From 4a3f3c93829e77afa58492963112e0312df7d7bf Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Thu, 10 Oct 2019 15:18:20 -0700 Subject: [PATCH 1/8] refactor: remove deprecated api field Signed-off-by: Erik Kieckhafer --- src/components/CartPopover/CartPopover.js | 4 ---- src/components/CartPopover/CartPopover.test.js | 1 - src/components/CheckoutSummary/CheckoutSummary.test.js | 2 -- src/components/OrderCard/OrderCard.test.js | 2 -- .../OrderCardFulfillmentGroup.test.js | 2 -- .../OrderFulfillmentGroup/OrderFulfillmentGroup.test.js | 2 -- src/components/OrderSummary/OrderSummary.test.js | 2 -- .../ProductDetailAddToCart/ProductDetailAddToCart.js | 1 - src/containers/cart/fragments.gql | 1 - src/lib/utils/cartItemsConnectionToArray.test.js | 4 ---- src/lib/utils/relayConnectionToArray.test.js | 4 ---- 11 files changed, 25 deletions(-) diff --git a/src/components/CartPopover/CartPopover.js b/src/components/CartPopover/CartPopover.js index fff48188e9..3846d65943 100644 --- a/src/components/CartPopover/CartPopover.js +++ b/src/components/CartPopover/CartPopover.js @@ -90,10 +90,6 @@ class CartPopover extends Component { */ value: PropTypes.string })), - /** - * Current stock quantity of item - */ - currentQuantity: PropTypes.number, /** * Image url of chosen item */ diff --git a/src/components/CartPopover/CartPopover.test.js b/src/components/CartPopover/CartPopover.test.js index 207dfa53c4..99b87d3121 100644 --- a/src/components/CartPopover/CartPopover.test.js +++ b/src/components/CartPopover/CartPopover.test.js @@ -16,7 +16,6 @@ const cartItem = { value: "Summer" } ], - currentQuantity: 10, imageUrl: "//placehold.it/100", isLowInventoryQuantity: false, price: { diff --git a/src/components/CheckoutSummary/CheckoutSummary.test.js b/src/components/CheckoutSummary/CheckoutSummary.test.js index 335a81fb7e..5f1ba90f89 100644 --- a/src/components/CheckoutSummary/CheckoutSummary.test.js +++ b/src/components/CheckoutSummary/CheckoutSummary.test.js @@ -28,7 +28,6 @@ const testCart = { compareAtPrice: { displayAmount: "$45.00" }, - currentQuantity: 3, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" @@ -48,7 +47,6 @@ const testCart = { { label: "Color", value: "Black" }, { label: "Size", value: "10" } ], - currentQuantity: 500, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" diff --git a/src/components/OrderCard/OrderCard.test.js b/src/components/OrderCard/OrderCard.test.js index faafbcd9d2..0d68ceeb7f 100644 --- a/src/components/OrderCard/OrderCard.test.js +++ b/src/components/OrderCard/OrderCard.test.js @@ -33,7 +33,6 @@ const order = { compareAtPrice: { displayAmount: "$45.00" }, - currentQuantity: 3, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" @@ -50,7 +49,6 @@ const order = { { _id: "456", attributes: [{ label: "Color", value: "Black" }, { label: "Size", value: "10" }], - currentQuantity: 500, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" diff --git a/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js b/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js index bbf915fbe9..a0d9608058 100644 --- a/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js +++ b/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js @@ -23,7 +23,6 @@ const testFulfillmentGroup = { compareAtPrice: { displayAmount: "$45.00" }, - currentQuantity: 3, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" @@ -40,7 +39,6 @@ const testFulfillmentGroup = { { _id: "456", attributes: [{ label: "Color", value: "Black" }, { label: "Size", value: "10" }], - currentQuantity: 500, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" diff --git a/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js b/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js index 9a4613fe00..664cf196fe 100644 --- a/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js +++ b/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js @@ -23,7 +23,6 @@ const testFulfillmentGroup = { compareAtPrice: { displayAmount: "$45.00" }, - currentQuantity: 3, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" @@ -40,7 +39,6 @@ const testFulfillmentGroup = { { _id: "456", attributes: [{ label: "Color", value: "Black" }, { label: "Size", value: "10" }], - currentQuantity: 500, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" diff --git a/src/components/OrderSummary/OrderSummary.test.js b/src/components/OrderSummary/OrderSummary.test.js index 59dd54ab09..7972fa5772 100644 --- a/src/components/OrderSummary/OrderSummary.test.js +++ b/src/components/OrderSummary/OrderSummary.test.js @@ -23,7 +23,6 @@ const testFulfillmentGroup = { compareAtPrice: { displayAmount: "$45.00" }, - currentQuantity: 3, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" @@ -40,7 +39,6 @@ const testFulfillmentGroup = { { _id: "456", attributes: [{ label: "Color", value: "Black" }, { label: "Size", value: "10" }], - currentQuantity: 500, imageURLs: { small: "//placehold.it/150", thumbnail: "//placehold.it/100" diff --git a/src/components/ProductDetailAddToCart/ProductDetailAddToCart.js b/src/components/ProductDetailAddToCart/ProductDetailAddToCart.js index b306cb5d95..ba57b4af0a 100644 --- a/src/components/ProductDetailAddToCart/ProductDetailAddToCart.js +++ b/src/components/ProductDetailAddToCart/ProductDetailAddToCart.js @@ -27,7 +27,6 @@ const cartItem = { value: "Summer" } ], - currentQuantity: 10, imageUrl: "//placehold.it/100", isLowInventoryQuantity: false, price: { diff --git a/src/containers/cart/fragments.gql b/src/containers/cart/fragments.gql index c9e1d16dfa..14d66e666b 100644 --- a/src/containers/cart/fragments.gql +++ b/src/containers/cart/fragments.gql @@ -197,7 +197,6 @@ fragment CartItemConnectionFragment on CartItemConnection { variantTitle optionTitle updatedAt - currentQuantity } } } diff --git a/src/lib/utils/cartItemsConnectionToArray.test.js b/src/lib/utils/cartItemsConnectionToArray.test.js index ad14f29f4b..dfab89071c 100644 --- a/src/lib/utils/cartItemsConnectionToArray.test.js +++ b/src/lib/utils/cartItemsConnectionToArray.test.js @@ -13,7 +13,6 @@ const cart = { small: "https://my.cdn.com/assets/files/Media/2oDhWDyk4qFsCZiAW/small/belle-HERO.png", thumbnail: "https://my.cdn.com/assets/files/Media/2oDhWDyk4qFsCZiAW/thumbnail/belle-HERO.png" }, - currentQuantity: null, optionTitle: "Red", productSlug: "basic-reaction-product", productType: "product-simple", @@ -30,7 +29,6 @@ const cart = { small: "https://my.cdn.com/assets/files/Media/mBSj5Fe8QgCKMCN4K/small/belle-HERO.png", thumbnail: "https://my.cdn.com/assets/files/Media/mBSj5Fe8QgCKMCN4K/thumbnail/belle-HERO.png" }, - currentQuantity: null, optionTitle: "Green", productSlug: "basic-reaction-product", productType: "product-simple", @@ -54,7 +52,6 @@ test("cartItemsConnectionToArray should convert a Relay style connection into a small: "https://my.cdn.com/assets/files/Media/2oDhWDyk4qFsCZiAW/small/belle-HERO.png", thumbnail: "https://my.cdn.com/assets/files/Media/2oDhWDyk4qFsCZiAW/thumbnail/belle-HERO.png" }, - currentQuantity: null, optionTitle: "Red", productSlug: "basic-reaction-product", productType: "product-simple", @@ -69,7 +66,6 @@ test("cartItemsConnectionToArray should convert a Relay style connection into a small: "https://my.cdn.com/assets/files/Media/mBSj5Fe8QgCKMCN4K/small/belle-HERO.png", thumbnail: "https://my.cdn.com/assets/files/Media/mBSj5Fe8QgCKMCN4K/thumbnail/belle-HERO.png" }, - currentQuantity: null, optionTitle: "Green", productSlug: "basic-reaction-product", productType: "product-simple", diff --git a/src/lib/utils/relayConnectionToArray.test.js b/src/lib/utils/relayConnectionToArray.test.js index f687c99de7..d004ef45e8 100644 --- a/src/lib/utils/relayConnectionToArray.test.js +++ b/src/lib/utils/relayConnectionToArray.test.js @@ -4,7 +4,6 @@ const items = { edges: [ { node: { - currentQuantity: null, optionTitle: "Red", productSlug: "basic-reaction-product", productType: "product-simple", @@ -14,7 +13,6 @@ const items = { }, { node: { - currentQuantity: null, optionTitle: "Green", productSlug: "basic-reaction-product", productType: "product-simple", @@ -30,7 +28,6 @@ test("relayConnectionToArray should convert a relay cursor connection to an arra const expected = [ { - currentQuantity: null, optionTitle: "Red", productSlug: "basic-reaction-product", productType: "product-simple", @@ -38,7 +35,6 @@ test("relayConnectionToArray should convert a relay cursor connection to an arra variantTitle: "Option 1 - Red Dwarf" }, { - currentQuantity: null, optionTitle: "Green", productSlug: "basic-reaction-product", productType: "product-simple", From be07cee98d0e9032fe938cc4cde6d7229dc5768a Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Fri, 11 Oct 2019 10:30:37 -0700 Subject: [PATCH 2/8] refactor: eradicate toGrid Signed-off-by: Erik Kieckhafer --- src/components/MediaGallery/MediaGallery.test.js | 2 -- src/components/MediaGalleryItem/MediaGalleryItem.test.js | 1 - .../ProductDetail/__mocks__/productData.mock.js | 8 -------- src/components/ProductGrid/__mocks__/products.mock.js | 2 -- .../ProductGrid/__snapshots__/ProductGrid.test.js.snap | 2 -- src/containers/catalog/catalogItemProduct.gql | 6 ------ src/lib/tracking/utils/getVariantTrackingData.test.js | 2 -- 7 files changed, 23 deletions(-) diff --git a/src/components/MediaGallery/MediaGallery.test.js b/src/components/MediaGallery/MediaGallery.test.js index 1a626cf6c1..47e5284957 100644 --- a/src/components/MediaGallery/MediaGallery.test.js +++ b/src/components/MediaGallery/MediaGallery.test.js @@ -4,7 +4,6 @@ import MediaGallery from "./MediaGallery"; const mediaItems = [ { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", @@ -17,7 +16,6 @@ const mediaItems = [ } }, { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", diff --git a/src/components/MediaGalleryItem/MediaGalleryItem.test.js b/src/components/MediaGalleryItem/MediaGalleryItem.test.js index d7cf36a985..6afd7d1341 100644 --- a/src/components/MediaGalleryItem/MediaGalleryItem.test.js +++ b/src/components/MediaGalleryItem/MediaGalleryItem.test.js @@ -3,7 +3,6 @@ import renderer from "react-test-renderer"; import MediaGalleryItem from "./MediaGalleryItem"; const media = { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", diff --git a/src/components/ProductDetail/__mocks__/productData.mock.js b/src/components/ProductDetail/__mocks__/productData.mock.js index 1f40b31c79..449ff7b7f1 100644 --- a/src/components/ProductDetail/__mocks__/productData.mock.js +++ b/src/components/ProductDetail/__mocks__/productData.mock.js @@ -168,7 +168,6 @@ export default { ], media: [ { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", @@ -181,7 +180,6 @@ export default { } }, { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", @@ -194,7 +192,6 @@ export default { } }, { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDpTTXI0cmhERm5ZdkZNdERUWA==", @@ -207,7 +204,6 @@ export default { } }, { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDpDSm9SQm05dlJyb3JjOW14Wg==", @@ -220,7 +216,6 @@ export default { } }, { - toGrid: 1, priority: 2, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", @@ -233,7 +228,6 @@ export default { } }, { - toGrid: 1, priority: 3, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", @@ -246,7 +240,6 @@ export default { } }, { - toGrid: 1, priority: 4, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", @@ -259,7 +252,6 @@ export default { } }, { - toGrid: 1, priority: 5, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", variantId: "cmVhY3Rpb24vcHJvZHVjdDo2cWlxUHdCa2VKZHRkUWM0Rw==", diff --git a/src/components/ProductGrid/__mocks__/products.mock.js b/src/components/ProductGrid/__mocks__/products.mock.js index f856db425a..b561cfec72 100644 --- a/src/components/ProductGrid/__mocks__/products.mock.js +++ b/src/components/ProductGrid/__mocks__/products.mock.js @@ -13,7 +13,6 @@ export default [ isSoldOut: true, isBackorder: false, primaryImage: { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpqbmE5NWthOWFOa015dG14aA==", URLs: { @@ -57,7 +56,6 @@ export default [ isSoldOut: false, isBackorder: false, primaryImage: { - toGrid: 1, priority: 0, productId: "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", URLs: { diff --git a/src/components/ProductGrid/__snapshots__/ProductGrid.test.js.snap b/src/components/ProductGrid/__snapshots__/ProductGrid.test.js.snap index 35d517c017..f99d2cfaa5 100644 --- a/src/components/ProductGrid/__snapshots__/ProductGrid.test.js.snap +++ b/src/components/ProductGrid/__snapshots__/ProductGrid.test.js.snap @@ -279,7 +279,6 @@ Array [ }, "priority": 0, "productId": "cmVhY3Rpb24vcHJvZHVjdDpqbmE5NWthOWFOa015dG14aA==", - "toGrid": 1, }, "slug": "men's-lightweigth-synchilla", "title": "Men's Lightweigth Synchilla", @@ -328,7 +327,6 @@ Details can be added below the image for more specific product information. }, "priority": 0, "productId": "cmVhY3Rpb24vcHJvZHVjdDpCQ1RNWjZIVHhGU3BwSkVTaw==", - "toGrid": 1, }, "slug": "example-product", "title": "Basic Reaction Product", diff --git a/src/containers/catalog/catalogItemProduct.gql b/src/containers/catalog/catalogItemProduct.gql index 073e7f9984..5090797a0b 100644 --- a/src/containers/catalog/catalogItemProduct.gql +++ b/src/containers/catalog/catalogItemProduct.gql @@ -39,13 +39,11 @@ query catalogItemProductQuery($slugOrId: String!) { small thumbnail } - toGrid priority productId variantId } media { - toGrid priority productId variantId @@ -107,7 +105,6 @@ query catalogItemProductQuery($slugOrId: String!) { isSoldOut isLowQuantity media { - toGrid priority productId variantId @@ -135,14 +132,12 @@ query catalogItemProductQuery($slugOrId: String!) { small thumbnail } - toGrid priority productId variantId } } media { - toGrid priority productId variantId @@ -170,7 +165,6 @@ query catalogItemProductQuery($slugOrId: String!) { small thumbnail } - toGrid priority productId variantId diff --git a/src/lib/tracking/utils/getVariantTrackingData.test.js b/src/lib/tracking/utils/getVariantTrackingData.test.js index 1ca796c923..19ff192adf 100644 --- a/src/lib/tracking/utils/getVariantTrackingData.test.js +++ b/src/lib/tracking/utils/getVariantTrackingData.test.js @@ -37,7 +37,6 @@ const product = { }, media: [ { - toGrid: 1, priority: 0, productId: "1001", variantId: "1002", @@ -46,7 +45,6 @@ const product = { } }, { - toGrid: 1, priority: 0, productId: "1001", variantId: "1003", From b3515e92bc525a1a3f0f076bdf12513b0d80b6ef Mon Sep 17 00:00:00 2001 From: Machiko Yasuda Date: Thu, 31 Oct 2019 11:31:58 -0700 Subject: [PATCH 3/8] chore: bump version for coordinated release Signed-off-by: Machiko Yasuda --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 137b4419bf..286181c6db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# v2.9.0 + +Example Storefront v2.9.0 is a minor update to keep this project in sync with [Reaction v2.9.0](https://github.com/reactioncommerce/reaction) and [reaction-hydra v2.9.0](https://github.com/reactioncommerce/reaction-hydra) + # v2.8.0 Example Storefront v2.8.0 is a minor update to keep this project in sync with [Reaction v2.8.0](https://github.com/reactioncommerce/reaction) and [reaction-hydra v2.8.0](https://github.com/reactioncommerce/reaction-hydra) diff --git a/package.json b/package.json index 2cd9c56a0e..0ac8436428 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "example-storefront", - "version": "2.8.0", + "version": "2.9.0", "description": "The Example Storefront serves as a reference for implementing a web based storefront using the Reaction Commerce GraphQL API.", "main": "./src/server.js", "keywords": [], From 157372df4a1285e18ceb3faff5b479c6fbbf1825 Mon Sep 17 00:00:00 2001 From: Eric Dobbertin Date: Wed, 6 Nov 2019 15:56:51 -0600 Subject: [PATCH 4/8] chore: add nvmrc file Signed-off-by: Eric Dobbertin --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000000..d19159826d --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +10.16.3 From c125a5fcbc57932c889b5c843ff63e0ae44ff5d5 Mon Sep 17 00:00:00 2001 From: Eric Dobbertin Date: Wed, 6 Nov 2019 15:57:13 -0600 Subject: [PATCH 5/8] fix: fixes for currentQuantity removal Signed-off-by: Eric Dobbertin --- .../CheckoutSummary/CheckoutSummary.test.js | 2 + src/components/OrderCard/OrderCard.test.js | 2 + .../OrderCardFulfillmentGroup.js | 9 ++- .../OrderCardFulfillmentGroup.test.js | 2 + .../OrderFulfillmentGroup.js | 9 ++- .../OrderFulfillmentGroup.test.js | 2 + .../ProductDetail/ProductDetail.test.js | 14 +++-- .../__snapshots__/ProductDetail.test.js.snap | 55 +++++++++++++++---- src/lib/utils/cartItemsConnectionToArray.js | 4 ++ 9 files changed, 82 insertions(+), 17 deletions(-) diff --git a/src/components/CheckoutSummary/CheckoutSummary.test.js b/src/components/CheckoutSummary/CheckoutSummary.test.js index 5f1ba90f89..03ffeb64ed 100644 --- a/src/components/CheckoutSummary/CheckoutSummary.test.js +++ b/src/components/CheckoutSummary/CheckoutSummary.test.js @@ -32,6 +32,7 @@ const testCart = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + currentQuantity: 3, isLowQuantity: true, price: { displayAmount: "$20.00" @@ -51,6 +52,7 @@ const testCart = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + currentQuantity: 30, isLowQuantity: false, price: { displayAmount: "$78.00" diff --git a/src/components/OrderCard/OrderCard.test.js b/src/components/OrderCard/OrderCard.test.js index 0d68ceeb7f..eab096b327 100644 --- a/src/components/OrderCard/OrderCard.test.js +++ b/src/components/OrderCard/OrderCard.test.js @@ -37,6 +37,7 @@ const order = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + inventoryAvailableToSell: 3, isLowQuantity: true, price: { displayAmount: "$20.00" @@ -53,6 +54,7 @@ const order = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + inventoryAvailableToSell: 30, isLowQuantity: false, price: { displayAmount: "$78.00" diff --git a/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.js b/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.js index 4567cee318..bbd7189c87 100644 --- a/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.js +++ b/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.js @@ -70,12 +70,19 @@ class OrderCardFulfillmentGroup extends Component { const { classes, fulfillmentGroup } = this.props; if (fulfillmentGroup && Array.isArray(fulfillmentGroup.items.nodes)) { + const items = fulfillmentGroup.items.nodes.map((item) => ({ + ...item, + // Backwards compatibility until all component library components are updated + // to accept `inventoryAvailableToSell`. + currentQuantity: item.currentQuantity || item.inventoryAvailableToSell + })); + return ( ); diff --git a/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js b/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js index a0d9608058..821e3adaee 100644 --- a/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js +++ b/src/components/OrderCardFulfillmentGroup/OrderCardFulfillmentGroup.test.js @@ -27,6 +27,7 @@ const testFulfillmentGroup = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + inventoryAvailableToSell: 3, isLowQuantity: true, price: { displayAmount: "$20.00" @@ -43,6 +44,7 @@ const testFulfillmentGroup = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + inventoryAvailableToSell: 30, isLowQuantity: false, price: { displayAmount: "$78.00" diff --git a/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.js b/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.js index 0e9aa2e2b5..4beda9e207 100644 --- a/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.js +++ b/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.js @@ -67,6 +67,13 @@ class OrderFulfillmentGroup extends Component { const { classes, fulfillmentGroup, hasMoreCartItems, loadMoreCartItems } = this.props; if (fulfillmentGroup && Array.isArray(fulfillmentGroup.items.nodes)) { + const items = fulfillmentGroup.items.nodes.map((item) => ({ + ...item, + // Backwards compatibility until all component library components are updated + // to accept `inventoryAvailableToSell`. + currentQuantity: item.currentQuantity || item.inventoryAvailableToSell + })); + return (
@@ -75,7 +82,7 @@ class OrderFulfillmentGroup extends Component { isReadOnly hasMoreCartItems={hasMoreCartItems} onLoadMoreCartItems={loadMoreCartItems} - items={fulfillmentGroup.items.nodes} + items={items} onChangeCartItemQuantity={this.handleItemQuantityChange} onRemoveItemFromCart={this.handleRemoveItem} /> diff --git a/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js b/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js index 664cf196fe..a1df7340e0 100644 --- a/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js +++ b/src/components/OrderFulfillmentGroup/OrderFulfillmentGroup.test.js @@ -27,6 +27,7 @@ const testFulfillmentGroup = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + inventoryAvailableToSell: 3, isLowQuantity: true, price: { displayAmount: "$20.00" @@ -43,6 +44,7 @@ const testFulfillmentGroup = { small: "//placehold.it/150", thumbnail: "//placehold.it/100" }, + inventoryAvailableToSell: 30, isLowQuantity: false, price: { displayAmount: "$78.00" diff --git a/src/components/ProductDetail/ProductDetail.test.js b/src/components/ProductDetail/ProductDetail.test.js index d84dcc53be..3f267c7035 100644 --- a/src/components/ProductDetail/ProductDetail.test.js +++ b/src/components/ProductDetail/ProductDetail.test.js @@ -2,6 +2,8 @@ import React from "react"; import renderer from "react-test-renderer"; import { MuiThemeProvider } from "@material-ui/core/styles"; import { Provider } from "mobx-react"; +import { ComponentsProvider } from "@reactioncommerce/components-context"; +import components from "custom/componentsContext"; import theme from "custom/reactionTheme"; import ProductDetail from "./ProductDetail"; import sampleData from "./__mocks__/productData.mock"; @@ -43,11 +45,13 @@ const uiStore = { test("basic snapshot", () => { const component = renderer.create(( - - - - - + + + + + + + )); const tree = component.toJSON(); expect(tree).toMatchSnapshot(); diff --git a/src/components/ProductDetail/__snapshots__/ProductDetail.test.js.snap b/src/components/ProductDetail/__snapshots__/ProductDetail.test.js.snap index 1f16812dda..0d6581e910 100644 --- a/src/components/ProductDetail/__snapshots__/ProductDetail.test.js.snap +++ b/src/components/ProductDetail/__snapshots__/ProductDetail.test.js.snap @@ -1,6 +1,20 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`basic snapshot 1`] = ` +.c7 { + width: 1.125em; + height: 1.125em; +} + +.c2 { + position: relative; + opacity: 0.5; +} + +.c3 { + position: relative; +} + .c5 { -webkit-font-smoothing: antialiased; -webkit-align-items: center; @@ -68,15 +82,6 @@ exports[`basic snapshot 1`] = ` fill: #ffffff; } -.c2 { - position: relative; - opacity: 0.5; -} - -.c3 { - position: relative; -} - .c4 { -webkit-font-smoothing: antialiased; color: #cd3f4c; @@ -921,7 +926,37 @@ Details can be added below the image for more specific product information. "width": 0, } } - /> + > + + + + + +
diff --git a/src/lib/utils/cartItemsConnectionToArray.js b/src/lib/utils/cartItemsConnectionToArray.js index 376290f7fb..e01a20b18b 100644 --- a/src/lib/utils/cartItemsConnectionToArray.js +++ b/src/lib/utils/cartItemsConnectionToArray.js @@ -18,6 +18,10 @@ export default function cartItemsConnectionToArray(cartItemsConnection) { // Make a copy to be able to mutate const item = { ...node }; + // Backwards compatibility until all component library components are updated + // to accept `inventoryAvailableToSell`. + item.currentQuantity = item.currentQuantity || item.inventoryAvailableToSell; + return item; }); } From 0e88ec1f357e437d142cadc01bee6dca77ff69e2 Mon Sep 17 00:00:00 2001 From: Wiston Mwinzi Date: Mon, 11 Nov 2019 21:03:11 +0300 Subject: [PATCH 6/8] enhanced create gitops pull request job Signed-off-by: Wiston Mwinzi --- .circleci/config.yml | 49 ++++++++------------------------------------ 1 file changed, 9 insertions(+), 40 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 52fc14279f..321807949c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,18 +10,14 @@ version: 2 # typing. See http://yaml.org/type/merge.html for details. defaults: &defaults environment: - CI_SCRIPTS: 'npx --quiet --package @reactioncommerce/ci-scripts@1.6.2' - DOCKER_REPOSITORY: "reactioncommerce/example-storefront" - DOCKER_NAMESPACE: "reactioncommerce" - DOCKER_NAME: "example-storefront" - GLOBAL_CACHE_VERSION: "v3" - KUSTOMIZE_VERSION: "3.2.1" - HUB_VERSION: "2.12.8" - GH_USERNAME: "rc-circleci" - GH_EMAIL: "circleci@reactioncommerce.com" - REACTION_GITOPS_REVIEWERS: "griggheo" + - CI_SCRIPTS: "npx --quiet --package @reactioncommerce/ci-scripts@1.9.1" + - DOCKER_REPOSITORY: "reactioncommerce/example-storefront" + - DOCKER_NAME: "example-storefront" + - GLOBAL_CACHE_VERSION: “v3” + - SERVICE: "reaction-storefront" + - REACTION_GITOPS_REVIEWERS: "wistonk,griggheo" docker: - - image: circleci/node:12.11.1-stretch + - image: circleci/node:12-stretch jobs: install-dependencies: @@ -94,35 +90,7 @@ jobs: - run: name: Clone reaction-gitops repo and create PR command: | - # Download kustomize - cd /tmp - wget https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_kustomize.v${KUSTOMIZE_VERSION}_linux_amd64 - sudo mv kustomize_kustomize.v${KUSTOMIZE_VERSION}_linux_amd64 /usr/local/bin/kustomize - sudo chmod +x /usr/local/bin/kustomize - # Download hub - wget https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz - tar xfz hub-linux-amd64-${HUB_VERSION}.tgz - sudo mv hub-linux-amd64-${HUB_VERSION}/bin/hub /usr/local/bin/hub - sudo chmod +x /usr/local/bin/hub - # Clone reaction-gitops repo and configure username and email for signing off commits - export GITHUB_TOKEN="${REACTION_GITOPS_GH_TOKEN}" - /usr/local/bin/hub clone https://${GITHUB_TOKEN}@github.com/reactioncommerce/reaction-gitops.git - cd reaction-gitops - /usr/local/bin/hub config user.name "${GH_USERNAME}" - /usr/local/bin/hub config user.email "${GH_EMAIL}" - cd kustomize/reaction-storefront/overlays/staging - # Create new branch - /usr/local/bin/hub checkout -b update-image-reaction-storefront-${CIRCLE_SHA1} - # Modify image tag in kustomization.yaml by calling 'kustomize edit set image' - /usr/local/bin/kustomize edit set image docker.io/${DOCKER_REPOSITORY}:${CIRCLE_SHA1} - /usr/local/bin/hub add kustomization.yaml - # Commit with sign-off - /usr/local/bin/hub commit -s -m "changed reaction-storefront image tag to ${CIRCLE_SHA1}" - # Push branch to origin - /usr/local/bin/hub push --set-upstream origin update-image-reaction-storefront-${CIRCLE_SHA1} - # Create PR - /usr/local/bin/hub pull-request --no-edit -r ${REACTION_GITOPS_REVIEWERS} - + ${CI_SCRIPTS} automate-gitops-pull-request workflows: version: 2 build_and_test: @@ -144,6 +112,7 @@ workflows: - eslint - test-unit - create-gitops-pull-request: + context: reaction-gitops requires: - docker-build-push filters: From c78b5a30cae8b0a166a214aef18e9462b7a15282 Mon Sep 17 00:00:00 2001 From: Ross Hadden Date: Wed, 13 Nov 2019 17:15:32 -0500 Subject: [PATCH 7/8] Revert "release v2.9.0" Signed-off-by: Ross Hadden --- CHANGELOG.md | 4 ---- package.json | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 286181c6db..137b4419bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,3 @@ -# v2.9.0 - -Example Storefront v2.9.0 is a minor update to keep this project in sync with [Reaction v2.9.0](https://github.com/reactioncommerce/reaction) and [reaction-hydra v2.9.0](https://github.com/reactioncommerce/reaction-hydra) - # v2.8.0 Example Storefront v2.8.0 is a minor update to keep this project in sync with [Reaction v2.8.0](https://github.com/reactioncommerce/reaction) and [reaction-hydra v2.8.0](https://github.com/reactioncommerce/reaction-hydra) diff --git a/package.json b/package.json index 0ac8436428..2cd9c56a0e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "example-storefront", - "version": "2.9.0", + "version": "2.8.0", "description": "The Example Storefront serves as a reference for implementing a web based storefront using the Reaction Commerce GraphQL API.", "main": "./src/server.js", "keywords": [], From 1ebb97d0840fc4fc99fa64cbba1f1fcaff16e14c Mon Sep 17 00:00:00 2001 From: Erik Kieckhafer Date: Wed, 13 Nov 2019 14:27:58 -0800 Subject: [PATCH 8/8] chore: version 2.9.0 Signed-off-by: Erik Kieckhafer --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 137b4419bf..942b6aa279 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# v2.9.0 + +Example Storefront v2.9.0 is a minor update to keep this project in sync with [Reaction v2.9.0](https://github.com/reactioncommerce/reaction) and [reaction-hydra v2.9.0](https://github.com/reactioncommerce/reaction-hydra) + +# v2.8.1 + +Example Storefront v2.8.1 is a patch update to keep this project in sync with [Reaction v2.8.1](https://github.com/reactioncommerce/reaction) and [reaction-hydra v2.8.1](https://github.com/reactioncommerce/reaction-hydra) + # v2.8.0 Example Storefront v2.8.0 is a minor update to keep this project in sync with [Reaction v2.8.0](https://github.com/reactioncommerce/reaction) and [reaction-hydra v2.8.0](https://github.com/reactioncommerce/reaction-hydra) diff --git a/package.json b/package.json index 2cd9c56a0e..0ac8436428 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "example-storefront", - "version": "2.8.0", + "version": "2.9.0", "description": "The Example Storefront serves as a reference for implementing a web based storefront using the Reaction Commerce GraphQL API.", "main": "./src/server.js", "keywords": [],