@shopify/hydrogen-react 2022.10.0 → 2022.10.2
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/dev/AddToCartButton.js +70 -0
- package/dist/dev/AddToCartButton.js.map +1 -0
- package/dist/dev/AddToCartButton.mjs +70 -0
- package/dist/dev/AddToCartButton.mjs.map +1 -0
- package/dist/dev/BaseButton.js +31 -0
- package/dist/dev/BaseButton.js.map +1 -0
- package/dist/dev/BaseButton.mjs +31 -0
- package/dist/dev/BaseButton.mjs.map +1 -0
- package/dist/dev/BuyNowButton.js +45 -0
- package/dist/dev/BuyNowButton.js.map +1 -0
- package/dist/dev/BuyNowButton.mjs +45 -0
- package/dist/dev/BuyNowButton.mjs.map +1 -0
- package/dist/dev/CartCheckoutButton.js +30 -0
- package/dist/dev/CartCheckoutButton.js.map +1 -0
- package/dist/dev/CartCheckoutButton.mjs +30 -0
- package/dist/dev/CartCheckoutButton.mjs.map +1 -0
- package/dist/dev/CartProvider.js +35 -35
- package/dist/dev/CartProvider.js.map +1 -1
- package/dist/dev/{CartProvider.cjs → CartProvider.mjs} +36 -36
- package/dist/dev/{CartProvider.cjs.map → CartProvider.mjs.map} +1 -1
- package/dist/dev/ExternalVideo.js +5 -5
- package/dist/dev/ExternalVideo.js.map +1 -1
- package/dist/dev/{ExternalVideo.cjs → ExternalVideo.mjs} +6 -6
- package/dist/{prod/ExternalVideo.cjs.map → dev/ExternalVideo.mjs.map} +1 -1
- package/dist/dev/Image.js +12 -12
- package/dist/dev/Image.js.map +1 -1
- package/dist/dev/{Image.cjs → Image.mjs} +13 -13
- package/dist/dev/{Image.cjs.map → Image.mjs.map} +1 -1
- package/dist/dev/MediaFile.js +12 -12
- package/dist/dev/MediaFile.js.map +1 -1
- package/dist/dev/{MediaFile.cjs → MediaFile.mjs} +13 -13
- package/dist/dev/MediaFile.mjs.map +1 -0
- package/dist/dev/Metafield.js +38 -32
- package/dist/dev/Metafield.js.map +1 -1
- package/dist/dev/{Metafield.cjs → Metafield.mjs} +39 -33
- package/dist/dev/Metafield.mjs.map +1 -0
- package/dist/dev/ModelViewer.js +11 -11
- package/dist/dev/ModelViewer.js.map +1 -1
- package/dist/dev/{ModelViewer.cjs → ModelViewer.mjs} +12 -12
- package/dist/dev/{ModelViewer.cjs.map → ModelViewer.mjs.map} +1 -1
- package/dist/dev/Money.js +8 -8
- package/dist/dev/Money.js.map +1 -1
- package/dist/{prod/Money.cjs → dev/Money.mjs} +9 -9
- package/dist/dev/{Money.cjs.map → Money.mjs.map} +1 -1
- package/dist/dev/ProductPrice.js +9 -9
- package/dist/dev/ProductPrice.js.map +1 -1
- package/dist/{prod/ProductPrice.cjs → dev/ProductPrice.mjs} +10 -10
- package/dist/dev/ProductPrice.mjs.map +1 -0
- package/dist/dev/ProductProvider.js +25 -25
- package/dist/dev/ProductProvider.js.map +1 -1
- package/dist/{prod/ProductProvider.cjs → dev/ProductProvider.mjs} +26 -26
- package/dist/dev/{ProductProvider.cjs.map → ProductProvider.mjs.map} +1 -1
- package/dist/dev/ShopPayButton.js +13 -13
- package/dist/dev/ShopPayButton.js.map +1 -1
- package/dist/{prod/ShopPayButton.cjs → dev/ShopPayButton.mjs} +14 -14
- package/dist/{prod/ShopPayButton.cjs.map → dev/ShopPayButton.mjs.map} +1 -1
- package/dist/dev/ShopifyProvider.js +14 -14
- package/dist/dev/ShopifyProvider.js.map +1 -1
- package/dist/dev/ShopifyProvider.mjs +46 -0
- package/dist/dev/{ShopifyProvider.cjs.map → ShopifyProvider.mjs.map} +1 -1
- package/dist/dev/Video.js +9 -9
- package/dist/dev/Video.js.map +1 -1
- package/dist/dev/{Video.cjs → Video.mjs} +10 -10
- package/dist/dev/{Video.cjs.map → Video.mjs.map} +1 -1
- package/dist/dev/_virtual/index.js +3 -3
- package/dist/dev/_virtual/index.js.map +1 -1
- package/dist/dev/_virtual/index.mjs +5 -0
- package/dist/dev/_virtual/index.mjs.map +1 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.development.js +3 -3
- package/dist/dev/_virtual/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/dev/_virtual/use-sync-external-store-shim.development.mjs +5 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.development.mjs.map +1 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js +3 -3
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.mjs +5 -0
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.mjs.map +1 -0
- package/dist/dev/_virtual/with-selector.development.js +3 -3
- package/dist/dev/_virtual/with-selector.development.js.map +1 -1
- package/dist/dev/_virtual/with-selector.development.mjs +5 -0
- package/dist/dev/_virtual/with-selector.development.mjs.map +1 -0
- package/dist/dev/_virtual/with-selector.js +3 -3
- package/dist/dev/_virtual/with-selector.js.map +1 -1
- package/dist/dev/_virtual/with-selector.mjs +5 -0
- package/dist/dev/_virtual/with-selector.mjs.map +1 -0
- package/dist/dev/_virtual/with-selector.production.min.js +3 -3
- package/dist/dev/_virtual/with-selector.production.min.js.map +1 -1
- package/dist/dev/_virtual/with-selector.production.min.mjs +5 -0
- package/dist/dev/_virtual/with-selector.production.min.mjs.map +1 -0
- package/dist/dev/cart-constants.js +9 -9
- package/dist/dev/cart-constants.js.map +1 -1
- package/dist/dev/cart-constants.mjs +17 -0
- package/dist/dev/{cart-constants.cjs.map → cart-constants.mjs.map} +1 -1
- package/dist/dev/cart-hooks.js +15 -15
- package/dist/dev/cart-hooks.js.map +1 -1
- package/dist/dev/cart-hooks.mjs +48 -0
- package/dist/dev/{cart-hooks.cjs.map → cart-hooks.mjs.map} +1 -1
- package/dist/dev/cart-queries.js +11 -11
- package/dist/dev/cart-queries.js.map +1 -1
- package/dist/{prod/cart-queries.cjs → dev/cart-queries.mjs} +12 -12
- package/dist/dev/{cart-queries.cjs.map → cart-queries.mjs.map} +1 -1
- package/dist/dev/flatten-connection.js +3 -3
- package/dist/dev/flatten-connection.js.map +1 -1
- package/dist/dev/{flatten-connection.cjs → flatten-connection.mjs} +4 -4
- package/dist/dev/{flatten-connection.cjs.map → flatten-connection.mjs.map} +1 -1
- package/dist/dev/image-size.js +6 -6
- package/dist/dev/image-size.js.map +1 -1
- package/dist/dev/{image-size.cjs → image-size.mjs} +7 -7
- package/dist/{prod/image-size.cjs.map → dev/image-size.mjs.map} +1 -1
- package/dist/dev/index.js +45 -37
- package/dist/dev/index.js.map +1 -1
- package/dist/dev/index.mjs +46 -0
- package/dist/dev/index.mjs.map +1 -0
- package/dist/dev/load-script.js +7 -7
- package/dist/dev/load-script.js.map +1 -1
- package/dist/{prod/load-script.cjs → dev/load-script.mjs} +8 -8
- package/dist/dev/{load-script.cjs.map → load-script.mjs.map} +1 -1
- package/dist/dev/metafield-parser.js +103 -0
- package/dist/dev/metafield-parser.js.map +1 -0
- package/dist/dev/metafield-parser.mjs +103 -0
- package/dist/dev/metafield-parser.mjs.map +1 -0
- package/dist/dev/node_modules/@xstate/fsm/es/index.js +34 -35
- package/dist/dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/{prod/node_modules/@xstate/fsm/es/index.cjs → dev/node_modules/@xstate/fsm/es/index.mjs} +36 -35
- package/dist/dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -0
- package/dist/dev/node_modules/@xstate/react/es/fsm.js +21 -21
- package/dist/dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/{prod/node_modules/@xstate/react/es/fsm.cjs → dev/node_modules/@xstate/react/es/fsm.mjs} +22 -22
- package/dist/dev/node_modules/@xstate/react/es/{fsm.cjs.map → fsm.mjs.map} +1 -1
- package/dist/dev/node_modules/@xstate/react/es/useConstant.js +23 -5
- package/dist/dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/dev/node_modules/@xstate/react/es/useConstant.mjs +12 -0
- package/dist/dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -0
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +4 -5
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -1
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +6 -0
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/{use-isomorphic-layout-effect.browser.esm.cjs.map → use-isomorphic-layout-effect.browser.esm.mjs.map} +1 -1
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +13 -11
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.development.cjs → with-selector.development.mjs} +12 -14
- package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map} +1 -1
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +12 -10
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.production.min.cjs → with-selector.production.min.mjs} +11 -13
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +11 -9
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/dev/node_modules/use-sync-external-store/cjs/{use-sync-external-store-shim.development.cjs → use-sync-external-store-shim.development.mjs} +10 -12
- package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map} +1 -1
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +11 -9
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs} +10 -12
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/index.js +12 -12
- package/dist/dev/node_modules/use-sync-external-store/shim/index.js.map +1 -1
- package/dist/dev/node_modules/use-sync-external-store/shim/index.mjs +21 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js +7 -6
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.mjs +11 -0
- package/dist/dev/node_modules/use-sync-external-store/shim/{with-selector.cjs.map → with-selector.mjs.map} +1 -1
- package/dist/dev/storefront-api-constants.js +3 -3
- package/dist/dev/storefront-api-constants.js.map +1 -1
- package/dist/dev/storefront-api-constants.mjs +5 -0
- package/dist/dev/storefront-api-constants.mjs.map +1 -0
- package/dist/dev/storefront-client.js +6 -6
- package/dist/dev/storefront-client.js.map +1 -1
- package/dist/dev/{storefront-client.cjs → storefront-client.mjs} +7 -7
- package/dist/dev/storefront-client.mjs.map +1 -0
- package/dist/dev/useCartAPIStateMachine.js +20 -20
- package/dist/dev/useCartAPIStateMachine.js.map +1 -1
- package/dist/{prod/useCartAPIStateMachine.cjs → dev/useCartAPIStateMachine.mjs} +21 -21
- package/dist/dev/{useCartAPIStateMachine.cjs.map → useCartAPIStateMachine.mjs.map} +1 -1
- package/dist/dev/useCartActions.js +26 -26
- package/dist/dev/useCartActions.js.map +1 -1
- package/dist/{prod/useCartActions.cjs → dev/useCartActions.mjs} +27 -27
- package/dist/dev/{useCartActions.cjs.map → useCartActions.mjs.map} +1 -1
- package/dist/dev/useMoney.js +10 -10
- package/dist/dev/useMoney.js.map +1 -1
- package/dist/{prod/useMoney.cjs → dev/useMoney.mjs} +11 -11
- package/dist/dev/{useMoney.cjs.map → useMoney.mjs.map} +1 -1
- package/dist/prod/AddToCartButton.js +70 -0
- package/dist/prod/AddToCartButton.js.map +1 -0
- package/dist/prod/AddToCartButton.mjs +70 -0
- package/dist/prod/AddToCartButton.mjs.map +1 -0
- package/dist/prod/BaseButton.js +31 -0
- package/dist/prod/BaseButton.js.map +1 -0
- package/dist/prod/BaseButton.mjs +31 -0
- package/dist/prod/BaseButton.mjs.map +1 -0
- package/dist/prod/BuyNowButton.js +45 -0
- package/dist/prod/BuyNowButton.js.map +1 -0
- package/dist/prod/BuyNowButton.mjs +45 -0
- package/dist/prod/BuyNowButton.mjs.map +1 -0
- package/dist/prod/CartCheckoutButton.js +30 -0
- package/dist/prod/CartCheckoutButton.js.map +1 -0
- package/dist/prod/CartCheckoutButton.mjs +30 -0
- package/dist/prod/CartCheckoutButton.mjs.map +1 -0
- package/dist/prod/CartProvider.js +35 -35
- package/dist/prod/CartProvider.js.map +1 -1
- package/dist/prod/{CartProvider.cjs → CartProvider.mjs} +36 -36
- package/dist/prod/{CartProvider.cjs.map → CartProvider.mjs.map} +1 -1
- package/dist/prod/ExternalVideo.js +5 -5
- package/dist/prod/ExternalVideo.js.map +1 -1
- package/dist/prod/{ExternalVideo.cjs → ExternalVideo.mjs} +6 -6
- package/dist/{dev/ExternalVideo.cjs.map → prod/ExternalVideo.mjs.map} +1 -1
- package/dist/prod/Image.js +12 -12
- package/dist/prod/Image.js.map +1 -1
- package/dist/prod/{Image.cjs → Image.mjs} +13 -13
- package/dist/prod/{Image.cjs.map → Image.mjs.map} +1 -1
- package/dist/prod/MediaFile.js +12 -12
- package/dist/prod/MediaFile.js.map +1 -1
- package/dist/prod/{MediaFile.cjs → MediaFile.mjs} +13 -13
- package/dist/prod/MediaFile.mjs.map +1 -0
- package/dist/prod/Metafield.js +32 -32
- package/dist/prod/Metafield.js.map +1 -1
- package/dist/prod/{Metafield.cjs → Metafield.mjs} +33 -33
- package/dist/prod/Metafield.mjs.map +1 -0
- package/dist/prod/ModelViewer.js +11 -11
- package/dist/prod/ModelViewer.js.map +1 -1
- package/dist/prod/{ModelViewer.cjs → ModelViewer.mjs} +12 -12
- package/dist/prod/{ModelViewer.cjs.map → ModelViewer.mjs.map} +1 -1
- package/dist/prod/Money.js +8 -8
- package/dist/prod/Money.js.map +1 -1
- package/dist/{dev/Money.cjs → prod/Money.mjs} +9 -9
- package/dist/prod/{Money.cjs.map → Money.mjs.map} +1 -1
- package/dist/prod/ProductPrice.js +9 -9
- package/dist/prod/ProductPrice.js.map +1 -1
- package/dist/{dev/ProductPrice.cjs → prod/ProductPrice.mjs} +10 -10
- package/dist/prod/ProductPrice.mjs.map +1 -0
- package/dist/prod/ProductProvider.js +25 -25
- package/dist/prod/ProductProvider.js.map +1 -1
- package/dist/{dev/ProductProvider.cjs → prod/ProductProvider.mjs} +26 -26
- package/dist/prod/{ProductProvider.cjs.map → ProductProvider.mjs.map} +1 -1
- package/dist/prod/ShopPayButton.js +13 -13
- package/dist/prod/ShopPayButton.js.map +1 -1
- package/dist/{dev/ShopPayButton.cjs → prod/ShopPayButton.mjs} +14 -14
- package/dist/{dev/ShopPayButton.cjs.map → prod/ShopPayButton.mjs.map} +1 -1
- package/dist/prod/ShopifyProvider.js +14 -14
- package/dist/prod/ShopifyProvider.js.map +1 -1
- package/dist/prod/ShopifyProvider.mjs +46 -0
- package/dist/prod/{ShopifyProvider.cjs.map → ShopifyProvider.mjs.map} +1 -1
- package/dist/prod/Video.js +9 -9
- package/dist/prod/Video.js.map +1 -1
- package/dist/prod/{Video.cjs → Video.mjs} +10 -10
- package/dist/prod/{Video.cjs.map → Video.mjs.map} +1 -1
- package/dist/prod/_virtual/index.js +3 -3
- package/dist/prod/_virtual/index.js.map +1 -1
- package/dist/prod/_virtual/index.mjs +5 -0
- package/dist/prod/_virtual/index.mjs.map +1 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.development.js +3 -3
- package/dist/prod/_virtual/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/prod/_virtual/use-sync-external-store-shim.development.mjs +5 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.development.mjs.map +1 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js +3 -3
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.mjs +5 -0
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.mjs.map +1 -0
- package/dist/prod/_virtual/with-selector.development.js +3 -3
- package/dist/prod/_virtual/with-selector.development.js.map +1 -1
- package/dist/prod/_virtual/with-selector.development.mjs +5 -0
- package/dist/prod/_virtual/with-selector.development.mjs.map +1 -0
- package/dist/prod/_virtual/with-selector.js +3 -3
- package/dist/prod/_virtual/with-selector.js.map +1 -1
- package/dist/prod/_virtual/with-selector.mjs +5 -0
- package/dist/prod/_virtual/with-selector.mjs.map +1 -0
- package/dist/prod/_virtual/with-selector.production.min.js +3 -3
- package/dist/prod/_virtual/with-selector.production.min.js.map +1 -1
- package/dist/prod/_virtual/with-selector.production.min.mjs +5 -0
- package/dist/prod/_virtual/with-selector.production.min.mjs.map +1 -0
- package/dist/prod/cart-constants.js +9 -9
- package/dist/prod/cart-constants.js.map +1 -1
- package/dist/prod/cart-constants.mjs +17 -0
- package/dist/prod/{cart-constants.cjs.map → cart-constants.mjs.map} +1 -1
- package/dist/prod/cart-hooks.js +15 -15
- package/dist/prod/cart-hooks.js.map +1 -1
- package/dist/prod/cart-hooks.mjs +48 -0
- package/dist/prod/{cart-hooks.cjs.map → cart-hooks.mjs.map} +1 -1
- package/dist/prod/cart-queries.js +11 -11
- package/dist/prod/cart-queries.js.map +1 -1
- package/dist/{dev/cart-queries.cjs → prod/cart-queries.mjs} +12 -12
- package/dist/prod/{cart-queries.cjs.map → cart-queries.mjs.map} +1 -1
- package/dist/prod/flatten-connection.js +3 -3
- package/dist/prod/flatten-connection.js.map +1 -1
- package/dist/prod/{flatten-connection.cjs → flatten-connection.mjs} +4 -4
- package/dist/prod/{flatten-connection.cjs.map → flatten-connection.mjs.map} +1 -1
- package/dist/prod/image-size.js +6 -6
- package/dist/prod/image-size.js.map +1 -1
- package/dist/prod/{image-size.cjs → image-size.mjs} +7 -7
- package/dist/{dev/image-size.cjs.map → prod/image-size.mjs.map} +1 -1
- package/dist/prod/index.js +45 -37
- package/dist/prod/index.js.map +1 -1
- package/dist/prod/index.mjs +46 -0
- package/dist/prod/index.mjs.map +1 -0
- package/dist/prod/load-script.js +7 -7
- package/dist/prod/load-script.js.map +1 -1
- package/dist/{dev/load-script.cjs → prod/load-script.mjs} +8 -8
- package/dist/prod/{load-script.cjs.map → load-script.mjs.map} +1 -1
- package/dist/prod/metafield-parser.js +114 -0
- package/dist/prod/metafield-parser.js.map +1 -0
- package/dist/prod/metafield-parser.mjs +114 -0
- package/dist/prod/metafield-parser.mjs.map +1 -0
- package/dist/prod/node_modules/@xstate/fsm/es/index.js +34 -35
- package/dist/prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/{dev/node_modules/@xstate/fsm/es/index.cjs → prod/node_modules/@xstate/fsm/es/index.mjs} +36 -35
- package/dist/prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -0
- package/dist/prod/node_modules/@xstate/react/es/fsm.js +21 -21
- package/dist/prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/{dev/node_modules/@xstate/react/es/fsm.cjs → prod/node_modules/@xstate/react/es/fsm.mjs} +22 -22
- package/dist/prod/node_modules/@xstate/react/es/{fsm.cjs.map → fsm.mjs.map} +1 -1
- package/dist/prod/node_modules/@xstate/react/es/useConstant.js +23 -5
- package/dist/prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/prod/node_modules/@xstate/react/es/useConstant.mjs +12 -0
- package/dist/prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -0
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js +4 -5
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js.map +1 -1
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.mjs +6 -0
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/{use-isomorphic-layout-effect.browser.esm.cjs.map → use-isomorphic-layout-effect.browser.esm.mjs.map} +1 -1
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +13 -11
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.development.cjs → with-selector.development.mjs} +12 -14
- package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs.map → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map} +1 -1
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +12 -10
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/{with-selector.production.min.cjs → with-selector.production.min.mjs} +11 -13
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +11 -9
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/prod/node_modules/use-sync-external-store/cjs/{use-sync-external-store-shim.development.cjs → use-sync-external-store-shim.development.mjs} +10 -12
- package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs.map → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map} +1 -1
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +11 -9
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs} +10 -12
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/index.js +12 -12
- package/dist/prod/node_modules/use-sync-external-store/shim/index.js.map +1 -1
- package/dist/prod/node_modules/use-sync-external-store/shim/index.mjs +21 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js +7 -6
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.mjs +11 -0
- package/dist/prod/node_modules/use-sync-external-store/shim/{with-selector.cjs.map → with-selector.mjs.map} +1 -1
- package/dist/prod/storefront-api-constants.js +3 -3
- package/dist/prod/storefront-api-constants.js.map +1 -1
- package/dist/prod/storefront-api-constants.mjs +5 -0
- package/dist/prod/storefront-api-constants.mjs.map +1 -0
- package/dist/prod/storefront-client.js +6 -6
- package/dist/prod/storefront-client.js.map +1 -1
- package/dist/prod/{storefront-client.cjs → storefront-client.mjs} +7 -7
- package/dist/prod/storefront-client.mjs.map +1 -0
- package/dist/prod/useCartAPIStateMachine.js +20 -20
- package/dist/prod/useCartAPIStateMachine.js.map +1 -1
- package/dist/{dev/useCartAPIStateMachine.cjs → prod/useCartAPIStateMachine.mjs} +21 -21
- package/dist/prod/{useCartAPIStateMachine.cjs.map → useCartAPIStateMachine.mjs.map} +1 -1
- package/dist/prod/useCartActions.js +26 -26
- package/dist/prod/useCartActions.js.map +1 -1
- package/dist/{dev/useCartActions.cjs → prod/useCartActions.mjs} +27 -27
- package/dist/prod/{useCartActions.cjs.map → useCartActions.mjs.map} +1 -1
- package/dist/prod/useMoney.js +10 -10
- package/dist/prod/useMoney.js.map +1 -1
- package/dist/{dev/useMoney.cjs → prod/useMoney.mjs} +11 -11
- package/dist/prod/{useMoney.cjs.map → useMoney.mjs.map} +1 -1
- package/dist/types/AddToCartButton.d.ts +22 -0
- package/dist/types/BaseButton.d.ts +15 -0
- package/dist/types/BuyNowButton.d.ts +15 -0
- package/dist/types/CartCheckoutButton.d.ts +12 -0
- package/dist/types/CartCost.d.ts +13 -0
- package/dist/types/MediaFile.d.ts +3 -1
- package/dist/types/Metafield.d.ts +3 -0
- package/dist/types/ProductPrice.d.ts +1 -2
- package/dist/types/index.d.cts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/metafield-parser.d.ts +222 -0
- package/dist/umd/hydrogen-react.dev.js +483 -204
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +17 -17
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +25 -17
- package/dist/dev/MediaFile.cjs.map +0 -1
- package/dist/dev/Metafield.cjs.map +0 -1
- package/dist/dev/ProductPrice.cjs.map +0 -1
- package/dist/dev/ShopifyProvider.cjs +0 -46
- package/dist/dev/_virtual/index.cjs +0 -5
- package/dist/dev/_virtual/index.cjs.map +0 -1
- package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs +0 -5
- package/dist/dev/_virtual/use-sync-external-store-shim.development.cjs.map +0 -1
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs +0 -5
- package/dist/dev/_virtual/use-sync-external-store-shim.production.min.cjs.map +0 -1
- package/dist/dev/_virtual/with-selector.cjs +0 -5
- package/dist/dev/_virtual/with-selector.cjs.map +0 -1
- package/dist/dev/_virtual/with-selector.development.cjs +0 -5
- package/dist/dev/_virtual/with-selector.development.cjs.map +0 -1
- package/dist/dev/_virtual/with-selector.production.min.cjs +0 -5
- package/dist/dev/_virtual/with-selector.production.min.cjs.map +0 -1
- package/dist/dev/cart-constants.cjs +0 -17
- package/dist/dev/cart-hooks.cjs +0 -48
- package/dist/dev/index.cjs +0 -38
- package/dist/dev/index.cjs.map +0 -1
- package/dist/dev/node_modules/@xstate/fsm/es/index.cjs.map +0 -1
- package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs +0 -30
- package/dist/dev/node_modules/@xstate/react/es/useConstant.cjs.map +0 -1
- package/dist/dev/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +0 -5
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +0 -1
- package/dist/dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +0 -1
- package/dist/dev/node_modules/use-sync-external-store/shim/index.cjs +0 -21
- package/dist/dev/node_modules/use-sync-external-store/shim/with-selector.cjs +0 -12
- package/dist/dev/node_modules/worktop/cookie/index.cjs +0 -27
- package/dist/dev/node_modules/worktop/cookie/index.cjs.map +0 -1
- package/dist/dev/node_modules/worktop/cookie/index.js +0 -27
- package/dist/dev/node_modules/worktop/cookie/index.js.map +0 -1
- package/dist/dev/storefront-api-constants.cjs +0 -5
- package/dist/dev/storefront-api-constants.cjs.map +0 -1
- package/dist/dev/storefront-client.cjs.map +0 -1
- package/dist/prod/MediaFile.cjs.map +0 -1
- package/dist/prod/Metafield.cjs.map +0 -1
- package/dist/prod/ProductPrice.cjs.map +0 -1
- package/dist/prod/ShopifyProvider.cjs +0 -46
- package/dist/prod/_virtual/index.cjs +0 -5
- package/dist/prod/_virtual/index.cjs.map +0 -1
- package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs +0 -5
- package/dist/prod/_virtual/use-sync-external-store-shim.development.cjs.map +0 -1
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs +0 -5
- package/dist/prod/_virtual/use-sync-external-store-shim.production.min.cjs.map +0 -1
- package/dist/prod/_virtual/with-selector.cjs +0 -5
- package/dist/prod/_virtual/with-selector.cjs.map +0 -1
- package/dist/prod/_virtual/with-selector.development.cjs +0 -5
- package/dist/prod/_virtual/with-selector.development.cjs.map +0 -1
- package/dist/prod/_virtual/with-selector.production.min.cjs +0 -5
- package/dist/prod/_virtual/with-selector.production.min.cjs.map +0 -1
- package/dist/prod/cart-constants.cjs +0 -17
- package/dist/prod/cart-hooks.cjs +0 -48
- package/dist/prod/index.cjs +0 -38
- package/dist/prod/index.cjs.map +0 -1
- package/dist/prod/node_modules/@xstate/fsm/es/index.cjs.map +0 -1
- package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs +0 -30
- package/dist/prod/node_modules/@xstate/react/es/useConstant.cjs.map +0 -1
- package/dist/prod/node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.cjs +0 -5
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.cjs.map +0 -1
- package/dist/prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.cjs.map +0 -1
- package/dist/prod/node_modules/use-sync-external-store/shim/index.cjs +0 -21
- package/dist/prod/node_modules/use-sync-external-store/shim/with-selector.cjs +0 -12
- package/dist/prod/node_modules/worktop/cookie/index.cjs +0 -27
- package/dist/prod/node_modules/worktop/cookie/index.cjs.map +0 -1
- package/dist/prod/node_modules/worktop/cookie/index.js +0 -27
- package/dist/prod/node_modules/worktop/cookie/index.js.map +0 -1
- package/dist/prod/storefront-api-constants.cjs +0 -5
- package/dist/prod/storefront-api-constants.cjs.map +0 -1
- package/dist/prod/storefront-client.cjs.map +0 -1
|
@@ -766,7 +766,7 @@ query CartQuery($id: ID!, $numCartLines: Int = 250, $country: CountryCode = ZZ)
|
|
|
766
766
|
${cartFragment}
|
|
767
767
|
`;
|
|
768
768
|
const SFAPI_VERSION = "2022-10";
|
|
769
|
-
var _jsxFileName$
|
|
769
|
+
var _jsxFileName$f = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopifyProvider.tsx";
|
|
770
770
|
const ShopifyContext = React.createContext({
|
|
771
771
|
storeDomain: "test.myshopify.com",
|
|
772
772
|
storefrontToken: "abc123",
|
|
@@ -797,7 +797,7 @@ ${cartFragment}
|
|
|
797
797
|
value: finalConfig,
|
|
798
798
|
__self: this,
|
|
799
799
|
__source: {
|
|
800
|
-
fileName: _jsxFileName$
|
|
800
|
+
fileName: _jsxFileName$f,
|
|
801
801
|
lineNumber: 49,
|
|
802
802
|
columnNumber: 5
|
|
803
803
|
}
|
|
@@ -1312,7 +1312,7 @@ ${cartFragment}
|
|
|
1312
1312
|
function isCartFetchResultEvent(event) {
|
|
1313
1313
|
return event.type === "RESOLVE" || event.type === "ERROR" || event.type === "CART_COMPLETED";
|
|
1314
1314
|
}
|
|
1315
|
-
var _jsxFileName$
|
|
1315
|
+
var _jsxFileName$e = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/CartProvider.tsx";
|
|
1316
1316
|
const CartContext = React.createContext(null);
|
|
1317
1317
|
function useCart() {
|
|
1318
1318
|
const context = React.useContext(CartContext);
|
|
@@ -1625,7 +1625,7 @@ ${cartFragment}
|
|
|
1625
1625
|
value: cartContextValue,
|
|
1626
1626
|
__self: this,
|
|
1627
1627
|
__source: {
|
|
1628
|
-
fileName: _jsxFileName$
|
|
1628
|
+
fileName: _jsxFileName$e,
|
|
1629
1629
|
lineNumber: 425,
|
|
1630
1630
|
columnNumber: 5
|
|
1631
1631
|
}
|
|
@@ -1791,7 +1791,338 @@ fragment ImageFragment on Image {
|
|
|
1791
1791
|
height
|
|
1792
1792
|
}
|
|
1793
1793
|
`;
|
|
1794
|
-
var _jsxFileName$
|
|
1794
|
+
var _jsxFileName$d = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductProvider.tsx";
|
|
1795
|
+
const ProductOptionsContext = React.createContext(null);
|
|
1796
|
+
function ProductProvider({
|
|
1797
|
+
children,
|
|
1798
|
+
data: product,
|
|
1799
|
+
initialVariantId: explicitVariantId
|
|
1800
|
+
}) {
|
|
1801
|
+
const variants = React.useMemo(() => {
|
|
1802
|
+
var _a;
|
|
1803
|
+
return flattenConnection((_a = product.variants) != null ? _a : {});
|
|
1804
|
+
}, [product.variants]);
|
|
1805
|
+
if (!isProductVariantArray(variants)) {
|
|
1806
|
+
throw new Error(`<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'`);
|
|
1807
|
+
}
|
|
1808
|
+
const options = React.useMemo(() => getOptions(variants), [variants]);
|
|
1809
|
+
const [selectedVariant, setSelectedVariant] = React.useState(() => getVariantBasedOnIdProp(explicitVariantId, variants));
|
|
1810
|
+
const [selectedOptions, setSelectedOptions] = React.useState(() => getSelectedOptions(selectedVariant));
|
|
1811
|
+
React.useEffect(() => {
|
|
1812
|
+
const newSelectedVariant = getVariantBasedOnIdProp(explicitVariantId, variants);
|
|
1813
|
+
setSelectedVariant(newSelectedVariant);
|
|
1814
|
+
setSelectedOptions(getSelectedOptions(newSelectedVariant));
|
|
1815
|
+
}, [explicitVariantId, variants]);
|
|
1816
|
+
const setSelectedOption = React.useCallback((name, value2) => {
|
|
1817
|
+
setSelectedOptions((selectedOptions2) => {
|
|
1818
|
+
const opts = {
|
|
1819
|
+
...selectedOptions2,
|
|
1820
|
+
[name]: value2
|
|
1821
|
+
};
|
|
1822
|
+
setSelectedVariant(getSelectedVariant(variants, opts));
|
|
1823
|
+
return opts;
|
|
1824
|
+
});
|
|
1825
|
+
}, [setSelectedOptions, variants]);
|
|
1826
|
+
const isOptionInStock = React.useCallback((option, value2) => {
|
|
1827
|
+
var _a;
|
|
1828
|
+
const proposedVariant = getSelectedVariant(variants, {
|
|
1829
|
+
...selectedOptions,
|
|
1830
|
+
...{
|
|
1831
|
+
[option]: value2
|
|
1832
|
+
}
|
|
1833
|
+
});
|
|
1834
|
+
return (_a = proposedVariant == null ? void 0 : proposedVariant.availableForSale) != null ? _a : true;
|
|
1835
|
+
}, [selectedOptions, variants]);
|
|
1836
|
+
const sellingPlanGroups = React.useMemo(() => {
|
|
1837
|
+
var _a;
|
|
1838
|
+
return flattenConnection((_a = product.sellingPlanGroups) != null ? _a : {}).map((sellingPlanGroup) => {
|
|
1839
|
+
var _a2;
|
|
1840
|
+
return {
|
|
1841
|
+
...sellingPlanGroup,
|
|
1842
|
+
sellingPlans: flattenConnection((_a2 = sellingPlanGroup == null ? void 0 : sellingPlanGroup.sellingPlans) != null ? _a2 : {})
|
|
1843
|
+
};
|
|
1844
|
+
});
|
|
1845
|
+
}, [product.sellingPlanGroups]);
|
|
1846
|
+
const [selectedSellingPlan, setSelectedSellingPlan] = React.useState(void 0);
|
|
1847
|
+
const selectedSellingPlanAllocation = React.useMemo(() => {
|
|
1848
|
+
var _a, _b;
|
|
1849
|
+
if (!selectedVariant || !selectedSellingPlan) {
|
|
1850
|
+
return;
|
|
1851
|
+
}
|
|
1852
|
+
if (!((_a = selectedVariant.sellingPlanAllocations) == null ? void 0 : _a.nodes) && !((_b = selectedVariant.sellingPlanAllocations) == null ? void 0 : _b.edges)) {
|
|
1853
|
+
throw new Error(`<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation`);
|
|
1854
|
+
}
|
|
1855
|
+
return flattenConnection(selectedVariant.sellingPlanAllocations).find((allocation) => {
|
|
1856
|
+
var _a2;
|
|
1857
|
+
return ((_a2 = allocation == null ? void 0 : allocation.sellingPlan) == null ? void 0 : _a2.id) === selectedSellingPlan.id;
|
|
1858
|
+
});
|
|
1859
|
+
}, [selectedVariant, selectedSellingPlan]);
|
|
1860
|
+
const value = React.useMemo(() => ({
|
|
1861
|
+
variants,
|
|
1862
|
+
variantsConnection: product.variants,
|
|
1863
|
+
options,
|
|
1864
|
+
selectedVariant,
|
|
1865
|
+
setSelectedVariant,
|
|
1866
|
+
selectedOptions,
|
|
1867
|
+
setSelectedOption,
|
|
1868
|
+
setSelectedOptions,
|
|
1869
|
+
isOptionInStock,
|
|
1870
|
+
selectedSellingPlan,
|
|
1871
|
+
setSelectedSellingPlan,
|
|
1872
|
+
selectedSellingPlanAllocation,
|
|
1873
|
+
sellingPlanGroups,
|
|
1874
|
+
sellingPlanGroupsConnection: product.sellingPlanGroups
|
|
1875
|
+
}), [isOptionInStock, options, product.sellingPlanGroups, product.variants, selectedOptions, selectedSellingPlan, selectedSellingPlanAllocation, selectedVariant, sellingPlanGroups, setSelectedOption, variants]);
|
|
1876
|
+
return /* @__PURE__ */ React__default.default.createElement(ProductOptionsContext.Provider, {
|
|
1877
|
+
value,
|
|
1878
|
+
__self: this,
|
|
1879
|
+
__source: {
|
|
1880
|
+
fileName: _jsxFileName$d,
|
|
1881
|
+
lineNumber: 201,
|
|
1882
|
+
columnNumber: 5
|
|
1883
|
+
}
|
|
1884
|
+
}, children);
|
|
1885
|
+
}
|
|
1886
|
+
function useProduct() {
|
|
1887
|
+
const context = React.useContext(ProductOptionsContext);
|
|
1888
|
+
if (!context) {
|
|
1889
|
+
throw new Error(`'useProduct' must be a child of <ProductProvider />`);
|
|
1890
|
+
}
|
|
1891
|
+
return context;
|
|
1892
|
+
}
|
|
1893
|
+
function getSelectedVariant(variants, choices) {
|
|
1894
|
+
var _a, _b;
|
|
1895
|
+
if (!variants.length || ((_b = (_a = variants == null ? void 0 : variants[0]) == null ? void 0 : _a.selectedOptions) == null ? void 0 : _b.length) !== Object.keys(choices).length) {
|
|
1896
|
+
return;
|
|
1897
|
+
}
|
|
1898
|
+
return variants == null ? void 0 : variants.find((variant) => {
|
|
1899
|
+
return Object.entries(choices).every(([name, value]) => {
|
|
1900
|
+
var _a2;
|
|
1901
|
+
return (_a2 = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a2.some((option) => (option == null ? void 0 : option.name) === name && (option == null ? void 0 : option.value) === value);
|
|
1902
|
+
});
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
function getOptions(variants) {
|
|
1906
|
+
const map = variants.reduce((memo, variant) => {
|
|
1907
|
+
var _a;
|
|
1908
|
+
if (!variant.selectedOptions) {
|
|
1909
|
+
throw new Error(`'getOptions' requires 'variant.selectedOptions'`);
|
|
1910
|
+
}
|
|
1911
|
+
(_a = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a.forEach((opt) => {
|
|
1912
|
+
var _a2, _b, _c, _d;
|
|
1913
|
+
memo[(_a2 = opt == null ? void 0 : opt.name) != null ? _a2 : ""] = memo[(_b = opt == null ? void 0 : opt.name) != null ? _b : ""] || /* @__PURE__ */ new Set();
|
|
1914
|
+
memo[(_c = opt == null ? void 0 : opt.name) != null ? _c : ""].add((_d = opt == null ? void 0 : opt.value) != null ? _d : "");
|
|
1915
|
+
});
|
|
1916
|
+
return memo;
|
|
1917
|
+
}, {});
|
|
1918
|
+
return Object.keys(map).map((option) => {
|
|
1919
|
+
return {
|
|
1920
|
+
name: option,
|
|
1921
|
+
values: Array.from(map[option])
|
|
1922
|
+
};
|
|
1923
|
+
});
|
|
1924
|
+
}
|
|
1925
|
+
function getVariantBasedOnIdProp(explicitVariantId, variants) {
|
|
1926
|
+
if (explicitVariantId) {
|
|
1927
|
+
const foundVariant = variants.find((variant) => (variant == null ? void 0 : variant.id) === explicitVariantId);
|
|
1928
|
+
if (!foundVariant) {
|
|
1929
|
+
console.warn(`<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID`);
|
|
1930
|
+
}
|
|
1931
|
+
return foundVariant;
|
|
1932
|
+
}
|
|
1933
|
+
if (explicitVariantId === null) {
|
|
1934
|
+
return null;
|
|
1935
|
+
}
|
|
1936
|
+
if (explicitVariantId === void 0) {
|
|
1937
|
+
return variants.find((variant) => variant == null ? void 0 : variant.availableForSale) || variants[0];
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
function getSelectedOptions(selectedVariant) {
|
|
1941
|
+
return (selectedVariant == null ? void 0 : selectedVariant.selectedOptions) ? selectedVariant.selectedOptions.reduce((memo, optionSet) => {
|
|
1942
|
+
var _a, _b;
|
|
1943
|
+
memo[(_a = optionSet == null ? void 0 : optionSet.name) != null ? _a : ""] = (_b = optionSet == null ? void 0 : optionSet.value) != null ? _b : "";
|
|
1944
|
+
return memo;
|
|
1945
|
+
}, {}) : {};
|
|
1946
|
+
}
|
|
1947
|
+
function isProductVariantArray(maybeVariantArray) {
|
|
1948
|
+
if (!maybeVariantArray || !Array.isArray(maybeVariantArray)) {
|
|
1949
|
+
return false;
|
|
1950
|
+
}
|
|
1951
|
+
return true;
|
|
1952
|
+
}
|
|
1953
|
+
var _jsxFileName$c = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/BaseButton.tsx";
|
|
1954
|
+
function BaseButton(props) {
|
|
1955
|
+
const {
|
|
1956
|
+
as,
|
|
1957
|
+
onClick,
|
|
1958
|
+
defaultOnClick,
|
|
1959
|
+
children,
|
|
1960
|
+
buttonRef,
|
|
1961
|
+
...passthroughProps
|
|
1962
|
+
} = props;
|
|
1963
|
+
const handleOnClick = React.useCallback((event) => {
|
|
1964
|
+
if (onClick) {
|
|
1965
|
+
const clickShouldContinue = onClick(event);
|
|
1966
|
+
if (typeof clickShouldContinue === "boolean" && clickShouldContinue === false || (event == null ? void 0 : event.defaultPrevented))
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1969
|
+
defaultOnClick == null ? void 0 : defaultOnClick(event);
|
|
1970
|
+
}, [defaultOnClick, onClick]);
|
|
1971
|
+
const Component = as || "button";
|
|
1972
|
+
return /* @__PURE__ */ React__default.default.createElement(Component, {
|
|
1973
|
+
ref: buttonRef,
|
|
1974
|
+
onClick: handleOnClick,
|
|
1975
|
+
...passthroughProps,
|
|
1976
|
+
__self: this,
|
|
1977
|
+
__source: {
|
|
1978
|
+
fileName: _jsxFileName$c,
|
|
1979
|
+
lineNumber: 59,
|
|
1980
|
+
columnNumber: 5
|
|
1981
|
+
}
|
|
1982
|
+
}, children);
|
|
1983
|
+
}
|
|
1984
|
+
var _jsxFileName$b = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/AddToCartButton.tsx";
|
|
1985
|
+
function AddToCartButton(props) {
|
|
1986
|
+
var _a;
|
|
1987
|
+
const [addingItem, setAddingItem] = React.useState(false);
|
|
1988
|
+
const {
|
|
1989
|
+
variantId: explicitVariantId,
|
|
1990
|
+
quantity = 1,
|
|
1991
|
+
attributes,
|
|
1992
|
+
sellingPlanId,
|
|
1993
|
+
onClick,
|
|
1994
|
+
children,
|
|
1995
|
+
accessibleAddingToCartLabel,
|
|
1996
|
+
...passthroughProps
|
|
1997
|
+
} = props;
|
|
1998
|
+
const {
|
|
1999
|
+
status,
|
|
2000
|
+
linesAdd
|
|
2001
|
+
} = useCart();
|
|
2002
|
+
const {
|
|
2003
|
+
selectedVariant
|
|
2004
|
+
} = useProduct();
|
|
2005
|
+
const variantId = (_a = explicitVariantId != null ? explicitVariantId : selectedVariant == null ? void 0 : selectedVariant.id) != null ? _a : "";
|
|
2006
|
+
const disabled = explicitVariantId === null || variantId === "" || selectedVariant === null || addingItem || passthroughProps.disabled;
|
|
2007
|
+
React.useEffect(() => {
|
|
2008
|
+
if (addingItem && status === "idle") {
|
|
2009
|
+
setAddingItem(false);
|
|
2010
|
+
}
|
|
2011
|
+
}, [status, addingItem]);
|
|
2012
|
+
const handleAddItem = React.useCallback(() => {
|
|
2013
|
+
setAddingItem(true);
|
|
2014
|
+
linesAdd([{
|
|
2015
|
+
quantity,
|
|
2016
|
+
merchandiseId: variantId || "",
|
|
2017
|
+
attributes,
|
|
2018
|
+
sellingPlanId
|
|
2019
|
+
}]);
|
|
2020
|
+
}, [linesAdd, quantity, variantId, attributes, sellingPlanId]);
|
|
2021
|
+
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement(BaseButton, {
|
|
2022
|
+
...passthroughProps,
|
|
2023
|
+
disabled,
|
|
2024
|
+
onClick,
|
|
2025
|
+
defaultOnClick: handleAddItem,
|
|
2026
|
+
__self: this,
|
|
2027
|
+
__source: {
|
|
2028
|
+
fileName: _jsxFileName$b,
|
|
2029
|
+
lineNumber: 71,
|
|
2030
|
+
columnNumber: 7
|
|
2031
|
+
}
|
|
2032
|
+
}, children), accessibleAddingToCartLabel ? /* @__PURE__ */ React__default.default.createElement("p", {
|
|
2033
|
+
style: {
|
|
2034
|
+
position: "absolute",
|
|
2035
|
+
width: "1px",
|
|
2036
|
+
height: "1px",
|
|
2037
|
+
padding: "0",
|
|
2038
|
+
margin: "-1px",
|
|
2039
|
+
overflow: "hidden",
|
|
2040
|
+
clip: "rect(0, 0, 0, 0)",
|
|
2041
|
+
whiteSpace: "nowrap",
|
|
2042
|
+
borderWidth: "0"
|
|
2043
|
+
},
|
|
2044
|
+
role: "alert",
|
|
2045
|
+
"aria-live": "assertive",
|
|
2046
|
+
__self: this,
|
|
2047
|
+
__source: {
|
|
2048
|
+
fileName: _jsxFileName$b,
|
|
2049
|
+
lineNumber: 80,
|
|
2050
|
+
columnNumber: 9
|
|
2051
|
+
}
|
|
2052
|
+
}, addingItem ? accessibleAddingToCartLabel : null) : null);
|
|
2053
|
+
}
|
|
2054
|
+
var _jsxFileName$a = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/BuyNowButton.tsx";
|
|
2055
|
+
function BuyNowButton(props) {
|
|
2056
|
+
const {
|
|
2057
|
+
cartCreate,
|
|
2058
|
+
checkoutUrl
|
|
2059
|
+
} = useCart();
|
|
2060
|
+
const [loading, setLoading] = React.useState(false);
|
|
2061
|
+
const {
|
|
2062
|
+
quantity,
|
|
2063
|
+
variantId,
|
|
2064
|
+
onClick,
|
|
2065
|
+
attributes,
|
|
2066
|
+
children,
|
|
2067
|
+
...passthroughProps
|
|
2068
|
+
} = props;
|
|
2069
|
+
React.useEffect(() => {
|
|
2070
|
+
if (checkoutUrl) {
|
|
2071
|
+
window.location.href = checkoutUrl;
|
|
2072
|
+
}
|
|
2073
|
+
}, [checkoutUrl]);
|
|
2074
|
+
const handleBuyNow = React.useCallback(() => {
|
|
2075
|
+
setLoading(true);
|
|
2076
|
+
cartCreate({
|
|
2077
|
+
lines: [{
|
|
2078
|
+
quantity: quantity != null ? quantity : 1,
|
|
2079
|
+
merchandiseId: variantId,
|
|
2080
|
+
attributes
|
|
2081
|
+
}]
|
|
2082
|
+
});
|
|
2083
|
+
}, [cartCreate, quantity, variantId, attributes]);
|
|
2084
|
+
return /* @__PURE__ */ React__default.default.createElement(BaseButton, {
|
|
2085
|
+
disabled: loading != null ? loading : passthroughProps.disabled,
|
|
2086
|
+
...passthroughProps,
|
|
2087
|
+
onClick,
|
|
2088
|
+
defaultOnClick: handleBuyNow,
|
|
2089
|
+
__self: this,
|
|
2090
|
+
__source: {
|
|
2091
|
+
fileName: _jsxFileName$a,
|
|
2092
|
+
lineNumber: 53,
|
|
2093
|
+
columnNumber: 5
|
|
2094
|
+
}
|
|
2095
|
+
}, children);
|
|
2096
|
+
}
|
|
2097
|
+
var _jsxFileName$9 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/CartCheckoutButton.tsx";
|
|
2098
|
+
function CartCheckoutButton(props) {
|
|
2099
|
+
const [requestedCheckout, setRequestedCheckout] = React.useState(false);
|
|
2100
|
+
const {
|
|
2101
|
+
status,
|
|
2102
|
+
checkoutUrl
|
|
2103
|
+
} = useCart();
|
|
2104
|
+
const {
|
|
2105
|
+
children,
|
|
2106
|
+
...passthroughProps
|
|
2107
|
+
} = props;
|
|
2108
|
+
React.useEffect(() => {
|
|
2109
|
+
if (requestedCheckout && checkoutUrl && status === "idle") {
|
|
2110
|
+
window.location.href = checkoutUrl;
|
|
2111
|
+
}
|
|
2112
|
+
}, [requestedCheckout, status, checkoutUrl]);
|
|
2113
|
+
return /* @__PURE__ */ React__default.default.createElement(BaseButton, {
|
|
2114
|
+
...passthroughProps,
|
|
2115
|
+
disabled: requestedCheckout || passthroughProps.disabled,
|
|
2116
|
+
onClick: () => setRequestedCheckout(true),
|
|
2117
|
+
__self: this,
|
|
2118
|
+
__source: {
|
|
2119
|
+
fileName: _jsxFileName$9,
|
|
2120
|
+
lineNumber: 28,
|
|
2121
|
+
columnNumber: 5
|
|
2122
|
+
}
|
|
2123
|
+
}, children);
|
|
2124
|
+
}
|
|
2125
|
+
var _jsxFileName$8 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ExternalVideo.tsx";
|
|
1795
2126
|
function ExternalVideo(props) {
|
|
1796
2127
|
var _a, _b;
|
|
1797
2128
|
const {
|
|
@@ -1826,7 +2157,7 @@ fragment ImageFragment on Image {
|
|
|
1826
2157
|
loading,
|
|
1827
2158
|
__self: this,
|
|
1828
2159
|
__source: {
|
|
1829
|
-
fileName: _jsxFileName$
|
|
2160
|
+
fileName: _jsxFileName$8,
|
|
1830
2161
|
lineNumber: 56,
|
|
1831
2162
|
columnNumber: 5
|
|
1832
2163
|
}
|
|
@@ -1905,7 +2236,7 @@ fragment ImageFragment on Image {
|
|
|
1905
2236
|
}
|
|
1906
2237
|
return { width: null, height: null };
|
|
1907
2238
|
}
|
|
1908
|
-
var _jsxFileName$
|
|
2239
|
+
var _jsxFileName$7 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Image.tsx";
|
|
1909
2240
|
function Image({
|
|
1910
2241
|
data,
|
|
1911
2242
|
width,
|
|
@@ -1974,7 +2305,7 @@ fragment ImageFragment on Image {
|
|
|
1974
2305
|
decoding,
|
|
1975
2306
|
__self: this,
|
|
1976
2307
|
__source: {
|
|
1977
|
-
fileName: _jsxFileName$
|
|
2308
|
+
fileName: _jsxFileName$7,
|
|
1978
2309
|
lineNumber: 150,
|
|
1979
2310
|
columnNumber: 5
|
|
1980
2311
|
}
|
|
@@ -2010,7 +2341,7 @@ fragment ImageFragment on Image {
|
|
|
2010
2341
|
scale
|
|
2011
2342
|
})} ${size}w`).join(", ");
|
|
2012
2343
|
}
|
|
2013
|
-
var _jsxFileName$
|
|
2344
|
+
var _jsxFileName$6 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Video.tsx";
|
|
2014
2345
|
function Video(props) {
|
|
2015
2346
|
var _a, _b;
|
|
2016
2347
|
const {
|
|
@@ -2037,7 +2368,7 @@ fragment ImageFragment on Image {
|
|
|
2037
2368
|
poster: posterUrl,
|
|
2038
2369
|
__self: this,
|
|
2039
2370
|
__source: {
|
|
2040
|
-
fileName: _jsxFileName$
|
|
2371
|
+
fileName: _jsxFileName$6,
|
|
2041
2372
|
lineNumber: 42,
|
|
2042
2373
|
columnNumber: 5
|
|
2043
2374
|
}
|
|
@@ -2052,7 +2383,7 @@ fragment ImageFragment on Image {
|
|
|
2052
2383
|
type: source.mimeType,
|
|
2053
2384
|
__self: this,
|
|
2054
2385
|
__source: {
|
|
2055
|
-
fileName: _jsxFileName$
|
|
2386
|
+
fileName: _jsxFileName$6,
|
|
2056
2387
|
lineNumber: 54,
|
|
2057
2388
|
columnNumber: 11
|
|
2058
2389
|
}
|
|
@@ -2105,7 +2436,7 @@ fragment ImageFragment on Image {
|
|
|
2105
2436
|
}, [url, stringifiedOptions, options]);
|
|
2106
2437
|
return status;
|
|
2107
2438
|
}
|
|
2108
|
-
var _jsxFileName$
|
|
2439
|
+
var _jsxFileName$5 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ModelViewer.tsx";
|
|
2109
2440
|
function ModelViewer(props) {
|
|
2110
2441
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2111
2442
|
const [modelViewer, setModelViewer] = React.useState(void 0);
|
|
@@ -2243,13 +2574,13 @@ fragment ImageFragment on Image {
|
|
|
2243
2574
|
scale: passthroughProps.scale,
|
|
2244
2575
|
__self: this,
|
|
2245
2576
|
__source: {
|
|
2246
|
-
fileName: _jsxFileName$
|
|
2577
|
+
fileName: _jsxFileName$5,
|
|
2247
2578
|
lineNumber: 222,
|
|
2248
2579
|
columnNumber: 5
|
|
2249
2580
|
}
|
|
2250
2581
|
}, children);
|
|
2251
2582
|
}
|
|
2252
|
-
var _jsxFileName$
|
|
2583
|
+
var _jsxFileName$4 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/MediaFile.tsx";
|
|
2253
2584
|
function MediaFile({
|
|
2254
2585
|
data,
|
|
2255
2586
|
mediaOptions,
|
|
@@ -2269,8 +2600,8 @@ fragment ImageFragment on Image {
|
|
|
2269
2600
|
data: data.image,
|
|
2270
2601
|
__self: this,
|
|
2271
2602
|
__source: {
|
|
2272
|
-
fileName: _jsxFileName$
|
|
2273
|
-
lineNumber:
|
|
2603
|
+
fileName: _jsxFileName$4,
|
|
2604
|
+
lineNumber: 54,
|
|
2274
2605
|
columnNumber: 9
|
|
2275
2606
|
}
|
|
2276
2607
|
});
|
|
@@ -2282,8 +2613,8 @@ fragment ImageFragment on Image {
|
|
|
2282
2613
|
data,
|
|
2283
2614
|
__self: this,
|
|
2284
2615
|
__source: {
|
|
2285
|
-
fileName: _jsxFileName$
|
|
2286
|
-
lineNumber:
|
|
2616
|
+
fileName: _jsxFileName$4,
|
|
2617
|
+
lineNumber: 63,
|
|
2287
2618
|
columnNumber: 9
|
|
2288
2619
|
}
|
|
2289
2620
|
});
|
|
@@ -2295,8 +2626,8 @@ fragment ImageFragment on Image {
|
|
|
2295
2626
|
data,
|
|
2296
2627
|
__self: this,
|
|
2297
2628
|
__source: {
|
|
2298
|
-
fileName: _jsxFileName$
|
|
2299
|
-
lineNumber:
|
|
2629
|
+
fileName: _jsxFileName$4,
|
|
2630
|
+
lineNumber: 68,
|
|
2300
2631
|
columnNumber: 9
|
|
2301
2632
|
}
|
|
2302
2633
|
});
|
|
@@ -2308,8 +2639,8 @@ fragment ImageFragment on Image {
|
|
|
2308
2639
|
data,
|
|
2309
2640
|
__self: this,
|
|
2310
2641
|
__source: {
|
|
2311
|
-
fileName: _jsxFileName$
|
|
2312
|
-
lineNumber:
|
|
2642
|
+
fileName: _jsxFileName$4,
|
|
2643
|
+
lineNumber: 78,
|
|
2313
2644
|
columnNumber: 9
|
|
2314
2645
|
}
|
|
2315
2646
|
});
|
|
@@ -2322,7 +2653,7 @@ fragment ImageFragment on Image {
|
|
|
2322
2653
|
}
|
|
2323
2654
|
}
|
|
2324
2655
|
}
|
|
2325
|
-
var _jsxFileName$
|
|
2656
|
+
var _jsxFileName$3 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Metafield.tsx";
|
|
2326
2657
|
function Metafield(props) {
|
|
2327
2658
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2328
2659
|
const {
|
|
@@ -2353,7 +2684,7 @@ fragment ImageFragment on Image {
|
|
|
2353
2684
|
...passthroughProps,
|
|
2354
2685
|
__self: this,
|
|
2355
2686
|
__source: {
|
|
2356
|
-
fileName: _jsxFileName$
|
|
2687
|
+
fileName: _jsxFileName$3,
|
|
2357
2688
|
lineNumber: 68,
|
|
2358
2689
|
columnNumber: 9
|
|
2359
2690
|
}
|
|
@@ -2365,7 +2696,7 @@ fragment ImageFragment on Image {
|
|
|
2365
2696
|
...passthroughProps,
|
|
2366
2697
|
__self: this,
|
|
2367
2698
|
__source: {
|
|
2368
|
-
fileName: _jsxFileName$
|
|
2699
|
+
fileName: _jsxFileName$3,
|
|
2369
2700
|
lineNumber: 76,
|
|
2370
2701
|
columnNumber: 9
|
|
2371
2702
|
}
|
|
@@ -2379,7 +2710,7 @@ fragment ImageFragment on Image {
|
|
|
2379
2710
|
...passthroughProps,
|
|
2380
2711
|
__self: this,
|
|
2381
2712
|
__source: {
|
|
2382
|
-
fileName: _jsxFileName$
|
|
2713
|
+
fileName: _jsxFileName$3,
|
|
2383
2714
|
lineNumber: 86,
|
|
2384
2715
|
columnNumber: 9
|
|
2385
2716
|
}
|
|
@@ -2391,7 +2722,7 @@ fragment ImageFragment on Image {
|
|
|
2391
2722
|
...passthroughProps,
|
|
2392
2723
|
__self: this,
|
|
2393
2724
|
__source: {
|
|
2394
|
-
fileName: _jsxFileName$
|
|
2725
|
+
fileName: _jsxFileName$3,
|
|
2395
2726
|
lineNumber: 94,
|
|
2396
2727
|
columnNumber: 9
|
|
2397
2728
|
}
|
|
@@ -2406,7 +2737,7 @@ fragment ImageFragment on Image {
|
|
|
2406
2737
|
},
|
|
2407
2738
|
__self: this,
|
|
2408
2739
|
__source: {
|
|
2409
|
-
fileName: _jsxFileName$
|
|
2740
|
+
fileName: _jsxFileName$3,
|
|
2410
2741
|
lineNumber: 102,
|
|
2411
2742
|
columnNumber: 9
|
|
2412
2743
|
}
|
|
@@ -2421,7 +2752,7 @@ fragment ImageFragment on Image {
|
|
|
2421
2752
|
},
|
|
2422
2753
|
__self: this,
|
|
2423
2754
|
__source: {
|
|
2424
|
-
fileName: _jsxFileName$
|
|
2755
|
+
fileName: _jsxFileName$3,
|
|
2425
2756
|
lineNumber: 111,
|
|
2426
2757
|
columnNumber: 9
|
|
2427
2758
|
}
|
|
@@ -2434,7 +2765,7 @@ fragment ImageFragment on Image {
|
|
|
2434
2765
|
...passthroughProps,
|
|
2435
2766
|
__self: this,
|
|
2436
2767
|
__source: {
|
|
2437
|
-
fileName: _jsxFileName$
|
|
2768
|
+
fileName: _jsxFileName$3,
|
|
2438
2769
|
lineNumber: 122,
|
|
2439
2770
|
columnNumber: 9
|
|
2440
2771
|
}
|
|
@@ -2446,7 +2777,7 @@ fragment ImageFragment on Image {
|
|
|
2446
2777
|
...passthroughProps,
|
|
2447
2778
|
__self: this,
|
|
2448
2779
|
__source: {
|
|
2449
|
-
fileName: _jsxFileName$
|
|
2780
|
+
fileName: _jsxFileName$3,
|
|
2450
2781
|
lineNumber: 133,
|
|
2451
2782
|
columnNumber: 9
|
|
2452
2783
|
}
|
|
@@ -2461,7 +2792,7 @@ fragment ImageFragment on Image {
|
|
|
2461
2792
|
...passthroughProps,
|
|
2462
2793
|
__self: this,
|
|
2463
2794
|
__source: {
|
|
2464
|
-
fileName: _jsxFileName$
|
|
2795
|
+
fileName: _jsxFileName$3,
|
|
2465
2796
|
lineNumber: 144,
|
|
2466
2797
|
columnNumber: 9
|
|
2467
2798
|
}
|
|
@@ -2474,7 +2805,7 @@ fragment ImageFragment on Image {
|
|
|
2474
2805
|
...passthroughProps,
|
|
2475
2806
|
__self: this,
|
|
2476
2807
|
__source: {
|
|
2477
|
-
fileName: _jsxFileName$
|
|
2808
|
+
fileName: _jsxFileName$3,
|
|
2478
2809
|
lineNumber: 154,
|
|
2479
2810
|
columnNumber: 9
|
|
2480
2811
|
}
|
|
@@ -2482,7 +2813,7 @@ fragment ImageFragment on Image {
|
|
|
2482
2813
|
key: `${ref != null ? ref : ""}-${index2}`,
|
|
2483
2814
|
__self: this,
|
|
2484
2815
|
__source: {
|
|
2485
|
-
fileName: _jsxFileName$
|
|
2816
|
+
fileName: _jsxFileName$3,
|
|
2486
2817
|
lineNumber: 158,
|
|
2487
2818
|
columnNumber: 13
|
|
2488
2819
|
}
|
|
@@ -2496,7 +2827,7 @@ fragment ImageFragment on Image {
|
|
|
2496
2827
|
...passthroughProps,
|
|
2497
2828
|
__self: this,
|
|
2498
2829
|
__source: {
|
|
2499
|
-
fileName: _jsxFileName$
|
|
2830
|
+
fileName: _jsxFileName$3,
|
|
2500
2831
|
lineNumber: 167,
|
|
2501
2832
|
columnNumber: 11
|
|
2502
2833
|
}
|
|
@@ -2508,7 +2839,7 @@ fragment ImageFragment on Image {
|
|
|
2508
2839
|
...passthroughProps,
|
|
2509
2840
|
__self: this,
|
|
2510
2841
|
__source: {
|
|
2511
|
-
fileName: _jsxFileName$
|
|
2842
|
+
fileName: _jsxFileName$3,
|
|
2512
2843
|
lineNumber: 172,
|
|
2513
2844
|
columnNumber: 11
|
|
2514
2845
|
}
|
|
@@ -2516,7 +2847,7 @@ fragment ImageFragment on Image {
|
|
|
2516
2847
|
data: ref.previewImage,
|
|
2517
2848
|
__self: this,
|
|
2518
2849
|
__source: {
|
|
2519
|
-
fileName: _jsxFileName$
|
|
2850
|
+
fileName: _jsxFileName$3,
|
|
2520
2851
|
lineNumber: 173,
|
|
2521
2852
|
columnNumber: 13
|
|
2522
2853
|
}
|
|
@@ -2528,7 +2859,7 @@ fragment ImageFragment on Image {
|
|
|
2528
2859
|
data: ref,
|
|
2529
2860
|
__self: this,
|
|
2530
2861
|
__source: {
|
|
2531
|
-
fileName: _jsxFileName$
|
|
2862
|
+
fileName: _jsxFileName$3,
|
|
2532
2863
|
lineNumber: 178,
|
|
2533
2864
|
columnNumber: 16
|
|
2534
2865
|
}
|
|
@@ -2541,13 +2872,16 @@ fragment ImageFragment on Image {
|
|
|
2541
2872
|
...passthroughProps,
|
|
2542
2873
|
__self: this,
|
|
2543
2874
|
__source: {
|
|
2544
|
-
fileName: _jsxFileName$
|
|
2875
|
+
fileName: _jsxFileName$3,
|
|
2545
2876
|
lineNumber: 185,
|
|
2546
2877
|
columnNumber: 5
|
|
2547
2878
|
}
|
|
2548
2879
|
}, (_i = parsedMetafield.value) == null ? void 0 : _i.toString());
|
|
2549
2880
|
}
|
|
2550
2881
|
function parseMetafield(metafield) {
|
|
2882
|
+
{
|
|
2883
|
+
console.info(`'parseMetafield()' will have a breaking change in a future version; its behavior will match that of 'metafieldParser()'`);
|
|
2884
|
+
}
|
|
2551
2885
|
if (!metafield) {
|
|
2552
2886
|
{
|
|
2553
2887
|
console.warn(`'parseMetafield' was not passed any value for the 'metafield' argument`);
|
|
@@ -2563,6 +2897,9 @@ fragment ImageFragment on Image {
|
|
|
2563
2897
|
};
|
|
2564
2898
|
}
|
|
2565
2899
|
function parseMetafieldValue(metafield) {
|
|
2900
|
+
{
|
|
2901
|
+
console.info(`'parseMetafieldValue()' will be removed in a future version`);
|
|
2902
|
+
}
|
|
2566
2903
|
if (!metafield) {
|
|
2567
2904
|
return null;
|
|
2568
2905
|
}
|
|
@@ -2690,6 +3027,103 @@ fragment ImageFragment on Image {
|
|
|
2690
3027
|
throw new Error(`Unit not supported: ${unit}`);
|
|
2691
3028
|
}
|
|
2692
3029
|
}
|
|
3030
|
+
function metafieldParser(metafield) {
|
|
3031
|
+
var _a, _b, _c, _d;
|
|
3032
|
+
if (!metafield.type) {
|
|
3033
|
+
const noTypeError = `metafieldParser(): The 'type' field is required in order to parse the Metafield.`;
|
|
3034
|
+
{
|
|
3035
|
+
throw new Error(noTypeError);
|
|
3036
|
+
}
|
|
3037
|
+
}
|
|
3038
|
+
switch (metafield.type) {
|
|
3039
|
+
case "boolean":
|
|
3040
|
+
return {
|
|
3041
|
+
...metafield,
|
|
3042
|
+
parsedValue: metafield.value === "true"
|
|
3043
|
+
};
|
|
3044
|
+
case "collection_reference":
|
|
3045
|
+
case "file_reference":
|
|
3046
|
+
case "page_reference":
|
|
3047
|
+
case "product_reference":
|
|
3048
|
+
case "variant_reference":
|
|
3049
|
+
return {
|
|
3050
|
+
...metafield,
|
|
3051
|
+
parsedValue: metafield.reference
|
|
3052
|
+
};
|
|
3053
|
+
case "color":
|
|
3054
|
+
case "multi_line_text_field":
|
|
3055
|
+
case "single_line_text_field":
|
|
3056
|
+
case "url":
|
|
3057
|
+
return {
|
|
3058
|
+
...metafield,
|
|
3059
|
+
parsedValue: metafield.value
|
|
3060
|
+
};
|
|
3061
|
+
case "dimension":
|
|
3062
|
+
case "money":
|
|
3063
|
+
case "json":
|
|
3064
|
+
case "rating":
|
|
3065
|
+
case "volume":
|
|
3066
|
+
case "weight":
|
|
3067
|
+
case "list.color":
|
|
3068
|
+
case "list.dimension":
|
|
3069
|
+
case "list.number_integer":
|
|
3070
|
+
case "list.number_decimal":
|
|
3071
|
+
case "list.rating":
|
|
3072
|
+
case "list.single_line_text_field":
|
|
3073
|
+
case "list.url":
|
|
3074
|
+
case "list.volume":
|
|
3075
|
+
case "list.weight": {
|
|
3076
|
+
let parsedValue = null;
|
|
3077
|
+
try {
|
|
3078
|
+
parsedValue = parseJSON((_a = metafield.value) != null ? _a : "");
|
|
3079
|
+
} catch (err) {
|
|
3080
|
+
const parseError = `metafieldParser(): attempted to JSON.parse the 'metafield.value' property, but failed.`;
|
|
3081
|
+
{
|
|
3082
|
+
throw new Error(parseError);
|
|
3083
|
+
}
|
|
3084
|
+
}
|
|
3085
|
+
return {
|
|
3086
|
+
...metafield,
|
|
3087
|
+
parsedValue
|
|
3088
|
+
};
|
|
3089
|
+
}
|
|
3090
|
+
case "date":
|
|
3091
|
+
case "date_time":
|
|
3092
|
+
return {
|
|
3093
|
+
...metafield,
|
|
3094
|
+
parsedValue: new Date((_b = metafield.value) != null ? _b : "")
|
|
3095
|
+
};
|
|
3096
|
+
case "list.date":
|
|
3097
|
+
case "list.date_time": {
|
|
3098
|
+
const jsonParseValue = parseJSON((_c = metafield == null ? void 0 : metafield.value) != null ? _c : "");
|
|
3099
|
+
return {
|
|
3100
|
+
...metafield,
|
|
3101
|
+
parsedValue: jsonParseValue.map((dateString) => new Date(dateString))
|
|
3102
|
+
};
|
|
3103
|
+
}
|
|
3104
|
+
case "number_decimal":
|
|
3105
|
+
case "number_integer":
|
|
3106
|
+
return {
|
|
3107
|
+
...metafield,
|
|
3108
|
+
parsedValue: Number(metafield.value)
|
|
3109
|
+
};
|
|
3110
|
+
case "list.collection_reference":
|
|
3111
|
+
case "list.file_reference":
|
|
3112
|
+
case "list.page_reference":
|
|
3113
|
+
case "list.product_reference":
|
|
3114
|
+
case "list.variant_reference":
|
|
3115
|
+
return {
|
|
3116
|
+
...metafield,
|
|
3117
|
+
parsedValue: flattenConnection((_d = metafield.references) != null ? _d : void 0)
|
|
3118
|
+
};
|
|
3119
|
+
default: {
|
|
3120
|
+
const typeNotFoundError = `metafieldParser(): the 'metafield.type' you passed in is not supported. Your type: "${metafield.type}". If you believe this is an error, please open an issue on GitHub.`;
|
|
3121
|
+
{
|
|
3122
|
+
throw new Error(typeNotFoundError);
|
|
3123
|
+
}
|
|
3124
|
+
}
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
2693
3127
|
function useMoney(money) {
|
|
2694
3128
|
const {
|
|
2695
3129
|
locale
|
|
@@ -2756,7 +3190,7 @@ fragment ImageFragment on Image {
|
|
|
2756
3190
|
return () => memoized != null ? memoized : memoized = new Intl.NumberFormat(locale, options);
|
|
2757
3191
|
}, [locale, options]);
|
|
2758
3192
|
}
|
|
2759
|
-
var _jsxFileName$
|
|
3193
|
+
var _jsxFileName$2 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/Money.tsx";
|
|
2760
3194
|
function Money({
|
|
2761
3195
|
data,
|
|
2762
3196
|
as,
|
|
@@ -2785,7 +3219,7 @@ fragment ImageFragment on Image {
|
|
|
2785
3219
|
...passthroughProps,
|
|
2786
3220
|
__self: this,
|
|
2787
3221
|
__source: {
|
|
2788
|
-
fileName: _jsxFileName$
|
|
3222
|
+
fileName: _jsxFileName$2,
|
|
2789
3223
|
lineNumber: 65,
|
|
2790
3224
|
columnNumber: 5
|
|
2791
3225
|
}
|
|
@@ -2794,7 +3228,7 @@ fragment ImageFragment on Image {
|
|
|
2794
3228
|
function isMoney(maybeMoney) {
|
|
2795
3229
|
return typeof maybeMoney.amount === "string" && !!maybeMoney.amount && typeof maybeMoney.currencyCode === "string" && !!maybeMoney.currencyCode;
|
|
2796
3230
|
}
|
|
2797
|
-
var _jsxFileName$
|
|
3231
|
+
var _jsxFileName$1 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductPrice.tsx";
|
|
2798
3232
|
function ProductPrice(props) {
|
|
2799
3233
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2800
3234
|
const {
|
|
@@ -2844,7 +3278,7 @@ fragment ImageFragment on Image {
|
|
|
2844
3278
|
measurement,
|
|
2845
3279
|
__self: this,
|
|
2846
3280
|
__source: {
|
|
2847
|
-
fileName: _jsxFileName$
|
|
3281
|
+
fileName: _jsxFileName$1,
|
|
2848
3282
|
lineNumber: 81,
|
|
2849
3283
|
columnNumber: 7
|
|
2850
3284
|
}
|
|
@@ -2855,171 +3289,12 @@ fragment ImageFragment on Image {
|
|
|
2855
3289
|
data: price,
|
|
2856
3290
|
__self: this,
|
|
2857
3291
|
__source: {
|
|
2858
|
-
fileName: _jsxFileName$
|
|
3292
|
+
fileName: _jsxFileName$1,
|
|
2859
3293
|
lineNumber: 85,
|
|
2860
3294
|
columnNumber: 10
|
|
2861
3295
|
}
|
|
2862
3296
|
});
|
|
2863
3297
|
}
|
|
2864
|
-
var _jsxFileName$1 = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ProductProvider.tsx";
|
|
2865
|
-
const ProductOptionsContext = React.createContext(null);
|
|
2866
|
-
function ProductProvider({
|
|
2867
|
-
children,
|
|
2868
|
-
data: product,
|
|
2869
|
-
initialVariantId: explicitVariantId
|
|
2870
|
-
}) {
|
|
2871
|
-
const variants = React.useMemo(() => {
|
|
2872
|
-
var _a;
|
|
2873
|
-
return flattenConnection((_a = product.variants) != null ? _a : {});
|
|
2874
|
-
}, [product.variants]);
|
|
2875
|
-
if (!isProductVariantArray(variants)) {
|
|
2876
|
-
throw new Error(`<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'`);
|
|
2877
|
-
}
|
|
2878
|
-
const options = React.useMemo(() => getOptions(variants), [variants]);
|
|
2879
|
-
const [selectedVariant, setSelectedVariant] = React.useState(() => getVariantBasedOnIdProp(explicitVariantId, variants));
|
|
2880
|
-
const [selectedOptions, setSelectedOptions] = React.useState(() => getSelectedOptions(selectedVariant));
|
|
2881
|
-
React.useEffect(() => {
|
|
2882
|
-
const newSelectedVariant = getVariantBasedOnIdProp(explicitVariantId, variants);
|
|
2883
|
-
setSelectedVariant(newSelectedVariant);
|
|
2884
|
-
setSelectedOptions(getSelectedOptions(newSelectedVariant));
|
|
2885
|
-
}, [explicitVariantId, variants]);
|
|
2886
|
-
const setSelectedOption = React.useCallback((name, value2) => {
|
|
2887
|
-
setSelectedOptions((selectedOptions2) => {
|
|
2888
|
-
const opts = {
|
|
2889
|
-
...selectedOptions2,
|
|
2890
|
-
[name]: value2
|
|
2891
|
-
};
|
|
2892
|
-
setSelectedVariant(getSelectedVariant(variants, opts));
|
|
2893
|
-
return opts;
|
|
2894
|
-
});
|
|
2895
|
-
}, [setSelectedOptions, variants]);
|
|
2896
|
-
const isOptionInStock = React.useCallback((option, value2) => {
|
|
2897
|
-
var _a;
|
|
2898
|
-
const proposedVariant = getSelectedVariant(variants, {
|
|
2899
|
-
...selectedOptions,
|
|
2900
|
-
...{
|
|
2901
|
-
[option]: value2
|
|
2902
|
-
}
|
|
2903
|
-
});
|
|
2904
|
-
return (_a = proposedVariant == null ? void 0 : proposedVariant.availableForSale) != null ? _a : true;
|
|
2905
|
-
}, [selectedOptions, variants]);
|
|
2906
|
-
const sellingPlanGroups = React.useMemo(() => {
|
|
2907
|
-
var _a;
|
|
2908
|
-
return flattenConnection((_a = product.sellingPlanGroups) != null ? _a : {}).map((sellingPlanGroup) => {
|
|
2909
|
-
var _a2;
|
|
2910
|
-
return {
|
|
2911
|
-
...sellingPlanGroup,
|
|
2912
|
-
sellingPlans: flattenConnection((_a2 = sellingPlanGroup == null ? void 0 : sellingPlanGroup.sellingPlans) != null ? _a2 : {})
|
|
2913
|
-
};
|
|
2914
|
-
});
|
|
2915
|
-
}, [product.sellingPlanGroups]);
|
|
2916
|
-
const [selectedSellingPlan, setSelectedSellingPlan] = React.useState(void 0);
|
|
2917
|
-
const selectedSellingPlanAllocation = React.useMemo(() => {
|
|
2918
|
-
var _a, _b;
|
|
2919
|
-
if (!selectedVariant || !selectedSellingPlan) {
|
|
2920
|
-
return;
|
|
2921
|
-
}
|
|
2922
|
-
if (!((_a = selectedVariant.sellingPlanAllocations) == null ? void 0 : _a.nodes) && !((_b = selectedVariant.sellingPlanAllocations) == null ? void 0 : _b.edges)) {
|
|
2923
|
-
throw new Error(`<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation`);
|
|
2924
|
-
}
|
|
2925
|
-
return flattenConnection(selectedVariant.sellingPlanAllocations).find((allocation) => {
|
|
2926
|
-
var _a2;
|
|
2927
|
-
return ((_a2 = allocation == null ? void 0 : allocation.sellingPlan) == null ? void 0 : _a2.id) === selectedSellingPlan.id;
|
|
2928
|
-
});
|
|
2929
|
-
}, [selectedVariant, selectedSellingPlan]);
|
|
2930
|
-
const value = React.useMemo(() => ({
|
|
2931
|
-
variants,
|
|
2932
|
-
variantsConnection: product.variants,
|
|
2933
|
-
options,
|
|
2934
|
-
selectedVariant,
|
|
2935
|
-
setSelectedVariant,
|
|
2936
|
-
selectedOptions,
|
|
2937
|
-
setSelectedOption,
|
|
2938
|
-
setSelectedOptions,
|
|
2939
|
-
isOptionInStock,
|
|
2940
|
-
selectedSellingPlan,
|
|
2941
|
-
setSelectedSellingPlan,
|
|
2942
|
-
selectedSellingPlanAllocation,
|
|
2943
|
-
sellingPlanGroups,
|
|
2944
|
-
sellingPlanGroupsConnection: product.sellingPlanGroups
|
|
2945
|
-
}), [isOptionInStock, options, product.sellingPlanGroups, product.variants, selectedOptions, selectedSellingPlan, selectedSellingPlanAllocation, selectedVariant, sellingPlanGroups, setSelectedOption, variants]);
|
|
2946
|
-
return /* @__PURE__ */ React__default.default.createElement(ProductOptionsContext.Provider, {
|
|
2947
|
-
value,
|
|
2948
|
-
__self: this,
|
|
2949
|
-
__source: {
|
|
2950
|
-
fileName: _jsxFileName$1,
|
|
2951
|
-
lineNumber: 201,
|
|
2952
|
-
columnNumber: 5
|
|
2953
|
-
}
|
|
2954
|
-
}, children);
|
|
2955
|
-
}
|
|
2956
|
-
function useProduct() {
|
|
2957
|
-
const context = React.useContext(ProductOptionsContext);
|
|
2958
|
-
if (!context) {
|
|
2959
|
-
throw new Error(`'useProduct' must be a child of <ProductProvider />`);
|
|
2960
|
-
}
|
|
2961
|
-
return context;
|
|
2962
|
-
}
|
|
2963
|
-
function getSelectedVariant(variants, choices) {
|
|
2964
|
-
var _a, _b;
|
|
2965
|
-
if (!variants.length || ((_b = (_a = variants == null ? void 0 : variants[0]) == null ? void 0 : _a.selectedOptions) == null ? void 0 : _b.length) !== Object.keys(choices).length) {
|
|
2966
|
-
return;
|
|
2967
|
-
}
|
|
2968
|
-
return variants == null ? void 0 : variants.find((variant) => {
|
|
2969
|
-
return Object.entries(choices).every(([name, value]) => {
|
|
2970
|
-
var _a2;
|
|
2971
|
-
return (_a2 = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a2.some((option) => (option == null ? void 0 : option.name) === name && (option == null ? void 0 : option.value) === value);
|
|
2972
|
-
});
|
|
2973
|
-
});
|
|
2974
|
-
}
|
|
2975
|
-
function getOptions(variants) {
|
|
2976
|
-
const map = variants.reduce((memo, variant) => {
|
|
2977
|
-
var _a;
|
|
2978
|
-
if (!variant.selectedOptions) {
|
|
2979
|
-
throw new Error(`'getOptions' requires 'variant.selectedOptions'`);
|
|
2980
|
-
}
|
|
2981
|
-
(_a = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a.forEach((opt) => {
|
|
2982
|
-
var _a2, _b, _c, _d;
|
|
2983
|
-
memo[(_a2 = opt == null ? void 0 : opt.name) != null ? _a2 : ""] = memo[(_b = opt == null ? void 0 : opt.name) != null ? _b : ""] || /* @__PURE__ */ new Set();
|
|
2984
|
-
memo[(_c = opt == null ? void 0 : opt.name) != null ? _c : ""].add((_d = opt == null ? void 0 : opt.value) != null ? _d : "");
|
|
2985
|
-
});
|
|
2986
|
-
return memo;
|
|
2987
|
-
}, {});
|
|
2988
|
-
return Object.keys(map).map((option) => {
|
|
2989
|
-
return {
|
|
2990
|
-
name: option,
|
|
2991
|
-
values: Array.from(map[option])
|
|
2992
|
-
};
|
|
2993
|
-
});
|
|
2994
|
-
}
|
|
2995
|
-
function getVariantBasedOnIdProp(explicitVariantId, variants) {
|
|
2996
|
-
if (explicitVariantId) {
|
|
2997
|
-
const foundVariant = variants.find((variant) => (variant == null ? void 0 : variant.id) === explicitVariantId);
|
|
2998
|
-
if (!foundVariant) {
|
|
2999
|
-
console.warn(`<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID`);
|
|
3000
|
-
}
|
|
3001
|
-
return foundVariant;
|
|
3002
|
-
}
|
|
3003
|
-
if (explicitVariantId === null) {
|
|
3004
|
-
return null;
|
|
3005
|
-
}
|
|
3006
|
-
if (explicitVariantId === void 0) {
|
|
3007
|
-
return variants.find((variant) => variant == null ? void 0 : variant.availableForSale) || variants[0];
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
function getSelectedOptions(selectedVariant) {
|
|
3011
|
-
return (selectedVariant == null ? void 0 : selectedVariant.selectedOptions) ? selectedVariant.selectedOptions.reduce((memo, optionSet) => {
|
|
3012
|
-
var _a, _b;
|
|
3013
|
-
memo[(_a = optionSet == null ? void 0 : optionSet.name) != null ? _a : ""] = (_b = optionSet == null ? void 0 : optionSet.value) != null ? _b : "";
|
|
3014
|
-
return memo;
|
|
3015
|
-
}, {}) : {};
|
|
3016
|
-
}
|
|
3017
|
-
function isProductVariantArray(maybeVariantArray) {
|
|
3018
|
-
if (!maybeVariantArray || !Array.isArray(maybeVariantArray)) {
|
|
3019
|
-
return false;
|
|
3020
|
-
}
|
|
3021
|
-
return true;
|
|
3022
|
-
}
|
|
3023
3298
|
var _jsxFileName = "/home/runner/work/hydrogen-ui/hydrogen-ui/packages/react/src/ShopPayButton.tsx";
|
|
3024
3299
|
const SHOPJS_URL = "https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";
|
|
3025
3300
|
function ShopPayButton({
|
|
@@ -3095,7 +3370,7 @@ fragment ImageFragment on Image {
|
|
|
3095
3370
|
}) {
|
|
3096
3371
|
if (storefrontApiVersion !== SFAPI_VERSION) {
|
|
3097
3372
|
console.warn(
|
|
3098
|
-
`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen-UI is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${storefrontApiVersion}"; expected version ${SFAPI_VERSION}`
|
|
3373
|
+
`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen-UI is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${storefrontApiVersion}"; expected version "${SFAPI_VERSION}"`
|
|
3099
3374
|
);
|
|
3100
3375
|
}
|
|
3101
3376
|
if (!privateStorefrontToken && !globalThis.document) {
|
|
@@ -3153,6 +3428,9 @@ fragment ImageFragment on Image {
|
|
|
3153
3428
|
}
|
|
3154
3429
|
};
|
|
3155
3430
|
}
|
|
3431
|
+
exports2.AddToCartButton = AddToCartButton;
|
|
3432
|
+
exports2.BuyNowButton = BuyNowButton;
|
|
3433
|
+
exports2.CartCheckoutButton = CartCheckoutButton;
|
|
3156
3434
|
exports2.CartProvider = CartProvider;
|
|
3157
3435
|
exports2.ExternalVideo = ExternalVideo;
|
|
3158
3436
|
exports2.Image = Image;
|
|
@@ -3167,6 +3445,7 @@ fragment ImageFragment on Image {
|
|
|
3167
3445
|
exports2.Video = Video;
|
|
3168
3446
|
exports2.createStorefrontClient = createStorefrontClient;
|
|
3169
3447
|
exports2.flattenConnection = flattenConnection;
|
|
3448
|
+
exports2.metafieldParser = metafieldParser;
|
|
3170
3449
|
exports2.parseMetafield = parseMetafield;
|
|
3171
3450
|
exports2.parseMetafieldValue = parseMetafieldValue;
|
|
3172
3451
|
exports2.useCart = useCart;
|