@shopify/hydrogen-react 2022.7.1 → 2022.10.1
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/README.md +1 -1
- 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.cjs.map → MediaFile.mjs.map} +1 -1
- package/dist/dev/Metafield.js +32 -32
- package/dist/dev/Metafield.js.map +1 -1
- package/dist/dev/{Metafield.cjs → Metafield.mjs} +33 -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.cjs.map → ProductPrice.mjs.map} +1 -1
- 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/{prod/ProductProvider.cjs.map → dev/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 -56
- 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 -113
- package/dist/dev/cart-queries.js.map +1 -1
- package/dist/{prod/cart-queries.cjs → dev/cart-queries.mjs} +12 -114
- 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 +37 -40
- package/dist/dev/index.js.map +1 -1
- package/dist/dev/index.mjs +38 -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/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/dev/node_modules/@xstate/react/es/{fsm.cjs → 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/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs → dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/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/{prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs → dev/node_modules/use-sync-external-store/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/node_modules/worktop/cookie/index.js +3 -3
- package/dist/dev/node_modules/worktop/cookie/index.js.map +1 -1
- package/dist/{prod/node_modules/worktop/cookie/index.cjs → dev/node_modules/worktop/cookie/index.mjs} +4 -4
- package/dist/dev/node_modules/worktop/cookie/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/dev/storefront-api-constants.js +4 -4
- 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/dev/{useCartAPIStateMachine.cjs → 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/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.cjs.map → MediaFile.mjs.map} +1 -1
- 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.cjs.map → ProductPrice.mjs.map} +1 -1
- 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/{dev/ProductProvider.cjs.map → prod/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 -56
- 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 -113
- package/dist/prod/cart-queries.js.map +1 -1
- package/dist/{dev/cart-queries.cjs → prod/cart-queries.mjs} +12 -114
- 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 +37 -40
- package/dist/prod/index.js.map +1 -1
- package/dist/prod/index.mjs +38 -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/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/prod/node_modules/@xstate/react/es/{fsm.cjs → 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/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.cjs → prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/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/{dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.cjs → prod/node_modules/use-sync-external-store/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/node_modules/worktop/cookie/index.js +3 -3
- package/dist/prod/node_modules/worktop/cookie/index.js.map +1 -1
- package/dist/{dev/node_modules/worktop/cookie/index.cjs → prod/node_modules/worktop/cookie/index.mjs} +4 -4
- package/dist/prod/node_modules/worktop/cookie/{index.cjs.map → index.mjs.map} +1 -1
- package/dist/prod/storefront-api-constants.js +4 -4
- 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/prod/{useCartAPIStateMachine.cjs → 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/index.d.cts +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/storefront-api-constants.d.ts +1 -1
- package/dist/types/storefront-api-types.d.ts +278 -73
- package/dist/types/useCartActions.d.ts +1 -1
- package/dist/umd/hydrogen-react.dev.js +253 -394
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +57 -157
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +15 -14
- package/storefront.schema.json +1 -1
- package/dist/dev/Metafield.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 -89
- package/dist/dev/index.cjs +0 -41
- 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/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/Metafield.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 -89
- package/dist/prod/index.cjs +0 -41
- 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/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
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const require$$0 = require("react");
|
|
4
|
+
const storefrontApiConstants = require("./storefront-api-constants.js");
|
|
5
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
6
|
+
const ShopifyContext = require$$0.createContext({
|
|
5
7
|
storeDomain: "test.myshopify.com",
|
|
6
8
|
storefrontToken: "abc123",
|
|
7
|
-
storefrontApiVersion: SFAPI_VERSION,
|
|
9
|
+
storefrontApiVersion: storefrontApiConstants.SFAPI_VERSION,
|
|
8
10
|
country: {
|
|
9
11
|
isoCode: "US"
|
|
10
12
|
},
|
|
@@ -20,27 +22,25 @@ function ShopifyProvider({
|
|
|
20
22
|
if (!shopifyConfig) {
|
|
21
23
|
throw new Error(`The 'shopifyConfig' prop must be passed to '<ShopifyProvider/>'`);
|
|
22
24
|
}
|
|
23
|
-
if (shopifyConfig.storefrontApiVersion !== SFAPI_VERSION) {
|
|
24
|
-
console.warn(`This version of Hydrogen-UI is built for Shopify's Storefront API version ${SFAPI_VERSION}, but it looks like you're using version ${shopifyConfig.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`);
|
|
25
|
+
if (shopifyConfig.storefrontApiVersion !== storefrontApiConstants.SFAPI_VERSION) {
|
|
26
|
+
console.warn(`This version of Hydrogen-UI is built for Shopify's Storefront API version ${storefrontApiConstants.SFAPI_VERSION}, but it looks like you're using version ${shopifyConfig.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`);
|
|
25
27
|
}
|
|
26
|
-
const finalConfig = useMemo(() => ({
|
|
28
|
+
const finalConfig = require$$0.useMemo(() => ({
|
|
27
29
|
...shopifyConfig,
|
|
28
30
|
storeDomain: shopifyConfig.storeDomain.replace(/^https?:\/\//, "")
|
|
29
31
|
}), [shopifyConfig]);
|
|
30
|
-
return /* @__PURE__ */ jsx(ShopifyContext.Provider, {
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ShopifyContext.Provider, {
|
|
31
33
|
value: finalConfig,
|
|
32
34
|
children
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
37
|
function useShop() {
|
|
36
|
-
const shopContext = useContext(ShopifyContext);
|
|
38
|
+
const shopContext = require$$0.useContext(ShopifyContext);
|
|
37
39
|
if (!shopContext) {
|
|
38
40
|
throw new Error(`'useShop()' must be a descendent of <ShopifyProvider/>`);
|
|
39
41
|
}
|
|
40
42
|
return shopContext;
|
|
41
43
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
useShop
|
|
45
|
-
};
|
|
44
|
+
exports.ShopifyProvider = ShopifyProvider;
|
|
45
|
+
exports.useShop = useShop;
|
|
46
46
|
//# sourceMappingURL=ShopifyProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShopifyProvider.js","sources":["../../src/ShopifyProvider.tsx"],"sourcesContent":["import {createContext, useContext, useMemo, type ReactNode} from 'react';\nimport type {LanguageCode, CountryCode, Shop} from './storefront-api-types.js';\nimport {SFAPI_VERSION} from './storefront-api-constants.js';\n\nconst ShopifyContext = createContext<ShopifyContextValue>({\n storeDomain: 'test.myshopify.com',\n storefrontToken: 'abc123',\n storefrontApiVersion: SFAPI_VERSION,\n country: {\n isoCode: 'US',\n },\n language: {\n isoCode: 'EN',\n },\n locale: 'EN-US',\n});\n\n/**\n * The `<ShopifyProvider/>` component enables use of the `useShop()` hook. The component should wrap your app.\n */\nexport function ShopifyProvider({\n children,\n shopifyConfig,\n}: {\n children: ReactNode;\n shopifyConfig: ShopifyContextValue;\n}) {\n if (!shopifyConfig) {\n throw new Error(\n `The 'shopifyConfig' prop must be passed to '<ShopifyProvider/>'`\n );\n }\n\n if (shopifyConfig.storefrontApiVersion !== SFAPI_VERSION) {\n console.warn(\n `This version of Hydrogen-UI is built for Shopify's Storefront API version ${SFAPI_VERSION}, but it looks like you're using version ${shopifyConfig.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`\n );\n }\n\n const finalConfig = useMemo<ShopifyContextValue>(\n () => ({\n ...shopifyConfig,\n storeDomain: shopifyConfig.storeDomain.replace(/^https?:\\/\\//, ''),\n }),\n [shopifyConfig]\n );\n\n return (\n <ShopifyContext.Provider value={finalConfig}>\n {children}\n </ShopifyContext.Provider>\n );\n}\n\n/**\n * Provides access to the `shopifyConfig` prop of `<ShopifyProvider/>`. Must be a descendent of `<ShopifyProvider/>`.\n */\nexport function useShop() {\n const shopContext = useContext(ShopifyContext);\n if (!shopContext) {\n throw new Error(`'useShop()' must be a descendent of <ShopifyProvider/>`);\n }\n return shopContext;\n}\n\n/**\n * Shopify-specific values that are used in various Hydrogen-UI components and hooks.\n */\nexport type ShopifyContextValue = {\n /** The globally-unique identifier for the Shop */\n storefrontId?: string;\n /** The host name of the domain (eg: `{shop}.myshopify.com`). If a URL with a scheme (for example `https://`) is passed in, then the scheme is removed. */\n storeDomain: Shop['primaryDomain']['host'];\n /** The Storefront API public access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) documentation for more details. */\n storefrontToken: string;\n /** The Storefront API version. This should almost always be the same as the version Hydrogen-UI was built for. Learn more about Shopify [API versioning](https://shopify.dev/api/usage/versioning) for more details. */\n storefrontApiVersion: string;\n country?: {\n /**\n * The code designating a country, which generally follows ISO 3166-1 alpha-2 guidelines. If a territory doesn't have a country code value in the `CountryCode` enum, it might be considered a subdivision of another country. For example, the territories associated with Spain are represented by the country code `ES`, and the territories associated with the United States of America are represented by the country code `US`.\n */\n isoCode: CountryCode;\n };\n language?: {\n /**\n * `ISO 369` language codes supported by Shopify.\n */\n isoCode: LanguageCode;\n };\n /**\n * The locale string based on `country` and `language`.\n */\n locale?: string;\n};\n"],"names":["ShopifyContext","createContext","storeDomain","storefrontToken","storefrontApiVersion","SFAPI_VERSION","country","isoCode","language","locale","ShopifyProvider","children","shopifyConfig","Error","console","warn","finalConfig","useMemo","replace","_jsx","useShop","shopContext","useContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShopifyProvider.js","sources":["../../src/ShopifyProvider.tsx"],"sourcesContent":["import {createContext, useContext, useMemo, type ReactNode} from 'react';\nimport type {LanguageCode, CountryCode, Shop} from './storefront-api-types.js';\nimport {SFAPI_VERSION} from './storefront-api-constants.js';\n\nconst ShopifyContext = createContext<ShopifyContextValue>({\n storeDomain: 'test.myshopify.com',\n storefrontToken: 'abc123',\n storefrontApiVersion: SFAPI_VERSION,\n country: {\n isoCode: 'US',\n },\n language: {\n isoCode: 'EN',\n },\n locale: 'EN-US',\n});\n\n/**\n * The `<ShopifyProvider/>` component enables use of the `useShop()` hook. The component should wrap your app.\n */\nexport function ShopifyProvider({\n children,\n shopifyConfig,\n}: {\n children: ReactNode;\n shopifyConfig: ShopifyContextValue;\n}) {\n if (!shopifyConfig) {\n throw new Error(\n `The 'shopifyConfig' prop must be passed to '<ShopifyProvider/>'`\n );\n }\n\n if (shopifyConfig.storefrontApiVersion !== SFAPI_VERSION) {\n console.warn(\n `This version of Hydrogen-UI is built for Shopify's Storefront API version ${SFAPI_VERSION}, but it looks like you're using version ${shopifyConfig.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`\n );\n }\n\n const finalConfig = useMemo<ShopifyContextValue>(\n () => ({\n ...shopifyConfig,\n storeDomain: shopifyConfig.storeDomain.replace(/^https?:\\/\\//, ''),\n }),\n [shopifyConfig]\n );\n\n return (\n <ShopifyContext.Provider value={finalConfig}>\n {children}\n </ShopifyContext.Provider>\n );\n}\n\n/**\n * Provides access to the `shopifyConfig` prop of `<ShopifyProvider/>`. Must be a descendent of `<ShopifyProvider/>`.\n */\nexport function useShop() {\n const shopContext = useContext(ShopifyContext);\n if (!shopContext) {\n throw new Error(`'useShop()' must be a descendent of <ShopifyProvider/>`);\n }\n return shopContext;\n}\n\n/**\n * Shopify-specific values that are used in various Hydrogen-UI components and hooks.\n */\nexport type ShopifyContextValue = {\n /** The globally-unique identifier for the Shop */\n storefrontId?: string;\n /** The host name of the domain (eg: `{shop}.myshopify.com`). If a URL with a scheme (for example `https://`) is passed in, then the scheme is removed. */\n storeDomain: Shop['primaryDomain']['host'];\n /** The Storefront API public access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) documentation for more details. */\n storefrontToken: string;\n /** The Storefront API version. This should almost always be the same as the version Hydrogen-UI was built for. Learn more about Shopify [API versioning](https://shopify.dev/api/usage/versioning) for more details. */\n storefrontApiVersion: string;\n country?: {\n /**\n * The code designating a country, which generally follows ISO 3166-1 alpha-2 guidelines. If a territory doesn't have a country code value in the `CountryCode` enum, it might be considered a subdivision of another country. For example, the territories associated with Spain are represented by the country code `ES`, and the territories associated with the United States of America are represented by the country code `US`.\n */\n isoCode: CountryCode;\n };\n language?: {\n /**\n * `ISO 369` language codes supported by Shopify.\n */\n isoCode: LanguageCode;\n };\n /**\n * The locale string based on `country` and `language`.\n */\n locale?: string;\n};\n"],"names":["ShopifyContext","createContext","storeDomain","storefrontToken","storefrontApiVersion","SFAPI_VERSION","country","isoCode","language","locale","ShopifyProvider","children","shopifyConfig","Error","console","warn","finalConfig","useMemo","replace","_jsx","useShop","shopContext","useContext"],"mappings":";;;;;AAIA,MAAMA,iBAAiBC,WAAAA,cAAmC;AAAA,EACxDC,aAAa;AAAA,EACbC,iBAAiB;AAAA,EACjBC,sBAAsBC,uBAAAA;AAAAA,EACtBC,SAAS;AAAA,IACPC,SAAS;AAAA,EADF;AAAA,EAGTC,UAAU;AAAA,IACRD,SAAS;AAAA,EADD;AAAA,EAGVE,QAAQ;AAVgD,CAAtB;AAgB7B,SAASC,gBAAgB;AAAA,EAC9BC;AAAAA,EACAC;AAF8B,GAM7B;AACD,MAAI,CAACA,eAAe;AACZ,UAAA,IAAIC,MACP,iEADG;AAAA,EAGP;AAEGD,MAAAA,cAAcR,yBAAyBC,sCAAe;AACxDS,YAAQC,KACL,6EAA4EV,uBAAyDO,yDAAAA,cAAcR,0HADtJ;AAAA,EAGD;AAEKY,QAAAA,cAAcC,WAAAA,QAClB,OAAO;AAAA,IACL,GAAGL;AAAAA,IACHV,aAAaU,cAAcV,YAAYgB,QAAQ,gBAAgB,EAAlD;AAAA,EAAA,IAEf,CAACN,aAAD,CALyB;AASzB,SAAAO,2BAAA,IAAC,eAAe,UAAhB;AAAA,IAAyB,OAAOH;AAAAA,IAAhC;AAAA,EAAA,CADF;AAKD;AAKM,SAASI,UAAU;AAClBC,QAAAA,cAAcC,sBAAWtB,cAAD;AAC9B,MAAI,CAACqB,aAAa;AACV,UAAA,IAAIR,MAAO,wDAAX;AAAA,EACP;AACMQ,SAAAA;AACR;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createContext, useMemo, useContext } from "react";
|
|
2
|
+
import { SFAPI_VERSION } from "./storefront-api-constants.mjs";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
const ShopifyContext = createContext({
|
|
5
|
+
storeDomain: "test.myshopify.com",
|
|
6
|
+
storefrontToken: "abc123",
|
|
7
|
+
storefrontApiVersion: SFAPI_VERSION,
|
|
8
|
+
country: {
|
|
9
|
+
isoCode: "US"
|
|
10
|
+
},
|
|
11
|
+
language: {
|
|
12
|
+
isoCode: "EN"
|
|
13
|
+
},
|
|
14
|
+
locale: "EN-US"
|
|
15
|
+
});
|
|
16
|
+
function ShopifyProvider({
|
|
17
|
+
children,
|
|
18
|
+
shopifyConfig
|
|
19
|
+
}) {
|
|
20
|
+
if (!shopifyConfig) {
|
|
21
|
+
throw new Error(`The 'shopifyConfig' prop must be passed to '<ShopifyProvider/>'`);
|
|
22
|
+
}
|
|
23
|
+
if (shopifyConfig.storefrontApiVersion !== SFAPI_VERSION) {
|
|
24
|
+
console.warn(`This version of Hydrogen-UI is built for Shopify's Storefront API version ${SFAPI_VERSION}, but it looks like you're using version ${shopifyConfig.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`);
|
|
25
|
+
}
|
|
26
|
+
const finalConfig = useMemo(() => ({
|
|
27
|
+
...shopifyConfig,
|
|
28
|
+
storeDomain: shopifyConfig.storeDomain.replace(/^https?:\/\//, "")
|
|
29
|
+
}), [shopifyConfig]);
|
|
30
|
+
return /* @__PURE__ */ jsx(ShopifyContext.Provider, {
|
|
31
|
+
value: finalConfig,
|
|
32
|
+
children
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function useShop() {
|
|
36
|
+
const shopContext = useContext(ShopifyContext);
|
|
37
|
+
if (!shopContext) {
|
|
38
|
+
throw new Error(`'useShop()' must be a descendent of <ShopifyProvider/>`);
|
|
39
|
+
}
|
|
40
|
+
return shopContext;
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
ShopifyProvider,
|
|
44
|
+
useShop
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=ShopifyProvider.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShopifyProvider.
|
|
1
|
+
{"version":3,"file":"ShopifyProvider.mjs","sources":["../../src/ShopifyProvider.tsx"],"sourcesContent":["import {createContext, useContext, useMemo, type ReactNode} from 'react';\nimport type {LanguageCode, CountryCode, Shop} from './storefront-api-types.js';\nimport {SFAPI_VERSION} from './storefront-api-constants.js';\n\nconst ShopifyContext = createContext<ShopifyContextValue>({\n storeDomain: 'test.myshopify.com',\n storefrontToken: 'abc123',\n storefrontApiVersion: SFAPI_VERSION,\n country: {\n isoCode: 'US',\n },\n language: {\n isoCode: 'EN',\n },\n locale: 'EN-US',\n});\n\n/**\n * The `<ShopifyProvider/>` component enables use of the `useShop()` hook. The component should wrap your app.\n */\nexport function ShopifyProvider({\n children,\n shopifyConfig,\n}: {\n children: ReactNode;\n shopifyConfig: ShopifyContextValue;\n}) {\n if (!shopifyConfig) {\n throw new Error(\n `The 'shopifyConfig' prop must be passed to '<ShopifyProvider/>'`\n );\n }\n\n if (shopifyConfig.storefrontApiVersion !== SFAPI_VERSION) {\n console.warn(\n `This version of Hydrogen-UI is built for Shopify's Storefront API version ${SFAPI_VERSION}, but it looks like you're using version ${shopifyConfig.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen-UI and the Storefront API.`\n );\n }\n\n const finalConfig = useMemo<ShopifyContextValue>(\n () => ({\n ...shopifyConfig,\n storeDomain: shopifyConfig.storeDomain.replace(/^https?:\\/\\//, ''),\n }),\n [shopifyConfig]\n );\n\n return (\n <ShopifyContext.Provider value={finalConfig}>\n {children}\n </ShopifyContext.Provider>\n );\n}\n\n/**\n * Provides access to the `shopifyConfig` prop of `<ShopifyProvider/>`. Must be a descendent of `<ShopifyProvider/>`.\n */\nexport function useShop() {\n const shopContext = useContext(ShopifyContext);\n if (!shopContext) {\n throw new Error(`'useShop()' must be a descendent of <ShopifyProvider/>`);\n }\n return shopContext;\n}\n\n/**\n * Shopify-specific values that are used in various Hydrogen-UI components and hooks.\n */\nexport type ShopifyContextValue = {\n /** The globally-unique identifier for the Shop */\n storefrontId?: string;\n /** The host name of the domain (eg: `{shop}.myshopify.com`). If a URL with a scheme (for example `https://`) is passed in, then the scheme is removed. */\n storeDomain: Shop['primaryDomain']['host'];\n /** The Storefront API public access token. Refer to the [authentication](https://shopify.dev/api/storefront#authentication) documentation for more details. */\n storefrontToken: string;\n /** The Storefront API version. This should almost always be the same as the version Hydrogen-UI was built for. Learn more about Shopify [API versioning](https://shopify.dev/api/usage/versioning) for more details. */\n storefrontApiVersion: string;\n country?: {\n /**\n * The code designating a country, which generally follows ISO 3166-1 alpha-2 guidelines. If a territory doesn't have a country code value in the `CountryCode` enum, it might be considered a subdivision of another country. For example, the territories associated with Spain are represented by the country code `ES`, and the territories associated with the United States of America are represented by the country code `US`.\n */\n isoCode: CountryCode;\n };\n language?: {\n /**\n * `ISO 369` language codes supported by Shopify.\n */\n isoCode: LanguageCode;\n };\n /**\n * The locale string based on `country` and `language`.\n */\n locale?: string;\n};\n"],"names":["ShopifyContext","createContext","storeDomain","storefrontToken","storefrontApiVersion","SFAPI_VERSION","country","isoCode","language","locale","ShopifyProvider","children","shopifyConfig","Error","console","warn","finalConfig","useMemo","replace","_jsx","useShop","shopContext","useContext"],"mappings":";;;AAIA,MAAMA,iBAAiBC,cAAmC;AAAA,EACxDC,aAAa;AAAA,EACbC,iBAAiB;AAAA,EACjBC,sBAAsBC;AAAAA,EACtBC,SAAS;AAAA,IACPC,SAAS;AAAA,EADF;AAAA,EAGTC,UAAU;AAAA,IACRD,SAAS;AAAA,EADD;AAAA,EAGVE,QAAQ;AAVgD,CAAtB;AAgB7B,SAASC,gBAAgB;AAAA,EAC9BC;AAAAA,EACAC;AAF8B,GAM7B;AACD,MAAI,CAACA,eAAe;AACZ,UAAA,IAAIC,MACP,iEADG;AAAA,EAGP;AAEGD,MAAAA,cAAcR,yBAAyBC,eAAe;AACxDS,YAAQC,KACL,6EAA4EV,yDAAyDO,cAAcR,0HADtJ;AAAA,EAGD;AAEKY,QAAAA,cAAcC,QAClB,OAAO;AAAA,IACL,GAAGL;AAAAA,IACHV,aAAaU,cAAcV,YAAYgB,QAAQ,gBAAgB,EAAlD;AAAA,EAAA,IAEf,CAACN,aAAD,CALyB;AASzB,SAAAO,oBAAC,eAAe,UAAhB;AAAA,IAAyB,OAAOH;AAAAA,IAAhC;AAAA,EAAA,CADF;AAKD;AAKM,SAASI,UAAU;AAClBC,QAAAA,cAAcC,WAAWtB,cAAD;AAC9B,MAAI,CAACqB,aAAa;AACV,UAAA,IAAIR,MAAO,wDAAX;AAAA,EACP;AACMQ,SAAAA;AACR;"}
|
package/dist/dev/Video.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const imageSize = require("./image-size.js");
|
|
4
|
+
const require$$0 = require("react");
|
|
5
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
6
|
function Video(props) {
|
|
5
7
|
var _a, _b;
|
|
6
8
|
const {
|
|
@@ -12,14 +14,14 @@ function Video(props) {
|
|
|
12
14
|
sourceProps = {},
|
|
13
15
|
...passthroughProps
|
|
14
16
|
} = props;
|
|
15
|
-
const posterUrl = shopifyImageLoader({
|
|
17
|
+
const posterUrl = imageSize.shopifyImageLoader({
|
|
16
18
|
src: (_b = (_a = data.previewImage) == null ? void 0 : _a.url) != null ? _b : "",
|
|
17
19
|
...previewImageOptions
|
|
18
20
|
});
|
|
19
21
|
if (!data.sources) {
|
|
20
22
|
throw new Error(`<Video/> requires a 'data.sources' array`);
|
|
21
23
|
}
|
|
22
|
-
return /* @__PURE__ */ jsx("video", {
|
|
24
|
+
return /* @__PURE__ */ jsxRuntime.jsx("video", {
|
|
23
25
|
...passthroughProps,
|
|
24
26
|
id,
|
|
25
27
|
playsInline,
|
|
@@ -29,7 +31,7 @@ function Video(props) {
|
|
|
29
31
|
if (!((source == null ? void 0 : source.url) && (source == null ? void 0 : source.mimeType))) {
|
|
30
32
|
throw new Error(`<Video/> needs 'source.url' and 'source.mimeType'`);
|
|
31
33
|
}
|
|
32
|
-
return /* @__PURE__ */ createElement("source", {
|
|
34
|
+
return /* @__PURE__ */ require$$0.createElement("source", {
|
|
33
35
|
...sourceProps,
|
|
34
36
|
key: source.url,
|
|
35
37
|
src: source.url,
|
|
@@ -38,7 +40,5 @@ function Video(props) {
|
|
|
38
40
|
})
|
|
39
41
|
});
|
|
40
42
|
}
|
|
41
|
-
|
|
42
|
-
Video
|
|
43
|
-
};
|
|
43
|
+
exports.Video = Video;
|
|
44
44
|
//# sourceMappingURL=Video.js.map
|
package/dist/dev/Video.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Video.js","sources":["../../src/Video.tsx"],"sourcesContent":["import {type HTMLAttributes} from 'react';\nimport {shopifyImageLoader} from './image-size.js';\nimport type {Video as VideoType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\nexport interface VideoProps {\n /** An object with fields that correspond to the Storefront API's [Video object](https://shopify.dev/api/storefront/latest/objects/video). */\n data: PartialDeep<VideoType, {recurseIntoArrays: true}>;\n /** An object of image size options for the video's `previewImage`. Uses `shopifyImageLoader` to generate the `poster` URL. */\n previewImageOptions?: Parameters<typeof shopifyImageLoader>[0];\n /** Props that will be passed to the `video` element's `source` children elements. */\n sourceProps?: HTMLAttributes<HTMLSourceElement> & {\n 'data-testid'?: string;\n };\n}\n\n/**\n * The `Video` component renders a `video` for the Storefront API's [Video object](https://shopify.dev/api/storefront/reference/products/video).\n */\nexport function Video(props: JSX.IntrinsicElements['video'] & VideoProps) {\n const {\n data,\n previewImageOptions,\n id = data.id,\n playsInline = true,\n controls = true,\n sourceProps = {},\n ...passthroughProps\n } = props;\n\n const posterUrl = shopifyImageLoader({\n src: data.previewImage?.url ?? '',\n ...previewImageOptions,\n });\n\n if (!data.sources) {\n throw new Error(`<Video/> requires a 'data.sources' array`);\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n {...passthroughProps}\n id={id}\n playsInline={playsInline}\n controls={controls}\n poster={posterUrl}\n >\n {data.sources.map((source) => {\n if (!(source?.url && source?.mimeType)) {\n throw new Error(`<Video/> needs 'source.url' and 'source.mimeType'`);\n }\n return (\n <source\n {...sourceProps}\n key={source.url}\n src={source.url}\n type={source.mimeType}\n />\n );\n })}\n </video>\n );\n}\n"],"names":["Video","props","data","previewImageOptions","id","playsInline","controls","sourceProps","passthroughProps","posterUrl","shopifyImageLoader","src","previewImage","url","sources","Error","map","source","mimeType"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Video.js","sources":["../../src/Video.tsx"],"sourcesContent":["import {type HTMLAttributes} from 'react';\nimport {shopifyImageLoader} from './image-size.js';\nimport type {Video as VideoType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\nexport interface VideoProps {\n /** An object with fields that correspond to the Storefront API's [Video object](https://shopify.dev/api/storefront/latest/objects/video). */\n data: PartialDeep<VideoType, {recurseIntoArrays: true}>;\n /** An object of image size options for the video's `previewImage`. Uses `shopifyImageLoader` to generate the `poster` URL. */\n previewImageOptions?: Parameters<typeof shopifyImageLoader>[0];\n /** Props that will be passed to the `video` element's `source` children elements. */\n sourceProps?: HTMLAttributes<HTMLSourceElement> & {\n 'data-testid'?: string;\n };\n}\n\n/**\n * The `Video` component renders a `video` for the Storefront API's [Video object](https://shopify.dev/api/storefront/reference/products/video).\n */\nexport function Video(props: JSX.IntrinsicElements['video'] & VideoProps) {\n const {\n data,\n previewImageOptions,\n id = data.id,\n playsInline = true,\n controls = true,\n sourceProps = {},\n ...passthroughProps\n } = props;\n\n const posterUrl = shopifyImageLoader({\n src: data.previewImage?.url ?? '',\n ...previewImageOptions,\n });\n\n if (!data.sources) {\n throw new Error(`<Video/> requires a 'data.sources' array`);\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n {...passthroughProps}\n id={id}\n playsInline={playsInline}\n controls={controls}\n poster={posterUrl}\n >\n {data.sources.map((source) => {\n if (!(source?.url && source?.mimeType)) {\n throw new Error(`<Video/> needs 'source.url' and 'source.mimeType'`);\n }\n return (\n <source\n {...sourceProps}\n key={source.url}\n src={source.url}\n type={source.mimeType}\n />\n );\n })}\n </video>\n );\n}\n"],"names":["Video","props","data","previewImageOptions","id","playsInline","controls","sourceProps","passthroughProps","posterUrl","shopifyImageLoader","src","previewImage","url","sources","Error","map","source","mimeType"],"mappings":";;;;;AAmBO,SAASA,MAAMC,OAAoD;;AAClE,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,KAAKF,KAAKE;AAAAA,IACVC,cAAc;AAAA,IACdC,WAAW;AAAA,IACXC,cAAc,CANV;AAAA,OAODC;AAAAA,EACDP,IAAAA;AAEJ,QAAMQ,YAAYC,UAAAA,mBAAmB;AAAA,IACnCC,MAAKT,gBAAKU,iBAALV,mBAAmBW,QAAnBX,YAA0B;AAAA,IAC/B,GAAGC;AAAAA,EAAAA,CAF+B;AAKhC,MAAA,CAACD,KAAKY,SAAS;AACX,UAAA,IAAIC,MAAO,0CAAX;AAAA,EACP;AAED,wCAEE,SAAA;AAAA,IAAA,GACMP;AAAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQC;AAAAA,IALV,UAOGP,KAAKY,QAAQE,IAAKC,CAAW,WAAA;AAC5B,UAAI,GAAEA,iCAAQJ,SAAOI,iCAAQC,YAAW;AAChC,cAAA,IAAIH,MAAO,mDAAX;AAAA,MACP;AACD;WAEQR;AAAAA,QACJ,KAAKU,OAAOJ;AAAAA,QACZ,KAAKI,OAAOJ;AAAAA,QACZ,MAAMI,OAAOC;AAAAA,MAAAA,CALjB;AAAA,IAAA,CAJD;AAAA,EAAA,CAPH;AAsBH;;"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const require$$0 = require("react");
|
|
5
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
1
|
+
import { shopifyImageLoader } from "./image-size.mjs";
|
|
2
|
+
import { createElement } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
4
|
function Video(props) {
|
|
7
5
|
var _a, _b;
|
|
8
6
|
const {
|
|
@@ -14,14 +12,14 @@ function Video(props) {
|
|
|
14
12
|
sourceProps = {},
|
|
15
13
|
...passthroughProps
|
|
16
14
|
} = props;
|
|
17
|
-
const posterUrl =
|
|
15
|
+
const posterUrl = shopifyImageLoader({
|
|
18
16
|
src: (_b = (_a = data.previewImage) == null ? void 0 : _a.url) != null ? _b : "",
|
|
19
17
|
...previewImageOptions
|
|
20
18
|
});
|
|
21
19
|
if (!data.sources) {
|
|
22
20
|
throw new Error(`<Video/> requires a 'data.sources' array`);
|
|
23
21
|
}
|
|
24
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ jsx("video", {
|
|
25
23
|
...passthroughProps,
|
|
26
24
|
id,
|
|
27
25
|
playsInline,
|
|
@@ -31,7 +29,7 @@ function Video(props) {
|
|
|
31
29
|
if (!((source == null ? void 0 : source.url) && (source == null ? void 0 : source.mimeType))) {
|
|
32
30
|
throw new Error(`<Video/> needs 'source.url' and 'source.mimeType'`);
|
|
33
31
|
}
|
|
34
|
-
return /* @__PURE__ */
|
|
32
|
+
return /* @__PURE__ */ createElement("source", {
|
|
35
33
|
...sourceProps,
|
|
36
34
|
key: source.url,
|
|
37
35
|
src: source.url,
|
|
@@ -40,5 +38,7 @@ function Video(props) {
|
|
|
40
38
|
})
|
|
41
39
|
});
|
|
42
40
|
}
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
export {
|
|
42
|
+
Video
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=Video.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Video.
|
|
1
|
+
{"version":3,"file":"Video.mjs","sources":["../../src/Video.tsx"],"sourcesContent":["import {type HTMLAttributes} from 'react';\nimport {shopifyImageLoader} from './image-size.js';\nimport type {Video as VideoType} from './storefront-api-types.js';\nimport type {PartialDeep} from 'type-fest';\n\nexport interface VideoProps {\n /** An object with fields that correspond to the Storefront API's [Video object](https://shopify.dev/api/storefront/latest/objects/video). */\n data: PartialDeep<VideoType, {recurseIntoArrays: true}>;\n /** An object of image size options for the video's `previewImage`. Uses `shopifyImageLoader` to generate the `poster` URL. */\n previewImageOptions?: Parameters<typeof shopifyImageLoader>[0];\n /** Props that will be passed to the `video` element's `source` children elements. */\n sourceProps?: HTMLAttributes<HTMLSourceElement> & {\n 'data-testid'?: string;\n };\n}\n\n/**\n * The `Video` component renders a `video` for the Storefront API's [Video object](https://shopify.dev/api/storefront/reference/products/video).\n */\nexport function Video(props: JSX.IntrinsicElements['video'] & VideoProps) {\n const {\n data,\n previewImageOptions,\n id = data.id,\n playsInline = true,\n controls = true,\n sourceProps = {},\n ...passthroughProps\n } = props;\n\n const posterUrl = shopifyImageLoader({\n src: data.previewImage?.url ?? '',\n ...previewImageOptions,\n });\n\n if (!data.sources) {\n throw new Error(`<Video/> requires a 'data.sources' array`);\n }\n\n return (\n // eslint-disable-next-line jsx-a11y/media-has-caption\n <video\n {...passthroughProps}\n id={id}\n playsInline={playsInline}\n controls={controls}\n poster={posterUrl}\n >\n {data.sources.map((source) => {\n if (!(source?.url && source?.mimeType)) {\n throw new Error(`<Video/> needs 'source.url' and 'source.mimeType'`);\n }\n return (\n <source\n {...sourceProps}\n key={source.url}\n src={source.url}\n type={source.mimeType}\n />\n );\n })}\n </video>\n );\n}\n"],"names":["Video","props","data","previewImageOptions","id","playsInline","controls","sourceProps","passthroughProps","posterUrl","shopifyImageLoader","src","previewImage","url","sources","Error","map","source","mimeType"],"mappings":";;;AAmBO,SAASA,MAAMC,OAAoD;;AAClE,QAAA;AAAA,IACJC;AAAAA,IACAC;AAAAA,IACAC,KAAKF,KAAKE;AAAAA,IACVC,cAAc;AAAA,IACdC,WAAW;AAAA,IACXC,cAAc,CANV;AAAA,OAODC;AAAAA,EACDP,IAAAA;AAEJ,QAAMQ,YAAYC,mBAAmB;AAAA,IACnCC,MAAKT,gBAAKU,iBAALV,mBAAmBW,QAAnBX,YAA0B;AAAA,IAC/B,GAAGC;AAAAA,EAAAA,CAF+B;AAKhC,MAAA,CAACD,KAAKY,SAAS;AACX,UAAA,IAAIC,MAAO,0CAAX;AAAA,EACP;AAED,6BAEE,SAAA;AAAA,IAAA,GACMP;AAAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQC;AAAAA,IALV,UAOGP,KAAKY,QAAQE,IAAKC,CAAW,WAAA;AAC5B,UAAI,GAAEA,iCAAQJ,SAAOI,iCAAQC,YAAW;AAChC,cAAA,IAAIH,MAAO,mDAAX;AAAA,MACP;AACD;WAEQR;AAAAA,QACJ,KAAKU,OAAOJ;AAAAA,QACZ,KAAKI,OAAOJ;AAAAA,QACZ,MAAMI,OAAOC;AAAAA,MAAAA,CALjB;AAAA,IAAA,CAJD;AAAA,EAAA,CAPH;AAsBH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
3
|
var useSyncExternalStoreShim_development = {};
|
|
2
|
-
|
|
3
|
-
useSyncExternalStoreShim_development as __exports
|
|
4
|
-
};
|
|
4
|
+
exports.__exports = useSyncExternalStoreShim_development;
|
|
5
5
|
//# sourceMappingURL=use-sync-external-store-shim.development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-sync-external-store-shim.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.development.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
3
|
var useSyncExternalStoreShim_production_min = {};
|
|
2
|
-
|
|
3
|
-
useSyncExternalStoreShim_production_min as __exports
|
|
4
|
-
};
|
|
4
|
+
exports.__exports = useSyncExternalStoreShim_production_min;
|
|
5
5
|
//# sourceMappingURL=use-sync-external-store-shim.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-sync-external-store-shim.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-sync-external-store-shim.production.min.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
3
|
var withSelector_development = {};
|
|
2
|
-
|
|
3
|
-
withSelector_development as __exports
|
|
4
|
-
};
|
|
4
|
+
exports.__exports = withSelector_development;
|
|
5
5
|
//# sourceMappingURL=with-selector.development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-selector.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-selector.development.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-selector.development.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
3
|
var withSelector = { exports: {} };
|
|
2
|
-
|
|
3
|
-
withSelector as w
|
|
4
|
-
};
|
|
4
|
+
exports.withSelector = withSelector;
|
|
5
5
|
//# sourceMappingURL=with-selector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-selector.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-selector.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-selector.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
3
|
var withSelector_production_min = {};
|
|
2
|
-
|
|
3
|
-
withSelector_production_min as __exports
|
|
4
|
-
};
|
|
4
|
+
exports.__exports = withSelector_production_min;
|
|
5
5
|
//# sourceMappingURL=with-selector.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-selector.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-selector.production.min.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-selector.production.min.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
1
3
|
const CART_ID_STORAGE_KEY = "shopifyCartId";
|
|
2
4
|
const STOREFRONT_API_PUBLIC_TOKEN_HEADER = "X-Shopify-Storefront-Access-Token";
|
|
3
5
|
const SHOPIFY_STOREFRONT_ID_HEADER = "Shopify-Storefront-Id";
|
|
@@ -5,13 +7,11 @@ const SHOPIFY_STOREFRONT_Y_HEADER = "Shopify-Storefront-Y";
|
|
|
5
7
|
const SHOPIFY_STOREFRONT_S_HEADER = "Shopify-Storefront-S";
|
|
6
8
|
const SHOPIFY_Y = "_shopify_y";
|
|
7
9
|
const SHOPIFY_S = "_shopify_s";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
STOREFRONT_API_PUBLIC_TOKEN_HEADER
|
|
16
|
-
};
|
|
10
|
+
exports.CART_ID_STORAGE_KEY = CART_ID_STORAGE_KEY;
|
|
11
|
+
exports.SHOPIFY_S = SHOPIFY_S;
|
|
12
|
+
exports.SHOPIFY_STOREFRONT_ID_HEADER = SHOPIFY_STOREFRONT_ID_HEADER;
|
|
13
|
+
exports.SHOPIFY_STOREFRONT_S_HEADER = SHOPIFY_STOREFRONT_S_HEADER;
|
|
14
|
+
exports.SHOPIFY_STOREFRONT_Y_HEADER = SHOPIFY_STOREFRONT_Y_HEADER;
|
|
15
|
+
exports.SHOPIFY_Y = SHOPIFY_Y;
|
|
16
|
+
exports.STOREFRONT_API_PUBLIC_TOKEN_HEADER = STOREFRONT_API_PUBLIC_TOKEN_HEADER;
|
|
17
17
|
//# sourceMappingURL=cart-constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart-constants.js","sources":["../../src/cart-constants.ts"],"sourcesContent":["export const CART_ID_STORAGE_KEY = 'shopifyCartId';\nexport const CART_COOKIE_TTL_DAYS = 14;\n\n// Needed for cart analytics within Shopify\nexport const STOREFRONT_API_PUBLIC_TOKEN_HEADER =\n 'X-Shopify-Storefront-Access-Token';\nexport const SHOPIFY_STOREFRONT_ID_HEADER = 'Shopify-Storefront-Id';\nexport const SHOPIFY_STOREFRONT_Y_HEADER = 'Shopify-Storefront-Y';\nexport const SHOPIFY_STOREFRONT_S_HEADER = 'Shopify-Storefront-S';\nexport const SHOPIFY_Y = '_shopify_y';\nexport const SHOPIFY_S = '_shopify_s';\n"],"names":[],"mappings":"AAAO,MAAM,sBAAsB;AAI5B,MAAM,qCACX;AACK,MAAM,+BAA+B;AACrC,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,YAAY;AAClB,MAAM,YAAY
|
|
1
|
+
{"version":3,"file":"cart-constants.js","sources":["../../src/cart-constants.ts"],"sourcesContent":["export const CART_ID_STORAGE_KEY = 'shopifyCartId';\nexport const CART_COOKIE_TTL_DAYS = 14;\n\n// Needed for cart analytics within Shopify\nexport const STOREFRONT_API_PUBLIC_TOKEN_HEADER =\n 'X-Shopify-Storefront-Access-Token';\nexport const SHOPIFY_STOREFRONT_ID_HEADER = 'Shopify-Storefront-Id';\nexport const SHOPIFY_STOREFRONT_Y_HEADER = 'Shopify-Storefront-Y';\nexport const SHOPIFY_STOREFRONT_S_HEADER = 'Shopify-Storefront-S';\nexport const SHOPIFY_Y = '_shopify_y';\nexport const SHOPIFY_S = '_shopify_s';\n"],"names":[],"mappings":";;AAAO,MAAM,sBAAsB;AAI5B,MAAM,qCACX;AACK,MAAM,+BAA+B;AACrC,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,YAAY;AAClB,MAAM,YAAY;;;;;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const CART_ID_STORAGE_KEY = "shopifyCartId";
|
|
2
|
+
const STOREFRONT_API_PUBLIC_TOKEN_HEADER = "X-Shopify-Storefront-Access-Token";
|
|
3
|
+
const SHOPIFY_STOREFRONT_ID_HEADER = "Shopify-Storefront-Id";
|
|
4
|
+
const SHOPIFY_STOREFRONT_Y_HEADER = "Shopify-Storefront-Y";
|
|
5
|
+
const SHOPIFY_STOREFRONT_S_HEADER = "Shopify-Storefront-S";
|
|
6
|
+
const SHOPIFY_Y = "_shopify_y";
|
|
7
|
+
const SHOPIFY_S = "_shopify_s";
|
|
8
|
+
export {
|
|
9
|
+
CART_ID_STORAGE_KEY,
|
|
10
|
+
SHOPIFY_S,
|
|
11
|
+
SHOPIFY_STOREFRONT_ID_HEADER,
|
|
12
|
+
SHOPIFY_STOREFRONT_S_HEADER,
|
|
13
|
+
SHOPIFY_STOREFRONT_Y_HEADER,
|
|
14
|
+
SHOPIFY_Y,
|
|
15
|
+
STOREFRONT_API_PUBLIC_TOKEN_HEADER
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=cart-constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart-constants.
|
|
1
|
+
{"version":3,"file":"cart-constants.mjs","sources":["../../src/cart-constants.ts"],"sourcesContent":["export const CART_ID_STORAGE_KEY = 'shopifyCartId';\nexport const CART_COOKIE_TTL_DAYS = 14;\n\n// Needed for cart analytics within Shopify\nexport const STOREFRONT_API_PUBLIC_TOKEN_HEADER =\n 'X-Shopify-Storefront-Access-Token';\nexport const SHOPIFY_STOREFRONT_ID_HEADER = 'Shopify-Storefront-Id';\nexport const SHOPIFY_STOREFRONT_Y_HEADER = 'Shopify-Storefront-Y';\nexport const SHOPIFY_STOREFRONT_S_HEADER = 'Shopify-Storefront-S';\nexport const SHOPIFY_Y = '_shopify_y';\nexport const SHOPIFY_S = '_shopify_s';\n"],"names":[],"mappings":"AAAO,MAAM,sBAAsB;AAI5B,MAAM,qCACX;AACK,MAAM,+BAA+B;AACrC,MAAM,8BAA8B;AACpC,MAAM,8BAA8B;AACpC,MAAM,YAAY;AAClB,MAAM,YAAY;"}
|
package/dist/dev/cart-hooks.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const require$$0 = require("react");
|
|
4
|
+
const ShopifyProvider = require("./ShopifyProvider.js");
|
|
5
|
+
const cartConstants = require("./cart-constants.js");
|
|
6
|
+
const index = require("./node_modules/worktop/cookie/index.js");
|
|
7
7
|
function useCartFetch() {
|
|
8
8
|
const {
|
|
9
9
|
storeDomain,
|
|
10
10
|
storefrontApiVersion,
|
|
11
11
|
storefrontToken,
|
|
12
12
|
storefrontId
|
|
13
|
-
} = useShop();
|
|
14
|
-
return useCallback(({
|
|
13
|
+
} = ShopifyProvider.useShop();
|
|
14
|
+
return require$$0.useCallback(({
|
|
15
15
|
query,
|
|
16
16
|
variables
|
|
17
17
|
}) => {
|
|
@@ -19,15 +19,15 @@ function useCartFetch() {
|
|
|
19
19
|
"Content-Type": "application/json",
|
|
20
20
|
"X-SDK-Variant": "hydrogen",
|
|
21
21
|
"X-SDK-Version": storefrontApiVersion,
|
|
22
|
-
[STOREFRONT_API_PUBLIC_TOKEN_HEADER]: storefrontToken
|
|
22
|
+
[cartConstants.STOREFRONT_API_PUBLIC_TOKEN_HEADER]: storefrontToken
|
|
23
23
|
};
|
|
24
24
|
if (storefrontId) {
|
|
25
|
-
headers[SHOPIFY_STOREFRONT_ID_HEADER] = storefrontId;
|
|
25
|
+
headers[cartConstants.SHOPIFY_STOREFRONT_ID_HEADER] = storefrontId;
|
|
26
26
|
}
|
|
27
|
-
const cookieData =
|
|
28
|
-
if (cookieData[SHOPIFY_Y] && cookieData[SHOPIFY_S]) {
|
|
29
|
-
headers[SHOPIFY_STOREFRONT_Y_HEADER] = cookieData[SHOPIFY_Y];
|
|
30
|
-
headers[SHOPIFY_STOREFRONT_S_HEADER] = cookieData[SHOPIFY_S];
|
|
27
|
+
const cookieData = index.parse(document.cookie);
|
|
28
|
+
if (cookieData[cartConstants.SHOPIFY_Y] && cookieData[cartConstants.SHOPIFY_S]) {
|
|
29
|
+
headers[cartConstants.SHOPIFY_STOREFRONT_Y_HEADER] = cookieData[cartConstants.SHOPIFY_Y];
|
|
30
|
+
headers[cartConstants.SHOPIFY_STOREFRONT_S_HEADER] = cookieData[cartConstants.SHOPIFY_S];
|
|
31
31
|
}
|
|
32
32
|
return fetch(`https://${storeDomain}/api/${storefrontApiVersion}/graphql.json`, {
|
|
33
33
|
method: "POST",
|
|
@@ -44,46 +44,5 @@ function useCartFetch() {
|
|
|
44
44
|
});
|
|
45
45
|
}, [storeDomain, storefrontApiVersion, storefrontToken, storefrontId]);
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
const [cart, updateCart] = useState();
|
|
49
|
-
const [checkoutUrl, updateCheckoutUrl] = useState();
|
|
50
|
-
const [error, updateError] = useState();
|
|
51
|
-
const fetch2 = useCartFetch();
|
|
52
|
-
const createInstantCheckout = useCallback(async (cartInput) => {
|
|
53
|
-
var _a, _b;
|
|
54
|
-
const {
|
|
55
|
-
data,
|
|
56
|
-
errors
|
|
57
|
-
} = await fetch2({
|
|
58
|
-
query: CartCreate(defaultCartFragment),
|
|
59
|
-
variables: {
|
|
60
|
-
input: cartInput
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
if (errors) {
|
|
64
|
-
updateError(errors.toString());
|
|
65
|
-
updateCart(void 0);
|
|
66
|
-
updateCheckoutUrl(void 0);
|
|
67
|
-
}
|
|
68
|
-
if ((_a = data == null ? void 0 : data.cartCreate) == null ? void 0 : _a.cart) {
|
|
69
|
-
const dataCart = data.cartCreate.cart;
|
|
70
|
-
updateCart({
|
|
71
|
-
...dataCart,
|
|
72
|
-
lines: flattenConnection(dataCart.lines),
|
|
73
|
-
note: (_b = dataCart.note) != null ? _b : void 0
|
|
74
|
-
});
|
|
75
|
-
updateCheckoutUrl(dataCart.checkoutUrl);
|
|
76
|
-
}
|
|
77
|
-
}, [fetch2]);
|
|
78
|
-
return {
|
|
79
|
-
cart,
|
|
80
|
-
checkoutUrl,
|
|
81
|
-
error,
|
|
82
|
-
createInstantCheckout
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
export {
|
|
86
|
-
useCartFetch,
|
|
87
|
-
useInstantCheckout
|
|
88
|
-
};
|
|
47
|
+
exports.useCartFetch = useCartFetch;
|
|
89
48
|
//# sourceMappingURL=cart-hooks.js.map
|