@shopify/hydrogen 2026.10.0-preview.4 → 2026.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.mjs +23 -12
- package/dist/client/client.d.mts +18 -15
- package/dist/client/client.mjs +8 -3
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/errors.d.mts +35 -13
- package/dist/client/errors.mjs +23 -13
- package/dist/client/errors.mjs.map +1 -1
- package/dist/client/types.d.mts +140 -90
- package/dist/core/analytics/cart-tracker.d.mts +19 -10
- package/dist/core/analytics/cart-tracker.mjs +18 -10
- package/dist/core/analytics/cart-tracker.mjs.map +1 -1
- package/dist/core/analytics/events.d.mts +17 -11
- package/dist/core/analytics/events.mjs +13 -4
- package/dist/core/analytics/events.mjs.map +1 -1
- package/dist/core/analytics/types.d.mts +207 -118
- package/dist/core/analytics/utils/flatten-connection.d.mts +11 -9
- package/dist/core/analytics/utils/flatten-connection.mjs +7 -6
- package/dist/core/analytics/utils/flatten-connection.mjs.map +1 -1
- package/dist/core/cache/fetch-with-cache.d.mts +24 -4
- package/dist/core/cache/fetch-with-cache.mjs +17 -2
- package/dist/core/cache/fetch-with-cache.mjs.map +1 -1
- package/dist/core/cache/key.d.mts +2 -0
- package/dist/core/cache/key.mjs.map +1 -1
- package/dist/core/cache/run-with-cache.d.mts +56 -8
- package/dist/core/cache/run-with-cache.mjs +17 -6
- package/dist/core/cache/run-with-cache.mjs.map +1 -1
- package/dist/core/cache/store.d.mts +8 -6
- package/dist/core/cache/store.mjs.map +1 -1
- package/dist/core/cache/strategies.d.mts +27 -2
- package/dist/core/cache/strategies.mjs +6 -0
- package/dist/core/cache/strategies.mjs.map +1 -1
- package/dist/core/cart/actions.d.mts +37 -30
- package/dist/core/cart/actions.mjs +21 -9
- package/dist/core/cart/actions.mjs.map +1 -1
- package/dist/core/cart/attach-quantity-input.d.mts +8 -7
- package/dist/core/cart/attach-quantity-input.mjs +8 -7
- package/dist/core/cart/attach-quantity-input.mjs.map +1 -1
- package/dist/core/cart/buyer-identity-sync.d.mts +7 -6
- package/dist/core/cart/buyer-identity-sync.mjs.map +1 -1
- package/dist/core/cart/cart.d.mts +59 -46
- package/dist/core/cart/cart.mjs +46 -29
- package/dist/core/cart/cart.mjs.map +1 -1
- package/dist/core/cart/cookie.d.mts +8 -4
- package/dist/core/cart/cookie.mjs +8 -4
- package/dist/core/cart/cookie.mjs.map +1 -1
- package/dist/core/cart/form.d.mts +34 -20
- package/dist/core/cart/form.mjs +6 -4
- package/dist/core/cart/form.mjs.map +1 -1
- package/dist/core/cart/get-cart.d.mts +27 -15
- package/dist/core/cart/get-cart.mjs +13 -8
- package/dist/core/cart/get-cart.mjs.map +1 -1
- package/dist/core/cart/quantity.d.mts +16 -5
- package/dist/core/cart/quantity.mjs +16 -5
- package/dist/core/cart/quantity.mjs.map +1 -1
- package/dist/core/cart/queries.d.mts +25 -19
- package/dist/core/cart/queries.mjs +15 -1
- package/dist/core/cart/queries.mjs.map +1 -1
- package/dist/core/cart/server-handlers.d.mts +82 -45
- package/dist/core/cart/server-handlers.mjs +4 -0
- package/dist/core/cart/server-handlers.mjs.map +1 -1
- package/dist/core/cart/state.d.mts +110 -64
- package/dist/core/cart/state.mjs +24 -6
- package/dist/core/cart/state.mjs.map +1 -1
- package/dist/core/collection/collection.d.mts +52 -53
- package/dist/core/collection/collection.mjs +5 -3
- package/dist/core/collection/collection.mjs.map +1 -1
- package/dist/core/collection/reconciler.d.mts +23 -16
- package/dist/core/collection/reconciler.mjs +8 -4
- package/dist/core/collection/reconciler.mjs.map +1 -1
- package/dist/core/collection/state.d.mts +31 -26
- package/dist/core/collection/state.mjs +4 -3
- package/dist/core/collection/state.mjs.map +1 -1
- package/dist/core/collection/url.d.mts +70 -29
- package/dist/core/collection/url.mjs +63 -25
- package/dist/core/collection/url.mjs.map +1 -1
- package/dist/core/constants.d.mts +1 -0
- package/dist/core/constants.mjs +1 -0
- package/dist/core/constants.mjs.map +1 -1
- package/dist/core/logging/logging.d.mts +14 -8
- package/dist/core/logging/logging.mjs +15 -10
- package/dist/core/logging/logging.mjs.map +1 -1
- package/dist/core/logging/types.d.mts +28 -11
- package/dist/core/logging/types.mjs.map +1 -1
- package/dist/core/money/format.d.mts +6 -4
- package/dist/core/money/format.mjs +19 -9
- package/dist/core/money/format.mjs.map +1 -1
- package/dist/core/money/types.d.mts +41 -25
- package/dist/core/predictive-search/form.d.mts +37 -7
- package/dist/core/predictive-search/form.mjs +21 -3
- package/dist/core/predictive-search/form.mjs.map +1 -1
- package/dist/core/predictive-search/queries.d.mts +18 -30
- package/dist/core/predictive-search/queries.mjs +7 -3
- package/dist/core/predictive-search/queries.mjs.map +1 -1
- package/dist/core/predictive-search/search.d.mts +25 -27
- package/dist/core/predictive-search/search.mjs +20 -19
- package/dist/core/predictive-search/search.mjs.map +1 -1
- package/dist/core/predictive-search/server-handlers.d.mts +25 -26
- package/dist/core/predictive-search/server-handlers.mjs +4 -0
- package/dist/core/predictive-search/server-handlers.mjs.map +1 -1
- package/dist/core/predictive-search/store.d.mts +65 -24
- package/dist/core/predictive-search/store.mjs +12 -1
- package/dist/core/predictive-search/store.mjs.map +1 -1
- package/dist/core/predictive-search/url.d.mts +36 -37
- package/dist/core/predictive-search/url.mjs +14 -6
- package/dist/core/predictive-search/url.mjs.map +1 -1
- package/dist/core/product/form.d.mts +63 -16
- package/dist/core/product/form.mjs +8 -2
- package/dist/core/product/form.mjs.map +1 -1
- package/dist/core/product/options.d.mts +8 -10
- package/dist/core/product/options.mjs +8 -10
- package/dist/core/product/options.mjs.map +1 -1
- package/dist/core/product/product-form.d.mts +77 -29
- package/dist/core/product/product-form.mjs +32 -10
- package/dist/core/product/product-form.mjs.map +1 -1
- package/dist/core/product/state.d.mts +55 -32
- package/dist/core/product/url.d.mts +19 -13
- package/dist/core/product/url.mjs +10 -10
- package/dist/core/product/url.mjs.map +1 -1
- package/dist/core/request-context.d.mts +77 -19
- package/dist/core/request-context.mjs +5 -1
- package/dist/core/request-context.mjs.map +1 -1
- package/dist/core/request-routing/handle-shopify-redirects.d.mts +12 -4
- package/dist/core/request-routing/handle-shopify-redirects.mjs +9 -2
- package/dist/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
- package/dist/core/request-routing/handle-shopify-routes.d.mts +5 -5
- package/dist/core/request-routing/handle-shopify-routes.mjs +7 -5
- package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/proxy.mjs +79 -43
- package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
- package/dist/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
- package/dist/core/request-routing/interceptors/url-redirects.mjs +6 -1
- package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/well-known.mjs +1 -1
- package/dist/core/request-routing/interceptors/well-known.mjs.map +1 -1
- package/dist/core/request-routing/registered-routes.d.mts +12 -0
- package/dist/core/request-routing/registered-routes.mjs +12 -0
- package/dist/core/request-routing/registered-routes.mjs.map +1 -1
- package/dist/core/request-routing/route-types.d.mts +43 -18
- package/dist/core/shop-pay/shop-pay.d.mts +71 -35
- package/dist/core/shop-pay/shop-pay.mjs +36 -10
- package/dist/core/shop-pay/shop-pay.mjs.map +1 -1
- package/dist/core/shopify-scripts/index.d.mts +15 -5
- package/dist/core/shopify-scripts/index.mjs +15 -5
- package/dist/core/shopify-scripts/index.mjs.map +1 -1
- package/dist/core/shopify-scripts/initialize.d.mts +12 -4
- package/dist/core/shopify-scripts/initialize.mjs +12 -4
- package/dist/core/shopify-scripts/initialize.mjs.map +1 -1
- package/dist/core/shopify-scripts/types.d.mts +58 -25
- package/dist/core/standard-routes/build.d.mts +11 -12
- package/dist/core/standard-routes/build.mjs +11 -12
- package/dist/core/standard-routes/build.mjs.map +1 -1
- package/dist/core/standard-routes/types.d.mts +30 -24
- package/dist/core/url.mjs +2 -1
- package/dist/core/url.mjs.map +1 -1
- package/dist/customer-account/client.d.mts +36 -69
- package/dist/customer-account/client.mjs +7 -8
- package/dist/customer-account/client.mjs.map +1 -1
- package/dist/customer-account/errors.d.mts +45 -36
- package/dist/customer-account/errors.mjs +21 -36
- package/dist/customer-account/errors.mjs.map +1 -1
- package/dist/customer-account/graphql.d.mts +11 -23
- package/dist/customer-account/graphql.mjs +3 -9
- package/dist/customer-account/graphql.mjs.map +1 -1
- package/dist/customer-account/session.d.mts +130 -100
- package/dist/customer-account/session.mjs +32 -10
- package/dist/customer-account/session.mjs.map +1 -1
- package/dist/customer-account/type-resolver.d.mts +7 -8
- package/dist/development/client/client.d.mts +18 -15
- package/dist/development/client/client.mjs +8 -3
- package/dist/development/client/client.mjs.map +1 -1
- package/dist/development/client/errors.d.mts +35 -13
- package/dist/development/client/errors.mjs +23 -13
- package/dist/development/client/errors.mjs.map +1 -1
- package/dist/development/client/types.d.mts +140 -90
- package/dist/development/core/analytics/cart-tracker.d.mts +19 -10
- package/dist/development/core/analytics/cart-tracker.mjs +18 -10
- package/dist/development/core/analytics/cart-tracker.mjs.map +1 -1
- package/dist/development/core/analytics/events.d.mts +17 -11
- package/dist/development/core/analytics/events.mjs +13 -4
- package/dist/development/core/analytics/events.mjs.map +1 -1
- package/dist/development/core/analytics/types.d.mts +207 -118
- package/dist/development/core/analytics/utils/flatten-connection.d.mts +11 -9
- package/dist/development/core/analytics/utils/flatten-connection.mjs +7 -6
- package/dist/development/core/analytics/utils/flatten-connection.mjs.map +1 -1
- package/dist/development/core/cache/fetch-with-cache.d.mts +24 -4
- package/dist/development/core/cache/fetch-with-cache.mjs +17 -2
- package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -1
- package/dist/development/core/cache/key.d.mts +2 -0
- package/dist/development/core/cache/key.mjs.map +1 -1
- package/dist/development/core/cache/run-with-cache.d.mts +56 -8
- package/dist/development/core/cache/run-with-cache.mjs +17 -6
- package/dist/development/core/cache/run-with-cache.mjs.map +1 -1
- package/dist/development/core/cache/store.d.mts +8 -6
- package/dist/development/core/cache/store.mjs.map +1 -1
- package/dist/development/core/cache/strategies.d.mts +27 -2
- package/dist/development/core/cache/strategies.mjs +6 -0
- package/dist/development/core/cache/strategies.mjs.map +1 -1
- package/dist/development/core/cart/actions.d.mts +37 -30
- package/dist/development/core/cart/actions.mjs +21 -9
- package/dist/development/core/cart/actions.mjs.map +1 -1
- package/dist/development/core/cart/attach-quantity-input.d.mts +8 -7
- package/dist/development/core/cart/attach-quantity-input.mjs +8 -7
- package/dist/development/core/cart/attach-quantity-input.mjs.map +1 -1
- package/dist/development/core/cart/buyer-identity-sync.d.mts +6 -5
- package/dist/development/core/cart/buyer-identity-sync.mjs.map +1 -1
- package/dist/development/core/cart/cart.d.mts +59 -46
- package/dist/development/core/cart/cart.mjs +46 -29
- package/dist/development/core/cart/cart.mjs.map +1 -1
- package/dist/development/core/cart/cookie.d.mts +8 -4
- package/dist/development/core/cart/cookie.mjs +8 -4
- package/dist/development/core/cart/cookie.mjs.map +1 -1
- package/dist/development/core/cart/form.d.mts +34 -20
- package/dist/development/core/cart/form.mjs +6 -4
- package/dist/development/core/cart/form.mjs.map +1 -1
- package/dist/development/core/cart/get-cart.d.mts +27 -15
- package/dist/development/core/cart/get-cart.mjs +13 -8
- package/dist/development/core/cart/get-cart.mjs.map +1 -1
- package/dist/development/core/cart/quantity.d.mts +16 -5
- package/dist/development/core/cart/quantity.mjs +16 -5
- package/dist/development/core/cart/quantity.mjs.map +1 -1
- package/dist/development/core/cart/queries.d.mts +25 -19
- package/dist/development/core/cart/queries.mjs +15 -1
- package/dist/development/core/cart/queries.mjs.map +1 -1
- package/dist/development/core/cart/server-handlers.d.mts +82 -45
- package/dist/development/core/cart/server-handlers.mjs +4 -0
- package/dist/development/core/cart/server-handlers.mjs.map +1 -1
- package/dist/development/core/cart/state.d.mts +110 -64
- package/dist/development/core/cart/state.mjs +24 -6
- package/dist/development/core/cart/state.mjs.map +1 -1
- package/dist/development/core/collection/collection.d.mts +52 -53
- package/dist/development/core/collection/collection.mjs +5 -3
- package/dist/development/core/collection/collection.mjs.map +1 -1
- package/dist/development/core/collection/reconciler.d.mts +23 -16
- package/dist/development/core/collection/reconciler.mjs +8 -4
- package/dist/development/core/collection/reconciler.mjs.map +1 -1
- package/dist/development/core/collection/state.d.mts +31 -26
- package/dist/development/core/collection/state.mjs +4 -3
- package/dist/development/core/collection/state.mjs.map +1 -1
- package/dist/development/core/collection/url.d.mts +70 -29
- package/dist/development/core/collection/url.mjs +63 -25
- package/dist/development/core/collection/url.mjs.map +1 -1
- package/dist/development/core/constants.mjs.map +1 -1
- package/dist/development/core/logging/logging.d.mts +14 -8
- package/dist/development/core/logging/logging.mjs +15 -10
- package/dist/development/core/logging/logging.mjs.map +1 -1
- package/dist/development/core/logging/types.d.mts +28 -11
- package/dist/development/core/logging/types.mjs.map +1 -1
- package/dist/development/core/money/format.d.mts +6 -4
- package/dist/development/core/money/format.mjs +19 -9
- package/dist/development/core/money/format.mjs.map +1 -1
- package/dist/development/core/money/types.d.mts +41 -25
- package/dist/development/core/predictive-search/form.d.mts +37 -7
- package/dist/development/core/predictive-search/form.mjs +21 -3
- package/dist/development/core/predictive-search/form.mjs.map +1 -1
- package/dist/development/core/predictive-search/queries.d.mts +18 -30
- package/dist/development/core/predictive-search/queries.mjs +7 -3
- package/dist/development/core/predictive-search/queries.mjs.map +1 -1
- package/dist/development/core/predictive-search/search.d.mts +25 -27
- package/dist/development/core/predictive-search/search.mjs +20 -19
- package/dist/development/core/predictive-search/search.mjs.map +1 -1
- package/dist/development/core/predictive-search/server-handlers.d.mts +25 -26
- package/dist/development/core/predictive-search/server-handlers.mjs +4 -0
- package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -1
- package/dist/development/core/predictive-search/store.d.mts +65 -24
- package/dist/development/core/predictive-search/store.mjs +12 -1
- package/dist/development/core/predictive-search/store.mjs.map +1 -1
- package/dist/development/core/predictive-search/url.d.mts +36 -37
- package/dist/development/core/predictive-search/url.mjs +14 -6
- package/dist/development/core/predictive-search/url.mjs.map +1 -1
- package/dist/development/core/product/form.d.mts +63 -16
- package/dist/development/core/product/form.mjs +8 -2
- package/dist/development/core/product/form.mjs.map +1 -1
- package/dist/development/core/product/options.d.mts +8 -10
- package/dist/development/core/product/options.mjs +8 -10
- package/dist/development/core/product/options.mjs.map +1 -1
- package/dist/development/core/product/product-form.d.mts +77 -29
- package/dist/development/core/product/product-form.mjs +32 -10
- package/dist/development/core/product/product-form.mjs.map +1 -1
- package/dist/development/core/product/state.d.mts +55 -32
- package/dist/development/core/product/url.d.mts +19 -13
- package/dist/development/core/product/url.mjs +10 -10
- package/dist/development/core/product/url.mjs.map +1 -1
- package/dist/development/core/request-context.d.mts +77 -19
- package/dist/development/core/request-context.mjs +5 -1
- package/dist/development/core/request-context.mjs.map +1 -1
- package/dist/development/core/request-routing/handle-shopify-redirects.d.mts +12 -4
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs +9 -2
- package/dist/development/core/request-routing/handle-shopify-redirects.mjs.map +1 -1
- package/dist/development/core/request-routing/handle-shopify-routes.development.d.mts +9 -1
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs +7 -0
- package/dist/development/core/request-routing/handle-shopify-routes.development.mjs.map +1 -1
- package/dist/development/core/request-routing/handle-shopify-routes.mjs +7 -5
- package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/proxy.mjs +79 -43
- package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs +69 -0
- package/dist/development/core/request-routing/interceptors/ucp-profile-proxy.mjs.map +1 -0
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs +6 -1
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/well-known.mjs +1 -1
- package/dist/development/core/request-routing/interceptors/well-known.mjs.map +1 -1
- package/dist/development/core/request-routing/registered-routes.d.mts +12 -0
- package/dist/development/core/request-routing/registered-routes.mjs +12 -0
- package/dist/development/core/request-routing/registered-routes.mjs.map +1 -1
- package/dist/development/core/request-routing/route-types.d.mts +43 -18
- package/dist/development/core/shop-pay/shop-pay.d.mts +71 -35
- package/dist/development/core/shop-pay/shop-pay.mjs +36 -10
- package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/index.d.mts +15 -5
- package/dist/development/core/shopify-scripts/index.mjs +15 -5
- package/dist/development/core/shopify-scripts/index.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/initialize.d.mts +12 -4
- package/dist/development/core/shopify-scripts/initialize.mjs +12 -4
- package/dist/development/core/shopify-scripts/initialize.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/types.d.mts +58 -25
- package/dist/development/core/standard-routes/build.d.mts +11 -12
- package/dist/development/core/standard-routes/build.mjs +11 -12
- package/dist/development/core/standard-routes/build.mjs.map +1 -1
- package/dist/development/core/standard-routes/types.d.mts +30 -24
- package/dist/development/core/url.mjs +2 -1
- package/dist/development/core/url.mjs.map +1 -1
- package/dist/development/customer-account/session.d.mts +45 -54
- package/dist/development/customer-account/session.mjs +20 -4
- package/dist/development/customer-account/session.mjs.map +1 -1
- package/dist/development/globals.d.mts +20 -11
- package/dist/development/graphql/generated/storefront-api-types.d.mts +127 -1
- package/dist/development/graphql/graphql.d.mts +17 -16
- package/dist/development/graphql/graphql.mjs +7 -8
- package/dist/development/graphql/graphql.mjs.map +1 -1
- package/dist/development/graphql/type-resolver.d.mts +15 -8
- package/dist/development/react/cart.d.mts +78 -32
- package/dist/development/react/cart.mjs +56 -29
- package/dist/development/react/cart.mjs.map +1 -1
- package/dist/development/react/collection.d.mts +40 -22
- package/dist/development/react/collection.mjs +27 -7
- package/dist/development/react/collection.mjs.map +1 -1
- package/dist/development/react/predictive-search.d.mts +65 -50
- package/dist/development/react/predictive-search.mjs +23 -21
- package/dist/development/react/predictive-search.mjs.map +1 -1
- package/dist/development/react/product.d.mts +45 -16
- package/dist/development/react/product.mjs +13 -11
- package/dist/development/react/product.mjs.map +1 -1
- package/dist/development/react/shop-pay.d.mts +15 -0
- package/dist/development/react/shop-pay.mjs +9 -0
- package/dist/development/react/shop-pay.mjs.map +1 -1
- package/dist/development/react/shopify-scripts.d.mts +23 -2
- package/dist/development/react/shopify-scripts.mjs +9 -0
- package/dist/development/react/shopify-scripts.mjs.map +1 -1
- package/dist/development/vue/cart.d.mts +28 -23
- package/dist/development/vue/cart.mjs +42 -25
- package/dist/development/vue/cart.mjs.map +1 -1
- package/dist/development/vue/collection.d.mts +20 -12
- package/dist/development/vue/collection.mjs +15 -7
- package/dist/development/vue/collection.mjs.map +1 -1
- package/dist/development/vue/index.d.mts +2 -2
- package/dist/development/vue/index.mjs +2 -2
- package/dist/development/vue/predictive-search.d.mts +31 -36
- package/dist/development/vue/predictive-search.mjs +16 -22
- package/dist/development/vue/predictive-search.mjs.map +1 -1
- package/dist/development/vue/product.d.mts +16 -15
- package/dist/development/vue/product.mjs +11 -11
- package/dist/development/vue/product.mjs.map +1 -1
- package/dist/development/vue/shop-pay.d.mts +14 -17
- package/dist/development/vue/shop-pay.mjs +8 -0
- package/dist/development/vue/shop-pay.mjs.map +1 -1
- package/dist/development/vue/shopify-scripts.d.mts +11 -0
- package/dist/development/vue/shopify-scripts.mjs +6 -0
- package/dist/development/vue/shopify-scripts.mjs.map +1 -1
- package/dist/globals.d.mts +20 -11
- package/dist/graphql/generated/storefront-api-types.d.mts +127 -1
- package/dist/graphql/graphql.d.mts +17 -16
- package/dist/graphql/graphql.mjs +7 -8
- package/dist/graphql/graphql.mjs.map +1 -1
- package/dist/graphql/type-resolver.d.mts +15 -8
- package/dist/react/cart.d.mts +78 -32
- package/dist/react/cart.mjs +56 -29
- package/dist/react/cart.mjs.map +1 -1
- package/dist/react/collection.d.mts +40 -22
- package/dist/react/collection.mjs +27 -7
- package/dist/react/collection.mjs.map +1 -1
- package/dist/react/predictive-search.d.mts +65 -50
- package/dist/react/predictive-search.mjs +23 -21
- package/dist/react/predictive-search.mjs.map +1 -1
- package/dist/react/product.d.mts +45 -16
- package/dist/react/product.mjs +13 -11
- package/dist/react/product.mjs.map +1 -1
- package/dist/react/shop-pay.d.mts +15 -0
- package/dist/react/shop-pay.mjs +9 -0
- package/dist/react/shop-pay.mjs.map +1 -1
- package/dist/react/shopify-scripts.d.mts +23 -2
- package/dist/react/shopify-scripts.mjs +9 -0
- package/dist/react/shopify-scripts.mjs.map +1 -1
- package/dist/ts-plugin/index.cjs +6 -0
- package/dist/ts-plugin/index.cjs.map +1 -1
- package/dist/ts-plugin/index.d.cts +6 -0
- package/dist/vite/local-https.d.mts +51 -17
- package/dist/vite/local-https.mjs +26 -5
- package/dist/vite/local-https.mjs.map +1 -1
- package/dist/vue/cart.d.mts +28 -23
- package/dist/vue/cart.mjs +42 -25
- package/dist/vue/cart.mjs.map +1 -1
- package/dist/vue/collection.d.mts +20 -12
- package/dist/vue/collection.mjs +15 -7
- package/dist/vue/collection.mjs.map +1 -1
- package/dist/vue/index.d.mts +2 -2
- package/dist/vue/index.mjs +2 -2
- package/dist/vue/predictive-search.d.mts +31 -36
- package/dist/vue/predictive-search.mjs +16 -22
- package/dist/vue/predictive-search.mjs.map +1 -1
- package/dist/vue/product.d.mts +16 -15
- package/dist/vue/product.mjs +11 -11
- package/dist/vue/product.mjs.map +1 -1
- package/dist/vue/shop-pay.d.mts +14 -17
- package/dist/vue/shop-pay.mjs +8 -0
- package/dist/vue/shop-pay.mjs.map +1 -1
- package/dist/vue/shopify-scripts.d.mts +11 -0
- package/dist/vue/shopify-scripts.mjs +6 -0
- package/dist/vue/shopify-scripts.mjs.map +1 -1
- package/package.json +3 -1
- package/skills/hydrogen-analytics/SKILL.md +1 -1
- package/skills/hydrogen-cart-ui/SKILL.md +28 -2
- package/skills/hydrogen-collection-browser/SKILL.md +9 -1
- package/skills/hydrogen-collection-browser/references/nextjs.md +1 -1
- package/skills/hydrogen-collection-browser/references/nuxt.md +1 -1
- package/skills/hydrogen-collection-browser/references/react.md +151 -32
- package/skills/hydrogen-customer-account/SKILL.md +2 -0
- package/skills/hydrogen-request-handlers/SKILL.md +21 -11
- package/skills/hydrogen-setup/references/analytics.md +14 -8
- package/skills/hydrogen-setup/steps/1-inspect-app.md +2 -2
- package/skills/hydrogen-setup/steps/6-product-detail-page.md +21 -11
- package/skills/hydrogen-storefront-client/SKILL.md +1 -1
- package/skills/hydrogen-storefront-client/references/caching.md +2 -0
- package/skills/hydrogen-variant-form/SKILL.md +25 -7
- package/skills/hydrogen-variant-form/references/nextjs.md +39 -4
- package/skills/hydrogen-variant-form/references/nuxt.md +83 -42
- package/skills/hydrogen-variant-form/references/react.md +45 -9
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import { CartData, CartState } from "./state.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/core/cart/cart.d.ts
|
|
4
|
-
/**
|
|
4
|
+
/** The timeout in milliseconds for cart loads and mutations. */
|
|
5
5
|
declare const STANDARD_ACTION_TIMEOUT_IN_MS = 30000;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* The error that a cart load or cart change throws when your cart endpoint responds with a non-2xx status. Read `status` to handle specific failures.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* Without a cart endpoint from `configureCartEndpoint`, cart requests fail with other error types.
|
|
10
|
+
*
|
|
11
|
+
* @publicDocs
|
|
11
12
|
*/
|
|
12
13
|
declare class CartNetworkError extends Error {
|
|
14
|
+
/** The HTTP status code that the cart endpoint returned. */
|
|
13
15
|
readonly status: number;
|
|
16
|
+
/** Always `CartNetworkError`. */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Always `"Something went wrong updating your cart. Please try again."`, including for a failed cart load. */
|
|
19
|
+
message: string;
|
|
20
|
+
/** The stack trace, when the JavaScript runtime records one. */
|
|
21
|
+
stack?: string;
|
|
14
22
|
constructor(status: number);
|
|
15
23
|
}
|
|
16
24
|
/**
|
|
17
|
-
*
|
|
25
|
+
* Holds the customer's cart and runs cart changes in any framework. In React, `CartProvider` creates the store for you.
|
|
18
26
|
*
|
|
19
|
-
* The store
|
|
20
|
-
* *intent*. Cart-level costs and totals are always server-authoritative, but
|
|
21
|
-
* line-level data (quantity, estimated cost) and discount applicability are
|
|
22
|
-
* projected optimistically until the server response arrives.
|
|
27
|
+
* The store shows line and discount code changes before the server responds, then updates the cart from each server response. Cart costs change only when the server responds.
|
|
23
28
|
*
|
|
24
|
-
*
|
|
25
|
-
* forms) or through Shopify Standard Action `shopify:cart:*` events.
|
|
29
|
+
* Cart changes start from cart form submissions or from Standard Actions `shopify:cart:*` events. Cart changes need the Standard Actions script, which `ShopifyScripts` adds to the page. Cart loads and changes time out after 30 seconds.
|
|
26
30
|
*
|
|
27
31
|
* @example
|
|
28
32
|
* ```ts
|
|
@@ -41,67 +45,71 @@ declare class CartNetworkError extends Error {
|
|
|
41
45
|
*/
|
|
42
46
|
type CartStore = {
|
|
43
47
|
/**
|
|
44
|
-
*
|
|
45
|
-
* and triggers the initial cart load if no `initialData` was provided.
|
|
46
|
-
* Idempotent; no-op without `document` (SSR-safe).
|
|
48
|
+
* Starts handling cart events, and loads the cart when you created the store without initial data. Repeated calls have no effect. During server rendering, the method does nothing.
|
|
47
49
|
*/
|
|
48
|
-
connect(): void; /**
|
|
49
|
-
destroy(): void; /** Replaces the
|
|
50
|
-
hydrate(data: CartData): void; /** Returns the current
|
|
50
|
+
connect(): void; /** Stops the store. Cancels in-flight cart requests and stops handling cart events. */
|
|
51
|
+
destroy(): void; /** Replaces the store's cart with a different cart that the server loaded. The method ignores data for the cart that the store already holds, and ignores data while cart changes are in flight. */
|
|
52
|
+
hydrate(data: CartData): void; /** Returns the current cart state, including changes that the server hasn't confirmed yet. */
|
|
51
53
|
getState(): CartState;
|
|
52
54
|
/**
|
|
53
|
-
*
|
|
54
|
-
* Compatible with React's `useSyncExternalStore`.
|
|
55
|
+
* Calls the listener on every state change and returns a function that removes the listener. The method works with React's `useSyncExternalStore`.
|
|
55
56
|
*
|
|
56
|
-
* @param listener -
|
|
57
|
+
* @param listener - The function that receives each new state.
|
|
58
|
+
*/
|
|
59
|
+
subscribe(listener: (state: CartState) => void): () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Loads the full cart from the server.
|
|
62
|
+
*
|
|
63
|
+
* The promise rejects when the load fails, with a `CartNetworkError` when your cart endpoint returns a non-2xx status.
|
|
57
64
|
*/
|
|
58
|
-
subscribe(listener: (state: CartState) => void): () => void; /** Triggers a full cart load from the server endpoint. */
|
|
59
65
|
fetch(): Promise<void>;
|
|
60
66
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
67
|
+
* Reloads the cart after a cart change that skipped the store, such as a server action. When the store has no cart yet, the method picks up the cart that the server created.
|
|
68
|
+
*
|
|
69
|
+
* A failed reload adds an entry to the network errors in the cart state.
|
|
63
70
|
*/
|
|
64
|
-
refresh(): void; /**
|
|
71
|
+
refresh(): void; /** Clears the cart data and errors and cancels in-flight cart requests. After you connect the store, the method also loads the cart again when the store held a cart. */
|
|
65
72
|
reset(): void;
|
|
66
73
|
/**
|
|
67
|
-
*
|
|
68
|
-
* field values, and dispatches the matching transaction.
|
|
74
|
+
* Runs the cart change that a cart form submission describes. Pass the form's submit event, and call `event.preventDefault()` to stop the browser's own form submission. The method connects the store when you haven't connected it.
|
|
69
75
|
*
|
|
70
|
-
* The
|
|
71
|
-
* `
|
|
72
|
-
* `
|
|
73
|
-
*
|
|
76
|
+
* The submit button's value sets the change: `add`, `increase`,
|
|
77
|
+
* `decrease`, `remove`, `set`, `discount-apply`, `discount-remove`,
|
|
78
|
+
* `note-update`, or `attributes-update`. A button without a value adds
|
|
79
|
+
* the line when the form has a `merchandiseId` field. A `set` with an empty or
|
|
80
|
+
* zero quantity removes the line. When your cart fragment selects the variant's
|
|
81
|
+
* available quantity, the store caps a `set` quantity at that number.
|
|
74
82
|
*
|
|
75
|
-
* The
|
|
76
|
-
*
|
|
77
|
-
*
|
|
83
|
+
* The promise rejects with a type error when the event target isn't a form or
|
|
84
|
+
* the event has no submitter. The promise rejects with an error when the button's
|
|
85
|
+
* value isn't a recognized change, or when the form lacks a required field
|
|
86
|
+
* such as the line ID.
|
|
78
87
|
*/
|
|
79
88
|
handleFormSubmit(event: SubmitEvent, eventDetail?: Record<string, unknown>): Promise<void>;
|
|
80
89
|
};
|
|
81
|
-
/**
|
|
90
|
+
/** The store action that reloads the cart after a cart change outside the store. */
|
|
82
91
|
type CartActions = Pick<CartStore, "refresh">;
|
|
92
|
+
/** The cart that the server loaded for the first render. */
|
|
83
93
|
type CartInitialData<TData extends CartData = CartData> = {
|
|
84
|
-
cart: TData | null;
|
|
94
|
+
/** The loaded cart, or `null` when the server found no cart. */cart: TData | null; /** Load errors from the server. The store ignores the errors. */
|
|
85
95
|
errors?: Array<{
|
|
86
96
|
message: string;
|
|
87
97
|
}>;
|
|
88
98
|
};
|
|
89
|
-
/** Options for
|
|
99
|
+
/** Options for creating a cart store. */
|
|
90
100
|
type CreateCartStoreOptions<TData extends CartData = CartData> = {
|
|
91
101
|
/**
|
|
92
|
-
*
|
|
102
|
+
* The cart that the server loaded, or a promise of the cart for streamed data.
|
|
93
103
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
104
|
+
* Pass the `data` property of the cart GET handler's result. A `null` cart
|
|
105
|
+
* tells the store that no cart exists yet. Without initial data, the store starts empty and loads the cart when you call `connect()`.
|
|
96
106
|
*/
|
|
97
107
|
initialData?: CartInitialData<TData> | PromiseLike<CartInitialData<TData>>;
|
|
98
108
|
};
|
|
99
109
|
/**
|
|
100
|
-
* Creates a
|
|
110
|
+
* Creates a cart store that holds the cart and applies cart changes before the server responds.
|
|
101
111
|
*
|
|
102
|
-
*
|
|
103
|
-
* requests are made and no event listeners are attached at creation time.
|
|
104
|
-
* Framework adapters call `connect()` on mount and `destroy()` on unmount.
|
|
112
|
+
* Call `connect()` to start the store and `destroy()` to stop it. The React and Vue cart providers call both for you.
|
|
105
113
|
*
|
|
106
114
|
* @example
|
|
107
115
|
* ```ts
|
|
@@ -118,18 +126,23 @@ type CreateCartStoreOptions<TData extends CartData = CartData> = {
|
|
|
118
126
|
* // Empty — loads the cart on connect()
|
|
119
127
|
* const store = createCartStore();
|
|
120
128
|
* ```
|
|
129
|
+
* @param options The cart that the server loaded for the first render.
|
|
130
|
+
* @returns The cart store. Read the cart with `getState()` and listen for changes with `subscribe()`.
|
|
131
|
+
* @publicDocs
|
|
121
132
|
*/
|
|
122
133
|
declare function createCartStore<TData extends CartData = CartData>(options?: CreateCartStoreOptions<TData>): CartStore;
|
|
123
134
|
/**
|
|
124
|
-
*
|
|
125
|
-
* Standard Actions default handler.
|
|
135
|
+
* Sends every cart load and cart change on the page to your cart endpoint. Without an endpoint, Standard Actions handles cart requests with its default handler.
|
|
126
136
|
*
|
|
127
|
-
*
|
|
137
|
+
* Call the function before you connect a cart store. The first cart load then goes to your endpoint. A later call with a different endpoint replaces the first endpoint and logs a warning. In React, `CartProvider` sets the endpoint to `/api/cart` when the provider mounts.
|
|
128
138
|
*
|
|
139
|
+
* @param endpoint The URL path of your cart route.
|
|
140
|
+
* @returns Nothing. Later cart loads and changes on the page go to the endpoint.
|
|
129
141
|
* @example
|
|
130
142
|
* ```ts
|
|
131
143
|
* configureCartEndpoint("/storefront/cart");
|
|
132
144
|
* ```
|
|
145
|
+
* @publicDocs
|
|
133
146
|
*/
|
|
134
147
|
declare function configureCartEndpoint(endpoint: string): void;
|
|
135
148
|
//#endregion
|
|
@@ -23,15 +23,17 @@ const EMPTY_QUANTITY = 0;
|
|
|
23
23
|
const FNV1A_OFFSET_BASIS = 2166136261;
|
|
24
24
|
const FNV1A_PRIME = 16777619;
|
|
25
25
|
const CART_REVALIDATION_ERROR_MESSAGE = "Something went wrong refreshing your cart. Please try again.";
|
|
26
|
-
/**
|
|
26
|
+
/** The timeout in milliseconds for cart loads and mutations. */
|
|
27
27
|
const STANDARD_ACTION_TIMEOUT_IN_MS = 3e4;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* The error that a cart load or cart change throws when your cart endpoint responds with a non-2xx status. Read `status` to handle specific failures.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Without a cart endpoint from `configureCartEndpoint`, cart requests fail with other error types.
|
|
32
|
+
*
|
|
33
|
+
* @publicDocs
|
|
33
34
|
*/
|
|
34
35
|
var CartNetworkError = class extends Error {
|
|
36
|
+
/** The HTTP status code that the cart endpoint returned. */
|
|
35
37
|
status;
|
|
36
38
|
constructor(status) {
|
|
37
39
|
super("Something went wrong updating your cart. Please try again.");
|
|
@@ -554,10 +556,11 @@ function getAddErrorKeys(payload, lineIds, failure) {
|
|
|
554
556
|
}
|
|
555
557
|
function mergeServerLine(previous, next) {
|
|
556
558
|
if (!previous) return next;
|
|
557
|
-
const
|
|
559
|
+
const swapped = previous.merchandise?.id !== void 0 && next.merchandise?.id !== void 0 && previous.merchandise.id !== next.merchandise.id;
|
|
560
|
+
const merchandise = next.merchandise && !swapped ? {
|
|
558
561
|
...previous.merchandise,
|
|
559
562
|
...next.merchandise
|
|
560
|
-
} : previous.merchandise;
|
|
563
|
+
} : next.merchandise ?? previous.merchandise;
|
|
561
564
|
return {
|
|
562
565
|
...previous,
|
|
563
566
|
...next,
|
|
@@ -677,17 +680,21 @@ const CART_TRANSACTION_TYPES = defineTransactionTypes({
|
|
|
677
680
|
data: reconcileCartLines(state.data, lines)
|
|
678
681
|
};
|
|
679
682
|
},
|
|
680
|
-
projectPromise: (state, result, payload, addError) => {
|
|
683
|
+
projectPromise: (state, result, payload, addError, options) => {
|
|
681
684
|
if (hasProjectedErrors(result)) addError((current, timestampMs) => projectLineErrors(current, result, [payload.lineId], timestampMs));
|
|
682
685
|
if (!result.cart) return state;
|
|
683
|
-
const
|
|
684
|
-
const matching =
|
|
686
|
+
const cart = cartResponseFromStandardEvent(result.cart);
|
|
687
|
+
const matching = getLines(cart).find((line) => line.id === payload.lineId);
|
|
688
|
+
if (!matching && payload.quantity > 0 && options.mergeServerCart) return {
|
|
689
|
+
...state,
|
|
690
|
+
data: adoptServerLines(state.data, cart)
|
|
691
|
+
};
|
|
685
692
|
const previous = getLines(state.data);
|
|
686
|
-
let lines = previous
|
|
693
|
+
let lines = previous;
|
|
687
694
|
if (matching) {
|
|
688
695
|
const prior = previous.find((line) => line.id === payload.lineId);
|
|
689
696
|
lines = previous.map((line) => line.id === payload.lineId ? mergeServerLine(prior, matching) : line);
|
|
690
|
-
} else if (payload.quantity
|
|
697
|
+
} else if (payload.quantity === 0) lines = previous.filter((line) => line.id !== payload.lineId);
|
|
691
698
|
return {
|
|
692
699
|
...state,
|
|
693
700
|
data: reconcileCartLines(state.data, lines)
|
|
@@ -718,14 +725,11 @@ const CART_TRANSACTION_TYPES = defineTransactionTypes({
|
|
|
718
725
|
if (hasProjectedErrors(result)) addError((current, timestampMs) => projectDiscountErrors(current, result, payload.discountCodes, timestampMs, resolvedCodes));
|
|
719
726
|
if (!result.cart) return state;
|
|
720
727
|
const cart = cartResponseFromStandardEvent(result.cart);
|
|
721
|
-
|
|
722
|
-
...state,
|
|
723
|
-
data: mergeAuthoritativeCartData(state.data, cart)
|
|
724
|
-
};
|
|
728
|
+
const data = options.mergeServerCart ? adoptServerLines(state.data, cart) : state.data;
|
|
725
729
|
return {
|
|
726
730
|
...state,
|
|
727
731
|
data: {
|
|
728
|
-
...
|
|
732
|
+
...data,
|
|
729
733
|
discountCodes: cart.discountCodes
|
|
730
734
|
}
|
|
731
735
|
};
|
|
@@ -872,16 +876,14 @@ function trimPendingTransaction(store, type, definition, payload, promise, ident
|
|
|
872
876
|
}
|
|
873
877
|
function addSnapshotFields(state, result) {
|
|
874
878
|
if (!result.cart) return state;
|
|
875
|
-
const
|
|
879
|
+
const { lines: _lines, checkoutUrl, updatedAt, ...fields } = cartResponseFromStandardEvent(result.cart);
|
|
876
880
|
return {
|
|
877
881
|
...state,
|
|
878
882
|
data: {
|
|
879
883
|
...state.data,
|
|
880
|
-
|
|
881
|
-
checkoutUrl:
|
|
882
|
-
updatedAt:
|
|
883
|
-
totalQuantity: cart.totalQuantity,
|
|
884
|
-
cost: cart.cost
|
|
884
|
+
...fields,
|
|
885
|
+
checkoutUrl: checkoutUrl ?? state.data.checkoutUrl,
|
|
886
|
+
updatedAt: updatedAt ?? state.data.updatedAt
|
|
885
887
|
}
|
|
886
888
|
};
|
|
887
889
|
}
|
|
@@ -1377,11 +1379,9 @@ function loadCartInStore(store, cartPromise) {
|
|
|
1377
1379
|
return promise;
|
|
1378
1380
|
}
|
|
1379
1381
|
/**
|
|
1380
|
-
* Creates a
|
|
1382
|
+
* Creates a cart store that holds the cart and applies cart changes before the server responds.
|
|
1381
1383
|
*
|
|
1382
|
-
*
|
|
1383
|
-
* requests are made and no event listeners are attached at creation time.
|
|
1384
|
-
* Framework adapters call `connect()` on mount and `destroy()` on unmount.
|
|
1384
|
+
* Call `connect()` to start the store and `destroy()` to stop it. The React and Vue cart providers call both for you.
|
|
1385
1385
|
*
|
|
1386
1386
|
* @example
|
|
1387
1387
|
* ```ts
|
|
@@ -1398,6 +1398,9 @@ function loadCartInStore(store, cartPromise) {
|
|
|
1398
1398
|
* // Empty — loads the cart on connect()
|
|
1399
1399
|
* const store = createCartStore();
|
|
1400
1400
|
* ```
|
|
1401
|
+
* @param options The cart that the server loaded for the first render.
|
|
1402
|
+
* @returns The cart store. Read the cart with `getState()` and listen for changes with `subscribe()`.
|
|
1403
|
+
* @publicDocs
|
|
1401
1404
|
*/
|
|
1402
1405
|
function createCartStore(options = {}) {
|
|
1403
1406
|
const initialData = options.initialData;
|
|
@@ -1552,15 +1555,17 @@ async function handleFormSubmitInStore(store, handlers, event, eventDetail) {
|
|
|
1552
1555
|
throw new Error(`Unknown cart form intent: "${intent}"`);
|
|
1553
1556
|
}
|
|
1554
1557
|
/**
|
|
1555
|
-
*
|
|
1556
|
-
* Standard Actions default handler.
|
|
1558
|
+
* Sends every cart load and cart change on the page to your cart endpoint. Without an endpoint, Standard Actions handles cart requests with its default handler.
|
|
1557
1559
|
*
|
|
1558
|
-
*
|
|
1560
|
+
* Call the function before you connect a cart store. The first cart load then goes to your endpoint. A later call with a different endpoint replaces the first endpoint and logs a warning. In React, `CartProvider` sets the endpoint to `/api/cart` when the provider mounts.
|
|
1559
1561
|
*
|
|
1562
|
+
* @param endpoint The URL path of your cart route.
|
|
1563
|
+
* @returns Nothing. Later cart loads and changes on the page go to the endpoint.
|
|
1560
1564
|
* @example
|
|
1561
1565
|
* ```ts
|
|
1562
1566
|
* configureCartEndpoint("/storefront/cart");
|
|
1563
1567
|
* ```
|
|
1568
|
+
* @publicDocs
|
|
1564
1569
|
*/
|
|
1565
1570
|
function configureCartEndpoint(endpoint) {
|
|
1566
1571
|
if (configuredCartEndpoint === endpoint) return;
|
|
@@ -1642,6 +1647,18 @@ function fetchCartData(cartId, signal) {
|
|
|
1642
1647
|
attributes: cart.attributes ?? []
|
|
1643
1648
|
} : null);
|
|
1644
1649
|
}
|
|
1650
|
+
function adoptServerLines(previous, authoritative) {
|
|
1651
|
+
const previousLines = new Map(getLines(previous).map((line) => [line.id, line]));
|
|
1652
|
+
const nodes = getLines(authoritative).map((line) => mergeServerLine(previousLines.get(line.id), line));
|
|
1653
|
+
return {
|
|
1654
|
+
...previous,
|
|
1655
|
+
lines: {
|
|
1656
|
+
...previous.lines,
|
|
1657
|
+
...authoritative.lines,
|
|
1658
|
+
nodes
|
|
1659
|
+
}
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1645
1662
|
function mergeAuthoritativeCartData(previous, authoritative) {
|
|
1646
1663
|
const previousLines = new Map(getLines(previous).map((line) => [line.id, line]));
|
|
1647
1664
|
const lines = getLines(authoritative).map((line) => mergeServerLine(previousLines.get(line.id), line));
|