@shopify/hydrogen-react 0.0.0-next-5c16c78 → 0.0.0-next-ea3959b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-dev/AddToCartButton.mjs +43 -40
- package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
- package/dist/browser-dev/BaseButton.mjs +13 -15
- package/dist/browser-dev/BaseButton.mjs.map +1 -1
- package/dist/browser-dev/BuyNowButton.mjs +19 -17
- package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
- package/dist/browser-dev/CartCheckoutButton.mjs +12 -15
- package/dist/browser-dev/CartCheckoutButton.mjs.map +1 -1
- package/dist/browser-dev/CartProvider.mjs +73 -67
- package/dist/browser-dev/CartProvider.mjs.map +1 -1
- package/dist/browser-dev/ExternalVideo.mjs +13 -11
- package/dist/browser-dev/ExternalVideo.mjs.map +1 -1
- package/dist/browser-dev/Image.mjs +41 -30
- package/dist/browser-dev/Image.mjs.map +1 -1
- package/dist/browser-dev/MediaFile.mjs +29 -21
- package/dist/browser-dev/MediaFile.mjs.map +1 -1
- package/dist/browser-dev/ModelViewer.mjs +138 -76
- package/dist/browser-dev/ModelViewer.mjs.map +1 -1
- package/dist/browser-dev/Money.mjs +12 -9
- package/dist/browser-dev/Money.mjs.map +1 -1
- package/dist/browser-dev/ProductPrice.mjs +12 -17
- package/dist/browser-dev/ProductPrice.mjs.map +1 -1
- package/dist/browser-dev/ProductProvider.mjs +102 -73
- package/dist/browser-dev/ProductProvider.mjs.map +1 -1
- package/dist/browser-dev/ShopPayButton.mjs +4 -14
- package/dist/browser-dev/ShopPayButton.mjs.map +1 -1
- package/dist/browser-dev/ShopifyProvider.mjs +20 -15
- package/dist/browser-dev/ShopifyProvider.mjs.map +1 -1
- package/dist/browser-dev/Video.mjs +30 -21
- package/dist/browser-dev/Video.mjs.map +1 -1
- package/dist/browser-dev/_virtual/index.mjs +11 -2
- package/dist/browser-dev/_virtual/index.mjs.map +1 -1
- package/dist/browser-dev/_virtual/with-selector.mjs +11 -2
- package/dist/browser-dev/_virtual/with-selector.mjs.map +1 -1
- package/dist/browser-dev/cart-hooks.mjs +31 -34
- package/dist/browser-dev/cart-hooks.mjs.map +1 -1
- package/dist/browser-dev/cart-queries.mjs +50 -20
- package/dist/browser-dev/cart-queries.mjs.map +1 -1
- package/dist/browser-dev/codegen.helpers.mjs +1 -0
- package/dist/browser-dev/codegen.helpers.mjs.map +1 -1
- package/dist/browser-dev/image-size.mjs +8 -8
- package/dist/browser-dev/image-size.mjs.map +1 -1
- package/dist/browser-dev/load-script.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs +2 -2
- package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs +3 -3
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
- package/dist/browser-dev/parse-metafield.mjs +4 -5
- package/dist/browser-dev/parse-metafield.mjs.map +1 -1
- package/dist/browser-dev/storefront-client.mjs +8 -10
- package/dist/browser-dev/storefront-client.mjs.map +1 -1
- package/dist/browser-dev/useCartAPIStateMachine.mjs +111 -80
- package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-dev/useCartActions.mjs +150 -109
- package/dist/browser-dev/useCartActions.mjs.map +1 -1
- package/dist/browser-dev/useMoney.mjs +61 -36
- package/dist/browser-dev/useMoney.mjs.map +1 -1
- package/dist/browser-prod/AddToCartButton.mjs +43 -40
- package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
- package/dist/browser-prod/BaseButton.mjs +13 -15
- package/dist/browser-prod/BaseButton.mjs.map +1 -1
- package/dist/browser-prod/BuyNowButton.mjs +19 -17
- package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
- package/dist/browser-prod/CartCheckoutButton.mjs +12 -15
- package/dist/browser-prod/CartCheckoutButton.mjs.map +1 -1
- package/dist/browser-prod/CartProvider.mjs +73 -67
- package/dist/browser-prod/CartProvider.mjs.map +1 -1
- package/dist/browser-prod/ExternalVideo.mjs +13 -11
- package/dist/browser-prod/ExternalVideo.mjs.map +1 -1
- package/dist/browser-prod/Image.mjs +35 -28
- package/dist/browser-prod/Image.mjs.map +1 -1
- package/dist/browser-prod/MediaFile.mjs +29 -21
- package/dist/browser-prod/MediaFile.mjs.map +1 -1
- package/dist/browser-prod/ModelViewer.mjs +135 -75
- package/dist/browser-prod/ModelViewer.mjs.map +1 -1
- package/dist/browser-prod/Money.mjs +12 -9
- package/dist/browser-prod/Money.mjs.map +1 -1
- package/dist/browser-prod/ProductPrice.mjs +12 -17
- package/dist/browser-prod/ProductPrice.mjs.map +1 -1
- package/dist/browser-prod/ProductProvider.mjs +102 -73
- package/dist/browser-prod/ProductProvider.mjs.map +1 -1
- package/dist/browser-prod/ShopPayButton.mjs +4 -14
- package/dist/browser-prod/ShopPayButton.mjs.map +1 -1
- package/dist/browser-prod/ShopifyProvider.mjs +17 -14
- package/dist/browser-prod/ShopifyProvider.mjs.map +1 -1
- package/dist/browser-prod/Video.mjs +30 -21
- package/dist/browser-prod/Video.mjs.map +1 -1
- package/dist/browser-prod/_virtual/index.mjs +11 -2
- package/dist/browser-prod/_virtual/index.mjs.map +1 -1
- package/dist/browser-prod/_virtual/with-selector.mjs +11 -2
- package/dist/browser-prod/_virtual/with-selector.mjs.map +1 -1
- package/dist/browser-prod/cart-hooks.mjs +31 -34
- package/dist/browser-prod/cart-hooks.mjs.map +1 -1
- package/dist/browser-prod/cart-queries.mjs +50 -20
- package/dist/browser-prod/cart-queries.mjs.map +1 -1
- package/dist/browser-prod/codegen.helpers.mjs +1 -0
- package/dist/browser-prod/codegen.helpers.mjs.map +1 -1
- package/dist/browser-prod/image-size.mjs +8 -8
- package/dist/browser-prod/image-size.mjs.map +1 -1
- package/dist/browser-prod/load-script.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs +2 -2
- package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs +3 -3
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
- package/dist/browser-prod/parse-metafield.mjs +4 -5
- package/dist/browser-prod/parse-metafield.mjs.map +1 -1
- package/dist/browser-prod/storefront-client.mjs +8 -10
- package/dist/browser-prod/storefront-client.mjs.map +1 -1
- package/dist/browser-prod/useCartAPIStateMachine.mjs +111 -80
- package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-prod/useCartActions.mjs +150 -109
- package/dist/browser-prod/useCartActions.mjs.map +1 -1
- package/dist/browser-prod/useMoney.mjs +61 -36
- package/dist/browser-prod/useMoney.mjs.map +1 -1
- package/dist/node-dev/AddToCartButton.js +44 -41
- package/dist/node-dev/AddToCartButton.js.map +1 -1
- package/dist/node-dev/AddToCartButton.mjs +43 -40
- package/dist/node-dev/AddToCartButton.mjs.map +1 -1
- package/dist/node-dev/BaseButton.js +14 -16
- package/dist/node-dev/BaseButton.js.map +1 -1
- package/dist/node-dev/BaseButton.mjs +13 -15
- package/dist/node-dev/BaseButton.mjs.map +1 -1
- package/dist/node-dev/BuyNowButton.js +20 -18
- package/dist/node-dev/BuyNowButton.js.map +1 -1
- package/dist/node-dev/BuyNowButton.mjs +19 -17
- package/dist/node-dev/BuyNowButton.mjs.map +1 -1
- package/dist/node-dev/CartCheckoutButton.js +13 -16
- package/dist/node-dev/CartCheckoutButton.js.map +1 -1
- package/dist/node-dev/CartCheckoutButton.mjs +12 -15
- package/dist/node-dev/CartCheckoutButton.mjs.map +1 -1
- package/dist/node-dev/CartProvider.js +74 -68
- package/dist/node-dev/CartProvider.js.map +1 -1
- package/dist/node-dev/CartProvider.mjs +73 -67
- package/dist/node-dev/CartProvider.mjs.map +1 -1
- package/dist/node-dev/ExternalVideo.js +14 -12
- package/dist/node-dev/ExternalVideo.js.map +1 -1
- package/dist/node-dev/ExternalVideo.mjs +13 -11
- package/dist/node-dev/ExternalVideo.mjs.map +1 -1
- package/dist/node-dev/Image.js +42 -31
- package/dist/node-dev/Image.js.map +1 -1
- package/dist/node-dev/Image.mjs +41 -30
- package/dist/node-dev/Image.mjs.map +1 -1
- package/dist/node-dev/MediaFile.js +30 -22
- package/dist/node-dev/MediaFile.js.map +1 -1
- package/dist/node-dev/MediaFile.mjs +29 -21
- package/dist/node-dev/MediaFile.mjs.map +1 -1
- package/dist/node-dev/ModelViewer.js +139 -77
- package/dist/node-dev/ModelViewer.js.map +1 -1
- package/dist/node-dev/ModelViewer.mjs +138 -76
- package/dist/node-dev/ModelViewer.mjs.map +1 -1
- package/dist/node-dev/Money.js +13 -10
- package/dist/node-dev/Money.js.map +1 -1
- package/dist/node-dev/Money.mjs +12 -9
- package/dist/node-dev/Money.mjs.map +1 -1
- package/dist/node-dev/ProductPrice.js +13 -18
- package/dist/node-dev/ProductPrice.js.map +1 -1
- package/dist/node-dev/ProductPrice.mjs +12 -17
- package/dist/node-dev/ProductPrice.mjs.map +1 -1
- package/dist/node-dev/ProductProvider.js +103 -74
- package/dist/node-dev/ProductProvider.js.map +1 -1
- package/dist/node-dev/ProductProvider.mjs +102 -73
- package/dist/node-dev/ProductProvider.mjs.map +1 -1
- package/dist/node-dev/ShopPayButton.js +5 -15
- package/dist/node-dev/ShopPayButton.js.map +1 -1
- package/dist/node-dev/ShopPayButton.mjs +4 -14
- package/dist/node-dev/ShopPayButton.mjs.map +1 -1
- package/dist/node-dev/ShopifyProvider.js +21 -16
- package/dist/node-dev/ShopifyProvider.js.map +1 -1
- package/dist/node-dev/ShopifyProvider.mjs +20 -15
- package/dist/node-dev/ShopifyProvider.mjs.map +1 -1
- package/dist/node-dev/Video.js +31 -22
- package/dist/node-dev/Video.js.map +1 -1
- package/dist/node-dev/Video.mjs +30 -21
- package/dist/node-dev/Video.mjs.map +1 -1
- package/dist/node-dev/_virtual/index.js +11 -3
- package/dist/node-dev/_virtual/index.js.map +1 -1
- package/dist/node-dev/_virtual/index.mjs +11 -2
- package/dist/node-dev/_virtual/index.mjs.map +1 -1
- package/dist/node-dev/_virtual/use-sync-external-store-shim.development.js +1 -1
- package/dist/node-dev/_virtual/use-sync-external-store-shim.production.min.js +1 -1
- package/dist/node-dev/_virtual/with-selector.development.js +1 -1
- package/dist/node-dev/_virtual/with-selector.js +11 -3
- package/dist/node-dev/_virtual/with-selector.js.map +1 -1
- package/dist/node-dev/_virtual/with-selector.mjs +11 -2
- package/dist/node-dev/_virtual/with-selector.mjs.map +1 -1
- package/dist/node-dev/_virtual/with-selector.production.min.js +1 -1
- package/dist/node-dev/cart-constants.js +1 -1
- package/dist/node-dev/cart-hooks.js +32 -35
- package/dist/node-dev/cart-hooks.js.map +1 -1
- package/dist/node-dev/cart-hooks.mjs +31 -34
- package/dist/node-dev/cart-hooks.mjs.map +1 -1
- package/dist/node-dev/cart-queries.js +51 -21
- package/dist/node-dev/cart-queries.js.map +1 -1
- package/dist/node-dev/cart-queries.mjs +50 -20
- package/dist/node-dev/cart-queries.mjs.map +1 -1
- package/dist/node-dev/codegen.helpers.js +2 -1
- package/dist/node-dev/codegen.helpers.js.map +1 -1
- package/dist/node-dev/codegen.helpers.mjs +1 -0
- package/dist/node-dev/codegen.helpers.mjs.map +1 -1
- package/dist/node-dev/flatten-connection.js +1 -1
- package/dist/node-dev/image-size.js +9 -9
- package/dist/node-dev/image-size.js.map +1 -1
- package/dist/node-dev/image-size.mjs +8 -8
- package/dist/node-dev/image-size.mjs.map +1 -1
- package/dist/node-dev/index.js +1 -1
- package/dist/node-dev/load-script.js +1 -1
- package/dist/node-dev/load-script.js.map +1 -1
- package/dist/node-dev/load-script.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.js +1 -1
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.js +2 -2
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs +2 -2
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js +2 -4
- package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +2 -4
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2 -4
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +2 -4
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +2 -4
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js +4 -4
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs +3 -3
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
- package/dist/node-dev/parse-metafield.js +5 -6
- package/dist/node-dev/parse-metafield.js.map +1 -1
- package/dist/node-dev/parse-metafield.mjs +4 -5
- package/dist/node-dev/parse-metafield.mjs.map +1 -1
- package/dist/node-dev/storefront-api-constants.js +1 -1
- package/dist/node-dev/storefront-client.js +9 -11
- package/dist/node-dev/storefront-client.js.map +1 -1
- package/dist/node-dev/storefront-client.mjs +8 -10
- package/dist/node-dev/storefront-client.mjs.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.js +112 -81
- package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.mjs +111 -80
- package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-dev/useCartActions.js +151 -110
- package/dist/node-dev/useCartActions.js.map +1 -1
- package/dist/node-dev/useCartActions.mjs +150 -109
- package/dist/node-dev/useCartActions.mjs.map +1 -1
- package/dist/node-dev/useMoney.js +62 -37
- package/dist/node-dev/useMoney.js.map +1 -1
- package/dist/node-dev/useMoney.mjs +61 -36
- package/dist/node-dev/useMoney.mjs.map +1 -1
- package/dist/node-prod/AddToCartButton.js +44 -41
- package/dist/node-prod/AddToCartButton.js.map +1 -1
- package/dist/node-prod/AddToCartButton.mjs +43 -40
- package/dist/node-prod/AddToCartButton.mjs.map +1 -1
- package/dist/node-prod/BaseButton.js +14 -16
- package/dist/node-prod/BaseButton.js.map +1 -1
- package/dist/node-prod/BaseButton.mjs +13 -15
- package/dist/node-prod/BaseButton.mjs.map +1 -1
- package/dist/node-prod/BuyNowButton.js +20 -18
- package/dist/node-prod/BuyNowButton.js.map +1 -1
- package/dist/node-prod/BuyNowButton.mjs +19 -17
- package/dist/node-prod/BuyNowButton.mjs.map +1 -1
- package/dist/node-prod/CartCheckoutButton.js +13 -16
- package/dist/node-prod/CartCheckoutButton.js.map +1 -1
- package/dist/node-prod/CartCheckoutButton.mjs +12 -15
- package/dist/node-prod/CartCheckoutButton.mjs.map +1 -1
- package/dist/node-prod/CartProvider.js +74 -68
- package/dist/node-prod/CartProvider.js.map +1 -1
- package/dist/node-prod/CartProvider.mjs +73 -67
- package/dist/node-prod/CartProvider.mjs.map +1 -1
- package/dist/node-prod/ExternalVideo.js +14 -12
- package/dist/node-prod/ExternalVideo.js.map +1 -1
- package/dist/node-prod/ExternalVideo.mjs +13 -11
- package/dist/node-prod/ExternalVideo.mjs.map +1 -1
- package/dist/node-prod/Image.js +36 -29
- package/dist/node-prod/Image.js.map +1 -1
- package/dist/node-prod/Image.mjs +35 -28
- package/dist/node-prod/Image.mjs.map +1 -1
- package/dist/node-prod/MediaFile.js +30 -22
- package/dist/node-prod/MediaFile.js.map +1 -1
- package/dist/node-prod/MediaFile.mjs +29 -21
- package/dist/node-prod/MediaFile.mjs.map +1 -1
- package/dist/node-prod/ModelViewer.js +136 -76
- package/dist/node-prod/ModelViewer.js.map +1 -1
- package/dist/node-prod/ModelViewer.mjs +135 -75
- package/dist/node-prod/ModelViewer.mjs.map +1 -1
- package/dist/node-prod/Money.js +13 -10
- package/dist/node-prod/Money.js.map +1 -1
- package/dist/node-prod/Money.mjs +12 -9
- package/dist/node-prod/Money.mjs.map +1 -1
- package/dist/node-prod/ProductPrice.js +13 -18
- package/dist/node-prod/ProductPrice.js.map +1 -1
- package/dist/node-prod/ProductPrice.mjs +12 -17
- package/dist/node-prod/ProductPrice.mjs.map +1 -1
- package/dist/node-prod/ProductProvider.js +103 -74
- package/dist/node-prod/ProductProvider.js.map +1 -1
- package/dist/node-prod/ProductProvider.mjs +102 -73
- package/dist/node-prod/ProductProvider.mjs.map +1 -1
- package/dist/node-prod/ShopPayButton.js +5 -15
- package/dist/node-prod/ShopPayButton.js.map +1 -1
- package/dist/node-prod/ShopPayButton.mjs +4 -14
- package/dist/node-prod/ShopPayButton.mjs.map +1 -1
- package/dist/node-prod/ShopifyProvider.js +18 -15
- package/dist/node-prod/ShopifyProvider.js.map +1 -1
- package/dist/node-prod/ShopifyProvider.mjs +17 -14
- package/dist/node-prod/ShopifyProvider.mjs.map +1 -1
- package/dist/node-prod/Video.js +31 -22
- package/dist/node-prod/Video.js.map +1 -1
- package/dist/node-prod/Video.mjs +30 -21
- package/dist/node-prod/Video.mjs.map +1 -1
- package/dist/node-prod/_virtual/index.js +11 -3
- package/dist/node-prod/_virtual/index.js.map +1 -1
- package/dist/node-prod/_virtual/index.mjs +11 -2
- package/dist/node-prod/_virtual/index.mjs.map +1 -1
- package/dist/node-prod/_virtual/use-sync-external-store-shim.development.js +1 -1
- package/dist/node-prod/_virtual/use-sync-external-store-shim.production.min.js +1 -1
- package/dist/node-prod/_virtual/with-selector.development.js +1 -1
- package/dist/node-prod/_virtual/with-selector.js +11 -3
- package/dist/node-prod/_virtual/with-selector.js.map +1 -1
- package/dist/node-prod/_virtual/with-selector.mjs +11 -2
- package/dist/node-prod/_virtual/with-selector.mjs.map +1 -1
- package/dist/node-prod/_virtual/with-selector.production.min.js +1 -1
- package/dist/node-prod/cart-constants.js +1 -1
- package/dist/node-prod/cart-hooks.js +32 -35
- package/dist/node-prod/cart-hooks.js.map +1 -1
- package/dist/node-prod/cart-hooks.mjs +31 -34
- package/dist/node-prod/cart-hooks.mjs.map +1 -1
- package/dist/node-prod/cart-queries.js +51 -21
- package/dist/node-prod/cart-queries.js.map +1 -1
- package/dist/node-prod/cart-queries.mjs +50 -20
- package/dist/node-prod/cart-queries.mjs.map +1 -1
- package/dist/node-prod/codegen.helpers.js +2 -1
- package/dist/node-prod/codegen.helpers.js.map +1 -1
- package/dist/node-prod/codegen.helpers.mjs +1 -0
- package/dist/node-prod/codegen.helpers.mjs.map +1 -1
- package/dist/node-prod/flatten-connection.js +1 -1
- package/dist/node-prod/image-size.js +9 -9
- package/dist/node-prod/image-size.js.map +1 -1
- package/dist/node-prod/image-size.mjs +8 -8
- package/dist/node-prod/image-size.mjs.map +1 -1
- package/dist/node-prod/index.js +1 -1
- package/dist/node-prod/load-script.js +1 -1
- package/dist/node-prod/load-script.js.map +1 -1
- package/dist/node-prod/load-script.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.js +1 -1
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.js +2 -2
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs +2 -2
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js +2 -4
- package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +2 -4
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +2 -4
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +2 -4
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +2 -4
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js +4 -4
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs +3 -3
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +1 -1
- package/dist/node-prod/parse-metafield.js +5 -6
- package/dist/node-prod/parse-metafield.js.map +1 -1
- package/dist/node-prod/parse-metafield.mjs +4 -5
- package/dist/node-prod/parse-metafield.mjs.map +1 -1
- package/dist/node-prod/storefront-api-constants.js +1 -1
- package/dist/node-prod/storefront-client.js +9 -11
- package/dist/node-prod/storefront-client.js.map +1 -1
- package/dist/node-prod/storefront-client.mjs +8 -10
- package/dist/node-prod/storefront-client.mjs.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.js +112 -81
- package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.mjs +111 -80
- package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-prod/useCartActions.js +151 -110
- package/dist/node-prod/useCartActions.js.map +1 -1
- package/dist/node-prod/useCartActions.mjs +150 -109
- package/dist/node-prod/useCartActions.mjs.map +1 -1
- package/dist/node-prod/useMoney.js +62 -37
- package/dist/node-prod/useMoney.js.map +1 -1
- package/dist/node-prod/useMoney.mjs +61 -36
- package/dist/node-prod/useMoney.mjs.map +1 -1
- package/dist/types/parse-metafield.d.ts +1 -1
- package/dist/umd/hydrogen-react.dev.js +994 -880
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +16 -16
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +13 -13
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useState, useEffect, useCallback } from "react";
|
|
2
3
|
import { useCart } from "./CartProvider.mjs";
|
|
3
4
|
import { useProduct } from "./ProductProvider.mjs";
|
|
4
5
|
import { BaseButton } from "./BaseButton.mjs";
|
|
5
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
6
6
|
function AddToCartButton(props) {
|
|
7
|
-
var _a;
|
|
8
7
|
const [addingItem, setAddingItem] = useState(false);
|
|
9
8
|
const {
|
|
10
9
|
variantId: explicitVariantId,
|
|
@@ -16,14 +15,9 @@ function AddToCartButton(props) {
|
|
|
16
15
|
accessibleAddingToCartLabel,
|
|
17
16
|
...passthroughProps
|
|
18
17
|
} = props;
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = useCart();
|
|
23
|
-
const {
|
|
24
|
-
selectedVariant
|
|
25
|
-
} = useProduct();
|
|
26
|
-
const variantId = (_a = explicitVariantId != null ? explicitVariantId : selectedVariant == null ? void 0 : selectedVariant.id) != null ? _a : "";
|
|
18
|
+
const { status, linesAdd } = useCart();
|
|
19
|
+
const { selectedVariant } = useProduct();
|
|
20
|
+
const variantId = explicitVariantId ?? (selectedVariant == null ? void 0 : selectedVariant.id) ?? "";
|
|
27
21
|
const disabled = explicitVariantId === null || variantId === "" || selectedVariant === null || addingItem || passthroughProps.disabled;
|
|
28
22
|
useEffect(() => {
|
|
29
23
|
if (addingItem && status === "idle") {
|
|
@@ -32,37 +26,46 @@ function AddToCartButton(props) {
|
|
|
32
26
|
}, [status, addingItem]);
|
|
33
27
|
const handleAddItem = useCallback(() => {
|
|
34
28
|
setAddingItem(true);
|
|
35
|
-
linesAdd([
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
linesAdd([
|
|
30
|
+
{
|
|
31
|
+
quantity,
|
|
32
|
+
merchandiseId: variantId || "",
|
|
33
|
+
attributes,
|
|
34
|
+
sellingPlanId
|
|
35
|
+
}
|
|
36
|
+
]);
|
|
41
37
|
}, [linesAdd, quantity, variantId, attributes, sellingPlanId]);
|
|
42
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
BaseButton,
|
|
41
|
+
{
|
|
42
|
+
...passthroughProps,
|
|
43
|
+
disabled,
|
|
44
|
+
onClick,
|
|
45
|
+
defaultOnClick: handleAddItem,
|
|
46
|
+
children
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
accessibleAddingToCartLabel ? /* @__PURE__ */ jsx(
|
|
50
|
+
"p",
|
|
51
|
+
{
|
|
52
|
+
style: {
|
|
53
|
+
position: "absolute",
|
|
54
|
+
width: "1px",
|
|
55
|
+
height: "1px",
|
|
56
|
+
padding: "0",
|
|
57
|
+
margin: "-1px",
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
clip: "rect(0, 0, 0, 0)",
|
|
60
|
+
whiteSpace: "nowrap",
|
|
61
|
+
borderWidth: "0"
|
|
62
|
+
},
|
|
63
|
+
role: "alert",
|
|
64
|
+
"aria-live": "assertive",
|
|
65
|
+
children: addingItem ? accessibleAddingToCartLabel : null
|
|
66
|
+
}
|
|
67
|
+
) : null
|
|
68
|
+
] });
|
|
66
69
|
}
|
|
67
70
|
export {
|
|
68
71
|
AddToCartButton
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddToCartButton.mjs","sources":["../../src/AddToCartButton.tsx"],"sourcesContent":["import {useCallback, useEffect, useState} from 'react';\n\nimport {useCart} from './CartProvider.js';\nimport {useProduct} from './ProductProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\nexport interface AddToCartButtonProps {\n /** An array of cart line attributes that belong to the item being added to the cart. */\n attributes?: {\n key: string;\n value: string;\n }[];\n /** The ID of the variant. */\n variantId?: string | null;\n /** The item quantity. */\n quantity?: number;\n /** The text that is announced by the screen reader when the item is being added to the cart. Used for accessibility purposes only and not displayed on the page. */\n accessibleAddingToCartLabel?: string;\n /** The selling plan ID of the subscription variant */\n sellingPlanId?: string;\n}\n\n/**\n * The `AddToCartButton` component renders a button that adds an item to the cart when pressed.\n * It must be a descendent of the `CartProvider` component.\n */\nexport function AddToCartButton<AsType extends React.ElementType = 'button'>(\n props: AddToCartButtonProps & BaseButtonProps<AsType>\n) {\n const [addingItem, setAddingItem] = useState<boolean>(false);\n const {\n variantId: explicitVariantId,\n quantity = 1,\n attributes,\n sellingPlanId,\n onClick,\n children,\n accessibleAddingToCartLabel,\n ...passthroughProps\n } = props;\n const {status, linesAdd} = useCart();\n const {selectedVariant} = useProduct();\n const variantId = explicitVariantId ?? selectedVariant?.id ?? '';\n const disabled =\n explicitVariantId === null ||\n variantId === '' ||\n selectedVariant === null ||\n addingItem ||\n passthroughProps.disabled;\n\n useEffect(() => {\n if (addingItem && status === 'idle') {\n setAddingItem(false);\n }\n }, [status, addingItem]);\n\n const handleAddItem = useCallback(() => {\n setAddingItem(true);\n linesAdd([\n {\n quantity,\n merchandiseId: variantId || '',\n attributes,\n sellingPlanId,\n },\n ]);\n }, [linesAdd, quantity, variantId, attributes, sellingPlanId]);\n\n return (\n <>\n <BaseButton\n {...passthroughProps}\n disabled={disabled}\n onClick={onClick}\n defaultOnClick={handleAddItem}\n >\n {children}\n </BaseButton>\n {accessibleAddingToCartLabel ? (\n <p\n style={{\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n borderWidth: '0',\n }}\n role=\"alert\"\n aria-live=\"assertive\"\n >\n {addingItem ? accessibleAddingToCartLabel : null}\n </p>\n ) : null}\n </>\n );\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"AddToCartButton.mjs","sources":["../../src/AddToCartButton.tsx"],"sourcesContent":["import {useCallback, useEffect, useState} from 'react';\n\nimport {useCart} from './CartProvider.js';\nimport {useProduct} from './ProductProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\nexport interface AddToCartButtonProps {\n /** An array of cart line attributes that belong to the item being added to the cart. */\n attributes?: {\n key: string;\n value: string;\n }[];\n /** The ID of the variant. */\n variantId?: string | null;\n /** The item quantity. */\n quantity?: number;\n /** The text that is announced by the screen reader when the item is being added to the cart. Used for accessibility purposes only and not displayed on the page. */\n accessibleAddingToCartLabel?: string;\n /** The selling plan ID of the subscription variant */\n sellingPlanId?: string;\n}\n\n/**\n * The `AddToCartButton` component renders a button that adds an item to the cart when pressed.\n * It must be a descendent of the `CartProvider` component.\n */\nexport function AddToCartButton<AsType extends React.ElementType = 'button'>(\n props: AddToCartButtonProps & BaseButtonProps<AsType>\n) {\n const [addingItem, setAddingItem] = useState<boolean>(false);\n const {\n variantId: explicitVariantId,\n quantity = 1,\n attributes,\n sellingPlanId,\n onClick,\n children,\n accessibleAddingToCartLabel,\n ...passthroughProps\n } = props;\n const {status, linesAdd} = useCart();\n const {selectedVariant} = useProduct();\n const variantId = explicitVariantId ?? selectedVariant?.id ?? '';\n const disabled =\n explicitVariantId === null ||\n variantId === '' ||\n selectedVariant === null ||\n addingItem ||\n passthroughProps.disabled;\n\n useEffect(() => {\n if (addingItem && status === 'idle') {\n setAddingItem(false);\n }\n }, [status, addingItem]);\n\n const handleAddItem = useCallback(() => {\n setAddingItem(true);\n linesAdd([\n {\n quantity,\n merchandiseId: variantId || '',\n attributes,\n sellingPlanId,\n },\n ]);\n }, [linesAdd, quantity, variantId, attributes, sellingPlanId]);\n\n return (\n <>\n <BaseButton\n {...passthroughProps}\n disabled={disabled}\n onClick={onClick}\n defaultOnClick={handleAddItem}\n >\n {children}\n </BaseButton>\n {accessibleAddingToCartLabel ? (\n <p\n style={{\n position: 'absolute',\n width: '1px',\n height: '1px',\n padding: '0',\n margin: '-1px',\n overflow: 'hidden',\n clip: 'rect(0, 0, 0, 0)',\n whiteSpace: 'nowrap',\n borderWidth: '0',\n }}\n role=\"alert\"\n aria-live=\"assertive\"\n >\n {addingItem ? accessibleAddingToCartLabel : null}\n </p>\n ) : null}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;AA0BO,SAAS,gBACd,OACA;AACA,QAAM,CAAC,YAAY,aAAa,IAAI,SAAkB,KAAK;AACrD,QAAA;AAAA,IACJ,WAAW;AAAA,IACX,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACD,IAAA;AACJ,QAAM,EAAC,QAAQ,SAAQ,IAAI,QAAQ;AAC7B,QAAA,EAAC,oBAAmB;AACpB,QAAA,YAAY,sBAAqB,mDAAiB,OAAM;AACxD,QAAA,WACJ,sBAAsB,QACtB,cAAc,MACd,oBAAoB,QACpB,cACA,iBAAiB;AAEnB,YAAU,MAAM;AACV,QAAA,cAAc,WAAW,QAAQ;AACnC,oBAAc,KAAK;AAAA,IACrB;AAAA,EAAA,GACC,CAAC,QAAQ,UAAU,CAAC;AAEjB,QAAA,gBAAgB,YAAY,MAAM;AACtC,kBAAc,IAAI;AACT,aAAA;AAAA,MACP;AAAA,QACE;AAAA,QACA,eAAe,aAAa;AAAA,QAC5B;AAAA,QACA;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EAAA,GACA,CAAC,UAAU,UAAU,WAAW,YAAY,aAAa,CAAC;AAE7D,SAEI,qBAAA,UAAA,EAAA,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA;AAAA,QACA,gBAAgB;AAAA,QAEf;AAAA,MAAA;AAAA,IACH;AAAA,IACC,8BACC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,UACL,UAAU;AAAA,UACV,OAAO;AAAA,UACP,QAAQ;AAAA,UACR,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,UAAU;AAAA,UACV,MAAM;AAAA,UACN,YAAY;AAAA,UACZ,aAAa;AAAA,QACf;AAAA,QACA,MAAK;AAAA,QACL,aAAU;AAAA,QAET,uBAAa,8BAA8B;AAAA,MAAA;AAAA,IAAA,IAE5C;AAAA,EACN,EAAA,CAAA;AAEJ;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
3
|
function BaseButton(props) {
|
|
4
4
|
const {
|
|
5
5
|
as,
|
|
@@ -9,21 +9,19 @@ function BaseButton(props) {
|
|
|
9
9
|
buttonRef,
|
|
10
10
|
...passthroughProps
|
|
11
11
|
} = props;
|
|
12
|
-
const handleOnClick = useCallback(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
const handleOnClick = useCallback(
|
|
13
|
+
(event) => {
|
|
14
|
+
if (onClick) {
|
|
15
|
+
const clickShouldContinue = onClick(event);
|
|
16
|
+
if (typeof clickShouldContinue === "boolean" && clickShouldContinue === false || (event == null ? void 0 : event.defaultPrevented))
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
defaultOnClick == null ? void 0 : defaultOnClick(event);
|
|
20
|
+
},
|
|
21
|
+
[defaultOnClick, onClick]
|
|
22
|
+
);
|
|
20
23
|
const Component = as || "button";
|
|
21
|
-
return /* @__PURE__ */ jsx(Component, {
|
|
22
|
-
ref: buttonRef,
|
|
23
|
-
onClick: handleOnClick,
|
|
24
|
-
...passthroughProps,
|
|
25
|
-
children
|
|
26
|
-
});
|
|
24
|
+
return /* @__PURE__ */ jsx(Component, { ref: buttonRef, onClick: handleOnClick, ...passthroughProps, children });
|
|
27
25
|
}
|
|
28
26
|
export {
|
|
29
27
|
BaseButton
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseButton.mjs","sources":["../../src/BaseButton.tsx"],"sourcesContent":["import {ReactNode, Ref, useCallback} from 'react';\n\nexport interface CustomBaseButtonProps<AsType> {\n /** Provide a React element or component to render as the underlying button. Note: for accessibility compliance, almost always you should use a `button` element, or a component that renders an underlying button. */\n as?: AsType;\n /** Any ReactNode elements. */\n children: ReactNode;\n /** Click event handler. Default behaviour triggers unless prevented */\n onClick?: (\n event?: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void | boolean;\n /** A default onClick behavior */\n defaultOnClick?: (\n event?: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void | boolean;\n /** A ref to the underlying button */\n buttonRef?: Ref<HTMLButtonElement>;\n}\n\nexport type BaseButtonProps<AsType extends React.ElementType> =\n CustomBaseButtonProps<AsType> &\n Omit<\n React.ComponentPropsWithoutRef<AsType>,\n keyof CustomBaseButtonProps<AsType>\n >;\n\nexport function BaseButton<AsType extends React.ElementType = 'button'>(\n props: BaseButtonProps<AsType>\n) {\n const {\n as,\n onClick,\n defaultOnClick,\n children,\n buttonRef,\n ...passthroughProps\n } = props;\n\n const handleOnClick = useCallback(\n (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (onClick) {\n const clickShouldContinue = onClick(event);\n if (\n (typeof clickShouldContinue === 'boolean' &&\n clickShouldContinue === false) ||\n event?.defaultPrevented\n )\n return;\n }\n\n defaultOnClick?.(event);\n },\n [defaultOnClick, onClick]\n );\n\n const Component = as || 'button';\n\n return (\n <Component ref={buttonRef} onClick={handleOnClick} {...passthroughProps}>\n {children}\n </Component>\n );\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"BaseButton.mjs","sources":["../../src/BaseButton.tsx"],"sourcesContent":["import {ReactNode, Ref, useCallback} from 'react';\n\nexport interface CustomBaseButtonProps<AsType> {\n /** Provide a React element or component to render as the underlying button. Note: for accessibility compliance, almost always you should use a `button` element, or a component that renders an underlying button. */\n as?: AsType;\n /** Any ReactNode elements. */\n children: ReactNode;\n /** Click event handler. Default behaviour triggers unless prevented */\n onClick?: (\n event?: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void | boolean;\n /** A default onClick behavior */\n defaultOnClick?: (\n event?: React.MouseEvent<HTMLButtonElement, MouseEvent>\n ) => void | boolean;\n /** A ref to the underlying button */\n buttonRef?: Ref<HTMLButtonElement>;\n}\n\nexport type BaseButtonProps<AsType extends React.ElementType> =\n CustomBaseButtonProps<AsType> &\n Omit<\n React.ComponentPropsWithoutRef<AsType>,\n keyof CustomBaseButtonProps<AsType>\n >;\n\nexport function BaseButton<AsType extends React.ElementType = 'button'>(\n props: BaseButtonProps<AsType>\n) {\n const {\n as,\n onClick,\n defaultOnClick,\n children,\n buttonRef,\n ...passthroughProps\n } = props;\n\n const handleOnClick = useCallback(\n (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (onClick) {\n const clickShouldContinue = onClick(event);\n if (\n (typeof clickShouldContinue === 'boolean' &&\n clickShouldContinue === false) ||\n event?.defaultPrevented\n )\n return;\n }\n\n defaultOnClick?.(event);\n },\n [defaultOnClick, onClick]\n );\n\n const Component = as || 'button';\n\n return (\n <Component ref={buttonRef} onClick={handleOnClick} {...passthroughProps}>\n {children}\n </Component>\n );\n}\n"],"names":[],"mappings":";;AA0BO,SAAS,WACd,OACA;AACM,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACD,IAAA;AAEJ,QAAM,gBAAgB;AAAA,IACpB,CAAC,UAA4D;AAC3D,UAAI,SAAS;AACL,cAAA,sBAAsB,QAAQ,KAAK;AACzC,YACG,OAAO,wBAAwB,aAC9B,wBAAwB,UAC1B,+BAAO;AAEP;AAAA,MACJ;AAEA,uDAAiB;AAAA,IACnB;AAAA,IACA,CAAC,gBAAgB,OAAO;AAAA,EAAA;AAG1B,QAAM,YAAY,MAAM;AAGtB,SAAA,oBAAC,aAAU,KAAK,WAAW,SAAS,eAAgB,GAAG,kBACpD,SACH,CAAA;AAEJ;"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useState, useEffect, useCallback } from "react";
|
|
2
3
|
import { useCart } from "./CartProvider.mjs";
|
|
3
4
|
import { BaseButton } from "./BaseButton.mjs";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
function BuyNowButton(props) {
|
|
6
|
-
const {
|
|
7
|
-
cartCreate,
|
|
8
|
-
checkoutUrl
|
|
9
|
-
} = useCart();
|
|
6
|
+
const { cartCreate, checkoutUrl } = useCart();
|
|
10
7
|
const [loading, setLoading] = useState(false);
|
|
11
8
|
const {
|
|
12
9
|
quantity,
|
|
@@ -24,20 +21,25 @@ function BuyNowButton(props) {
|
|
|
24
21
|
const handleBuyNow = useCallback(() => {
|
|
25
22
|
setLoading(true);
|
|
26
23
|
cartCreate({
|
|
27
|
-
lines: [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
lines: [
|
|
25
|
+
{
|
|
26
|
+
quantity: quantity ?? 1,
|
|
27
|
+
merchandiseId: variantId,
|
|
28
|
+
attributes
|
|
29
|
+
}
|
|
30
|
+
]
|
|
32
31
|
});
|
|
33
32
|
}, [cartCreate, quantity, variantId, attributes]);
|
|
34
|
-
return /* @__PURE__ */ jsx(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
BaseButton,
|
|
35
|
+
{
|
|
36
|
+
disabled: loading ?? passthroughProps.disabled,
|
|
37
|
+
...passthroughProps,
|
|
38
|
+
onClick,
|
|
39
|
+
defaultOnClick: handleBuyNow,
|
|
40
|
+
children
|
|
41
|
+
}
|
|
42
|
+
);
|
|
41
43
|
}
|
|
42
44
|
export {
|
|
43
45
|
BuyNowButton
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuyNowButton.mjs","sources":["../../src/BuyNowButton.tsx"],"sourcesContent":["import {useEffect, useState, useCallback} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ninterface BuyNowButtonProps {\n /** The item quantity. Defaults to 1. */\n quantity?: number;\n /** The ID of the variant. */\n variantId: string;\n /** An array of cart line attributes that belong to the item being added to the cart. */\n attributes?: {\n key: string;\n value: string;\n }[];\n}\n\n/** The `BuyNowButton` component renders a button that adds an item to the cart and redirects the customer to checkout. */\nexport function BuyNowButton<AsType extends React.ElementType = 'button'>(\n props: BuyNowButtonProps & BaseButtonProps<AsType>\n) {\n const {cartCreate, checkoutUrl} = useCart();\n const [loading, setLoading] = useState<boolean>(false);\n\n const {\n quantity,\n variantId,\n onClick,\n attributes,\n children,\n ...passthroughProps\n } = props;\n\n useEffect(() => {\n if (checkoutUrl) {\n window.location.href = checkoutUrl;\n }\n }, [checkoutUrl]);\n\n const handleBuyNow = useCallback(() => {\n setLoading(true);\n cartCreate({\n lines: [\n {\n quantity: quantity ?? 1,\n merchandiseId: variantId,\n attributes,\n },\n ],\n });\n }, [cartCreate, quantity, variantId, attributes]);\n\n return (\n <BaseButton\n disabled={loading ?? passthroughProps.disabled}\n {...passthroughProps}\n onClick={onClick}\n defaultOnClick={handleBuyNow}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"BuyNowButton.mjs","sources":["../../src/BuyNowButton.tsx"],"sourcesContent":["import {useEffect, useState, useCallback} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ninterface BuyNowButtonProps {\n /** The item quantity. Defaults to 1. */\n quantity?: number;\n /** The ID of the variant. */\n variantId: string;\n /** An array of cart line attributes that belong to the item being added to the cart. */\n attributes?: {\n key: string;\n value: string;\n }[];\n}\n\n/** The `BuyNowButton` component renders a button that adds an item to the cart and redirects the customer to checkout. */\nexport function BuyNowButton<AsType extends React.ElementType = 'button'>(\n props: BuyNowButtonProps & BaseButtonProps<AsType>\n) {\n const {cartCreate, checkoutUrl} = useCart();\n const [loading, setLoading] = useState<boolean>(false);\n\n const {\n quantity,\n variantId,\n onClick,\n attributes,\n children,\n ...passthroughProps\n } = props;\n\n useEffect(() => {\n if (checkoutUrl) {\n window.location.href = checkoutUrl;\n }\n }, [checkoutUrl]);\n\n const handleBuyNow = useCallback(() => {\n setLoading(true);\n cartCreate({\n lines: [\n {\n quantity: quantity ?? 1,\n merchandiseId: variantId,\n attributes,\n },\n ],\n });\n }, [cartCreate, quantity, variantId, attributes]);\n\n return (\n <BaseButton\n disabled={loading ?? passthroughProps.disabled}\n {...passthroughProps}\n onClick={onClick}\n defaultOnClick={handleBuyNow}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":[],"mappings":";;;;AAiBO,SAAS,aACd,OACA;AACA,QAAM,EAAC,YAAY,YAAW,IAAI,QAAQ;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAkB,KAAK;AAE/C,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACD,IAAA;AAEJ,YAAU,MAAM;AACd,QAAI,aAAa;AACf,aAAO,SAAS,OAAO;AAAA,IACzB;AAAA,EAAA,GACC,CAAC,WAAW,CAAC;AAEV,QAAA,eAAe,YAAY,MAAM;AACrC,eAAW,IAAI;AACJ,eAAA;AAAA,MACT,OAAO;AAAA,QACL;AAAA,UACE,UAAU,YAAY;AAAA,UACtB,eAAe;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IAAA,CACD;AAAA,KACA,CAAC,YAAY,UAAU,WAAW,UAAU,CAAC;AAG9C,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAU,WAAW,iBAAiB;AAAA,MACrC,GAAG;AAAA,MACJ;AAAA,MACA,gBAAgB;AAAA,MAEf;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import { useState, useEffect } from "react";
|
|
2
3
|
import { useCart } from "./CartProvider.mjs";
|
|
3
4
|
import { BaseButton } from "./BaseButton.mjs";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
function CartCheckoutButton(props) {
|
|
6
6
|
const [requestedCheckout, setRequestedCheckout] = useState(false);
|
|
7
|
-
const {
|
|
8
|
-
|
|
9
|
-
checkoutUrl
|
|
10
|
-
} = useCart();
|
|
11
|
-
const {
|
|
12
|
-
children,
|
|
13
|
-
...passthroughProps
|
|
14
|
-
} = props;
|
|
7
|
+
const { status, checkoutUrl } = useCart();
|
|
8
|
+
const { children, ...passthroughProps } = props;
|
|
15
9
|
useEffect(() => {
|
|
16
10
|
if (requestedCheckout && checkoutUrl && status === "idle") {
|
|
17
11
|
window.location.href = checkoutUrl;
|
|
18
12
|
}
|
|
19
13
|
}, [requestedCheckout, status, checkoutUrl]);
|
|
20
|
-
return /* @__PURE__ */ jsx(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
BaseButton,
|
|
16
|
+
{
|
|
17
|
+
...passthroughProps,
|
|
18
|
+
disabled: requestedCheckout || passthroughProps.disabled,
|
|
19
|
+
onClick: () => setRequestedCheckout(true),
|
|
20
|
+
children
|
|
21
|
+
}
|
|
22
|
+
);
|
|
26
23
|
}
|
|
27
24
|
export {
|
|
28
25
|
CartCheckoutButton
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartCheckoutButton.mjs","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<BaseButtonProps<'button'>, PropsWeControl> & {\n /** A `ReactNode` element. */\n children: ReactNode;\n }\n) {\n const [requestedCheckout, setRequestedCheckout] = useState(false);\n const {status, checkoutUrl} = useCart();\n const {children, ...passthroughProps} = props;\n\n useEffect(() => {\n if (requestedCheckout && checkoutUrl && status === 'idle') {\n window.location.href = checkoutUrl;\n }\n }, [requestedCheckout, status, checkoutUrl]);\n\n return (\n <BaseButton\n {...passthroughProps}\n disabled={requestedCheckout || passthroughProps.disabled}\n onClick={() => setRequestedCheckout(true)}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"CartCheckoutButton.mjs","sources":["../../src/CartCheckoutButton.tsx"],"sourcesContent":["import {ReactNode, useEffect, useState} from 'react';\nimport {useCart} from './CartProvider.js';\nimport {BaseButton, BaseButtonProps} from './BaseButton.js';\n\ntype PropsWeControl = 'onClick';\n\n/**\n * The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart.\n * It must be a descendent of a `CartProvider` component.\n */\nexport function CartCheckoutButton(\n props: Omit<BaseButtonProps<'button'>, PropsWeControl> & {\n /** A `ReactNode` element. */\n children: ReactNode;\n }\n) {\n const [requestedCheckout, setRequestedCheckout] = useState(false);\n const {status, checkoutUrl} = useCart();\n const {children, ...passthroughProps} = props;\n\n useEffect(() => {\n if (requestedCheckout && checkoutUrl && status === 'idle') {\n window.location.href = checkoutUrl;\n }\n }, [requestedCheckout, status, checkoutUrl]);\n\n return (\n <BaseButton\n {...passthroughProps}\n disabled={requestedCheckout || passthroughProps.disabled}\n onClick={() => setRequestedCheckout(true)}\n >\n {children}\n </BaseButton>\n );\n}\n"],"names":[],"mappings":";;;;AAUO,SAAS,mBACd,OAIA;AACA,QAAM,CAAC,mBAAmB,oBAAoB,IAAI,SAAS,KAAK;AAChE,QAAM,EAAC,QAAQ,YAAW,IAAI,QAAQ;AACtC,QAAM,EAAC,UAAU,GAAG,iBAAA,IAAoB;AAExC,YAAU,MAAM;AACV,QAAA,qBAAqB,eAAe,WAAW,QAAQ;AACzD,aAAO,SAAS,OAAO;AAAA,IACzB;AAAA,EACC,GAAA,CAAC,mBAAmB,QAAQ,WAAW,CAAC;AAGzC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,UAAU,qBAAqB,iBAAiB;AAAA,MAChD,SAAS,MAAM,qBAAqB,IAAI;AAAA,MAEvC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
1
2
|
import { createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, useTransition } from "react";
|
|
2
3
|
import { useCartAPIStateMachine } from "./useCartAPIStateMachine.mjs";
|
|
3
4
|
import { CART_ID_STORAGE_KEY } from "./cart-constants.mjs";
|
|
4
5
|
import { defaultCartFragment } from "./cart-queries.mjs";
|
|
5
|
-
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
const CartContext = createContext(null);
|
|
7
7
|
function useCart() {
|
|
8
8
|
const context = useContext(CartContext);
|
|
@@ -78,16 +78,16 @@ function CartProvider({
|
|
|
78
78
|
onCartActionOptimisticUI(context, event) {
|
|
79
79
|
var _a2, _b2, _c2, _d2;
|
|
80
80
|
if (!context.cart)
|
|
81
|
-
return {
|
|
82
|
-
...context
|
|
83
|
-
};
|
|
81
|
+
return { ...context };
|
|
84
82
|
switch (event.type) {
|
|
85
83
|
case "CARTLINE_REMOVE":
|
|
86
84
|
return {
|
|
87
85
|
...context,
|
|
88
86
|
cart: {
|
|
89
87
|
...context.cart,
|
|
90
|
-
lines: (_b2 = (_a2 = context == null ? void 0 : context.cart) == null ? void 0 : _a2.lines) == null ? void 0 : _b2.filter(
|
|
88
|
+
lines: (_b2 = (_a2 = context == null ? void 0 : context.cart) == null ? void 0 : _a2.lines) == null ? void 0 : _b2.filter(
|
|
89
|
+
(line) => (line == null ? void 0 : line.id) && !event.payload.lines.includes(line == null ? void 0 : line.id)
|
|
90
|
+
)
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
case "CARTLINE_UPDATE":
|
|
@@ -96,9 +96,9 @@ function CartProvider({
|
|
|
96
96
|
cart: {
|
|
97
97
|
...context.cart,
|
|
98
98
|
lines: (_d2 = (_c2 = context == null ? void 0 : context.cart) == null ? void 0 : _c2.lines) == null ? void 0 : _d2.map((line) => {
|
|
99
|
-
const updatedLine = event.payload.lines.find(
|
|
100
|
-
id
|
|
101
|
-
|
|
99
|
+
const updatedLine = event.payload.lines.find(
|
|
100
|
+
({ id }) => id === (line == null ? void 0 : line.id)
|
|
101
|
+
);
|
|
102
102
|
if (updatedLine && updatedLine.quantity) {
|
|
103
103
|
return {
|
|
104
104
|
...line,
|
|
@@ -110,9 +110,7 @@ function CartProvider({
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
return {
|
|
114
|
-
...context
|
|
115
|
-
};
|
|
113
|
+
return { ...context };
|
|
116
114
|
},
|
|
117
115
|
onCartActionComplete(context, event) {
|
|
118
116
|
const cartActionEvent = event.payload.cartActionEvent;
|
|
@@ -157,12 +155,7 @@ function CartProvider({
|
|
|
157
155
|
try {
|
|
158
156
|
const cartId = window.localStorage.getItem(CART_ID_STORAGE_KEY);
|
|
159
157
|
if (cartId) {
|
|
160
|
-
cartSend({
|
|
161
|
-
type: "CART_FETCH",
|
|
162
|
-
payload: {
|
|
163
|
-
cartId
|
|
164
|
-
}
|
|
165
|
-
});
|
|
158
|
+
cartSend({ type: "CART_FETCH", payload: { cartId } });
|
|
166
159
|
}
|
|
167
160
|
} catch (error) {
|
|
168
161
|
console.warn("error fetching cartId");
|
|
@@ -177,25 +170,32 @@ function CartProvider({
|
|
|
177
170
|
return;
|
|
178
171
|
cartSend({
|
|
179
172
|
type: "BUYER_IDENTITY_UPDATE",
|
|
180
|
-
payload: {
|
|
181
|
-
buyerIdentity: {
|
|
182
|
-
countryCode,
|
|
183
|
-
customerAccessToken
|
|
184
|
-
}
|
|
185
|
-
}
|
|
173
|
+
payload: { buyerIdentity: { countryCode, customerAccessToken } }
|
|
186
174
|
});
|
|
187
|
-
}, [
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
cartSend
|
|
193
|
-
|
|
175
|
+
}, [
|
|
176
|
+
countryCode,
|
|
177
|
+
customerAccessToken,
|
|
178
|
+
countryChanged,
|
|
179
|
+
customerOverridesCountryCode,
|
|
180
|
+
cartSend
|
|
181
|
+
]);
|
|
182
|
+
const onCartReadySend = useCallback(
|
|
183
|
+
(cartEvent) => {
|
|
184
|
+
if (!cartReady.current) {
|
|
185
|
+
return console.warn("Cart isn't ready yet");
|
|
186
|
+
}
|
|
187
|
+
cartSend(cartEvent);
|
|
188
|
+
},
|
|
189
|
+
[cartSend]
|
|
190
|
+
);
|
|
194
191
|
useEffect(() => {
|
|
195
192
|
var _a2, _b2, _c2;
|
|
196
193
|
if (((_b2 = (_a2 = cartState == null ? void 0 : cartState.context) == null ? void 0 : _a2.cart) == null ? void 0 : _b2.id) && storageAvailable("localStorage")) {
|
|
197
194
|
try {
|
|
198
|
-
window.localStorage.setItem(
|
|
195
|
+
window.localStorage.setItem(
|
|
196
|
+
CART_ID_STORAGE_KEY,
|
|
197
|
+
(_c2 = cartState.context.cart) == null ? void 0 : _c2.id
|
|
198
|
+
);
|
|
199
199
|
} catch (error) {
|
|
200
200
|
console.warn("Failed to save cartId to localStorage", error);
|
|
201
201
|
}
|
|
@@ -210,50 +210,46 @@ function CartProvider({
|
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
}, [cartCompleted]);
|
|
213
|
-
const cartCreate = useCallback(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (cartInput.buyerIdentity == null) {
|
|
217
|
-
cartInput.buyerIdentity
|
|
213
|
+
const cartCreate = useCallback(
|
|
214
|
+
(cartInput) => {
|
|
215
|
+
var _a2, _b2;
|
|
216
|
+
if (countryCode && !((_a2 = cartInput.buyerIdentity) == null ? void 0 : _a2.countryCode)) {
|
|
217
|
+
if (cartInput.buyerIdentity == null) {
|
|
218
|
+
cartInput.buyerIdentity = {};
|
|
219
|
+
}
|
|
220
|
+
cartInput.buyerIdentity.countryCode = countryCode;
|
|
218
221
|
}
|
|
219
|
-
cartInput.buyerIdentity.
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
cartInput.buyerIdentity =
|
|
222
|
+
if (customerAccessToken && !((_b2 = cartInput.buyerIdentity) == null ? void 0 : _b2.customerAccessToken)) {
|
|
223
|
+
if (cartInput.buyerIdentity == null) {
|
|
224
|
+
cartInput.buyerIdentity = {};
|
|
225
|
+
}
|
|
226
|
+
cartInput.buyerIdentity.customerAccessToken = customerAccessToken;
|
|
224
227
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
228
|
+
onCartReadySend({
|
|
229
|
+
type: "CART_CREATE",
|
|
230
|
+
payload: cartInput
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
[countryCode, customerAccessToken, onCartReadySend]
|
|
234
|
+
);
|
|
232
235
|
const cartDisplayState = useDelayedStateUntilHydration(cartState);
|
|
233
236
|
const cartContextValue = useMemo(() => {
|
|
234
|
-
var _a2, _b2, _c2, _d2
|
|
237
|
+
var _a2, _b2, _c2, _d2;
|
|
235
238
|
return {
|
|
236
|
-
...(
|
|
237
|
-
lines: [],
|
|
238
|
-
attributes: []
|
|
239
|
-
},
|
|
239
|
+
...((_a2 = cartDisplayState == null ? void 0 : cartDisplayState.context) == null ? void 0 : _a2.cart) ?? { lines: [], attributes: [] },
|
|
240
240
|
status: transposeStatus(cartDisplayState.value),
|
|
241
|
-
error: (
|
|
242
|
-
totalQuantity: (
|
|
241
|
+
error: (_b2 = cartDisplayState == null ? void 0 : cartDisplayState.context) == null ? void 0 : _b2.errors,
|
|
242
|
+
totalQuantity: ((_d2 = (_c2 = cartDisplayState == null ? void 0 : cartDisplayState.context) == null ? void 0 : _c2.cart) == null ? void 0 : _d2.totalQuantity) ?? 0,
|
|
243
243
|
cartCreate,
|
|
244
244
|
linesAdd(lines) {
|
|
245
245
|
var _a3, _b3;
|
|
246
246
|
if ((_b3 = (_a3 = cartDisplayState == null ? void 0 : cartDisplayState.context) == null ? void 0 : _a3.cart) == null ? void 0 : _b3.id) {
|
|
247
247
|
onCartReadySend({
|
|
248
248
|
type: "CARTLINE_ADD",
|
|
249
|
-
payload: {
|
|
250
|
-
lines
|
|
251
|
-
}
|
|
249
|
+
payload: { lines }
|
|
252
250
|
});
|
|
253
251
|
} else {
|
|
254
|
-
cartCreate({
|
|
255
|
-
lines
|
|
256
|
-
});
|
|
252
|
+
cartCreate({ lines });
|
|
257
253
|
}
|
|
258
254
|
},
|
|
259
255
|
linesRemove(lines) {
|
|
@@ -306,11 +302,15 @@ function CartProvider({
|
|
|
306
302
|
},
|
|
307
303
|
cartFragment
|
|
308
304
|
};
|
|
309
|
-
}, [
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
305
|
+
}, [
|
|
306
|
+
cartCreate,
|
|
307
|
+
(_f = cartDisplayState == null ? void 0 : cartDisplayState.context) == null ? void 0 : _f.cart,
|
|
308
|
+
(_g = cartDisplayState == null ? void 0 : cartDisplayState.context) == null ? void 0 : _g.errors,
|
|
309
|
+
cartDisplayState.value,
|
|
310
|
+
cartFragment,
|
|
311
|
+
onCartReadySend
|
|
312
|
+
]);
|
|
313
|
+
return /* @__PURE__ */ jsx(CartContext.Provider, { value: cartContextValue, children });
|
|
314
314
|
}
|
|
315
315
|
function transposeStatus(status) {
|
|
316
316
|
switch (status) {
|
|
@@ -365,7 +365,13 @@ function storageAvailable(type) {
|
|
|
365
365
|
storage.removeItem(x);
|
|
366
366
|
return true;
|
|
367
367
|
} catch (e) {
|
|
368
|
-
return e instanceof DOMException &&
|
|
368
|
+
return e instanceof DOMException && // everything except Firefox
|
|
369
|
+
(e.code === 22 || // Firefox
|
|
370
|
+
e.code === 1014 || // test name field too, because code might not be present
|
|
371
|
+
// everything except Firefox
|
|
372
|
+
e.name === "QuotaExceededError" || // Firefox
|
|
373
|
+
e.name === "NS_ERROR_DOM_QUOTA_REACHED") && // acknowledge QuotaExceededError only if there's something already stored
|
|
374
|
+
storage && storage.length !== 0;
|
|
369
375
|
}
|
|
370
376
|
}
|
|
371
377
|
function countryCodeNotUpdated(context, event) {
|