@shopify/hydrogen-react 2025.1.2 → 2025.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
- package/dist/browser-dev/BaseButton.mjs.map +1 -1
- package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
- package/dist/browser-dev/CartCheckoutButton.mjs.map +1 -1
- package/dist/browser-dev/CartCost.mjs.map +1 -1
- package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
- package/dist/browser-dev/CartLineQuantity.mjs.map +1 -1
- package/dist/browser-dev/CartLineQuantityAdjustButton.mjs.map +1 -1
- package/dist/browser-dev/CartProvider.mjs +4 -7
- package/dist/browser-dev/CartProvider.mjs.map +1 -1
- package/dist/browser-dev/ExternalVideo.mjs.map +1 -1
- package/dist/browser-dev/Image.mjs +2 -4
- package/dist/browser-dev/Image.mjs.map +1 -1
- package/dist/browser-dev/MediaFile.mjs.map +1 -1
- package/dist/browser-dev/ModelViewer.mjs.map +1 -1
- package/dist/browser-dev/Money.mjs.map +1 -1
- package/dist/browser-dev/ProductPrice.mjs.map +1 -1
- package/dist/browser-dev/ProductProvider.mjs +15 -12
- package/dist/browser-dev/ProductProvider.mjs.map +1 -1
- package/dist/browser-dev/RichText.components.mjs +2 -4
- package/dist/browser-dev/RichText.components.mjs.map +1 -1
- package/dist/browser-dev/RichText.mjs.map +1 -1
- package/dist/browser-dev/ShopPayButton.mjs.map +1 -1
- package/dist/browser-dev/ShopifyProvider.mjs +19 -2
- package/dist/browser-dev/ShopifyProvider.mjs.map +1 -1
- package/dist/browser-dev/Video.mjs.map +1 -1
- package/dist/browser-dev/_virtual/with-selector.mjs +3 -2
- package/dist/browser-dev/_virtual/with-selector.mjs.map +1 -1
- package/dist/browser-dev/_virtual/with-selector2.mjs +5 -0
- package/dist/browser-dev/_virtual/with-selector2.mjs.map +1 -0
- package/dist/browser-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/browser-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
- package/dist/browser-dev/analytics-utils.mjs.map +1 -1
- package/dist/browser-dev/analytics.mjs +6 -9
- package/dist/browser-dev/analytics.mjs.map +1 -1
- package/dist/browser-dev/cart-hooks.mjs +25 -7
- package/dist/browser-dev/cart-hooks.mjs.map +1 -1
- package/dist/browser-dev/cookies-utils.mjs +5 -5
- package/dist/browser-dev/cookies-utils.mjs.map +1 -1
- package/dist/browser-dev/flatten-connection.mjs.map +1 -1
- package/dist/browser-dev/getProductOptions.mjs +2 -4
- package/dist/browser-dev/getProductOptions.mjs.map +1 -1
- package/dist/browser-dev/index.mjs +4 -0
- package/dist/browser-dev/index.mjs.map +1 -1
- package/dist/browser-dev/load-script.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs +10 -18
- package/dist/browser-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs +5 -9
- package/dist/browser-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/browser-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
- package/dist/browser-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs +1 -2
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
- package/dist/browser-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/browser-dev/optionValueDecoder.mjs +1 -2
- package/dist/browser-dev/optionValueDecoder.mjs.map +1 -1
- package/dist/browser-dev/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/browser-dev/parse-metafield.mjs +2 -2
- package/dist/browser-dev/parse-metafield.mjs.map +1 -1
- package/dist/browser-dev/storefront-client.mjs +1 -2
- package/dist/browser-dev/storefront-client.mjs.map +1 -1
- package/dist/browser-dev/tracking-utils.mjs +88 -0
- package/dist/browser-dev/tracking-utils.mjs.map +1 -0
- package/dist/browser-dev/useCartAPIStateMachine.mjs +6 -12
- package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-dev/useCartActions.mjs.map +1 -1
- package/dist/browser-dev/useMoney.mjs.map +1 -1
- package/dist/browser-dev/useSelectedOptionInUrlParam.mjs.map +1 -1
- package/dist/browser-dev/useShopifyCookies.mjs +97 -11
- package/dist/browser-dev/useShopifyCookies.mjs.map +1 -1
- package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
- package/dist/browser-prod/BaseButton.mjs.map +1 -1
- package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
- package/dist/browser-prod/CartCheckoutButton.mjs.map +1 -1
- package/dist/browser-prod/CartCost.mjs.map +1 -1
- package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
- package/dist/browser-prod/CartLineQuantity.mjs.map +1 -1
- package/dist/browser-prod/CartLineQuantityAdjustButton.mjs.map +1 -1
- package/dist/browser-prod/CartProvider.mjs +4 -7
- package/dist/browser-prod/CartProvider.mjs.map +1 -1
- package/dist/browser-prod/ExternalVideo.mjs.map +1 -1
- package/dist/browser-prod/Image.mjs +2 -4
- package/dist/browser-prod/Image.mjs.map +1 -1
- package/dist/browser-prod/MediaFile.mjs.map +1 -1
- package/dist/browser-prod/ModelViewer.mjs.map +1 -1
- package/dist/browser-prod/Money.mjs.map +1 -1
- package/dist/browser-prod/ProductPrice.mjs.map +1 -1
- package/dist/browser-prod/ProductProvider.mjs +15 -12
- package/dist/browser-prod/ProductProvider.mjs.map +1 -1
- package/dist/browser-prod/RichText.components.mjs +2 -4
- package/dist/browser-prod/RichText.components.mjs.map +1 -1
- package/dist/browser-prod/RichText.mjs.map +1 -1
- package/dist/browser-prod/ShopPayButton.mjs.map +1 -1
- package/dist/browser-prod/ShopifyProvider.mjs +19 -2
- package/dist/browser-prod/ShopifyProvider.mjs.map +1 -1
- package/dist/browser-prod/Video.mjs.map +1 -1
- package/dist/browser-prod/_virtual/with-selector.mjs +3 -2
- package/dist/browser-prod/_virtual/with-selector.mjs.map +1 -1
- package/dist/browser-prod/_virtual/with-selector2.mjs +5 -0
- package/dist/browser-prod/_virtual/with-selector2.mjs.map +1 -0
- package/dist/browser-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/browser-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
- package/dist/browser-prod/analytics-utils.mjs.map +1 -1
- package/dist/browser-prod/analytics.mjs +7 -11
- package/dist/browser-prod/analytics.mjs.map +1 -1
- package/dist/browser-prod/cart-hooks.mjs +25 -7
- package/dist/browser-prod/cart-hooks.mjs.map +1 -1
- package/dist/browser-prod/cookies-utils.mjs +5 -5
- package/dist/browser-prod/cookies-utils.mjs.map +1 -1
- package/dist/browser-prod/flatten-connection.mjs.map +1 -1
- package/dist/browser-prod/getProductOptions.mjs +2 -4
- package/dist/browser-prod/getProductOptions.mjs.map +1 -1
- package/dist/browser-prod/index.mjs +4 -0
- package/dist/browser-prod/index.mjs.map +1 -1
- package/dist/browser-prod/load-script.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs +10 -18
- package/dist/browser-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs +5 -9
- package/dist/browser-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/browser-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
- package/dist/browser-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs +1 -2
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
- package/dist/browser-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/browser-prod/optionValueDecoder.mjs +1 -2
- package/dist/browser-prod/optionValueDecoder.mjs.map +1 -1
- package/dist/browser-prod/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/browser-prod/parse-metafield.mjs +2 -2
- package/dist/browser-prod/parse-metafield.mjs.map +1 -1
- package/dist/browser-prod/storefront-client.mjs +1 -2
- package/dist/browser-prod/storefront-client.mjs.map +1 -1
- package/dist/browser-prod/tracking-utils.mjs +88 -0
- package/dist/browser-prod/tracking-utils.mjs.map +1 -0
- package/dist/browser-prod/useCartAPIStateMachine.mjs +6 -12
- package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-prod/useCartActions.mjs.map +1 -1
- package/dist/browser-prod/useMoney.mjs.map +1 -1
- package/dist/browser-prod/useSelectedOptionInUrlParam.mjs.map +1 -1
- package/dist/browser-prod/useShopifyCookies.mjs +97 -11
- package/dist/browser-prod/useShopifyCookies.mjs.map +1 -1
- package/dist/node-dev/AddToCartButton.js.map +1 -1
- package/dist/node-dev/AddToCartButton.mjs.map +1 -1
- package/dist/node-dev/BaseButton.js.map +1 -1
- package/dist/node-dev/BaseButton.mjs.map +1 -1
- package/dist/node-dev/BuyNowButton.js.map +1 -1
- package/dist/node-dev/BuyNowButton.mjs.map +1 -1
- package/dist/node-dev/CartCheckoutButton.js.map +1 -1
- package/dist/node-dev/CartCheckoutButton.mjs.map +1 -1
- package/dist/node-dev/CartCost.js.map +1 -1
- package/dist/node-dev/CartCost.mjs.map +1 -1
- package/dist/node-dev/CartLineProvider.js.map +1 -1
- package/dist/node-dev/CartLineProvider.mjs.map +1 -1
- package/dist/node-dev/CartLineQuantity.js.map +1 -1
- package/dist/node-dev/CartLineQuantity.mjs.map +1 -1
- package/dist/node-dev/CartLineQuantityAdjustButton.js.map +1 -1
- package/dist/node-dev/CartLineQuantityAdjustButton.mjs.map +1 -1
- package/dist/node-dev/CartProvider.js +3 -6
- package/dist/node-dev/CartProvider.js.map +1 -1
- package/dist/node-dev/CartProvider.mjs +4 -7
- package/dist/node-dev/CartProvider.mjs.map +1 -1
- package/dist/node-dev/ExternalVideo.js.map +1 -1
- package/dist/node-dev/ExternalVideo.mjs.map +1 -1
- package/dist/node-dev/Image.js +2 -4
- package/dist/node-dev/Image.js.map +1 -1
- package/dist/node-dev/Image.mjs +2 -4
- package/dist/node-dev/Image.mjs.map +1 -1
- package/dist/node-dev/MediaFile.js.map +1 -1
- package/dist/node-dev/MediaFile.mjs.map +1 -1
- package/dist/node-dev/ModelViewer.js.map +1 -1
- package/dist/node-dev/ModelViewer.mjs.map +1 -1
- package/dist/node-dev/Money.js.map +1 -1
- package/dist/node-dev/Money.mjs.map +1 -1
- package/dist/node-dev/ProductPrice.js.map +1 -1
- package/dist/node-dev/ProductPrice.mjs.map +1 -1
- package/dist/node-dev/ProductProvider.js +14 -11
- package/dist/node-dev/ProductProvider.js.map +1 -1
- package/dist/node-dev/ProductProvider.mjs +15 -12
- package/dist/node-dev/ProductProvider.mjs.map +1 -1
- package/dist/node-dev/RichText.components.js +2 -4
- package/dist/node-dev/RichText.components.js.map +1 -1
- package/dist/node-dev/RichText.components.mjs +2 -4
- package/dist/node-dev/RichText.components.mjs.map +1 -1
- package/dist/node-dev/RichText.js.map +1 -1
- package/dist/node-dev/RichText.mjs.map +1 -1
- package/dist/node-dev/ShopPayButton.js.map +1 -1
- package/dist/node-dev/ShopPayButton.mjs.map +1 -1
- package/dist/node-dev/ShopifyProvider.js +18 -1
- package/dist/node-dev/ShopifyProvider.js.map +1 -1
- package/dist/node-dev/ShopifyProvider.mjs +19 -2
- package/dist/node-dev/ShopifyProvider.mjs.map +1 -1
- package/dist/node-dev/Video.js.map +1 -1
- package/dist/node-dev/Video.mjs.map +1 -1
- package/dist/node-dev/_virtual/with-selector.js +3 -2
- package/dist/node-dev/_virtual/with-selector.js.map +1 -1
- package/dist/node-dev/_virtual/with-selector.mjs +3 -2
- package/dist/node-dev/_virtual/with-selector.mjs.map +1 -1
- package/dist/node-dev/_virtual/with-selector2.js +5 -0
- package/dist/node-dev/_virtual/with-selector2.js.map +1 -0
- package/dist/node-dev/_virtual/with-selector2.mjs +5 -0
- package/dist/node-dev/_virtual/with-selector2.mjs.map +1 -0
- package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
- package/dist/node-dev/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.js.map +1 -1
- package/dist/node-dev/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
- package/dist/node-dev/analytics-utils.js.map +1 -1
- package/dist/node-dev/analytics-utils.mjs.map +1 -1
- package/dist/node-dev/analytics.js +6 -9
- package/dist/node-dev/analytics.js.map +1 -1
- package/dist/node-dev/analytics.mjs +6 -9
- package/dist/node-dev/analytics.mjs.map +1 -1
- package/dist/node-dev/cart-hooks.js +24 -6
- package/dist/node-dev/cart-hooks.js.map +1 -1
- package/dist/node-dev/cart-hooks.mjs +25 -7
- package/dist/node-dev/cart-hooks.mjs.map +1 -1
- package/dist/node-dev/cookies-utils.js +4 -4
- package/dist/node-dev/cookies-utils.js.map +1 -1
- package/dist/node-dev/cookies-utils.mjs +5 -5
- package/dist/node-dev/cookies-utils.mjs.map +1 -1
- package/dist/node-dev/flatten-connection.js.map +1 -1
- package/dist/node-dev/flatten-connection.mjs.map +1 -1
- package/dist/node-dev/getProductOptions.js +2 -4
- package/dist/node-dev/getProductOptions.js.map +1 -1
- package/dist/node-dev/getProductOptions.mjs +2 -4
- package/dist/node-dev/getProductOptions.mjs.map +1 -1
- package/dist/node-dev/index.js +4 -0
- package/dist/node-dev/index.js.map +1 -1
- package/dist/node-dev/index.mjs +4 -0
- package/dist/node-dev/index.mjs.map +1 -1
- package/dist/node-dev/load-script.js.map +1 -1
- package/dist/node-dev/load-script.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.js +10 -18
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs +10 -18
- package/dist/node-dev/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.js +5 -9
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs +5 -9
- package/dist/node-dev/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/node-dev/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +5 -10
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs +1 -2
- package/dist/node-dev/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js +12 -7
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
- package/dist/node-dev/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/node-dev/optionValueDecoder.js +1 -2
- package/dist/node-dev/optionValueDecoder.js.map +1 -1
- package/dist/node-dev/optionValueDecoder.mjs +1 -2
- package/dist/node-dev/optionValueDecoder.mjs.map +1 -1
- package/dist/node-dev/packages/hydrogen-react/package.json.js +1 -1
- package/dist/node-dev/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/node-dev/parse-metafield.js +2 -2
- package/dist/node-dev/parse-metafield.js.map +1 -1
- package/dist/node-dev/parse-metafield.mjs +2 -2
- package/dist/node-dev/parse-metafield.mjs.map +1 -1
- package/dist/node-dev/storefront-client.js +1 -2
- package/dist/node-dev/storefront-client.js.map +1 -1
- package/dist/node-dev/storefront-client.mjs +1 -2
- package/dist/node-dev/storefront-client.mjs.map +1 -1
- package/dist/node-dev/tracking-utils.js +88 -0
- package/dist/node-dev/tracking-utils.js.map +1 -0
- package/dist/node-dev/tracking-utils.mjs +88 -0
- package/dist/node-dev/tracking-utils.mjs.map +1 -0
- package/dist/node-dev/useCartAPIStateMachine.js +6 -12
- package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.mjs +6 -12
- package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-dev/useCartActions.js.map +1 -1
- package/dist/node-dev/useCartActions.mjs.map +1 -1
- package/dist/node-dev/useMoney.js.map +1 -1
- package/dist/node-dev/useMoney.mjs.map +1 -1
- package/dist/node-dev/useSelectedOptionInUrlParam.js.map +1 -1
- package/dist/node-dev/useSelectedOptionInUrlParam.mjs.map +1 -1
- package/dist/node-dev/useShopifyCookies.js +95 -9
- package/dist/node-dev/useShopifyCookies.js.map +1 -1
- package/dist/node-dev/useShopifyCookies.mjs +97 -11
- package/dist/node-dev/useShopifyCookies.mjs.map +1 -1
- package/dist/node-prod/AddToCartButton.js.map +1 -1
- package/dist/node-prod/AddToCartButton.mjs.map +1 -1
- package/dist/node-prod/BaseButton.js.map +1 -1
- package/dist/node-prod/BaseButton.mjs.map +1 -1
- package/dist/node-prod/BuyNowButton.js.map +1 -1
- package/dist/node-prod/BuyNowButton.mjs.map +1 -1
- package/dist/node-prod/CartCheckoutButton.js.map +1 -1
- package/dist/node-prod/CartCheckoutButton.mjs.map +1 -1
- package/dist/node-prod/CartCost.js.map +1 -1
- package/dist/node-prod/CartCost.mjs.map +1 -1
- package/dist/node-prod/CartLineProvider.js.map +1 -1
- package/dist/node-prod/CartLineProvider.mjs.map +1 -1
- package/dist/node-prod/CartLineQuantity.js.map +1 -1
- package/dist/node-prod/CartLineQuantity.mjs.map +1 -1
- package/dist/node-prod/CartLineQuantityAdjustButton.js.map +1 -1
- package/dist/node-prod/CartLineQuantityAdjustButton.mjs.map +1 -1
- package/dist/node-prod/CartProvider.js +3 -6
- package/dist/node-prod/CartProvider.js.map +1 -1
- package/dist/node-prod/CartProvider.mjs +4 -7
- package/dist/node-prod/CartProvider.mjs.map +1 -1
- package/dist/node-prod/ExternalVideo.js.map +1 -1
- package/dist/node-prod/ExternalVideo.mjs.map +1 -1
- package/dist/node-prod/Image.js +2 -4
- package/dist/node-prod/Image.js.map +1 -1
- package/dist/node-prod/Image.mjs +2 -4
- package/dist/node-prod/Image.mjs.map +1 -1
- package/dist/node-prod/MediaFile.js.map +1 -1
- package/dist/node-prod/MediaFile.mjs.map +1 -1
- package/dist/node-prod/ModelViewer.js.map +1 -1
- package/dist/node-prod/ModelViewer.mjs.map +1 -1
- package/dist/node-prod/Money.js.map +1 -1
- package/dist/node-prod/Money.mjs.map +1 -1
- package/dist/node-prod/ProductPrice.js.map +1 -1
- package/dist/node-prod/ProductPrice.mjs.map +1 -1
- package/dist/node-prod/ProductProvider.js +14 -11
- package/dist/node-prod/ProductProvider.js.map +1 -1
- package/dist/node-prod/ProductProvider.mjs +15 -12
- package/dist/node-prod/ProductProvider.mjs.map +1 -1
- package/dist/node-prod/RichText.components.js +2 -4
- package/dist/node-prod/RichText.components.js.map +1 -1
- package/dist/node-prod/RichText.components.mjs +2 -4
- package/dist/node-prod/RichText.components.mjs.map +1 -1
- package/dist/node-prod/RichText.js.map +1 -1
- package/dist/node-prod/RichText.mjs.map +1 -1
- package/dist/node-prod/ShopPayButton.js.map +1 -1
- package/dist/node-prod/ShopPayButton.mjs.map +1 -1
- package/dist/node-prod/ShopifyProvider.js +18 -1
- package/dist/node-prod/ShopifyProvider.js.map +1 -1
- package/dist/node-prod/ShopifyProvider.mjs +19 -2
- package/dist/node-prod/ShopifyProvider.mjs.map +1 -1
- package/dist/node-prod/Video.js.map +1 -1
- package/dist/node-prod/Video.mjs.map +1 -1
- package/dist/node-prod/_virtual/with-selector.js +3 -2
- package/dist/node-prod/_virtual/with-selector.js.map +1 -1
- package/dist/node-prod/_virtual/with-selector.mjs +3 -2
- package/dist/node-prod/_virtual/with-selector.mjs.map +1 -1
- package/dist/node-prod/_virtual/with-selector2.js +5 -0
- package/dist/node-prod/_virtual/with-selector2.js.map +1 -0
- package/dist/node-prod/_virtual/with-selector2.mjs +5 -0
- package/dist/node-prod/_virtual/with-selector2.mjs.map +1 -0
- package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.js.map +1 -1
- package/dist/node-prod/analytics-schema-custom-storefront-customer-tracking.mjs.map +1 -1
- package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.js.map +1 -1
- package/dist/node-prod/analytics-schema-trekkie-storefront-page-view.mjs.map +1 -1
- package/dist/node-prod/analytics-utils.js.map +1 -1
- package/dist/node-prod/analytics-utils.mjs.map +1 -1
- package/dist/node-prod/analytics.js +7 -11
- package/dist/node-prod/analytics.js.map +1 -1
- package/dist/node-prod/analytics.mjs +7 -11
- package/dist/node-prod/analytics.mjs.map +1 -1
- package/dist/node-prod/cart-hooks.js +24 -6
- package/dist/node-prod/cart-hooks.js.map +1 -1
- package/dist/node-prod/cart-hooks.mjs +25 -7
- package/dist/node-prod/cart-hooks.mjs.map +1 -1
- package/dist/node-prod/cookies-utils.js +4 -4
- package/dist/node-prod/cookies-utils.js.map +1 -1
- package/dist/node-prod/cookies-utils.mjs +5 -5
- package/dist/node-prod/cookies-utils.mjs.map +1 -1
- package/dist/node-prod/flatten-connection.js.map +1 -1
- package/dist/node-prod/flatten-connection.mjs.map +1 -1
- package/dist/node-prod/getProductOptions.js +2 -4
- package/dist/node-prod/getProductOptions.js.map +1 -1
- package/dist/node-prod/getProductOptions.mjs +2 -4
- package/dist/node-prod/getProductOptions.mjs.map +1 -1
- package/dist/node-prod/index.js +4 -0
- package/dist/node-prod/index.js.map +1 -1
- package/dist/node-prod/index.mjs +4 -0
- package/dist/node-prod/index.mjs.map +1 -1
- package/dist/node-prod/load-script.js.map +1 -1
- package/dist/node-prod/load-script.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.js +10 -18
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs +10 -18
- package/dist/node-prod/node_modules/@xstate/fsm/es/index.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.js +5 -9
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs +5 -9
- package/dist/node-prod/node_modules/@xstate/react/es/fsm.mjs.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/useConstant.js.map +1 -1
- package/dist/node-prod/node_modules/@xstate/react/es/useConstant.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js +5 -10
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs +5 -10
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.min.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.min.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs +1 -2
- package/dist/node-prod/node_modules/use-sync-external-store/shim/index.mjs.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js +12 -7
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.js.map +1 -1
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs +12 -7
- package/dist/node-prod/node_modules/use-sync-external-store/shim/with-selector.mjs.map +1 -1
- package/dist/node-prod/optionValueDecoder.js +1 -2
- package/dist/node-prod/optionValueDecoder.js.map +1 -1
- package/dist/node-prod/optionValueDecoder.mjs +1 -2
- package/dist/node-prod/optionValueDecoder.mjs.map +1 -1
- package/dist/node-prod/packages/hydrogen-react/package.json.js +1 -1
- package/dist/node-prod/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/node-prod/parse-metafield.js +2 -2
- package/dist/node-prod/parse-metafield.js.map +1 -1
- package/dist/node-prod/parse-metafield.mjs +2 -2
- package/dist/node-prod/parse-metafield.mjs.map +1 -1
- package/dist/node-prod/storefront-client.js +1 -2
- package/dist/node-prod/storefront-client.js.map +1 -1
- package/dist/node-prod/storefront-client.mjs +1 -2
- package/dist/node-prod/storefront-client.mjs.map +1 -1
- package/dist/node-prod/tracking-utils.js +88 -0
- package/dist/node-prod/tracking-utils.js.map +1 -0
- package/dist/node-prod/tracking-utils.mjs +88 -0
- package/dist/node-prod/tracking-utils.mjs.map +1 -0
- package/dist/node-prod/useCartAPIStateMachine.js +6 -12
- package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.mjs +6 -12
- package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-prod/useCartActions.js.map +1 -1
- package/dist/node-prod/useCartActions.mjs.map +1 -1
- package/dist/node-prod/useMoney.js.map +1 -1
- package/dist/node-prod/useMoney.mjs.map +1 -1
- package/dist/node-prod/useSelectedOptionInUrlParam.js.map +1 -1
- package/dist/node-prod/useSelectedOptionInUrlParam.mjs.map +1 -1
- package/dist/node-prod/useShopifyCookies.js +95 -9
- package/dist/node-prod/useShopifyCookies.js.map +1 -1
- package/dist/node-prod/useShopifyCookies.mjs +97 -11
- package/dist/node-prod/useShopifyCookies.mjs.map +1 -1
- package/dist/types/Image.d.ts +1 -1
- package/dist/types/ShopifyProvider.d.ts +5 -0
- package/dist/types/cookies-utils.d.ts +4 -0
- package/dist/types/index.d.cts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/tracking-utils.d.ts +22 -0
- package/dist/types/useShopifyCookies.d.ts +28 -2
- package/dist/umd/hydrogen-react.dev.js +543 -367
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +18 -18
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +35 -22
|
@@ -35,20 +35,17 @@
|
|
|
35
35
|
***************************************************************************** */
|
|
36
36
|
function t(t2, n2) {
|
|
37
37
|
var e2 = "function" == typeof Symbol && t2[Symbol.iterator];
|
|
38
|
-
if (!e2)
|
|
39
|
-
return t2;
|
|
38
|
+
if (!e2) return t2;
|
|
40
39
|
var r2, i2, o2 = e2.call(t2), a2 = [];
|
|
41
40
|
try {
|
|
42
|
-
for (; (void 0 === n2 || n2-- > 0) && !(r2 = o2.next()).done; )
|
|
43
|
-
a2.push(r2.value);
|
|
41
|
+
for (; (void 0 === n2 || n2-- > 0) && !(r2 = o2.next()).done; ) a2.push(r2.value);
|
|
44
42
|
} catch (t3) {
|
|
45
43
|
i2 = { error: t3 };
|
|
46
44
|
} finally {
|
|
47
45
|
try {
|
|
48
46
|
r2 && !r2.done && (e2 = o2.return) && e2.call(o2);
|
|
49
47
|
} finally {
|
|
50
|
-
if (i2)
|
|
51
|
-
throw i2.error;
|
|
48
|
+
if (i2) throw i2.error;
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
return a2;
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
return t2 === n2;
|
|
73
70
|
};
|
|
74
71
|
}
|
|
75
|
-
function u
|
|
72
|
+
function u(t2) {
|
|
76
73
|
return "string" == typeof t2 ? { type: t2 } : t2;
|
|
77
74
|
}
|
|
78
75
|
function c(t2, n2) {
|
|
@@ -96,32 +93,29 @@
|
|
|
96
93
|
var s2 = t(f(r(n2.states[n2.initial].entry).map(function(t2) {
|
|
97
94
|
return o(t2, i2.actions);
|
|
98
95
|
}), n2.context, e), 2), l2 = s2[0], v2 = s2[1], y = { config: n2, _options: i2, initialState: { value: n2.initial, actions: l2, context: v2, matches: a(n2.initial) }, transition: function(e2, i3) {
|
|
99
|
-
var s3, l3, v3 = "string" == typeof e2 ? { value: e2, context: n2.context } : e2, p = v3.value,
|
|
96
|
+
var s3, l3, v3 = "string" == typeof e2 ? { value: e2, context: n2.context } : e2, p = v3.value, g = v3.context, d = u(i3), x = n2.states[p];
|
|
100
97
|
if (x.on) {
|
|
101
98
|
var m = r(x.on[d.type]);
|
|
102
99
|
try {
|
|
103
100
|
for (var h = function(t2) {
|
|
104
101
|
var n3 = "function" == typeof Symbol && Symbol.iterator, e3 = n3 && t2[n3], r2 = 0;
|
|
105
|
-
if (e3)
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
return t2 && r2 >= t2.length && (t2 = void 0), { value: t2 && t2[r2++], done: !t2 };
|
|
110
|
-
} };
|
|
102
|
+
if (e3) return e3.call(t2);
|
|
103
|
+
if (t2 && "number" == typeof t2.length) return { next: function() {
|
|
104
|
+
return t2 && r2 >= t2.length && (t2 = void 0), { value: t2 && t2[r2++], done: !t2 };
|
|
105
|
+
} };
|
|
111
106
|
throw new TypeError(n3 ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
112
107
|
}(m), b = h.next(); !b.done; b = h.next()) {
|
|
113
108
|
var S = b.value;
|
|
114
|
-
if (void 0 === S)
|
|
115
|
-
return c(p, g2);
|
|
109
|
+
if (void 0 === S) return c(p, g);
|
|
116
110
|
var w = "string" == typeof S ? { target: S } : S, j = w.target, E = w.actions, R = void 0 === E ? [] : E, N = w.cond, O = void 0 === N ? function() {
|
|
117
111
|
return true;
|
|
118
112
|
} : N, _ = void 0 === j, k = null != j ? j : p, T = n2.states[k];
|
|
119
|
-
if (O(
|
|
113
|
+
if (O(g, d)) {
|
|
120
114
|
var q = t(f((_ ? r(R) : [].concat(x.exit, R, T.entry).filter(function(t2) {
|
|
121
115
|
return t2;
|
|
122
116
|
})).map(function(t2) {
|
|
123
117
|
return o(t2, y._options.actions);
|
|
124
|
-
}),
|
|
118
|
+
}), g, d), 3), z = q[0], A = q[1], B = q[2], C = null != j ? j : p;
|
|
125
119
|
return { value: C, context: A, actions: z, changed: j !== p || z.length > 0 || B, matches: a(C) };
|
|
126
120
|
}
|
|
127
121
|
}
|
|
@@ -131,12 +125,11 @@
|
|
|
131
125
|
try {
|
|
132
126
|
b && !b.done && (l3 = h.return) && l3.call(h);
|
|
133
127
|
} finally {
|
|
134
|
-
if (s3)
|
|
135
|
-
throw s3.error;
|
|
128
|
+
if (s3) throw s3.error;
|
|
136
129
|
}
|
|
137
130
|
}
|
|
138
131
|
}
|
|
139
|
-
return c(p,
|
|
132
|
+
return c(p, g);
|
|
140
133
|
} };
|
|
141
134
|
return y;
|
|
142
135
|
}
|
|
@@ -148,7 +141,7 @@
|
|
|
148
141
|
};
|
|
149
142
|
function v(t2) {
|
|
150
143
|
var r2 = t2.initialState, i2 = n.NotStarted, o2 = /* @__PURE__ */ new Set(), c2 = { _machine: t2, send: function(e2) {
|
|
151
|
-
i2 === n.Running && (r2 = t2.transition(r2, e2), l$1(r2, u
|
|
144
|
+
i2 === n.Running && (r2 = t2.transition(r2, e2), l$1(r2, u(e2)), o2.forEach(function(t3) {
|
|
152
145
|
return t3(r2);
|
|
153
146
|
}));
|
|
154
147
|
}, subscribe: function(t3) {
|
|
@@ -159,8 +152,7 @@
|
|
|
159
152
|
if (o3) {
|
|
160
153
|
var u2 = "object" == typeof o3 ? o3 : { context: t2.config.context, value: o3 };
|
|
161
154
|
r2 = { value: u2.value, actions: [], context: u2.context, matches: a(u2.value) };
|
|
162
|
-
} else
|
|
163
|
-
r2 = t2.initialState;
|
|
155
|
+
} else r2 = t2.initialState;
|
|
164
156
|
return i2 = n.Running, l$1(r2, e), c2;
|
|
165
157
|
}, stop: function() {
|
|
166
158
|
return i2 = n.Stopped, o2.clear(), c2;
|
|
@@ -176,228 +168,251 @@
|
|
|
176
168
|
var withSelector_development = {};
|
|
177
169
|
var shim = { exports: {} };
|
|
178
170
|
var useSyncExternalStoreShim_development = {};
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
171
|
+
var hasRequiredUseSyncExternalStoreShim_development;
|
|
172
|
+
function requireUseSyncExternalStoreShim_development() {
|
|
173
|
+
if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
|
|
174
|
+
hasRequiredUseSyncExternalStoreShim_development = 1;
|
|
175
|
+
/**
|
|
176
|
+
* @license React
|
|
177
|
+
* use-sync-external-store-shim.development.js
|
|
178
|
+
*
|
|
179
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
180
|
+
*
|
|
181
|
+
* This source code is licensed under the MIT license found in the
|
|
182
|
+
* LICENSE file in the root directory of this source tree.
|
|
183
|
+
*/
|
|
184
|
+
{
|
|
185
|
+
(function() {
|
|
186
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
187
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
188
|
+
}
|
|
189
|
+
var React2 = React$1;
|
|
190
|
+
var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
191
|
+
function error(format) {
|
|
197
192
|
{
|
|
198
|
-
|
|
199
|
-
args
|
|
193
|
+
{
|
|
194
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
195
|
+
args[_key2 - 1] = arguments[_key2];
|
|
196
|
+
}
|
|
197
|
+
printWarning("error", format, args);
|
|
200
198
|
}
|
|
201
|
-
printWarning("error", format, args);
|
|
202
199
|
}
|
|
203
200
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
args = args.concat([stack]);
|
|
212
|
-
}
|
|
213
|
-
var argsWithFormat = args.map(function(item) {
|
|
214
|
-
return String(item);
|
|
215
|
-
});
|
|
216
|
-
argsWithFormat.unshift("Warning: " + format);
|
|
217
|
-
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function is(x, y) {
|
|
221
|
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
|
|
222
|
-
}
|
|
223
|
-
var objectIs = typeof Object.is === "function" ? Object.is : is;
|
|
224
|
-
var useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
|
|
225
|
-
var didWarnOld18Alpha = false;
|
|
226
|
-
var didWarnUncachedGetSnapshot = false;
|
|
227
|
-
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
228
|
-
{
|
|
229
|
-
if (!didWarnOld18Alpha) {
|
|
230
|
-
if (React2.startTransition !== void 0) {
|
|
231
|
-
didWarnOld18Alpha = true;
|
|
232
|
-
error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
|
|
201
|
+
function printWarning(level, format, args) {
|
|
202
|
+
{
|
|
203
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
204
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
205
|
+
if (stack !== "") {
|
|
206
|
+
format += "%s";
|
|
207
|
+
args = args.concat([stack]);
|
|
233
208
|
}
|
|
209
|
+
var argsWithFormat = args.map(function(item) {
|
|
210
|
+
return String(item);
|
|
211
|
+
});
|
|
212
|
+
argsWithFormat.unshift("Warning: " + format);
|
|
213
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
234
214
|
}
|
|
235
215
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
if (!didWarnUncachedGetSnapshot) {
|
|
239
|
-
var cachedValue = getSnapshot();
|
|
240
|
-
if (!objectIs(value, cachedValue)) {
|
|
241
|
-
error("The result of getSnapshot should be cached to avoid an infinite loop");
|
|
242
|
-
didWarnUncachedGetSnapshot = true;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
216
|
+
function is(x, y) {
|
|
217
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
|
|
245
218
|
}
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
});
|
|
219
|
+
var objectIs = typeof Object.is === "function" ? Object.is : is;
|
|
220
|
+
var useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
|
|
221
|
+
var didWarnOld18Alpha = false;
|
|
222
|
+
var didWarnUncachedGetSnapshot = false;
|
|
223
|
+
function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {
|
|
224
|
+
{
|
|
225
|
+
if (!didWarnOld18Alpha) {
|
|
226
|
+
if (React2.startTransition !== void 0) {
|
|
227
|
+
didWarnOld18Alpha = true;
|
|
228
|
+
error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.");
|
|
229
|
+
}
|
|
230
|
+
}
|
|
259
231
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
232
|
+
var value = getSnapshot();
|
|
233
|
+
{
|
|
234
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
235
|
+
var cachedValue = getSnapshot();
|
|
236
|
+
if (!objectIs(value, cachedValue)) {
|
|
237
|
+
error("The result of getSnapshot should be cached to avoid an infinite loop");
|
|
238
|
+
didWarnUncachedGetSnapshot = true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
266
241
|
}
|
|
267
|
-
var
|
|
242
|
+
var _useState = useState({
|
|
243
|
+
inst: {
|
|
244
|
+
value,
|
|
245
|
+
getSnapshot
|
|
246
|
+
}
|
|
247
|
+
}), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
248
|
+
useLayoutEffect(function() {
|
|
249
|
+
inst.value = value;
|
|
250
|
+
inst.getSnapshot = getSnapshot;
|
|
268
251
|
if (checkIfSnapshotChanged(inst)) {
|
|
269
252
|
forceUpdate({
|
|
270
253
|
inst
|
|
271
254
|
});
|
|
272
255
|
}
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
256
|
+
}, [subscribe, value, getSnapshot]);
|
|
257
|
+
useEffect(function() {
|
|
258
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
259
|
+
forceUpdate({
|
|
260
|
+
inst
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
var handleStoreChange = function() {
|
|
264
|
+
if (checkIfSnapshotChanged(inst)) {
|
|
265
|
+
forceUpdate({
|
|
266
|
+
inst
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
return subscribe(handleStoreChange);
|
|
271
|
+
}, [subscribe]);
|
|
272
|
+
useDebugValue(value);
|
|
273
|
+
return value;
|
|
287
274
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
298
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
299
|
-
}
|
|
300
|
-
})();
|
|
301
|
-
}
|
|
302
|
-
{
|
|
303
|
-
shim.exports = useSyncExternalStoreShim_development;
|
|
304
|
-
}
|
|
305
|
-
var shimExports = shim.exports;
|
|
306
|
-
/**
|
|
307
|
-
* @license React
|
|
308
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
309
|
-
*
|
|
310
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
311
|
-
*
|
|
312
|
-
* This source code is licensed under the MIT license found in the
|
|
313
|
-
* LICENSE file in the root directory of this source tree.
|
|
314
|
-
*/
|
|
315
|
-
{
|
|
316
|
-
(function() {
|
|
317
|
-
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
318
|
-
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
319
|
-
}
|
|
320
|
-
var React2 = React$1;
|
|
321
|
-
var shim2 = shimExports;
|
|
322
|
-
function is(x, y) {
|
|
323
|
-
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
|
|
324
|
-
}
|
|
325
|
-
var objectIs = typeof Object.is === "function" ? Object.is : is;
|
|
326
|
-
var useSyncExternalStore = shim2.useSyncExternalStore;
|
|
327
|
-
var useRef = React2.useRef, useEffect = React2.useEffect, useMemo = React2.useMemo, useDebugValue = React2.useDebugValue;
|
|
328
|
-
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual2) {
|
|
329
|
-
var instRef = useRef(null);
|
|
330
|
-
var inst;
|
|
331
|
-
if (instRef.current === null) {
|
|
332
|
-
inst = {
|
|
333
|
-
hasValue: false,
|
|
334
|
-
value: null
|
|
335
|
-
};
|
|
336
|
-
instRef.current = inst;
|
|
337
|
-
} else {
|
|
338
|
-
inst = instRef.current;
|
|
275
|
+
function checkIfSnapshotChanged(inst) {
|
|
276
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
277
|
+
var prevValue = inst.value;
|
|
278
|
+
try {
|
|
279
|
+
var nextValue = latestGetSnapshot();
|
|
280
|
+
return !objectIs(prevValue, nextValue);
|
|
281
|
+
} catch (error2) {
|
|
282
|
+
return true;
|
|
283
|
+
}
|
|
339
284
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
285
|
+
function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) {
|
|
286
|
+
return getSnapshot();
|
|
287
|
+
}
|
|
288
|
+
var canUseDOM = !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
|
|
289
|
+
var isServerEnvironment = !canUseDOM;
|
|
290
|
+
var shim2 = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore;
|
|
291
|
+
var useSyncExternalStore$2 = React2.useSyncExternalStore !== void 0 ? React2.useSyncExternalStore : shim2;
|
|
292
|
+
useSyncExternalStoreShim_development.useSyncExternalStore = useSyncExternalStore$2;
|
|
293
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
294
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
295
|
+
}
|
|
296
|
+
})();
|
|
297
|
+
}
|
|
298
|
+
return useSyncExternalStoreShim_development;
|
|
299
|
+
}
|
|
300
|
+
var hasRequiredShim;
|
|
301
|
+
function requireShim() {
|
|
302
|
+
if (hasRequiredShim) return shim.exports;
|
|
303
|
+
hasRequiredShim = 1;
|
|
304
|
+
{
|
|
305
|
+
shim.exports = requireUseSyncExternalStoreShim_development();
|
|
306
|
+
}
|
|
307
|
+
return shim.exports;
|
|
308
|
+
}
|
|
309
|
+
var hasRequiredWithSelector_development;
|
|
310
|
+
function requireWithSelector_development() {
|
|
311
|
+
if (hasRequiredWithSelector_development) return withSelector_development;
|
|
312
|
+
hasRequiredWithSelector_development = 1;
|
|
313
|
+
/**
|
|
314
|
+
* @license React
|
|
315
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
316
|
+
*
|
|
317
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
318
|
+
*
|
|
319
|
+
* This source code is licensed under the MIT license found in the
|
|
320
|
+
* LICENSE file in the root directory of this source tree.
|
|
321
|
+
*/
|
|
322
|
+
{
|
|
323
|
+
(function() {
|
|
324
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
|
|
325
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
|
|
326
|
+
}
|
|
327
|
+
var React2 = React$1;
|
|
328
|
+
var shim2 = requireShim();
|
|
329
|
+
function is(x, y) {
|
|
330
|
+
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y;
|
|
331
|
+
}
|
|
332
|
+
var objectIs = typeof Object.is === "function" ? Object.is : is;
|
|
333
|
+
var useSyncExternalStore = shim2.useSyncExternalStore;
|
|
334
|
+
var useRef = React2.useRef, useEffect = React2.useEffect, useMemo = React2.useMemo, useDebugValue = React2.useDebugValue;
|
|
335
|
+
function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual2) {
|
|
336
|
+
var instRef = useRef(null);
|
|
337
|
+
var inst;
|
|
338
|
+
if (instRef.current === null) {
|
|
339
|
+
inst = {
|
|
340
|
+
hasValue: false,
|
|
341
|
+
value: null
|
|
342
|
+
};
|
|
343
|
+
instRef.current = inst;
|
|
344
|
+
} else {
|
|
345
|
+
inst = instRef.current;
|
|
346
|
+
}
|
|
347
|
+
var _useMemo = useMemo(function() {
|
|
348
|
+
var hasMemo = false;
|
|
349
|
+
var memoizedSnapshot;
|
|
350
|
+
var memoizedSelection;
|
|
351
|
+
var memoizedSelector = function(nextSnapshot) {
|
|
352
|
+
if (!hasMemo) {
|
|
353
|
+
hasMemo = true;
|
|
354
|
+
memoizedSnapshot = nextSnapshot;
|
|
355
|
+
var _nextSelection = selector(nextSnapshot);
|
|
356
|
+
if (isEqual2 !== void 0) {
|
|
357
|
+
if (inst.hasValue) {
|
|
358
|
+
var currentSelection = inst.value;
|
|
359
|
+
if (isEqual2(currentSelection, _nextSelection)) {
|
|
360
|
+
memoizedSelection = currentSelection;
|
|
361
|
+
return currentSelection;
|
|
362
|
+
}
|
|
355
363
|
}
|
|
356
364
|
}
|
|
365
|
+
memoizedSelection = _nextSelection;
|
|
366
|
+
return _nextSelection;
|
|
357
367
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
})();
|
|
368
|
+
var prevSnapshot = memoizedSnapshot;
|
|
369
|
+
var prevSelection = memoizedSelection;
|
|
370
|
+
if (objectIs(prevSnapshot, nextSnapshot)) {
|
|
371
|
+
return prevSelection;
|
|
372
|
+
}
|
|
373
|
+
var nextSelection = selector(nextSnapshot);
|
|
374
|
+
if (isEqual2 !== void 0 && isEqual2(prevSelection, nextSelection)) {
|
|
375
|
+
return prevSelection;
|
|
376
|
+
}
|
|
377
|
+
memoizedSnapshot = nextSnapshot;
|
|
378
|
+
memoizedSelection = nextSelection;
|
|
379
|
+
return nextSelection;
|
|
380
|
+
};
|
|
381
|
+
var maybeGetServerSnapshot = getServerSnapshot === void 0 ? null : getServerSnapshot;
|
|
382
|
+
var getSnapshotWithSelector = function() {
|
|
383
|
+
return memoizedSelector(getSnapshot());
|
|
384
|
+
};
|
|
385
|
+
var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? void 0 : function() {
|
|
386
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
387
|
+
};
|
|
388
|
+
return [getSnapshotWithSelector, getServerSnapshotWithSelector];
|
|
389
|
+
}, [getSnapshot, getServerSnapshot, selector, isEqual2]), getSelection = _useMemo[0], getServerSelection = _useMemo[1];
|
|
390
|
+
var value = useSyncExternalStore(subscribe, getSelection, getServerSelection);
|
|
391
|
+
useEffect(function() {
|
|
392
|
+
inst.hasValue = true;
|
|
393
|
+
inst.value = value;
|
|
394
|
+
}, [value]);
|
|
395
|
+
useDebugValue(value);
|
|
396
|
+
return value;
|
|
397
|
+
}
|
|
398
|
+
withSelector_development.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector;
|
|
399
|
+
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === "function") {
|
|
400
|
+
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
|
|
401
|
+
}
|
|
402
|
+
})();
|
|
403
|
+
}
|
|
404
|
+
return withSelector_development;
|
|
396
405
|
}
|
|
397
|
-
|
|
398
|
-
|
|
406
|
+
var hasRequiredWithSelector;
|
|
407
|
+
function requireWithSelector() {
|
|
408
|
+
if (hasRequiredWithSelector) return withSelector.exports;
|
|
409
|
+
hasRequiredWithSelector = 1;
|
|
410
|
+
{
|
|
411
|
+
withSelector.exports = requireWithSelector_development();
|
|
412
|
+
}
|
|
413
|
+
return withSelector.exports;
|
|
399
414
|
}
|
|
400
|
-
var withSelectorExports =
|
|
415
|
+
var withSelectorExports = requireWithSelector();
|
|
401
416
|
function useConstant(fn) {
|
|
402
417
|
var ref = React__namespace.useRef();
|
|
403
418
|
if (!ref.current) {
|
|
@@ -407,21 +422,17 @@
|
|
|
407
422
|
}
|
|
408
423
|
var __read = function(o2, n2) {
|
|
409
424
|
var m = typeof Symbol === "function" && o2[Symbol.iterator];
|
|
410
|
-
if (!m)
|
|
411
|
-
return o2;
|
|
425
|
+
if (!m) return o2;
|
|
412
426
|
var i2 = m.call(o2), r2, ar = [], e2;
|
|
413
427
|
try {
|
|
414
|
-
while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done)
|
|
415
|
-
ar.push(r2.value);
|
|
428
|
+
while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done) ar.push(r2.value);
|
|
416
429
|
} catch (error) {
|
|
417
430
|
e2 = { error };
|
|
418
431
|
} finally {
|
|
419
432
|
try {
|
|
420
|
-
if (r2 && !r2.done && (m = i2["return"]))
|
|
421
|
-
m.call(i2);
|
|
433
|
+
if (r2 && !r2.done && (m = i2["return"])) m.call(i2);
|
|
422
434
|
} finally {
|
|
423
|
-
if (e2)
|
|
424
|
-
throw e2.error;
|
|
435
|
+
if (e2) throw e2.error;
|
|
425
436
|
}
|
|
426
437
|
}
|
|
427
438
|
return ar;
|
|
@@ -841,8 +852,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
841
852
|
getStorefrontApiUrl(overrideProps) {
|
|
842
853
|
const domain = getShopifyDomain(overrideProps);
|
|
843
854
|
const apiUrl = domain + (domain.endsWith("/") ? "api" : "/api");
|
|
844
|
-
if (isMockShop(domain))
|
|
845
|
-
return apiUrl;
|
|
855
|
+
if (isMockShop(domain)) return apiUrl;
|
|
846
856
|
return `${apiUrl}/${(overrideProps == null ? void 0 : overrideProps.storefrontApiVersion) ?? storefrontApiVersion}/graphql.json`;
|
|
847
857
|
},
|
|
848
858
|
getPrivateTokenHeaders(overrideProps) {
|
|
@@ -919,6 +929,21 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
919
929
|
const ShopifyContext = React$1.createContext(
|
|
920
930
|
defaultShopifyContext
|
|
921
931
|
);
|
|
932
|
+
function isSfapiProxyEnabled() {
|
|
933
|
+
var _a, _b, _c;
|
|
934
|
+
if (typeof window === "undefined") return false;
|
|
935
|
+
try {
|
|
936
|
+
const navigationEntry = (_b = (_a = window.performance) == null ? void 0 : _a.getEntriesByType) == null ? void 0 : _b.call(
|
|
937
|
+
_a,
|
|
938
|
+
"navigation"
|
|
939
|
+
)[0];
|
|
940
|
+
return !!((_c = navigationEntry == null ? void 0 : navigationEntry.serverTiming) == null ? void 0 : _c.some(
|
|
941
|
+
(entry) => entry.name === "_sfapi_proxy"
|
|
942
|
+
));
|
|
943
|
+
} catch (e2) {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
}
|
|
922
947
|
function ShopifyProvider({
|
|
923
948
|
children,
|
|
924
949
|
...shopifyConfig
|
|
@@ -934,12 +959,14 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
934
959
|
);
|
|
935
960
|
}
|
|
936
961
|
const finalConfig = React$1.useMemo(() => {
|
|
962
|
+
const sameDomainForStorefrontApi = shopifyConfig.sameDomainForStorefrontApi ?? isSfapiProxyEnabled();
|
|
937
963
|
function getShopifyDomain(overrideProps) {
|
|
938
964
|
const domain = (overrideProps == null ? void 0 : overrideProps.storeDomain) ?? shopifyConfig.storeDomain;
|
|
939
965
|
return domain.includes("://") ? domain : `https://${domain}`;
|
|
940
966
|
}
|
|
941
967
|
return {
|
|
942
968
|
...shopifyConfig,
|
|
969
|
+
sameDomainForStorefrontApi,
|
|
943
970
|
getPublicTokenHeaders(overrideProps) {
|
|
944
971
|
return getPublicTokenHeadersRaw(
|
|
945
972
|
overrideProps.contentType,
|
|
@@ -949,7 +976,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
949
976
|
},
|
|
950
977
|
getShopifyDomain,
|
|
951
978
|
getStorefrontApiUrl(overrideProps) {
|
|
952
|
-
const finalDomainUrl = getShopifyDomain({
|
|
979
|
+
const finalDomainUrl = sameDomainForStorefrontApi && typeof window !== "undefined" ? window.location.origin : getShopifyDomain({
|
|
953
980
|
storeDomain: (overrideProps == null ? void 0 : overrideProps.storeDomain) ?? shopifyConfig.storeDomain
|
|
954
981
|
});
|
|
955
982
|
return `${finalDomainUrl}${finalDomainUrl.endsWith("/") ? "" : "/"}api/${(overrideProps == null ? void 0 : overrideProps.storefrontApiVersion) ?? shopifyConfig.storefrontApiVersion}/graphql.json`;
|
|
@@ -971,77 +998,94 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
971
998
|
const SHOPIFY_STOREFRONT_S_HEADER = "Shopify-Storefront-S";
|
|
972
999
|
const SHOPIFY_Y = "_shopify_y";
|
|
973
1000
|
const SHOPIFY_S = "_shopify_s";
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
"
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
1001
|
+
const SHOPIFY_VISIT_TOKEN_HEADER = "X-Shopify-VisitToken";
|
|
1002
|
+
const SHOPIFY_UNIQUE_TOKEN_HEADER = "X-Shopify-UniqueToken";
|
|
1003
|
+
const cachedTrackingValues = { current: null };
|
|
1004
|
+
function getTrackingValues(cookieString) {
|
|
1005
|
+
var _a, _b, _c;
|
|
1006
|
+
let trackingValues;
|
|
1007
|
+
if (typeof window !== "undefined" && typeof window.performance !== "undefined") {
|
|
1008
|
+
try {
|
|
1009
|
+
const resourceRE = /^https?:\/\/([^/]+)(\/api\/(?:unstable|2\d{3}-\d{2})\/graphql\.json(?=$|\?))?/;
|
|
1010
|
+
const entries = performance.getEntriesByType(
|
|
1011
|
+
"resource"
|
|
1012
|
+
);
|
|
1013
|
+
let matchedValues;
|
|
1014
|
+
for (let i2 = entries.length - 1; i2 >= 0; i2--) {
|
|
1015
|
+
const entry = entries[i2];
|
|
1016
|
+
if (entry.initiatorType !== "fetch") continue;
|
|
1017
|
+
const currentHost = window.location.host;
|
|
1018
|
+
const match = entry.name.match(resourceRE);
|
|
1019
|
+
if (!match) continue;
|
|
1020
|
+
const [, matchedHost, sfapiPath] = match;
|
|
1021
|
+
const isMatch = (
|
|
1022
|
+
// Same origin (exact host match)
|
|
1023
|
+
matchedHost === currentHost || // Subdomain with SFAPI path
|
|
1024
|
+
sfapiPath && (matchedHost == null ? void 0 : matchedHost.endsWith(`.${currentHost}`))
|
|
1025
|
+
);
|
|
1026
|
+
if (isMatch) {
|
|
1027
|
+
const values = extractFromPerformanceEntry(entry);
|
|
1028
|
+
if (values) {
|
|
1029
|
+
matchedValues = values;
|
|
1030
|
+
break;
|
|
1031
|
+
}
|
|
991
1032
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
hash = tokenHash.replace(/[x]/g, (c2) => {
|
|
1010
|
-
const r2 = randomValuesArray[i2] % 16;
|
|
1011
|
-
const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
|
|
1012
|
-
i2++;
|
|
1013
|
-
return v2.toString(16);
|
|
1014
|
-
}).toUpperCase();
|
|
1015
|
-
} catch (err) {
|
|
1016
|
-
hash = tokenHash.replace(/[x]/g, (c2) => {
|
|
1017
|
-
const r2 = Math.random() * 16 | 0;
|
|
1018
|
-
const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
|
|
1019
|
-
return v2.toString(16);
|
|
1020
|
-
}).toUpperCase();
|
|
1033
|
+
}
|
|
1034
|
+
if (matchedValues) {
|
|
1035
|
+
trackingValues = matchedValues;
|
|
1036
|
+
}
|
|
1037
|
+
if (trackingValues) {
|
|
1038
|
+
cachedTrackingValues.current = trackingValues;
|
|
1039
|
+
} else if (cachedTrackingValues.current) {
|
|
1040
|
+
trackingValues = cachedTrackingValues.current;
|
|
1041
|
+
}
|
|
1042
|
+
if (!trackingValues) {
|
|
1043
|
+
const navigationEntries = performance.getEntriesByType(
|
|
1044
|
+
"navigation"
|
|
1045
|
+
)[0];
|
|
1046
|
+
trackingValues = extractFromPerformanceEntry(navigationEntries, false);
|
|
1047
|
+
}
|
|
1048
|
+
} catch {
|
|
1049
|
+
}
|
|
1021
1050
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
perfNumber = performance.now() >>> 0;
|
|
1030
|
-
} catch (err) {
|
|
1031
|
-
perfNumber = 0;
|
|
1051
|
+
if (!trackingValues) {
|
|
1052
|
+
const cookie = typeof cookieString === "string" ? cookieString : typeof document !== "undefined" ? document.cookie : "";
|
|
1053
|
+
trackingValues = {
|
|
1054
|
+
uniqueToken: ((_a = cookie.match(/\b_shopify_y=([^;]+)/)) == null ? void 0 : _a[1]) || "",
|
|
1055
|
+
visitToken: ((_b = cookie.match(/\b_shopify_s=([^;]+)/)) == null ? void 0 : _b[1]) || "",
|
|
1056
|
+
consent: ((_c = cookie.match(/\b_tracking_consent=([^;]+)/)) == null ? void 0 : _c[1]) || ""
|
|
1057
|
+
};
|
|
1032
1058
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1059
|
+
return trackingValues;
|
|
1060
|
+
}
|
|
1061
|
+
function extractFromPerformanceEntry(entry, isConsentRequired = true) {
|
|
1062
|
+
let uniqueToken = "";
|
|
1063
|
+
let visitToken = "";
|
|
1064
|
+
let consent = "";
|
|
1065
|
+
const serverTiming = entry.serverTiming;
|
|
1066
|
+
if (serverTiming && serverTiming.length >= 3) {
|
|
1067
|
+
for (let i2 = serverTiming.length - 1; i2 >= 0; i2--) {
|
|
1068
|
+
const { name, description } = serverTiming[i2];
|
|
1069
|
+
if (!name || !description) continue;
|
|
1070
|
+
if (name === "_y") {
|
|
1071
|
+
uniqueToken = description;
|
|
1072
|
+
} else if (name === "_s") {
|
|
1073
|
+
visitToken = description;
|
|
1074
|
+
} else if (name === "_cmp") {
|
|
1075
|
+
consent = description;
|
|
1076
|
+
}
|
|
1077
|
+
if (uniqueToken && visitToken && consent) break;
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
return uniqueToken && visitToken && (isConsentRequired ? consent : true) ? { uniqueToken, visitToken, consent } : void 0;
|
|
1042
1081
|
}
|
|
1043
1082
|
function useCartFetch() {
|
|
1044
|
-
const {
|
|
1083
|
+
const {
|
|
1084
|
+
storefrontId,
|
|
1085
|
+
getPublicTokenHeaders,
|
|
1086
|
+
getStorefrontApiUrl,
|
|
1087
|
+
sameDomainForStorefrontApi
|
|
1088
|
+
} = useShop();
|
|
1045
1089
|
return React$1.useCallback(
|
|
1046
1090
|
({
|
|
1047
1091
|
query,
|
|
@@ -1051,9 +1095,17 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1051
1095
|
if (storefrontId) {
|
|
1052
1096
|
headers[SHOPIFY_STOREFRONT_ID_HEADER] = storefrontId;
|
|
1053
1097
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1098
|
+
if (!sameDomainForStorefrontApi) {
|
|
1099
|
+
const { uniqueToken, visitToken } = getTrackingValues();
|
|
1100
|
+
if (uniqueToken) {
|
|
1101
|
+
headers[SHOPIFY_STOREFRONT_Y_HEADER] = uniqueToken;
|
|
1102
|
+
headers[SHOPIFY_UNIQUE_TOKEN_HEADER] = uniqueToken;
|
|
1103
|
+
}
|
|
1104
|
+
if (visitToken) {
|
|
1105
|
+
headers[SHOPIFY_STOREFRONT_S_HEADER] = visitToken;
|
|
1106
|
+
headers[SHOPIFY_VISIT_TOKEN_HEADER] = visitToken;
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1057
1109
|
return fetch(getStorefrontApiUrl(), {
|
|
1058
1110
|
method: "POST",
|
|
1059
1111
|
headers,
|
|
@@ -1071,7 +1123,12 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1071
1123
|
};
|
|
1072
1124
|
});
|
|
1073
1125
|
},
|
|
1074
|
-
[
|
|
1126
|
+
[
|
|
1127
|
+
getPublicTokenHeaders,
|
|
1128
|
+
storefrontId,
|
|
1129
|
+
getStorefrontApiUrl,
|
|
1130
|
+
sameDomainForStorefrontApi
|
|
1131
|
+
]
|
|
1075
1132
|
);
|
|
1076
1133
|
}
|
|
1077
1134
|
function useCartActions({
|
|
@@ -1414,8 +1471,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1414
1471
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1415
1472
|
cartFetchAction: async (_, event) => {
|
|
1416
1473
|
var _a;
|
|
1417
|
-
if (event.type !== "CART_FETCH")
|
|
1418
|
-
return;
|
|
1474
|
+
if (event.type !== "CART_FETCH") return;
|
|
1419
1475
|
const { data, errors } = await cartFetch((_a = event == null ? void 0 : event.payload) == null ? void 0 : _a.cartId);
|
|
1420
1476
|
const resultEvent = eventFromFetchResult(event, data == null ? void 0 : data.cart, errors);
|
|
1421
1477
|
send(resultEvent);
|
|
@@ -1423,8 +1479,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1423
1479
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1424
1480
|
cartCreateAction: async (_, event) => {
|
|
1425
1481
|
var _a;
|
|
1426
|
-
if (event.type !== "CART_CREATE")
|
|
1427
|
-
return;
|
|
1482
|
+
if (event.type !== "CART_CREATE") return;
|
|
1428
1483
|
const { data, errors } = await cartCreate(event == null ? void 0 : event.payload);
|
|
1429
1484
|
const resultEvent = eventFromFetchResult(
|
|
1430
1485
|
event,
|
|
@@ -1436,8 +1491,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1436
1491
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1437
1492
|
cartLineAddAction: async (context, event) => {
|
|
1438
1493
|
var _a, _b;
|
|
1439
|
-
if (event.type !== "CARTLINE_ADD" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id))
|
|
1440
|
-
return;
|
|
1494
|
+
if (event.type !== "CARTLINE_ADD" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id)) return;
|
|
1441
1495
|
const { data, errors } = await cartLineAdd(
|
|
1442
1496
|
context.cart.id,
|
|
1443
1497
|
event.payload.lines
|
|
@@ -1452,8 +1506,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1452
1506
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1453
1507
|
cartLineUpdateAction: async (context, event) => {
|
|
1454
1508
|
var _a, _b;
|
|
1455
|
-
if (event.type !== "CARTLINE_UPDATE" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id))
|
|
1456
|
-
return;
|
|
1509
|
+
if (event.type !== "CARTLINE_UPDATE" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id)) return;
|
|
1457
1510
|
const { data, errors } = await cartLineUpdate(
|
|
1458
1511
|
context.cart.id,
|
|
1459
1512
|
event.payload.lines
|
|
@@ -1468,8 +1521,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1468
1521
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1469
1522
|
cartLineRemoveAction: async (context, event) => {
|
|
1470
1523
|
var _a, _b;
|
|
1471
|
-
if (event.type !== "CARTLINE_REMOVE" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id))
|
|
1472
|
-
return;
|
|
1524
|
+
if (event.type !== "CARTLINE_REMOVE" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id)) return;
|
|
1473
1525
|
const { data, errors } = await cartLineRemove(
|
|
1474
1526
|
context.cart.id,
|
|
1475
1527
|
event.payload.lines
|
|
@@ -1484,8 +1536,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1484
1536
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
1485
1537
|
noteUpdateAction: async (context, event) => {
|
|
1486
1538
|
var _a, _b;
|
|
1487
|
-
if (event.type !== "NOTE_UPDATE" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id))
|
|
1488
|
-
return;
|
|
1539
|
+
if (event.type !== "NOTE_UPDATE" || !((_a = context == null ? void 0 : context.cart) == null ? void 0 : _a.id)) return;
|
|
1489
1540
|
const { data, errors } = await noteUpdate(
|
|
1490
1541
|
context.cart.id,
|
|
1491
1542
|
event.payload.note
|
|
@@ -1643,8 +1694,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1643
1694
|
);
|
|
1644
1695
|
countryCode = (countryCode ?? shop.countryIsoCode ?? "US").toUpperCase();
|
|
1645
1696
|
languageCode = (languageCode ?? shop.languageIsoCode ?? "EN").toUpperCase();
|
|
1646
|
-
if (countryCode)
|
|
1647
|
-
countryCode = countryCode.toUpperCase();
|
|
1697
|
+
if (countryCode) countryCode = countryCode.toUpperCase();
|
|
1648
1698
|
const [prevCountryCode, setPrevCountryCode] = React$1.useState(countryCode);
|
|
1649
1699
|
const [prevCustomerAccessToken, setPrevCustomerAccessToken] = React$1.useState(customerAccessToken);
|
|
1650
1700
|
const customerOverridesCountryCode = React$1.useRef(false);
|
|
@@ -1685,8 +1735,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1685
1735
|
},
|
|
1686
1736
|
onCartActionOptimisticUI(context, event) {
|
|
1687
1737
|
var _a2, _b2, _c2, _d2;
|
|
1688
|
-
if (!context.cart)
|
|
1689
|
-
return { ...context };
|
|
1738
|
+
if (!context.cart) return { ...context };
|
|
1690
1739
|
switch (event.type) {
|
|
1691
1740
|
case "CARTLINE_REMOVE":
|
|
1692
1741
|
return {
|
|
@@ -1776,8 +1825,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
1776
1825
|
}
|
|
1777
1826
|
}, [cart, cartReady, cartSend]);
|
|
1778
1827
|
React$1.useEffect(() => {
|
|
1779
|
-
if (!countryChanged || customerOverridesCountryCode.current)
|
|
1780
|
-
return;
|
|
1828
|
+
if (!countryChanged || customerOverridesCountryCode.current) return;
|
|
1781
1829
|
cartSend({
|
|
1782
1830
|
type: "BUYER_IDENTITY_UPDATE",
|
|
1783
1831
|
payload: { buyerIdentity: { countryCode, customerAccessToken } }
|
|
@@ -2120,17 +2168,20 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
2120
2168
|
});
|
|
2121
2169
|
}
|
|
2122
2170
|
function getOptions(variants) {
|
|
2123
|
-
const map = variants.reduce(
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2171
|
+
const map = variants.reduce(
|
|
2172
|
+
(memo, variant) => {
|
|
2173
|
+
var _a;
|
|
2174
|
+
if (!variant.selectedOptions) {
|
|
2175
|
+
throw new Error(`'getOptions' requires 'variant.selectedOptions'`);
|
|
2176
|
+
}
|
|
2177
|
+
(_a = variant == null ? void 0 : variant.selectedOptions) == null ? void 0 : _a.forEach((opt) => {
|
|
2178
|
+
memo[(opt == null ? void 0 : opt.name) ?? ""] = memo[(opt == null ? void 0 : opt.name) ?? ""] || /* @__PURE__ */ new Set();
|
|
2179
|
+
memo[(opt == null ? void 0 : opt.name) ?? ""].add((opt == null ? void 0 : opt.value) ?? "");
|
|
2180
|
+
});
|
|
2181
|
+
return memo;
|
|
2182
|
+
},
|
|
2183
|
+
{}
|
|
2184
|
+
);
|
|
2134
2185
|
return Object.keys(map).map((option) => {
|
|
2135
2186
|
return {
|
|
2136
2187
|
name: option,
|
|
@@ -2354,6 +2405,48 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
2354
2405
|
}
|
|
2355
2406
|
return false;
|
|
2356
2407
|
}
|
|
2408
|
+
const tokenHash = "xxxx-4xxx-xxxx-xxxxxxxxxxxx";
|
|
2409
|
+
function buildUUID() {
|
|
2410
|
+
let hash = "";
|
|
2411
|
+
try {
|
|
2412
|
+
const crypto = window.crypto;
|
|
2413
|
+
const randomValuesArray = new Uint16Array(31);
|
|
2414
|
+
crypto.getRandomValues(randomValuesArray);
|
|
2415
|
+
let i2 = 0;
|
|
2416
|
+
hash = tokenHash.replace(/[x]/g, (c2) => {
|
|
2417
|
+
const r2 = randomValuesArray[i2] % 16;
|
|
2418
|
+
const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
|
|
2419
|
+
i2++;
|
|
2420
|
+
return v2.toString(16);
|
|
2421
|
+
}).toUpperCase();
|
|
2422
|
+
} catch (err) {
|
|
2423
|
+
hash = tokenHash.replace(/[x]/g, (c2) => {
|
|
2424
|
+
const r2 = Math.random() * 16 | 0;
|
|
2425
|
+
const v2 = c2 === "x" ? r2 : r2 & 3 | 8;
|
|
2426
|
+
return v2.toString(16);
|
|
2427
|
+
}).toUpperCase();
|
|
2428
|
+
}
|
|
2429
|
+
return `${hexTime()}-${hash}`;
|
|
2430
|
+
}
|
|
2431
|
+
function hexTime() {
|
|
2432
|
+
let dateNumber = 0;
|
|
2433
|
+
let perfNumber = 0;
|
|
2434
|
+
dateNumber = (/* @__PURE__ */ new Date()).getTime() >>> 0;
|
|
2435
|
+
try {
|
|
2436
|
+
perfNumber = performance.now() >>> 0;
|
|
2437
|
+
} catch (err) {
|
|
2438
|
+
perfNumber = 0;
|
|
2439
|
+
}
|
|
2440
|
+
const output = Math.abs(dateNumber + perfNumber).toString(16).toLowerCase();
|
|
2441
|
+
return output.padStart(8, "0");
|
|
2442
|
+
}
|
|
2443
|
+
function getShopifyCookies(cookies) {
|
|
2444
|
+
const trackingValues = getTrackingValues(cookies);
|
|
2445
|
+
return {
|
|
2446
|
+
[SHOPIFY_Y]: trackingValues.uniqueToken,
|
|
2447
|
+
[SHOPIFY_S]: trackingValues.visitToken
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2357
2450
|
const SCHEMA_ID$1 = "trekkie_storefront_page_view/1.4";
|
|
2358
2451
|
const OXYGEN_DOMAIN = "myshopify.dev";
|
|
2359
2452
|
function pageView$1(payload) {
|
|
@@ -2405,7 +2498,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
2405
2498
|
}
|
|
2406
2499
|
return false;
|
|
2407
2500
|
}
|
|
2408
|
-
const version = "2025.1.
|
|
2501
|
+
const version = "2025.1.4";
|
|
2409
2502
|
const SCHEMA_ID = "custom_storefront_customer_tracking/1.2";
|
|
2410
2503
|
const PAGE_RENDERED_EVENT_NAME = "page_rendered";
|
|
2411
2504
|
const COLLECTION_PAGE_RENDERED_EVENT_NAME = "collection_page_rendered";
|
|
@@ -2628,8 +2721,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
2628
2721
|
}
|
|
2629
2722
|
function sendShopifyAnalytics(event, shopDomain) {
|
|
2630
2723
|
const { eventName, payload } = event;
|
|
2631
|
-
if (!payload.hasUserConsent)
|
|
2632
|
-
return Promise.resolve();
|
|
2724
|
+
if (!payload.hasUserConsent) return Promise.resolve();
|
|
2633
2725
|
let events = [];
|
|
2634
2726
|
const pageViewPayload = payload;
|
|
2635
2727
|
if (eventName === AnalyticsEventName.PAGE_VIEW) {
|
|
@@ -2660,8 +2752,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
2660
2752
|
}
|
|
2661
2753
|
}
|
|
2662
2754
|
function isLighthouseUserAgent() {
|
|
2663
|
-
if (typeof window === "undefined" || !window.navigator)
|
|
2664
|
-
return false;
|
|
2755
|
+
if (typeof window === "undefined" || !window.navigator) return false;
|
|
2665
2756
|
return /Chrome-Lighthouse/.test(window.navigator.userAgent);
|
|
2666
2757
|
}
|
|
2667
2758
|
const ERROR_MESSAGE = "sendShopifyAnalytics request is unsuccessful";
|
|
@@ -2725,10 +2816,10 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
2725
2816
|
};
|
|
2726
2817
|
}
|
|
2727
2818
|
const [navigationType, navigationApi] = getNavigationType();
|
|
2728
|
-
const
|
|
2819
|
+
const trackingValues = getTrackingValues();
|
|
2729
2820
|
return {
|
|
2730
|
-
uniqueToken:
|
|
2731
|
-
visitToken:
|
|
2821
|
+
uniqueToken: trackingValues.uniqueToken,
|
|
2822
|
+
visitToken: trackingValues.visitToken,
|
|
2732
2823
|
url: location.href,
|
|
2733
2824
|
path: location.pathname,
|
|
2734
2825
|
search: location.search,
|
|
@@ -3157,8 +3248,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
3157
3248
|
};
|
|
3158
3249
|
})();
|
|
3159
3250
|
function decodeEncodedVariant(encodedVariantField) {
|
|
3160
|
-
if (!encodedVariantField)
|
|
3161
|
-
return [];
|
|
3251
|
+
if (!encodedVariantField) return [];
|
|
3162
3252
|
if (encodedVariantField.startsWith("v1_")) {
|
|
3163
3253
|
return v1Decoder(stripVersion(encodedVariantField));
|
|
3164
3254
|
}
|
|
@@ -3357,8 +3447,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
3357
3447
|
}
|
|
3358
3448
|
function getAdjacentAndFirstAvailableVariants(product) {
|
|
3359
3449
|
const checkedProduct = checkProductParam(product);
|
|
3360
|
-
if (!checkedProduct.options)
|
|
3361
|
-
return [];
|
|
3450
|
+
if (!checkedProduct.options) return [];
|
|
3362
3451
|
const availableVariants = {};
|
|
3363
3452
|
checkedProduct.options.map((option) => {
|
|
3364
3453
|
var _a;
|
|
@@ -3388,8 +3477,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
3388
3477
|
}
|
|
3389
3478
|
function getProductOptions(product) {
|
|
3390
3479
|
const checkedProduct = checkProductParam(product, true);
|
|
3391
|
-
if (!checkedProduct.options)
|
|
3392
|
-
return [];
|
|
3480
|
+
if (!checkedProduct.options) return [];
|
|
3393
3481
|
const {
|
|
3394
3482
|
options,
|
|
3395
3483
|
selectedOrFirstAvailableVariant: selectedVariant,
|
|
@@ -3790,14 +3878,12 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
3790
3878
|
return isFixedWidth(width) ? fixed : responsive;
|
|
3791
3879
|
}
|
|
3792
3880
|
function parseAspectRatio(aspectRatio) {
|
|
3793
|
-
if (!aspectRatio)
|
|
3794
|
-
return;
|
|
3881
|
+
if (!aspectRatio) return;
|
|
3795
3882
|
const [width, height] = aspectRatio.split("/");
|
|
3796
3883
|
return 1 / (Number(width) / Number(height));
|
|
3797
3884
|
}
|
|
3798
3885
|
function generateSizes(imageWidths, aspectRatio, crop = "center", sourceDimensions) {
|
|
3799
|
-
if (!imageWidths)
|
|
3800
|
-
return;
|
|
3886
|
+
if (!imageWidths) return;
|
|
3801
3887
|
return imageWidths.map((width) => {
|
|
3802
3888
|
return {
|
|
3803
3889
|
width,
|
|
@@ -4129,6 +4215,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4129
4215
|
...metafield,
|
|
4130
4216
|
parsedValue: metafield.value
|
|
4131
4217
|
};
|
|
4218
|
+
// TODO: 'money' should probably be parsed even further to like `useMoney()`, but that logic needs to be extracted first so it's not a hook
|
|
4132
4219
|
case "dimension":
|
|
4133
4220
|
case "money":
|
|
4134
4221
|
case "json":
|
|
@@ -4199,8 +4286,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4199
4286
|
function parseJSON(json) {
|
|
4200
4287
|
if (String(json).includes("__proto__")) {
|
|
4201
4288
|
return JSON.parse(json, (k, v2) => {
|
|
4202
|
-
if (k !== "__proto__")
|
|
4203
|
-
return v2;
|
|
4289
|
+
if (k !== "__proto__") return v2;
|
|
4204
4290
|
});
|
|
4205
4291
|
}
|
|
4206
4292
|
return JSON.parse(json);
|
|
@@ -4291,10 +4377,8 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4291
4377
|
}) {
|
|
4292
4378
|
if (node.bold && node.italic)
|
|
4293
4379
|
return /* @__PURE__ */ React.createElement("em", null, /* @__PURE__ */ React.createElement("strong", null, node.value));
|
|
4294
|
-
if (node.bold)
|
|
4295
|
-
|
|
4296
|
-
if (node.italic)
|
|
4297
|
-
return /* @__PURE__ */ React.createElement("em", null, node.value);
|
|
4380
|
+
if (node.bold) return /* @__PURE__ */ React.createElement("strong", null, node.value);
|
|
4381
|
+
if (node.italic) return /* @__PURE__ */ React.createElement("em", null, node.value);
|
|
4298
4382
|
return node.value;
|
|
4299
4383
|
}
|
|
4300
4384
|
function RichTextLink({
|
|
@@ -4562,17 +4646,29 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4562
4646
|
}, [JSON.stringify(selectedOptions)]);
|
|
4563
4647
|
return null;
|
|
4564
4648
|
}
|
|
4649
|
+
function l(a2, r2, e2 = {}) {
|
|
4650
|
+
let t2 = a2 + "=" + encodeURIComponent(r2);
|
|
4651
|
+
return e2.expires && (t2 += "; Expires=" + new Date(e2.expires).toUTCString()), e2.maxage != null && e2.maxage >= 0 && (t2 += "; Max-Age=" + (e2.maxage | 0)), e2.domain && (t2 += "; Domain=" + e2.domain), e2.path && (t2 += "; Path=" + e2.path), e2.samesite && (t2 += "; SameSite=" + e2.samesite), (e2.secure || e2.samesite === "None") && (t2 += "; Secure"), e2.httponly && (t2 += "; HttpOnly"), t2;
|
|
4652
|
+
}
|
|
4565
4653
|
const longTermLength = 60 * 60 * 24 * 360 * 1;
|
|
4566
4654
|
const shortTermLength = 60 * 30;
|
|
4567
4655
|
function useShopifyCookies(options) {
|
|
4568
4656
|
const {
|
|
4569
|
-
hasUserConsent
|
|
4657
|
+
hasUserConsent,
|
|
4570
4658
|
domain = "",
|
|
4571
|
-
checkoutDomain = ""
|
|
4659
|
+
checkoutDomain = "",
|
|
4660
|
+
storefrontAccessToken,
|
|
4661
|
+
fetchTrackingValues,
|
|
4662
|
+
ignoreDeprecatedCookies = false
|
|
4572
4663
|
} = options || {};
|
|
4664
|
+
const coreCookiesReady = useCoreShopifyCookies({
|
|
4665
|
+
storefrontAccessToken,
|
|
4666
|
+
fetchTrackingValues,
|
|
4667
|
+
checkoutDomain
|
|
4668
|
+
});
|
|
4573
4669
|
React$1.useEffect(() => {
|
|
4574
|
-
|
|
4575
|
-
let currentDomain = domain || window.
|
|
4670
|
+
if (ignoreDeprecatedCookies || !coreCookiesReady) return;
|
|
4671
|
+
let currentDomain = domain || window.location.host;
|
|
4576
4672
|
if (checkoutDomain) {
|
|
4577
4673
|
const checkoutDomainParts = checkoutDomain.split(".").reverse();
|
|
4578
4674
|
const currentDomainParts = currentDomain.split(".").reverse();
|
|
@@ -4584,19 +4680,22 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4584
4680
|
});
|
|
4585
4681
|
currentDomain = sameDomainParts.reverse().join(".");
|
|
4586
4682
|
}
|
|
4587
|
-
if (/^localhost/.test(currentDomain))
|
|
4588
|
-
currentDomain = "";
|
|
4683
|
+
if (/^localhost/.test(currentDomain)) currentDomain = "";
|
|
4589
4684
|
const domainWithLeadingDot = currentDomain ? /^\./.test(currentDomain) ? currentDomain : `.${currentDomain}` : "";
|
|
4590
4685
|
if (hasUserConsent) {
|
|
4686
|
+
const trackingValues = getTrackingValues();
|
|
4687
|
+
if ((trackingValues.uniqueToken || trackingValues.visitToken || "").startsWith("00000000-")) {
|
|
4688
|
+
return;
|
|
4689
|
+
}
|
|
4591
4690
|
setCookie(
|
|
4592
4691
|
SHOPIFY_Y,
|
|
4593
|
-
|
|
4692
|
+
trackingValues.uniqueToken || buildUUID(),
|
|
4594
4693
|
longTermLength,
|
|
4595
4694
|
domainWithLeadingDot
|
|
4596
4695
|
);
|
|
4597
4696
|
setCookie(
|
|
4598
4697
|
SHOPIFY_S,
|
|
4599
|
-
|
|
4698
|
+
trackingValues.visitToken || buildUUID(),
|
|
4600
4699
|
shortTermLength,
|
|
4601
4700
|
domainWithLeadingDot
|
|
4602
4701
|
);
|
|
@@ -4604,7 +4703,14 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4604
4703
|
setCookie(SHOPIFY_Y, "", 0, domainWithLeadingDot);
|
|
4605
4704
|
setCookie(SHOPIFY_S, "", 0, domainWithLeadingDot);
|
|
4606
4705
|
}
|
|
4607
|
-
}, [
|
|
4706
|
+
}, [
|
|
4707
|
+
coreCookiesReady,
|
|
4708
|
+
hasUserConsent,
|
|
4709
|
+
domain,
|
|
4710
|
+
checkoutDomain,
|
|
4711
|
+
ignoreDeprecatedCookies
|
|
4712
|
+
]);
|
|
4713
|
+
return coreCookiesReady;
|
|
4608
4714
|
}
|
|
4609
4715
|
function setCookie(name, value, maxage, domain) {
|
|
4610
4716
|
document.cookie = l(name, value, {
|
|
@@ -4614,6 +4720,73 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4614
4720
|
path: "/"
|
|
4615
4721
|
});
|
|
4616
4722
|
}
|
|
4723
|
+
async function fetchTrackingValuesFromBrowser(storefrontAccessToken, storefrontApiDomain = "") {
|
|
4724
|
+
const { uniqueToken, visitToken } = getTrackingValues();
|
|
4725
|
+
const response = await fetch(
|
|
4726
|
+
// TODO: update this endpoint when it becomes stable
|
|
4727
|
+
`${storefrontApiDomain.replace(/\/+$/, "")}/api/unstable/graphql.json`,
|
|
4728
|
+
{
|
|
4729
|
+
method: "POST",
|
|
4730
|
+
headers: {
|
|
4731
|
+
"Content-Type": "application/json",
|
|
4732
|
+
...storefrontAccessToken && {
|
|
4733
|
+
"X-Shopify-Storefront-Access-Token": storefrontAccessToken
|
|
4734
|
+
},
|
|
4735
|
+
...visitToken || uniqueToken ? {
|
|
4736
|
+
[SHOPIFY_VISIT_TOKEN_HEADER]: visitToken,
|
|
4737
|
+
[SHOPIFY_UNIQUE_TOKEN_HEADER]: uniqueToken
|
|
4738
|
+
} : void 0
|
|
4739
|
+
},
|
|
4740
|
+
body: JSON.stringify({
|
|
4741
|
+
query: (
|
|
4742
|
+
// This query ensures we get _cmp (consent) server-timing header, which is not available in other queries.
|
|
4743
|
+
// This value can be passed later to consent-tracking-api and privacy-banner scripts to avoid extra requests.
|
|
4744
|
+
"query ensureCookies { consentManagement { cookies(visitorConsent:{}) { cookieDomain } } }"
|
|
4745
|
+
)
|
|
4746
|
+
})
|
|
4747
|
+
}
|
|
4748
|
+
);
|
|
4749
|
+
if (!response.ok) {
|
|
4750
|
+
throw new Error(
|
|
4751
|
+
`Failed to fetch consent from browser: ${response.status} ${response.statusText}`
|
|
4752
|
+
);
|
|
4753
|
+
}
|
|
4754
|
+
await response.json();
|
|
4755
|
+
getTrackingValues();
|
|
4756
|
+
}
|
|
4757
|
+
function useCoreShopifyCookies({
|
|
4758
|
+
checkoutDomain,
|
|
4759
|
+
storefrontAccessToken,
|
|
4760
|
+
fetchTrackingValues = false
|
|
4761
|
+
}) {
|
|
4762
|
+
const [cookiesReady, setCookiesReady] = React$1.useState(!fetchTrackingValues);
|
|
4763
|
+
const hasFetchedTrackingValues = React$1.useRef(false);
|
|
4764
|
+
React$1.useEffect(() => {
|
|
4765
|
+
if (!fetchTrackingValues) {
|
|
4766
|
+
setCookiesReady(true);
|
|
4767
|
+
return;
|
|
4768
|
+
}
|
|
4769
|
+
if (hasFetchedTrackingValues.current) return;
|
|
4770
|
+
hasFetchedTrackingValues.current = true;
|
|
4771
|
+
fetchTrackingValuesFromBrowser(storefrontAccessToken).catch(
|
|
4772
|
+
(error) => checkoutDomain ? (
|
|
4773
|
+
// Retry with checkout domain if available to at least
|
|
4774
|
+
// get the server-timing values for tracking.
|
|
4775
|
+
fetchTrackingValuesFromBrowser(
|
|
4776
|
+
storefrontAccessToken,
|
|
4777
|
+
checkoutDomain
|
|
4778
|
+
)
|
|
4779
|
+
) : Promise.reject(error)
|
|
4780
|
+
).catch((error) => {
|
|
4781
|
+
console.warn(
|
|
4782
|
+
"[h2:warn:useShopifyCookies] Failed to fetch tracking values from browser: " + (error instanceof Error ? error.message : String(error))
|
|
4783
|
+
);
|
|
4784
|
+
}).finally(() => {
|
|
4785
|
+
setCookiesReady(true);
|
|
4786
|
+
});
|
|
4787
|
+
}, [checkoutDomain, fetchTrackingValues, storefrontAccessToken]);
|
|
4788
|
+
return cookiesReady;
|
|
4789
|
+
}
|
|
4617
4790
|
exports2.AddToCartButton = AddToCartButton;
|
|
4618
4791
|
exports2.AnalyticsEventName = AnalyticsEventName;
|
|
4619
4792
|
exports2.AnalyticsPageType = AnalyticsPageType;
|
|
@@ -4637,6 +4810,8 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4637
4810
|
exports2.SHOPIFY_STOREFRONT_ID_HEADER = SHOPIFY_STOREFRONT_ID_HEADER;
|
|
4638
4811
|
exports2.SHOPIFY_STOREFRONT_S_HEADER = SHOPIFY_STOREFRONT_S_HEADER;
|
|
4639
4812
|
exports2.SHOPIFY_STOREFRONT_Y_HEADER = SHOPIFY_STOREFRONT_Y_HEADER;
|
|
4813
|
+
exports2.SHOPIFY_UNIQUE_TOKEN_HEADER = SHOPIFY_UNIQUE_TOKEN_HEADER;
|
|
4814
|
+
exports2.SHOPIFY_VISIT_TOKEN_HEADER = SHOPIFY_VISIT_TOKEN_HEADER;
|
|
4640
4815
|
exports2.SHOPIFY_Y = SHOPIFY_Y;
|
|
4641
4816
|
exports2.ShopPayButton = ShopPayButton;
|
|
4642
4817
|
exports2.ShopifyProvider = ShopifyProvider;
|
|
@@ -4650,6 +4825,7 @@ Refer to the authentication https://shopify.dev/api/storefront#authentication do
|
|
|
4650
4825
|
exports2.getClientBrowserParameters = getClientBrowserParameters;
|
|
4651
4826
|
exports2.getProductOptions = getProductOptions;
|
|
4652
4827
|
exports2.getShopifyCookies = getShopifyCookies;
|
|
4828
|
+
exports2.getTrackingValues = getTrackingValues;
|
|
4653
4829
|
exports2.isOptionValueCombinationInEncodedVariant = isOptionValueCombinationInEncodedVariant;
|
|
4654
4830
|
exports2.mapSelectedProductOptionToObject = mapSelectedProductOptionToObject;
|
|
4655
4831
|
exports2.parseGid = parseGid;
|