@shopify/hydrogen 2026.10.0-preview.4 → 2026.10.0
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/cli/index.mjs +23 -12
- package/dist/client/client.d.mts +18 -15
- package/dist/client/client.mjs +8 -3
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/errors.d.mts +35 -13
- package/dist/client/errors.mjs +23 -13
- package/dist/client/errors.mjs.map +1 -1
- package/dist/client/types.d.mts +140 -90
- package/dist/core/analytics/cart-tracker.d.mts +19 -10
- package/dist/core/analytics/cart-tracker.mjs +18 -10
- package/dist/core/analytics/cart-tracker.mjs.map +1 -1
- package/dist/core/analytics/events.d.mts +17 -11
- package/dist/core/analytics/events.mjs +13 -4
- package/dist/core/analytics/events.mjs.map +1 -1
- package/dist/core/analytics/types.d.mts +207 -118
- package/dist/core/analytics/utils/flatten-connection.d.mts +11 -9
- package/dist/core/analytics/utils/flatten-connection.mjs +7 -6
- package/dist/core/analytics/utils/flatten-connection.mjs.map +1 -1
- package/dist/core/cache/fetch-with-cache.d.mts +24 -4
- package/dist/core/cache/fetch-with-cache.mjs +17 -2
- package/dist/core/cache/fetch-with-cache.mjs.map +1 -1
- package/dist/core/cache/key.d.mts +2 -0
- package/dist/core/cache/key.mjs.map +1 -1
- package/dist/core/cache/run-with-cache.d.mts +56 -8
- package/dist/core/cache/run-with-cache.mjs +17 -6
- package/dist/core/cache/run-with-cache.mjs.map +1 -1
- package/dist/core/cache/store.d.mts +8 -6
- package/dist/core/cache/store.mjs.map +1 -1
- package/dist/core/cache/strategies.d.mts +27 -2
- package/dist/core/cache/strategies.mjs +6 -0
- package/dist/core/cache/strategies.mjs.map +1 -1
- package/dist/core/cart/actions.d.mts +37 -30
- package/dist/core/cart/actions.mjs +21 -9
- package/dist/core/cart/actions.mjs.map +1 -1
- package/dist/core/cart/attach-quantity-input.d.mts +8 -7
- package/dist/core/cart/attach-quantity-input.mjs +8 -7
- package/dist/core/cart/attach-quantity-input.mjs.map +1 -1
- package/dist/core/cart/buyer-identity-sync.d.mts +7 -6
- package/dist/core/cart/buyer-identity-sync.mjs.map +1 -1
- package/dist/core/cart/cart.d.mts +59 -46
- package/dist/core/cart/cart.mjs +46 -29
- package/dist/core/cart/cart.mjs.map +1 -1
- package/dist/core/cart/cookie.d.mts +8 -4
- package/dist/core/cart/cookie.mjs +8 -4
- package/dist/core/cart/cookie.mjs.map +1 -1
- package/dist/core/cart/form.d.mts +34 -20
- package/dist/core/cart/form.mjs +6 -4
- package/dist/core/cart/form.mjs.map +1 -1
- package/dist/core/cart/get-cart.d.mts +27 -15
- package/dist/core/cart/get-cart.mjs +13 -8
- package/dist/core/cart/get-cart.mjs.map +1 -1
- package/dist/core/cart/quantity.d.mts +16 -5
- package/dist/core/cart/quantity.mjs +16 -5
- package/dist/core/cart/quantity.mjs.map +1 -1
- package/dist/core/cart/queries.d.mts +25 -19
- package/dist/core/cart/queries.mjs +15 -1
- package/dist/core/cart/queries.mjs.map +1 -1
- package/dist/core/cart/server-handlers.d.mts +82 -45
- package/dist/core/cart/server-handlers.mjs +4 -0
- package/dist/core/cart/server-handlers.mjs.map +1 -1
- package/dist/core/cart/state.d.mts +110 -64
- package/dist/core/cart/state.mjs +24 -6
- package/dist/core/cart/state.mjs.map +1 -1
- package/dist/core/collection/collection.d.mts +52 -53
- package/dist/core/collection/collection.mjs +5 -3
- package/dist/core/collection/collection.mjs.map +1 -1
- package/dist/core/collection/reconciler.d.mts +23 -16
- package/dist/core/collection/reconciler.mjs +8 -4
- package/dist/core/collection/reconciler.mjs.map +1 -1
- package/dist/core/collection/state.d.mts +31 -26
- package/dist/core/collection/state.mjs +4 -3
- package/dist/core/collection/state.mjs.map +1 -1
- package/dist/core/collection/url.d.mts +70 -29
- package/dist/core/collection/url.mjs +63 -25
- package/dist/core/collection/url.mjs.map +1 -1
- package/dist/core/constants.d.mts +1 -0
- package/dist/core/constants.mjs +1 -0
- package/dist/core/constants.mjs.map +1 -1
- package/dist/core/logging/logging.d.mts +14 -8
- package/dist/core/logging/logging.mjs +15 -10
- package/dist/core/logging/logging.mjs.map +1 -1
- package/dist/core/logging/types.d.mts +28 -11
- package/dist/core/logging/types.mjs.map +1 -1
- package/dist/core/money/format.d.mts +6 -4
- package/dist/core/money/format.mjs +19 -9
- package/dist/core/money/format.mjs.map +1 -1
- package/dist/core/money/types.d.mts +41 -25
- package/dist/core/predictive-search/form.d.mts +37 -7
- package/dist/core/predictive-search/form.mjs +21 -3
- package/dist/core/predictive-search/form.mjs.map +1 -1
- package/dist/core/predictive-search/queries.d.mts +18 -30
- package/dist/core/predictive-search/queries.mjs +7 -3
- package/dist/core/predictive-search/queries.mjs.map +1 -1
- package/dist/core/predictive-search/search.d.mts +25 -27
- package/dist/core/predictive-search/search.mjs +20 -19
- package/dist/core/predictive-search/search.mjs.map +1 -1
- package/dist/core/predictive-search/server-handlers.d.mts +25 -26
- package/dist/core/predictive-search/server-handlers.mjs +4 -0
- package/dist/core/predictive-search/server-handlers.mjs.map +1 -1
- package/dist/core/predictive-search/store.d.mts +65 -24
- package/dist/core/predictive-search/store.mjs +12 -1
- package/dist/core/predictive-search/store.mjs.map +1 -1
- package/dist/core/predictive-search/url.d.mts +36 -37
- package/dist/core/predictive-search/url.mjs +14 -6
- package/dist/core/predictive-search/url.mjs.map +1 -1
- package/dist/core/product/form.d.mts +63 -16
- package/dist/core/product/form.mjs +8 -2
- package/dist/core/product/form.mjs.map +1 -1
- package/dist/core/product/options.d.mts +8 -10
- package/dist/core/product/options.mjs +8 -10
- package/dist/core/product/options.mjs.map +1 -1
- package/dist/core/product/product-form.d.mts +77 -29
- package/dist/core/product/product-form.mjs +32 -10
- package/dist/core/product/product-form.mjs.map +1 -1
- package/dist/core/product/state.d.mts +55 -32
- package/dist/core/product/url.d.mts +19 -13
- package/dist/core/product/url.mjs +10 -10
- package/dist/core/product/url.mjs.map +1 -1
- package/dist/core/request-context.d.mts +77 -19
- package/dist/core/request-context.mjs +5 -1
- package/dist/core/request-context.mjs.map +1 -1
- package/dist/core/request-routing/handle-shopify-redirects.d.mts +12 -4
- package/dist/core/request-routing/handle-shopify-redirects.mjs +9 -2
- package/dist/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
- package/dist/core/request-routing/handle-shopify-routes.d.mts +5 -5
- package/dist/core/request-routing/handle-shopify-routes.mjs +7 -5
- package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/proxy.mjs +79 -43
- package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
- package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/url-redirects.mjs +6 -1
- package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/well-known.mjs +1 -1
- package/dist/core/request-routing/interceptors/well-known.mjs.map +1 -1
- package/dist/core/request-routing/registered-routes.d.mts +12 -0
- package/dist/core/request-routing/registered-routes.mjs +12 -0
- package/dist/core/request-routing/registered-routes.mjs.map +1 -1
- package/dist/core/request-routing/route-types.d.mts +43 -18
- package/dist/core/shop-pay/shop-pay.d.mts +71 -35
- package/dist/core/shop-pay/shop-pay.mjs +36 -10
- package/dist/core/shop-pay/shop-pay.mjs.map +1 -1
- package/dist/core/shopify-scripts/index.d.mts +15 -5
- package/dist/core/shopify-scripts/index.mjs +15 -5
- package/dist/core/shopify-scripts/index.mjs.map +1 -1
- package/dist/core/shopify-scripts/initialize.d.mts +12 -4
- package/dist/core/shopify-scripts/initialize.mjs +12 -4
- package/dist/core/shopify-scripts/initialize.mjs.map +1 -1
- package/dist/core/shopify-scripts/types.d.mts +58 -25
- package/dist/core/standard-routes/build.d.mts +11 -12
- package/dist/core/standard-routes/build.mjs +11 -12
- package/dist/core/standard-routes/build.mjs.map +1 -1
- package/dist/core/standard-routes/types.d.mts +30 -24
- package/dist/core/url.mjs +2 -1
- package/dist/core/url.mjs.map +1 -1
- package/dist/customer-account/client.d.mts +36 -69
- package/dist/customer-account/client.mjs +7 -8
- package/dist/customer-account/client.mjs.map +1 -1
- package/dist/customer-account/errors.d.mts +45 -36
- package/dist/customer-account/errors.mjs +21 -36
- package/dist/customer-account/errors.mjs.map +1 -1
- package/dist/customer-account/graphql.d.mts +11 -23
- package/dist/customer-account/graphql.mjs +3 -9
- package/dist/customer-account/graphql.mjs.map +1 -1
- package/dist/customer-account/session.d.mts +130 -100
- package/dist/customer-account/session.mjs +32 -10
- package/dist/customer-account/session.mjs.map +1 -1
- package/dist/customer-account/type-resolver.d.mts +7 -8
- package/dist/development/client/client.d.mts +18 -15
- package/dist/development/client/client.mjs +8 -3
- package/dist/development/client/client.mjs.map +1 -1
- package/dist/development/client/errors.d.mts +35 -13
- package/dist/development/client/errors.mjs +23 -13
- package/dist/development/client/errors.mjs.map +1 -1
- package/dist/development/client/types.d.mts +140 -90
- package/dist/development/core/analytics/cart-tracker.d.mts +19 -10
- package/dist/development/core/analytics/cart-tracker.mjs +18 -10
- package/dist/development/core/analytics/cart-tracker.mjs.map +1 -1
- package/dist/development/core/analytics/events.d.mts +17 -11
- package/dist/development/core/analytics/events.mjs +13 -4
- package/dist/development/core/analytics/events.mjs.map +1 -1
- package/dist/development/core/analytics/types.d.mts +207 -118
- package/dist/development/core/analytics/utils/flatten-connection.d.mts +11 -9
- package/dist/development/core/analytics/utils/flatten-connection.mjs +7 -6
- package/dist/development/core/analytics/utils/flatten-connection.mjs.map +1 -1
- package/dist/development/core/cache/fetch-with-cache.d.mts +24 -4
- package/dist/development/core/cache/fetch-with-cache.mjs +17 -2
- package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -1
- package/dist/development/core/cache/key.d.mts +2 -0
- package/dist/development/core/cache/key.mjs.map +1 -1
- package/dist/development/core/cache/run-with-cache.d.mts +56 -8
- package/dist/development/core/cache/run-with-cache.mjs +17 -6
- package/dist/development/core/cache/run-with-cache.mjs.map +1 -1
- package/dist/development/core/cache/store.d.mts +8 -6
- package/dist/development/core/cache/store.mjs.map +1 -1
- package/dist/development/core/cache/strategies.d.mts +27 -2
- package/dist/development/core/cache/strategies.mjs +6 -0
- package/dist/development/core/cache/strategies.mjs.map +1 -1
- package/dist/development/core/cart/actions.d.mts +37 -30
- package/dist/development/core/cart/actions.mjs +21 -9
- package/dist/development/core/cart/actions.mjs.map +1 -1
- package/dist/development/core/cart/attach-quantity-input.d.mts +8 -7
- package/dist/development/core/cart/attach-quantity-input.mjs +8 -7
- package/dist/development/core/cart/attach-quantity-input.mjs.map +1 -1
- package/dist/development/core/cart/buyer-identity-sync.d.mts +6 -5
- package/dist/development/core/cart/buyer-identity-sync.mjs.map +1 -1
- package/dist/development/core/cart/cart.d.mts +59 -46
- package/dist/development/core/cart/cart.mjs +46 -29
- package/dist/development/core/cart/cart.mjs.map +1 -1
- package/dist/development/core/cart/cookie.d.mts +8 -4
- package/dist/development/core/cart/cookie.mjs +8 -4
- package/dist/development/core/cart/cookie.mjs.map +1 -1
- package/dist/development/core/cart/form.d.mts +34 -20
- package/dist/development/core/cart/form.mjs +6 -4
- package/dist/development/core/cart/form.mjs.map +1 -1
- package/dist/development/core/cart/get-cart.d.mts +27 -15
- package/dist/development/core/cart/get-cart.mjs +13 -8
- package/dist/development/core/cart/get-cart.mjs.map +1 -1
- package/dist/development/core/cart/quantity.d.mts +16 -5
- package/dist/development/core/cart/quantity.mjs +16 -5
- package/dist/development/core/cart/quantity.mjs.map +1 -1
- package/dist/development/core/cart/queries.d.mts +25 -19
- package/dist/development/core/cart/queries.mjs +15 -1
- package/dist/development/core/cart/queries.mjs.map +1 -1
- package/dist/development/core/cart/server-handlers.d.mts +82 -45
- package/dist/development/core/cart/server-handlers.mjs +4 -0
- package/dist/development/core/cart/server-handlers.mjs.map +1 -1
- package/dist/development/core/cart/state.d.mts +110 -64
- package/dist/development/core/cart/state.mjs +24 -6
- package/dist/development/core/cart/state.mjs.map +1 -1
- package/dist/development/core/collection/collection.d.mts +52 -53
- package/dist/development/core/collection/collection.mjs +5 -3
- package/dist/development/core/collection/collection.mjs.map +1 -1
- package/dist/development/core/collection/reconciler.d.mts +23 -16
- package/dist/development/core/collection/reconciler.mjs +8 -4
- package/dist/development/core/collection/reconciler.mjs.map +1 -1
- package/dist/development/core/collection/state.d.mts +31 -26
- package/dist/development/core/collection/state.mjs +4 -3
- package/dist/development/core/collection/state.mjs.map +1 -1
- package/dist/development/core/collection/url.d.mts +70 -29
- package/dist/development/core/collection/url.mjs +63 -25
- package/dist/development/core/collection/url.mjs.map +1 -1
- package/dist/development/core/constants.mjs.map +1 -1
- package/dist/development/core/logging/logging.d.mts +14 -8
- package/dist/development/core/logging/logging.mjs +15 -10
- package/dist/development/core/logging/logging.mjs.map +1 -1
- package/dist/development/core/logging/types.d.mts +28 -11
- package/dist/development/core/logging/types.mjs.map +1 -1
- package/dist/development/core/money/format.d.mts +6 -4
- package/dist/development/core/money/format.mjs +19 -9
- package/dist/development/core/money/format.mjs.map +1 -1
- package/dist/development/core/money/types.d.mts +41 -25
- package/dist/development/core/predictive-search/form.d.mts +37 -7
- package/dist/development/core/predictive-search/form.mjs +21 -3
- package/dist/development/core/predictive-search/form.mjs.map +1 -1
- package/dist/development/core/predictive-search/queries.d.mts +18 -30
- package/dist/development/core/predictive-search/queries.mjs +7 -3
- package/dist/development/core/predictive-search/queries.mjs.map +1 -1
- package/dist/development/core/predictive-search/search.d.mts +25 -27
- package/dist/development/core/predictive-search/search.mjs +20 -19
- package/dist/development/core/predictive-search/search.mjs.map +1 -1
- package/dist/development/core/predictive-search/server-handlers.d.mts +25 -26
- package/dist/development/core/predictive-search/server-handlers.mjs +4 -0
- package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -1
- package/dist/development/core/predictive-search/store.d.mts +65 -24
- package/dist/development/core/predictive-search/store.mjs +12 -1
- package/dist/development/core/predictive-search/store.mjs.map +1 -1
- package/dist/development/core/predictive-search/url.d.mts +36 -37
- package/dist/development/core/predictive-search/url.mjs +14 -6
- package/dist/development/core/predictive-search/url.mjs.map +1 -1
- package/dist/development/core/product/form.d.mts +63 -16
- package/dist/development/core/product/form.mjs +8 -2
- package/dist/development/core/product/form.mjs.map +1 -1
- package/dist/development/core/product/options.d.mts +8 -10
- package/dist/development/core/product/options.mjs +8 -10
- package/dist/development/core/product/options.mjs.map +1 -1
- package/dist/development/core/product/product-form.d.mts +77 -29
- package/dist/development/core/product/product-form.mjs +32 -10
- package/dist/development/core/product/product-form.mjs.map +1 -1
- package/dist/development/core/product/state.d.mts +55 -32
- package/dist/development/core/product/url.d.mts +19 -13
- package/dist/development/core/product/url.mjs +10 -10
- package/dist/development/core/product/url.mjs.map +1 -1
- package/dist/development/core/request-context.d.mts +77 -19
- package/dist/development/core/request-context.mjs +5 -1
- package/dist/development/core/request-context.mjs.map +1 -1
- package/dist/development/core/request-routing/handle-shopify-redirects.d.mts +12 -4
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs +9 -2
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
- package/dist/development/core/request-routing/handle-shopify-routes.development.d.mts +9 -1
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs +7 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs.map +1 -1
- package/dist/development/core/request-routing/handle-shopify-routes.mjs +7 -5
- package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/proxy.mjs +79 -43
- package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
- package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs +6 -1
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/well-known.mjs +1 -1
- package/dist/development/core/request-routing/interceptors/well-known.mjs.map +1 -1
- package/dist/development/core/request-routing/registered-routes.d.mts +12 -0
- package/dist/development/core/request-routing/registered-routes.mjs +12 -0
- package/dist/development/core/request-routing/registered-routes.mjs.map +1 -1
- package/dist/development/core/request-routing/route-types.d.mts +43 -18
- package/dist/development/core/shop-pay/shop-pay.d.mts +71 -35
- package/dist/development/core/shop-pay/shop-pay.mjs +36 -10
- package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/index.d.mts +15 -5
- package/dist/development/core/shopify-scripts/index.mjs +15 -5
- package/dist/development/core/shopify-scripts/index.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/initialize.d.mts +12 -4
- package/dist/development/core/shopify-scripts/initialize.mjs +12 -4
- package/dist/development/core/shopify-scripts/initialize.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/types.d.mts +58 -25
- package/dist/development/core/standard-routes/build.d.mts +11 -12
- package/dist/development/core/standard-routes/build.mjs +11 -12
- package/dist/development/core/standard-routes/build.mjs.map +1 -1
- package/dist/development/core/standard-routes/types.d.mts +30 -24
- package/dist/development/core/url.mjs +2 -1
- package/dist/development/core/url.mjs.map +1 -1
- package/dist/development/customer-account/session.d.mts +45 -54
- package/dist/development/customer-account/session.mjs +20 -4
- package/dist/development/customer-account/session.mjs.map +1 -1
- package/dist/development/globals.d.mts +20 -11
- package/dist/development/graphql/generated/storefront-api-types.d.mts +127 -1
- package/dist/development/graphql/graphql.d.mts +17 -16
- package/dist/development/graphql/graphql.mjs +7 -8
- package/dist/development/graphql/graphql.mjs.map +1 -1
- package/dist/development/graphql/type-resolver.d.mts +15 -8
- package/dist/development/react/cart.d.mts +78 -32
- package/dist/development/react/cart.mjs +56 -29
- package/dist/development/react/cart.mjs.map +1 -1
- package/dist/development/react/collection.d.mts +40 -22
- package/dist/development/react/collection.mjs +27 -7
- package/dist/development/react/collection.mjs.map +1 -1
- package/dist/development/react/predictive-search.d.mts +65 -50
- package/dist/development/react/predictive-search.mjs +23 -21
- package/dist/development/react/predictive-search.mjs.map +1 -1
- package/dist/development/react/product.d.mts +45 -16
- package/dist/development/react/product.mjs +13 -11
- package/dist/development/react/product.mjs.map +1 -1
- package/dist/development/react/shop-pay.d.mts +15 -0
- package/dist/development/react/shop-pay.mjs +9 -0
- package/dist/development/react/shop-pay.mjs.map +1 -1
- package/dist/development/react/shopify-scripts.d.mts +23 -2
- package/dist/development/react/shopify-scripts.mjs +9 -0
- package/dist/development/react/shopify-scripts.mjs.map +1 -1
- package/dist/development/vue/cart.d.mts +28 -23
- package/dist/development/vue/cart.mjs +42 -25
- package/dist/development/vue/cart.mjs.map +1 -1
- package/dist/development/vue/collection.d.mts +20 -12
- package/dist/development/vue/collection.mjs +15 -7
- package/dist/development/vue/collection.mjs.map +1 -1
- package/dist/development/vue/index.d.mts +2 -2
- package/dist/development/vue/index.mjs +2 -2
- package/dist/development/vue/predictive-search.d.mts +31 -36
- package/dist/development/vue/predictive-search.mjs +16 -22
- package/dist/development/vue/predictive-search.mjs.map +1 -1
- package/dist/development/vue/product.d.mts +16 -15
- package/dist/development/vue/product.mjs +11 -11
- package/dist/development/vue/product.mjs.map +1 -1
- package/dist/development/vue/shop-pay.d.mts +14 -17
- package/dist/development/vue/shop-pay.mjs +8 -0
- package/dist/development/vue/shop-pay.mjs.map +1 -1
- package/dist/development/vue/shopify-scripts.d.mts +11 -0
- package/dist/development/vue/shopify-scripts.mjs +6 -0
- package/dist/development/vue/shopify-scripts.mjs.map +1 -1
- package/dist/globals.d.mts +20 -11
- package/dist/graphql/generated/storefront-api-types.d.mts +127 -1
- package/dist/graphql/graphql.d.mts +17 -16
- package/dist/graphql/graphql.mjs +7 -8
- package/dist/graphql/graphql.mjs.map +1 -1
- package/dist/graphql/type-resolver.d.mts +15 -8
- package/dist/react/cart.d.mts +78 -32
- package/dist/react/cart.mjs +56 -29
- package/dist/react/cart.mjs.map +1 -1
- package/dist/react/collection.d.mts +40 -22
- package/dist/react/collection.mjs +27 -7
- package/dist/react/collection.mjs.map +1 -1
- package/dist/react/predictive-search.d.mts +65 -50
- package/dist/react/predictive-search.mjs +23 -21
- package/dist/react/predictive-search.mjs.map +1 -1
- package/dist/react/product.d.mts +45 -16
- package/dist/react/product.mjs +13 -11
- package/dist/react/product.mjs.map +1 -1
- package/dist/react/shop-pay.d.mts +15 -0
- package/dist/react/shop-pay.mjs +9 -0
- package/dist/react/shop-pay.mjs.map +1 -1
- package/dist/react/shopify-scripts.d.mts +23 -2
- package/dist/react/shopify-scripts.mjs +9 -0
- package/dist/react/shopify-scripts.mjs.map +1 -1
- package/dist/ts-plugin/index.cjs +6 -0
- package/dist/ts-plugin/index.cjs.map +1 -1
- package/dist/ts-plugin/index.d.cts +6 -0
- package/dist/vite/local-https.d.mts +51 -17
- package/dist/vite/local-https.mjs +26 -5
- package/dist/vite/local-https.mjs.map +1 -1
- package/dist/vue/cart.d.mts +28 -23
- package/dist/vue/cart.mjs +42 -25
- package/dist/vue/cart.mjs.map +1 -1
- package/dist/vue/collection.d.mts +20 -12
- package/dist/vue/collection.mjs +15 -7
- package/dist/vue/collection.mjs.map +1 -1
- package/dist/vue/index.d.mts +2 -2
- package/dist/vue/index.mjs +2 -2
- package/dist/vue/predictive-search.d.mts +31 -36
- package/dist/vue/predictive-search.mjs +16 -22
- package/dist/vue/predictive-search.mjs.map +1 -1
- package/dist/vue/product.d.mts +16 -15
- package/dist/vue/product.mjs +11 -11
- package/dist/vue/product.mjs.map +1 -1
- package/dist/vue/shop-pay.d.mts +14 -17
- package/dist/vue/shop-pay.mjs +8 -0
- package/dist/vue/shop-pay.mjs.map +1 -1
- package/dist/vue/shopify-scripts.d.mts +11 -0
- package/dist/vue/shopify-scripts.mjs +6 -0
- package/dist/vue/shopify-scripts.mjs.map +1 -1
- package/package.json +3 -1
- package/skills/hydrogen-analytics/SKILL.md +1 -1
- package/skills/hydrogen-cart-ui/SKILL.md +28 -2
- package/skills/hydrogen-collection-browser/SKILL.md +9 -1
- package/skills/hydrogen-collection-browser/references/nextjs.md +1 -1
- package/skills/hydrogen-collection-browser/references/nuxt.md +1 -1
- package/skills/hydrogen-collection-browser/references/react.md +151 -32
- package/skills/hydrogen-customer-account/SKILL.md +2 -0
- package/skills/hydrogen-request-handlers/SKILL.md +21 -11
- package/skills/hydrogen-setup/references/analytics.md +14 -8
- package/skills/hydrogen-setup/steps/1-inspect-app.md +2 -2
- package/skills/hydrogen-setup/steps/6-product-detail-page.md +21 -11
- package/skills/hydrogen-storefront-client/SKILL.md +1 -1
- package/skills/hydrogen-storefront-client/references/caching.md +2 -0
- package/skills/hydrogen-variant-form/SKILL.md +25 -7
- package/skills/hydrogen-variant-form/references/nextjs.md +39 -4
- package/skills/hydrogen-variant-form/references/nuxt.md +83 -42
- package/skills/hydrogen-variant-form/references/react.md +45 -9
|
@@ -2,11 +2,19 @@ import { InitializeShopifyScriptsOptions } from "./types.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/core/shopify-scripts/initialize.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Starts Shopify's scripts in the browser for frameworks without a Hydrogen binding. Call it after
|
|
6
|
+
* hydration, with the consent configuration that you passed to `getShopifyScriptTags`.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* The function sets up `window.Shopify.routes`, and sends a page view event on load and after each
|
|
9
|
+
* navigation that changes the path or query. In the custom banner consent mode, Hydrogen calls your
|
|
10
|
+
* setup callback after the Customer Privacy API loads. A custom banner configuration without a
|
|
11
|
+
* setup callback logs a warning, and analytics events stay blocked. When the browser supports
|
|
12
|
+
* WebMCP, the function also loads Shopify's WebMCP tools. Set `webMcp` to `false` to skip them.
|
|
13
|
+
*
|
|
14
|
+
* @param options - The consent configuration, the route settings, and whether to load WebMCP tools.
|
|
15
|
+
* @returns A promise that resolves after the WebMCP tools load or fail to load, or right away when the function skips WebMCP.
|
|
16
|
+
*
|
|
17
|
+
* @publicDocs
|
|
10
18
|
*/
|
|
11
19
|
declare function initializeShopifyScripts({
|
|
12
20
|
consent,
|
|
@@ -7,11 +7,19 @@ import { loadShopifyWebMcpTools } from "./webmcp.mjs";
|
|
|
7
7
|
//#region src/core/shopify-scripts/initialize.ts
|
|
8
8
|
const log = getLogger("consent");
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Starts Shopify's scripts in the browser for frameworks without a Hydrogen binding. Call it after
|
|
11
|
+
* hydration, with the consent configuration that you passed to `getShopifyScriptTags`.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* The function sets up `window.Shopify.routes`, and sends a page view event on load and after each
|
|
14
|
+
* navigation that changes the path or query. In the custom banner consent mode, Hydrogen calls your
|
|
15
|
+
* setup callback after the Customer Privacy API loads. A custom banner configuration without a
|
|
16
|
+
* setup callback logs a warning, and analytics events stay blocked. When the browser supports
|
|
17
|
+
* WebMCP, the function also loads Shopify's WebMCP tools. Set `webMcp` to `false` to skip them.
|
|
18
|
+
*
|
|
19
|
+
* @param options - The consent configuration, the route settings, and whether to load WebMCP tools.
|
|
20
|
+
* @returns A promise that resolves after the WebMCP tools load or fail to load, or right away when the function skips WebMCP.
|
|
21
|
+
*
|
|
22
|
+
* @publicDocs
|
|
15
23
|
*/
|
|
16
24
|
function initializeShopifyScripts({ consent, navigate, routes, webMcp = true }) {
|
|
17
25
|
configureShopifyRouting({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialize.mjs","names":[],"sources":["../../../../src/core/shopify-scripts/initialize.ts"],"sourcesContent":["import { initializeCustomConsent } from \"../analytics/custom-consent\";\nimport { getLogger } from \"../logging\";\nimport { configureShopifyRouting } from \"./global\";\nimport { initializeShopifyPageViewEvents } from \"./page-view\";\nimport type { InitializeShopifyScriptsOptions } from \"./types\";\nimport { loadShopifyWebMcpTools } from \"./webmcp\";\n\nconst log = getLogger(\"consent\");\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"initialize.mjs","names":[],"sources":["../../../../src/core/shopify-scripts/initialize.ts"],"sourcesContent":["import { initializeCustomConsent } from \"../analytics/custom-consent\";\nimport { getLogger } from \"../logging\";\nimport { configureShopifyRouting } from \"./global\";\nimport { initializeShopifyPageViewEvents } from \"./page-view\";\nimport type { InitializeShopifyScriptsOptions } from \"./types\";\nimport { loadShopifyWebMcpTools } from \"./webmcp\";\n\nconst log = getLogger(\"consent\");\n\n/**\n * Starts Shopify's scripts in the browser for frameworks without a Hydrogen binding. Call it after\n * hydration, with the consent configuration that you passed to `getShopifyScriptTags`.\n *\n * The function sets up `window.Shopify.routes`, and sends a page view event on load and after each\n * navigation that changes the path or query. In the custom banner consent mode, Hydrogen calls your\n * setup callback after the Customer Privacy API loads. A custom banner configuration without a\n * setup callback logs a warning, and analytics events stay blocked. When the browser supports\n * WebMCP, the function also loads Shopify's WebMCP tools. Set `webMcp` to `false` to skip them.\n *\n * @param options - The consent configuration, the route settings, and whether to load WebMCP tools.\n * @returns A promise that resolves after the WebMCP tools load or fail to load, or right away when the function skips WebMCP.\n *\n * @publicDocs\n */\nexport function initializeShopifyScripts({\n consent,\n navigate,\n routes,\n webMcp = true,\n}: InitializeShopifyScriptsOptions): Promise<boolean | void> {\n configureShopifyRouting({ navigate, routes });\n initializeShopifyPageViewEvents();\n\n if (consent?.mode === \"custom-banner\") {\n if (typeof consent.setup !== \"function\") {\n log.warn(\n \"custom-banner requires a consent.setup callback; analytics delivery remains blocked until setup completes\",\n );\n } else {\n try {\n initializeCustomConsent(consent.setup);\n } catch (error) {\n log.error(\"custom consent initialization failed\", { error });\n }\n }\n }\n\n if (!webMcp) return Promise.resolve();\n\n return loadShopifyWebMcpTools();\n}\n"],"mappings":";;;;;;;AAOA,MAAM,MAAM,UAAU,UAAU;;;;;;;;;;;;;;;;AAiBhC,SAAgB,yBAAyB,EACvC,SACA,UACA,QACA,SAAS,QACkD;AAC3D,yBAAwB;EAAE;EAAU;EAAQ,CAAC;AAC7C,kCAAiC;AAEjC,KAAI,SAAS,SAAS,gBACpB,KAAI,OAAO,QAAQ,UAAU,WAC3B,KAAI,KACF,4GACD;KAED,KAAI;AACF,0BAAwB,QAAQ,MAAM;UAC/B,OAAO;AACd,MAAI,MAAM,wCAAwC,EAAE,OAAO,CAAC;;AAKlE,KAAI,CAAC,OAAQ,QAAO,QAAQ,SAAS;AAErC,QAAO,wBAAwB"}
|
|
@@ -4,17 +4,23 @@ import { ShopifyGlobal } from "../../globals.mjs";
|
|
|
4
4
|
import { ConsentConfig, ShopAnalyticsChannel, StorefrontAnalyticsConfig } from "../analytics/types.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/core/shopify-scripts/types.d.ts
|
|
7
|
+
/** The sales channel and custom data for the analytics bus. */
|
|
7
8
|
type ShopifyScriptsAnalyticsConfig = {
|
|
8
|
-
channel?: ShopAnalyticsChannel;
|
|
9
|
+
/** The sales channel that Shopify attributes analytics to. Defaults to `hydrogen`. */channel?: ShopAnalyticsChannel; /** Extra values that analytics destinations can read from the bus configuration. */
|
|
9
10
|
customData?: StorefrontAnalyticsConfig["customData"];
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
+
/** The locale that Shopify's scripts read from the browser's Shopify global. */
|
|
13
|
+
interface ShopifyScriptsI18n extends Pick<I18nConfig, "country" | "language">, Partial<Pick<I18nConfig, "pathPrefix">> {
|
|
14
|
+
/** The active currency code. Hydrogen converts it to uppercase. */
|
|
12
15
|
currency?: string;
|
|
13
|
-
}
|
|
16
|
+
}
|
|
17
|
+
/** The values of the HTML `crossorigin` attribute. */
|
|
14
18
|
type ShopifyCrossOrigin = "" | "anonymous" | "use-credentials";
|
|
19
|
+
/** Custom `data-*` HTML attributes with string values. */
|
|
15
20
|
type ShopifyDataAttributes = {
|
|
16
21
|
[name: `data-${string}`]: string;
|
|
17
22
|
};
|
|
23
|
+
/** The HTML attributes of a generated script tag, with lowercase attribute names. */
|
|
18
24
|
type ShopifyScriptTagAttributes = ShopifyDataAttributes & Partial<{
|
|
19
25
|
async: boolean;
|
|
20
26
|
crossorigin: ShopifyCrossOrigin;
|
|
@@ -24,58 +30,85 @@ type ShopifyScriptTagAttributes = ShopifyDataAttributes & Partial<{
|
|
|
24
30
|
src: string;
|
|
25
31
|
type: string;
|
|
26
32
|
}>;
|
|
33
|
+
/** The HTML attributes of a generated link tag. */
|
|
27
34
|
type ShopifyLinkTagAttributes = Partial<{
|
|
28
|
-
as: "script";
|
|
29
|
-
crossorigin: ShopifyCrossOrigin;
|
|
30
|
-
href: string;
|
|
35
|
+
/** The resource type for a prefetch link. Always `script`. */as: "script"; /** The CORS mode for fetching the linked resource. */
|
|
36
|
+
crossorigin: ShopifyCrossOrigin; /** The URL of the origin to preconnect to, or the script to prefetch. */
|
|
37
|
+
href: string; /** Whether the link preconnects to an origin or prefetches a script. */
|
|
31
38
|
rel: "preconnect" | "prefetch";
|
|
32
39
|
}>;
|
|
40
|
+
/** A script tag to render in the document head. */
|
|
33
41
|
type ShopifyScriptDescriptor = {
|
|
34
|
-
tagName: "script";
|
|
35
|
-
attributes?: ShopifyScriptTagAttributes;
|
|
42
|
+
/** Always `script` for a script tag. */tagName: "script"; /** The script tag's HTML attributes, such as its source URL and nonce. */
|
|
43
|
+
attributes?: ShopifyScriptTagAttributes; /** The inline script content, for scripts that have no source URL. */
|
|
36
44
|
innerHTML?: string;
|
|
37
45
|
};
|
|
46
|
+
/** A link tag to render in the document head. */
|
|
38
47
|
type ShopifyLinkDescriptor = {
|
|
39
|
-
tagName: "link";
|
|
40
|
-
attributes: ShopifyLinkTagAttributes;
|
|
48
|
+
/** Always `link` for a link tag. */tagName: "link";
|
|
49
|
+
attributes: ShopifyLinkTagAttributes; /** Link tags have no content. */
|
|
41
50
|
innerHTML?: never;
|
|
42
51
|
};
|
|
52
|
+
/** A script or link tag to render in the document head. */
|
|
43
53
|
type ShopifyScriptTagDescriptor = ShopifyScriptDescriptor | ShopifyLinkDescriptor;
|
|
54
|
+
/** The generated link and script tags, as separate lists and as one combined list. */
|
|
44
55
|
type ShopifyScriptTagDescriptors = {
|
|
45
56
|
/** Link descriptors for framework head APIs that split links from scripts. */readonly links: readonly ShopifyLinkDescriptor[]; /** Script descriptors for framework head APIs that split scripts from links. */
|
|
46
57
|
readonly scripts: readonly ShopifyScriptDescriptor[]; /** All generated descriptors as a mixed list, with links before scripts. */
|
|
47
58
|
readonly tags: readonly ShopifyScriptTagDescriptor[];
|
|
48
59
|
};
|
|
60
|
+
/** The shop identifiers that Shopify's scripts and analytics use. */
|
|
49
61
|
type ShopifyScriptsShop = {
|
|
50
|
-
shopId: string;
|
|
51
|
-
storefrontId: string; /** The shop's permanent `*.myshopify.com` domain
|
|
62
|
+
/** The shop's ID, as a numeric string or a Shop GID. */shopId: string; /** The Hydrogen storefront's ID. Hydrogen leaves it out of Headless channel analytics. */
|
|
63
|
+
storefrontId: string; /** The shop's permanent `*.myshopify.com` domain. Hydrogen sets it as `window.Shopify.shop`. */
|
|
52
64
|
myshopifyDomain: string;
|
|
53
65
|
};
|
|
66
|
+
/** The shop details and the features whose scripts to load. */
|
|
54
67
|
type ShopifyScriptTagsOptions = {
|
|
55
68
|
/**
|
|
56
|
-
* Loads the customer account component. Render
|
|
57
|
-
* @see
|
|
69
|
+
* Loads the customer account component. Render `shopify-account` where you want the account UI to appear.
|
|
70
|
+
* @see [shopify-account](https://shopify.dev/docs/api/storefront-web-components/components/shopify-account)
|
|
58
71
|
*/
|
|
59
|
-
account?: boolean;
|
|
60
|
-
analytics?: ShopifyScriptsAnalyticsConfig;
|
|
61
|
-
consent?: ConsentConfig;
|
|
72
|
+
account?: boolean; /** The sales channel and custom data for the analytics bus. */
|
|
73
|
+
analytics?: ShopifyScriptsAnalyticsConfig; /** Which consent script to load and how the analytics bus waits for consent. */
|
|
74
|
+
consent?: ConsentConfig; /** Development-only debugging tools. */
|
|
62
75
|
debug?: {
|
|
63
76
|
/** Loads Shopify's standard events inspector in development builds. */standardEventsInspector?: boolean;
|
|
64
|
-
};
|
|
65
|
-
i18n?: ShopifyScriptsI18n; /** Loads Inbox. Render
|
|
77
|
+
}; /** The country, language, currency, and path prefix for Shopify's scripts. Defaults to US English. */
|
|
78
|
+
i18n?: ShopifyScriptsI18n; /** Loads Inbox. Render `shopify-chat` where you want the chat UI to appear. */
|
|
66
79
|
inbox?: boolean;
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Adds a `nonce` attribute to every script tag.
|
|
82
|
+
*/
|
|
83
|
+
nonce?: string; /** The shop's IDs and permanent domain. */
|
|
84
|
+
shop: ShopifyScriptsShop; /** Loads Shopify's storefront analytics script. Defaults to `true`. */
|
|
69
85
|
shopifyAnalytics?: boolean;
|
|
70
86
|
};
|
|
87
|
+
/**
|
|
88
|
+
* Route settings for Shopify's scripts: the storefront's route templates and a callback for
|
|
89
|
+
* client-side navigation.
|
|
90
|
+
*/
|
|
71
91
|
type ShopifyRoutesOptions = {
|
|
72
|
-
|
|
92
|
+
/**
|
|
93
|
+
* Navigates to a URL after Shopify's scripts resolve it to your app's route. Defaults to a full
|
|
94
|
+
* page load. Checkout, cart permalink, buy permalink, and customer account paths always use a full page load.
|
|
95
|
+
*/
|
|
96
|
+
navigate?: ShopifyGlobal["routes"]["navigate"]; /** Your app's custom route templates, which Shopify's scripts use to match and resolve storefront URLs. */
|
|
73
97
|
routes?: ShopifyRouteTemplates;
|
|
74
98
|
};
|
|
75
|
-
|
|
76
|
-
|
|
99
|
+
/** The route, consent, and WebMCP settings for starting Shopify's scripts in the browser. */
|
|
100
|
+
interface InitializeShopifyScriptsOptions extends ShopifyRoutesOptions {
|
|
101
|
+
/** The consent configuration that you passed to the script tags. The bus runs the setup callback once. */
|
|
102
|
+
consent?: ConsentConfig;
|
|
103
|
+
/** Loads Shopify WebMCP tools when the browser supports WebMCP. Defaults to `true`. */
|
|
77
104
|
webMcp?: boolean;
|
|
78
|
-
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Options for both `getShopifyScriptTags` and `initializeShopifyScripts`. Build one object and pass
|
|
108
|
+
* it to both functions.
|
|
109
|
+
*
|
|
110
|
+
* @publicDocs
|
|
111
|
+
*/
|
|
79
112
|
type ShopifyScriptsOptions = ShopifyScriptTagsOptions & InitializeShopifyScriptsOptions;
|
|
80
113
|
//#endregion
|
|
81
114
|
export { InitializeShopifyScriptsOptions, ShopifyRoutesOptions, ShopifyScriptTagDescriptor, ShopifyScriptTagDescriptors, ShopifyScriptTagsOptions, ShopifyScriptsAnalyticsConfig, ShopifyScriptsI18n, ShopifyScriptsOptions, ShopifyScriptsShop };
|
|
@@ -2,21 +2,19 @@ import { ShopifyRouteTemplates } from "./types.mjs";
|
|
|
2
2
|
|
|
3
3
|
//#region src/core/standard-routes/build.d.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Tells Hydrogen where your app serves products, collections, and other Shopify resources. Pass
|
|
6
|
+
* the returned object to `handleShopifyRoutes`, `handleShopifyRedirects`, the `ShopifyScripts` `routes`
|
|
7
|
+
* option, and the predictive search URL helpers.
|
|
6
8
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
9
|
+
* Add a key only for a route that your app serves at a non-standard path. Hydrogen uses Shopify's
|
|
10
|
+
* default path for each key that you leave out. Pass an empty object when your app serves every
|
|
11
|
+
* route at its default path. Each template starts with `/` and includes the handle placeholders
|
|
12
|
+
* for its route. Leave the locale path prefix out of templates. Hydrogen adds the prefix for you.
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
* pathname template. Templates must start with `/` and include the required named handle
|
|
13
|
-
* placeholders for routes that identify a resource. Do not include an i18n path prefix in the
|
|
14
|
-
* template; Hydrogen applies `i18n.pathPrefix` separately when resolving routes. Pass an empty
|
|
15
|
-
* object when the app uses standard storefront routes so there is still one app-owned routing
|
|
16
|
-
* manifest to update if routes change later. When matching the current page, standard storefront
|
|
17
|
-
* routes retain their page-template identities even if a configured template resolves another
|
|
18
|
-
* route to the same pathname.
|
|
14
|
+
* TypeScript checks the shape of each template. The function returns the object that you pass.
|
|
19
15
|
*
|
|
16
|
+
* @param routes The non-standard paths that your app serves, keyed by standard route name.
|
|
17
|
+
* @returns The route templates, typed for Hydrogen's route, redirect, and URL helpers.
|
|
20
18
|
* @example
|
|
21
19
|
* ```ts
|
|
22
20
|
* const routeTemplates = createShopifyRouteTemplates({
|
|
@@ -27,6 +25,7 @@ import { ShopifyRouteTemplates } from "./types.mjs";
|
|
|
27
25
|
* policy: "/legal/:policyHandle",
|
|
28
26
|
* });
|
|
29
27
|
* ```
|
|
28
|
+
* @publicDocs
|
|
30
29
|
*/
|
|
31
30
|
declare function createShopifyRouteTemplates<const TRoutes extends ShopifyRouteTemplates>(routes: TRoutes): TRoutes;
|
|
32
31
|
//#endregion
|
|
@@ -3,21 +3,19 @@ import { prependPathPrefix } from "./path.mjs";
|
|
|
3
3
|
|
|
4
4
|
//#region src/core/standard-routes/build.ts
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Tells Hydrogen where your app serves products, collections, and other Shopify resources. Pass
|
|
7
|
+
* the returned object to `handleShopifyRoutes`, `handleShopifyRedirects`, the `ShopifyScripts` `routes`
|
|
8
|
+
* option, and the predictive search URL helpers.
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* Add a key only for a route that your app serves at a non-standard path. Hydrogen uses Shopify's
|
|
11
|
+
* default path for each key that you leave out. Pass an empty object when your app serves every
|
|
12
|
+
* route at its default path. Each template starts with `/` and includes the handle placeholders
|
|
13
|
+
* for its route. Leave the locale path prefix out of templates. Hydrogen adds the prefix for you.
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
* pathname template. Templates must start with `/` and include the required named handle
|
|
14
|
-
* placeholders for routes that identify a resource. Do not include an i18n path prefix in the
|
|
15
|
-
* template; Hydrogen applies `i18n.pathPrefix` separately when resolving routes. Pass an empty
|
|
16
|
-
* object when the app uses standard storefront routes so there is still one app-owned routing
|
|
17
|
-
* manifest to update if routes change later. When matching the current page, standard storefront
|
|
18
|
-
* routes retain their page-template identities even if a configured template resolves another
|
|
19
|
-
* route to the same pathname.
|
|
15
|
+
* TypeScript checks the shape of each template. The function returns the object that you pass.
|
|
20
16
|
*
|
|
17
|
+
* @param routes The non-standard paths that your app serves, keyed by standard route name.
|
|
18
|
+
* @returns The route templates, typed for Hydrogen's route, redirect, and URL helpers.
|
|
21
19
|
* @example
|
|
22
20
|
* ```ts
|
|
23
21
|
* const routeTemplates = createShopifyRouteTemplates({
|
|
@@ -28,6 +26,7 @@ import { prependPathPrefix } from "./path.mjs";
|
|
|
28
26
|
* policy: "/legal/:policyHandle",
|
|
29
27
|
* });
|
|
30
28
|
* ```
|
|
29
|
+
* @publicDocs
|
|
31
30
|
*/
|
|
32
31
|
function createShopifyRouteTemplates(routes) {
|
|
33
32
|
return routes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.mjs","names":[],"sources":["../../../../src/core/standard-routes/build.ts"],"sourcesContent":["import { DEFAULT_STANDARD_ROUTES, isStandardRouteParamName } from \"./defaults\";\nimport { prependPathPrefix } from \"./path\";\nimport type {\n ShopifyRouteTemplates,\n StandardRouteName,\n StandardRouteOptions,\n StandardRouteParams,\n StandardRouteParamsByName,\n} from \"./types\";\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"build.mjs","names":[],"sources":["../../../../src/core/standard-routes/build.ts"],"sourcesContent":["import { DEFAULT_STANDARD_ROUTES, isStandardRouteParamName } from \"./defaults\";\nimport { prependPathPrefix } from \"./path\";\nimport type {\n ShopifyRouteTemplates,\n StandardRouteName,\n StandardRouteOptions,\n StandardRouteParams,\n StandardRouteParamsByName,\n} from \"./types\";\n\n/**\n * Tells Hydrogen where your app serves products, collections, and other Shopify resources. Pass\n * the returned object to `handleShopifyRoutes`, `handleShopifyRedirects`, the `ShopifyScripts` `routes`\n * option, and the predictive search URL helpers.\n *\n * Add a key only for a route that your app serves at a non-standard path. Hydrogen uses Shopify's\n * default path for each key that you leave out. Pass an empty object when your app serves every\n * route at its default path. Each template starts with `/` and includes the handle placeholders\n * for its route. Leave the locale path prefix out of templates. Hydrogen adds the prefix for you.\n *\n * TypeScript checks the shape of each template. The function returns the object that you pass.\n *\n * @param routes The non-standard paths that your app serves, keyed by standard route name.\n * @returns The route templates, typed for Hydrogen's route, redirect, and URL helpers.\n * @example\n * ```ts\n * const routeTemplates = createShopifyRouteTemplates({\n * product: \"/p/:productHandle\",\n * collection: \"/c/:collectionHandle\",\n * article: \"/journal/:blogHandle/:articleHandle\",\n * cart: \"/basket\",\n * policy: \"/legal/:policyHandle\",\n * });\n * ```\n * @publicDocs\n */\nexport function createShopifyRouteTemplates<const TRoutes extends ShopifyRouteTemplates>(\n routes: TRoutes,\n): TRoutes {\n return routes;\n}\n\nexport function getStandardRoute<const TRoute extends StandardRouteName>(\n routeTemplates: ShopifyRouteTemplates,\n route: TRoute,\n params: StandardRouteParamsByName[TRoute],\n options: StandardRouteOptions = {},\n): string {\n const target = routeTemplates[route] ?? DEFAULT_STANDARD_ROUTES[route][0];\n\n return buildStandardRouteTarget(target, params, options.pathPrefix);\n}\n\n/**\n * Builds a pathname from a route template, handle params, and optional i18n path prefix.\n */\nexport function buildStandardRouteTarget(\n template: string,\n params: StandardRouteParams,\n pathPrefix: string | undefined,\n): string {\n return prependPathPrefix(interpolateRouteTemplate(template, params), pathPrefix);\n}\n\nfunction interpolateRouteTemplate(template: string, params: StandardRouteParams): string {\n return template.replace(/:([A-Za-z][A-Za-z0-9_]*)/g, (placeholder, name: string) => {\n if (!isStandardRouteParamName(name)) return placeholder;\n\n const value = params[name];\n return value === undefined ? placeholder : encodeURIComponent(value);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,SAAgB,4BACd,QACS;AACT,QAAO;;AAGT,SAAgB,iBACd,gBACA,OACA,QACA,UAAgC,EAAE,EAC1B;AAGR,QAAO,yBAFQ,eAAe,UAAU,wBAAwB,OAAO,IAE/B,QAAQ,QAAQ,WAAW;;;;;AAMrE,SAAgB,yBACd,UACA,QACA,YACQ;AACR,QAAO,kBAAkB,yBAAyB,UAAU,OAAO,EAAE,WAAW;;AAGlF,SAAS,yBAAyB,UAAkB,QAAqC;AACvF,QAAO,SAAS,QAAQ,8BAA8B,aAAa,SAAiB;AAClF,MAAI,CAAC,yBAAyB,KAAK,CAAE,QAAO;EAE5C,MAAM,QAAQ,OAAO;AACrB,SAAO,UAAU,SAAY,cAAc,mBAAmB,MAAM;GACpE"}
|
|
@@ -1,75 +1,78 @@
|
|
|
1
1
|
//#region src/core/standard-routes/types.d.ts
|
|
2
|
+
/** A path template that starts with `/` and includes the named handle placeholder. */
|
|
2
3
|
type StandardRouteTemplateWithParam<Param extends string> = `/${string}:${Param}` | `/${string}:${Param}/${string}`;
|
|
4
|
+
/** A path template that starts with `/`. */
|
|
3
5
|
type StandardRouteTemplate = `/${string}`;
|
|
6
|
+
/** Your app's custom path templates for Shopify standard storefront routes, keyed by route name. */
|
|
4
7
|
type ShopifyRouteTemplates = {
|
|
5
8
|
/**
|
|
6
|
-
*
|
|
7
|
-
* `/blogs/news/snowboard-guide`, to
|
|
9
|
+
* The app's article path. Hydrogen redirects Shopify article paths, such as
|
|
10
|
+
* `/blogs/news/snowboard-guide`, to this template.
|
|
8
11
|
*
|
|
9
12
|
* @example "/journal/:blogHandle/:articleHandle"
|
|
10
13
|
*/
|
|
11
14
|
article?: StandardRouteTemplateWithParam<"blogHandle"> & StandardRouteTemplateWithParam<"articleHandle">;
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* The app's blog path. Hydrogen redirects Shopify blog paths, such as
|
|
17
|
+
* `/blogs/news`, to this template.
|
|
15
18
|
*
|
|
16
19
|
* @example "/journal/:blogHandle"
|
|
17
20
|
*/
|
|
18
21
|
blog?: StandardRouteTemplateWithParam<"blogHandle">;
|
|
19
22
|
/**
|
|
20
|
-
*
|
|
23
|
+
* The app's cart path. Hydrogen redirects Shopify's `/cart` path to this template.
|
|
21
24
|
*
|
|
22
25
|
* @example "/basket"
|
|
23
26
|
*/
|
|
24
27
|
cart?: StandardRouteTemplate;
|
|
25
28
|
/**
|
|
26
|
-
*
|
|
27
|
-
* to
|
|
29
|
+
* The app's collection path. Hydrogen redirects Shopify collection paths, such as
|
|
30
|
+
* `/collections/winter`, to this template.
|
|
28
31
|
*
|
|
29
32
|
* @example "/c/:collectionHandle"
|
|
30
33
|
*/
|
|
31
34
|
collection?: StandardRouteTemplateWithParam<"collectionHandle">;
|
|
32
35
|
/**
|
|
33
|
-
*
|
|
34
|
-
* legacy `/products
|
|
36
|
+
* The app's collection list path. Hydrogen redirects Shopify's `/collections`
|
|
37
|
+
* path and the legacy `/products` path to this template.
|
|
35
38
|
*
|
|
36
39
|
* @example "/catalog"
|
|
37
40
|
*/
|
|
38
41
|
collectionList?: StandardRouteTemplate;
|
|
39
42
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
43
|
+
* The app's page path. Hydrogen redirects Shopify page paths, such as
|
|
44
|
+
* `/pages/about-us`, to this template.
|
|
42
45
|
*
|
|
43
46
|
* @example "/content/:pageHandle"
|
|
44
47
|
*/
|
|
45
48
|
page?: StandardRouteTemplateWithParam<"pageHandle">;
|
|
46
49
|
/**
|
|
47
|
-
*
|
|
48
|
-
* to
|
|
50
|
+
* The app's policy path. Hydrogen redirects Shopify policy paths, such as
|
|
51
|
+
* `/policies/privacy-policy`, to this template.
|
|
49
52
|
*
|
|
50
53
|
* @example "/legal/:policyHandle"
|
|
51
54
|
*/
|
|
52
55
|
policy?: StandardRouteTemplateWithParam<"policyHandle">;
|
|
53
56
|
/**
|
|
54
|
-
*
|
|
55
|
-
* to
|
|
57
|
+
* The app's product path. Hydrogen redirects Shopify product paths, such as
|
|
58
|
+
* `/products/snowboard`, to this template.
|
|
56
59
|
*
|
|
57
60
|
* @example "/p/:productHandle"
|
|
58
61
|
*/
|
|
59
62
|
product?: StandardRouteTemplateWithParam<"productHandle">;
|
|
60
63
|
/**
|
|
61
|
-
*
|
|
62
|
-
* `/collections/winter/products/snowboard
|
|
64
|
+
* The app's path for products inside a collection. Hydrogen redirects Shopify
|
|
65
|
+
* paths such as `/collections/winter/products/snowboard` to this template.
|
|
63
66
|
*
|
|
64
|
-
*
|
|
65
|
-
* app's
|
|
67
|
+
* The template must include `:productHandle`. Add `:collectionHandle` when the
|
|
68
|
+
* app's product path also names the collection.
|
|
66
69
|
*
|
|
67
70
|
* @example "/p/:productHandle"
|
|
68
71
|
* @example "/c/:collectionHandle/p/:productHandle"
|
|
69
72
|
*/
|
|
70
73
|
productInCollection?: StandardRouteTemplateWithParam<"productHandle">;
|
|
71
74
|
/**
|
|
72
|
-
*
|
|
75
|
+
* The app's search path. Hydrogen redirects Shopify's `/search` path to this template.
|
|
73
76
|
*
|
|
74
77
|
* @example "/find"
|
|
75
78
|
*/
|
|
@@ -77,14 +80,17 @@ type ShopifyRouteTemplates = {
|
|
|
77
80
|
};
|
|
78
81
|
type StandardRouteName = keyof ShopifyRouteTemplates;
|
|
79
82
|
type ShopifyStandardRouteName = StandardRouteName | "index";
|
|
83
|
+
/** The page template name for a standard route. Collection-scoped products use `product`, and the collection list uses `list-collections`. */
|
|
80
84
|
type ShopifyPageTemplateName<TRoute extends ShopifyStandardRouteName = ShopifyStandardRouteName> = TRoute extends "productInCollection" ? "product" : TRoute extends "collectionList" ? "list-collections" : TRoute;
|
|
81
85
|
type StandardRouteParamName = "articleHandle" | "blogHandle" | "collectionHandle" | "pageHandle" | "policyHandle" | "productHandle";
|
|
86
|
+
/** The handle values that fill a route template's placeholders, keyed by placeholder name. */
|
|
82
87
|
type StandardRouteParams = Partial<Record<StandardRouteParamName, string>>;
|
|
88
|
+
/** The standard route that a storefront URL matches, with its handles, page template name, and templates. */
|
|
83
89
|
type ShopifyStandardRouteMatch<TRoute extends ShopifyStandardRouteName = ShopifyStandardRouteName> = {
|
|
84
|
-
standardPathname: string;
|
|
85
|
-
params: StandardRouteParams;
|
|
86
|
-
route: TRoute;
|
|
87
|
-
pageTemplateName: ShopifyPageTemplateName<TRoute>;
|
|
90
|
+
/** Shopify's default path for the matched resource, with the locale path prefix applied. */standardPathname: string; /** The decoded handle values from the matched URL. */
|
|
91
|
+
params: StandardRouteParams; /** The standard route name that the URL matched, or `index` for the home page. */
|
|
92
|
+
route: TRoute; /** The page template name for the matched route, such as `product` or `list-collections`. */
|
|
93
|
+
pageTemplateName: ShopifyPageTemplateName<TRoute>; /** Shopify's default template for the matched route and your app's custom template, which falls back to the default. */
|
|
88
94
|
templates: {
|
|
89
95
|
standard: string;
|
|
90
96
|
custom: string;
|
|
@@ -24,6 +24,7 @@ const CUSTOMER_ACCOUNT_HANDOFF_PATHS = new Set(Object.values(CUSTOMER_ACCOUNT_PA
|
|
|
24
24
|
function isHydrogenServerHandoffPath(pathname) {
|
|
25
25
|
return CHECKOUT_RE.test(pathname) || CART_PERMALINK_RE.test(pathname) || BUY_PERMALINK_RE.test(pathname) || CUSTOMER_ACCOUNT_HANDOFF_PATHS.has(pathname);
|
|
26
26
|
}
|
|
27
|
+
const UCP_RE = /^\/\.well-known\/ucp$/;
|
|
27
28
|
/**
|
|
28
29
|
* Allowlisted `.well-known` resources proxied to the Online Store origin:
|
|
29
30
|
* - `apple-developer-merchantid-domain-association` — Apple Pay domain verification.
|
|
@@ -57,5 +58,5 @@ function normalizeStoreDomain(domain) {
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
//#endregion
|
|
60
|
-
export { AJAX_CART_RE, BUY_PERMALINK_RE, CHECKOUT_RE, CUSTOMER_ACCOUNT_PATHS, MCP_RE, SFAPI_RE, SHOPIFY_API_PROXY_PREFIX, SHOPIFY_API_PROXY_RE, UCP_MCP_RE, WELL_KNOWN_RE, getSameOriginPath, isHydrogenServerHandoffPath, normalizeStoreDomain };
|
|
61
|
+
export { AJAX_CART_RE, BUY_PERMALINK_RE, CHECKOUT_RE, CUSTOMER_ACCOUNT_PATHS, MCP_RE, SFAPI_RE, SHOPIFY_API_PROXY_PREFIX, SHOPIFY_API_PROXY_RE, UCP_MCP_RE, UCP_RE, WELL_KNOWN_RE, getSameOriginPath, isHydrogenServerHandoffPath, normalizeStoreDomain };
|
|
61
62
|
//# sourceMappingURL=url.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.mjs","names":[],"sources":["../../../src/core/url.ts"],"sourcesContent":["export const SFAPI_RE = /^\\/api\\/(unstable|2\\d{3}-\\d{2})\\/graphql\\.json$/;\nexport const SHOPIFY_API_PROXY_PREFIX = \"/__shopify\";\nexport const SHOPIFY_API_PROXY_RE = /^\\/__shopify(?:\\/|$)/;\nexport const MCP_RE = /^\\/api\\/mcp$/;\nexport const UCP_MCP_RE = /^\\/api\\/ucp\\/mcp$/;\nexport const CHECKOUT_RE = /^\\/checkout$/;\nexport const CART_PERMALINK_RE = /^\\/cart\\/\\d+:\\d+(?:,\\d+:\\d+)*$/;\nconst BUY_ITEM_PAIR = String.raw`(?:[A-Za-z0-9._-]+|~[A-Za-z0-9_-]+):[1-9]\\d*`;\n// Items are required so a storefront's own /buy pages keep routing to the app.\nexport const BUY_PERMALINK_RE = new RegExp(`^/buy/${BUY_ITEM_PAIR}(?:,${BUY_ITEM_PAIR})*$`);\nexport const CUSTOMER_ACCOUNT_PATHS = {\n authorize: \"/account/authorize\",\n login: \"/account/login\",\n logout: \"/account/logout\",\n refresh: \"/account/refresh\",\n} as const;\n\nconst CUSTOMER_ACCOUNT_HANDOFF_PATHS: ReadonlySet<string> = new Set(\n Object.values(CUSTOMER_ACCOUNT_PATHS),\n);\n\n/**\n * Returns whether the pathname conventionally represents a Hydrogen document-level server handoff.\n *\n * Keep this aligned with the routes intercepted before framework routing. API and protocol\n * interceptors are intentionally excluded because they are not browser navigation destinations.\n */\nexport function isHydrogenServerHandoffPath(pathname: string): boolean {\n return (\n CHECKOUT_RE.test(pathname) ||\n CART_PERMALINK_RE.test(pathname) ||\n BUY_PERMALINK_RE.test(pathname) ||\n CUSTOMER_ACCOUNT_HANDOFF_PATHS.has(pathname)\n );\n}\n\n/**\n * Allowlisted `.well-known` resources proxied to the Online Store origin:\n * - `apple-developer-merchantid-domain-association` — Apple Pay domain verification.\n * - `shopify/fec/produce` — Frontend Event Collector ingress. On the Online\n * Store the myshopify.com edge forwards this first-party path to the\n * collector; headless storefronts have no such edge, so Hydrogen proxies it\n * to the same origin (used by WebMCP's Event Refinery client).\n */\nexport const WELL_KNOWN_RE =\n /^\\/\\.well-known\\/(?:apple-developer-merchantid-domain-association|shopify\\/fec\\/produce)$/;\nexport const AJAX_CART_RE =\n /^(?:\\/[a-z]{2}(?:-[a-z]{2})?)?\\/cart(?:\\.(?:js|json)|\\/(?:add|update|change|clear)(?:\\.(?:js|json))?)$/i;\n\n/**\n * Normalizes `target` to a path on `origin` that is safe to use as a redirect location.\n * Returns `undefined` unless `target` is a path starting with `/` or an absolute URL,\n * stays on `origin`, and its normalized pathname does not start with `//`.\n */\nexport function getSameOriginPath(\n target: string | null | undefined,\n origin: string,\n): string | undefined {\n if (!target) return undefined;\n\n try {\n // Parse absolute URLs without a base so scheme-relative forms like `https:evil.example`\n // resolve to their own host, as a browser would, instead of onto `origin`.\n const url = target.startsWith(\"/\") ? new URL(target, origin) : new URL(target);\n if (url.origin !== origin) return undefined;\n const path = `${url.pathname}${url.search}${url.hash}`;\n // The parsed pathname can itself start with `//` (e.g. from `/x/..//evil`),\n // which a redirect would resolve as a protocol-relative URL to another host.\n return path.startsWith(\"//\") ? undefined : path;\n } catch {\n return undefined;\n }\n}\n\nexport function normalizeStoreDomain(domain: string): string {\n if (!domain) {\n throw new Error(\"Storefront `storeDomain` is required.\");\n }\n\n if (domain.startsWith(\"http://\") || domain.startsWith(\"https://\")) {\n return domain.replace(/\\/+$/, \"\");\n }\n return `https://${domain}`.replace(/\\/+$/, \"\");\n}\n"],"mappings":";AAAA,MAAa,WAAW;AACxB,MAAa,2BAA2B;AACxC,MAAa,uBAAuB;AACpC,MAAa,SAAS;AACtB,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,oBAAoB;AACjC,MAAM,gBAAgB,OAAO,GAAG;AAEhC,MAAa,mBAAmB,IAAI,OAAO,SAAS,cAAc,MAAM,cAAc,KAAK;AAC3F,MAAa,yBAAyB;CACpC,WAAW;CACX,OAAO;CACP,QAAQ;CACR,SAAS;CACV;AAED,MAAM,iCAAsD,IAAI,IAC9D,OAAO,OAAO,uBAAuB,CACtC;;;;;;;AAQD,SAAgB,4BAA4B,UAA2B;AACrE,QACE,YAAY,KAAK,SAAS,IAC1B,kBAAkB,KAAK,SAAS,IAChC,iBAAiB,KAAK,SAAS,IAC/B,+BAA+B,IAAI,SAAS
|
|
1
|
+
{"version":3,"file":"url.mjs","names":[],"sources":["../../../src/core/url.ts"],"sourcesContent":["export const SFAPI_RE = /^\\/api\\/(unstable|2\\d{3}-\\d{2})\\/graphql\\.json$/;\nexport const SHOPIFY_API_PROXY_PREFIX = \"/__shopify\";\nexport const SHOPIFY_API_PROXY_RE = /^\\/__shopify(?:\\/|$)/;\nexport const MCP_RE = /^\\/api\\/mcp$/;\nexport const UCP_MCP_RE = /^\\/api\\/ucp\\/mcp$/;\nexport const CHECKOUT_RE = /^\\/checkout$/;\nexport const CART_PERMALINK_RE = /^\\/cart\\/\\d+:\\d+(?:,\\d+:\\d+)*$/;\nconst BUY_ITEM_PAIR = String.raw`(?:[A-Za-z0-9._-]+|~[A-Za-z0-9_-]+):[1-9]\\d*`;\n// Items are required so a storefront's own /buy pages keep routing to the app.\nexport const BUY_PERMALINK_RE = new RegExp(`^/buy/${BUY_ITEM_PAIR}(?:,${BUY_ITEM_PAIR})*$`);\nexport const CUSTOMER_ACCOUNT_PATHS = {\n authorize: \"/account/authorize\",\n login: \"/account/login\",\n logout: \"/account/logout\",\n refresh: \"/account/refresh\",\n} as const;\n\nconst CUSTOMER_ACCOUNT_HANDOFF_PATHS: ReadonlySet<string> = new Set(\n Object.values(CUSTOMER_ACCOUNT_PATHS),\n);\n\n/**\n * Returns whether the pathname conventionally represents a Hydrogen document-level server handoff.\n *\n * Keep this aligned with the routes intercepted before framework routing. API and protocol\n * interceptors are intentionally excluded because they are not browser navigation destinations.\n */\nexport function isHydrogenServerHandoffPath(pathname: string): boolean {\n return (\n CHECKOUT_RE.test(pathname) ||\n CART_PERMALINK_RE.test(pathname) ||\n BUY_PERMALINK_RE.test(pathname) ||\n CUSTOMER_ACCOUNT_HANDOFF_PATHS.has(pathname)\n );\n}\n\n// UCP profiles need JSON validation and caching separate from the other well-known resources.\nexport const UCP_RE = /^\\/\\.well-known\\/ucp$/;\n\n/**\n * Allowlisted `.well-known` resources proxied to the Online Store origin:\n * - `apple-developer-merchantid-domain-association` — Apple Pay domain verification.\n * - `shopify/fec/produce` — Frontend Event Collector ingress. On the Online\n * Store the myshopify.com edge forwards this first-party path to the\n * collector; headless storefronts have no such edge, so Hydrogen proxies it\n * to the same origin (used by WebMCP's Event Refinery client).\n */\nexport const WELL_KNOWN_RE =\n /^\\/\\.well-known\\/(?:apple-developer-merchantid-domain-association|shopify\\/fec\\/produce)$/;\nexport const AJAX_CART_RE =\n /^(?:\\/[a-z]{2}(?:-[a-z]{2})?)?\\/cart(?:\\.(?:js|json)|\\/(?:add|update|change|clear)(?:\\.(?:js|json))?)$/i;\n\n/**\n * Normalizes `target` to a path on `origin` that is safe to use as a redirect location.\n * Returns `undefined` unless `target` is a path starting with `/` or an absolute URL,\n * stays on `origin`, and its normalized pathname does not start with `//`.\n */\nexport function getSameOriginPath(\n target: string | null | undefined,\n origin: string,\n): string | undefined {\n if (!target) return undefined;\n\n try {\n // Parse absolute URLs without a base so scheme-relative forms like `https:evil.example`\n // resolve to their own host, as a browser would, instead of onto `origin`.\n const url = target.startsWith(\"/\") ? new URL(target, origin) : new URL(target);\n if (url.origin !== origin) return undefined;\n const path = `${url.pathname}${url.search}${url.hash}`;\n // The parsed pathname can itself start with `//` (e.g. from `/x/..//evil`),\n // which a redirect would resolve as a protocol-relative URL to another host.\n return path.startsWith(\"//\") ? undefined : path;\n } catch {\n return undefined;\n }\n}\n\nexport function normalizeStoreDomain(domain: string): string {\n if (!domain) {\n throw new Error(\"Storefront `storeDomain` is required.\");\n }\n\n if (domain.startsWith(\"http://\") || domain.startsWith(\"https://\")) {\n return domain.replace(/\\/+$/, \"\");\n }\n return `https://${domain}`.replace(/\\/+$/, \"\");\n}\n"],"mappings":";AAAA,MAAa,WAAW;AACxB,MAAa,2BAA2B;AACxC,MAAa,uBAAuB;AACpC,MAAa,SAAS;AACtB,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,oBAAoB;AACjC,MAAM,gBAAgB,OAAO,GAAG;AAEhC,MAAa,mBAAmB,IAAI,OAAO,SAAS,cAAc,MAAM,cAAc,KAAK;AAC3F,MAAa,yBAAyB;CACpC,WAAW;CACX,OAAO;CACP,QAAQ;CACR,SAAS;CACV;AAED,MAAM,iCAAsD,IAAI,IAC9D,OAAO,OAAO,uBAAuB,CACtC;;;;;;;AAQD,SAAgB,4BAA4B,UAA2B;AACrE,QACE,YAAY,KAAK,SAAS,IAC1B,kBAAkB,KAAK,SAAS,IAChC,iBAAiB,KAAK,SAAS,IAC/B,+BAA+B,IAAI,SAAS;;AAKhD,MAAa,SAAS;;;;;;;;;AAUtB,MAAa,gBACX;AACF,MAAa,eACX;;;;;;AAOF,SAAgB,kBACd,QACA,QACoB;AACpB,KAAI,CAAC,OAAQ,QAAO;AAEpB,KAAI;EAGF,MAAM,MAAM,OAAO,WAAW,IAAI,GAAG,IAAI,IAAI,QAAQ,OAAO,GAAG,IAAI,IAAI,OAAO;AAC9E,MAAI,IAAI,WAAW,OAAQ,QAAO;EAClC,MAAM,OAAO,GAAG,IAAI,WAAW,IAAI,SAAS,IAAI;AAGhD,SAAO,KAAK,WAAW,KAAK,GAAG,SAAY;SACrC;AACN;;;AAIJ,SAAgB,qBAAqB,QAAwB;AAC3D,KAAI,CAAC,OACH,OAAM,IAAI,MAAM,wCAAwC;AAG1D,KAAI,OAAO,WAAW,UAAU,IAAI,OAAO,WAAW,WAAW,CAC/D,QAAO,OAAO,QAAQ,QAAQ,GAAG;AAEnC,QAAO,WAAW,SAAS,QAAQ,QAAQ,GAAG"}
|