@shopify/hydrogen 2026.4.5 → 2026.10.0-preview.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -13
- package/bin/hydrogen.mjs +7 -0
- package/dist/cli/index.mjs +647 -0
- package/dist/client/client.d.mts +34 -0
- package/dist/client/client.mjs +206 -0
- package/dist/client/client.mjs.map +1 -0
- package/dist/client/errors.d.mts +48 -0
- package/dist/client/errors.mjs +52 -0
- package/dist/client/errors.mjs.map +1 -0
- package/dist/client/index.d.mts +4 -0
- package/dist/client/types.d.mts +147 -0
- package/dist/core/analytics/cart-tracker.d.mts +8 -0
- package/dist/core/analytics/cart-tracker.mjs +144 -0
- package/dist/core/analytics/cart-tracker.mjs.map +1 -0
- package/dist/core/analytics/events.d.mts +15 -0
- package/dist/core/analytics/events.mjs +15 -0
- package/dist/core/analytics/events.mjs.map +1 -0
- package/dist/core/analytics/index.d.mts +3 -0
- package/dist/core/analytics/types.d.mts +143 -0
- package/dist/core/analytics/utils/flatten-connection.d.mts +19 -0
- package/dist/core/analytics/utils/flatten-connection.mjs +25 -0
- package/dist/core/analytics/utils/flatten-connection.mjs.map +1 -0
- package/dist/core/cache/cache-status.mjs +17 -0
- package/dist/core/cache/cache-status.mjs.map +1 -0
- package/dist/core/cache/fetch-with-cache.d.mts +43 -0
- package/dist/core/cache/fetch-with-cache.mjs +188 -0
- package/dist/core/cache/fetch-with-cache.mjs.map +1 -0
- package/dist/core/cache/key.d.mts +6 -0
- package/dist/core/cache/key.mjs +27 -0
- package/dist/core/cache/key.mjs.map +1 -0
- package/dist/core/cache/run-with-cache.d.mts +36 -0
- package/dist/core/cache/run-with-cache.mjs +114 -0
- package/dist/core/cache/run-with-cache.mjs.map +1 -0
- package/dist/core/cache/store.d.mts +19 -0
- package/dist/core/cache/store.mjs +62 -0
- package/dist/core/cache/store.mjs.map +1 -0
- package/dist/core/cache/strategies.d.mts +39 -0
- package/dist/core/cache/strategies.mjs +70 -0
- package/dist/core/cache/strategies.mjs.map +1 -0
- package/dist/core/cart/actions.d.mts +50 -0
- package/dist/core/cart/actions.mjs +240 -0
- package/dist/core/cart/actions.mjs.map +1 -0
- package/dist/core/cart/attach-quantity-input.d.mts +5 -0
- package/dist/core/cart/attach-quantity-input.mjs +17 -0
- package/dist/core/cart/attach-quantity-input.mjs.map +1 -0
- package/dist/core/cart/buyer-identity-sync.d.mts +23 -0
- package/dist/core/cart/buyer-identity-sync.mjs +9 -0
- package/dist/core/cart/buyer-identity-sync.mjs.map +1 -0
- package/dist/core/cart/cart.d.mts +37 -0
- package/dist/core/cart/cart.mjs +1707 -0
- package/dist/core/cart/cart.mjs.map +1 -0
- package/dist/core/cart/cookie.d.mts +5 -0
- package/dist/core/cart/cookie.mjs +28 -0
- package/dist/core/cart/cookie.mjs.map +1 -0
- package/dist/core/cart/form.d.mts +130 -0
- package/dist/core/cart/form.mjs +75 -0
- package/dist/core/cart/form.mjs.map +1 -0
- package/dist/core/cart/get-cart.d.mts +25 -0
- package/dist/core/cart/get-cart.mjs +32 -0
- package/dist/core/cart/get-cart.mjs.map +1 -0
- package/dist/core/cart/index.d.mts +10 -0
- package/dist/core/cart/quantity.d.mts +10 -0
- package/dist/core/cart/quantity.mjs +14 -0
- package/dist/core/cart/quantity.mjs.map +1 -0
- package/dist/core/cart/queries.d.mts +4296 -0
- package/dist/core/cart/queries.mjs +70 -0
- package/dist/core/cart/queries.mjs.map +1 -0
- package/dist/core/cart/server-handlers.d.mts +82 -0
- package/dist/core/cart/server-handlers.mjs +322 -0
- package/dist/core/cart/server-handlers.mjs.map +1 -0
- package/dist/core/cart/state.d.mts +137 -0
- package/dist/core/cart/state.mjs +76 -0
- package/dist/core/cart/state.mjs.map +1 -0
- package/dist/core/cart/sync-quantity-inputs.mjs +16 -0
- package/dist/core/cart/sync-quantity-inputs.mjs.map +1 -0
- package/dist/core/collection/collection.d.mts +134 -0
- package/dist/core/collection/collection.mjs +170 -0
- package/dist/core/collection/collection.mjs.map +1 -0
- package/dist/core/collection/index.d.mts +6 -0
- package/dist/core/collection/reconciler.d.mts +32 -0
- package/dist/core/collection/reconciler.mjs +89 -0
- package/dist/core/collection/reconciler.mjs.map +1 -0
- package/dist/core/collection/state.d.mts +66 -0
- package/dist/core/collection/state.mjs +20 -0
- package/dist/core/collection/state.mjs.map +1 -0
- package/dist/core/collection/url.d.mts +71 -0
- package/dist/core/collection/url.mjs +376 -0
- package/dist/core/collection/url.mjs.map +1 -0
- package/dist/core/constants.d.mts +5 -0
- package/dist/core/constants.mjs +8 -0
- package/dist/core/constants.mjs.map +1 -0
- package/dist/core/headers.mjs +43 -0
- package/dist/core/headers.mjs.map +1 -0
- package/dist/core/index.d.mts +56 -0
- package/dist/core/index.mjs +45 -0
- package/dist/core/logging/logging.d.mts +21 -0
- package/dist/core/logging/logging.mjs +99 -0
- package/dist/core/logging/logging.mjs.map +1 -0
- package/dist/core/logging/types.d.mts +40 -0
- package/dist/core/logging/types.mjs +18 -0
- package/dist/core/logging/types.mjs.map +1 -0
- package/dist/core/money/cache.mjs +25 -0
- package/dist/core/money/cache.mjs.map +1 -0
- package/dist/core/money/format.d.mts +15 -0
- package/dist/core/money/format.mjs +243 -0
- package/dist/core/money/format.mjs.map +1 -0
- package/dist/core/money/types.d.mts +47 -0
- package/dist/core/observable.mjs +46 -0
- package/dist/core/observable.mjs.map +1 -0
- package/dist/core/predictive-search/constants.d.mts +5 -0
- package/dist/core/predictive-search/constants.mjs +6 -0
- package/dist/core/predictive-search/constants.mjs.map +1 -0
- package/dist/core/predictive-search/form.d.mts +31 -0
- package/dist/core/predictive-search/form.mjs +31 -0
- package/dist/core/predictive-search/form.mjs.map +1 -0
- package/dist/core/predictive-search/index.d.mts +6 -0
- package/dist/core/predictive-search/queries.d.mts +118 -0
- package/dist/core/predictive-search/queries.mjs +81 -0
- package/dist/core/predictive-search/queries.mjs.map +1 -0
- package/dist/core/predictive-search/search.d.mts +32 -0
- package/dist/core/predictive-search/search.mjs +74 -0
- package/dist/core/predictive-search/search.mjs.map +1 -0
- package/dist/core/predictive-search/server-handlers.d.mts +36 -0
- package/dist/core/predictive-search/server-handlers.mjs +113 -0
- package/dist/core/predictive-search/server-handlers.mjs.map +1 -0
- package/dist/core/predictive-search/store.d.mts +44 -0
- package/dist/core/predictive-search/store.mjs +224 -0
- package/dist/core/predictive-search/store.mjs.map +1 -0
- package/dist/core/predictive-search/url.d.mts +41 -0
- package/dist/core/predictive-search/url.mjs +71 -0
- package/dist/core/predictive-search/url.mjs.map +1 -0
- package/dist/core/product/accept-variant-id.mjs +98 -0
- package/dist/core/product/accept-variant-id.mjs.map +1 -0
- package/dist/core/product/form.d.mts +63 -0
- package/dist/core/product/form.mjs +44 -0
- package/dist/core/product/form.mjs.map +1 -0
- package/dist/core/product/index.d.mts +5 -0
- package/dist/core/product/options.d.mts +43 -0
- package/dist/core/product/options.mjs +296 -0
- package/dist/core/product/options.mjs.map +1 -0
- package/dist/core/product/product-form.d.mts +72 -0
- package/dist/core/product/product-form.mjs +158 -0
- package/dist/core/product/product-form.mjs.map +1 -0
- package/dist/core/product/state.d.mts +68 -0
- package/dist/core/product/url.d.mts +47 -0
- package/dist/core/product/url.mjs +69 -0
- package/dist/core/product/url.mjs.map +1 -0
- package/dist/core/request-context.d.mts +75 -0
- package/dist/core/request-context.mjs +141 -0
- package/dist/core/request-context.mjs.map +1 -0
- package/dist/core/request-routing/handle-shopify-redirects.d.mts +17 -0
- package/dist/core/request-routing/handle-shopify-redirects.mjs +31 -0
- package/dist/core/request-routing/handle-shopify-redirects.mjs.map +1 -0
- package/dist/core/request-routing/handle-shopify-routes.d.mts +14 -0
- package/dist/core/request-routing/handle-shopify-routes.mjs +42 -0
- package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/admin-redirect.mjs +12 -0
- package/dist/core/request-routing/interceptors/admin-redirect.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/ajax-api.mjs +16 -0
- package/dist/core/request-routing/interceptors/ajax-api.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/api-proxy.mjs +20 -0
- package/dist/core/request-routing/interceptors/api-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/checkout.mjs +58 -0
- package/dist/core/request-routing/interceptors/checkout.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/mcp-proxy.mjs +23 -0
- package/dist/core/request-routing/interceptors/mcp-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/proxy.mjs +73 -0
- package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/query-param-redirect.mjs +22 -0
- package/dist/core/request-routing/interceptors/query-param-redirect.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/sfapi-proxy.mjs +27 -0
- package/dist/core/request-routing/interceptors/sfapi-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/standard-routes.mjs +19 -0
- package/dist/core/request-routing/interceptors/standard-routes.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/url-redirects.mjs +27 -0
- package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/well-known.mjs +22 -0
- package/dist/core/request-routing/interceptors/well-known.mjs.map +1 -0
- package/dist/core/request-routing/registered-routes.d.mts +7 -0
- package/dist/core/request-routing/registered-routes.mjs +72 -0
- package/dist/core/request-routing/registered-routes.mjs.map +1 -0
- package/dist/core/request-routing/route-types.d.mts +56 -0
- package/dist/core/request-routing/safe-apply-response-headers.mjs +16 -0
- package/dist/core/request-routing/safe-apply-response-headers.mjs.map +1 -0
- package/dist/core/shop-pay/shop-pay.d.mts +102 -0
- package/dist/core/shop-pay/shop-pay.mjs +289 -0
- package/dist/core/shop-pay/shop-pay.mjs.map +1 -0
- package/dist/core/shopify-scripts/analytics.mjs +26 -0
- package/dist/core/shopify-scripts/analytics.mjs.map +1 -0
- package/dist/core/shopify-scripts/consent.mjs +17 -0
- package/dist/core/shopify-scripts/consent.mjs.map +1 -0
- package/dist/core/shopify-scripts/constants.mjs +19 -0
- package/dist/core/shopify-scripts/constants.mjs.map +1 -0
- package/dist/core/shopify-scripts/deprecated-cookies.mjs +97 -0
- package/dist/core/shopify-scripts/deprecated-cookies.mjs.map +1 -0
- package/dist/core/shopify-scripts/global.d.mts +1 -0
- package/dist/core/shopify-scripts/global.mjs +86 -0
- package/dist/core/shopify-scripts/global.mjs.map +1 -0
- package/dist/core/shopify-scripts/index.d.mts +27 -0
- package/dist/core/shopify-scripts/index.mjs +135 -0
- package/dist/core/shopify-scripts/index.mjs.map +1 -0
- package/dist/core/shopify-scripts/initialize.d.mts +18 -0
- package/dist/core/shopify-scripts/initialize.mjs +27 -0
- package/dist/core/shopify-scripts/initialize.mjs.map +1 -0
- package/dist/core/shopify-scripts/page-view.mjs +49 -0
- package/dist/core/shopify-scripts/page-view.mjs.map +1 -0
- package/dist/core/shopify-scripts/perfkit.mjs +33 -0
- package/dist/core/shopify-scripts/perfkit.mjs.map +1 -0
- package/dist/core/shopify-scripts/render.d.mts +1 -0
- package/dist/core/shopify-scripts/render.mjs +23 -0
- package/dist/core/shopify-scripts/render.mjs.map +1 -0
- package/dist/core/shopify-scripts/types.d.mts +76 -0
- package/dist/core/shopify-scripts/utils/cookie-domain.mjs +43 -0
- package/dist/core/shopify-scripts/utils/cookie-domain.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/inline-script.mjs +8 -0
- package/dist/core/shopify-scripts/utils/inline-script.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/navigation.mjs +46 -0
- package/dist/core/shopify-scripts/utils/navigation.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/tracking-values.mjs +65 -0
- package/dist/core/shopify-scripts/utils/tracking-values.mjs.map +1 -0
- package/dist/core/shopify-scripts/utils/uuid.mjs +17 -0
- package/dist/core/shopify-scripts/utils/uuid.mjs.map +1 -0
- package/dist/core/shopify-scripts/webmcp.mjs +22 -0
- package/dist/core/shopify-scripts/webmcp.mjs.map +1 -0
- package/dist/core/standard-routes/build.d.mts +34 -0
- package/dist/core/standard-routes/build.mjs +54 -0
- package/dist/core/standard-routes/build.mjs.map +1 -0
- package/dist/core/standard-routes/defaults.mjs +31 -0
- package/dist/core/standard-routes/defaults.mjs.map +1 -0
- package/dist/core/standard-routes/match.mjs +108 -0
- package/dist/core/standard-routes/match.mjs.map +1 -0
- package/dist/core/standard-routes/path.mjs +58 -0
- package/dist/core/standard-routes/path.mjs.map +1 -0
- package/dist/core/standard-routes/redirects.mjs +51 -0
- package/dist/core/standard-routes/redirects.mjs.map +1 -0
- package/dist/core/standard-routes/types.d.mts +95 -0
- package/dist/core/url.mjs +42 -0
- package/dist/core/url.mjs.map +1 -0
- package/dist/core/utils/load-script.mjs +34 -0
- package/dist/core/utils/load-script.mjs.map +1 -0
- package/dist/core/utils/parse-gid.mjs +33 -0
- package/dist/core/utils/parse-gid.mjs.map +1 -0
- package/dist/core/utils/record.mjs +8 -0
- package/dist/core/utils/record.mjs.map +1 -0
- package/dist/customer-account/client.d.mts +50 -0
- package/dist/customer-account/client.mjs +239 -0
- package/dist/customer-account/client.mjs.map +1 -0
- package/dist/customer-account/errors.d.mts +28 -0
- package/dist/customer-account/errors.mjs +39 -0
- package/dist/customer-account/errors.mjs.map +1 -0
- package/dist/customer-account/graphql.d.mts +29 -0
- package/dist/customer-account/graphql.mjs +39 -0
- package/dist/customer-account/graphql.mjs.map +1 -0
- package/dist/customer-account/index.d.mts +7 -0
- package/dist/customer-account/index.mjs +7 -0
- package/dist/customer-account/session.d.mts +117 -0
- package/dist/customer-account/session.mjs +733 -0
- package/dist/customer-account/session.mjs.map +1 -0
- package/dist/customer-account/type-resolver.d.mts +11 -0
- package/dist/customer-account-api-types.d.ts +3269 -3270
- package/dist/customer-account.schema.json +50753 -1
- package/dist/development/_virtual/_@oxc-project_runtime@0.127.0/helpers/taggedTemplateLiteral.mjs +7 -0
- package/dist/development/client/client.d.mts +34 -0
- package/dist/development/client/client.mjs +206 -0
- package/dist/development/client/client.mjs.map +1 -0
- package/dist/development/client/errors.d.mts +48 -0
- package/dist/development/client/errors.mjs +57 -0
- package/dist/development/client/errors.mjs.map +1 -0
- package/dist/development/client/index.d.mts +4 -0
- package/dist/development/client/types.d.mts +147 -0
- package/dist/development/core/analytics/cart-tracker.d.mts +8 -0
- package/dist/development/core/analytics/cart-tracker.mjs +144 -0
- package/dist/development/core/analytics/cart-tracker.mjs.map +1 -0
- package/dist/development/core/analytics/events.d.mts +15 -0
- package/dist/development/core/analytics/events.mjs +15 -0
- package/dist/development/core/analytics/events.mjs.map +1 -0
- package/dist/development/core/analytics/index.d.mts +3 -0
- package/dist/development/core/analytics/types.d.mts +143 -0
- package/dist/development/core/analytics/utils/flatten-connection.d.mts +19 -0
- package/dist/development/core/analytics/utils/flatten-connection.mjs +25 -0
- package/dist/development/core/analytics/utils/flatten-connection.mjs.map +1 -0
- package/dist/development/core/cache/cache-status.mjs +17 -0
- package/dist/development/core/cache/cache-status.mjs.map +1 -0
- package/dist/development/core/cache/fetch-with-cache.d.mts +43 -0
- package/dist/development/core/cache/fetch-with-cache.mjs +188 -0
- package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -0
- package/dist/development/core/cache/key.d.mts +6 -0
- package/dist/development/core/cache/key.mjs +27 -0
- package/dist/development/core/cache/key.mjs.map +1 -0
- package/dist/development/core/cache/run-with-cache.d.mts +36 -0
- package/dist/development/core/cache/run-with-cache.mjs +114 -0
- package/dist/development/core/cache/run-with-cache.mjs.map +1 -0
- package/dist/development/core/cache/store.d.mts +19 -0
- package/dist/development/core/cache/store.mjs +62 -0
- package/dist/development/core/cache/store.mjs.map +1 -0
- package/dist/development/core/cache/strategies.d.mts +39 -0
- package/dist/development/core/cache/strategies.mjs +70 -0
- package/dist/development/core/cache/strategies.mjs.map +1 -0
- package/dist/development/core/cart/actions.d.mts +50 -0
- package/dist/development/core/cart/actions.mjs +240 -0
- package/dist/development/core/cart/actions.mjs.map +1 -0
- package/dist/development/core/cart/attach-quantity-input.d.mts +5 -0
- package/dist/development/core/cart/attach-quantity-input.mjs +17 -0
- package/dist/development/core/cart/attach-quantity-input.mjs.map +1 -0
- package/dist/development/core/cart/buyer-identity-sync.d.mts +19 -0
- package/dist/development/core/cart/buyer-identity-sync.mjs +6 -0
- package/dist/development/core/cart/buyer-identity-sync.mjs.map +1 -0
- package/dist/development/core/cart/cart.d.mts +37 -0
- package/dist/development/core/cart/cart.mjs +1707 -0
- package/dist/development/core/cart/cart.mjs.map +1 -0
- package/dist/development/core/cart/cookie.d.mts +5 -0
- package/dist/development/core/cart/cookie.mjs +28 -0
- package/dist/development/core/cart/cookie.mjs.map +1 -0
- package/dist/development/core/cart/form.d.mts +130 -0
- package/dist/development/core/cart/form.mjs +75 -0
- package/dist/development/core/cart/form.mjs.map +1 -0
- package/dist/development/core/cart/get-cart.d.mts +25 -0
- package/dist/development/core/cart/get-cart.mjs +32 -0
- package/dist/development/core/cart/get-cart.mjs.map +1 -0
- package/dist/development/core/cart/index.d.mts +10 -0
- package/dist/development/core/cart/quantity.d.mts +10 -0
- package/dist/development/core/cart/quantity.mjs +14 -0
- package/dist/development/core/cart/quantity.mjs.map +1 -0
- package/dist/development/core/cart/queries.d.mts +4296 -0
- package/dist/development/core/cart/queries.mjs +70 -0
- package/dist/development/core/cart/queries.mjs.map +1 -0
- package/dist/development/core/cart/server-handlers.d.mts +82 -0
- package/dist/development/core/cart/server-handlers.mjs +322 -0
- package/dist/development/core/cart/server-handlers.mjs.map +1 -0
- package/dist/development/core/cart/state.d.mts +137 -0
- package/dist/development/core/cart/state.mjs +76 -0
- package/dist/development/core/cart/state.mjs.map +1 -0
- package/dist/development/core/cart/sync-quantity-inputs.mjs +16 -0
- package/dist/development/core/cart/sync-quantity-inputs.mjs.map +1 -0
- package/dist/development/core/collection/collection.d.mts +134 -0
- package/dist/development/core/collection/collection.mjs +170 -0
- package/dist/development/core/collection/collection.mjs.map +1 -0
- package/dist/development/core/collection/index.d.mts +6 -0
- package/dist/development/core/collection/reconciler.d.mts +32 -0
- package/dist/development/core/collection/reconciler.mjs +89 -0
- package/dist/development/core/collection/reconciler.mjs.map +1 -0
- package/dist/development/core/collection/state.d.mts +66 -0
- package/dist/development/core/collection/state.mjs +20 -0
- package/dist/development/core/collection/state.mjs.map +1 -0
- package/dist/development/core/collection/url.d.mts +71 -0
- package/dist/development/core/collection/url.mjs +376 -0
- package/dist/development/core/collection/url.mjs.map +1 -0
- package/dist/development/core/constants.mjs +7 -0
- package/dist/development/core/constants.mjs.map +1 -0
- package/dist/development/core/development.d.mts +56 -0
- package/dist/development/core/development.mjs +45 -0
- package/dist/development/core/headers.mjs +43 -0
- package/dist/development/core/headers.mjs.map +1 -0
- package/dist/development/core/index.d.mts +54 -0
- package/dist/development/core/logging/logging.d.mts +21 -0
- package/dist/development/core/logging/logging.mjs +99 -0
- package/dist/development/core/logging/logging.mjs.map +1 -0
- package/dist/development/core/logging/types.d.mts +40 -0
- package/dist/development/core/logging/types.mjs +18 -0
- package/dist/development/core/logging/types.mjs.map +1 -0
- package/dist/development/core/money/cache.mjs +25 -0
- package/dist/development/core/money/cache.mjs.map +1 -0
- package/dist/development/core/money/format.d.mts +15 -0
- package/dist/development/core/money/format.mjs +243 -0
- package/dist/development/core/money/format.mjs.map +1 -0
- package/dist/development/core/money/types.d.mts +47 -0
- package/dist/development/core/observable.mjs +46 -0
- package/dist/development/core/observable.mjs.map +1 -0
- package/dist/development/core/predictive-search/constants.d.mts +5 -0
- package/dist/development/core/predictive-search/constants.mjs +6 -0
- package/dist/development/core/predictive-search/constants.mjs.map +1 -0
- package/dist/development/core/predictive-search/form.d.mts +31 -0
- package/dist/development/core/predictive-search/form.mjs +31 -0
- package/dist/development/core/predictive-search/form.mjs.map +1 -0
- package/dist/development/core/predictive-search/index.d.mts +6 -0
- package/dist/development/core/predictive-search/queries.d.mts +118 -0
- package/dist/development/core/predictive-search/queries.mjs +81 -0
- package/dist/development/core/predictive-search/queries.mjs.map +1 -0
- package/dist/development/core/predictive-search/search.d.mts +32 -0
- package/dist/development/core/predictive-search/search.mjs +74 -0
- package/dist/development/core/predictive-search/search.mjs.map +1 -0
- package/dist/development/core/predictive-search/server-handlers.d.mts +36 -0
- package/dist/development/core/predictive-search/server-handlers.mjs +113 -0
- package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -0
- package/dist/development/core/predictive-search/store.d.mts +44 -0
- package/dist/development/core/predictive-search/store.mjs +224 -0
- package/dist/development/core/predictive-search/store.mjs.map +1 -0
- package/dist/development/core/predictive-search/url.d.mts +41 -0
- package/dist/development/core/predictive-search/url.mjs +71 -0
- package/dist/development/core/predictive-search/url.mjs.map +1 -0
- package/dist/development/core/product/accept-variant-id.mjs +98 -0
- package/dist/development/core/product/accept-variant-id.mjs.map +1 -0
- package/dist/development/core/product/form.d.mts +63 -0
- package/dist/development/core/product/form.mjs +44 -0
- package/dist/development/core/product/form.mjs.map +1 -0
- package/dist/development/core/product/index.d.mts +5 -0
- package/dist/development/core/product/options.d.mts +43 -0
- package/dist/development/core/product/options.mjs +296 -0
- package/dist/development/core/product/options.mjs.map +1 -0
- package/dist/development/core/product/product-form.d.mts +72 -0
- package/dist/development/core/product/product-form.mjs +158 -0
- package/dist/development/core/product/product-form.mjs.map +1 -0
- package/dist/development/core/product/state.d.mts +68 -0
- package/dist/development/core/product/url.d.mts +47 -0
- package/dist/development/core/product/url.mjs +69 -0
- package/dist/development/core/product/url.mjs.map +1 -0
- package/dist/development/core/request-context.d.mts +75 -0
- package/dist/development/core/request-context.mjs +141 -0
- package/dist/development/core/request-context.mjs.map +1 -0
- package/dist/development/core/request-routing/handle-shopify-redirects.d.mts +17 -0
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs +31 -0
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs.map +1 -0
- package/dist/development/core/request-routing/handle-shopify-routes.d.mts +1 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.d.mts +11 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs +16 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs.map +1 -0
- package/dist/development/core/request-routing/handle-shopify-routes.mjs +42 -0
- package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/admin-redirect.mjs +12 -0
- package/dist/development/core/request-routing/interceptors/admin-redirect.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/ajax-api.mjs +16 -0
- package/dist/development/core/request-routing/interceptors/ajax-api.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/api-proxy.mjs +20 -0
- package/dist/development/core/request-routing/interceptors/api-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/checkout.mjs +58 -0
- package/dist/development/core/request-routing/interceptors/checkout.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/graphiql.mjs +46 -0
- package/dist/development/core/request-routing/interceptors/graphiql.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/mcp-proxy.mjs +23 -0
- package/dist/development/core/request-routing/interceptors/mcp-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/proxy.mjs +73 -0
- package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/query-param-redirect.mjs +22 -0
- package/dist/development/core/request-routing/interceptors/query-param-redirect.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/sfapi-proxy.mjs +27 -0
- package/dist/development/core/request-routing/interceptors/sfapi-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/standard-routes.mjs +19 -0
- package/dist/development/core/request-routing/interceptors/standard-routes.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs +27 -0
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/well-known.mjs +22 -0
- package/dist/development/core/request-routing/interceptors/well-known.mjs.map +1 -0
- package/dist/development/core/request-routing/registered-routes.d.mts +7 -0
- package/dist/development/core/request-routing/registered-routes.mjs +72 -0
- package/dist/development/core/request-routing/registered-routes.mjs.map +1 -0
- package/dist/development/core/request-routing/route-types.d.mts +56 -0
- package/dist/development/core/request-routing/safe-apply-response-headers.mjs +16 -0
- package/dist/development/core/request-routing/safe-apply-response-headers.mjs.map +1 -0
- package/dist/development/core/shop-pay/shop-pay.d.mts +102 -0
- package/dist/development/core/shop-pay/shop-pay.mjs +289 -0
- package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/analytics.mjs +26 -0
- package/dist/development/core/shopify-scripts/analytics.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/consent.mjs +17 -0
- package/dist/development/core/shopify-scripts/consent.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/constants.mjs +19 -0
- package/dist/development/core/shopify-scripts/constants.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/deprecated-cookies.mjs +97 -0
- package/dist/development/core/shopify-scripts/deprecated-cookies.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/global.d.mts +1 -0
- package/dist/development/core/shopify-scripts/global.mjs +86 -0
- package/dist/development/core/shopify-scripts/global.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/index.d.mts +27 -0
- package/dist/development/core/shopify-scripts/index.mjs +145 -0
- package/dist/development/core/shopify-scripts/index.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/initialize.d.mts +18 -0
- package/dist/development/core/shopify-scripts/initialize.mjs +27 -0
- package/dist/development/core/shopify-scripts/initialize.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/page-view.mjs +49 -0
- package/dist/development/core/shopify-scripts/page-view.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/perfkit.mjs +33 -0
- package/dist/development/core/shopify-scripts/perfkit.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/render.d.mts +1 -0
- package/dist/development/core/shopify-scripts/render.mjs +23 -0
- package/dist/development/core/shopify-scripts/render.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/types.d.mts +76 -0
- package/dist/development/core/shopify-scripts/utils/cookie-domain.mjs +43 -0
- package/dist/development/core/shopify-scripts/utils/cookie-domain.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/inline-script.mjs +8 -0
- package/dist/development/core/shopify-scripts/utils/inline-script.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/navigation.mjs +46 -0
- package/dist/development/core/shopify-scripts/utils/navigation.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/tracking-values.mjs +65 -0
- package/dist/development/core/shopify-scripts/utils/tracking-values.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/utils/uuid.mjs +17 -0
- package/dist/development/core/shopify-scripts/utils/uuid.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/webmcp.mjs +22 -0
- package/dist/development/core/shopify-scripts/webmcp.mjs.map +1 -0
- package/dist/development/core/standard-routes/build.d.mts +34 -0
- package/dist/development/core/standard-routes/build.mjs +54 -0
- package/dist/development/core/standard-routes/build.mjs.map +1 -0
- package/dist/development/core/standard-routes/defaults.mjs +31 -0
- package/dist/development/core/standard-routes/defaults.mjs.map +1 -0
- package/dist/development/core/standard-routes/match.mjs +108 -0
- package/dist/development/core/standard-routes/match.mjs.map +1 -0
- package/dist/development/core/standard-routes/path.mjs +58 -0
- package/dist/development/core/standard-routes/path.mjs.map +1 -0
- package/dist/development/core/standard-routes/redirects.mjs +51 -0
- package/dist/development/core/standard-routes/redirects.mjs.map +1 -0
- package/dist/development/core/standard-routes/types.d.mts +95 -0
- package/dist/development/core/types.d.mts +11 -0
- package/dist/development/core/url.mjs +42 -0
- package/dist/development/core/url.mjs.map +1 -0
- package/dist/development/core/utils/load-script.mjs +34 -0
- package/dist/development/core/utils/load-script.mjs.map +1 -0
- package/dist/development/core/utils/parse-gid.mjs +33 -0
- package/dist/development/core/utils/parse-gid.mjs.map +1 -0
- package/dist/development/customer-account/session.d.mts +46 -0
- package/dist/development/customer-account/session.mjs +21 -0
- package/dist/development/customer-account/session.mjs.map +1 -0
- package/dist/development/globals.d.mts +64 -0
- package/dist/development/graphql/generated/customer-account-api-types.d.mts +13 -0
- package/dist/development/graphql/generated/graphql-env.d.mts +19280 -0
- package/dist/development/graphql/generated/storefront-api-types.d.mts +47 -0
- package/dist/development/graphql/graphql.d.mts +40 -0
- package/dist/development/graphql/graphql.mjs +16 -0
- package/dist/development/graphql/graphql.mjs.map +1 -0
- package/dist/development/graphql/index.d.mts +2 -0
- package/dist/development/graphql/scalars.d.mts +15 -0
- package/dist/development/graphql/type-resolver.d.mts +229 -0
- package/dist/development/react/cart.d.mts +44 -0
- package/dist/development/react/cart.mjs +155 -0
- package/dist/development/react/cart.mjs.map +1 -0
- package/dist/development/react/collection.d.mts +91 -0
- package/dist/development/react/collection.mjs +129 -0
- package/dist/development/react/collection.mjs.map +1 -0
- package/dist/development/react/index.d.mts +13 -0
- package/dist/development/react/index.mjs +10 -0
- package/dist/development/react/predictive-search.d.mts +49 -0
- package/dist/development/react/predictive-search.mjs +133 -0
- package/dist/development/react/predictive-search.mjs.map +1 -0
- package/dist/development/react/product.d.mts +72 -0
- package/dist/development/react/product.mjs +127 -0
- package/dist/development/react/product.mjs.map +1 -0
- package/dist/development/react/shop-pay.d.mts +9 -0
- package/dist/development/react/shop-pay.mjs +16 -0
- package/dist/development/react/shop-pay.mjs.map +1 -0
- package/dist/development/react/shopify-scripts.d.mts +20 -0
- package/dist/development/react/shopify-scripts.mjs +39 -0
- package/dist/development/react/shopify-scripts.mjs.map +1 -0
- package/dist/development/vendor/standard-actions.d.mts +134 -0
- package/dist/development/vendor/standard-events.d.mts +1107 -0
- package/dist/development/vue/cart.d.mts +46 -0
- package/dist/development/vue/cart.mjs +122 -0
- package/dist/development/vue/cart.mjs.map +1 -0
- package/dist/development/vue/collection.d.mts +46 -0
- package/dist/development/vue/collection.mjs +108 -0
- package/dist/development/vue/collection.mjs.map +1 -0
- package/dist/development/vue/index.d.mts +11 -0
- package/dist/development/vue/index.mjs +8 -0
- package/dist/development/vue/predictive-search.d.mts +124 -0
- package/dist/development/vue/predictive-search.mjs +171 -0
- package/dist/development/vue/predictive-search.mjs.map +1 -0
- package/dist/development/vue/product.d.mts +57 -0
- package/dist/development/vue/product.mjs +167 -0
- package/dist/development/vue/product.mjs.map +1 -0
- package/dist/development/vue/shop-pay.d.mts +25 -0
- package/dist/development/vue/shop-pay.mjs +35 -0
- package/dist/development/vue/shop-pay.mjs.map +1 -0
- package/dist/development/vue/shopify-scripts.d.mts +127 -0
- package/dist/development/vue/shopify-scripts.mjs +79 -0
- package/dist/development/vue/shopify-scripts.mjs.map +1 -0
- package/dist/globals.d.mts +64 -0
- package/dist/graphql/generated/customer-account-api-types.d.mts +13 -0
- package/dist/graphql/generated/customer-account-graphql-env.d.mts +22170 -0
- package/dist/graphql/generated/graphql-env.d.mts +19280 -0
- package/dist/graphql/generated/storefront-api-types.d.mts +47 -0
- package/dist/graphql/graphql.d.mts +40 -0
- package/dist/graphql/graphql.mjs +16 -0
- package/dist/graphql/graphql.mjs.map +1 -0
- package/dist/graphql/index.d.mts +2 -0
- package/dist/graphql/scalars.d.mts +26 -0
- package/dist/graphql/type-resolver.d.mts +229 -0
- package/dist/react/cart.d.mts +44 -0
- package/dist/react/cart.mjs +155 -0
- package/dist/react/cart.mjs.map +1 -0
- package/dist/react/collection.d.mts +91 -0
- package/dist/react/collection.mjs +129 -0
- package/dist/react/collection.mjs.map +1 -0
- package/dist/react/index.d.mts +13 -0
- package/dist/react/index.mjs +10 -0
- package/dist/react/predictive-search.d.mts +49 -0
- package/dist/react/predictive-search.mjs +133 -0
- package/dist/react/predictive-search.mjs.map +1 -0
- package/dist/react/product.d.mts +72 -0
- package/dist/react/product.mjs +127 -0
- package/dist/react/product.mjs.map +1 -0
- package/dist/react/shop-pay.d.mts +9 -0
- package/dist/react/shop-pay.mjs +16 -0
- package/dist/react/shop-pay.mjs.map +1 -0
- package/dist/react/shopify-scripts.d.mts +20 -0
- package/dist/react/shopify-scripts.mjs +39 -0
- package/dist/react/shopify-scripts.mjs.map +1 -0
- package/dist/storefront-api-types.d.ts +2351 -2390
- package/dist/storefront.schema.json +41534 -1
- package/dist/ts-plugin/index.cjs +68 -0
- package/dist/ts-plugin/index.cjs.map +1 -0
- package/dist/ts-plugin/index.d.cts +4 -0
- package/dist/vendor/standard-actions.d.mts +134 -0
- package/dist/vendor/standard-events.d.mts +1107 -0
- package/dist/vite/certificate-prompt.mjs +24 -0
- package/dist/vite/certificate-prompt.mjs.map +1 -0
- package/dist/vite/index.d.mts +2 -0
- package/dist/vite/index.mjs +3 -0
- package/dist/vite/local-https.d.mts +47 -0
- package/dist/vite/local-https.mjs +276 -0
- package/dist/vite/local-https.mjs.map +1 -0
- package/dist/vite/mkcert.mjs +141 -0
- package/dist/vite/mkcert.mjs.map +1 -0
- package/dist/vue/cart.d.mts +46 -0
- package/dist/vue/cart.mjs +122 -0
- package/dist/vue/cart.mjs.map +1 -0
- package/dist/vue/collection.d.mts +46 -0
- package/dist/vue/collection.mjs +108 -0
- package/dist/vue/collection.mjs.map +1 -0
- package/dist/vue/index.d.mts +11 -0
- package/dist/vue/index.mjs +8 -0
- package/dist/vue/predictive-search.d.mts +124 -0
- package/dist/vue/predictive-search.mjs +171 -0
- package/dist/vue/predictive-search.mjs.map +1 -0
- package/dist/vue/product.d.mts +57 -0
- package/dist/vue/product.mjs +167 -0
- package/dist/vue/product.mjs.map +1 -0
- package/dist/vue/shop-pay.d.mts +25 -0
- package/dist/vue/shop-pay.mjs +35 -0
- package/dist/vue/shop-pay.mjs.map +1 -0
- package/dist/vue/shopify-scripts.d.mts +127 -0
- package/dist/vue/shopify-scripts.mjs +79 -0
- package/dist/vue/shopify-scripts.mjs.map +1 -0
- package/package.json +116 -86
- package/skills/hydrogen-analytics/SKILL.md +80 -0
- package/skills/hydrogen-analytics/references/react.md +160 -0
- package/skills/hydrogen-analytics/references/vue.md +80 -0
- package/skills/hydrogen-cart-drawer/SKILL.md +248 -0
- package/skills/hydrogen-cart-drawer/references/accessibility.md +109 -0
- package/skills/hydrogen-cart-drawer/references/css.md +67 -0
- package/skills/hydrogen-cart-ui/SKILL.md +224 -0
- package/skills/hydrogen-cart-ui/references/nextjs.md +89 -0
- package/skills/hydrogen-cart-ui/references/react.md +285 -0
- package/skills/hydrogen-cart-ui/references/vue.md +228 -0
- package/skills/hydrogen-collection-browser/SKILL.md +83 -0
- package/skills/hydrogen-collection-browser/references/nextjs.md +118 -0
- package/skills/hydrogen-collection-browser/references/nuxt.md +108 -0
- package/skills/hydrogen-collection-browser/references/react.md +301 -0
- package/skills/hydrogen-customer-account/SKILL.md +107 -0
- package/skills/hydrogen-image/SKILL.md +65 -0
- package/skills/hydrogen-local-https/SKILL.md +142 -0
- package/skills/hydrogen-markets/SKILL.md +221 -0
- package/skills/hydrogen-markets/references/nextjs.md +157 -0
- package/skills/hydrogen-money/SKILL.md +67 -0
- package/skills/hydrogen-oxygen/SKILL.md +245 -0
- package/skills/hydrogen-oxygen/references/react-router.md +230 -0
- package/skills/hydrogen-predictive-search/SKILL.md +130 -0
- package/skills/hydrogen-predictive-search/references/react.md +32 -0
- package/skills/hydrogen-predictive-search/references/vue.md +40 -0
- package/skills/hydrogen-request-handlers/SKILL.md +107 -0
- package/skills/hydrogen-request-handlers/references/frameworks.md +179 -0
- package/skills/hydrogen-request-handlers/references/nextjs.md +137 -0
- package/skills/hydrogen-request-handlers/references/nuxt.md +215 -0
- package/skills/hydrogen-routing/SKILL.md +171 -0
- package/skills/hydrogen-setup/SKILL.md +50 -0
- package/skills/hydrogen-setup/references/analytics.md +624 -0
- package/skills/hydrogen-setup/steps/1-inspect-app.md +62 -0
- package/skills/hydrogen-setup/steps/10-analytics.md +10 -0
- package/skills/hydrogen-setup/steps/11-verify.md +31 -0
- package/skills/hydrogen-setup/steps/2-scaffold.md +86 -0
- package/skills/hydrogen-setup/steps/3-build-home-page.md +37 -0
- package/skills/hydrogen-setup/steps/4-collection-and-search.md +14 -0
- package/skills/hydrogen-setup/steps/5-cart.md +10 -0
- package/skills/hydrogen-setup/steps/6-product-detail-page.md +416 -0
- package/skills/hydrogen-setup/steps/7-shopify-runtime-scripts.md +69 -0
- package/skills/hydrogen-setup/steps/8-cart-drawer-and-navbar.md +35 -0
- package/skills/hydrogen-setup/steps/9-account-page.md +54 -0
- package/skills/hydrogen-shop-pay/SKILL.md +79 -0
- package/skills/hydrogen-shop-pay/references/core.md +66 -0
- package/skills/hydrogen-shop-pay/references/react.md +50 -0
- package/skills/hydrogen-shop-pay/references/vue.md +39 -0
- package/skills/hydrogen-smoke-test/SKILL.md +205 -0
- package/skills/hydrogen-storefront-client/SKILL.md +322 -0
- package/skills/hydrogen-storefront-client/references/astro.md +125 -0
- package/skills/hydrogen-storefront-client/references/caching.md +25 -0
- package/skills/hydrogen-storefront-client/references/nextjs.md +121 -0
- package/skills/hydrogen-storefront-client/references/nuxt.md +121 -0
- package/skills/hydrogen-storefront-client/references/query-validation.md +95 -0
- package/skills/hydrogen-storefront-client/references/react-router.md +81 -0
- package/skills/hydrogen-storefront-client/references/solidstart.md +131 -0
- package/skills/hydrogen-storefront-client/references/sveltekit.md +169 -0
- package/skills/hydrogen-variant-form/SKILL.md +267 -0
- package/skills/hydrogen-variant-form/references/nextjs.md +207 -0
- package/skills/hydrogen-variant-form/references/nuxt.md +95 -0
- package/skills/hydrogen-variant-form/references/react.md +71 -0
- package/dist/dev/get-virtual-routes-H72465VB.js +0 -74
- package/dist/dev/hydrogen-routes.d.ts +0 -5
- package/dist/dev/hydrogen-routes.js +0 -25
- package/dist/development/get-virtual-routes-ACFZHU42.js +0 -71
- package/dist/development/get-virtual-routes-ACFZHU42.js.map +0 -1
- package/dist/development/index.cjs +0 -6978
- package/dist/development/index.cjs.map +0 -1
- package/dist/development/index.js +0 -6631
- package/dist/development/index.js.map +0 -1
- package/dist/development/log-seo-tags-IG37ONQ2.js +0 -74
- package/dist/development/log-seo-tags-IG37ONQ2.js.map +0 -1
- package/dist/development/react-router-preset.d.ts +0 -45
- package/dist/development/react-router-preset.js +0 -49
- package/dist/development/react-router-preset.js.map +0 -1
- package/dist/index.cjs +0 -1
- package/dist/oxygen/index.d.ts +0 -197
- package/dist/oxygen/index.js +0 -107
- package/dist/production/get-virtual-routes-ZZEGQQDV.js +0 -3
- package/dist/production/get-virtual-routes-ZZEGQQDV.js.map +0 -1
- package/dist/production/index.cjs +0 -1019
- package/dist/production/index.cjs.map +0 -1
- package/dist/production/index.d.cts +0 -3260
- package/dist/production/index.d.ts +0 -3260
- package/dist/production/index.js +0 -1019
- package/dist/production/index.js.map +0 -1
- package/dist/production/log-seo-tags-TY72EQWZ.js +0 -2
- package/dist/production/log-seo-tags-TY72EQWZ.js.map +0 -1
- package/dist/production/react-router-preset.d.ts +0 -45
- package/dist/production/react-router-preset.js +0 -11
- package/dist/react-router.d.ts +0 -75
- package/dist/vite/chunk-4O5OI3OO.js +0 -127
- package/dist/vite/chunk-FAQ7TVHC.js +0 -9
- package/dist/vite/chunk-QXBQVDMY.js +0 -68
- package/dist/vite/compat-date.d.ts +0 -3
- package/dist/vite/compat-date.js +0 -6
- package/dist/vite/get-virtual-routes.d.ts +0 -21
- package/dist/vite/get-virtual-routes.js +0 -74
- package/dist/vite/hydrogen-middleware.d.ts +0 -9
- package/dist/vite/hydrogen-middleware.js +0 -7
- package/dist/vite/plugin.d.ts +0 -22
- package/dist/vite/plugin.js +0 -171
- package/dist/vite/request-events.d.ts +0 -144
- package/dist/vite/request-events.js +0 -10
- package/dist/vite/types.d.ts +0 -5
- package/dist/vite/types.js +0 -0
- package/dist/vite/virtual-routes/assets/debug-network.css +0 -609
- package/dist/vite/virtual-routes/assets/favicon-dark.svg +0 -20
- package/dist/vite/virtual-routes/assets/favicon.svg +0 -28
- package/dist/vite/virtual-routes/assets/inter-variable-font.woff2 +0 -0
- package/dist/vite/virtual-routes/assets/jetbrainsmono-variable-font.woff2 +0 -0
- package/dist/vite/virtual-routes/assets/styles.css +0 -249
- package/dist/vite/virtual-routes/components/FlameChartWrapper.jsx +0 -123
- package/dist/vite/virtual-routes/components/HydrogenLogoBaseBW.jsx +0 -32
- package/dist/vite/virtual-routes/components/HydrogenLogoBaseColor.jsx +0 -47
- package/dist/vite/virtual-routes/components/IconBanner.jsx +0 -292
- package/dist/vite/virtual-routes/components/IconClose.jsx +0 -38
- package/dist/vite/virtual-routes/components/IconDiscard.jsx +0 -44
- package/dist/vite/virtual-routes/components/IconError.jsx +0 -61
- package/dist/vite/virtual-routes/components/IconGithub.jsx +0 -23
- package/dist/vite/virtual-routes/components/IconTwitter.jsx +0 -21
- package/dist/vite/virtual-routes/components/Layout.jsx +0 -7
- package/dist/vite/virtual-routes/components/RequestDetails.jsx +0 -171
- package/dist/vite/virtual-routes/components/RequestTable.jsx +0 -91
- package/dist/vite/virtual-routes/components/RequestWaterfall.jsx +0 -151
- package/dist/vite/virtual-routes/layout.jsx +0 -33
- package/dist/vite/virtual-routes/lib/useDebugNetworkServer.jsx +0 -178
- package/dist/vite/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.jsx +0 -37
- package/dist/vite/virtual-routes/routes/[.]well-known.appspecific.com[.]chrome[.]devtools[.]json.tsx +0 -79
- package/dist/vite/virtual-routes/routes/graphiql.jsx +0 -5
- package/dist/vite/virtual-routes/routes/index.jsx +0 -265
- package/dist/vite/virtual-routes/routes/subrequest-profiler.jsx +0 -243
- package/dist/vite/virtual-routes/virtual-root-with-layout.jsx +0 -63
- package/dist/vite/virtual-routes/virtual-root.jsx +0 -67
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/core/standard-routes/path.ts
|
|
2
|
+
function prependPathPrefix(pathname, pathPrefix) {
|
|
3
|
+
const normalizedPathPrefix = normalizePathPrefix(pathPrefix);
|
|
4
|
+
if (!normalizedPathPrefix) return pathname;
|
|
5
|
+
return `${normalizedPathPrefix}/${pathname.replace(/^\/+/, "")}`;
|
|
6
|
+
}
|
|
7
|
+
function normalizePathPrefix(pathPrefix) {
|
|
8
|
+
if (!pathPrefix) return "";
|
|
9
|
+
const trimmedPathPrefix = pathPrefix.trim().replace(/^\/+|\/+$/g, "");
|
|
10
|
+
return trimmedPathPrefix ? `/${trimmedPathPrefix}` : "";
|
|
11
|
+
}
|
|
12
|
+
function parseUrl(url, baseUrl) {
|
|
13
|
+
try {
|
|
14
|
+
return new URL(url, baseUrl ?? "https://shopify.local");
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Parses a URL and rejects absolute URLs that do not share `baseUrl`'s origin.
|
|
21
|
+
*
|
|
22
|
+
* Relative URLs are resolved against `baseUrl` when provided, or against a throwaway local origin
|
|
23
|
+
* when no base is available.
|
|
24
|
+
*/
|
|
25
|
+
function parseSameOriginUrl(url, baseUrl) {
|
|
26
|
+
const parsedUrl = parseUrl(url, baseUrl);
|
|
27
|
+
if (!parsedUrl) return null;
|
|
28
|
+
const parsedBaseUrl = baseUrl ? parseUrl(baseUrl, void 0) : null;
|
|
29
|
+
if (parsedBaseUrl && parsedUrl.origin !== parsedBaseUrl.origin) return null;
|
|
30
|
+
return parsedUrl;
|
|
31
|
+
}
|
|
32
|
+
function isAbsoluteUrl(url) {
|
|
33
|
+
return /^[A-Za-z][A-Za-z0-9+.-]*:/.test(url);
|
|
34
|
+
}
|
|
35
|
+
function stripTrailingSlash(pathname) {
|
|
36
|
+
if (pathname === "/") return pathname;
|
|
37
|
+
return pathname.replace(/\/+$/, "");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Removes the locale prefix before matching route templates.
|
|
41
|
+
*
|
|
42
|
+
* `ShopifyScripts` stores `routes.root` with a trailing slash, while server i18n uses
|
|
43
|
+
* `pathPrefix`; both are normalized here so `/fr-ca/products/snowboard` can match the same
|
|
44
|
+
* template as `/products/snowboard`.
|
|
45
|
+
*/
|
|
46
|
+
function stripI18nPathPrefix(pathname, pathPrefix) {
|
|
47
|
+
const normalizedPathPrefix = normalizePathPrefix(pathPrefix);
|
|
48
|
+
if (!normalizedPathPrefix) return pathname;
|
|
49
|
+
const lowerPathname = pathname.toLowerCase();
|
|
50
|
+
const lowerPathPrefix = normalizedPathPrefix.toLowerCase();
|
|
51
|
+
if (lowerPathname === lowerPathPrefix) return "/";
|
|
52
|
+
if (!lowerPathname.startsWith(`${lowerPathPrefix}/`)) return pathname;
|
|
53
|
+
return pathname.slice(normalizedPathPrefix.length) || "/";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { isAbsoluteUrl, normalizePathPrefix, parseSameOriginUrl, prependPathPrefix, stripI18nPathPrefix, stripTrailingSlash };
|
|
58
|
+
//# sourceMappingURL=path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.mjs","names":[],"sources":["../../../src/core/standard-routes/path.ts"],"sourcesContent":["export function prependPathPrefix(pathname: string, pathPrefix: string | undefined): string {\n const normalizedPathPrefix = normalizePathPrefix(pathPrefix);\n if (!normalizedPathPrefix) return pathname;\n\n return `${normalizedPathPrefix}/${pathname.replace(/^\\/+/, \"\")}`;\n}\n\nexport function normalizePathPrefix(pathPrefix: string | undefined): string {\n if (!pathPrefix) return \"\";\n\n const trimmedPathPrefix = pathPrefix.trim().replace(/^\\/+|\\/+$/g, \"\");\n return trimmedPathPrefix ? `/${trimmedPathPrefix}` : \"\";\n}\n\nfunction parseUrl(url: string, baseUrl: string | undefined): URL | null {\n try {\n return new URL(url, baseUrl ?? \"https://shopify.local\");\n } catch {\n return null;\n }\n}\n\n/**\n * Parses a URL and rejects absolute URLs that do not share `baseUrl`'s origin.\n *\n * Relative URLs are resolved against `baseUrl` when provided, or against a throwaway local origin\n * when no base is available.\n */\nexport function parseSameOriginUrl(url: string, baseUrl: string | undefined): URL | null {\n const parsedUrl = parseUrl(url, baseUrl);\n if (!parsedUrl) return null;\n\n const parsedBaseUrl = baseUrl ? parseUrl(baseUrl, undefined) : null;\n if (parsedBaseUrl && parsedUrl.origin !== parsedBaseUrl.origin) return null;\n\n return parsedUrl;\n}\n\nexport function isAbsoluteUrl(url: string): boolean {\n return /^[A-Za-z][A-Za-z0-9+.-]*:/.test(url);\n}\n\nexport function stripTrailingSlash(pathname: string): string {\n if (pathname === \"/\") return pathname;\n return pathname.replace(/\\/+$/, \"\");\n}\n\n/**\n * Removes the locale prefix before matching route templates.\n *\n * `ShopifyScripts` stores `routes.root` with a trailing slash, while server i18n uses\n * `pathPrefix`; both are normalized here so `/fr-ca/products/snowboard` can match the same\n * template as `/products/snowboard`.\n */\nexport function stripI18nPathPrefix(pathname: string, pathPrefix: string | undefined): string {\n const normalizedPathPrefix = normalizePathPrefix(pathPrefix);\n if (!normalizedPathPrefix) return pathname;\n\n const lowerPathname = pathname.toLowerCase();\n const lowerPathPrefix = normalizedPathPrefix.toLowerCase();\n\n if (lowerPathname === lowerPathPrefix) return \"/\";\n if (!lowerPathname.startsWith(`${lowerPathPrefix}/`)) return pathname;\n\n return pathname.slice(normalizedPathPrefix.length) || \"/\";\n}\n"],"mappings":";AAAA,SAAgB,kBAAkB,UAAkB,YAAwC;CAC1F,MAAM,uBAAuB,oBAAoB,WAAW;AAC5D,KAAI,CAAC,qBAAsB,QAAO;AAElC,QAAO,GAAG,qBAAqB,GAAG,SAAS,QAAQ,QAAQ,GAAG;;AAGhE,SAAgB,oBAAoB,YAAwC;AAC1E,KAAI,CAAC,WAAY,QAAO;CAExB,MAAM,oBAAoB,WAAW,MAAM,CAAC,QAAQ,cAAc,GAAG;AACrE,QAAO,oBAAoB,IAAI,sBAAsB;;AAGvD,SAAS,SAAS,KAAa,SAAyC;AACtE,KAAI;AACF,SAAO,IAAI,IAAI,KAAK,WAAW,wBAAwB;SACjD;AACN,SAAO;;;;;;;;;AAUX,SAAgB,mBAAmB,KAAa,SAAyC;CACvF,MAAM,YAAY,SAAS,KAAK,QAAQ;AACxC,KAAI,CAAC,UAAW,QAAO;CAEvB,MAAM,gBAAgB,UAAU,SAAS,SAAS,OAAU,GAAG;AAC/D,KAAI,iBAAiB,UAAU,WAAW,cAAc,OAAQ,QAAO;AAEvE,QAAO;;AAGT,SAAgB,cAAc,KAAsB;AAClD,QAAO,4BAA4B,KAAK,IAAI;;AAG9C,SAAgB,mBAAmB,UAA0B;AAC3D,KAAI,aAAa,IAAK,QAAO;AAC7B,QAAO,SAAS,QAAQ,QAAQ,GAAG;;;;;;;;;AAUrC,SAAgB,oBAAoB,UAAkB,YAAwC;CAC5F,MAAM,uBAAuB,oBAAoB,WAAW;AAC5D,KAAI,CAAC,qBAAsB,QAAO;CAElC,MAAM,gBAAgB,SAAS,aAAa;CAC5C,MAAM,kBAAkB,qBAAqB,aAAa;AAE1D,KAAI,kBAAkB,gBAAiB,QAAO;AAC9C,KAAI,CAAC,cAAc,WAAW,GAAG,gBAAgB,GAAG,CAAE,QAAO;AAE7D,QAAO,SAAS,MAAM,qBAAqB,OAAO,IAAI"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DEFAULT_STANDARD_ROUTES } from "./defaults.mjs";
|
|
2
|
+
import { isAbsoluteUrl, parseSameOriginUrl, stripTrailingSlash } from "./path.mjs";
|
|
3
|
+
import { buildStandardRouteTarget } from "./build.mjs";
|
|
4
|
+
import { matchStandardRouteTemplates } from "./match.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/core/standard-routes/redirects.ts
|
|
7
|
+
/**
|
|
8
|
+
* Returns the custom route target for a Shopify standard route pathname.
|
|
9
|
+
*
|
|
10
|
+
* This is used by server redirects: it only matches Shopify's default route shape when the app
|
|
11
|
+
* configured a custom template for that same resource, so standard `/products/...` requests do not
|
|
12
|
+
* redirect unless the app opted into a non-standard product route.
|
|
13
|
+
*/
|
|
14
|
+
function getStandardRouteTarget({ pathname, pathPrefix, routeTemplates }) {
|
|
15
|
+
const match = matchStandardRouteTemplates(pathname, pathPrefix, (route) => routeTemplates[route] ? DEFAULT_STANDARD_ROUTES[route] : []);
|
|
16
|
+
if (!match) return null;
|
|
17
|
+
const target = routeTemplates[match.route];
|
|
18
|
+
if (!target) return null;
|
|
19
|
+
return buildStandardRouteTarget(target, match.params, pathPrefix);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Resolves a Shopify standard resource URL to the app's configured route template.
|
|
23
|
+
*
|
|
24
|
+
* Query strings and hashes are preserved. Absolute URLs are only resolved when they share the same
|
|
25
|
+
* origin as `baseUrl`; external URLs are returned unchanged.
|
|
26
|
+
*/
|
|
27
|
+
function resolveStandardRouteUrl({ baseUrl, pathPrefix, routeTemplates, url }) {
|
|
28
|
+
const parsedUrl = parseSameOriginUrl(url, baseUrl);
|
|
29
|
+
if (!parsedUrl) return url;
|
|
30
|
+
const target = getStandardRouteTarget({
|
|
31
|
+
pathname: parsedUrl.pathname,
|
|
32
|
+
pathPrefix,
|
|
33
|
+
routeTemplates
|
|
34
|
+
});
|
|
35
|
+
if (!target) return url;
|
|
36
|
+
const resolvedUrl = `${target}${parsedUrl.search}${parsedUrl.hash}`;
|
|
37
|
+
return isAbsoluteUrl(url) ? `${parsedUrl.origin}${resolvedUrl}` : resolvedUrl;
|
|
38
|
+
}
|
|
39
|
+
function isStandardRouteSelfRedirect(requestUrl, location) {
|
|
40
|
+
try {
|
|
41
|
+
const sourceUrl = new URL(requestUrl);
|
|
42
|
+
const targetUrl = new URL(location, sourceUrl.origin);
|
|
43
|
+
return sourceUrl.origin === targetUrl.origin && stripTrailingSlash(sourceUrl.pathname) === stripTrailingSlash(targetUrl.pathname) && sourceUrl.search === targetUrl.search;
|
|
44
|
+
} catch {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { getStandardRouteTarget, isStandardRouteSelfRedirect, resolveStandardRouteUrl };
|
|
51
|
+
//# sourceMappingURL=redirects.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirects.mjs","names":[],"sources":["../../../src/core/standard-routes/redirects.ts"],"sourcesContent":["import { buildStandardRouteTarget } from \"./build\";\nimport { DEFAULT_STANDARD_ROUTES } from \"./defaults\";\nimport { matchStandardRouteTemplates } from \"./match\";\nimport { isAbsoluteUrl, parseSameOriginUrl, stripTrailingSlash } from \"./path\";\nimport type { ShopifyRouteTemplates } from \"./types\";\n\n/**\n * Returns the custom route target for a Shopify standard route pathname.\n *\n * This is used by server redirects: it only matches Shopify's default route shape when the app\n * configured a custom template for that same resource, so standard `/products/...` requests do not\n * redirect unless the app opted into a non-standard product route.\n */\nexport function getStandardRouteTarget({\n pathname,\n pathPrefix,\n routeTemplates,\n}: {\n pathname: string;\n pathPrefix?: string;\n routeTemplates: ShopifyRouteTemplates;\n}): string | null {\n const match = matchStandardRouteTemplates(pathname, pathPrefix, (route) =>\n routeTemplates[route] ? DEFAULT_STANDARD_ROUTES[route] : [],\n );\n\n if (!match) return null;\n\n const target = routeTemplates[match.route];\n if (!target) return null;\n\n return buildStandardRouteTarget(target, match.params, pathPrefix);\n}\n\n/**\n * Resolves a Shopify standard resource URL to the app's configured route template.\n *\n * Query strings and hashes are preserved. Absolute URLs are only resolved when they share the same\n * origin as `baseUrl`; external URLs are returned unchanged.\n */\nexport function resolveStandardRouteUrl({\n baseUrl,\n pathPrefix,\n routeTemplates,\n url,\n}: {\n baseUrl?: string;\n pathPrefix?: string;\n routeTemplates: ShopifyRouteTemplates;\n url: string;\n}): string {\n const parsedUrl = parseSameOriginUrl(url, baseUrl);\n if (!parsedUrl) return url;\n\n const target = getStandardRouteTarget({\n pathname: parsedUrl.pathname,\n pathPrefix,\n routeTemplates,\n });\n\n if (!target) return url;\n\n const resolvedUrl = `${target}${parsedUrl.search}${parsedUrl.hash}`;\n\n return isAbsoluteUrl(url) ? `${parsedUrl.origin}${resolvedUrl}` : resolvedUrl;\n}\n\nexport function isStandardRouteSelfRedirect(requestUrl: string, location: string): boolean {\n try {\n const sourceUrl = new URL(requestUrl);\n const targetUrl = new URL(location, sourceUrl.origin);\n\n return (\n sourceUrl.origin === targetUrl.origin &&\n stripTrailingSlash(sourceUrl.pathname) === stripTrailingSlash(targetUrl.pathname) &&\n sourceUrl.search === targetUrl.search\n );\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,uBAAuB,EACrC,UACA,YACA,kBAKgB;CAChB,MAAM,QAAQ,4BAA4B,UAAU,aAAa,UAC/D,eAAe,SAAS,wBAAwB,SAAS,EAAE,CAC5D;AAED,KAAI,CAAC,MAAO,QAAO;CAEnB,MAAM,SAAS,eAAe,MAAM;AACpC,KAAI,CAAC,OAAQ,QAAO;AAEpB,QAAO,yBAAyB,QAAQ,MAAM,QAAQ,WAAW;;;;;;;;AASnE,SAAgB,wBAAwB,EACtC,SACA,YACA,gBACA,OAMS;CACT,MAAM,YAAY,mBAAmB,KAAK,QAAQ;AAClD,KAAI,CAAC,UAAW,QAAO;CAEvB,MAAM,SAAS,uBAAuB;EACpC,UAAU,UAAU;EACpB;EACA;EACD,CAAC;AAEF,KAAI,CAAC,OAAQ,QAAO;CAEpB,MAAM,cAAc,GAAG,SAAS,UAAU,SAAS,UAAU;AAE7D,QAAO,cAAc,IAAI,GAAG,GAAG,UAAU,SAAS,gBAAgB;;AAGpE,SAAgB,4BAA4B,YAAoB,UAA2B;AACzF,KAAI;EACF,MAAM,YAAY,IAAI,IAAI,WAAW;EACrC,MAAM,YAAY,IAAI,IAAI,UAAU,UAAU,OAAO;AAErD,SACE,UAAU,WAAW,UAAU,UAC/B,mBAAmB,UAAU,SAAS,KAAK,mBAAmB,UAAU,SAAS,IACjF,UAAU,WAAW,UAAU;SAE3B;AACN,SAAO"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//#region src/core/standard-routes/types.d.ts
|
|
2
|
+
type StandardRouteTemplateWithParam<Param extends string> = `/${string}:${Param}` | `/${string}:${Param}/${string}`;
|
|
3
|
+
type StandardRouteTemplate = `/${string}`;
|
|
4
|
+
type ShopifyRouteTemplates = {
|
|
5
|
+
/**
|
|
6
|
+
* Redirects Shopify article routes, for example
|
|
7
|
+
* `/blogs/news/snowboard-guide`, to the app's custom article route.
|
|
8
|
+
*
|
|
9
|
+
* @example "/journal/:blogHandle/:articleHandle"
|
|
10
|
+
*/
|
|
11
|
+
article?: StandardRouteTemplateWithParam<"blogHandle"> & StandardRouteTemplateWithParam<"articleHandle">;
|
|
12
|
+
/**
|
|
13
|
+
* Redirects Shopify blog routes, for example `/blogs/news`, to the app's
|
|
14
|
+
* custom blog route.
|
|
15
|
+
*
|
|
16
|
+
* @example "/journal/:blogHandle"
|
|
17
|
+
*/
|
|
18
|
+
blog?: StandardRouteTemplateWithParam<"blogHandle">;
|
|
19
|
+
/**
|
|
20
|
+
* Redirects Shopify's `/cart` route to the app's custom cart route.
|
|
21
|
+
*
|
|
22
|
+
* @example "/basket"
|
|
23
|
+
*/
|
|
24
|
+
cart?: StandardRouteTemplate;
|
|
25
|
+
/**
|
|
26
|
+
* Redirects Shopify collection routes, for example `/collections/winter`,
|
|
27
|
+
* to the app's custom collection route.
|
|
28
|
+
*
|
|
29
|
+
* @example "/c/:collectionHandle"
|
|
30
|
+
*/
|
|
31
|
+
collection?: StandardRouteTemplateWithParam<"collectionHandle">;
|
|
32
|
+
/**
|
|
33
|
+
* Redirects Shopify's collection-listing routes, `/collections` and the
|
|
34
|
+
* legacy `/products`, to the app's custom collection-listing route.
|
|
35
|
+
*
|
|
36
|
+
* @example "/catalog"
|
|
37
|
+
*/
|
|
38
|
+
collectionList?: StandardRouteTemplate;
|
|
39
|
+
/**
|
|
40
|
+
* Redirects Shopify page routes, for example `/pages/about-us`, to the app's
|
|
41
|
+
* custom page route.
|
|
42
|
+
*
|
|
43
|
+
* @example "/content/:pageHandle"
|
|
44
|
+
*/
|
|
45
|
+
page?: StandardRouteTemplateWithParam<"pageHandle">;
|
|
46
|
+
/**
|
|
47
|
+
* Redirects Shopify policy routes, for example `/policies/privacy-policy`,
|
|
48
|
+
* to the app's custom policy route.
|
|
49
|
+
*
|
|
50
|
+
* @example "/legal/:policyHandle"
|
|
51
|
+
*/
|
|
52
|
+
policy?: StandardRouteTemplateWithParam<"policyHandle">;
|
|
53
|
+
/**
|
|
54
|
+
* Redirects Shopify product routes, for example `/products/snowboard`,
|
|
55
|
+
* to the app's custom product route.
|
|
56
|
+
*
|
|
57
|
+
* @example "/p/:productHandle"
|
|
58
|
+
*/
|
|
59
|
+
product?: StandardRouteTemplateWithParam<"productHandle">;
|
|
60
|
+
/**
|
|
61
|
+
* Redirects Shopify collection-scoped product routes, for example
|
|
62
|
+
* `/collections/winter/products/snowboard`, to the app's custom product route.
|
|
63
|
+
*
|
|
64
|
+
* Must include `:productHandle`. May include `:collectionHandle` when the
|
|
65
|
+
* app's custom product route is also collection-scoped.
|
|
66
|
+
*
|
|
67
|
+
* @example "/p/:productHandle"
|
|
68
|
+
* @example "/c/:collectionHandle/p/:productHandle"
|
|
69
|
+
*/
|
|
70
|
+
productInCollection?: StandardRouteTemplateWithParam<"productHandle">;
|
|
71
|
+
/**
|
|
72
|
+
* Redirects Shopify's `/search` route to the app's custom search route.
|
|
73
|
+
*
|
|
74
|
+
* @example "/find"
|
|
75
|
+
*/
|
|
76
|
+
search?: StandardRouteTemplate;
|
|
77
|
+
};
|
|
78
|
+
type StandardRouteName = keyof ShopifyRouteTemplates;
|
|
79
|
+
type ShopifyStandardRouteName = StandardRouteName | "index";
|
|
80
|
+
type ShopifyPageTemplateName<TRoute extends ShopifyStandardRouteName = ShopifyStandardRouteName> = TRoute extends "productInCollection" ? "product" : TRoute extends "collectionList" ? "list-collections" : TRoute;
|
|
81
|
+
type StandardRouteParamName = "articleHandle" | "blogHandle" | "collectionHandle" | "pageHandle" | "policyHandle" | "productHandle";
|
|
82
|
+
type StandardRouteParams = Partial<Record<StandardRouteParamName, string>>;
|
|
83
|
+
type ShopifyStandardRouteMatch<TRoute extends ShopifyStandardRouteName = ShopifyStandardRouteName> = {
|
|
84
|
+
standardPathname: string;
|
|
85
|
+
params: StandardRouteParams;
|
|
86
|
+
route: TRoute;
|
|
87
|
+
pageTemplateName: ShopifyPageTemplateName<TRoute>;
|
|
88
|
+
templates: {
|
|
89
|
+
standard: string;
|
|
90
|
+
custom: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
//#endregion
|
|
94
|
+
export { ShopifyRouteTemplates, ShopifyStandardRouteMatch };
|
|
95
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/core/url.ts
|
|
2
|
+
const SFAPI_RE = /^\/api\/(unstable|2\d{3}-\d{2})\/graphql\.json$/;
|
|
3
|
+
const SHOPIFY_API_PROXY_PREFIX = "/__shopify";
|
|
4
|
+
const SHOPIFY_API_PROXY_RE = /^\/__shopify(?:\/|$)/;
|
|
5
|
+
const MCP_RE = /^\/api\/mcp$/;
|
|
6
|
+
const CHECKOUT_RE = /^\/checkout$/;
|
|
7
|
+
const CART_PERMALINK_RE = /^\/cart\/\d+:\d+(?:,\d+:\d+)*$/;
|
|
8
|
+
const CUSTOMER_ACCOUNT_PATHS = {
|
|
9
|
+
authorize: "/account/authorize",
|
|
10
|
+
login: "/account/login",
|
|
11
|
+
logout: "/account/logout",
|
|
12
|
+
refresh: "/account/refresh"
|
|
13
|
+
};
|
|
14
|
+
const CUSTOMER_ACCOUNT_HANDOFF_PATHS = new Set(Object.values(CUSTOMER_ACCOUNT_PATHS));
|
|
15
|
+
/**
|
|
16
|
+
* Returns whether the pathname conventionally represents a Hydrogen document-level server handoff.
|
|
17
|
+
*
|
|
18
|
+
* Keep this aligned with the routes intercepted before framework routing. API and protocol
|
|
19
|
+
* interceptors are intentionally excluded because they are not browser navigation destinations.
|
|
20
|
+
*/
|
|
21
|
+
function isHydrogenServerHandoffPath(pathname) {
|
|
22
|
+
return CHECKOUT_RE.test(pathname) || CART_PERMALINK_RE.test(pathname) || CUSTOMER_ACCOUNT_HANDOFF_PATHS.has(pathname);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Allowlisted `.well-known` resources proxied to the Online Store origin:
|
|
26
|
+
* - `apple-developer-merchantid-domain-association` — Apple Pay domain verification.
|
|
27
|
+
* - `shopify/fec/produce` — Frontend Event Collector ingress. On the Online
|
|
28
|
+
* Store the myshopify.com edge forwards this first-party path to the
|
|
29
|
+
* collector; headless storefronts have no such edge, so Hydrogen proxies it
|
|
30
|
+
* to the same origin (used by WebMCP's Event Refinery client).
|
|
31
|
+
*/
|
|
32
|
+
const WELL_KNOWN_RE = /^\/\.well-known\/(?:apple-developer-merchantid-domain-association|shopify\/fec\/produce)$/;
|
|
33
|
+
const AJAX_CART_RE = /^(?:\/[a-z]{2}(?:-[a-z]{2})?)?\/cart(?:\.(?:js|json)|\/(?:add|update|change|clear)(?:\.(?:js|json))?)$/i;
|
|
34
|
+
function normalizeStoreDomain(domain) {
|
|
35
|
+
if (!domain) throw new Error("Storefront `storeDomain` is required.");
|
|
36
|
+
if (domain.startsWith("http://") || domain.startsWith("https://")) return domain.replace(/\/+$/, "");
|
|
37
|
+
return `https://${domain}`.replace(/\/+$/, "");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { AJAX_CART_RE, CHECKOUT_RE, CUSTOMER_ACCOUNT_PATHS, MCP_RE, SFAPI_RE, SHOPIFY_API_PROXY_PREFIX, SHOPIFY_API_PROXY_RE, WELL_KNOWN_RE, isHydrogenServerHandoffPath, normalizeStoreDomain };
|
|
42
|
+
//# sourceMappingURL=url.mjs.map
|
|
@@ -0,0 +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 CHECKOUT_RE = /^\\/checkout$/;\nexport const CART_PERMALINK_RE = /^\\/cart\\/\\d+:\\d+(?:,\\d+:\\d+)*$/;\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 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\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,cAAc;AAC3B,MAAa,oBAAoB;AACjC,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,+BAA+B,IAAI,SAAS;;;;;;;;;;AAYhD,MAAa,gBACX;AACF,MAAa,eACX;AAEF,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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/core/utils/load-script.ts
|
|
2
|
+
/**
|
|
3
|
+
* Inlined from @shopify/hydrogen-react/load-script.
|
|
4
|
+
* Pure DOM script loader with no framework dependency.
|
|
5
|
+
*/
|
|
6
|
+
const SCRIPTS_LOADED = {};
|
|
7
|
+
function loadScript(src, options) {
|
|
8
|
+
const isScriptLoaded = SCRIPTS_LOADED[src];
|
|
9
|
+
if (isScriptLoaded) return isScriptLoaded;
|
|
10
|
+
const promise = new Promise((resolve, reject) => {
|
|
11
|
+
const script = document.createElement("script");
|
|
12
|
+
script.type = options?.module ? "module" : "text/javascript";
|
|
13
|
+
script.src = src;
|
|
14
|
+
script.addEventListener("load", () => resolve(true));
|
|
15
|
+
script.addEventListener("error", () => {
|
|
16
|
+
delete SCRIPTS_LOADED[src];
|
|
17
|
+
reject(false);
|
|
18
|
+
});
|
|
19
|
+
if (options?.in === "head") document.head.appendChild(script);
|
|
20
|
+
else document.body.appendChild(script);
|
|
21
|
+
if (options?.attributes) {
|
|
22
|
+
const { attributes } = options;
|
|
23
|
+
Object.keys(attributes).forEach((key) => {
|
|
24
|
+
script.setAttribute(key, attributes[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
SCRIPTS_LOADED[src] = promise;
|
|
29
|
+
return promise;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { loadScript };
|
|
34
|
+
//# sourceMappingURL=load-script.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-script.mjs","names":[],"sources":["../../../src/core/utils/load-script.ts"],"sourcesContent":["/**\n * Inlined from @shopify/hydrogen-react/load-script.\n * Pure DOM script loader with no framework dependency.\n */\n\nconst SCRIPTS_LOADED: Record<string, Promise<boolean>> = {};\n\ntype LoadScriptOptions = {\n module?: boolean;\n in?: \"head\" | \"body\";\n attributes?: Record<string, string>;\n};\n\nexport function loadScript(src: string, options?: LoadScriptOptions): Promise<boolean> {\n const isScriptLoaded = SCRIPTS_LOADED[src];\n if (isScriptLoaded) return isScriptLoaded;\n\n const promise = new Promise<boolean>((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.type = options?.module ? \"module\" : \"text/javascript\";\n script.src = src;\n script.addEventListener(\"load\", () => resolve(true));\n script.addEventListener(\"error\", () => {\n delete SCRIPTS_LOADED[src];\n reject(false);\n });\n\n if (options?.in === \"head\") {\n document.head.appendChild(script);\n } else {\n document.body.appendChild(script);\n }\n\n if (options?.attributes) {\n const { attributes } = options;\n Object.keys(attributes).forEach((key) => {\n script.setAttribute(key, attributes[key]);\n });\n }\n });\n\n SCRIPTS_LOADED[src] = promise;\n return promise;\n}\n"],"mappings":";;;;;AAKA,MAAM,iBAAmD,EAAE;AAQ3D,SAAgB,WAAW,KAAa,SAA+C;CACrF,MAAM,iBAAiB,eAAe;AACtC,KAAI,eAAgB,QAAO;CAE3B,MAAM,UAAU,IAAI,SAAkB,SAAS,WAAW;EACxD,MAAM,SAAS,SAAS,cAAc,SAAS;AAC/C,SAAO,OAAO,SAAS,SAAS,WAAW;AAC3C,SAAO,MAAM;AACb,SAAO,iBAAiB,cAAc,QAAQ,KAAK,CAAC;AACpD,SAAO,iBAAiB,eAAe;AACrC,UAAO,eAAe;AACtB,UAAO,MAAM;IACb;AAEF,MAAI,SAAS,OAAO,OAClB,UAAS,KAAK,YAAY,OAAO;MAEjC,UAAS,KAAK,YAAY,OAAO;AAGnC,MAAI,SAAS,YAAY;GACvB,MAAM,EAAE,eAAe;AACvB,UAAO,KAAK,WAAW,CAAC,SAAS,QAAQ;AACvC,WAAO,aAAa,KAAK,WAAW,KAAK;KACzC;;GAEJ;AAEF,gBAAe,OAAO;AACtB,QAAO"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/core/utils/parse-gid.ts
|
|
2
|
+
function parseGid(gid) {
|
|
3
|
+
const defaultReturn = {
|
|
4
|
+
id: "",
|
|
5
|
+
resource: null,
|
|
6
|
+
resourceId: null,
|
|
7
|
+
search: "",
|
|
8
|
+
searchParams: new URLSearchParams(),
|
|
9
|
+
hash: ""
|
|
10
|
+
};
|
|
11
|
+
if (typeof gid !== "string") return defaultReturn;
|
|
12
|
+
try {
|
|
13
|
+
const { search, searchParams, pathname, hash } = new URL(gid);
|
|
14
|
+
const pathnameParts = pathname.split("/");
|
|
15
|
+
const lastPathnamePart = pathnameParts[pathnameParts.length - 1];
|
|
16
|
+
const resourcePart = pathnameParts[pathnameParts.length - 2];
|
|
17
|
+
if (!lastPathnamePart || !resourcePart) return defaultReturn;
|
|
18
|
+
return {
|
|
19
|
+
id: `${lastPathnamePart}${search}${hash}` || "",
|
|
20
|
+
resource: resourcePart ?? null,
|
|
21
|
+
resourceId: lastPathnamePart || null,
|
|
22
|
+
search,
|
|
23
|
+
searchParams,
|
|
24
|
+
hash
|
|
25
|
+
};
|
|
26
|
+
} catch {
|
|
27
|
+
return defaultReturn;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { parseGid };
|
|
33
|
+
//# sourceMappingURL=parse-gid.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-gid.mjs","names":[],"sources":["../../../src/core/utils/parse-gid.ts"],"sourcesContent":["/**\n * Inlined from @shopify/hydrogen-react/analytics-utils.\n * Parses Shopify Global IDs (GIDs) into their component parts.\n */\n\ntype ShopifyGid = Pick<URL, \"search\" | \"searchParams\" | \"hash\"> & {\n id: string;\n resource: string | null;\n resourceId: string | null;\n};\n\nexport function parseGid(gid: string | undefined): ShopifyGid {\n const defaultReturn: ShopifyGid = {\n id: \"\",\n resource: null,\n resourceId: null,\n search: \"\",\n searchParams: new URLSearchParams(),\n hash: \"\",\n };\n\n if (typeof gid !== \"string\") return defaultReturn;\n\n try {\n const { search, searchParams, pathname, hash } = new URL(gid);\n const pathnameParts = pathname.split(\"/\");\n const lastPathnamePart = pathnameParts[pathnameParts.length - 1];\n const resourcePart = pathnameParts[pathnameParts.length - 2];\n\n if (!lastPathnamePart || !resourcePart) return defaultReturn;\n\n const id = `${lastPathnamePart}${search}${hash}` || \"\";\n const resourceId = lastPathnamePart || null;\n const resource = resourcePart ?? null;\n\n return { id, resource, resourceId, search, searchParams, hash };\n } catch {\n return defaultReturn;\n }\n}\n"],"mappings":";AAWA,SAAgB,SAAS,KAAqC;CAC5D,MAAM,gBAA4B;EAChC,IAAI;EACJ,UAAU;EACV,YAAY;EACZ,QAAQ;EACR,cAAc,IAAI,iBAAiB;EACnC,MAAM;EACP;AAED,KAAI,OAAO,QAAQ,SAAU,QAAO;AAEpC,KAAI;EACF,MAAM,EAAE,QAAQ,cAAc,UAAU,SAAS,IAAI,IAAI,IAAI;EAC7D,MAAM,gBAAgB,SAAS,MAAM,IAAI;EACzC,MAAM,mBAAmB,cAAc,cAAc,SAAS;EAC9D,MAAM,eAAe,cAAc,cAAc,SAAS;AAE1D,MAAI,CAAC,oBAAoB,CAAC,aAAc,QAAO;AAM/C,SAAO;GAAE,IAJE,GAAG,mBAAmB,SAAS,UAAU;GAIvC,UAFI,gBAAgB;GAEV,YAHJ,oBAAoB;GAGJ;GAAQ;GAAc;GAAM;SACzD;AACN,SAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record.mjs","names":[],"sources":["../../../src/core/utils/record.ts"],"sourcesContent":["export function isObjectRecord(value: unknown): value is Record<PropertyKey, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n"],"mappings":";AAAA,SAAgB,eAAe,OAAuD;AACpF,QAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ShopifyRequestContext } from "../core/request-context.mjs";
|
|
2
|
+
import { GraphQLFormattedError } from "../client/types.mjs";
|
|
3
|
+
import { AnyCustomerAccountDocument, CustomerAccountDocument } from "./graphql.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/customer-account/client.d.ts
|
|
6
|
+
type CreateCustomerAccountClientOptions = {
|
|
7
|
+
shopId: string;
|
|
8
|
+
customerApiVersion?: string;
|
|
9
|
+
requestContext: ShopifyRequestContext;
|
|
10
|
+
fetch?: typeof globalThis.fetch;
|
|
11
|
+
defaultTimeoutInMs?: number;
|
|
12
|
+
};
|
|
13
|
+
type CustomerAccountGraphqlOptions<Variables = Record<string, unknown>> = {
|
|
14
|
+
accessToken: string;
|
|
15
|
+
variables?: Variables;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
};
|
|
18
|
+
type ResultOfDoc<Doc> = Doc extends CustomerAccountDocument<infer Result, never, string> ? Result : never;
|
|
19
|
+
type VariablesOfDoc<Doc> = Doc extends CustomerAccountDocument<unknown, infer Variables, string> ? Variables : never;
|
|
20
|
+
type OptionalAutoVariables<Variables> = "language" extends keyof Variables ? {
|
|
21
|
+
language?: Variables["language"];
|
|
22
|
+
} : {};
|
|
23
|
+
type UserVariables<Doc> = Omit<VariablesOfDoc<Doc>, "language"> & OptionalAutoVariables<VariablesOfDoc<Doc>>;
|
|
24
|
+
type HasNoRequiredKeys<T> = Record<string, never> extends T ? true : false;
|
|
25
|
+
type CustomerAccountGraphqlResult<Result = unknown> = {
|
|
26
|
+
data: Result;
|
|
27
|
+
errors?: undefined;
|
|
28
|
+
headers: Headers;
|
|
29
|
+
} | {
|
|
30
|
+
data: Result | null;
|
|
31
|
+
errors: GraphQLFormattedError[];
|
|
32
|
+
headers: Headers;
|
|
33
|
+
};
|
|
34
|
+
type CustomerAccountGqlRestParam<Doc extends AnyCustomerAccountDocument> = HasNoRequiredKeys<UserVariables<Doc>> extends true ? [options: CustomerAccountGraphqlOptions<UserVariables<Doc>>] : [options: CustomerAccountGraphqlOptions<UserVariables<Doc>> & {
|
|
35
|
+
variables: UserVariables<Doc>;
|
|
36
|
+
}];
|
|
37
|
+
type CustomerAccountClient = {
|
|
38
|
+
readonly apiUrl: string;
|
|
39
|
+
graphql: <const Doc extends AnyCustomerAccountDocument>(document: Doc, ...options: CustomerAccountGqlRestParam<Doc>) => Promise<CustomerAccountGraphqlResult<ResultOfDoc<Doc>>>;
|
|
40
|
+
};
|
|
41
|
+
declare function createCustomerAccountClient({
|
|
42
|
+
shopId,
|
|
43
|
+
customerApiVersion,
|
|
44
|
+
requestContext,
|
|
45
|
+
fetch: customFetch,
|
|
46
|
+
defaultTimeoutInMs
|
|
47
|
+
}: CreateCustomerAccountClientOptions): CustomerAccountClient;
|
|
48
|
+
//#endregion
|
|
49
|
+
export { CreateCustomerAccountClientOptions, CustomerAccountClient, CustomerAccountGqlRestParam, CustomerAccountGraphqlOptions, CustomerAccountGraphqlResult, createCustomerAccountClient };
|
|
50
|
+
//# sourceMappingURL=client.d.mts.map
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { CUSTOMER_ACCOUNT_API_VERSION, DEFAULT_TIMEOUT_IN_MS } from "../core/constants.mjs";
|
|
2
|
+
import { CustomerAccountApiError, CustomerAccountAuthenticationError, CustomerAccountTimeoutError } from "./errors.mjs";
|
|
3
|
+
import { isObjectRecord } from "../core/utils/record.mjs";
|
|
4
|
+
import { assertCustomerAccountDocument } from "./graphql.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/customer-account/client.ts
|
|
7
|
+
const SHOP_ID_RE = /^\d+$/;
|
|
8
|
+
const CUSTOMER_API_VERSION_RE = /^\d{4}-\d{2}$/;
|
|
9
|
+
const MAX_ASCII_CONTROL_CODE_POINT = 31;
|
|
10
|
+
const ASCII_DELETE_CODE_POINT = 127;
|
|
11
|
+
const MAX_SET_TIMEOUT_IN_MS = 2147483647;
|
|
12
|
+
const LOCAL_ORIGIN_HOSTS = new Set([
|
|
13
|
+
"localhost",
|
|
14
|
+
"127.0.0.1",
|
|
15
|
+
"::1",
|
|
16
|
+
"[::1]"
|
|
17
|
+
]);
|
|
18
|
+
const USER_AGENT = `Hydrogen 2026.10.0-preview.2`;
|
|
19
|
+
const CUSTOMER_ACCOUNT_GRAPHQL_PERSONALIZATION_REASON = "customer-account-graphql";
|
|
20
|
+
function createCustomerAccountClient({ shopId, customerApiVersion = CUSTOMER_ACCOUNT_API_VERSION, requestContext, fetch: customFetch, defaultTimeoutInMs = DEFAULT_TIMEOUT_IN_MS }) {
|
|
21
|
+
if (typeof document !== "undefined") throw new Error("Customer Account API tokens cannot be used in a browser context. Use this client from server or edge routes only.");
|
|
22
|
+
validateShopId(shopId);
|
|
23
|
+
validateCustomerApiVersion(customerApiVersion);
|
|
24
|
+
validateTimeout(defaultTimeoutInMs);
|
|
25
|
+
const resolvedFetch = customFetch ?? globalThis.fetch;
|
|
26
|
+
if (typeof resolvedFetch !== "function") throw new Error("No fetch function available. Pass a fetch option or ensure globalThis.fetch exists.");
|
|
27
|
+
const origin = getOrigin(requestContext.url);
|
|
28
|
+
const apiUrl = `https://shopify.com/${shopId}/account/customer/api/${customerApiVersion}/graphql`;
|
|
29
|
+
async function graphql(document, ...rest) {
|
|
30
|
+
assertCustomerAccountDocument(document);
|
|
31
|
+
const options = validateGraphqlOptions(rest[0]);
|
|
32
|
+
requestContext.markResponseAsPersonalized(CUSTOMER_ACCOUNT_GRAPHQL_PERSONALIZATION_REASON);
|
|
33
|
+
const accessToken = validateAccessToken(options.accessToken);
|
|
34
|
+
const externalSignals = [requestContext.signal, options.signal].filter((signal) => Boolean(signal));
|
|
35
|
+
throwIfAlreadyAborted(externalSignals);
|
|
36
|
+
const { signal: timeoutSignal, cleanup: cleanupTimeout } = createCustomerAccountTimeoutSignal(defaultTimeoutInMs);
|
|
37
|
+
externalSignals.push(timeoutSignal);
|
|
38
|
+
const signal = AbortSignal.any(externalSignals);
|
|
39
|
+
try {
|
|
40
|
+
const variables = getVariables(document, getOptionalVariables(options.variables), requestContext.i18n.language);
|
|
41
|
+
return await readCustomerAccountGraphqlResponse(await fetchCustomerAccountGraphql({
|
|
42
|
+
fetch: resolvedFetch,
|
|
43
|
+
apiUrl,
|
|
44
|
+
accessToken,
|
|
45
|
+
origin,
|
|
46
|
+
query: document.source,
|
|
47
|
+
variables,
|
|
48
|
+
signal,
|
|
49
|
+
timeoutSignal,
|
|
50
|
+
timeoutInMs: defaultTimeoutInMs
|
|
51
|
+
}), signal, timeoutSignal, defaultTimeoutInMs);
|
|
52
|
+
} finally {
|
|
53
|
+
cleanupTimeout();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
apiUrl,
|
|
58
|
+
graphql
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async function fetchCustomerAccountGraphql({ fetch, apiUrl, accessToken, origin, query, variables, signal, timeoutSignal, timeoutInMs }) {
|
|
62
|
+
try {
|
|
63
|
+
return await withAbort(fetch(apiUrl, {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: new Headers({
|
|
66
|
+
Authorization: accessToken,
|
|
67
|
+
"Content-Type": "application/json",
|
|
68
|
+
Origin: origin,
|
|
69
|
+
"User-Agent": USER_AGENT
|
|
70
|
+
}),
|
|
71
|
+
body: JSON.stringify({
|
|
72
|
+
query,
|
|
73
|
+
variables
|
|
74
|
+
}),
|
|
75
|
+
cache: "no-store",
|
|
76
|
+
redirect: "manual",
|
|
77
|
+
signal
|
|
78
|
+
}), signal);
|
|
79
|
+
} catch (cause) {
|
|
80
|
+
throwIfCustomerAccountSignalAborted(signal, timeoutSignal, timeoutInMs);
|
|
81
|
+
if (isAbortError(cause)) throw cause;
|
|
82
|
+
throw new CustomerAccountApiError("Customer Account API request failed", { cause });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
async function readCustomerAccountGraphqlResponse(response, signal, timeoutSignal, timeoutInMs) {
|
|
86
|
+
const requestId = response.headers.get("x-request-id") ?? void 0;
|
|
87
|
+
if (!response.ok) {
|
|
88
|
+
cancelResponseBody(response);
|
|
89
|
+
throw new CustomerAccountApiError(`Customer Account API responded with ${response.status}`, {
|
|
90
|
+
status: response.status,
|
|
91
|
+
requestId,
|
|
92
|
+
retryAfter: response.headers.get("retry-after") ?? void 0
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
let body;
|
|
96
|
+
try {
|
|
97
|
+
body = parseGraphqlResponse(await withAbort(response.json(), signal));
|
|
98
|
+
} catch (cause) {
|
|
99
|
+
cancelResponseBody(response);
|
|
100
|
+
throwIfCustomerAccountSignalAborted(signal, timeoutSignal, timeoutInMs);
|
|
101
|
+
if (isAbortError(cause)) throw cause;
|
|
102
|
+
throw new CustomerAccountApiError("Failed to parse Customer Account API response as JSON", {
|
|
103
|
+
status: response.status,
|
|
104
|
+
requestId,
|
|
105
|
+
cause
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (body.errors) return {
|
|
109
|
+
data: body.data ?? null,
|
|
110
|
+
errors: body.errors,
|
|
111
|
+
headers: response.headers
|
|
112
|
+
};
|
|
113
|
+
if (body.data == null) throw new CustomerAccountApiError("Customer Account API response did not include data", {
|
|
114
|
+
status: response.status,
|
|
115
|
+
requestId
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
data: body.data,
|
|
119
|
+
headers: response.headers
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function cancelResponseBody(response) {
|
|
123
|
+
try {
|
|
124
|
+
response.body?.cancel().catch(() => void 0);
|
|
125
|
+
} catch {}
|
|
126
|
+
}
|
|
127
|
+
function validateTimeout(timeoutInMs) {
|
|
128
|
+
if (!Number.isSafeInteger(timeoutInMs) || timeoutInMs <= 0 || timeoutInMs > MAX_SET_TIMEOUT_IN_MS) throw new Error(`defaultTimeoutInMs must be a positive safe integer no greater than ${MAX_SET_TIMEOUT_IN_MS}`);
|
|
129
|
+
}
|
|
130
|
+
function createCustomerAccountTimeoutSignal(timeoutInMs) {
|
|
131
|
+
const controller = new AbortController();
|
|
132
|
+
const timeoutId = setTimeout(() => {
|
|
133
|
+
controller.abort(new CustomerAccountTimeoutError(timeoutInMs));
|
|
134
|
+
}, timeoutInMs);
|
|
135
|
+
return {
|
|
136
|
+
signal: controller.signal,
|
|
137
|
+
cleanup: () => clearTimeout(timeoutId)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function withAbort(promise, signal) {
|
|
141
|
+
if (!signal) return Promise.resolve(promise);
|
|
142
|
+
if (signal.aborted) return Promise.reject(signal.reason ?? new DOMException("signal is aborted without reason", "AbortError"));
|
|
143
|
+
return new Promise((resolve, reject) => {
|
|
144
|
+
const abort = () => {
|
|
145
|
+
signal.removeEventListener("abort", abort);
|
|
146
|
+
reject(signal.reason ?? new DOMException("signal is aborted without reason", "AbortError"));
|
|
147
|
+
};
|
|
148
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
149
|
+
Promise.resolve(promise).then((value) => {
|
|
150
|
+
signal.removeEventListener("abort", abort);
|
|
151
|
+
resolve(value);
|
|
152
|
+
}, (error) => {
|
|
153
|
+
signal.removeEventListener("abort", abort);
|
|
154
|
+
reject(error);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function getVariables(document, variables, language) {
|
|
159
|
+
if (!document.variableNames.has("language")) return variables;
|
|
160
|
+
if ("language" in variables) return variables;
|
|
161
|
+
return {
|
|
162
|
+
...variables,
|
|
163
|
+
language
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
function throwIfAlreadyAborted(signals) {
|
|
167
|
+
const abortedSignal = signals.find((signal) => signal.aborted);
|
|
168
|
+
if (!abortedSignal) return;
|
|
169
|
+
throw abortedSignal.reason ?? new DOMException("signal is aborted without reason", "AbortError");
|
|
170
|
+
}
|
|
171
|
+
function throwIfCustomerAccountSignalAborted(signal, timeoutSignal, timeoutInMs) {
|
|
172
|
+
if (!signal.aborted) return;
|
|
173
|
+
if (timeoutSignal.aborted && signal.reason === timeoutSignal.reason) {
|
|
174
|
+
const reason = timeoutSignal.reason;
|
|
175
|
+
throw reason instanceof CustomerAccountTimeoutError ? reason : new CustomerAccountTimeoutError(timeoutInMs);
|
|
176
|
+
}
|
|
177
|
+
throw signal.reason ?? new DOMException("signal is aborted without reason", "AbortError");
|
|
178
|
+
}
|
|
179
|
+
function isAbortError(cause) {
|
|
180
|
+
return cause instanceof DOMException && cause.name === "AbortError";
|
|
181
|
+
}
|
|
182
|
+
function parseGraphqlResponse(json) {
|
|
183
|
+
if (!isObjectRecord(json)) throw new Error("Customer Account API returned unexpected JSON type");
|
|
184
|
+
if (!("data" in json) && !("errors" in json)) throw new Error("Customer Account API response must include data or errors");
|
|
185
|
+
const errors = json.errors;
|
|
186
|
+
if (errors !== void 0 && !isGraphqlErrorArray(errors)) throw new Error("Customer Account API returned invalid GraphQL errors");
|
|
187
|
+
return {
|
|
188
|
+
data: json.data,
|
|
189
|
+
errors
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
function isGraphqlErrorArray(value) {
|
|
193
|
+
if (!Array.isArray(value)) return false;
|
|
194
|
+
return value.every((error) => {
|
|
195
|
+
return typeof error === "object" && error !== null && typeof error.message === "string";
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
function validateShopId(shopId) {
|
|
199
|
+
if (!SHOP_ID_RE.test(shopId)) throw new Error("shopId must be a numeric Shopify shop ID string");
|
|
200
|
+
}
|
|
201
|
+
function validateCustomerApiVersion(customerApiVersion) {
|
|
202
|
+
if (!CUSTOMER_API_VERSION_RE.test(customerApiVersion)) throw new Error("customerApiVersion must use YYYY-MM format");
|
|
203
|
+
}
|
|
204
|
+
function validateAccessToken(accessToken) {
|
|
205
|
+
if (typeof accessToken !== "string" || accessToken === "" || accessToken.trim() !== accessToken || hasAsciiControlCharacter(accessToken)) throw new CustomerAccountAuthenticationError();
|
|
206
|
+
return accessToken;
|
|
207
|
+
}
|
|
208
|
+
function validateGraphqlOptions(options) {
|
|
209
|
+
if (typeof options !== "object" || options === null) throw new CustomerAccountAuthenticationError();
|
|
210
|
+
return options;
|
|
211
|
+
}
|
|
212
|
+
function getOptionalVariables(variables) {
|
|
213
|
+
if (variables === void 0) return {};
|
|
214
|
+
if (!isObjectRecord(variables)) throw new TypeError("Customer Account API variables must be an object");
|
|
215
|
+
return variables;
|
|
216
|
+
}
|
|
217
|
+
function hasAsciiControlCharacter(value) {
|
|
218
|
+
for (let index = 0; index < value.length; index++) {
|
|
219
|
+
const codePoint = value.charCodeAt(index);
|
|
220
|
+
if (codePoint <= MAX_ASCII_CONTROL_CODE_POINT || codePoint === ASCII_DELETE_CODE_POINT) return true;
|
|
221
|
+
}
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Customer Account API requires an HTTPS Origin, but local dev frameworks often
|
|
226
|
+
* receive `http://localhost` requests. Keep that local-only exception without
|
|
227
|
+
* weakening origin validation for non-local requests.
|
|
228
|
+
*/
|
|
229
|
+
function getOrigin(requestUrl) {
|
|
230
|
+
if (!requestUrl) throw new Error("requestContext.url is required for Customer Account API requests");
|
|
231
|
+
const url = new URL(requestUrl);
|
|
232
|
+
if (url.protocol === "https:") return url.origin;
|
|
233
|
+
if (url.protocol === "http:" && LOCAL_ORIGIN_HOSTS.has(url.hostname)) return `https://${url.host}`;
|
|
234
|
+
throw new Error(`Customer Account API origin must use HTTPS. Received: ${requestUrl}`);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
//#endregion
|
|
238
|
+
export { createCustomerAccountClient };
|
|
239
|
+
//# sourceMappingURL=client.mjs.map
|