@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,102 @@
|
|
|
1
|
+
//#region src/core/shop-pay/shop-pay.d.ts
|
|
2
|
+
declare const SHOP_PAY_BUTTON_TAG_NAME = "hydrogen-shop-pay-button";
|
|
3
|
+
type ShopPayButtonBaseOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Absolute checkout base URL. Omit it to emit same-origin `/checkout` and
|
|
6
|
+
* `/cart` permalink paths, which `handleShopifyRoutes` redirects to the
|
|
7
|
+
* store's real checkout.
|
|
8
|
+
*/
|
|
9
|
+
checkoutUrl?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Checkout payment mode. Defaults to `"shop_pay"`. Use
|
|
12
|
+
* `"shop_pay_installments"` only when the checkout path should open Shop Pay
|
|
13
|
+
* Installments.
|
|
14
|
+
*/
|
|
15
|
+
paymentOption?: "shop_pay" | "shop_pay_installments";
|
|
16
|
+
/**
|
|
17
|
+
* Attribution source appended to the checkout URL as `source`. Defaults to
|
|
18
|
+
* `"hydrogen"`. Most storefronts should not override this.
|
|
19
|
+
*/
|
|
20
|
+
source?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Optional attribution token appended to the checkout URL as `source_token`.
|
|
23
|
+
* Only pass a value when Shopify has provided one for the integration.
|
|
24
|
+
*/
|
|
25
|
+
sourceToken?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Content Security Policy nonce applied to the shadow root's inline style.
|
|
28
|
+
*/
|
|
29
|
+
nonce?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Sales channel that issued the Storefront API token. Omit it unless checkout
|
|
32
|
+
* needs explicit `"headless"` or `"hydrogen"` attribution.
|
|
33
|
+
*/
|
|
34
|
+
channel?: "headless" | "hydrogen";
|
|
35
|
+
/**
|
|
36
|
+
* Disables the button. Disabled buttons render without an `href` and include
|
|
37
|
+
* `aria-disabled="true"`.
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* CSS width for the rendered anchor, for example `"100%"`. Omit it to use
|
|
42
|
+
* the Shop Pay default width.
|
|
43
|
+
*/
|
|
44
|
+
width?: string;
|
|
45
|
+
/**
|
|
46
|
+
* CSS border radius for the rendered anchor, for example `"8px"`. Omit it to
|
|
47
|
+
* use the Shop Pay default radius.
|
|
48
|
+
*/
|
|
49
|
+
borderRadius?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Localized accessible label for the Shop Pay logo. Defaults to `"Buy with Shop Pay"`.
|
|
52
|
+
* Never translate the brand name `"Shop Pay"`; keep it in Latin script in every locale.
|
|
53
|
+
*
|
|
54
|
+
* @example English
|
|
55
|
+
* `"Buy with Shop Pay"`
|
|
56
|
+
*
|
|
57
|
+
* @example Japanese
|
|
58
|
+
* `"Shop Payで購入"`
|
|
59
|
+
*
|
|
60
|
+
* @example Hindi
|
|
61
|
+
* `"Shop Pay से खरीदें"`
|
|
62
|
+
*
|
|
63
|
+
* @example Arabic
|
|
64
|
+
* `"الشراء باستخدام Shop Pay"`
|
|
65
|
+
*/
|
|
66
|
+
accessibilityLabel?: string;
|
|
67
|
+
};
|
|
68
|
+
type ShopPayVariantWithQuantity = {
|
|
69
|
+
/** ProductVariant GID or bare numeric ProductVariant ID. Product IDs are invalid. */id: string; /** Quantity for this variant. Defaults to `1`. */
|
|
70
|
+
quantity?: number;
|
|
71
|
+
};
|
|
72
|
+
type ShopPayVariants = readonly string[] | readonly ShopPayVariantWithQuantity[];
|
|
73
|
+
type ShopPayButtonOptions = ShopPayButtonBaseOptions & {
|
|
74
|
+
/**
|
|
75
|
+
* Variants to check out immediately via a Shopify cart permalink. Omit this
|
|
76
|
+
* for cart checkout mode, where `/checkout` checks out the current cart.
|
|
77
|
+
*/
|
|
78
|
+
variants?: ShopPayVariants;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Builds the checkout URL the Shop Pay button navigates to, or `null` when the
|
|
82
|
+
* button is disabled. Variant mode produces a cart permalink; otherwise the
|
|
83
|
+
* current cart checks out.
|
|
84
|
+
*/
|
|
85
|
+
declare function getShopPayButtonUrl(options: ShopPayButtonOptions): string | null;
|
|
86
|
+
/**
|
|
87
|
+
* Renders the Shop Pay button as an HTML string: a self-contained wrapper
|
|
88
|
+
* element carrying the styles and anchor it needs to work without client
|
|
89
|
+
* JavaScript. Use it from server templates or frameworks without a Hydrogen
|
|
90
|
+
* binding.
|
|
91
|
+
*/
|
|
92
|
+
declare function renderShopPayButton(options: ShopPayButtonOptions): string;
|
|
93
|
+
/**
|
|
94
|
+
* Creates the Shop Pay button as a detached DOM element. The returned element
|
|
95
|
+
* carries the button styles with it.
|
|
96
|
+
*/
|
|
97
|
+
declare function createShopPayButton(options: ShopPayButtonOptions): HTMLElement;
|
|
98
|
+
/** Registers the Shop Pay custom element. No-ops during SSR or when already registered. */
|
|
99
|
+
declare function defineShopPayButton(): void;
|
|
100
|
+
//#endregion
|
|
101
|
+
export { SHOP_PAY_BUTTON_TAG_NAME, ShopPayButtonOptions, createShopPayButton, defineShopPayButton, getShopPayButtonUrl, renderShopPayButton };
|
|
102
|
+
//# sourceMappingURL=shop-pay.d.mts.map
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { normalizeStoreDomain } from "../url.mjs";
|
|
2
|
+
import { parseGid } from "../utils/parse-gid.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/shop-pay/shop-pay.ts
|
|
5
|
+
const DEFAULT_SOURCE = "hydrogen";
|
|
6
|
+
const DEFAULT_ACCESSIBILITY_LABEL = "Buy with Shop Pay";
|
|
7
|
+
const ERROR_PREFIX = "[hydrogen:error:ShopPay]";
|
|
8
|
+
const CAN_USE_DOM = typeof document !== "undefined";
|
|
9
|
+
const SHOP_PAY_BUTTON_TAG_NAME = "hydrogen-shop-pay-button";
|
|
10
|
+
const SHOP_PAY_BUTTON_CLASS_NAME = "shop-pay-button";
|
|
11
|
+
const SHOP_PAY_BUTTON_OBSERVED_ATTRIBUTES = [
|
|
12
|
+
"accessibility-label",
|
|
13
|
+
"border-radius",
|
|
14
|
+
"channel",
|
|
15
|
+
"checkout-url",
|
|
16
|
+
"disabled",
|
|
17
|
+
"nonce",
|
|
18
|
+
"payment-option",
|
|
19
|
+
"source",
|
|
20
|
+
"source-token",
|
|
21
|
+
"variants",
|
|
22
|
+
"width"
|
|
23
|
+
];
|
|
24
|
+
/** Button styles matching the hosted shop-js pay button. */
|
|
25
|
+
const SHOP_PAY_BUTTON_STYLES = `:host{display:block}.${SHOP_PAY_BUTTON_CLASS_NAME}{position:relative;display:flex;align-items:center;box-sizing:border-box;margin:0;padding:10px 16px;overflow:visible;width:260px;border:none;border-radius:12px;background-color:#5433eb;color:#fff;cursor:pointer;text-decoration:none;transition:all .15s cubic-bezier(.4,0,.2,1)}.${SHOP_PAY_BUTTON_CLASS_NAME}:hover{background-color:#4524db}.${SHOP_PAY_BUTTON_CLASS_NAME}:focus-visible{outline:none;box-shadow:0 0 0 3px #9c83f8}.${SHOP_PAY_BUTTON_CLASS_NAME}[aria-disabled=true]{opacity:.5;pointer-events:none;cursor:default}.${SHOP_PAY_BUTTON_CLASS_NAME}__logo{position:relative;display:inline-block;margin:0 auto;width:88px;height:auto}`;
|
|
26
|
+
const SHOP_PAY_LOGO_SVG = `<svg class="${SHOP_PAY_BUTTON_CLASS_NAME}__logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 99 25" aria-hidden="true" focusable="false"><path fill="currentColor" d="M70.842 7.915h2.25c1.561 0 2.328.642 2.328 1.715 0 1.074-.739 1.715-2.259 1.715h-2.32v-3.43ZM80.525 16.142c-.879 0-1.227-.474-1.227-.948 0-.642.725-.935 2.147-1.102l1.115-.125c-.07 1.227-.892 2.175-2.035 2.175Z"/><path fill="currentColor" fill-rule="evenodd" d="M65.645.5a3.64 3.64 0 0 0-3.64 3.64V20.7a3.64 3.64 0 0 0 3.64 3.64h29.668a3.64 3.64 0 0 0 3.64-3.64V4.14A3.64 3.64 0 0 0 95.314.5H65.645Zm5.197 16.674v-4.197h2.64c2.412 0 3.695-1.353 3.695-3.402 0-2.05-1.283-3.277-3.695-3.277h-4.341v10.876h1.7Zm9.334.223c1.297 0 2.147-.572 2.538-1.548.112 1.088.767 1.645 2.189 1.269l.014-1.157c-.572.055-.683-.154-.683-.753v-2.845c0-1.673-1.102-2.663-3.138-2.663-2.008 0-3.165 1.004-3.165 2.705h1.562c0-.809.572-1.297 1.576-1.297 1.06 0 1.547.46 1.534 1.255v.363l-1.8.195c-2.021.223-3.137.99-3.137 2.329 0 1.101.781 2.147 2.51 2.147Zm9.906.32c-.711 1.73-1.855 2.245-3.64 2.245h-.766V18.54h.822c.977 0 1.45-.307 1.966-1.185L85.3 9.923h1.757l2.259 5.424 2.008-5.424h1.715l-2.956 7.795Z" clip-rule="evenodd"/><path fill="currentColor" d="M6.992 11.055c-2.359-.509-3.41-.708-3.41-1.612 0-.85.711-1.274 2.134-1.274 1.25 0 2.165.544 2.839 1.61.05.081.155.11.241.066l2.655-1.335a.186.186 0 0 0 .076-.259c-1.102-1.9-3.137-2.94-5.818-2.94C2.188 5.311 0 7.037 0 9.781c0 2.915 2.664 3.651 5.027 4.16 2.362.51 3.417.709 3.417 1.613s-.769 1.33-2.303 1.33c-1.416 0-2.467-.644-3.102-1.896a.186.186 0 0 0-.251-.082L.14 16.21a.188.188 0 0 0-.083.253c1.051 2.102 3.207 3.285 6.087 3.285 3.668 0 5.885-1.698 5.885-4.527 0-2.83-2.677-3.651-5.037-4.16v-.007ZM21.218 5.311c-1.505 0-2.835.531-3.791 1.477-.06.057-.159.015-.159-.067V.687A.185.185 0 0 0 17.081.5h-3.322a.185.185 0 0 0-.187.187v18.73c0 .104.083.186.187.186h3.322a.185.185 0 0 0 .187-.186V11.2c0-1.587 1.223-2.804 2.87-2.804 1.649 0 2.843 1.191 2.843 2.804v8.216c0 .104.082.186.187.186h3.322a.185.185 0 0 0 .187-.186V11.2c0-3.452-2.274-5.89-5.459-5.89ZM33.415 4.774c-1.803 0-3.493.55-4.706 1.343a.186.186 0 0 0-.06.25l1.464 2.488c.054.089.168.12.257.066a5.853 5.853 0 0 1 3.052-.834c2.899 0 5.03 2.036 5.03 4.726 0 2.292-1.706 3.99-3.868 3.99-1.762 0-2.985-1.022-2.985-2.463 0-.825.352-1.502 1.27-1.98a.183.183 0 0 0 .073-.258l-1.381-2.327a.187.187 0 0 0-.226-.079c-1.85.683-3.15 2.327-3.15 4.533 0 3.338 2.67 5.83 6.396 5.83 4.35 0 7.478-3 7.478-7.303 0-4.612-3.64-7.982-8.644-7.982ZM51.776 5.283c-1.68 0-3.182.62-4.277 1.707a.093.093 0 0 1-.16-.066v-1.31a.185.185 0 0 0-.187-.186h-3.235a.185.185 0 0 0-.188.187v18.702c0 .104.083.186.188.186h3.32a.185.185 0 0 0 .188-.186v-6.133c0-.082.099-.123.16-.07 1.091 1.012 2.536 1.603 4.19 1.603 3.897 0 6.936-3.139 6.936-7.217 0-4.078-3.042-7.217-6.935-7.217Zm-.63 11.266c-2.215 0-3.895-1.754-3.895-4.074S48.928 8.4 51.147 8.4c2.22 0 3.893 1.726 3.893 4.075 0 2.348-1.651 4.074-3.896 4.074h.003Z"/></svg>`;
|
|
27
|
+
/**
|
|
28
|
+
* Builds the checkout URL the Shop Pay button navigates to, or `null` when the
|
|
29
|
+
* button is disabled. Variant mode produces a cart permalink; otherwise the
|
|
30
|
+
* current cart checks out.
|
|
31
|
+
*/
|
|
32
|
+
function getShopPayButtonUrl(options) {
|
|
33
|
+
if (options.disabled) return null;
|
|
34
|
+
const variants = getShopPayVariants(options);
|
|
35
|
+
if (!options.checkoutUrl) {
|
|
36
|
+
const search = getShopPaySearchParams(options);
|
|
37
|
+
return `${variants ? `/cart/${variants}` : "/checkout"}?${search}`;
|
|
38
|
+
}
|
|
39
|
+
const url = variants ? getShopPayVariantModeUrl(options.checkoutUrl, variants) : getShopPayCheckoutModeUrl(options.checkoutUrl);
|
|
40
|
+
for (const [name, value] of getShopPaySearchParams(options)) url.searchParams.set(name, value);
|
|
41
|
+
return url.toString();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Renders the Shop Pay button as an HTML string: a self-contained wrapper
|
|
45
|
+
* element carrying the styles and anchor it needs to work without client
|
|
46
|
+
* JavaScript. Use it from server templates or frameworks without a Hydrogen
|
|
47
|
+
* binding.
|
|
48
|
+
*/
|
|
49
|
+
function renderShopPayButton(options) {
|
|
50
|
+
defineShopPayButton();
|
|
51
|
+
const attributes = serializeAttributes(getShopPayButtonElementAttributes(options));
|
|
52
|
+
const content = CAN_USE_DOM ? "" : getShopPayButtonDeclarativeShadowDomHtml(options);
|
|
53
|
+
return `<${SHOP_PAY_BUTTON_TAG_NAME}${attributes ? ` ${attributes}` : ""}>${content}</${SHOP_PAY_BUTTON_TAG_NAME}>`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Creates the Shop Pay button as a detached DOM element. The returned element
|
|
57
|
+
* carries the button styles with it.
|
|
58
|
+
*/
|
|
59
|
+
function createShopPayButton(options) {
|
|
60
|
+
defineShopPayButton();
|
|
61
|
+
const element = document.createElement(SHOP_PAY_BUTTON_TAG_NAME);
|
|
62
|
+
initializeShopPayButtonElement(element, options);
|
|
63
|
+
return element;
|
|
64
|
+
}
|
|
65
|
+
function initializeShopPayButtonElement(element, options) {
|
|
66
|
+
syncShopPayButtonElementAttributes(element, getShopPayButtonElementAttributes(options));
|
|
67
|
+
const shadowRoot = element.shadowRoot ?? element.attachShadow({ mode: "open" });
|
|
68
|
+
const template = element.querySelector("template[shadowrootmode]");
|
|
69
|
+
if (template instanceof HTMLTemplateElement) {
|
|
70
|
+
shadowRoot.append(template.content.cloneNode(true));
|
|
71
|
+
template.remove();
|
|
72
|
+
}
|
|
73
|
+
renderShopPayButtonShadowRoot(shadowRoot, options);
|
|
74
|
+
}
|
|
75
|
+
/** Registers the Shop Pay custom element. No-ops during SSR or when already registered. */
|
|
76
|
+
function defineShopPayButton() {
|
|
77
|
+
if (typeof customElements === "undefined" || typeof HTMLElement === "undefined" || customElements.get("hydrogen-shop-pay-button")) return;
|
|
78
|
+
customElements.define(SHOP_PAY_BUTTON_TAG_NAME, class extends HTMLElement {
|
|
79
|
+
#connected = false;
|
|
80
|
+
static observedAttributes = SHOP_PAY_BUTTON_OBSERVED_ATTRIBUTES;
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
this.#connected = true;
|
|
83
|
+
initializeShopPayButtonElement(this, getShopPayButtonOptions(this));
|
|
84
|
+
}
|
|
85
|
+
attributeChangedCallback() {
|
|
86
|
+
if (!this.#connected || !this.shadowRoot) return;
|
|
87
|
+
renderShopPayButtonShadowRoot(this.shadowRoot, getShopPayButtonOptions(this));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** Anchor attributes shared by server and browser shadow-root rendering. */
|
|
92
|
+
function getShopPayButtonAnchorAttributes(options) {
|
|
93
|
+
const attributes = {
|
|
94
|
+
class: SHOP_PAY_BUTTON_CLASS_NAME,
|
|
95
|
+
target: "_self"
|
|
96
|
+
};
|
|
97
|
+
const href = getShopPayButtonUrl(options);
|
|
98
|
+
if (href) attributes.href = href;
|
|
99
|
+
else {
|
|
100
|
+
attributes.role = "link";
|
|
101
|
+
attributes["aria-disabled"] = "true";
|
|
102
|
+
}
|
|
103
|
+
const style = serializeStyleProperties(getShopPayButtonStyleProperties(options));
|
|
104
|
+
if (style) attributes.style = style;
|
|
105
|
+
attributes["aria-label"] = getShopPayAccessibilityLabel(options.accessibilityLabel);
|
|
106
|
+
return attributes;
|
|
107
|
+
}
|
|
108
|
+
function getShopPayButtonElementContentHtml(options) {
|
|
109
|
+
return `<style${getShopPayButtonStyleNonceAttribute(options)}>${SHOP_PAY_BUTTON_STYLES}</style><a ${serializeAttributes(getShopPayButtonAnchorAttributes(options))}>${getShopPayButtonContentHtml()}</a>`;
|
|
110
|
+
}
|
|
111
|
+
function getShopPayButtonDeclarativeShadowDomHtml(options) {
|
|
112
|
+
return `<template shadowrootmode="open" shadowroot="open">${getShopPayButtonElementContentHtml(options)}</template>`;
|
|
113
|
+
}
|
|
114
|
+
function getShopPayButtonElementAttributes(options) {
|
|
115
|
+
const attributes = {};
|
|
116
|
+
const variants = getShopPayVariants(options);
|
|
117
|
+
if (hasContent(options.accessibilityLabel)) attributes["accessibility-label"] = options.accessibilityLabel.trim();
|
|
118
|
+
if (hasContent(options.borderRadius)) attributes["border-radius"] = normalizeCssValue("borderRadius", options.borderRadius);
|
|
119
|
+
if (options.channel) attributes.channel = options.channel;
|
|
120
|
+
if (options.checkoutUrl !== void 0) attributes["checkout-url"] = options.checkoutUrl;
|
|
121
|
+
if (options.disabled) attributes.disabled = "";
|
|
122
|
+
if (hasContent(options.nonce)) attributes.nonce = options.nonce.trim();
|
|
123
|
+
if (options.paymentOption) attributes["payment-option"] = options.paymentOption;
|
|
124
|
+
if (options.source !== void 0) attributes.source = options.source;
|
|
125
|
+
if (options.sourceToken !== void 0) attributes["source-token"] = options.sourceToken;
|
|
126
|
+
if (variants) attributes.variants = variants;
|
|
127
|
+
if (hasContent(options.width)) attributes.width = normalizeCssValue("width", options.width);
|
|
128
|
+
return attributes;
|
|
129
|
+
}
|
|
130
|
+
/** Inner HTML for the shadow root's anchor. */
|
|
131
|
+
function getShopPayButtonContentHtml() {
|
|
132
|
+
return SHOP_PAY_LOGO_SVG;
|
|
133
|
+
}
|
|
134
|
+
function getShopPayButtonStyleProperties(options) {
|
|
135
|
+
const style = {};
|
|
136
|
+
if (hasContent(options.width)) style.width = normalizeCssValue("width", options.width);
|
|
137
|
+
if (hasContent(options.borderRadius)) style.borderRadius = normalizeCssValue("borderRadius", options.borderRadius);
|
|
138
|
+
return style;
|
|
139
|
+
}
|
|
140
|
+
function getShopPaySearchParams(options) {
|
|
141
|
+
const params = new URLSearchParams();
|
|
142
|
+
params.set("payment", options.paymentOption ?? "shop_pay");
|
|
143
|
+
const source = options.source ?? DEFAULT_SOURCE;
|
|
144
|
+
if (source) params.set("source", source);
|
|
145
|
+
if (options.sourceToken) params.set("source_token", options.sourceToken);
|
|
146
|
+
if (options.channel) params.set("channel", options.channel);
|
|
147
|
+
return params;
|
|
148
|
+
}
|
|
149
|
+
function getShopPayCheckoutModeUrl(checkoutUrl) {
|
|
150
|
+
const url = parseCheckoutUrl(checkoutUrl);
|
|
151
|
+
if (url.pathname === "/") url.pathname = "/checkout";
|
|
152
|
+
url.hash = "";
|
|
153
|
+
return url;
|
|
154
|
+
}
|
|
155
|
+
function getShopPayVariantModeUrl(checkoutUrl, variants) {
|
|
156
|
+
const url = parseCheckoutUrl(checkoutUrl);
|
|
157
|
+
url.pathname = `/cart/${variants}`;
|
|
158
|
+
url.hash = "";
|
|
159
|
+
return url;
|
|
160
|
+
}
|
|
161
|
+
function parseCheckoutUrl(checkoutUrl) {
|
|
162
|
+
try {
|
|
163
|
+
return new URL(normalizeStoreDomain(checkoutUrl.trim()));
|
|
164
|
+
} catch {
|
|
165
|
+
throw shopPayError("Shop Pay requires a valid \"checkoutUrl\" value.");
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function getShopPayVariants(options) {
|
|
169
|
+
const variantsInput = options.variants;
|
|
170
|
+
if (!Array.isArray(variantsInput) || variantsInput.length === 0) return void 0;
|
|
171
|
+
if (variantsInput.every(isVariantId)) return variantsInput.map((id) => `${normalizeVariantId(id)}:1`).join(",");
|
|
172
|
+
if (variantsInput.every(isVariantWithQuantity)) return variantsInput.map(({ id, quantity }) => {
|
|
173
|
+
return `${normalizeVariantId(id)}:${normalizeQuantity(quantity)}`;
|
|
174
|
+
}).join(",");
|
|
175
|
+
throw shopPayError("Shop Pay variants must be either variant IDs or objects with an id and quantity.");
|
|
176
|
+
}
|
|
177
|
+
function isVariantId(variant) {
|
|
178
|
+
return typeof variant === "string";
|
|
179
|
+
}
|
|
180
|
+
function getShopPayButtonOptions(element) {
|
|
181
|
+
return {
|
|
182
|
+
accessibilityLabel: element.getAttribute("accessibility-label") ?? void 0,
|
|
183
|
+
borderRadius: element.getAttribute("border-radius") ?? void 0,
|
|
184
|
+
channel: parseChannel(element.getAttribute("channel")),
|
|
185
|
+
checkoutUrl: element.getAttribute("checkout-url") ?? void 0,
|
|
186
|
+
disabled: element.hasAttribute("disabled"),
|
|
187
|
+
nonce: element.nonce || element.getAttribute("nonce") || void 0,
|
|
188
|
+
paymentOption: parsePaymentOption(element.getAttribute("payment-option")),
|
|
189
|
+
source: element.getAttribute("source") ?? void 0,
|
|
190
|
+
sourceToken: element.getAttribute("source-token") ?? void 0,
|
|
191
|
+
variants: parseVariantsAttribute(element.getAttribute("variants")),
|
|
192
|
+
width: element.getAttribute("width") ?? void 0
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
function parseVariantsAttribute(value) {
|
|
196
|
+
if (!value) return void 0;
|
|
197
|
+
return value.split(",").map((entry) => {
|
|
198
|
+
const [id = "", quantity] = entry.split(":");
|
|
199
|
+
return {
|
|
200
|
+
id,
|
|
201
|
+
quantity: quantity === void 0 ? void 0 : Number(quantity)
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
function parsePaymentOption(value) {
|
|
206
|
+
return value === "shop_pay" || value === "shop_pay_installments" ? value : void 0;
|
|
207
|
+
}
|
|
208
|
+
function parseChannel(value) {
|
|
209
|
+
return value === "headless" || value === "hydrogen" ? value : void 0;
|
|
210
|
+
}
|
|
211
|
+
function renderShopPayButtonShadowRoot(shadowRoot, options) {
|
|
212
|
+
let style = shadowRoot.querySelector("style");
|
|
213
|
+
if (!(style instanceof HTMLStyleElement)) {
|
|
214
|
+
style = shadowRoot.ownerDocument.createElement("style");
|
|
215
|
+
shadowRoot.prepend(style);
|
|
216
|
+
}
|
|
217
|
+
const nextNonce = hasContent(options.nonce) ? options.nonce.trim() : void 0;
|
|
218
|
+
const nonceChanged = (style.nonce || void 0) !== nextNonce;
|
|
219
|
+
if (nextNonce) style.nonce = nextNonce;
|
|
220
|
+
else style.removeAttribute("nonce");
|
|
221
|
+
if (nonceChanged) style.textContent = "";
|
|
222
|
+
if (style.textContent !== SHOP_PAY_BUTTON_STYLES) style.textContent = SHOP_PAY_BUTTON_STYLES;
|
|
223
|
+
let anchor = shadowRoot.querySelector("a");
|
|
224
|
+
if (!(anchor instanceof HTMLAnchorElement)) {
|
|
225
|
+
anchor = shadowRoot.ownerDocument.createElement("a");
|
|
226
|
+
shadowRoot.append(anchor);
|
|
227
|
+
}
|
|
228
|
+
syncAttributes(anchor, getShopPayButtonAnchorAttributes(options));
|
|
229
|
+
const content = getShopPayButtonContentHtml();
|
|
230
|
+
if (anchor.innerHTML !== content) anchor.innerHTML = content;
|
|
231
|
+
}
|
|
232
|
+
function syncAttributes(element, attributes) {
|
|
233
|
+
for (const name of element.getAttributeNames()) if (!(name in attributes)) element.removeAttribute(name);
|
|
234
|
+
for (const [name, value] of Object.entries(attributes)) if (element.getAttribute(name) !== value) element.setAttribute(name, value);
|
|
235
|
+
}
|
|
236
|
+
function syncShopPayButtonElementAttributes(element, attributes) {
|
|
237
|
+
for (const name of SHOP_PAY_BUTTON_OBSERVED_ATTRIBUTES) if (!(name in attributes)) element.removeAttribute(name);
|
|
238
|
+
for (const [name, value] of Object.entries(attributes)) if (element.getAttribute(name) !== value) element.setAttribute(name, value);
|
|
239
|
+
}
|
|
240
|
+
function isVariantWithQuantity(variant) {
|
|
241
|
+
return typeof variant === "object" && variant !== null && typeof variant.id === "string";
|
|
242
|
+
}
|
|
243
|
+
function normalizeVariantId(id) {
|
|
244
|
+
const parsed = parseGid(id);
|
|
245
|
+
const bareId = parsed.id || id.trim();
|
|
246
|
+
if (parsed.resource && parsed.resource !== "ProductVariant") throw shopPayError("Shop Pay variant IDs must be Shopify ProductVariant GIDs or bare numeric variant IDs.");
|
|
247
|
+
if (/^\d+$/.test(bareId)) return bareId;
|
|
248
|
+
throw shopPayError("Shop Pay variant IDs must be Shopify ProductVariant GIDs or bare numeric variant IDs.");
|
|
249
|
+
}
|
|
250
|
+
function normalizeQuantity(quantity = 1) {
|
|
251
|
+
if (!Number.isInteger(quantity) || quantity < 1) throw shopPayError("Shop Pay variant quantities must be positive integers.");
|
|
252
|
+
return quantity;
|
|
253
|
+
}
|
|
254
|
+
function escapeText(value) {
|
|
255
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
256
|
+
}
|
|
257
|
+
function escapeAttribute(value) {
|
|
258
|
+
return escapeText(value).replace(/"/g, """);
|
|
259
|
+
}
|
|
260
|
+
function getShopPayAccessibilityLabel(label) {
|
|
261
|
+
return hasContent(label) ? label.trim() : DEFAULT_ACCESSIBILITY_LABEL;
|
|
262
|
+
}
|
|
263
|
+
function getShopPayButtonStyleNonceAttribute(options) {
|
|
264
|
+
return hasContent(options.nonce) ? ` nonce="${escapeAttribute(options.nonce.trim())}"` : "";
|
|
265
|
+
}
|
|
266
|
+
function hasContent(value) {
|
|
267
|
+
return typeof value === "string" && value.trim() !== "";
|
|
268
|
+
}
|
|
269
|
+
function normalizeCssValue(name, value) {
|
|
270
|
+
const normalized = value.trim();
|
|
271
|
+
if (/[;{}]/.test(normalized)) throw shopPayError(`Shop Pay ${name} must be a single CSS value.`);
|
|
272
|
+
return normalized;
|
|
273
|
+
}
|
|
274
|
+
function serializeAttributes(attributes) {
|
|
275
|
+
return Object.entries(attributes).map(([name, value]) => `${name}="${escapeAttribute(value)}"`).join(" ");
|
|
276
|
+
}
|
|
277
|
+
function serializeStyleProperties(style) {
|
|
278
|
+
return Object.entries(style).map(([name, value]) => `${hyphenateStyleName(name)}:${value}`).join(";");
|
|
279
|
+
}
|
|
280
|
+
function hyphenateStyleName(name) {
|
|
281
|
+
return name.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
282
|
+
}
|
|
283
|
+
function shopPayError(message) {
|
|
284
|
+
return /* @__PURE__ */ new Error(`${ERROR_PREFIX} ${message}`);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
//#endregion
|
|
288
|
+
export { SHOP_PAY_BUTTON_TAG_NAME, createShopPayButton, defineShopPayButton, getShopPayButtonDeclarativeShadowDomHtml, getShopPayButtonElementAttributes, getShopPayButtonUrl, renderShopPayButton };
|
|
289
|
+
//# sourceMappingURL=shop-pay.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shop-pay.mjs","names":["#connected"],"sources":["../../../src/core/shop-pay/shop-pay.ts"],"sourcesContent":["import { normalizeStoreDomain } from \"../url\";\nimport { parseGid } from \"../utils/parse-gid\";\n\nconst DEFAULT_SOURCE = \"hydrogen\";\nconst DEFAULT_ACCESSIBILITY_LABEL = \"Buy with Shop Pay\";\nconst ERROR_PREFIX = \"[hydrogen:error:ShopPay]\";\nconst CAN_USE_DOM = typeof document !== \"undefined\";\nexport const SHOP_PAY_BUTTON_TAG_NAME = \"hydrogen-shop-pay-button\";\nexport const SHOP_PAY_BUTTON_CLASS_NAME = \"shop-pay-button\";\nconst SHOP_PAY_BUTTON_OBSERVED_ATTRIBUTES = [\n \"accessibility-label\",\n \"border-radius\",\n \"channel\",\n \"checkout-url\",\n \"disabled\",\n \"nonce\",\n \"payment-option\",\n \"source\",\n \"source-token\",\n \"variants\",\n \"width\",\n] as const;\n\n/** Button styles matching the hosted shop-js pay button. */\nexport const SHOP_PAY_BUTTON_STYLES =\n `:host{display:block}` +\n `.${SHOP_PAY_BUTTON_CLASS_NAME}{position:relative;display:flex;align-items:center;box-sizing:border-box;margin:0;padding:10px 16px;overflow:visible;width:260px;border:none;border-radius:12px;background-color:#5433eb;color:#fff;cursor:pointer;text-decoration:none;transition:all .15s cubic-bezier(.4,0,.2,1)}` +\n `.${SHOP_PAY_BUTTON_CLASS_NAME}:hover{background-color:#4524db}` +\n `.${SHOP_PAY_BUTTON_CLASS_NAME}:focus-visible{outline:none;box-shadow:0 0 0 3px #9c83f8}` +\n `.${SHOP_PAY_BUTTON_CLASS_NAME}[aria-disabled=true]{opacity:.5;pointer-events:none;cursor:default}` +\n `.${SHOP_PAY_BUTTON_CLASS_NAME}__logo{position:relative;display:inline-block;margin:0 auto;width:88px;height:auto}`;\n\nconst SHOP_PAY_LOGO_SVG =\n `<svg class=\"${SHOP_PAY_BUTTON_CLASS_NAME}__logo\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 99 25\" aria-hidden=\"true\" focusable=\"false\">` +\n '<path fill=\"currentColor\" d=\"M70.842 7.915h2.25c1.561 0 2.328.642 2.328 1.715 0 1.074-.739 1.715-2.259 1.715h-2.32v-3.43ZM80.525 16.142c-.879 0-1.227-.474-1.227-.948 0-.642.725-.935 2.147-1.102l1.115-.125c-.07 1.227-.892 2.175-2.035 2.175Z\"/>' +\n '<path fill=\"currentColor\" fill-rule=\"evenodd\" d=\"M65.645.5a3.64 3.64 0 0 0-3.64 3.64V20.7a3.64 3.64 0 0 0 3.64 3.64h29.668a3.64 3.64 0 0 0 3.64-3.64V4.14A3.64 3.64 0 0 0 95.314.5H65.645Zm5.197 16.674v-4.197h2.64c2.412 0 3.695-1.353 3.695-3.402 0-2.05-1.283-3.277-3.695-3.277h-4.341v10.876h1.7Zm9.334.223c1.297 0 2.147-.572 2.538-1.548.112 1.088.767 1.645 2.189 1.269l.014-1.157c-.572.055-.683-.154-.683-.753v-2.845c0-1.673-1.102-2.663-3.138-2.663-2.008 0-3.165 1.004-3.165 2.705h1.562c0-.809.572-1.297 1.576-1.297 1.06 0 1.547.46 1.534 1.255v.363l-1.8.195c-2.021.223-3.137.99-3.137 2.329 0 1.101.781 2.147 2.51 2.147Zm9.906.32c-.711 1.73-1.855 2.245-3.64 2.245h-.766V18.54h.822c.977 0 1.45-.307 1.966-1.185L85.3 9.923h1.757l2.259 5.424 2.008-5.424h1.715l-2.956 7.795Z\" clip-rule=\"evenodd\"/>' +\n '<path fill=\"currentColor\" d=\"M6.992 11.055c-2.359-.509-3.41-.708-3.41-1.612 0-.85.711-1.274 2.134-1.274 1.25 0 2.165.544 2.839 1.61.05.081.155.11.241.066l2.655-1.335a.186.186 0 0 0 .076-.259c-1.102-1.9-3.137-2.94-5.818-2.94C2.188 5.311 0 7.037 0 9.781c0 2.915 2.664 3.651 5.027 4.16 2.362.51 3.417.709 3.417 1.613s-.769 1.33-2.303 1.33c-1.416 0-2.467-.644-3.102-1.896a.186.186 0 0 0-.251-.082L.14 16.21a.188.188 0 0 0-.083.253c1.051 2.102 3.207 3.285 6.087 3.285 3.668 0 5.885-1.698 5.885-4.527 0-2.83-2.677-3.651-5.037-4.16v-.007ZM21.218 5.311c-1.505 0-2.835.531-3.791 1.477-.06.057-.159.015-.159-.067V.687A.185.185 0 0 0 17.081.5h-3.322a.185.185 0 0 0-.187.187v18.73c0 .104.083.186.187.186h3.322a.185.185 0 0 0 .187-.186V11.2c0-1.587 1.223-2.804 2.87-2.804 1.649 0 2.843 1.191 2.843 2.804v8.216c0 .104.082.186.187.186h3.322a.185.185 0 0 0 .187-.186V11.2c0-3.452-2.274-5.89-5.459-5.89ZM33.415 4.774c-1.803 0-3.493.55-4.706 1.343a.186.186 0 0 0-.06.25l1.464 2.488c.054.089.168.12.257.066a5.853 5.853 0 0 1 3.052-.834c2.899 0 5.03 2.036 5.03 4.726 0 2.292-1.706 3.99-3.868 3.99-1.762 0-2.985-1.022-2.985-2.463 0-.825.352-1.502 1.27-1.98a.183.183 0 0 0 .073-.258l-1.381-2.327a.187.187 0 0 0-.226-.079c-1.85.683-3.15 2.327-3.15 4.533 0 3.338 2.67 5.83 6.396 5.83 4.35 0 7.478-3 7.478-7.303 0-4.612-3.64-7.982-8.644-7.982ZM51.776 5.283c-1.68 0-3.182.62-4.277 1.707a.093.093 0 0 1-.16-.066v-1.31a.185.185 0 0 0-.187-.186h-3.235a.185.185 0 0 0-.188.187v18.702c0 .104.083.186.188.186h3.32a.185.185 0 0 0 .188-.186v-6.133c0-.082.099-.123.16-.07 1.091 1.012 2.536 1.603 4.19 1.603 3.897 0 6.936-3.139 6.936-7.217 0-4.078-3.042-7.217-6.935-7.217Zm-.63 11.266c-2.215 0-3.895-1.754-3.895-4.074S48.928 8.4 51.147 8.4c2.22 0 3.893 1.726 3.893 4.075 0 2.348-1.651 4.074-3.896 4.074h.003Z\"/>' +\n \"</svg>\";\n\ntype ShopPayButtonBaseOptions = {\n /**\n * Absolute checkout base URL. Omit it to emit same-origin `/checkout` and\n * `/cart` permalink paths, which `handleShopifyRoutes` redirects to the\n * store's real checkout.\n */\n checkoutUrl?: string;\n /**\n * Checkout payment mode. Defaults to `\"shop_pay\"`. Use\n * `\"shop_pay_installments\"` only when the checkout path should open Shop Pay\n * Installments.\n */\n paymentOption?: \"shop_pay\" | \"shop_pay_installments\";\n /**\n * Attribution source appended to the checkout URL as `source`. Defaults to\n * `\"hydrogen\"`. Most storefronts should not override this.\n */\n source?: string;\n /**\n * Optional attribution token appended to the checkout URL as `source_token`.\n * Only pass a value when Shopify has provided one for the integration.\n */\n sourceToken?: string;\n /**\n * Content Security Policy nonce applied to the shadow root's inline style.\n */\n nonce?: string;\n /**\n * Sales channel that issued the Storefront API token. Omit it unless checkout\n * needs explicit `\"headless\"` or `\"hydrogen\"` attribution.\n */\n channel?: \"headless\" | \"hydrogen\";\n /**\n * Disables the button. Disabled buttons render without an `href` and include\n * `aria-disabled=\"true\"`.\n */\n disabled?: boolean;\n /**\n * CSS width for the rendered anchor, for example `\"100%\"`. Omit it to use\n * the Shop Pay default width.\n */\n width?: string;\n /**\n * CSS border radius for the rendered anchor, for example `\"8px\"`. Omit it to\n * use the Shop Pay default radius.\n */\n borderRadius?: string;\n /**\n * Localized accessible label for the Shop Pay logo. Defaults to `\"Buy with Shop Pay\"`.\n * Never translate the brand name `\"Shop Pay\"`; keep it in Latin script in every locale.\n *\n * @example English\n * `\"Buy with Shop Pay\"`\n *\n * @example Japanese\n * `\"Shop Payで購入\"`\n *\n * @example Hindi\n * `\"Shop Pay से खरीदें\"`\n *\n * @example Arabic\n * `\"الشراء باستخدام Shop Pay\"`\n */\n accessibilityLabel?: string;\n};\n\ntype ShopPayVariantWithQuantity = {\n /** ProductVariant GID or bare numeric ProductVariant ID. Product IDs are invalid. */\n id: string;\n /** Quantity for this variant. Defaults to `1`. */\n quantity?: number;\n};\n\ntype ShopPayVariant = string | ShopPayVariantWithQuantity;\ntype ShopPayVariants = readonly string[] | readonly ShopPayVariantWithQuantity[];\n\nexport type ShopPayButtonOptions = ShopPayButtonBaseOptions & {\n /**\n * Variants to check out immediately via a Shopify cart permalink. Omit this\n * for cart checkout mode, where `/checkout` checks out the current cart.\n */\n variants?: ShopPayVariants;\n};\n\n/**\n * Builds the checkout URL the Shop Pay button navigates to, or `null` when the\n * button is disabled. Variant mode produces a cart permalink; otherwise the\n * current cart checks out.\n */\nexport function getShopPayButtonUrl(options: ShopPayButtonOptions): string | null {\n if (options.disabled) return null;\n\n const variants = getShopPayVariants(options);\n\n if (!options.checkoutUrl) {\n const search = getShopPaySearchParams(options);\n return `${variants ? `/cart/${variants}` : \"/checkout\"}?${search}`;\n }\n\n const url = variants\n ? getShopPayVariantModeUrl(options.checkoutUrl, variants)\n : getShopPayCheckoutModeUrl(options.checkoutUrl);\n\n for (const [name, value] of getShopPaySearchParams(options)) {\n url.searchParams.set(name, value);\n }\n\n return url.toString();\n}\n\n/**\n * Renders the Shop Pay button as an HTML string: a self-contained wrapper\n * element carrying the styles and anchor it needs to work without client\n * JavaScript. Use it from server templates or frameworks without a Hydrogen\n * binding.\n */\nexport function renderShopPayButton(options: ShopPayButtonOptions): string {\n defineShopPayButton();\n const attributes = serializeAttributes(getShopPayButtonElementAttributes(options));\n const content = CAN_USE_DOM ? \"\" : getShopPayButtonDeclarativeShadowDomHtml(options);\n return `<${SHOP_PAY_BUTTON_TAG_NAME}${attributes ? ` ${attributes}` : \"\"}>${content}</${SHOP_PAY_BUTTON_TAG_NAME}>`;\n}\n\n/**\n * Creates the Shop Pay button as a detached DOM element. The returned element\n * carries the button styles with it.\n */\nexport function createShopPayButton(options: ShopPayButtonOptions): HTMLElement {\n defineShopPayButton();\n const element = document.createElement(SHOP_PAY_BUTTON_TAG_NAME);\n initializeShopPayButtonElement(element, options);\n\n return element;\n}\n\nexport function initializeShopPayButtonElement(\n element: HTMLElement,\n options: ShopPayButtonOptions,\n): void {\n syncShopPayButtonElementAttributes(element, getShopPayButtonElementAttributes(options));\n\n const shadowRoot = element.shadowRoot ?? element.attachShadow({ mode: \"open\" });\n const template = element.querySelector(\"template[shadowrootmode]\");\n\n if (template instanceof HTMLTemplateElement) {\n shadowRoot.append(template.content.cloneNode(true));\n template.remove();\n }\n\n renderShopPayButtonShadowRoot(shadowRoot, options);\n}\n\n/** Registers the Shop Pay custom element. No-ops during SSR or when already registered. */\nexport function defineShopPayButton(): void {\n if (\n typeof customElements === \"undefined\" ||\n typeof HTMLElement === \"undefined\" ||\n customElements.get(SHOP_PAY_BUTTON_TAG_NAME)\n ) {\n return;\n }\n\n customElements.define(\n SHOP_PAY_BUTTON_TAG_NAME,\n class extends HTMLElement {\n #connected = false;\n\n static observedAttributes = SHOP_PAY_BUTTON_OBSERVED_ATTRIBUTES;\n\n connectedCallback(): void {\n this.#connected = true;\n initializeShopPayButtonElement(this, getShopPayButtonOptions(this));\n }\n\n attributeChangedCallback(): void {\n if (!this.#connected || !this.shadowRoot) return;\n renderShopPayButtonShadowRoot(this.shadowRoot, getShopPayButtonOptions(this));\n }\n },\n );\n}\n\n/** Anchor attributes shared by server and browser shadow-root rendering. */\nexport function getShopPayButtonAnchorAttributes(\n options: ShopPayButtonOptions,\n): Record<string, string> {\n const attributes: Record<string, string> = {\n class: SHOP_PAY_BUTTON_CLASS_NAME,\n target: \"_self\",\n };\n\n const href = getShopPayButtonUrl(options);\n if (href) {\n attributes.href = href;\n } else {\n attributes.role = \"link\";\n attributes[\"aria-disabled\"] = \"true\";\n }\n\n const style = serializeStyleProperties(getShopPayButtonStyleProperties(options));\n if (style) attributes.style = style;\n\n attributes[\"aria-label\"] = getShopPayAccessibilityLabel(options.accessibilityLabel);\n\n return attributes;\n}\n\nexport function getShopPayButtonElementContentHtml(options: ShopPayButtonOptions): string {\n return `<style${getShopPayButtonStyleNonceAttribute(options)}>${SHOP_PAY_BUTTON_STYLES}</style><a ${serializeAttributes(getShopPayButtonAnchorAttributes(options))}>${getShopPayButtonContentHtml()}</a>`;\n}\n\nexport function getShopPayButtonDeclarativeShadowDomHtml(options: ShopPayButtonOptions): string {\n return `<template shadowrootmode=\"open\" shadowroot=\"open\">${getShopPayButtonElementContentHtml(options)}</template>`;\n}\n\nexport function getShopPayButtonElementAttributes(\n options: ShopPayButtonOptions,\n): Record<string, string> {\n const attributes: Record<string, string> = {};\n const variants = getShopPayVariants(options);\n\n if (hasContent(options.accessibilityLabel)) {\n attributes[\"accessibility-label\"] = options.accessibilityLabel.trim();\n }\n if (hasContent(options.borderRadius)) {\n attributes[\"border-radius\"] = normalizeCssValue(\"borderRadius\", options.borderRadius);\n }\n if (options.channel) attributes.channel = options.channel;\n if (options.checkoutUrl !== undefined) attributes[\"checkout-url\"] = options.checkoutUrl;\n if (options.disabled) attributes.disabled = \"\";\n if (hasContent(options.nonce)) attributes.nonce = options.nonce.trim();\n if (options.paymentOption) attributes[\"payment-option\"] = options.paymentOption;\n if (options.source !== undefined) attributes.source = options.source;\n if (options.sourceToken !== undefined) attributes[\"source-token\"] = options.sourceToken;\n if (variants) attributes.variants = variants;\n if (hasContent(options.width)) {\n attributes.width = normalizeCssValue(\"width\", options.width);\n }\n\n return attributes;\n}\n\n/** Inner HTML for the shadow root's anchor. */\nexport function getShopPayButtonContentHtml(): string {\n return SHOP_PAY_LOGO_SVG;\n}\n\nfunction getShopPayButtonStyleProperties(\n options: Pick<ShopPayButtonOptions, \"width\" | \"borderRadius\">,\n): Record<string, string> {\n const style: Record<string, string> = {};\n\n if (hasContent(options.width)) style.width = normalizeCssValue(\"width\", options.width);\n if (hasContent(options.borderRadius)) {\n style.borderRadius = normalizeCssValue(\"borderRadius\", options.borderRadius);\n }\n\n return style;\n}\n\nfunction getShopPaySearchParams(options: ShopPayButtonOptions): URLSearchParams {\n const params = new URLSearchParams();\n params.set(\"payment\", options.paymentOption ?? \"shop_pay\");\n\n const source = options.source ?? DEFAULT_SOURCE;\n if (source) params.set(\"source\", source);\n if (options.sourceToken) params.set(\"source_token\", options.sourceToken);\n if (options.channel) params.set(\"channel\", options.channel);\n\n return params;\n}\n\nfunction getShopPayCheckoutModeUrl(checkoutUrl: string): URL {\n const url = parseCheckoutUrl(checkoutUrl);\n if (url.pathname === \"/\") url.pathname = \"/checkout\";\n url.hash = \"\";\n return url;\n}\n\nfunction getShopPayVariantModeUrl(checkoutUrl: string, variants: string): URL {\n const url = parseCheckoutUrl(checkoutUrl);\n url.pathname = `/cart/${variants}`;\n url.hash = \"\";\n return url;\n}\n\nfunction parseCheckoutUrl(checkoutUrl: string): URL {\n try {\n return new URL(normalizeStoreDomain(checkoutUrl.trim()));\n } catch {\n throw shopPayError('Shop Pay requires a valid \"checkoutUrl\" value.');\n }\n}\n\nfunction getShopPayVariants(options: ShopPayButtonOptions): string | undefined {\n const variantsInput: readonly ShopPayVariant[] | undefined = options.variants;\n\n if (!Array.isArray(variantsInput) || variantsInput.length === 0) return undefined;\n\n if (variantsInput.every(isVariantId)) {\n return variantsInput.map((id) => `${normalizeVariantId(id)}:1`).join(\",\");\n }\n\n if (variantsInput.every(isVariantWithQuantity)) {\n return variantsInput\n .map(({ id, quantity }) => {\n return `${normalizeVariantId(id)}:${normalizeQuantity(quantity)}`;\n })\n .join(\",\");\n }\n\n throw shopPayError(\n \"Shop Pay variants must be either variant IDs or objects with an id and quantity.\",\n );\n}\n\nfunction isVariantId(variant: ShopPayVariant): variant is string {\n return typeof variant === \"string\";\n}\n\nfunction getShopPayButtonOptions(element: HTMLElement): ShopPayButtonOptions {\n return {\n accessibilityLabel: element.getAttribute(\"accessibility-label\") ?? undefined,\n borderRadius: element.getAttribute(\"border-radius\") ?? undefined,\n channel: parseChannel(element.getAttribute(\"channel\")),\n checkoutUrl: element.getAttribute(\"checkout-url\") ?? undefined,\n disabled: element.hasAttribute(\"disabled\"),\n nonce: element.nonce || element.getAttribute(\"nonce\") || undefined,\n paymentOption: parsePaymentOption(element.getAttribute(\"payment-option\")),\n source: element.getAttribute(\"source\") ?? undefined,\n sourceToken: element.getAttribute(\"source-token\") ?? undefined,\n variants: parseVariantsAttribute(element.getAttribute(\"variants\")),\n width: element.getAttribute(\"width\") ?? undefined,\n };\n}\n\nfunction parseVariantsAttribute(value: string | null): ShopPayVariants | undefined {\n if (!value) return undefined;\n\n return value.split(\",\").map((entry) => {\n const [id = \"\", quantity] = entry.split(\":\");\n return { id, quantity: quantity === undefined ? undefined : Number(quantity) };\n });\n}\n\nfunction parsePaymentOption(value: string | null): ShopPayButtonOptions[\"paymentOption\"] {\n return value === \"shop_pay\" || value === \"shop_pay_installments\" ? value : undefined;\n}\n\nfunction parseChannel(value: string | null): ShopPayButtonOptions[\"channel\"] {\n return value === \"headless\" || value === \"hydrogen\" ? value : undefined;\n}\n\nfunction renderShopPayButtonShadowRoot(\n shadowRoot: ShadowRoot,\n options: ShopPayButtonOptions,\n): void {\n let style = shadowRoot.querySelector(\"style\");\n if (!(style instanceof HTMLStyleElement)) {\n style = shadowRoot.ownerDocument.createElement(\"style\");\n shadowRoot.prepend(style);\n }\n\n const nextNonce = hasContent(options.nonce) ? options.nonce.trim() : undefined;\n const nonceChanged = (style.nonce || undefined) !== nextNonce;\n if (nextNonce) {\n style.nonce = nextNonce;\n } else {\n style.removeAttribute(\"nonce\");\n }\n if (nonceChanged) style.textContent = \"\";\n if (style.textContent !== SHOP_PAY_BUTTON_STYLES) style.textContent = SHOP_PAY_BUTTON_STYLES;\n\n let anchor = shadowRoot.querySelector(\"a\");\n if (!(anchor instanceof HTMLAnchorElement)) {\n anchor = shadowRoot.ownerDocument.createElement(\"a\");\n shadowRoot.append(anchor);\n }\n\n syncAttributes(anchor, getShopPayButtonAnchorAttributes(options));\n const content = getShopPayButtonContentHtml();\n if (anchor.innerHTML !== content) anchor.innerHTML = content;\n}\n\nfunction syncAttributes(element: Element, attributes: Record<string, string>): void {\n for (const name of element.getAttributeNames()) {\n if (!(name in attributes)) element.removeAttribute(name);\n }\n\n for (const [name, value] of Object.entries(attributes)) {\n if (element.getAttribute(name) !== value) element.setAttribute(name, value);\n }\n}\n\nfunction syncShopPayButtonElementAttributes(\n element: Element,\n attributes: Record<string, string>,\n): void {\n for (const name of SHOP_PAY_BUTTON_OBSERVED_ATTRIBUTES) {\n if (!(name in attributes)) element.removeAttribute(name);\n }\n\n for (const [name, value] of Object.entries(attributes)) {\n if (element.getAttribute(name) !== value) element.setAttribute(name, value);\n }\n}\n\nfunction isVariantWithQuantity(\n variant: ShopPayVariant | undefined,\n): variant is ShopPayVariantWithQuantity {\n return typeof variant === \"object\" && variant !== null && typeof variant.id === \"string\";\n}\n\nfunction normalizeVariantId(id: string): string {\n const parsed = parseGid(id);\n const bareId = parsed.id || id.trim();\n\n if (parsed.resource && parsed.resource !== \"ProductVariant\") {\n throw shopPayError(\n \"Shop Pay variant IDs must be Shopify ProductVariant GIDs or bare numeric variant IDs.\",\n );\n }\n\n if (/^\\d+$/.test(bareId)) return bareId;\n\n throw shopPayError(\n \"Shop Pay variant IDs must be Shopify ProductVariant GIDs or bare numeric variant IDs.\",\n );\n}\n\nfunction normalizeQuantity(quantity = 1): number {\n if (!Number.isInteger(quantity) || quantity < 1) {\n throw shopPayError(\"Shop Pay variant quantities must be positive integers.\");\n }\n\n return quantity;\n}\n\nfunction escapeText(value: string): string {\n return value.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n\nfunction escapeAttribute(value: string): string {\n return escapeText(value).replace(/\"/g, \""\");\n}\n\nfunction getShopPayAccessibilityLabel(label: string | undefined): string {\n return hasContent(label) ? label.trim() : DEFAULT_ACCESSIBILITY_LABEL;\n}\n\nfunction getShopPayButtonStyleNonceAttribute(options: Pick<ShopPayButtonOptions, \"nonce\">): string {\n return hasContent(options.nonce) ? ` nonce=\"${escapeAttribute(options.nonce.trim())}\"` : \"\";\n}\n\nfunction hasContent(value: string | undefined): value is string {\n return typeof value === \"string\" && value.trim() !== \"\";\n}\n\nfunction normalizeCssValue(name: \"width\" | \"borderRadius\", value: string): string {\n const normalized = value.trim();\n if (/[;{}]/.test(normalized)) {\n throw shopPayError(`Shop Pay ${name} must be a single CSS value.`);\n }\n return normalized;\n}\n\nfunction serializeAttributes(attributes: Record<string, string>): string {\n return Object.entries(attributes)\n .map(([name, value]) => `${name}=\"${escapeAttribute(value)}\"`)\n .join(\" \");\n}\n\nfunction serializeStyleProperties(style: Record<string, string>): string {\n return Object.entries(style)\n .map(([name, value]) => `${hyphenateStyleName(name)}:${value}`)\n .join(\";\");\n}\n\nfunction hyphenateStyleName(name: string): string {\n return name.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);\n}\n\nfunction shopPayError(message: string): Error {\n return new Error(`${ERROR_PREFIX} ${message}`);\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { asInlineScript } from "./utils/inline-script.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/core/shopify-scripts/analytics.ts
|
|
4
|
+
const initializeShopifyAnalyticsBus = (scriptData) => decodeURIComponent("(function()%7Blet%20e%3D%7Btrace%3A%60debug%60%2Cdebug%3A%60debug%60%2Cinfo%3A%60info%60%2Cwarn%3A%60warn%60%2Cerror%3A%60error%60%2Cfatal%3A%60error%60%7D%3Bfunction%20t(e%2Ct)%7Breturn%60%5Bhydrogen%3A%24%7Be%7D%3A%24%7Bt%7D%5D%60%7Dfunction%20n(n%2Cr%2Ci)%7Blet%7Bscope%3Aa%2Cerror%3Ao%2C...s%7D%3Di%3F%3F%7B%7D%2Cc%3D%5Ba%3F%60%24%7Bt(n%2Ca)%7D%20%24%7Br%7D%60%3Ar%5D%3Bo!%3D%3Dvoid%200%26%26c.push(o)%2CObject.keys(s).length%3E0%26%26c.push(s)%2Cconsole%5Be%5Bn%5D%5D(...c)%7Dlet%20r%3D%7Btrace%3A(e%2Ct)%3D%3En(%60trace%60%2Ce%2Ct)%2Cdebug%3A(e%2Ct)%3D%3En(%60debug%60%2Ce%2Ct)%2Cinfo%3A(e%2Ct)%3D%3En(%60info%60%2Ce%2Ct)%2Cwarn%3A(e%2Ct)%3D%3En(%60warn%60%2Ce%2Ct)%2Cerror%3A(e%2Ct)%3D%3En(%60error%60%2Ce%2Ct)%2Cfatal%3A(e%2Ct)%3D%3En(%60fatal%60%2Ce%2Ct)%7D%2Ci%3D%60https%3A%2F%2Fcdn.shopify.com%60%3B%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%2C%60%24%7Bi%7D%60%3Blet%20a%3D%60visitorConsentCollected%60%3Bfunction%20o()%7Bif(typeof%20window%3E%60u%60)return%3Blet%20e%3Dwindow%3Breturn%20e.Shopify%3F%3F%3D%7B%7D%7Dfunction%20s(e)%7Breturn%20typeof%20e%3D%3D%60object%60%26%26!!e%26%26!Array.isArray(e)%7Dfunction%20c(e%2Ct)%7Blet%20n%3De.subscriptions.get(t.event)%3Bif(!n%3F.size)%7Be.nextReplaySequence%3DMath.max(e.nextReplaySequence%2Ct.sequence%2B1)%3Breturn%7Dfor(let%20i%20of%20n)try%7Bi(t.payload)%7Dcatch(t)%7Br.error(%60error%20in%20analytics%20destination%20%22%24%7Be.name%7D%22%60%2C%7Bscope%3A%60analytics%60%2Cerror%3At%7D)%7De.nextReplaySequence%3DMath.max(e.nextReplaySequence%2Ct.sequence%2B1)%7Dfunction%20l(e)%7Blet%20t%3D0%2Cn%3D!0%2Ci%3D%5B%5D%2Ca%3Dnew%20Set%2Co%3Dnew%20Set%3Bfunction%20s(t%3D!1)%7Bif(!e.canTrack())%7Bt%26%26(i.length%3D0%2Cn%3D!1)%3Breturn%7Dn%3D!0%3Bfor(let%20e%20of%20a)for(let%20t%20of%20i)t.sequence%3Ce.nextReplaySequence%7C%7Cc(e%2Ct)%7Dfunction%20l(t)%7Bif(o.has(t.name))return%20r.warn(%60analytics%20destination%20%22%24%7Bt.name%7D%22%20is%20already%20registered%60%2C%7Bscope%3A%60analytics%60%7D)%2C()%3D%3E%7B%7D%3Bo.add(t.name)%3Blet%20n%3D%7Bname%3At.name%2Csubscriptions%3Anew%20Map%2CnextReplaySequence%3A0%7D%2Ci%3D!1%2Cc%3D(t%2Cr)%3D%3E%7Bif(i)return()%3D%3E%7B%7D%3Bif(e.isSupportedEvent%26%26!e.isSupportedEvent(t))return%20e.warnUnsupportedEvent%3F.(t)%2C()%3D%3E%7B%7D%3Blet%20a%3Dn.subscriptions.get(t)%3Breturn%20a%7C%7C(a%3Dnew%20Set%2Cn.subscriptions.set(t%2Ca))%2Ca.add(r)%2C()%3D%3E%7Blet%20e%3Dn.subscriptions.get(t)%3Be%3F.delete(r)%2Ce%3F.size%3D%3D%3D0%26%26n.subscriptions.delete(t)%7D%7D%2Cl%3D()%3D%3E%7Bi%7C%7C(i%3D!0%2Ca.delete(n)%2Co.delete(t.name)%2Cn.subscriptions.clear()%2Cn.cleanup%3F.())%7D%2Cu%3De%3D%3E%7Bif(i)%7Be%3F.()%3Breturn%7Dtypeof%20e%3D%3D%60function%60%26%26(n.cleanup%3De)%2Ca.add(n)%2Cs()%7D%3Btry%7Blet%20n%3Dt.setup(%7Bsubscribe%3Ac%2CgetConfig%3Ae.getConfig%7D)%3Bn%26%26typeof%20n.then%3D%3D%60function%60%3Fn.then(u).catch(e%3D%3E%7Br.error(%60error%20setting%20up%20analytics%20destination%20%22%24%7Bt.name%7D%22%60%2C%7Bscope%3A%60analytics%60%2Cerror%3Ae%7D)%2Cl()%7D)%3Au(n)%7Dcatch(e)%7Br.error(%60error%20setting%20up%20analytics%20destination%20%22%24%7Bt.name%7D%22%60%2C%7Bscope%3A%60analytics%60%2Cerror%3Ae%7D)%2Cl()%7Dreturn%20l%7Dfunction%20u(r%2Co)%7Blet%20s%3D%7Bsequence%3At%2B%2B%2Cevent%3Ar%2Cpayload%3Ao%7D%3Bif(n%26%26(i.push(s)%2Ci.length%3E500%26%26i.shift())%2Ce.canTrack())for(let%20e%20of%20a)c(e%2Cs)%7Dfunction%20d()%7Bi.length%3D0%3Bfor(let%20e%20of%20a)e.subscriptions.clear()%2Ce.cleanup%3F.()%3Ba.clear()%2Co.clear()%7Dreturn%7BaddDestination%3Al%2ConPublish%3Au%2Creplay%3As%2Cdestroy%3Ad%7D%7Dlet%20u%3D%7BPAGE_VIEWED%3A%60page_viewed%60%2CPRODUCT_VIEWED%3A%60product_viewed%60%2CCOLLECTION_VIEWED%3A%60collection_viewed%60%2CCART_VIEWED%3A%60cart_viewed%60%2CSEARCH_VIEWED%3A%60search_viewed%60%2CCART_UPDATED%3A%60cart_updated%60%2CPRODUCT_ADD_TO_CART%3A%60product_added_to_cart%60%2CPRODUCT_REMOVED_FROM_CART%3A%60product_removed_from_cart%60%7D%2Cd%3D%60gid%3A%2F%2Fshopify%2FShop%2F%60%3Bfunction%20f(e)%7Breturn%20e.startsWith(d)%3Fe%3A%60%24%7Bd%7D%24%7Be%7D%60%7Dfunction%20p(e)%7Breturn%20e%3F%7B...e%2CshopId%3Af(e.shopId)%7D%3Anull%7Dlet%20m%3Dnew%20Set(%5Bu.PAGE_VIEWED%2Cu.PRODUCT_VIEWED%2Cu.COLLECTION_VIEWED%2Cu.CART_VIEWED%2Cu.SEARCH_VIEWED%5D)%2Ch%3Dnew%20Set(Object.values(u))%3Bfunction%20g()%7Bif(!(typeof%20window%3E%60u%60))return%20window.location.href%7Dfunction%20_(e%2Ct)%7Breturn%20Object.prototype.hasOwnProperty.call(e%2Ct)%7Dfunction%20v(e%2Ct)%7Breturn%20s(e)%3F_(e%2C%60shop%60)%3F%7B...e%2Cshop%3Ap(e.shop)%7D%3A%7B...e%2Cshop%3At%7D%3Ae%7Dfunction%20y(e%2Ct)%7Bif(!m.has(e)%7C%7C!s(t)%7C%7Ctypeof%20t.url%3D%3D%60string%60%26%26t.url.length%3E0)return%20t%3Blet%20n%3Dg()%3Breturn%20n%3F%7B...t%2Curl%3An%7D%3At%7Dfunction%20b()%7Btry%7Blet%20e%3Dwindow.Shopify%3F.customerPrivacy%3Bif(e%3F.consentStatus!%3D%3D%60loaded%60)return!1%3Blet%20t%3De.currentVisitorConsent%3F.()%3Breturn%20s(t)%26%26t.analytics%3D%3D%3D%60no%60%3F!1%3Ae%3F.analyticsProcessingAllowed%3F.()%3F%3F!1%7Dcatch%7Breturn!1%7D%7Dfunction%20x(e)%7Breturn%20typeof%20e%3D%3D%60string%60%26%26h.has(e)%7Dfunction%20S(e)%7Br.warn(%60unsupported%20analytics%20event%20%22%24%7BString(e)%7D%22%60%2C%7Bscope%3A%60analytics%60%7D)%7Dfunction%20C(e)%7Breturn!s(e)%7C%7Ce.analytics%3D%3D%3D%60%60%26%26e.marketing%3D%3D%3D%60%60%26%26e.preferences%3D%3D%3D%60%60%7Dfunction%20w()%7Btry%7Bif(!s(window.privacyBanner))return!1%3Blet%20e%3Dwindow.Shopify%3F.customerPrivacy%2Ct%3De%3F.shouldShowBanner%3Breturn%20typeof%20t%3D%3D%60function%60%3Ft()%26%26C(e%3F.currentVisitorConsent%3F.())%3A!0%7Dcatch%7Breturn!0%7D%7Dfunction%20T(e)%7Breturn%20e%3D%3D%3Dvoid%200%3F%7B%7D%3Ae%7Dfunction%20E(e)%7Bif(typeof%20window%3C%60u%60%26%26window.Shopify%3F.analytics)throw%20Error(%60Analytics%20bus%20already%20initialized.%20Only%20one%20setupStorefrontAnalytics()%20instance%20is%20allowed.%20Call%20destroy()%20first%20to%20re-initialize.%60)%3Blet%7Bconsent%3At%2CcustomData%3An%7D%3De%2Ci%3Dp(e.shop)%2Cs%3D!1%2Cc%3D!1%2Cu%3Dnew%20Map%2Cd%3D0%3Bfunction%20f()%7Breturn%7Bshop%3Ai%2Cconsent%3At%2CcustomData%3An%7D%7Dlet%20m%3Dl(%7BcanTrack%3A()%3D%3E!c%26%26b()%2CgetConfig%3Af%2CisSupportedEvent%3Ax%2CwarnUnsupportedEvent%3AS%7D)%3Bfunction%20h(e%2C...t)%7Bif(s)return%3Bif(!x(e))%7BS(e)%3Breturn%7Dlet%20n%3Dy(e%2Cv(T(t%5B0%5D)%2Ci))%3B(u.get(e)%3F%3Fnew%20Map).forEach((e%2Ct)%3D%3E%7Btry%7Be(n)%7Dcatch(e)%7Br.error(%60analytics%20publish%20error%60%2C%7Bscope%3A%60analytics%60%2Cerror%3Ae%2CsubscriberId%3At%7D)%7D%7D)%2Cm.onPublish(e%2Cn)%7Dfunction%20g(e%2Ct)%7Bif(!x(e))return%20S(e)%2C()%3D%3E%7B%7D%3Blet%20n%3Du.get(e)%3Bn%7C%7C(n%3Dnew%20Map%2Cu.set(e%2Cn))%3Blet%20r%3DString(d%2B%2B)%3Breturn%20n.set(r%2Ct)%2C()%3D%3E%7Bu.get(e)%3F.delete(r)%7D%7Dlet%20_%3Bfunction%20C()%7Bif(typeof%20document%3E%60u%60)return%3Blet%20e%3De%3D%3E%7Bif(s)return%3Blet%20t%3De.detail%3F.source%2Cn%3Dt%3D%3D%3D%60initial%60%26%26w()%3Bif(c%3Dn%2Cn)return%3Blet%20r%3Dt!%3D%3D%60initial%60%3Bm.replay(r)%7D%3Bdocument.addEventListener(a%2Ce)%2C_%3D()%3D%3E%7Bdocument.removeEventListener(a%2Ce)%7D%7Dfunction%20E()%7Bif(typeof%20window%3E%60u%60)return%3Blet%20e%3DO%2Ct%3Do()%3Bt%26%26(t.analytics%3De)%7Dfunction%20D()%7Bs%3D!0%2Cu.clear()%2Cm.destroy()%2C_%3F.()%2Ctypeof%20window%3C%60u%60%26%26window.Shopify%3F.analytics%3D%3D%3DO%26%26delete%20window.Shopify.analytics%7Dlet%20O%3D%7Bpublish%3Ah%2Csubscribe%3Ag%2CaddDestination%3Am.addDestination%2Cdestroy%3AD%2CgetConfig%3Af%7D%3Breturn%20i%3F.shopId%26%26String(i.shopId).endsWith(%60%2F68817551382%60)%26%26r.warn(%60mock%20shop%20detected%3B%20analytics%20will%20not%20work%20properly%60%2C%7Bscope%3A%60analytics%60%7D)%2CC()%2CE()%2CO%7Dfunction%20D(e)%7Be%26%26E(e)%7DD(__SHOPIFY_SCRIPT_DATA__)%7D)()%3B").replace("__SHOPIFY_SCRIPT_DATA__", () => (JSON.stringify(scriptData) ?? "undefined").replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"));
|
|
5
|
+
function getShopifyAnalyticsConfig({ analytics, consent, shop }) {
|
|
6
|
+
const channel = analytics?.channel ?? "hydrogen";
|
|
7
|
+
return {
|
|
8
|
+
shop: channel === "headless" ? {
|
|
9
|
+
shopId: shop.shopId,
|
|
10
|
+
channel
|
|
11
|
+
} : {
|
|
12
|
+
shopId: shop.shopId,
|
|
13
|
+
storefrontId: shop.storefrontId,
|
|
14
|
+
channel
|
|
15
|
+
},
|
|
16
|
+
consent: consent ?? {},
|
|
17
|
+
customData: analytics?.customData
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function getShopifyAnalyticsBusScript(analytics) {
|
|
21
|
+
return asInlineScript(initializeShopifyAnalyticsBus)(analytics);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getShopifyAnalyticsBusScript, getShopifyAnalyticsConfig };
|
|
26
|
+
//# sourceMappingURL=analytics.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.mjs","names":[],"sources":["../../../src/core/shopify-scripts/analytics.ts"],"sourcesContent":["import initializeShopifyAnalyticsBus from \"../analytics/cdn/bootstrap\" with { type: \"script\" };\nimport type { StorefrontAnalyticsConfig } from \"../analytics/types\";\nimport type { ShopifyScriptTagsOptions } from \"./types\";\nimport { asInlineScript } from \"./utils/inline-script\";\n\nexport function getShopifyAnalyticsConfig({\n analytics,\n consent,\n shop,\n}: Pick<ShopifyScriptTagsOptions, \"analytics\" | \"consent\" | \"shop\">): StorefrontAnalyticsConfig {\n const channel = analytics?.channel ?? \"hydrogen\";\n\n return {\n shop:\n channel === \"headless\"\n ? { shopId: shop.shopId, channel }\n : { shopId: shop.shopId, storefrontId: shop.storefrontId, channel },\n consent: consent ?? {},\n customData: analytics?.customData,\n };\n}\n\nexport function getShopifyAnalyticsBusScript(analytics: StorefrontAnalyticsConfig): string {\n return asInlineScript(initializeShopifyAnalyticsBus)(analytics);\n}\n"],"mappings":";;;AAAA,MAAM,iCAA+B,eAAkB,mBAAgB,mpPAAuB,CAAA,QAAA,kCAAA,KAAA,UAAA,WAAA,IAAA,aAAA,QAAA,MAAA,UAAA,CAAA,QAAA,WAAA,UAAA,CAAA,QAAA,WAAA,UAAA,CAAA;AAK9F,SAAgB,0BAA0B,EACxC,WACA,SACA,QAC8F;CAC9F,MAAM,UAAU,WAAW,WAAW;AAEtC,QAAO;EACL,MACE,YAAY,aACR;GAAE,QAAQ,KAAK;GAAQ;GAAQ,GAC/B;GAAE,QAAQ,KAAK;GAAQ,cAAc,KAAK;GAAc;GAAS;EACvE,SAAS,WAAW,EAAE;EACtB,YAAY,WAAW;EACxB;;AAGH,SAAgB,6BAA6B,WAA8C;AACzF,QAAO,eAAe,8BAA8B,CAAC,UAAU"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { asInlineScript } from "./utils/inline-script.mjs";
|
|
2
|
+
import { SHOPIFY_CONSENT_SCRIPT_ID, VISITOR_CONSENT_COLLECTED_EVENT } from "./constants.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/core/shopify-scripts/consent.ts
|
|
5
|
+
const initializeShopifyConsentTracking = (scriptData) => decodeURIComponent("(function()%7Bfunction%20e(e)%7Breturn%20typeof%20e%3D%3D%60object%60%26%26!!e%7Dfunction%20t(e%2Ct)%7Blet%20n%3D%5B%60%5Bhydrogen%3Aerror%3Aconsent%5D%20%24%7Be%7D%60%5D%3Bt!%3D%3Dvoid%200%26%26n.push(t)%2Cconsole.error(...n)%7Dfunction%20n(n)%7Blet%20r%3Dwindow%2Ci%3Dn.mode%3D%3D%3D%60default-banner%60%2Ca%3D!1%2Co%3D!1%2Cs%3D%60initial%60%2Cc%3D()%3D%3Er.Shopify%3F.customerPrivacy%2Cl%3D()%3D%3E%7Blet%20e%3Dc()%3Be%26%26(e.consentStatus%3D%60loaded%60)%7D%2Cu%3D()%3D%3E%7Bo%3D!0%2Ca%26%26l()%7D%2Cd%3D()%3D%3E%7Blet%20e%3Dc()%3F.setTrackingConsent%3Bif(typeof%20e!%3D%60function%60)return%20t(%60unable%20to%20request%20initial%20consent%60)%2Cu()%3Be(%7BheadlessStorefront%3A!0%7D%2Ce%3D%3E%7Bif(e%3F.error)%7Bt(%60unable%20to%20request%20initial%20consent%60%2Ce.error)%3Breturn%7Du()%7D)%7D%2Cf%3D()%3D%3E%7Blet%20e%3Dc()%3Breturn%20typeof%20e%3F.setTrackingConsent%3D%3D%60function%60%7C%7Ctypeof%20e%3F.shouldShowBanner%3D%3D%60function%60%7C%7Ctypeof%20window.privacyBanner%3D%3D%60object%60%7D%2Cp%3D()%3D%3E%7Ba%7C%7C(a%3D!0%2Ci%3Fo%26%26u()%3Ad())%7D%3Bdocument.addEventListener(n.eventName%2Ct%3D%3E%7Blet%20n%3D%60detail%60in%20t%3Ft.detail%3Avoid%200%3Be(n)%26%26(n.source%3F%3F%3Ds)%2Cs%3D%60interaction%60%7D%2C%7Bcapture%3A!0%7D)%2Cdocument.addEventListener(n.eventName%2Cu%2C%7Bcapture%3A!0%7D)%3Blet%20m%3Ddocument.getElementById(n.scriptId)%3Bf()%3Fp()%3Am%3F.addEventListener(%60load%60%2Cp%2C%7Bonce%3A!0%7D)%7Dn(__SHOPIFY_SCRIPT_DATA__)%7D)()%3B").replace("__SHOPIFY_SCRIPT_DATA__", () => (JSON.stringify(scriptData) ?? "undefined").replace(/</g, "\\u003c").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029"));
|
|
6
|
+
function getShopifyConsentTrackingScript(consent = {}) {
|
|
7
|
+
const config = {
|
|
8
|
+
eventName: VISITOR_CONSENT_COLLECTED_EVENT,
|
|
9
|
+
mode: consent.mode ?? "no-banner",
|
|
10
|
+
scriptId: SHOPIFY_CONSENT_SCRIPT_ID
|
|
11
|
+
};
|
|
12
|
+
return asInlineScript(initializeShopifyConsentTracking)(config);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { getShopifyConsentTrackingScript };
|
|
17
|
+
//# sourceMappingURL=consent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consent.mjs","names":[],"sources":["../../../src/core/shopify-scripts/consent.ts"],"sourcesContent":["import type { ConsentConfig } from \"../analytics/types\";\nimport initializeShopifyConsentTracking from \"./consent-script\" with { type: \"script\" };\nimport type { ShopifyConsentTrackingConfig } from \"./consent-script\";\nimport { SHOPIFY_CONSENT_SCRIPT_ID, VISITOR_CONSENT_COLLECTED_EVENT } from \"./constants\";\nimport { asInlineScript } from \"./utils/inline-script\";\n\nexport function getShopifyConsentTrackingScript(consent: ConsentConfig = {}): string {\n const config: ShopifyConsentTrackingConfig = {\n eventName: VISITOR_CONSENT_COLLECTED_EVENT,\n mode: consent.mode ?? \"no-banner\",\n scriptId: SHOPIFY_CONSENT_SCRIPT_ID,\n };\n\n return asInlineScript(initializeShopifyConsentTracking)(config);\n}\n"],"mappings":";;;;AACA,MAAM,oCAAkC,eAAgB,mBAAqB,q8CAAU,CAAA,QAAA,kCAAA,KAAA,UAAA,WAAA,IAAA,aAAA,QAAA,MAAA,UAAA,CAAA,QAAA,WAAA,UAAA,CAAA,QAAA,WAAA,UAAA,CAAA;AAKvF,SAAgB,gCAAgC,UAAyB,EAAE,EAAU;CACnF,MAAM,SAAuC;EAC3C,WAAW;EACX,MAAM,QAAQ,QAAQ;EACtB,UAAU;EACX;AAED,QAAO,eAAe,iCAAiC,CAAC,OAAO"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//#region src/core/shopify-scripts/constants.ts
|
|
2
|
+
const SHOPIFY_CDN_ORIGIN = "https://cdn.shopify.com";
|
|
3
|
+
const SHOPIFY_SHOP_APP_ORIGIN = "https://shop.app";
|
|
4
|
+
const SHOPIFY_STOREFRONT_STANDARD_ACTIONS_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/standard-actions.js`;
|
|
5
|
+
const SHOPIFY_STOREFRONT_STANDARD_EVENTS_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/standard-events.js`;
|
|
6
|
+
const SHOPIFY_STOREFRONT_STANDARD_EVENTS_INSPECTOR_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/standard-events-inspector.js`;
|
|
7
|
+
const SHOPIFY_STOREFRONT_WEBMCP_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/webmcp.js`;
|
|
8
|
+
const SHOPIFY_INBOX_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/web-components/agent.js`;
|
|
9
|
+
const SHOPIFY_STOREFRONT_ANALYTICS_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/analytics/shopify.js`;
|
|
10
|
+
const SHOPIFY_PERF_KIT_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js?v2`;
|
|
11
|
+
const SHOPIFY_CONSENT_API_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js`;
|
|
12
|
+
const SHOPIFY_PRIVACY_BANNER_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/shopifycloud/privacy-banner/storefront-banner.js`;
|
|
13
|
+
const SHOPIFY_CONSENT_SCRIPT_ID = "shopify-consent";
|
|
14
|
+
const SHOPIFY_PERF_KIT_SCRIPT_ID = "shopify-perfkit";
|
|
15
|
+
const VISITOR_CONSENT_COLLECTED_EVENT = "visitorConsentCollected";
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { SHOPIFY_CDN_ORIGIN, SHOPIFY_CONSENT_API_SCRIPT, SHOPIFY_CONSENT_SCRIPT_ID, SHOPIFY_INBOX_SCRIPT, SHOPIFY_PERF_KIT_SCRIPT, SHOPIFY_PERF_KIT_SCRIPT_ID, 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 };
|
|
19
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../../src/core/shopify-scripts/constants.ts"],"sourcesContent":["export const SHOPIFY_CDN_ORIGIN = \"https://cdn.shopify.com\";\nexport const SHOPIFY_SHOP_APP_ORIGIN = \"https://shop.app\";\nexport const SHOPIFY_STOREFRONT_STANDARD_ACTIONS_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/standard-actions.js`;\nexport const SHOPIFY_STOREFRONT_STANDARD_EVENTS_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/standard-events.js`;\nexport const SHOPIFY_STOREFRONT_STANDARD_EVENTS_INSPECTOR_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/standard-events-inspector.js`;\nexport const SHOPIFY_STOREFRONT_WEBMCP_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/webmcp.js`;\nexport const SHOPIFY_INBOX_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/web-components/agent.js`;\n\nexport const SHOPIFY_STOREFRONT_ANALYTICS_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/storefront/analytics/shopify.js`;\n\nexport const SHOPIFY_PERF_KIT_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/shopifycloud/perf-kit/shopify-perf-kit-spa.min.js?v2`;\nexport const SHOPIFY_CONSENT_API_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js`;\nexport const SHOPIFY_PRIVACY_BANNER_SCRIPT = `${SHOPIFY_CDN_ORIGIN}/shopifycloud/privacy-banner/storefront-banner.js`;\n\nexport const SHOPIFY_CONSENT_SCRIPT_ID = \"shopify-consent\";\nexport const SHOPIFY_PERF_KIT_SCRIPT_ID = \"shopify-perfkit\";\n\nexport const VISITOR_CONSENT_COLLECTED_EVENT = \"visitorConsentCollected\";\n"],"mappings":";AAAA,MAAa,qBAAqB;AAClC,MAAa,0BAA0B;AACvC,MAAa,6CAA6C,GAAG,mBAAmB;AAChF,MAAa,4CAA4C,GAAG,mBAAmB;AAC/E,MAAa,sDAAsD,GAAG,mBAAmB;AACzF,MAAa,mCAAmC,GAAG,mBAAmB;AACtE,MAAa,uBAAuB,GAAG,mBAAmB;AAE1D,MAAa,sCAAsC,GAAG,mBAAmB;AAEzE,MAAa,0BAA0B,GAAG,mBAAmB;AAC7D,MAAa,6BAA6B,GAAG,mBAAmB;AAChE,MAAa,gCAAgC,GAAG,mBAAmB;AAEnE,MAAa,4BAA4B;AACzC,MAAa,6BAA6B;AAE1C,MAAa,kCAAkC"}
|