@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,97 @@
|
|
|
1
|
+
import { VISITOR_CONSENT_COLLECTED_EVENT } from "./constants.mjs";
|
|
2
|
+
import { findWritableCookieDomain } from "./utils/cookie-domain.mjs";
|
|
3
|
+
import { getTrackingValues } from "./utils/tracking-values.mjs";
|
|
4
|
+
import { buildUUID } from "./utils/uuid.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/core/shopify-scripts/deprecated-cookies.ts
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This module manages the legacy `_shopify_y` and `_shopify_s`
|
|
9
|
+
* JavaScript-visible cookies. Modern Shopify storefronts use http-only cookies
|
|
10
|
+
* set by the Storefront API via the SFAPI proxy. This module exists only for
|
|
11
|
+
* backward compatibility with downstream systems that may still read these
|
|
12
|
+
* JS cookies directly.
|
|
13
|
+
*
|
|
14
|
+
* To remove: delete this file and remove the ShopifyScripts startup call.
|
|
15
|
+
*/
|
|
16
|
+
const SHOPIFY_Y = "_shopify_y";
|
|
17
|
+
const SHOPIFY_S = "_shopify_s";
|
|
18
|
+
const LONG_TERM_EXPIRY_IN_SECONDS = 3600 * 24 * 360;
|
|
19
|
+
const SHORT_TERM_EXPIRY_IN_SECONDS = 1800;
|
|
20
|
+
/**
|
|
21
|
+
* Computes the cookie domain as the broadest wildcard domain the browser will
|
|
22
|
+
* accept for the consent domain. Returns empty string for localhost or when
|
|
23
|
+
* probing fails (cookies use current domain).
|
|
24
|
+
*
|
|
25
|
+
* @deprecated Part of legacy cookie management.
|
|
26
|
+
*/
|
|
27
|
+
function computeCookieDomain(consentDomain) {
|
|
28
|
+
if (typeof window === "undefined") return "";
|
|
29
|
+
return findWritableCookieDomain(consentDomain || window.location.host);
|
|
30
|
+
}
|
|
31
|
+
function setCookie(name, value, maxAgeInSeconds, domain) {
|
|
32
|
+
const parts = [`${name}=${encodeURIComponent(value)}`];
|
|
33
|
+
parts.push(`max-age=${maxAgeInSeconds}`);
|
|
34
|
+
parts.push("path=/");
|
|
35
|
+
parts.push("SameSite=Lax");
|
|
36
|
+
if (domain) parts.push(`domain=${domain}`);
|
|
37
|
+
document.cookie = parts.join("; ");
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Sets or removes the legacy `_shopify_y` and `_shopify_s` cookies
|
|
41
|
+
* based on the current consent state and tracking values.
|
|
42
|
+
*/
|
|
43
|
+
function updateCookies(hasConsent, domain) {
|
|
44
|
+
if (hasConsent) {
|
|
45
|
+
const trackingValues = getTrackingValues();
|
|
46
|
+
if ((trackingValues.uniqueToken || trackingValues.visitToken || "").startsWith("00000000-")) return;
|
|
47
|
+
setCookie(SHOPIFY_Y, trackingValues.uniqueToken || buildUUID(), LONG_TERM_EXPIRY_IN_SECONDS, domain);
|
|
48
|
+
setCookie(SHOPIFY_S, trackingValues.visitToken || buildUUID(), SHORT_TERM_EXPIRY_IN_SECONDS, domain);
|
|
49
|
+
} else {
|
|
50
|
+
setCookie(SHOPIFY_Y, "", 0, domain);
|
|
51
|
+
setCookie(SHOPIFY_S, "", 0, domain);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function hasAnalyticsConsent() {
|
|
55
|
+
try {
|
|
56
|
+
return (window.Shopify?.customerPrivacy)?.analyticsProcessingAllowed?.() ?? false;
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function isConsentLoaded() {
|
|
62
|
+
return window.Shopify?.customerPrivacy?.consentStatus === "loaded";
|
|
63
|
+
}
|
|
64
|
+
function getConsentDomain() {
|
|
65
|
+
return window.Shopify?.customerPrivacy?.config?.consentDomain;
|
|
66
|
+
}
|
|
67
|
+
let didInitializeDeprecatedCookies = false;
|
|
68
|
+
const noOpCleanup = () => {};
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated Starts page-lifetime legacy cookie management from ShopifyScripts.
|
|
71
|
+
*/
|
|
72
|
+
function initializeDeprecatedCookies() {
|
|
73
|
+
if (typeof window === "undefined" || typeof document === "undefined") return noOpCleanup;
|
|
74
|
+
if (didInitializeDeprecatedCookies) return noOpCleanup;
|
|
75
|
+
didInitializeDeprecatedCookies = true;
|
|
76
|
+
const domain = computeCookieDomain(getConsentDomain());
|
|
77
|
+
const syncConsent = () => {
|
|
78
|
+
updateCookies(hasAnalyticsConsent(), domain);
|
|
79
|
+
};
|
|
80
|
+
document.addEventListener(VISITOR_CONSENT_COLLECTED_EVENT, syncConsent);
|
|
81
|
+
if (isConsentLoaded()) syncConsent();
|
|
82
|
+
const syncPageView = () => {
|
|
83
|
+
if (hasAnalyticsConsent()) updateCookies(true, domain);
|
|
84
|
+
};
|
|
85
|
+
const subscribeToAnalytics = () => {
|
|
86
|
+
const subscribe = window.Shopify?.analytics?.subscribe;
|
|
87
|
+
if (typeof subscribe !== "function") return false;
|
|
88
|
+
subscribe("page_viewed", syncPageView);
|
|
89
|
+
return true;
|
|
90
|
+
};
|
|
91
|
+
if (!subscribeToAnalytics() && document.readyState === "loading") document.addEventListener("DOMContentLoaded", subscribeToAnalytics, { once: true });
|
|
92
|
+
return noOpCleanup;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { initializeDeprecatedCookies };
|
|
97
|
+
//# sourceMappingURL=deprecated-cookies.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecated-cookies.mjs","names":[],"sources":["../../../src/core/shopify-scripts/deprecated-cookies.ts"],"sourcesContent":["/**\n * @deprecated This module manages the legacy `_shopify_y` and `_shopify_s`\n * JavaScript-visible cookies. Modern Shopify storefronts use http-only cookies\n * set by the Storefront API via the SFAPI proxy. This module exists only for\n * backward compatibility with downstream systems that may still read these\n * JS cookies directly.\n *\n * To remove: delete this file and remove the ShopifyScripts startup call.\n */\n\nimport { VISITOR_CONSENT_COLLECTED_EVENT } from \"./constants\";\nimport { findWritableCookieDomain } from \"./utils/cookie-domain\";\nimport { getTrackingValues } from \"./utils/tracking-values\";\nimport { buildUUID } from \"./utils/uuid\";\n\nconst SHOPIFY_Y = \"_shopify_y\";\nconst SHOPIFY_S = \"_shopify_s\";\n\nconst LONG_TERM_EXPIRY_IN_SECONDS = 60 * 60 * 24 * 360;\nconst SHORT_TERM_EXPIRY_IN_SECONDS = 60 * 30;\n\n/**\n * Computes the cookie domain as the broadest wildcard domain the browser will\n * accept for the consent domain. Returns empty string for localhost or when\n * probing fails (cookies use current domain).\n *\n * @deprecated Part of legacy cookie management.\n */\nexport function computeCookieDomain(consentDomain?: string): string {\n if (typeof window === \"undefined\") return \"\";\n\n return findWritableCookieDomain(consentDomain || window.location.host);\n}\n\nfunction setCookie(name: string, value: string, maxAgeInSeconds: number, domain: string): void {\n const parts = [`${name}=${encodeURIComponent(value)}`];\n parts.push(`max-age=${maxAgeInSeconds}`);\n parts.push(\"path=/\");\n parts.push(\"SameSite=Lax\");\n if (domain) parts.push(`domain=${domain}`);\n document.cookie = parts.join(\"; \");\n}\n\n/**\n * @deprecated Sets or removes the legacy `_shopify_y` and `_shopify_s` cookies\n * based on the current consent state and tracking values.\n */\nfunction updateCookies(hasConsent: boolean, domain: string): void {\n if (hasConsent) {\n const trackingValues = getTrackingValues();\n const tokenValue = trackingValues.uniqueToken || trackingValues.visitToken || \"\";\n if (tokenValue.startsWith(\"00000000-\")) return;\n\n setCookie(\n SHOPIFY_Y,\n trackingValues.uniqueToken || buildUUID(),\n LONG_TERM_EXPIRY_IN_SECONDS,\n domain,\n );\n setCookie(\n SHOPIFY_S,\n trackingValues.visitToken || buildUUID(),\n SHORT_TERM_EXPIRY_IN_SECONDS,\n domain,\n );\n } else {\n setCookie(SHOPIFY_Y, \"\", 0, domain);\n setCookie(SHOPIFY_S, \"\", 0, domain);\n }\n}\n\nfunction hasAnalyticsConsent(): boolean {\n try {\n const privacy = window.Shopify?.customerPrivacy;\n return privacy?.analyticsProcessingAllowed?.() ?? false;\n } catch {\n return false;\n }\n}\n\nfunction isConsentLoaded(): boolean {\n return window.Shopify?.customerPrivacy?.consentStatus === \"loaded\";\n}\n\nfunction getConsentDomain(): string | undefined {\n return window.Shopify?.customerPrivacy?.config?.consentDomain;\n}\n\nlet didInitializeDeprecatedCookies = false;\nconst noOpCleanup = () => {};\n\n/**\n * @deprecated Starts page-lifetime legacy cookie management from ShopifyScripts.\n */\nexport function initializeDeprecatedCookies(): () => void {\n if (typeof window === \"undefined\" || typeof document === \"undefined\") return noOpCleanup;\n if (didInitializeDeprecatedCookies) return noOpCleanup;\n\n didInitializeDeprecatedCookies = true;\n const domain = computeCookieDomain(getConsentDomain());\n\n const syncConsent = () => {\n updateCookies(hasAnalyticsConsent(), domain);\n };\n\n document.addEventListener(VISITOR_CONSENT_COLLECTED_EVENT, syncConsent);\n if (isConsentLoaded()) syncConsent();\n\n const syncPageView = () => {\n if (hasAnalyticsConsent()) {\n updateCookies(true, domain);\n }\n };\n\n const subscribeToAnalytics = () => {\n const subscribe = window.Shopify?.analytics?.subscribe;\n if (typeof subscribe !== \"function\") return false;\n\n subscribe(\"page_viewed\", syncPageView);\n return true;\n };\n\n if (!subscribeToAnalytics() && document.readyState === \"loading\") {\n // The bus is inline today, but if it moves to a module/defer script it will\n // still be available before DOMContentLoaded.\n document.addEventListener(\"DOMContentLoaded\", subscribeToAnalytics, { once: true });\n }\n\n return noOpCleanup;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,YAAY;AAClB,MAAM,YAAY;AAElB,MAAM,8BAA8B,OAAU,KAAK;AACnD,MAAM,+BAA+B;;;;;;;;AASrC,SAAgB,oBAAoB,eAAgC;AAClE,KAAI,OAAO,WAAW,YAAa,QAAO;AAE1C,QAAO,yBAAyB,iBAAiB,OAAO,SAAS,KAAK;;AAGxE,SAAS,UAAU,MAAc,OAAe,iBAAyB,QAAsB;CAC7F,MAAM,QAAQ,CAAC,GAAG,KAAK,GAAG,mBAAmB,MAAM,GAAG;AACtD,OAAM,KAAK,WAAW,kBAAkB;AACxC,OAAM,KAAK,SAAS;AACpB,OAAM,KAAK,eAAe;AAC1B,KAAI,OAAQ,OAAM,KAAK,UAAU,SAAS;AAC1C,UAAS,SAAS,MAAM,KAAK,KAAK;;;;;;AAOpC,SAAS,cAAc,YAAqB,QAAsB;AAChE,KAAI,YAAY;EACd,MAAM,iBAAiB,mBAAmB;AAE1C,OADmB,eAAe,eAAe,eAAe,cAAc,IAC/D,WAAW,YAAY,CAAE;AAExC,YACE,WACA,eAAe,eAAe,WAAW,EACzC,6BACA,OACD;AACD,YACE,WACA,eAAe,cAAc,WAAW,EACxC,8BACA,OACD;QACI;AACL,YAAU,WAAW,IAAI,GAAG,OAAO;AACnC,YAAU,WAAW,IAAI,GAAG,OAAO;;;AAIvC,SAAS,sBAA+B;AACtC,KAAI;AAEF,UADgB,OAAO,SAAS,kBAChB,8BAA8B,IAAI;SAC5C;AACN,SAAO;;;AAIX,SAAS,kBAA2B;AAClC,QAAO,OAAO,SAAS,iBAAiB,kBAAkB;;AAG5D,SAAS,mBAAuC;AAC9C,QAAO,OAAO,SAAS,iBAAiB,QAAQ;;AAGlD,IAAI,iCAAiC;AACrC,MAAM,oBAAoB;;;;AAK1B,SAAgB,8BAA0C;AACxD,KAAI,OAAO,WAAW,eAAe,OAAO,aAAa,YAAa,QAAO;AAC7E,KAAI,+BAAgC,QAAO;AAE3C,kCAAiC;CACjC,MAAM,SAAS,oBAAoB,kBAAkB,CAAC;CAEtD,MAAM,oBAAoB;AACxB,gBAAc,qBAAqB,EAAE,OAAO;;AAG9C,UAAS,iBAAiB,iCAAiC,YAAY;AACvE,KAAI,iBAAiB,CAAE,cAAa;CAEpC,MAAM,qBAAqB;AACzB,MAAI,qBAAqB,CACvB,eAAc,MAAM,OAAO;;CAI/B,MAAM,6BAA6B;EACjC,MAAM,YAAY,OAAO,SAAS,WAAW;AAC7C,MAAI,OAAO,cAAc,WAAY,QAAO;AAE5C,YAAU,eAAe,aAAa;AACtC,SAAO;;AAGT,KAAI,CAAC,sBAAsB,IAAI,SAAS,eAAe,UAGrD,UAAS,iBAAiB,oBAAoB,sBAAsB,EAAE,MAAM,MAAM,CAAC;AAGrF,QAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { matchStandardRouteUrl } from "../standard-routes/match.mjs";
|
|
2
|
+
import { resolveStandardRouteUrl } from "../standard-routes/redirects.mjs";
|
|
3
|
+
import { SHOPIFY_API_PROXY_PREFIX, isHydrogenServerHandoffPath } from "../url.mjs";
|
|
4
|
+
import { asInlineScript } from "./utils/inline-script.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/core/shopify-scripts/global.ts
|
|
7
|
+
const initializeShopifyGlobal = (scriptData) => decodeURIComponent("(function()%7Bfunction%20e(e)%7Blet%20t%3Dwindow%2Cn%3DObject.assign(t.Shopify%3F%3F%3D%7B%7D%2Ce%2C%7Bcomponents%3A%7Bconfig%3A%7BstoreDomain%3Awindow.location.origin%2Ccountry%3Ae.country%2Clanguage%3Ae.locale%7D%7D%7D)%3Bn.customerPrivacy.config.consentDomain%3Dwindow.location.host%7De(__SHOPIFY_SCRIPT_DATA__)%7D)()%3B").replace("__SHOPIFY_SCRIPT_DATA__", () => (JSON.stringify(scriptData) ?? "undefined").replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"));
|
|
8
|
+
const DEFAULT_COUNTRY = "US";
|
|
9
|
+
const DEFAULT_LOCALE = "en";
|
|
10
|
+
const DEFAULT_ROUTES_ROOT = "/";
|
|
11
|
+
/**
|
|
12
|
+
* Returns the browser's `window.Shopify` object, creating it when needed.
|
|
13
|
+
*
|
|
14
|
+
* This is SSR-safe and returns `undefined` outside the browser.
|
|
15
|
+
*/
|
|
16
|
+
function getShopifyGlobal() {
|
|
17
|
+
if (typeof window === "undefined") return void 0;
|
|
18
|
+
const shopifyWindow = window;
|
|
19
|
+
return shopifyWindow.Shopify ??= {};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Configures Shopify runtime routing hooks used by storefront scripts.
|
|
23
|
+
*
|
|
24
|
+
* This is SSR-safe and no-ops outside the browser.
|
|
25
|
+
*/
|
|
26
|
+
function configureShopifyRouting({ navigate, routes }) {
|
|
27
|
+
const shopify = getShopifyGlobal();
|
|
28
|
+
if (!shopify) return;
|
|
29
|
+
const getRouteOptions = (url) => ({
|
|
30
|
+
baseUrl: window.location.href,
|
|
31
|
+
pathPrefix: shopify.routes?.root,
|
|
32
|
+
routeTemplates: routes ?? {},
|
|
33
|
+
url
|
|
34
|
+
});
|
|
35
|
+
shopify.routes ??= {};
|
|
36
|
+
shopify.routes.match = (url) => matchStandardRouteUrl(getRouteOptions(url));
|
|
37
|
+
shopify.routes.resolve = (url) => resolveStandardRouteUrl(getRouteOptions(url));
|
|
38
|
+
const navigateTo = navigate ?? documentNavigate;
|
|
39
|
+
shopify.routes.navigate = (url) => {
|
|
40
|
+
if (shouldHandoff(url)) return documentNavigate(url);
|
|
41
|
+
return navigateTo(shopify.routes?.resolve?.(url) ?? url);
|
|
42
|
+
};
|
|
43
|
+
shopify.navigate = shopify.routes.navigate;
|
|
44
|
+
}
|
|
45
|
+
function documentNavigate(url) {
|
|
46
|
+
window.location.assign(url);
|
|
47
|
+
}
|
|
48
|
+
function shouldHandoff(url) {
|
|
49
|
+
try {
|
|
50
|
+
const parsedUrl = new URL(url, window.location.href);
|
|
51
|
+
return parsedUrl.origin === window.location.origin && isHydrogenServerHandoffPath(parsedUrl.pathname);
|
|
52
|
+
} catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function getShopifyRoutesRoot(pathPrefix) {
|
|
57
|
+
const normalizedPathPrefix = pathPrefix?.trim().replace(/^\/+/, "").replace(/\/+$/, "") ?? "";
|
|
58
|
+
return normalizedPathPrefix ? `/${normalizedPathPrefix}/` : DEFAULT_ROUTES_ROOT;
|
|
59
|
+
}
|
|
60
|
+
function normalizeMyshopifyDomain(domain) {
|
|
61
|
+
return domain.trim().replace(/^https?:\/\//i, "").replace(/\/+$/, "");
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Builds the inline bootstrap script that initializes `window.Shopify` for storefront scripts.
|
|
65
|
+
*/
|
|
66
|
+
function getShopifyGlobalBootstrapScript({ i18n, shop }) {
|
|
67
|
+
const config = {
|
|
68
|
+
country: i18n?.country ?? DEFAULT_COUNTRY,
|
|
69
|
+
...i18n?.currency !== void 0 ? { currency: { active: i18n.currency.toUpperCase() } } : {},
|
|
70
|
+
locale: (i18n?.language ?? DEFAULT_LOCALE).toLowerCase(),
|
|
71
|
+
routes: {
|
|
72
|
+
root: getShopifyRoutesRoot(i18n?.pathPrefix),
|
|
73
|
+
apiProxyPrefix: SHOPIFY_API_PROXY_PREFIX
|
|
74
|
+
},
|
|
75
|
+
shop: normalizeMyshopifyDomain(shop.myshopifyDomain),
|
|
76
|
+
customerPrivacy: {
|
|
77
|
+
config: { isHeadless: true },
|
|
78
|
+
consentStatus: "pending"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return asInlineScript(initializeShopifyGlobal)(config);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { configureShopifyRouting, getShopifyGlobal, getShopifyGlobalBootstrapScript };
|
|
86
|
+
//# sourceMappingURL=global.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.mjs","names":[],"sources":["../../../src/core/shopify-scripts/global.ts"],"sourcesContent":["import type { ShopifyGlobal } from \"../../globals\";\nimport type { I18nConfig } from \"../request-context\";\nimport {\n matchStandardRouteUrl,\n resolveStandardRouteUrl,\n type ShopifyRouteTemplates,\n} from \"../standard-routes/index\";\nimport { SHOPIFY_API_PROXY_PREFIX, isHydrogenServerHandoffPath } from \"../url\";\nimport initializeShopifyGlobal from \"./global-script\" with { type: \"script\" };\nimport type { ShopifyScriptsI18n } from \"./types\";\nimport type { ShopifyScriptsShop } from \"./types\";\nimport { asInlineScript } from \"./utils/inline-script\";\n\nexport type ShopifyGlobalConfig = {\n country: I18nConfig[\"country\"];\n currency?: NonNullable<ShopifyGlobal[\"currency\"]>;\n locale: Lowercase<I18nConfig[\"language\"]>;\n customerPrivacy: {\n config: NonNullable<ShopifyGlobal[\"customerPrivacy\"][\"config\"]>;\n consentStatus: NonNullable<ShopifyGlobal[\"customerPrivacy\"][\"consentStatus\"]>;\n };\n routes: {\n root: string;\n apiProxyPrefix: string;\n };\n shop: string;\n};\n\nexport type IncompleteCustomerPrivacy = Partial<\n Omit<ShopifyGlobal[\"customerPrivacy\"], \"config\">\n> & {\n config?: Partial<NonNullable<ShopifyGlobal[\"customerPrivacy\"][\"config\"]>>;\n};\n\nexport type IncompleteShopifyGlobal = Partial<Omit<ShopifyGlobal, \"customerPrivacy\" | \"routes\">> & {\n customerPrivacy?: IncompleteCustomerPrivacy;\n routes?: Partial<ShopifyGlobal[\"routes\"]> & Record<string, unknown>;\n [key: string]: unknown;\n};\n\nconst DEFAULT_COUNTRY: ShopifyGlobalConfig[\"country\"] = \"US\";\nconst DEFAULT_LOCALE: ShopifyGlobalConfig[\"locale\"] = \"en\";\nconst DEFAULT_ROUTES_ROOT: ShopifyGlobalConfig[\"routes\"][\"root\"] = \"/\";\n\n/**\n * Returns the browser's `window.Shopify` object, creating it when needed.\n *\n * This is SSR-safe and returns `undefined` outside the browser.\n */\nexport function getShopifyGlobal(): IncompleteShopifyGlobal | undefined {\n if (typeof window === \"undefined\") return undefined;\n\n const shopifyWindow: { Shopify?: IncompleteShopifyGlobal } = window;\n return (shopifyWindow.Shopify ??= {});\n}\n\n/**\n * Configures Shopify runtime routing hooks used by storefront scripts.\n *\n * This is SSR-safe and no-ops outside the browser.\n */\nexport function configureShopifyRouting({\n navigate,\n routes,\n}: {\n navigate?: ShopifyGlobal[\"routes\"][\"navigate\"];\n routes?: ShopifyRouteTemplates;\n}) {\n const shopify = getShopifyGlobal();\n if (!shopify) return;\n\n const getRouteOptions = (url: string) => ({\n baseUrl: window.location.href,\n pathPrefix: shopify.routes?.root,\n routeTemplates: routes ?? {},\n url,\n });\n\n shopify.routes ??= {};\n shopify.routes.match = (url) => matchStandardRouteUrl(getRouteOptions(url));\n shopify.routes.resolve = (url) => resolveStandardRouteUrl(getRouteOptions(url));\n\n const navigateTo = navigate ?? documentNavigate;\n shopify.routes.navigate = (url) => {\n if (shouldHandoff(url)) {\n return documentNavigate(url);\n }\n\n return navigateTo(shopify.routes?.resolve?.(url) ?? url);\n };\n // Deprecated, kept for temporary backwards compat with WebMCP\n shopify.navigate = shopify.routes.navigate;\n}\n\nfunction documentNavigate(url: string): void {\n window.location.assign(url);\n}\n\nfunction shouldHandoff(url: string): boolean {\n try {\n const parsedUrl = new URL(url, window.location.href);\n\n return (\n parsedUrl.origin === window.location.origin && isHydrogenServerHandoffPath(parsedUrl.pathname)\n );\n } catch {\n return false;\n }\n}\n\nfunction getShopifyRoutesRoot(pathPrefix: I18nConfig[\"pathPrefix\"]): string {\n const normalizedPathPrefix = pathPrefix?.trim().replace(/^\\/+/, \"\").replace(/\\/+$/, \"\") ?? \"\";\n\n return normalizedPathPrefix ? `/${normalizedPathPrefix}/` : DEFAULT_ROUTES_ROOT;\n}\n\nfunction normalizeMyshopifyDomain(domain: string): string {\n return domain\n .trim()\n .replace(/^https?:\\/\\//i, \"\")\n .replace(/\\/+$/, \"\");\n}\n\n/**\n * Builds the inline bootstrap script that initializes `window.Shopify` for storefront scripts.\n */\nexport function getShopifyGlobalBootstrapScript({\n i18n,\n shop,\n}: {\n i18n?: ShopifyScriptsI18n;\n shop: ShopifyScriptsShop;\n}): string {\n const config: ShopifyGlobalConfig = {\n country: i18n?.country ?? DEFAULT_COUNTRY,\n ...(i18n?.currency !== undefined ? { currency: { active: i18n.currency.toUpperCase() } } : {}),\n // oxlint-disable-next-line typescript/consistent-type-assertions\n locale: (i18n?.language ?? DEFAULT_LOCALE).toLowerCase() as Lowercase<\n ShopifyGlobalConfig[\"locale\"]\n >,\n routes: {\n root: getShopifyRoutesRoot(i18n?.pathPrefix),\n apiProxyPrefix: SHOPIFY_API_PROXY_PREFIX,\n },\n shop: normalizeMyshopifyDomain(shop.myshopifyDomain),\n customerPrivacy: {\n config: {\n isHeadless: true,\n },\n consentStatus: \"pending\",\n },\n };\n\n return asInlineScript(initializeShopifyGlobal)(config);\n}\n"],"mappings":";;;;;;AAQA,MAAM,2BAAyB,eAAe,mBAAsB,sUAAS,CAAA,QAAA,kCAAA,KAAA,UAAA,WAAA,IAAA,aAAA,QAAA,MAAA,UAAA,CAAA,QAAA,WAAA,UAAA,CAAA,QAAA,WAAA,UAAA,CAAA;AAgC7E,MAAM,kBAAkD;AACxD,MAAM,iBAAgD;AACtD,MAAM,sBAA6D;;;;;;AAOnE,SAAgB,mBAAwD;AACtE,KAAI,OAAO,WAAW,YAAa,QAAO;CAE1C,MAAM,gBAAuD;AAC7D,QAAQ,cAAc,YAAY,EAAE;;;;;;;AAQtC,SAAgB,wBAAwB,EACtC,UACA,UAIC;CACD,MAAM,UAAU,kBAAkB;AAClC,KAAI,CAAC,QAAS;CAEd,MAAM,mBAAmB,SAAiB;EACxC,SAAS,OAAO,SAAS;EACzB,YAAY,QAAQ,QAAQ;EAC5B,gBAAgB,UAAU,EAAE;EAC5B;EACD;AAED,SAAQ,WAAW,EAAE;AACrB,SAAQ,OAAO,SAAS,QAAQ,sBAAsB,gBAAgB,IAAI,CAAC;AAC3E,SAAQ,OAAO,WAAW,QAAQ,wBAAwB,gBAAgB,IAAI,CAAC;CAE/E,MAAM,aAAa,YAAY;AAC/B,SAAQ,OAAO,YAAY,QAAQ;AACjC,MAAI,cAAc,IAAI,CACpB,QAAO,iBAAiB,IAAI;AAG9B,SAAO,WAAW,QAAQ,QAAQ,UAAU,IAAI,IAAI,IAAI;;AAG1D,SAAQ,WAAW,QAAQ,OAAO;;AAGpC,SAAS,iBAAiB,KAAmB;AAC3C,QAAO,SAAS,OAAO,IAAI;;AAG7B,SAAS,cAAc,KAAsB;AAC3C,KAAI;EACF,MAAM,YAAY,IAAI,IAAI,KAAK,OAAO,SAAS,KAAK;AAEpD,SACE,UAAU,WAAW,OAAO,SAAS,UAAU,4BAA4B,UAAU,SAAQ;SAEzF;AACN,SAAO;;;AAIX,SAAS,qBAAqB,YAA8C;CAC1E,MAAM,uBAAuB,YAAY,MAAM,CAAC,QAAQ,QAAQ,GAAG,CAAC,QAAQ,QAAQ,GAAG,IAAI;AAE3F,QAAO,uBAAuB,IAAI,qBAAqB,KAAK;;AAG9D,SAAS,yBAAyB,QAAwB;AACxD,QAAO,OACJ,MAAK,CACL,QAAQ,iBAAiB,GAAE,CAC3B,QAAQ,QAAQ,GAAG;;;;;AAMxB,SAAgB,gCAAgC,EAC9C,MACA,QAIS;CACT,MAAM,SAA8B;EAClC,SAAS,MAAM,WAAW;EAC1B,GAAI,MAAM,aAAa,SAAY,EAAE,UAAU,EAAE,QAAQ,KAAK,SAAS,aAAa,EAAE,EAAE,GAAG,EAAE;EAE7F,SAAS,MAAM,YAAY,gBAAgB,aAAa;EAGxD,QAAQ;GACN,MAAM,qBAAqB,MAAM,WAAW;GAC5C,gBAAgB;GACjB;EACD,MAAM,yBAAyB,KAAK,gBAAgB;EACpD,iBAAiB;GACf,QAAQ,EACN,YAAY,MACb;GACD,eAAe;GAChB;EACF;AAED,QAAO,eAAe,wBAAwB,CAAC,OAAO"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ShopifyRoutesOptions, ShopifyScriptTagDescriptor, ShopifyScriptTagDescriptors, ShopifyScriptTagsOptions, ShopifyScriptsAnalyticsConfig, ShopifyScriptsI18n, ShopifyScriptsOptions, ShopifyScriptsShop } from "./types.mjs";
|
|
2
|
+
import { initializeShopifyScripts } from "./initialize.mjs";
|
|
3
|
+
//#region src/core/shopify-scripts/index.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Returns grouped Shopify storefront script/link descriptors for SSR frameworks and bindings.
|
|
6
|
+
*
|
|
7
|
+
* Framework bindings wrap this with `initializeShopifyScripts()` to form their `ShopifyScripts`
|
|
8
|
+
* component. Frameworks without a binding can render these descriptors during SSR and call
|
|
9
|
+
* `initializeShopifyScripts()` during browser hydration.
|
|
10
|
+
*/
|
|
11
|
+
declare function getShopifyScriptTags({
|
|
12
|
+
analytics,
|
|
13
|
+
consent,
|
|
14
|
+
debug,
|
|
15
|
+
i18n,
|
|
16
|
+
nonce,
|
|
17
|
+
shop,
|
|
18
|
+
shopifyAnalytics,
|
|
19
|
+
inbox
|
|
20
|
+
}: ShopifyScriptTagsOptions): ShopifyScriptTagDescriptors;
|
|
21
|
+
/**
|
|
22
|
+
* Renders all Shopify storefront script/link descriptors to HTML strings.
|
|
23
|
+
*/
|
|
24
|
+
declare function renderShopifyScriptTags(options: ShopifyScriptTagsOptions): string[];
|
|
25
|
+
//#endregion
|
|
26
|
+
export { getShopifyScriptTags, renderShopifyScriptTags };
|
|
27
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { getShopifyAnalyticsBusScript, getShopifyAnalyticsConfig } from "./analytics.mjs";
|
|
2
|
+
import { SHOPIFY_CDN_ORIGIN, SHOPIFY_CONSENT_API_SCRIPT, SHOPIFY_CONSENT_SCRIPT_ID, SHOPIFY_INBOX_SCRIPT, SHOPIFY_PERF_KIT_SCRIPT, SHOPIFY_PRIVACY_BANNER_SCRIPT, SHOPIFY_SHOP_APP_ORIGIN, SHOPIFY_STOREFRONT_ANALYTICS_SCRIPT, SHOPIFY_STOREFRONT_STANDARD_ACTIONS_SCRIPT, SHOPIFY_STOREFRONT_STANDARD_EVENTS_SCRIPT, SHOPIFY_STOREFRONT_WEBMCP_SCRIPT, VISITOR_CONSENT_COLLECTED_EVENT } from "./constants.mjs";
|
|
3
|
+
import { getShopifyConsentTrackingScript } from "./consent.mjs";
|
|
4
|
+
import { getShopifyGlobal, getShopifyGlobalBootstrapScript } from "./global.mjs";
|
|
5
|
+
import { getPerfKitScript } from "./perfkit.mjs";
|
|
6
|
+
import { renderShopifyScriptTag } from "./render.mjs";
|
|
7
|
+
import { initializeShopifyScripts } from "./initialize.mjs";
|
|
8
|
+
|
|
9
|
+
//#region src/core/shopify-scripts/index.ts
|
|
10
|
+
/**
|
|
11
|
+
* Returns grouped Shopify storefront script/link descriptors for SSR frameworks and bindings.
|
|
12
|
+
*
|
|
13
|
+
* Framework bindings wrap this with `initializeShopifyScripts()` to form their `ShopifyScripts`
|
|
14
|
+
* component. Frameworks without a binding can render these descriptors during SSR and call
|
|
15
|
+
* `initializeShopifyScripts()` during browser hydration.
|
|
16
|
+
*/
|
|
17
|
+
function getShopifyScriptTags({ analytics, consent, debug, i18n, nonce, shop, shopifyAnalytics = true, inbox = false }) {
|
|
18
|
+
const nonceAttributes = nonce !== void 0 ? { nonce } : void 0;
|
|
19
|
+
const analyticsConfig = getShopifyAnalyticsConfig({
|
|
20
|
+
analytics,
|
|
21
|
+
consent,
|
|
22
|
+
shop
|
|
23
|
+
});
|
|
24
|
+
const links = [
|
|
25
|
+
{
|
|
26
|
+
tagName: "link",
|
|
27
|
+
attributes: {
|
|
28
|
+
rel: "preconnect",
|
|
29
|
+
href: SHOPIFY_CDN_ORIGIN
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
tagName: "link",
|
|
34
|
+
attributes: {
|
|
35
|
+
rel: "preconnect",
|
|
36
|
+
href: SHOPIFY_SHOP_APP_ORIGIN
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
tagName: "link",
|
|
41
|
+
attributes: {
|
|
42
|
+
rel: "prefetch",
|
|
43
|
+
as: "script",
|
|
44
|
+
href: SHOPIFY_STOREFRONT_STANDARD_EVENTS_SCRIPT,
|
|
45
|
+
crossorigin: "anonymous"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
];
|
|
49
|
+
const scripts = [{
|
|
50
|
+
tagName: "script",
|
|
51
|
+
attributes: {
|
|
52
|
+
id: "shopify-global-bootstrap",
|
|
53
|
+
...nonceAttributes
|
|
54
|
+
},
|
|
55
|
+
innerHTML: getShopifyGlobalBootstrapScript({
|
|
56
|
+
i18n,
|
|
57
|
+
shop
|
|
58
|
+
})
|
|
59
|
+
}, {
|
|
60
|
+
tagName: "script",
|
|
61
|
+
attributes: {
|
|
62
|
+
id: "shopify-standard-actions",
|
|
63
|
+
type: "module",
|
|
64
|
+
crossorigin: "anonymous",
|
|
65
|
+
...nonceAttributes,
|
|
66
|
+
src: SHOPIFY_STOREFRONT_STANDARD_ACTIONS_SCRIPT
|
|
67
|
+
}
|
|
68
|
+
}];
|
|
69
|
+
if (inbox) scripts.push({
|
|
70
|
+
tagName: "script",
|
|
71
|
+
attributes: {
|
|
72
|
+
id: "shopify-inbox",
|
|
73
|
+
type: "module",
|
|
74
|
+
async: true,
|
|
75
|
+
crossorigin: "anonymous",
|
|
76
|
+
...nonceAttributes,
|
|
77
|
+
src: SHOPIFY_INBOX_SCRIPT
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
scripts.push({
|
|
81
|
+
tagName: "script",
|
|
82
|
+
attributes: {
|
|
83
|
+
id: SHOPIFY_CONSENT_SCRIPT_ID,
|
|
84
|
+
async: true,
|
|
85
|
+
crossorigin: "anonymous",
|
|
86
|
+
...nonceAttributes,
|
|
87
|
+
src: consent?.mode === "default-banner" ? SHOPIFY_PRIVACY_BANNER_SCRIPT : SHOPIFY_CONSENT_API_SCRIPT
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
scripts.push({
|
|
91
|
+
tagName: "script",
|
|
92
|
+
attributes: {
|
|
93
|
+
id: "shopify-consent-bootstrap",
|
|
94
|
+
...nonceAttributes
|
|
95
|
+
},
|
|
96
|
+
innerHTML: getShopifyConsentTrackingScript(consent)
|
|
97
|
+
});
|
|
98
|
+
scripts.push({
|
|
99
|
+
tagName: "script",
|
|
100
|
+
attributes: {
|
|
101
|
+
id: "shopify-analytics-bus",
|
|
102
|
+
...nonceAttributes
|
|
103
|
+
},
|
|
104
|
+
innerHTML: getShopifyAnalyticsBusScript(analyticsConfig)
|
|
105
|
+
});
|
|
106
|
+
if (shopifyAnalytics) scripts.push({
|
|
107
|
+
tagName: "script",
|
|
108
|
+
attributes: {
|
|
109
|
+
id: "shopify-storefront-analytics",
|
|
110
|
+
async: true,
|
|
111
|
+
crossorigin: "anonymous",
|
|
112
|
+
...nonceAttributes,
|
|
113
|
+
src: SHOPIFY_STOREFRONT_ANALYTICS_SCRIPT
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const perfKitScript = getPerfKitScript(shop, nonceAttributes);
|
|
117
|
+
if (perfKitScript) scripts.push(perfKitScript);
|
|
118
|
+
return {
|
|
119
|
+
links,
|
|
120
|
+
scripts,
|
|
121
|
+
get tags() {
|
|
122
|
+
return [...links, ...scripts];
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Renders all Shopify storefront script/link descriptors to HTML strings.
|
|
128
|
+
*/
|
|
129
|
+
function renderShopifyScriptTags(options) {
|
|
130
|
+
return getShopifyScriptTags(options).tags.map(renderShopifyScriptTag);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
//#endregion
|
|
134
|
+
export { getShopifyScriptTags, renderShopifyScriptTags };
|
|
135
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/core/shopify-scripts/index.ts"],"sourcesContent":["import { getShopifyAnalyticsBusScript, getShopifyAnalyticsConfig } from \"./analytics\";\nimport { getShopifyConsentTrackingScript } from \"./consent\";\nimport {\n SHOPIFY_CONSENT_API_SCRIPT,\n SHOPIFY_CDN_ORIGIN,\n SHOPIFY_CONSENT_SCRIPT_ID,\n SHOPIFY_PRIVACY_BANNER_SCRIPT,\n SHOPIFY_SHOP_APP_ORIGIN,\n SHOPIFY_INBOX_SCRIPT,\n SHOPIFY_STOREFRONT_ANALYTICS_SCRIPT,\n SHOPIFY_STOREFRONT_STANDARD_ACTIONS_SCRIPT,\n SHOPIFY_STOREFRONT_STANDARD_EVENTS_INSPECTOR_SCRIPT,\n SHOPIFY_STOREFRONT_STANDARD_EVENTS_SCRIPT,\n} from \"./constants\";\nimport { getShopifyGlobalBootstrapScript } from \"./global\";\nimport { getPerfKitScript } from \"./perfkit\";\nimport { renderShopifyScriptTag } from \"./render\";\nimport type {\n ShopifyLinkDescriptor,\n ShopifyScriptDescriptor,\n ShopifyScriptTagDescriptors,\n ShopifyScriptTagsOptions,\n} from \"./types\";\n\nexport {\n SHOPIFY_CDN_ORIGIN,\n SHOPIFY_CONSENT_API_SCRIPT,\n SHOPIFY_PERF_KIT_SCRIPT,\n SHOPIFY_PRIVACY_BANNER_SCRIPT,\n SHOPIFY_SHOP_APP_ORIGIN,\n SHOPIFY_INBOX_SCRIPT,\n SHOPIFY_STOREFRONT_ANALYTICS_SCRIPT,\n SHOPIFY_STOREFRONT_STANDARD_ACTIONS_SCRIPT,\n SHOPIFY_STOREFRONT_STANDARD_EVENTS_SCRIPT,\n SHOPIFY_STOREFRONT_WEBMCP_SCRIPT,\n VISITOR_CONSENT_COLLECTED_EVENT,\n} from \"./constants\";\nexport { getShopifyGlobal, getShopifyGlobalBootstrapScript } from \"./global\";\nexport { initializeShopifyScripts } from \"./initialize\";\nexport { renderShopifyScriptTag } from \"./render\";\nexport type {\n ShopifyScriptsAnalyticsConfig,\n ShopifyRoutesOptions,\n ShopifyScriptTagDescriptor,\n ShopifyScriptTagDescriptors,\n ShopifyScriptTagsOptions,\n ShopifyScriptsOptions,\n ShopifyScriptsI18n,\n ShopifyScriptsShop,\n} from \"./types\";\n\n/**\n * Returns grouped Shopify storefront script/link descriptors for SSR frameworks and bindings.\n *\n * Framework bindings wrap this with `initializeShopifyScripts()` to form their `ShopifyScripts`\n * component. Frameworks without a binding can render these descriptors during SSR and call\n * `initializeShopifyScripts()` during browser hydration.\n */\nexport function getShopifyScriptTags({\n analytics,\n consent,\n debug,\n i18n,\n nonce,\n shop,\n shopifyAnalytics = true,\n inbox = false,\n}: ShopifyScriptTagsOptions): ShopifyScriptTagDescriptors {\n const nonceAttributes = nonce !== undefined ? { nonce } : undefined;\n const analyticsConfig = getShopifyAnalyticsConfig({ analytics, consent, shop });\n\n const links: ShopifyLinkDescriptor[] = [\n {\n tagName: \"link\",\n attributes: {\n rel: \"preconnect\",\n href: SHOPIFY_CDN_ORIGIN,\n },\n },\n {\n tagName: \"link\",\n attributes: {\n rel: \"preconnect\",\n href: SHOPIFY_SHOP_APP_ORIGIN,\n },\n },\n {\n tagName: \"link\",\n attributes: {\n rel: \"prefetch\",\n as: \"script\",\n href: SHOPIFY_STOREFRONT_STANDARD_EVENTS_SCRIPT,\n crossorigin: \"anonymous\",\n },\n },\n ];\n const scripts: ShopifyScriptDescriptor[] = [\n {\n tagName: \"script\",\n attributes: { id: \"shopify-global-bootstrap\", ...nonceAttributes },\n innerHTML: getShopifyGlobalBootstrapScript({ i18n, shop }),\n },\n {\n tagName: \"script\",\n attributes: {\n id: \"shopify-standard-actions\",\n type: \"module\",\n crossorigin: \"anonymous\",\n ...nonceAttributes,\n src: SHOPIFY_STOREFRONT_STANDARD_ACTIONS_SCRIPT,\n },\n },\n ];\n\n if (__DEV__ && debug?.standardEventsInspector) {\n scripts.push({\n tagName: \"script\",\n attributes: {\n id: \"shopify-standard-events-inspector\",\n defer: true,\n crossorigin: \"anonymous\",\n ...nonceAttributes,\n src: SHOPIFY_STOREFRONT_STANDARD_EVENTS_INSPECTOR_SCRIPT,\n },\n });\n }\n\n if (inbox) {\n scripts.push({\n tagName: \"script\",\n attributes: {\n id: \"shopify-inbox\",\n type: \"module\",\n async: true,\n crossorigin: \"anonymous\",\n ...nonceAttributes,\n src: SHOPIFY_INBOX_SCRIPT,\n },\n });\n }\n\n // Keep this async consent library immediately before the inline consent bootstrap.\n // Parser-inserted async scripts execute in a later task, so the following inline\n // script can attach a load listener before the library runs.\n scripts.push({\n tagName: \"script\",\n attributes: {\n id: SHOPIFY_CONSENT_SCRIPT_ID,\n async: true,\n crossorigin: \"anonymous\",\n ...nonceAttributes,\n src:\n consent?.mode === \"default-banner\"\n ? SHOPIFY_PRIVACY_BANNER_SCRIPT\n : SHOPIFY_CONSENT_API_SCRIPT,\n },\n });\n // This must run immediately after the consent library tag so it can find that\n // tag and attach its load listener before consent-tracking-api/privacy-banner executes.\n scripts.push({\n tagName: \"script\",\n attributes: { id: \"shopify-consent-bootstrap\", ...nonceAttributes },\n innerHTML: getShopifyConsentTrackingScript(consent),\n });\n\n // This must run after getShopifyConsentTrackingScript because that script\n // temporarily annotates visitorConsentCollected events for the analytics bus.\n scripts.push({\n tagName: \"script\",\n attributes: { id: \"shopify-analytics-bus\", ...nonceAttributes },\n innerHTML: getShopifyAnalyticsBusScript(analyticsConfig),\n });\n\n if (shopifyAnalytics) {\n scripts.push({\n tagName: \"script\",\n attributes: {\n id: \"shopify-storefront-analytics\",\n async: true,\n crossorigin: \"anonymous\",\n ...nonceAttributes,\n src: SHOPIFY_STOREFRONT_ANALYTICS_SCRIPT,\n },\n });\n }\n\n const perfKitScript = getPerfKitScript(shop, nonceAttributes);\n if (perfKitScript) {\n scripts.push(perfKitScript);\n }\n\n return {\n links,\n scripts,\n get tags() {\n return [...links, ...scripts];\n },\n };\n}\n\n/**\n * Renders all Shopify storefront script/link descriptors to HTML strings.\n */\nexport function renderShopifyScriptTags(options: ShopifyScriptTagsOptions): string[] {\n return getShopifyScriptTags(options).tags.map(renderShopifyScriptTag);\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA0DA,SAAgB,qBAAqB,EACnC,WACA,SACA,OACA,MACA,OACA,MACA,mBAAmB,MACnB,QAAQ,SACgD;CACxD,MAAM,kBAAkB,UAAU,SAAY,EAAE,OAAO,GAAG;CAC1D,MAAM,kBAAkB,0BAA0B;EAAE;EAAW;EAAS;EAAM,CAAC;CAE/E,MAAM,QAAiC;EACrC;GACE,SAAS;GACT,YAAY;IACV,KAAK;IACL,MAAM;IACP;GACF;EACD;GACE,SAAS;GACT,YAAY;IACV,KAAK;IACL,MAAM;IACP;GACF;EACD;GACE,SAAS;GACT,YAAY;IACV,KAAK;IACL,IAAI;IACJ,MAAM;IACN,aAAa;IACd;GACF;EACF;CACD,MAAM,UAAqC,CACzC;EACE,SAAS;EACT,YAAY;GAAE,IAAI;GAA4B,GAAG;GAAiB;EAClE,WAAW,gCAAgC;GAAE;GAAM;GAAM,CAAC;EAC3D,EACD;EACE,SAAS;EACT,YAAY;GACV,IAAI;GACJ,MAAM;GACN,aAAa;GACb,GAAG;GACH,KAAK;GACN;EACF,CACF;AAeD,KAAI,MACF,SAAQ,KAAK;EACX,SAAS;EACT,YAAY;GACV,IAAI;GACJ,MAAM;GACN,OAAO;GACP,aAAa;GACb,GAAG;GACH,KAAK;GACN;EACF,CAAC;AAMJ,SAAQ,KAAK;EACX,SAAS;EACT,YAAY;GACV,IAAI;GACJ,OAAO;GACP,aAAa;GACb,GAAG;GACH,KACE,SAAS,SAAS,mBACd,gCACA;GACP;EACF,CAAC;AAGF,SAAQ,KAAK;EACX,SAAS;EACT,YAAY;GAAE,IAAI;GAA6B,GAAG;GAAiB;EACnE,WAAW,gCAAgC,QAAQ;EACpD,CAAC;AAIF,SAAQ,KAAK;EACX,SAAS;EACT,YAAY;GAAE,IAAI;GAAyB,GAAG;GAAiB;EAC/D,WAAW,6BAA6B,gBAAgB;EACzD,CAAC;AAEF,KAAI,iBACF,SAAQ,KAAK;EACX,SAAS;EACT,YAAY;GACV,IAAI;GACJ,OAAO;GACP,aAAa;GACb,GAAG;GACH,KAAK;GACN;EACF,CAAC;CAGJ,MAAM,gBAAgB,iBAAiB,MAAM,gBAAgB;AAC7D,KAAI,cACF,SAAQ,KAAK,cAAc;AAG7B,QAAO;EACL;EACA;EACA,IAAI,OAAO;AACT,UAAO,CAAC,GAAG,OAAO,GAAG,QAAQ;;EAEhC;;;;;AAMH,SAAgB,wBAAwB,SAA6C;AACnF,QAAO,qBAAqB,QAAQ,CAAC,KAAK,IAAI,uBAAuB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InitializeShopifyScriptsOptions } from "./types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/shopify-scripts/initialize.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Initializes Shopify browser script behavior for frameworks without a Hydrogen binding.
|
|
6
|
+
*
|
|
7
|
+
* This is the browser hydration half of `getShopifyScriptTags()`: framework bindings combine both
|
|
8
|
+
* into a `ShopifyScripts` component, while custom integrations can render script tags during SSR
|
|
9
|
+
* and call this helper from their browser lifecycle.
|
|
10
|
+
*/
|
|
11
|
+
declare function initializeShopifyScripts({
|
|
12
|
+
navigate,
|
|
13
|
+
routes,
|
|
14
|
+
webMcp
|
|
15
|
+
}: InitializeShopifyScriptsOptions): Promise<boolean | void>;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { initializeShopifyScripts };
|
|
18
|
+
//# sourceMappingURL=initialize.d.mts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { configureShopifyRouting } from "./global.mjs";
|
|
2
|
+
import { initializeDeprecatedCookies } from "./deprecated-cookies.mjs";
|
|
3
|
+
import { initializeShopifyPageViewEvents } from "./page-view.mjs";
|
|
4
|
+
import { loadShopifyWebMcpTools } from "./webmcp.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/core/shopify-scripts/initialize.ts
|
|
7
|
+
/**
|
|
8
|
+
* Initializes Shopify browser script behavior for frameworks without a Hydrogen binding.
|
|
9
|
+
*
|
|
10
|
+
* This is the browser hydration half of `getShopifyScriptTags()`: framework bindings combine both
|
|
11
|
+
* into a `ShopifyScripts` component, while custom integrations can render script tags during SSR
|
|
12
|
+
* and call this helper from their browser lifecycle.
|
|
13
|
+
*/
|
|
14
|
+
function initializeShopifyScripts({ navigate, routes, webMcp = true }) {
|
|
15
|
+
configureShopifyRouting({
|
|
16
|
+
navigate,
|
|
17
|
+
routes
|
|
18
|
+
});
|
|
19
|
+
initializeDeprecatedCookies();
|
|
20
|
+
initializeShopifyPageViewEvents();
|
|
21
|
+
if (!webMcp) return Promise.resolve();
|
|
22
|
+
return loadShopifyWebMcpTools();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
export { initializeShopifyScripts };
|
|
27
|
+
//# sourceMappingURL=initialize.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.mjs","names":[],"sources":["../../../src/core/shopify-scripts/initialize.ts"],"sourcesContent":["import { initializeDeprecatedCookies } from \"./deprecated-cookies\";\nimport { configureShopifyRouting } from \"./global\";\nimport { initializeShopifyPageViewEvents } from \"./page-view\";\nimport type { InitializeShopifyScriptsOptions } from \"./types\";\nimport { loadShopifyWebMcpTools } from \"./webmcp\";\n\n/**\n * Initializes Shopify browser script behavior for frameworks without a Hydrogen binding.\n *\n * This is the browser hydration half of `getShopifyScriptTags()`: framework bindings combine both\n * into a `ShopifyScripts` component, while custom integrations can render script tags during SSR\n * and call this helper from their browser lifecycle.\n */\nexport function initializeShopifyScripts({\n navigate,\n routes,\n webMcp = true,\n}: InitializeShopifyScriptsOptions): Promise<boolean | void> {\n configureShopifyRouting({ navigate, routes });\n initializeDeprecatedCookies();\n initializeShopifyPageViewEvents();\n\n if (!webMcp) return Promise.resolve();\n\n return loadShopifyWebMcpTools();\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,yBAAyB,EACvC,UACA,QACA,SAAS,QACkD;AAC3D,yBAAwB;EAAE;EAAU;EAAQ,CAAC;AAC7C,8BAA6B;AAC7B,kCAAiC;AAEjC,KAAI,CAAC,OAAQ,QAAO,QAAQ,SAAS;AAErC,QAAO,wBAAwB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SHOPIFY_PERF_KIT_SCRIPT_ID } from "./constants.mjs";
|
|
2
|
+
import { observeNavigation } from "./utils/navigation.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/shopify-scripts/page-view.ts
|
|
5
|
+
let cleanupPageViewEvents;
|
|
6
|
+
const getPageKey = () => `${window.location.pathname}${window.location.search}`;
|
|
7
|
+
const getPageTemplate = (url = window.location.href) => window.Shopify?.routes?.match?.(url)?.pageTemplateName ?? "unknown";
|
|
8
|
+
const importStandardEventsFromCDN = () => import("https://cdn.shopify.com/storefront/standard-events.js");
|
|
9
|
+
function initializeShopifyPageViewEvents(importStandardEvents = importStandardEventsFromCDN) {
|
|
10
|
+
if (cleanupPageViewEvents) return cleanupPageViewEvents;
|
|
11
|
+
document.getElementById(SHOPIFY_PERF_KIT_SCRIPT_ID)?.setAttribute("data-page-type", getPageTemplate());
|
|
12
|
+
const standardEventsPromise = importStandardEvents().catch(() => void 0);
|
|
13
|
+
let lastPageKey = getPageKey();
|
|
14
|
+
let scheduledNavigation;
|
|
15
|
+
const emitPageView = () => {
|
|
16
|
+
const page = {
|
|
17
|
+
template: getPageTemplate(),
|
|
18
|
+
title: document.title,
|
|
19
|
+
url: window.location.href
|
|
20
|
+
};
|
|
21
|
+
standardEventsPromise.then((StandardEvents) => {
|
|
22
|
+
if (!StandardEvents) return;
|
|
23
|
+
document.dispatchEvent(new StandardEvents.PageViewEvent({ page }));
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const stopObservingNavigation = observeNavigation(() => {
|
|
27
|
+
const pageKey = getPageKey();
|
|
28
|
+
if (pageKey === lastPageKey) return;
|
|
29
|
+
lastPageKey = pageKey;
|
|
30
|
+
if (scheduledNavigation !== void 0) cancelAnimationFrame(scheduledNavigation);
|
|
31
|
+
scheduledNavigation = requestAnimationFrame(() => {
|
|
32
|
+
scheduledNavigation = void 0;
|
|
33
|
+
emitPageView();
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", emitPageView, { once: true });
|
|
37
|
+
else emitPageView();
|
|
38
|
+
cleanupPageViewEvents = () => {
|
|
39
|
+
document.removeEventListener("DOMContentLoaded", emitPageView);
|
|
40
|
+
stopObservingNavigation();
|
|
41
|
+
if (scheduledNavigation !== void 0) cancelAnimationFrame(scheduledNavigation);
|
|
42
|
+
cleanupPageViewEvents = void 0;
|
|
43
|
+
};
|
|
44
|
+
return cleanupPageViewEvents;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
//#endregion
|
|
48
|
+
export { initializeShopifyPageViewEvents };
|
|
49
|
+
//# sourceMappingURL=page-view.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-view.mjs","names":[],"sources":["../../../src/core/shopify-scripts/page-view.ts"],"sourcesContent":["import type * as StandardEventsModule from \"../../../vendor/standard-events\";\nimport { SHOPIFY_PERF_KIT_SCRIPT_ID } from \"./constants\";\nimport { observeNavigation } from \"./utils/navigation\";\n\nlet cleanupPageViewEvents: (() => void) | undefined;\n\nconst getPageKey = () => `${window.location.pathname}${window.location.search}`;\nconst getPageTemplate = (url = window.location.href) =>\n window.Shopify?.routes?.match?.(url)?.pageTemplateName ?? \"unknown\";\n\n// Keep this URL inline so consumer bundlers such as Vite recognize it as an external import.\nconst importStandardEventsFromCDN: () => Promise<\n Pick<typeof StandardEventsModule, \"PageViewEvent\">\n> = () =>\n // @ts-expect-error CDN package without automatic types\n import(\"https://cdn.shopify.com/storefront/standard-events.js\");\n\nexport function initializeShopifyPageViewEvents(\n importStandardEvents = importStandardEventsFromCDN,\n) {\n if (cleanupPageViewEvents) return cleanupPageViewEvents;\n\n // Update the PerfKit script with the current page type since it\n // might miss the initial page view if it was loaded after the script.\n document\n .getElementById(SHOPIFY_PERF_KIT_SCRIPT_ID)\n ?.setAttribute(\"data-page-type\", getPageTemplate());\n\n const standardEventsPromise = importStandardEvents().catch(() => undefined);\n let lastPageKey = getPageKey();\n let scheduledNavigation: number | undefined;\n\n const emitPageView = () => {\n const page = {\n template: getPageTemplate(),\n title: document.title,\n url: window.location.href,\n } satisfies StandardEventsModule.PageViewEvent[\"page\"];\n\n void standardEventsPromise.then((StandardEvents) => {\n if (!StandardEvents) return;\n document.dispatchEvent(new StandardEvents.PageViewEvent({ page }));\n });\n };\n\n const stopObservingNavigation = observeNavigation(() => {\n const pageKey = getPageKey();\n if (pageKey === lastPageKey) return;\n\n lastPageKey = pageKey;\n if (scheduledNavigation !== undefined) {\n cancelAnimationFrame(scheduledNavigation);\n }\n scheduledNavigation = requestAnimationFrame(() => {\n scheduledNavigation = undefined;\n emitPageView();\n });\n });\n\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", emitPageView, { once: true });\n } else {\n emitPageView();\n }\n\n cleanupPageViewEvents = () => {\n document.removeEventListener(\"DOMContentLoaded\", emitPageView);\n stopObservingNavigation();\n if (scheduledNavigation !== undefined) cancelAnimationFrame(scheduledNavigation);\n cleanupPageViewEvents = undefined;\n };\n\n return cleanupPageViewEvents;\n}\n"],"mappings":";;;;AAIA,IAAI;AAEJ,MAAM,mBAAmB,GAAG,OAAO,SAAS,WAAW,OAAO,SAAS;AACvE,MAAM,mBAAmB,MAAM,OAAO,SAAS,SAC7C,OAAO,SAAS,QAAQ,QAAQ,IAAI,EAAE,oBAAoB;AAG5D,MAAM,oCAIJ,OAAO;AAET,SAAgB,gCACd,uBAAuB,6BACvB;AACA,KAAI,sBAAuB,QAAO;AAIlC,UACG,eAAe,2BAA2B,EACzC,aAAa,kBAAkB,iBAAiB,CAAC;CAErD,MAAM,wBAAwB,sBAAsB,CAAC,YAAY,OAAU;CAC3E,IAAI,cAAc,YAAY;CAC9B,IAAI;CAEJ,MAAM,qBAAqB;EACzB,MAAM,OAAO;GACX,UAAU,iBAAiB;GAC3B,OAAO,SAAS;GAChB,KAAK,OAAO,SAAS;GACtB;AAED,EAAK,sBAAsB,MAAM,mBAAmB;AAClD,OAAI,CAAC,eAAgB;AACrB,YAAS,cAAc,IAAI,eAAe,cAAc,EAAE,MAAM,CAAC,CAAC;IAClE;;CAGJ,MAAM,0BAA0B,wBAAwB;EACtD,MAAM,UAAU,YAAY;AAC5B,MAAI,YAAY,YAAa;AAE7B,gBAAc;AACd,MAAI,wBAAwB,OAC1B,sBAAqB,oBAAoB;AAE3C,wBAAsB,4BAA4B;AAChD,yBAAsB;AACtB,iBAAc;IACd;GACF;AAEF,KAAI,SAAS,eAAe,UAC1B,UAAS,iBAAiB,oBAAoB,cAAc,EAAE,MAAM,MAAM,CAAC;KAE3E,eAAc;AAGhB,+BAA8B;AAC5B,WAAS,oBAAoB,oBAAoB,aAAa;AAC9D,2BAAyB;AACzB,MAAI,wBAAwB,OAAW,sBAAqB,oBAAoB;AAChF,0BAAwB;;AAG1B,QAAO"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SHOPIFY_PERF_KIT_SCRIPT, SHOPIFY_PERF_KIT_SCRIPT_ID } from "./constants.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/shopify-scripts/perfkit.ts
|
|
4
|
+
const SHOPIFY_SHOP_ID_PATTERN = /^\d+$/;
|
|
5
|
+
function getPerfKitScript(shop, extraAttributes) {
|
|
6
|
+
if (!shop.storefrontId) return;
|
|
7
|
+
const shopId = parseNumericShopId(shop.shopId);
|
|
8
|
+
if (!shopId) return;
|
|
9
|
+
return {
|
|
10
|
+
tagName: "script",
|
|
11
|
+
attributes: {
|
|
12
|
+
id: SHOPIFY_PERF_KIT_SCRIPT_ID,
|
|
13
|
+
...extraAttributes,
|
|
14
|
+
async: true,
|
|
15
|
+
src: SHOPIFY_PERF_KIT_SCRIPT,
|
|
16
|
+
"data-application": "hydrogen",
|
|
17
|
+
"data-shop-id": shopId,
|
|
18
|
+
"data-storefront-id": shop.storefrontId,
|
|
19
|
+
"data-monorail-region": "global",
|
|
20
|
+
"data-spa-mode": "true",
|
|
21
|
+
"data-resource-timing-sampling-rate": "10"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function parseNumericShopId(shopId) {
|
|
26
|
+
const parsedShopId = shopId.split("/").pop();
|
|
27
|
+
if (!parsedShopId) return;
|
|
28
|
+
return SHOPIFY_SHOP_ID_PATTERN.test(parsedShopId) ? parsedShopId : void 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { getPerfKitScript };
|
|
33
|
+
//# sourceMappingURL=perfkit.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perfkit.mjs","names":[],"sources":["../../../src/core/shopify-scripts/perfkit.ts"],"sourcesContent":["import { SHOPIFY_PERF_KIT_SCRIPT, SHOPIFY_PERF_KIT_SCRIPT_ID } from \"./constants\";\nimport type {\n ShopifyScriptDescriptor,\n ShopifyScriptsShop,\n ShopifyScriptTagAttributes,\n} from \"./types\";\n\nconst SHOPIFY_SHOP_ID_PATTERN = /^\\d+$/;\n\nexport function getPerfKitScript(\n shop: ShopifyScriptsShop,\n extraAttributes?: Pick<ShopifyScriptTagAttributes, \"nonce\">,\n): ShopifyScriptDescriptor | undefined {\n if (!shop.storefrontId) return;\n\n const shopId = parseNumericShopId(shop.shopId);\n if (!shopId) return;\n\n return {\n tagName: \"script\",\n attributes: {\n id: SHOPIFY_PERF_KIT_SCRIPT_ID,\n ...extraAttributes,\n async: true,\n src: SHOPIFY_PERF_KIT_SCRIPT,\n \"data-application\": \"hydrogen\",\n \"data-shop-id\": shopId,\n \"data-storefront-id\": shop.storefrontId,\n \"data-monorail-region\": \"global\",\n \"data-spa-mode\": \"true\",\n \"data-resource-timing-sampling-rate\": \"10\",\n },\n };\n}\n\nfunction parseNumericShopId(shopId: ShopifyScriptsShop[\"shopId\"]): string | undefined {\n const parsedShopId = shopId.split(\"/\").pop();\n if (!parsedShopId) return;\n\n return SHOPIFY_SHOP_ID_PATTERN.test(parsedShopId) ? parsedShopId : undefined;\n}\n"],"mappings":";;;AAOA,MAAM,0BAA0B;AAEhC,SAAgB,iBACd,MACA,iBACqC;AACrC,KAAI,CAAC,KAAK,aAAc;CAExB,MAAM,SAAS,mBAAmB,KAAK,OAAO;AAC9C,KAAI,CAAC,OAAQ;AAEb,QAAO;EACL,SAAS;EACT,YAAY;GACV,IAAI;GACJ,GAAG;GACH,OAAO;GACP,KAAK;GACL,oBAAoB;GACpB,gBAAgB;GAChB,sBAAsB,KAAK;GAC3B,wBAAwB;GACxB,iBAAiB;GACjB,sCAAsC;GACvC;EACF;;AAGH,SAAS,mBAAmB,QAA0D;CACpF,MAAM,eAAe,OAAO,MAAM,IAAI,CAAC,KAAK;AAC5C,KAAI,CAAC,aAAc;AAEnB,QAAO,wBAAwB,KAAK,aAAa,GAAG,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/core/shopify-scripts/render.ts
|
|
2
|
+
/**
|
|
3
|
+
* Renders a Shopify script/link descriptor to an HTML string.
|
|
4
|
+
*/
|
|
5
|
+
function renderShopifyScriptTag({ tagName, attributes, innerHTML }) {
|
|
6
|
+
const serializedAttributes = Object.entries(attributes ?? {}).map(renderHtmlAttribute).filter((attribute) => Boolean(attribute)).join(" ");
|
|
7
|
+
const openingTag = serializedAttributes ? `<${tagName} ${serializedAttributes}>` : `<${tagName}>`;
|
|
8
|
+
if (tagName === "link") return openingTag;
|
|
9
|
+
return `${openingTag}${innerHTML ?? ""}<\/script>`;
|
|
10
|
+
}
|
|
11
|
+
function renderHtmlAttribute([name, value]) {
|
|
12
|
+
if (value === false) return;
|
|
13
|
+
const serializedName = name.toLowerCase();
|
|
14
|
+
if (value === true) return serializedName;
|
|
15
|
+
return `${serializedName}="${escapeHtmlAttribute(value)}"`;
|
|
16
|
+
}
|
|
17
|
+
function escapeHtmlAttribute(value) {
|
|
18
|
+
return value.replace(/&/g, "&").replace(/"/g, """);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
//#endregion
|
|
22
|
+
export { renderShopifyScriptTag };
|
|
23
|
+
//# sourceMappingURL=render.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.mjs","names":[],"sources":["../../../src/core/shopify-scripts/render.ts"],"sourcesContent":["import type { ShopifyAttributeValue, ShopifyScriptTagDescriptor } from \"./types\";\n\n/**\n * Renders a Shopify script/link descriptor to an HTML string.\n */\nexport function renderShopifyScriptTag({\n tagName,\n attributes,\n innerHTML,\n}: ShopifyScriptTagDescriptor): string {\n const serializedAttributes = Object.entries(attributes ?? {})\n .map(renderHtmlAttribute)\n .filter((attribute): attribute is string => Boolean(attribute))\n .join(\" \");\n const openingTag = serializedAttributes ? `<${tagName} ${serializedAttributes}>` : `<${tagName}>`;\n\n if (tagName === \"link\") return openingTag;\n\n return `${openingTag}${innerHTML ?? \"\"}</script>`;\n}\n\nfunction renderHtmlAttribute([name, value]: [string, ShopifyAttributeValue]): string | undefined {\n if (value === false) return;\n\n const serializedName = name.toLowerCase();\n if (value === true) return serializedName;\n\n return `${serializedName}=\"${escapeHtmlAttribute(value)}\"`;\n}\n\nfunction escapeHtmlAttribute(value: string): string {\n return value.replace(/&/g, \"&\").replace(/\"/g, \""\");\n}\n"],"mappings":";;;;AAKA,SAAgB,uBAAuB,EACrC,SACA,YACA,aACqC;CACrC,MAAM,uBAAuB,OAAO,QAAQ,cAAc,EAAE,CAAC,CAC1D,IAAI,oBAAoB,CACxB,QAAQ,cAAmC,QAAQ,UAAU,CAAC,CAC9D,KAAK,IAAI;CACZ,MAAM,aAAa,uBAAuB,IAAI,QAAQ,GAAG,qBAAqB,KAAK,IAAI,QAAQ;AAE/F,KAAI,YAAY,OAAQ,QAAO;AAE/B,QAAO,GAAG,aAAa,aAAa,GAAG;;AAGzC,SAAS,oBAAoB,CAAC,MAAM,QAA6D;AAC/F,KAAI,UAAU,MAAO;CAErB,MAAM,iBAAiB,KAAK,aAAa;AACzC,KAAI,UAAU,KAAM,QAAO;AAE3B,QAAO,GAAG,eAAe,IAAI,oBAAoB,MAAM,CAAC;;AAG1D,SAAS,oBAAoB,OAAuB;AAClD,QAAO,MAAM,QAAQ,MAAM,QAAQ,CAAC,QAAQ,MAAM,SAAS"}
|