@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,4 +1,114 @@
|
|
|
1
1
|
//#region src/graphql/generated/storefront-api-types.d.ts
|
|
2
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
3
|
+
type Scalars = {
|
|
4
|
+
ID: {
|
|
5
|
+
input: string;
|
|
6
|
+
output: string;
|
|
7
|
+
};
|
|
8
|
+
String: {
|
|
9
|
+
input: string;
|
|
10
|
+
output: string;
|
|
11
|
+
};
|
|
12
|
+
Boolean: {
|
|
13
|
+
input: boolean;
|
|
14
|
+
output: boolean;
|
|
15
|
+
};
|
|
16
|
+
Int: {
|
|
17
|
+
input: number;
|
|
18
|
+
output: number;
|
|
19
|
+
};
|
|
20
|
+
Float: {
|
|
21
|
+
input: number;
|
|
22
|
+
output: number;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A string containing a hexadecimal representation of a color.
|
|
26
|
+
*
|
|
27
|
+
* For example, "#6A8D48".
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
Color: {
|
|
31
|
+
input: string;
|
|
32
|
+
output: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Represents an [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)-encoded date and time string.
|
|
36
|
+
* For example, 3:50 pm on September 7, 2019 in the time zone of UTC (Coordinated Universal Time) is
|
|
37
|
+
* represented as `"2019-09-07T15:50:00Z`".
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
DateTime: {
|
|
41
|
+
input: string;
|
|
42
|
+
output: string;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* A signed decimal number, which supports arbitrary precision and is serialized as a string.
|
|
46
|
+
*
|
|
47
|
+
* Example values: `"29.99"`, `"29.999"`.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
Decimal: {
|
|
51
|
+
input: string;
|
|
52
|
+
output: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* A string containing HTML code. Refer to the [HTML spec](https://html.spec.whatwg.org/#elements-3) for a
|
|
56
|
+
* complete list of HTML elements.
|
|
57
|
+
*
|
|
58
|
+
* Example value: `"<p>Grey cotton knit sweater.</p>"`
|
|
59
|
+
*
|
|
60
|
+
*/
|
|
61
|
+
HTML: {
|
|
62
|
+
input: string;
|
|
63
|
+
output: string;
|
|
64
|
+
}; /** An ISO 8601-encoded datetime */
|
|
65
|
+
ISO8601DateTime: {
|
|
66
|
+
input: string;
|
|
67
|
+
output: string;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A [JSON](https://www.json.org/json-en.html) object.
|
|
71
|
+
*
|
|
72
|
+
* Example value:
|
|
73
|
+
* `{
|
|
74
|
+
* "product": {
|
|
75
|
+
* "id": "gid://shopify/Product/1346443542550",
|
|
76
|
+
* "title": "White T-shirt",
|
|
77
|
+
* "options": [{
|
|
78
|
+
* "name": "Size",
|
|
79
|
+
* "values": ["M", "L"]
|
|
80
|
+
* }]
|
|
81
|
+
* }
|
|
82
|
+
* }`
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
JSON: {
|
|
86
|
+
input: string;
|
|
87
|
+
output: string;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Represents an [RFC 3986](https://datatracker.ietf.org/doc/html/rfc3986) and
|
|
91
|
+
* [RFC 3987](https://datatracker.ietf.org/doc/html/rfc3987)-compliant URI string.
|
|
92
|
+
*
|
|
93
|
+
* For example, `"https://example.myshopify.com"` is a valid URL. It includes a scheme (`https`) and a host
|
|
94
|
+
* (`example.myshopify.com`).
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
URL: {
|
|
98
|
+
input: string;
|
|
99
|
+
output: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* An unsigned 64-bit integer. Represents whole numeric values between 0 and 2^64 - 1 encoded as a string of base-10 digits.
|
|
103
|
+
*
|
|
104
|
+
* Example value: `"50"`.
|
|
105
|
+
*
|
|
106
|
+
*/
|
|
107
|
+
UnsignedInt64: {
|
|
108
|
+
input: string;
|
|
109
|
+
output: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
2
112
|
/**
|
|
3
113
|
* Error codes returned by [`CartUserError`](https://shopify.dev/docs/api/storefront/current/objects/CartUserError) during cart mutations. Covers validation failures for addresses, quantities, delivery options, merchandise lines, discount codes, and metafields.
|
|
4
114
|
*
|
|
@@ -14,6 +124,13 @@ type CartWarningCode = /** The discount code cannot be honored. */"DISCOUNT_CODE
|
|
|
14
124
|
*
|
|
15
125
|
*/
|
|
16
126
|
type CountryCode = /** Ascension Island. */"AC" /** Andorra. */ | "AD" /** United Arab Emirates. */ | "AE" /** Afghanistan. */ | "AF" /** Antigua & Barbuda. */ | "AG" /** Anguilla. */ | "AI" /** Albania. */ | "AL" /** Armenia. */ | "AM" /** Netherlands Antilles. */ | "AN" /** Angola. */ | "AO" /** Argentina. */ | "AR" /** Austria. */ | "AT" /** Australia. */ | "AU" /** Aruba. */ | "AW" /** Åland Islands. */ | "AX" /** Azerbaijan. */ | "AZ" /** Bosnia & Herzegovina. */ | "BA" /** Barbados. */ | "BB" /** Bangladesh. */ | "BD" /** Belgium. */ | "BE" /** Burkina Faso. */ | "BF" /** Bulgaria. */ | "BG" /** Bahrain. */ | "BH" /** Burundi. */ | "BI" /** Benin. */ | "BJ" /** St. Barthélemy. */ | "BL" /** Bermuda. */ | "BM" /** Brunei. */ | "BN" /** Bolivia. */ | "BO" /** Caribbean Netherlands. */ | "BQ" /** Brazil. */ | "BR" /** Bahamas. */ | "BS" /** Bhutan. */ | "BT" /** Bouvet Island. */ | "BV" /** Botswana. */ | "BW" /** Belarus. */ | "BY" /** Belize. */ | "BZ" /** Canada. */ | "CA" /** Cocos (Keeling) Islands. */ | "CC" /** Congo - Kinshasa. */ | "CD" /** Central African Republic. */ | "CF" /** Congo - Brazzaville. */ | "CG" /** Switzerland. */ | "CH" /** Côte d’Ivoire. */ | "CI" /** Cook Islands. */ | "CK" /** Chile. */ | "CL" /** Cameroon. */ | "CM" /** China. */ | "CN" /** Colombia. */ | "CO" /** Costa Rica. */ | "CR" /** Cuba. */ | "CU" /** Cape Verde. */ | "CV" /** Curaçao. */ | "CW" /** Christmas Island. */ | "CX" /** Cyprus. */ | "CY" /** Czechia. */ | "CZ" /** Germany. */ | "DE" /** Djibouti. */ | "DJ" /** Denmark. */ | "DK" /** Dominica. */ | "DM" /** Dominican Republic. */ | "DO" /** Algeria. */ | "DZ" /** Ecuador. */ | "EC" /** Estonia. */ | "EE" /** Egypt. */ | "EG" /** Western Sahara. */ | "EH" /** Eritrea. */ | "ER" /** Spain. */ | "ES" /** Ethiopia. */ | "ET" /** Finland. */ | "FI" /** Fiji. */ | "FJ" /** Falkland Islands. */ | "FK" /** Faroe Islands. */ | "FO" /** France. */ | "FR" /** Gabon. */ | "GA" /** United Kingdom. */ | "GB" /** Grenada. */ | "GD" /** Georgia. */ | "GE" /** French Guiana. */ | "GF" /** Guernsey. */ | "GG" /** Ghana. */ | "GH" /** Gibraltar. */ | "GI" /** Greenland. */ | "GL" /** Gambia. */ | "GM" /** Guinea. */ | "GN" /** Guadeloupe. */ | "GP" /** Equatorial Guinea. */ | "GQ" /** Greece. */ | "GR" /** South Georgia & South Sandwich Islands. */ | "GS" /** Guatemala. */ | "GT" /** Guinea-Bissau. */ | "GW" /** Guyana. */ | "GY" /** Hong Kong SAR. */ | "HK" /** Heard & McDonald Islands. */ | "HM" /** Honduras. */ | "HN" /** Croatia. */ | "HR" /** Haiti. */ | "HT" /** Hungary. */ | "HU" /** Indonesia. */ | "ID" /** Ireland. */ | "IE" /** Israel. */ | "IL" /** Isle of Man. */ | "IM" /** India. */ | "IN" /** British Indian Ocean Territory. */ | "IO" /** Iraq. */ | "IQ" /** Iran. */ | "IR" /** Iceland. */ | "IS" /** Italy. */ | "IT" /** Jersey. */ | "JE" /** Jamaica. */ | "JM" /** Jordan. */ | "JO" /** Japan. */ | "JP" /** Kenya. */ | "KE" /** Kyrgyzstan. */ | "KG" /** Cambodia. */ | "KH" /** Kiribati. */ | "KI" /** Comoros. */ | "KM" /** St. Kitts & Nevis. */ | "KN" /** North Korea. */ | "KP" /** South Korea. */ | "KR" /** Kuwait. */ | "KW" /** Cayman Islands. */ | "KY" /** Kazakhstan. */ | "KZ" /** Laos. */ | "LA" /** Lebanon. */ | "LB" /** St. Lucia. */ | "LC" /** Liechtenstein. */ | "LI" /** Sri Lanka. */ | "LK" /** Liberia. */ | "LR" /** Lesotho. */ | "LS" /** Lithuania. */ | "LT" /** Luxembourg. */ | "LU" /** Latvia. */ | "LV" /** Libya. */ | "LY" /** Morocco. */ | "MA" /** Monaco. */ | "MC" /** Moldova. */ | "MD" /** Montenegro. */ | "ME" /** St. Martin. */ | "MF" /** Madagascar. */ | "MG" /** North Macedonia. */ | "MK" /** Mali. */ | "ML" /** Myanmar (Burma). */ | "MM" /** Mongolia. */ | "MN" /** Macao SAR. */ | "MO" /** Martinique. */ | "MQ" /** Mauritania. */ | "MR" /** Montserrat. */ | "MS" /** Malta. */ | "MT" /** Mauritius. */ | "MU" /** Maldives. */ | "MV" /** Malawi. */ | "MW" /** Mexico. */ | "MX" /** Malaysia. */ | "MY" /** Mozambique. */ | "MZ" /** Namibia. */ | "NA" /** New Caledonia. */ | "NC" /** Niger. */ | "NE" /** Norfolk Island. */ | "NF" /** Nigeria. */ | "NG" /** Nicaragua. */ | "NI" /** Netherlands. */ | "NL" /** Norway. */ | "NO" /** Nepal. */ | "NP" /** Nauru. */ | "NR" /** Niue. */ | "NU" /** New Zealand. */ | "NZ" /** Oman. */ | "OM" /** Panama. */ | "PA" /** Peru. */ | "PE" /** French Polynesia. */ | "PF" /** Papua New Guinea. */ | "PG" /** Philippines. */ | "PH" /** Pakistan. */ | "PK" /** Poland. */ | "PL" /** St. Pierre & Miquelon. */ | "PM" /** Pitcairn Islands. */ | "PN" /** Palestinian Territories. */ | "PS" /** Portugal. */ | "PT" /** Paraguay. */ | "PY" /** Qatar. */ | "QA" /** Réunion. */ | "RE" /** Romania. */ | "RO" /** Serbia. */ | "RS" /** Russia. */ | "RU" /** Rwanda. */ | "RW" /** Saudi Arabia. */ | "SA" /** Solomon Islands. */ | "SB" /** Seychelles. */ | "SC" /** Sudan. */ | "SD" /** Sweden. */ | "SE" /** Singapore. */ | "SG" /** St. Helena. */ | "SH" /** Slovenia. */ | "SI" /** Svalbard & Jan Mayen. */ | "SJ" /** Slovakia. */ | "SK" /** Sierra Leone. */ | "SL" /** San Marino. */ | "SM" /** Senegal. */ | "SN" /** Somalia. */ | "SO" /** Suriname. */ | "SR" /** South Sudan. */ | "SS" /** São Tomé & Príncipe. */ | "ST" /** El Salvador. */ | "SV" /** Sint Maarten. */ | "SX" /** Syria. */ | "SY" /** Eswatini. */ | "SZ" /** Tristan da Cunha. */ | "TA" /** Turks & Caicos Islands. */ | "TC" /** Chad. */ | "TD" /** French Southern Territories. */ | "TF" /** Togo. */ | "TG" /** Thailand. */ | "TH" /** Tajikistan. */ | "TJ" /** Tokelau. */ | "TK" /** Timor-Leste. */ | "TL" /** Turkmenistan. */ | "TM" /** Tunisia. */ | "TN" /** Tonga. */ | "TO" /** Türkiye. */ | "TR" /** Trinidad & Tobago. */ | "TT" /** Tuvalu. */ | "TV" /** Taiwan. */ | "TW" /** Tanzania. */ | "TZ" /** Ukraine. */ | "UA" /** Uganda. */ | "UG" /** U.S. Outlying Islands. */ | "UM" /** United States. */ | "US" /** Uruguay. */ | "UY" /** Uzbekistan. */ | "UZ" /** Vatican City. */ | "VA" /** St. Vincent & Grenadines. */ | "VC" /** Venezuela. */ | "VE" /** British Virgin Islands. */ | "VG" /** Vietnam. */ | "VN" /** Vanuatu. */ | "VU" /** Wallis & Futuna. */ | "WF" /** Samoa. */ | "WS" /** Kosovo. */ | "XK" /** Yemen. */ | "YE" /** Mayotte. */ | "YT" /** South Africa. */ | "ZA" /** Zambia. */ | "ZM" /** Zimbabwe. */ | "ZW" /** Unknown Region. */ | "ZZ";
|
|
127
|
+
/**
|
|
128
|
+
* The three-letter currency codes that represent the world currencies used in
|
|
129
|
+
* stores. These include standard ISO 4217 codes, legacy codes,
|
|
130
|
+
* and non-standard codes.
|
|
131
|
+
*
|
|
132
|
+
*/
|
|
133
|
+
type CurrencyCode = /** United Arab Emirates Dirham (AED). */"AED" /** Afghan Afghani (AFN). */ | "AFN" /** Albanian Lek (ALL). */ | "ALL" /** Armenian Dram (AMD). */ | "AMD" /** Netherlands Antillean Guilder. */ | "ANG" /** Angolan Kwanza (AOA). */ | "AOA" /** Argentine Pesos (ARS). */ | "ARS" /** Australian Dollars (AUD). */ | "AUD" /** Aruban Florin (AWG). */ | "AWG" /** Azerbaijani Manat (AZN). */ | "AZN" /** Bosnia and Herzegovina Convertible Mark (BAM). */ | "BAM" /** Barbadian Dollar (BBD). */ | "BBD" /** Bangladesh Taka (BDT). */ | "BDT" /** Bulgarian Lev (BGN). */ | "BGN" /** Bahraini Dinar (BHD). */ | "BHD" /** Burundian Franc (BIF). */ | "BIF" /** Bermudian Dollar (BMD). */ | "BMD" /** Brunei Dollar (BND). */ | "BND" /** Bolivian Boliviano (BOB). */ | "BOB" /** Brazilian Real (BRL). */ | "BRL" /** Bahamian Dollar (BSD). */ | "BSD" /** Bhutanese Ngultrum (BTN). */ | "BTN" /** Botswana Pula (BWP). */ | "BWP" /** Belarusian Ruble (BYN). */ | "BYN" /** Belarusian Ruble (BYR). */ | "BYR" /** Belize Dollar (BZD). */ | "BZD" /** Canadian Dollars (CAD). */ | "CAD" /** Congolese franc (CDF). */ | "CDF" /** Swiss Francs (CHF). */ | "CHF" /** Chilean Peso (CLP). */ | "CLP" /** Chinese Yuan Renminbi (CNY). */ | "CNY" /** Colombian Peso (COP). */ | "COP" /** Costa Rican Colones (CRC). */ | "CRC" /** Cape Verdean escudo (CVE). */ | "CVE" /** Czech Koruny (CZK). */ | "CZK" /** Djiboutian Franc (DJF). */ | "DJF" /** Danish Kroner (DKK). */ | "DKK" /** Dominican Peso (DOP). */ | "DOP" /** Algerian Dinar (DZD). */ | "DZD" /** Egyptian Pound (EGP). */ | "EGP" /** Eritrean Nakfa (ERN). */ | "ERN" /** Ethiopian Birr (ETB). */ | "ETB" /** Euro (EUR). */ | "EUR" /** Fijian Dollars (FJD). */ | "FJD" /** Falkland Islands Pounds (FKP). */ | "FKP" /** United Kingdom Pounds (GBP). */ | "GBP" /** Georgian Lari (GEL). */ | "GEL" /** Ghanaian Cedi (GHS). */ | "GHS" /** Gibraltar Pounds (GIP). */ | "GIP" /** Gambian Dalasi (GMD). */ | "GMD" /** Guinean Franc (GNF). */ | "GNF" /** Guatemalan Quetzal (GTQ). */ | "GTQ" /** Guyanese Dollar (GYD). */ | "GYD" /** Hong Kong Dollars (HKD). */ | "HKD" /** Honduran Lempira (HNL). */ | "HNL" /** Croatian Kuna (HRK). */ | "HRK" /** Haitian Gourde (HTG). */ | "HTG" /** Hungarian Forint (HUF). */ | "HUF" /** Indonesian Rupiah (IDR). */ | "IDR" /** Israeli New Shekel (NIS). */ | "ILS" /** Indian Rupees (INR). */ | "INR" /** Iraqi Dinar (IQD). */ | "IQD" /** Iranian Rial (IRR). */ | "IRR" /** Icelandic Kronur (ISK). */ | "ISK" /** Jersey Pound. */ | "JEP" /** Jamaican Dollars (JMD). */ | "JMD" /** Jordanian Dinar (JOD). */ | "JOD" /** Japanese Yen (JPY). */ | "JPY" /** Kenyan Shilling (KES). */ | "KES" /** Kyrgyzstani Som (KGS). */ | "KGS" /** Cambodian Riel. */ | "KHR" /** Kiribati Dollar (KID). */ | "KID" /** Comorian Franc (KMF). */ | "KMF" /** South Korean Won (KRW). */ | "KRW" /** Kuwaiti Dinar (KWD). */ | "KWD" /** Cayman Dollars (KYD). */ | "KYD" /** Kazakhstani Tenge (KZT). */ | "KZT" /** Laotian Kip (LAK). */ | "LAK" /** Lebanese Pounds (LBP). */ | "LBP" /** Sri Lankan Rupees (LKR). */ | "LKR" /** Liberian Dollar (LRD). */ | "LRD" /** Lesotho Loti (LSL). */ | "LSL" /** Lithuanian Litai (LTL). */ | "LTL" /** Latvian Lati (LVL). */ | "LVL" /** Libyan Dinar (LYD). */ | "LYD" /** Moroccan Dirham. */ | "MAD" /** Moldovan Leu (MDL). */ | "MDL" /** Malagasy Ariary (MGA). */ | "MGA" /** Macedonia Denar (MKD). */ | "MKD" /** Burmese Kyat (MMK). */ | "MMK" /** Mongolian Tugrik. */ | "MNT" /** Macanese Pataca (MOP). */ | "MOP" /** Mauritanian Ouguiya (MRU). */ | "MRU" /** Mauritian Rupee (MUR). */ | "MUR" /** Maldivian Rufiyaa (MVR). */ | "MVR" /** Malawian Kwacha (MWK). */ | "MWK" /** Mexican Pesos (MXN). */ | "MXN" /** Malaysian Ringgits (MYR). */ | "MYR" /** Mozambican Metical. */ | "MZN" /** Namibian Dollar. */ | "NAD" /** Nigerian Naira (NGN). */ | "NGN" /** Nicaraguan Córdoba (NIO). */ | "NIO" /** Norwegian Kroner (NOK). */ | "NOK" /** Nepalese Rupee (NPR). */ | "NPR" /** New Zealand Dollars (NZD). */ | "NZD" /** Omani Rial (OMR). */ | "OMR" /** Panamian Balboa (PAB). */ | "PAB" /** Peruvian Nuevo Sol (PEN). */ | "PEN" /** Papua New Guinean Kina (PGK). */ | "PGK" /** Philippine Peso (PHP). */ | "PHP" /** Pakistani Rupee (PKR). */ | "PKR" /** Polish Zlotych (PLN). */ | "PLN" /** Paraguayan Guarani (PYG). */ | "PYG" /** Qatari Rial (QAR). */ | "QAR" /** Romanian Lei (RON). */ | "RON" /** Serbian dinar (RSD). */ | "RSD" /** Russian Rubles (RUB). */ | "RUB" /** Rwandan Franc (RWF). */ | "RWF" /** Saudi Riyal (SAR). */ | "SAR" /** Solomon Islands Dollar (SBD). */ | "SBD" /** Seychellois Rupee (SCR). */ | "SCR" /** Sudanese Pound (SDG). */ | "SDG" /** Swedish Kronor (SEK). */ | "SEK" /** Singapore Dollars (SGD). */ | "SGD" /** Saint Helena Pounds (SHP). */ | "SHP" /** Sierra Leonean Leone (SLL). */ | "SLL" /** Somali Shilling (SOS). */ | "SOS" /** Surinamese Dollar (SRD). */ | "SRD" /** South Sudanese Pound (SSP). */ | "SSP" /** Sao Tome And Principe Dobra (STD). */ | "STD" /** Sao Tome And Principe Dobra (STN). */ | "STN" /** Syrian Pound (SYP). */ | "SYP" /** Swazi Lilangeni (SZL). */ | "SZL" /** Thai baht (THB). */ | "THB" /** Tajikistani Somoni (TJS). */ | "TJS" /** Turkmenistani Manat (TMT). */ | "TMT" /** Tunisian Dinar (TND). */ | "TND" /** Tongan Pa'anga (TOP). */ | "TOP" /** Turkish Lira (TRY). */ | "TRY" /** Trinidad and Tobago Dollars (TTD). */ | "TTD" /** Taiwan Dollars (TWD). */ | "TWD" /** Tanzanian Shilling (TZS). */ | "TZS" /** Ukrainian Hryvnia (UAH). */ | "UAH" /** Ugandan Shilling (UGX). */ | "UGX" /** United States Dollars (USD). */ | "USD" /** Uruguayan Pesos (UYU). */ | "UYU" /** Uzbekistan som (UZS). */ | "UZS" /** Venezuelan Bolivares (VED). */ | "VED" /** Venezuelan Bolivares (VEF). */ | "VEF" /** Venezuelan Bolivares Soberanos (VES). */ | "VES" /** Vietnamese đồng (VND). */ | "VND" /** Vanuatu Vatu (VUV). */ | "VUV" /** Samoan Tala (WST). */ | "WST" /** Central African CFA Franc (XAF). */ | "XAF" /** East Caribbean Dollar (XCD). */ | "XCD" /** Caribbean Guilder (XCG). */ | "XCG" /** West African CFA franc (XOF). */ | "XOF" /** CFP Franc (XPF). */ | "XPF" /** Unrecognized currency. */ | "XXX" /** Yemeni Rial (YER). */ | "YER" /** South African Rand (ZAR). */ | "ZAR" /** Zambian Kwacha (ZMW). */ | "ZMW";
|
|
17
134
|
/**
|
|
18
135
|
* Supported languages for retrieving translated storefront content. Pass a language code to the [`@inContext`](https://shopify.dev/docs/storefronts/headless/building-with-the-storefront-api/in-context) directive to return product titles, descriptions, and other translatable fields in that language.
|
|
19
136
|
*
|
|
@@ -21,6 +138,15 @@ type CountryCode = /** Ascension Island. */"AC" /** Andorra. */ | "AD" /** Unite
|
|
|
21
138
|
*
|
|
22
139
|
*/
|
|
23
140
|
type LanguageCode = /** Afrikaans. */"AF" /** Akan. */ | "AK" /** Amharic. */ | "AM" /** Arabic. */ | "AR" /** Assamese. */ | "AS" /** Azerbaijani. */ | "AZ" /** Belarusian. */ | "BE" /** Bulgarian. */ | "BG" /** Bambara. */ | "BM" /** Bangla. */ | "BN" /** Tibetan. */ | "BO" /** Breton. */ | "BR" /** Bosnian. */ | "BS" /** Catalan. */ | "CA" /** Chechen. */ | "CE" /** Central Kurdish. */ | "CKB" /** Czech. */ | "CS" /** Church Slavic. */ | "CU" /** Welsh. */ | "CY" /** Danish. */ | "DA" /** German. */ | "DE" /** Dzongkha. */ | "DZ" /** Ewe. */ | "EE" /** Greek. */ | "EL" /** English. */ | "EN" /** Esperanto. */ | "EO" /** Spanish. */ | "ES" /** Estonian. */ | "ET" /** Basque. */ | "EU" /** Persian. */ | "FA" /** Fulah. */ | "FF" /** Finnish. */ | "FI" /** Filipino. */ | "FIL" /** Faroese. */ | "FO" /** French. */ | "FR" /** Western Frisian. */ | "FY" /** Irish. */ | "GA" /** Scottish Gaelic. */ | "GD" /** Galician. */ | "GL" /** Gujarati. */ | "GU" /** Manx. */ | "GV" /** Hausa. */ | "HA" /** Hebrew. */ | "HE" /** Hindi. */ | "HI" /** Croatian. */ | "HR" /** Hungarian. */ | "HU" /** Armenian. */ | "HY" /** Interlingua. */ | "IA" /** Indonesian. */ | "ID" /** Igbo. */ | "IG" /** Sichuan Yi. */ | "II" /** Icelandic. */ | "IS" /** Italian. */ | "IT" /** Japanese. */ | "JA" /** Javanese. */ | "JV" /** Georgian. */ | "KA" /** Kikuyu. */ | "KI" /** Kazakh. */ | "KK" /** Kalaallisut. */ | "KL" /** Khmer. */ | "KM" /** Kannada. */ | "KN" /** Korean. */ | "KO" /** Kashmiri. */ | "KS" /** Kurdish. */ | "KU" /** Cornish. */ | "KW" /** Kyrgyz. */ | "KY" /** Latin. */ | "LA" /** Luxembourgish. */ | "LB" /** Ganda. */ | "LG" /** Lingala. */ | "LN" /** Lao. */ | "LO" /** Lithuanian. */ | "LT" /** Luba-Katanga. */ | "LU" /** Latvian. */ | "LV" /** Malagasy. */ | "MG" /** Māori. */ | "MI" /** Macedonian. */ | "MK" /** Malayalam. */ | "ML" /** Mongolian. */ | "MN" /** Moldavian. */ | "MO" /** Marathi. */ | "MR" /** Malay. */ | "MS" /** Maltese. */ | "MT" /** Burmese. */ | "MY" /** Norwegian (Bokmål). */ | "NB" /** North Ndebele. */ | "ND" /** Nepali. */ | "NE" /** Dutch. */ | "NL" /** Norwegian Nynorsk. */ | "NN" /** Norwegian. */ | "NO" /** Oromo. */ | "OM" /** Odia. */ | "OR" /** Ossetic. */ | "OS" /** Punjabi. */ | "PA" /** Polish. */ | "PL" /** Pashto. */ | "PS" /** Portuguese. */ | "PT" /** Portuguese (Brazil). */ | "PT_BR" /** Portuguese (Portugal). */ | "PT_PT" /** Quechua. */ | "QU" /** Romansh. */ | "RM" /** Rundi. */ | "RN" /** Romanian. */ | "RO" /** Russian. */ | "RU" /** Kinyarwanda. */ | "RW" /** Sanskrit. */ | "SA" /** Sardinian. */ | "SC" /** Sindhi. */ | "SD" /** Northern Sami. */ | "SE" /** Sango. */ | "SG" /** Serbo-Croatian. */ | "SH" /** Sinhala. */ | "SI" /** Slovak. */ | "SK" /** Slovenian. */ | "SL" /** Shona. */ | "SN" /** Somali. */ | "SO" /** Albanian. */ | "SQ" /** Serbian. */ | "SR" /** Sundanese. */ | "SU" /** Swedish. */ | "SV" /** Swahili. */ | "SW" /** Tamil. */ | "TA" /** Telugu. */ | "TE" /** Tajik. */ | "TG" /** Thai. */ | "TH" /** Tigrinya. */ | "TI" /** Turkmen. */ | "TK" /** Tongan. */ | "TO" /** Turkish. */ | "TR" /** Tatar. */ | "TT" /** Uyghur. */ | "UG" /** Ukrainian. */ | "UK" /** Urdu. */ | "UR" /** Uzbek. */ | "UZ" /** Vietnamese. */ | "VI" /** Volapük. */ | "VO" /** Wolof. */ | "WO" /** Xhosa. */ | "XH" /** Yiddish. */ | "YI" /** Yoruba. */ | "YO" /** Chinese. */ | "ZH" /** Chinese (Simplified). */ | "ZH_CN" /** Chinese (Traditional). */ | "ZH_TW" /** Zulu. */ | "ZU";
|
|
141
|
+
/**
|
|
142
|
+
* A precise monetary value with its associated currency. Combines a decimal amount with a three-letter [`CurrencyCode`](https://shopify.dev/docs/api/storefront/current/enums/CurrencyCode) to express prices, costs, and other financial values. For example, 12.99 USD.
|
|
143
|
+
*
|
|
144
|
+
*/
|
|
145
|
+
type MoneyV2 = {
|
|
146
|
+
__typename?: "MoneyV2"; /** Decimal money amount. */
|
|
147
|
+
amount: Scalars["Decimal"]["output"]; /** Currency of the money. */
|
|
148
|
+
currencyCode: CurrencyCode;
|
|
149
|
+
};
|
|
24
150
|
/** Decides the distribution of results. */
|
|
25
151
|
type PredictiveSearchLimitScope = /** Return results up to limit across all types. */"ALL" /** Return results up to limit per type. */ | "EACH";
|
|
26
152
|
/** The types of search items to perform predictive search on. */
|
|
@@ -43,5 +169,5 @@ type SearchUnavailableProductsType = /** Exclude unavailable products. */"HIDE"
|
|
|
43
169
|
/** Specifies the list of resource fields to search. */
|
|
44
170
|
type SearchableField = /** Author of the page or article. */"AUTHOR" /** Body of the page or article or product description or collection description. */ | "BODY" /** Product type. */ | "PRODUCT_TYPE" /** Tag associated with the product or article. */ | "TAG" /** Title of the page or article or product title or collection title. */ | "TITLE" /** Variant barcode. */ | "VARIANTS_BARCODE" /** Variant SKU. */ | "VARIANTS_SKU" /** Variant title. */ | "VARIANTS_TITLE" /** Product vendor. */ | "VENDOR";
|
|
45
171
|
//#endregion
|
|
46
|
-
export { CartErrorCode, CartWarningCode, CountryCode, LanguageCode, PredictiveSearchLimitScope, PredictiveSearchType, ProductCollectionSortKeys, SearchUnavailableProductsType, SearchableField };
|
|
172
|
+
export { CartErrorCode, CartWarningCode, CountryCode, LanguageCode, MoneyV2, PredictiveSearchLimitScope, PredictiveSearchType, ProductCollectionSortKeys, SearchUnavailableProductsType, SearchableField };
|
|
47
173
|
//# sourceMappingURL=storefront-api-types.d.mts.map
|
|
@@ -8,29 +8,31 @@ type StorefrontTadaGql = initGraphQLTada<{
|
|
|
8
8
|
introspection: introspection;
|
|
9
9
|
scalars: StorefrontScalars;
|
|
10
10
|
}>;
|
|
11
|
+
/** Type-only properties that mark a string as a `gql` document. */
|
|
11
12
|
type StorefrontQueryMetadata<Source extends string = string> = {
|
|
12
|
-
readonly __hydrogenQueryBrand: true;
|
|
13
|
+
/** Marks a string that `gql` returns. The property exists only in types. */readonly __hydrogenQueryBrand: true; /** The document's query text, which TypeScript reads to infer types. The property exists only in types. */
|
|
13
14
|
readonly __hydrogenQuerySource?: Source;
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
+
* The type of a `gql` document, a query string that carries its result and variables types.
|
|
17
18
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `ResultOf<>` and `VariablesOf<>` work on it.
|
|
19
|
+
* At runtime, the document is a plain string. Read the types with `StorefrontApi.ResultOf` and
|
|
20
|
+
* `StorefrontApi.VariablesOf`.
|
|
21
21
|
*/
|
|
22
22
|
type StorefrontQueryString<Result = any, Variables = any, Source extends string = string> = string & DocumentDecoration<Result, Variables> & {
|
|
23
23
|
readonly __hydrogenQueryBrand: true;
|
|
24
24
|
readonly __hydrogenQuerySource?: Source;
|
|
25
25
|
};
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Any `gql` document, whatever its result and variables types. Use the type to accept any Storefront API document.
|
|
28
|
+
*/
|
|
27
29
|
type AnyStorefrontQueryString = string & StorefrontQueryMetadata;
|
|
28
|
-
/**
|
|
30
|
+
/** The query text of a `gql` document as a string literal type. Resolves to `never` for a plain string. */
|
|
29
31
|
type SourceOf<Doc> = Doc extends {
|
|
30
32
|
readonly __hydrogenQuerySource?: infer Source extends string;
|
|
31
33
|
} ? Source : never;
|
|
32
34
|
type FragmentSources<Fragments extends readonly AnyStorefrontQueryString[]> = Fragments extends readonly [] ? "" : Fragments extends readonly [infer Only extends AnyStorefrontQueryString] ? SourceOf<Only> : Fragments extends readonly [infer First extends AnyStorefrontQueryString, ...infer Rest extends readonly AnyStorefrontQueryString[]] ? `${SourceOf<First>}\n${FragmentSources<Rest>}` : string;
|
|
33
|
-
/**
|
|
35
|
+
/** The combined query text of a document and its fragments, which keeps the inferred types of composed documents. */
|
|
34
36
|
type ComposedSource<Source extends string, Fragments extends readonly AnyStorefrontQueryString[]> = FragmentSources<Fragments> extends "" ? Source : `${Source}\n${FragmentSources<Fragments>}`;
|
|
35
37
|
type StorefrontGql = {
|
|
36
38
|
<const Document extends AnyStorefrontQueryString, const Fragments extends readonly AnyStorefrontQueryString[], const DocumentSource extends string = ComposedSource<SourceOf<Document>, Fragments>>(document: Document, fragments: Fragments): StorefrontQueryString<InferResult<DocumentSource>, InferVariables<DocumentSource>, DocumentSource>;
|
|
@@ -38,14 +40,12 @@ type StorefrontGql = {
|
|
|
38
40
|
<const Source extends string, const Fragments extends readonly AnyStorefrontQueryString[], const DocumentSource extends string = ComposedSource<Source, Fragments>>(source: Source, fragments: Fragments): StorefrontQueryString<InferResult<DocumentSource>, InferVariables<DocumentSource>, DocumentSource>;
|
|
39
41
|
} & StorefrontTadaGql;
|
|
40
42
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* At the type level, the return type carries phantom `Result` and `Variables`
|
|
45
|
-
* types inferred from the Storefront API schema via gql.tada.
|
|
43
|
+
* Writes a typed Storefront API query, mutation, or fragment. TypeScript infers the result and
|
|
44
|
+
* variables types from Hydrogen's bundled Storefront API schema. At runtime, the function returns
|
|
45
|
+
* the query string with any fragments appended.
|
|
46
46
|
*
|
|
47
|
-
* Pass
|
|
48
|
-
*
|
|
47
|
+
* Pass earlier fragment documents as the second argument to compose documents and keep the
|
|
48
|
+
* inferred types.
|
|
49
49
|
*
|
|
50
50
|
* @example
|
|
51
51
|
* ```ts
|
|
@@ -62,10 +62,11 @@ type StorefrontGql = {
|
|
|
62
62
|
* });
|
|
63
63
|
*
|
|
64
64
|
* if (!result.errors) {
|
|
65
|
-
* // result.data.product
|
|
65
|
+
* // result.data.product has the type `{ title: string } | null`
|
|
66
66
|
* console.log(result.data.product?.title);
|
|
67
67
|
* }
|
|
68
68
|
* ```
|
|
69
|
+
* @publicDocs
|
|
69
70
|
*/
|
|
70
71
|
declare const gql: StorefrontGql;
|
|
71
72
|
//#endregion
|
package/dist/graphql/graphql.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
//#region src/graphql/graphql.ts
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Writes a typed Storefront API query, mutation, or fragment. TypeScript infers the result and
|
|
4
|
+
* variables types from Hydrogen's bundled Storefront API schema. At runtime, the function returns
|
|
5
|
+
* the query string with any fragments appended.
|
|
4
6
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* types inferred from the Storefront API schema via gql.tada.
|
|
8
|
-
*
|
|
9
|
-
* Pass an array of previously declared `gql()` fragments as the second
|
|
10
|
-
* argument to compose documents while preserving full type inference.
|
|
7
|
+
* Pass earlier fragment documents as the second argument to compose documents and keep the
|
|
8
|
+
* inferred types.
|
|
11
9
|
*
|
|
12
10
|
* @example
|
|
13
11
|
* ```ts
|
|
@@ -24,10 +22,11 @@
|
|
|
24
22
|
* });
|
|
25
23
|
*
|
|
26
24
|
* if (!result.errors) {
|
|
27
|
-
* // result.data.product
|
|
25
|
+
* // result.data.product has the type `{ title: string } | null`
|
|
28
26
|
* console.log(result.data.product?.title);
|
|
29
27
|
* }
|
|
30
28
|
* ```
|
|
29
|
+
* @publicDocs
|
|
31
30
|
*/
|
|
32
31
|
const gql = ((source, fragments) => {
|
|
33
32
|
let query = source;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.mjs","names":[],"sources":["../../src/graphql/graphql.ts"],"sourcesContent":["import type { DocumentDecoration, initGraphQLTada as InitGraphQLTada } from \"gql.tada\";\n\nimport type { introspection } from \"./generated/graphql-env\";\nimport type { StorefrontScalars } from \"./scalars\";\nimport type { InferResult, InferVariables } from \"./type-resolver\";\n\ntype StorefrontTadaGql = InitGraphQLTada<{\n introspection: introspection;\n scalars: StorefrontScalars;\n}>;\n\ntype StorefrontQueryMetadata<Source extends string = string> = {\n readonly __hydrogenQueryBrand: true;\n readonly __hydrogenQuerySource?: Source;\n};\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"graphql.mjs","names":[],"sources":["../../src/graphql/graphql.ts"],"sourcesContent":["import type { DocumentDecoration, initGraphQLTada as InitGraphQLTada } from \"gql.tada\";\n\nimport type { introspection } from \"./generated/graphql-env\";\nimport type { StorefrontScalars } from \"./scalars\";\nimport type { InferResult, InferVariables } from \"./type-resolver\";\n\ntype StorefrontTadaGql = InitGraphQLTada<{\n introspection: introspection;\n scalars: StorefrontScalars;\n}>;\n\n/** Type-only properties that mark a string as a `gql` document. */\ntype StorefrontQueryMetadata<Source extends string = string> = {\n /** Marks a string that `gql` returns. The property exists only in types. */\n readonly __hydrogenQueryBrand: true;\n /** The document's query text, which TypeScript reads to infer types. The property exists only in types. */\n readonly __hydrogenQuerySource?: Source;\n};\n\n/**\n * The type of a `gql` document, a query string that carries its result and variables types.\n *\n * At runtime, the document is a plain string. Read the types with `StorefrontApi.ResultOf` and\n * `StorefrontApi.VariablesOf`.\n */\nexport type StorefrontQueryString<\n Result = any,\n Variables = any,\n Source extends string = string,\n> = string &\n DocumentDecoration<Result, Variables> & {\n readonly __hydrogenQueryBrand: true;\n readonly __hydrogenQuerySource?: Source;\n };\n\n/**\n * Any `gql` document, whatever its result and variables types. Use the type to accept any Storefront API document.\n */\nexport type AnyStorefrontQueryString = string & StorefrontQueryMetadata;\n\n/** The query text of a `gql` document as a string literal type. Resolves to `never` for a plain string. */\nexport type SourceOf<Doc> = Doc extends {\n readonly __hydrogenQuerySource?: infer Source extends string;\n}\n ? Source\n : never;\n\nexport type FragmentSources<Fragments extends readonly AnyStorefrontQueryString[]> =\n Fragments extends readonly []\n ? \"\"\n : Fragments extends readonly [infer Only extends AnyStorefrontQueryString]\n ? SourceOf<Only>\n : Fragments extends readonly [\n infer First extends AnyStorefrontQueryString,\n ...infer Rest extends readonly AnyStorefrontQueryString[],\n ]\n ? `${SourceOf<First>}\\n${FragmentSources<Rest>}`\n : string;\n\n/** The combined query text of a document and its fragments, which keeps the inferred types of composed documents. */\nexport type ComposedSource<\n Source extends string,\n Fragments extends readonly AnyStorefrontQueryString[],\n> = FragmentSources<Fragments> extends \"\" ? Source : `${Source}\\n${FragmentSources<Fragments>}`;\n\ntype StorefrontGql = {\n // Composes an already-declared document with additional fragments. Declared\n // before the raw-source overloads so branded documents recover their literal\n // source through SourceOf instead of binding Source to the branded type,\n // which would degrade ComposedSource and kill inference.\n <\n const Document extends AnyStorefrontQueryString,\n const Fragments extends readonly AnyStorefrontQueryString[],\n const DocumentSource extends string = ComposedSource<SourceOf<Document>, Fragments>,\n >(\n document: Document,\n fragments: Fragments,\n ): StorefrontQueryString<\n InferResult<DocumentSource>,\n InferVariables<DocumentSource>,\n DocumentSource\n >;\n <const Source extends string>(\n source: Source,\n ): StorefrontQueryString<InferResult<Source>, InferVariables<Source>, Source>;\n <\n const Source extends string,\n const Fragments extends readonly AnyStorefrontQueryString[],\n const DocumentSource extends string = ComposedSource<Source, Fragments>,\n >(\n source: Source,\n fragments: Fragments,\n ): StorefrontQueryString<\n InferResult<DocumentSource>,\n InferVariables<DocumentSource>,\n DocumentSource\n >;\n} & StorefrontTadaGql;\n\n/**\n * Writes a typed Storefront API query, mutation, or fragment. TypeScript infers the result and\n * variables types from Hydrogen's bundled Storefront API schema. At runtime, the function returns\n * the query string with any fragments appended.\n *\n * Pass earlier fragment documents as the second argument to compose documents and keep the\n * inferred types.\n *\n * @example\n * ```ts\n * import { gql } from \"@shopify/hydrogen\";\n *\n * const PRODUCT_QUERY = gql(`\n * query Product($handle: String!) {\n * product(handle: $handle) { title }\n * }\n * `);\n *\n * const result = await storefront.graphql(PRODUCT_QUERY, {\n * variables: { handle: \"snowboard\" },\n * });\n *\n * if (!result.errors) {\n * // result.data.product has the type `{ title: string } | null`\n * console.log(result.data.product?.title);\n * }\n * ```\n * @publicDocs\n */\n// oxlint-disable-next-line typescript-eslint/consistent-type-assertions -- gql.tada adds phantom helper properties to the function type that are not used at runtime.\nexport const gql = ((source: string, fragments?: Array<string>) => {\n let query = source;\n\n if (fragments) {\n const seen = new Set<string>();\n for (const fragment of fragments) {\n if (!seen.has(fragment)) {\n seen.add(fragment);\n query += \"\\n\" + fragment;\n }\n }\n }\n\n return query;\n}) as unknown as StorefrontGql;\n\n/**\n * Writes a typed Storefront API query, mutation, or fragment. At runtime, the function returns the query text with each fragment appended once.\n *\n * TypeScript infers the result and variables types from Hydrogen's bundled Storefront API schema, even when the client targets another `apiVersion`. Read the types with `StorefrontApi.ResultOf` and `StorefrontApi.VariablesOf`. To type a fragment on its own, compose the fragment into a query and read the type from the query. The `FragmentOf` helper from `gql`.tada doesn't accept `gql` documents.\n *\n * @publicDocs\n */\nexport type StorefrontGqlForDocs =\n /**\n * @param source - The Storefront API query, mutation, or fragment source text.\n * @param fragments - The `gql` fragments that the query text spreads.\n * @returns A typed document to pass to the client's `graphql()` method.\n */\n (source: string, fragments?: readonly AnyStorefrontQueryString[]) => AnyStorefrontQueryString;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIA,MAAa,QAAQ,QAAgB,cAA8B;CACjE,IAAI,QAAQ;AAEZ,KAAI,WAAW;EACb,MAAM,uBAAO,IAAI,KAAa;AAC9B,OAAK,MAAM,YAAY,UACrB,KAAI,CAAC,KAAK,IAAI,SAAS,EAAE;AACvB,QAAK,IAAI,SAAS;AAClB,YAAS,OAAO;;;AAKtB,QAAO"}
|
|
@@ -134,6 +134,7 @@ type FragmentMap<Defs, Map = {}> = Defs extends readonly [infer Def, ...infer Re
|
|
|
134
134
|
type FirstOperation<Defs> = Defs extends readonly [infer Def, ...infer Rest] ? Def extends {
|
|
135
135
|
kind: "OperationDefinition";
|
|
136
136
|
} ? Def : FirstOperation<Rest> : never;
|
|
137
|
+
/** The document's only operation, or `never` when the document has no operations or several. */
|
|
137
138
|
type SingleOperation<Defs, Operation = never> = Defs extends readonly [infer Def, ...infer Rest] ? Def extends {
|
|
138
139
|
kind: "OperationDefinition";
|
|
139
140
|
} ? [Operation] extends [never] ? SingleOperation<Rest, Def> : never : SingleOperation<Rest, Operation> : Operation;
|
|
@@ -213,6 +214,7 @@ type VariablesType<Doc, Schema extends SchemaLike> = Doc extends {
|
|
|
213
214
|
} ? FirstOperation<Defs> extends {
|
|
214
215
|
variableDefinitions: any;
|
|
215
216
|
} ? VariablesWalker<FirstOperation<Defs>["variableDefinitions"], Schema> : {} : {};
|
|
217
|
+
/** The operation kind of a parsed document with one operation. Resolves to `"unknown"` for any other document. */
|
|
216
218
|
type OperationKindType<Doc> = Doc extends {
|
|
217
219
|
kind: "Document";
|
|
218
220
|
definitions: infer Defs extends readonly unknown[];
|
|
@@ -222,21 +224,26 @@ type OperationKindType<Doc> = Doc extends {
|
|
|
222
224
|
type InferResultForSchema<T extends string, Schema extends SchemaLike> = parseDocument<T> extends infer Doc ? Doc extends never ? never : DocumentType<Doc, Schema> : never;
|
|
223
225
|
type InferVariablesForSchema<T extends string, Schema extends SchemaLike> = parseDocument<T> extends infer Doc ? Doc extends never ? never : VariablesType<Doc, Schema> : never;
|
|
224
226
|
/**
|
|
225
|
-
*
|
|
227
|
+
* The result type of a Storefront API query string, from Hydrogen's bundled schema.
|
|
226
228
|
*
|
|
227
|
-
*
|
|
228
|
-
* a
|
|
229
|
-
*
|
|
229
|
+
* Use the type for a result shape outside a GraphQL call, such as a component prop type. Pass the
|
|
230
|
+
* query text as a string literal type. For a `gql` document, use `StorefrontApi.ResultOf`. The
|
|
231
|
+
* type resolves to `never` for a `gql` document.
|
|
232
|
+
*
|
|
233
|
+
* @publicDocs
|
|
230
234
|
*/
|
|
231
235
|
type InferResult<T extends string> = InferResultForSchema<T, StorefrontSchema>;
|
|
232
236
|
/**
|
|
233
|
-
*
|
|
237
|
+
* The variables type of a Storefront API query string, from Hydrogen's bundled schema.
|
|
238
|
+
*
|
|
239
|
+
* Use the type for a variables shape outside a GraphQL call, such as a loader parameter type. Pass
|
|
240
|
+
* the query text as a string literal type. For a `gql` document, use `StorefrontApi.VariablesOf`.
|
|
241
|
+
* The type resolves to `never` for a `gql` document.
|
|
234
242
|
*
|
|
235
|
-
*
|
|
236
|
-
* a loader param type. Takes a raw query source literal: for `gql()` documents use
|
|
237
|
-
* `StorefrontApi.VariablesOf`, since `InferVariables<typeof doc>` resolves to `never`.
|
|
243
|
+
* @publicDocs
|
|
238
244
|
*/
|
|
239
245
|
type InferVariables<T extends string> = InferVariablesForSchema<T, StorefrontSchema>;
|
|
246
|
+
/** The operation kind of a query string, such as `query`. Resolves to `unknown` unless the query text has exactly one operation. */
|
|
240
247
|
type InferOperationKind<T extends string> = parseDocument<T> extends infer Doc ? [Doc] extends [never] ? "unknown" : OperationKindType<Doc> : "unknown";
|
|
241
248
|
//#endregion
|
|
242
249
|
export { GraphQLSchemaFor, InferOperationKind, InferResult, InferResultForSchema, InferVariables, InferVariablesForSchema };
|
package/dist/react/cart.d.mts
CHANGED
|
@@ -4,25 +4,71 @@ import { CartFormRegister } from "../core/cart/form.mjs";
|
|
|
4
4
|
import { CartDataFromHandlers } from "../core/cart/server-handlers.mjs";
|
|
5
5
|
import { FormHTMLAttributes, ReactNode, SubmitEvent } from "react";
|
|
6
6
|
//#region src/react/cart.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Props for the cart provider that `createCartComponents` returns.
|
|
9
|
+
*/
|
|
7
10
|
type TypedCartProviderProps<TData extends CartData> = {
|
|
8
|
-
|
|
11
|
+
/**
|
|
12
|
+
* The `data` property of the cart GET handler's result, or a promise of that data. Without initial data, the store loads the cart from `/api/cart` after the provider mounts, and the server-rendered page shows an empty cart. The provider creates its store from the first value and ignores later changes.
|
|
13
|
+
*/
|
|
14
|
+
initialData?: CartInitialData<TData>; /** Content that can read the cart through the cart hooks. */
|
|
9
15
|
children?: ReactNode;
|
|
10
16
|
};
|
|
11
17
|
type CartInitialData<TData extends CartData = CartData> = CreateCartStoreOptions<TData>["initialData"];
|
|
18
|
+
/** A hook that returns the slice of cart state that your selector picks. */
|
|
19
|
+
type CartStateHook<TData extends CartData> =
|
|
20
|
+
/**
|
|
21
|
+
* @param selector - Picks the value to return from the cart state.
|
|
22
|
+
* @param isEqual - Compares the previous and next selected values. Return `true` to skip the re-render. Without the function, the hook compares the values by reference.
|
|
23
|
+
* @returns The selected value.
|
|
24
|
+
*/
|
|
25
|
+
<S>(selector: (state: CartState<TData>) => S, isEqual?: (a: S, b: S) => boolean) => S;
|
|
26
|
+
/** A hook that returns the slice of cart state that your selector picks, or `undefined` outside the cart provider. */
|
|
27
|
+
type OptionalCartStateHook<TData extends CartData> =
|
|
28
|
+
/**
|
|
29
|
+
* @param selector - Picks the value to return from the cart state.
|
|
30
|
+
* @param isEqual - Compares the previous and next selected values. Return `true` to skip the re-render. Without the function, the hook compares the values by reference.
|
|
31
|
+
* @returns The selected value, or `undefined` outside the cart provider.
|
|
32
|
+
*/
|
|
33
|
+
<S>(selector: (state: CartState<TData>) => S, isEqual?: (a: S, b: S) => boolean) => S | undefined;
|
|
34
|
+
/** Callbacks that run around a cart form submission. */
|
|
35
|
+
interface CartFormPropsOptions {
|
|
36
|
+
/** Runs before the cart store handles the submission. Call `event.preventDefault()` to skip the cart submission. */
|
|
37
|
+
beforeSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
|
|
38
|
+
/** Runs as soon as the cart change starts, before the server responds. */
|
|
39
|
+
afterSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
|
|
40
|
+
}
|
|
41
|
+
/** The form props function and the register function for a cart form. */
|
|
42
|
+
interface CartFormBindings {
|
|
43
|
+
/** Returns the `method`, `action`, and `onSubmit` props to spread on the form. The form posts to the cart endpoint, and the cart store handles each submission. */
|
|
44
|
+
formProps: (opts?: CartFormPropsOptions) => FormHTMLAttributes<HTMLFormElement>;
|
|
45
|
+
/** Returns the attributes for a cart field or action button. Register the quantity field with `interactive: true` to submit the form when the quantity changes. The interactive input takes the quantity as a default value and stays uncontrolled. */
|
|
46
|
+
register: CartFormRegister;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The cart provider and hooks that `createCartComponents` returns, typed with the custom cart fields from your cart server handlers.
|
|
50
|
+
*/
|
|
12
51
|
type TypedCartComponents<TData extends CartData> = {
|
|
13
|
-
CartProvider: (props: TypedCartProviderProps<TData>) => ReactNode;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
52
|
+
/** Creates the cart store and shares the store with the cart hooks inside the provider. The provider connects the store on mount and destroys the store on unmount. */CartProvider: (props: TypedCartProviderProps<TData>) => ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the slice of cart state that the selector picks. The component re-renders when the selected value changes by reference, or when your `isEqual` function reports a change. A selector that returns the full state re-renders on every cart update.
|
|
55
|
+
*/
|
|
56
|
+
useCart: CartStateHook<TData>; /** Suspends while the full cart loads, then returns the slice of cart state that the selector picks. Wrap the component in a `Suspense` boundary. */
|
|
57
|
+
useSuspenseCart: CartStateHook<TData>;
|
|
58
|
+
/**
|
|
59
|
+
* Returns the slice of cart state that the selector picks, or `undefined` outside the provider. Use the hook in a component that also renders above the provider, such as a cart badge on an error page.
|
|
60
|
+
*/
|
|
61
|
+
useOptionalCart: OptionalCartStateHook<TData>; /** Returns the `refresh()` action. Call `refresh()` after a server-side cart change that skips cart forms. */
|
|
62
|
+
useCartActions: typeof useCartActions; /** Returns form props and a register function for cart forms. */
|
|
18
63
|
useCartForm: typeof useCartForm;
|
|
19
64
|
};
|
|
20
65
|
/**
|
|
21
|
-
*
|
|
22
|
-
* cart
|
|
66
|
+
* Returns a cart provider and cart hooks typed to the cart fragment in your cart server handlers.
|
|
67
|
+
* Pass `typeof cartServerHandlers` as the `THandlers` type argument. Every hook's cart state then includes your custom cart fields.
|
|
68
|
+
*
|
|
69
|
+
* On mount, the provider sends cart requests to `/api/cart` and connects the store. Every hook except `useOptionalCart` throws when you call it outside the provider.
|
|
23
70
|
*
|
|
24
|
-
* The
|
|
25
|
-
* call, so every hook's {@link CartState} carries your custom cart fields end-to-end.
|
|
71
|
+
* @returns The cart provider, the cart state hooks, and the cart actions and form hooks.
|
|
26
72
|
*
|
|
27
73
|
* @example
|
|
28
74
|
* ```tsx
|
|
@@ -37,14 +83,15 @@ type TypedCartComponents<TData extends CartData> = {
|
|
|
37
83
|
* useCartForm,
|
|
38
84
|
* } = createCartComponents<typeof cartServerHandlers>();
|
|
39
85
|
* ```
|
|
86
|
+
* @publicDocs
|
|
40
87
|
*/
|
|
41
88
|
declare function createCartComponents<THandlers>(): TypedCartComponents<CartDataFromHandlers<THandlers>>;
|
|
42
89
|
/**
|
|
43
|
-
* Returns cart
|
|
90
|
+
* Returns the cart action that reloads the cart after a cart change outside cart forms.
|
|
44
91
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
92
|
+
* Call `refresh()` after a server-side cart change that skips cart forms, such as a server action that creates the cart.
|
|
93
|
+
*
|
|
94
|
+
* @returns The `refresh()` action.
|
|
48
95
|
*
|
|
49
96
|
* @example
|
|
50
97
|
* ```tsx
|
|
@@ -55,14 +102,17 @@ declare function createCartComponents<THandlers>(): TypedCartComponents<CartData
|
|
|
55
102
|
* refresh(); // re-fetch the cart
|
|
56
103
|
* }
|
|
57
104
|
* ```
|
|
105
|
+
* @publicDocs
|
|
58
106
|
*/
|
|
59
107
|
declare function useCartActions(): CartActions;
|
|
60
108
|
/**
|
|
61
|
-
*
|
|
109
|
+
* Publishes cart analytics events when the customer's cart changes.
|
|
110
|
+
*
|
|
111
|
+
* Call the hook once near the root of your app, inside `CartProvider`. The hook starts tracking on mount and stops on unmount. The hook publishes `cart_updated`, `product_added_to_cart`, and `product_removed_from_cart` events.
|
|
62
112
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
113
|
+
* The hook throws outside `CartProvider`, and when the Shopify analytics bus isn't available. Render `ShopifyScripts` before the hook runs.
|
|
114
|
+
*
|
|
115
|
+
* @returns Nothing. The hook tracks cart analytics for the lifetime of the calling component.
|
|
66
116
|
*
|
|
67
117
|
* @example
|
|
68
118
|
* ```tsx
|
|
@@ -71,19 +121,20 @@ declare function useCartActions(): CartActions;
|
|
|
71
121
|
* return <Layout />;
|
|
72
122
|
* }
|
|
73
123
|
* ```
|
|
124
|
+
* @publicDocs
|
|
74
125
|
*/
|
|
75
126
|
declare function useCartAnalytics(): void;
|
|
76
127
|
/**
|
|
77
128
|
* Returns form props and a field register function for building cart forms.
|
|
78
129
|
*
|
|
79
|
-
* `formProps()`
|
|
80
|
-
*
|
|
81
|
-
* `
|
|
82
|
-
*
|
|
130
|
+
* Spread `formProps()` on the form. The form posts to the cart endpoint. On submit, the form props stop the browser's navigation and send the form through the cart store.
|
|
131
|
+
* The submit handler ignores a failed cart change. Read failures from the cart state's `errors`.
|
|
132
|
+
* To skip the cart submission, call `event.preventDefault()` in a `beforeSubmit` callback. The `afterSubmit` callback runs as soon as the cart change starts, before the server responds.
|
|
133
|
+
* The register function returns the HTML attributes for each cart field and action.
|
|
134
|
+
*
|
|
135
|
+
* Register the quantity field with `interactive: true` to submit the form when the quantity changes. The interactive input takes the quantity as a default value and stays uncontrolled.
|
|
83
136
|
*
|
|
84
|
-
*
|
|
85
|
-
* attributes include a `ref` callback that attaches {@link attachQuantityInput}
|
|
86
|
-
* for auto-submit-on-change behavior.
|
|
137
|
+
* @returns The form props function and the register function.
|
|
87
138
|
*
|
|
88
139
|
* @example
|
|
89
140
|
* ```tsx
|
|
@@ -102,14 +153,9 @@ declare function useCartAnalytics(): void;
|
|
|
102
153
|
* );
|
|
103
154
|
* }
|
|
104
155
|
* ```
|
|
156
|
+
* @publicDocs
|
|
105
157
|
*/
|
|
106
|
-
declare function useCartForm():
|
|
107
|
-
formProps: (opts?: {
|
|
108
|
-
beforeSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
|
|
109
|
-
afterSubmit?: (e: SubmitEvent<HTMLFormElement>) => void;
|
|
110
|
-
}) => FormHTMLAttributes<HTMLFormElement>;
|
|
111
|
-
register: CartFormRegister;
|
|
112
|
-
};
|
|
158
|
+
declare function useCartForm(): CartFormBindings;
|
|
113
159
|
//#endregion
|
|
114
160
|
export { createCartComponents, useCartAnalytics };
|
|
115
161
|
//# sourceMappingURL=cart.d.mts.map
|