@shopify/hydrogen 2026.10.1 → 2026.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/dist/cli/index.mjs +8 -5
- package/dist/client/client.mjs +45 -12
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/i18n-variables.d.mts +13 -0
- package/dist/client/i18n-variables.mjs +92 -0
- package/dist/client/i18n-variables.mjs.map +1 -0
- package/dist/client/types.d.mts +21 -8
- package/dist/core/cache/fetch-with-cache.mjs +8 -1
- package/dist/core/cache/fetch-with-cache.mjs.map +1 -1
- package/dist/core/cart/cart.mjs +111 -24
- package/dist/core/cart/cart.mjs.map +1 -1
- package/dist/core/cart/cookie.mjs +6 -1
- package/dist/core/cart/cookie.mjs.map +1 -1
- package/dist/core/cart/form.d.mts +17 -5
- package/dist/core/cart/form.mjs +5 -0
- package/dist/core/cart/form.mjs.map +1 -1
- package/dist/core/cart/index.d.mts +1 -1
- package/dist/core/cart/queries.d.mts +57 -57
- package/dist/core/collection/url.mjs +8 -1
- package/dist/core/collection/url.mjs.map +1 -1
- package/dist/core/constants.mjs +2 -1
- package/dist/core/constants.mjs.map +1 -1
- package/dist/core/csp/index.d.mts +56 -0
- package/dist/core/csp/index.mjs +117 -0
- package/dist/core/csp/index.mjs.map +1 -0
- package/dist/core/csp/types.d.mts +52 -0
- package/dist/core/headers.mjs +2 -2
- package/dist/core/headers.mjs.map +1 -1
- package/dist/core/i18n/define.d.mts +54 -0
- package/dist/core/i18n/define.mjs +135 -0
- package/dist/core/i18n/define.mjs.map +1 -0
- package/dist/core/i18n/errors.d.mts +18 -0
- package/dist/core/i18n/errors.mjs +24 -0
- package/dist/core/i18n/errors.mjs.map +1 -0
- package/dist/core/i18n/href.d.mts +28 -0
- package/dist/core/i18n/href.mjs +45 -0
- package/dist/core/i18n/href.mjs.map +1 -0
- package/dist/core/i18n/locale.d.mts +21 -0
- package/dist/core/i18n/locale.mjs +36 -0
- package/dist/core/i18n/locale.mjs.map +1 -0
- package/dist/core/i18n/match.d.mts +37 -0
- package/dist/core/i18n/match.mjs +82 -0
- package/dist/core/i18n/match.mjs.map +1 -0
- package/dist/core/i18n/types.d.mts +80 -0
- package/dist/core/index.d.mts +14 -5
- package/dist/core/index.mjs +9 -2
- package/dist/core/predictive-search/index.d.mts +2 -2
- package/dist/core/predictive-search/queries.d.mts +2 -2
- package/dist/core/predictive-search/server-handlers.d.mts +27 -6
- package/dist/core/predictive-search/server-handlers.mjs +1 -4
- package/dist/core/predictive-search/server-handlers.mjs.map +1 -1
- package/dist/core/predictive-search/url.d.mts +2 -2
- package/dist/core/predictive-search/url.mjs.map +1 -1
- package/dist/core/product/accept-variant-id.mjs +1 -1
- package/dist/core/product/accept-variant-id.mjs.map +1 -1
- package/dist/core/request-context.d.mts +61 -35
- package/dist/core/request-context.mjs +11 -7
- package/dist/core/request-context.mjs.map +1 -1
- package/dist/core/request-routing/handle-shopify-routes.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/api-proxy.mjs +9 -1
- package/dist/core/request-routing/interceptors/api-proxy.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/checkout.mjs +11 -5
- package/dist/core/request-routing/interceptors/checkout.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/proxy.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/standard-routes.mjs +1 -1
- package/dist/core/request-routing/interceptors/standard-routes.mjs.map +1 -1
- package/dist/core/request-routing/interceptors/url-redirects.mjs +2 -1
- package/dist/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
- package/dist/core/request-routing/registered-routes.d.mts +13 -2
- package/dist/core/request-routing/registered-routes.mjs +33 -9
- package/dist/core/request-routing/registered-routes.mjs.map +1 -1
- package/dist/core/request-routing/route-types.d.mts +18 -8
- package/dist/core/shop-pay/shop-pay.mjs +5 -4
- package/dist/core/shop-pay/shop-pay.mjs.map +1 -1
- package/dist/core/shopify-scripts/analytics.mjs +3 -5
- package/dist/core/shopify-scripts/analytics.mjs.map +1 -1
- package/dist/core/shopify-scripts/constants.mjs +3 -1
- package/dist/core/shopify-scripts/constants.mjs.map +1 -1
- package/dist/core/shopify-scripts/global.mjs +13 -11
- package/dist/core/shopify-scripts/global.mjs.map +1 -1
- package/dist/core/shopify-scripts/hashes.d.mts +17 -0
- package/dist/core/shopify-scripts/hashes.mjs +12 -0
- package/dist/core/shopify-scripts/hashes.mjs.map +1 -0
- package/dist/core/shopify-scripts/index.d.mts +1 -0
- package/dist/core/shopify-scripts/index.mjs +12 -9
- package/dist/core/shopify-scripts/index.mjs.map +1 -1
- package/dist/core/shopify-scripts/page-view.mjs +4 -1
- package/dist/core/shopify-scripts/page-view.mjs.map +1 -1
- package/dist/core/shopify-scripts/perfkit.mjs +8 -2
- package/dist/core/shopify-scripts/perfkit.mjs.map +1 -1
- package/dist/core/shopify-scripts/types.d.mts +4 -2
- package/dist/core/shopify-scripts/utils/inline-script.mjs +4 -1
- package/dist/core/shopify-scripts/utils/inline-script.mjs.map +1 -1
- package/dist/core/standard-routes/build.d.mts +7 -2
- package/dist/core/standard-routes/build.mjs +10 -3
- package/dist/core/standard-routes/build.mjs.map +1 -1
- package/dist/core/standard-routes/match.mjs +11 -1
- package/dist/core/standard-routes/match.mjs.map +1 -1
- package/dist/core/standard-routes/path.mjs +14 -3
- package/dist/core/standard-routes/path.mjs.map +1 -1
- package/dist/core/standard-routes/types.d.mts +6 -1
- package/dist/core/url.mjs +5 -3
- package/dist/core/url.mjs.map +1 -1
- package/dist/core/utils/load-script.mjs +6 -6
- package/dist/core/utils/load-script.mjs.map +1 -1
- package/dist/customer-account/client.d.mts +14 -10
- package/dist/customer-account/client.mjs +4 -5
- package/dist/customer-account/client.mjs.map +1 -1
- package/dist/customer-account/graphql.d.mts +7 -1
- package/dist/customer-account/graphql.mjs +6 -7
- package/dist/customer-account/graphql.mjs.map +1 -1
- package/dist/customer-account/session.mjs +3 -4
- package/dist/customer-account/session.mjs.map +1 -1
- package/dist/development/client/client.mjs +45 -12
- package/dist/development/client/client.mjs.map +1 -1
- package/dist/development/client/i18n-variables.d.mts +13 -0
- package/dist/development/client/i18n-variables.mjs +92 -0
- package/dist/development/client/i18n-variables.mjs.map +1 -0
- package/dist/development/client/types.d.mts +21 -8
- package/dist/development/core/cache/fetch-with-cache.mjs +8 -1
- package/dist/development/core/cache/fetch-with-cache.mjs.map +1 -1
- package/dist/development/core/cart/cart.mjs +111 -24
- package/dist/development/core/cart/cart.mjs.map +1 -1
- package/dist/development/core/cart/cookie.mjs +6 -1
- package/dist/development/core/cart/cookie.mjs.map +1 -1
- package/dist/development/core/cart/form.d.mts +17 -5
- package/dist/development/core/cart/form.mjs +5 -0
- package/dist/development/core/cart/form.mjs.map +1 -1
- package/dist/development/core/cart/index.d.mts +1 -1
- package/dist/development/core/cart/queries.d.mts +57 -57
- package/dist/development/core/collection/url.mjs +8 -1
- package/dist/development/core/collection/url.mjs.map +1 -1
- package/dist/development/core/constants.mjs +2 -1
- package/dist/development/core/constants.mjs.map +1 -1
- package/dist/development/core/csp/index.d.mts +56 -0
- package/dist/development/core/csp/index.mjs +128 -0
- package/dist/development/core/csp/index.mjs.map +1 -0
- package/dist/development/core/csp/types.d.mts +52 -0
- package/dist/development/core/development.d.mts +14 -5
- package/dist/development/core/development.mjs +9 -2
- package/dist/development/core/headers.mjs +2 -2
- package/dist/development/core/headers.mjs.map +1 -1
- package/dist/development/core/i18n/define.d.mts +54 -0
- package/dist/development/core/i18n/define.mjs +135 -0
- package/dist/development/core/i18n/define.mjs.map +1 -0
- package/dist/development/core/i18n/errors.d.mts +18 -0
- package/dist/development/core/i18n/errors.mjs +24 -0
- package/dist/development/core/i18n/errors.mjs.map +1 -0
- package/dist/development/core/i18n/href.d.mts +28 -0
- package/dist/development/core/i18n/href.mjs +45 -0
- package/dist/development/core/i18n/href.mjs.map +1 -0
- package/dist/development/core/i18n/locale.d.mts +21 -0
- package/dist/development/core/i18n/locale.mjs +36 -0
- package/dist/development/core/i18n/locale.mjs.map +1 -0
- package/dist/development/core/i18n/match.d.mts +37 -0
- package/dist/development/core/i18n/match.mjs +82 -0
- package/dist/development/core/i18n/match.mjs.map +1 -0
- package/dist/development/core/i18n/types.d.mts +80 -0
- package/dist/development/core/index.d.mts +13 -4
- package/dist/development/core/predictive-search/index.d.mts +2 -2
- package/dist/development/core/predictive-search/queries.d.mts +2 -2
- package/dist/development/core/predictive-search/server-handlers.d.mts +27 -6
- package/dist/development/core/predictive-search/server-handlers.mjs +1 -4
- package/dist/development/core/predictive-search/server-handlers.mjs.map +1 -1
- package/dist/development/core/predictive-search/url.d.mts +2 -2
- package/dist/development/core/predictive-search/url.mjs.map +1 -1
- package/dist/development/core/product/accept-variant-id.mjs +1 -1
- package/dist/development/core/product/accept-variant-id.mjs.map +1 -1
- package/dist/development/core/request-context.d.mts +61 -35
- package/dist/development/core/request-context.mjs +11 -7
- package/dist/development/core/request-context.mjs.map +1 -1
- package/dist/development/core/request-routing/handle-shopify-routes.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/api-proxy.mjs +9 -1
- package/dist/development/core/request-routing/interceptors/api-proxy.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/checkout.mjs +11 -5
- package/dist/development/core/request-routing/interceptors/checkout.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/proxy.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/standard-routes.mjs +1 -1
- package/dist/development/core/request-routing/interceptors/standard-routes.mjs.map +1 -1
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs +2 -1
- package/dist/development/core/request-routing/interceptors/url-redirects.mjs.map +1 -1
- package/dist/development/core/request-routing/registered-routes.d.mts +13 -2
- package/dist/development/core/request-routing/registered-routes.mjs +33 -9
- package/dist/development/core/request-routing/registered-routes.mjs.map +1 -1
- package/dist/development/core/request-routing/route-types.d.mts +18 -8
- package/dist/development/core/shop-pay/shop-pay.mjs +5 -4
- package/dist/development/core/shop-pay/shop-pay.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/analytics.mjs +3 -5
- package/dist/development/core/shopify-scripts/analytics.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/constants.mjs +3 -1
- package/dist/development/core/shopify-scripts/constants.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/global.mjs +13 -11
- package/dist/development/core/shopify-scripts/global.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/hashes.d.mts +17 -0
- package/dist/development/core/shopify-scripts/hashes.mjs +12 -0
- package/dist/development/core/shopify-scripts/hashes.mjs.map +1 -0
- package/dist/development/core/shopify-scripts/index.d.mts +1 -0
- package/dist/development/core/shopify-scripts/index.mjs +12 -9
- package/dist/development/core/shopify-scripts/index.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/page-view.mjs +4 -1
- package/dist/development/core/shopify-scripts/page-view.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/perfkit.mjs +8 -2
- package/dist/development/core/shopify-scripts/perfkit.mjs.map +1 -1
- package/dist/development/core/shopify-scripts/types.d.mts +4 -2
- package/dist/development/core/shopify-scripts/utils/inline-script.mjs +4 -1
- package/dist/development/core/shopify-scripts/utils/inline-script.mjs.map +1 -1
- package/dist/development/core/standard-routes/build.d.mts +7 -2
- package/dist/development/core/standard-routes/build.mjs +10 -3
- package/dist/development/core/standard-routes/build.mjs.map +1 -1
- package/dist/development/core/standard-routes/match.mjs +11 -1
- package/dist/development/core/standard-routes/match.mjs.map +1 -1
- package/dist/development/core/standard-routes/path.mjs +14 -3
- package/dist/development/core/standard-routes/path.mjs.map +1 -1
- package/dist/development/core/standard-routes/types.d.mts +6 -1
- package/dist/development/core/url.mjs +5 -3
- package/dist/development/core/url.mjs.map +1 -1
- package/dist/development/core/utils/load-script.mjs +6 -6
- package/dist/development/core/utils/load-script.mjs.map +1 -1
- package/dist/development/customer-account/session.mjs.map +1 -1
- package/dist/development/globals.d.mts +8 -4
- package/dist/development/graphql/type-resolver.d.mts +39 -1
- package/dist/development/react/cart.mjs +79 -25
- package/dist/development/react/cart.mjs.map +1 -1
- package/dist/development/react/index.d.mts +2 -2
- package/dist/globals.d.mts +8 -4
- package/dist/graphql/type-resolver.d.mts +39 -1
- package/dist/react/cart.mjs +79 -25
- package/dist/react/cart.mjs.map +1 -1
- package/dist/react/index.d.mts +2 -2
- package/dist/vite/index.d.mts +11 -1
- package/dist/vite/index.mjs +21 -1
- package/dist/vite/index.mjs.map +1 -0
- package/package.json +13 -3
- package/skills/hydrogen-analytics/SKILL.md +2 -2
- package/skills/hydrogen-analytics/references/react.md +2 -2
- package/skills/hydrogen-cart-ui/SKILL.md +2 -2
- package/skills/hydrogen-markets/SKILL.md +127 -93
- package/skills/hydrogen-markets/references/nextjs.md +77 -87
- package/skills/hydrogen-oxygen/references/react-router.md +1 -2
- package/skills/hydrogen-predictive-search/SKILL.md +18 -1
- package/skills/hydrogen-request-handlers/SKILL.md +24 -6
- package/skills/hydrogen-request-handlers/references/content-security-policy.md +103 -0
- package/skills/hydrogen-request-handlers/references/frameworks.md +9 -12
- package/skills/hydrogen-request-handlers/references/nextjs.md +7 -3
- package/skills/hydrogen-request-handlers/references/nuxt.md +7 -7
- package/skills/hydrogen-robots-txt/SKILL.md +87 -0
- package/skills/hydrogen-routing/SKILL.md +36 -14
- package/skills/hydrogen-setup/SKILL.md +2 -2
- package/skills/hydrogen-setup/references/analytics.md +5 -5
- package/skills/hydrogen-setup/steps/2-scaffold.md +3 -0
- package/skills/hydrogen-setup/steps/7-shopify-runtime-scripts.md +4 -3
- package/skills/hydrogen-setup/steps/9-account-page.md +1 -1
- package/skills/hydrogen-smoke-test/SKILL.md +9 -2
- package/skills/hydrogen-storefront-client/SKILL.md +29 -9
- package/skills/hydrogen-storefront-client/references/astro.md +8 -3
- package/skills/hydrogen-storefront-client/references/caching.md +2 -0
- package/skills/hydrogen-storefront-client/references/nextjs.md +8 -3
- package/skills/hydrogen-storefront-client/references/nuxt.md +9 -5
- package/skills/hydrogen-storefront-client/references/react-router.md +6 -3
- package/skills/hydrogen-storefront-client/references/solidstart.md +6 -2
- package/skills/hydrogen-storefront-client/references/sveltekit.md +10 -4
- package/skills/migrate-to-hydrogen-2026-10/SKILL.md +20 -22
- package/skills/migrate-to-hydrogen-2026-10/references/sitemap-and-seo.md +1 -0
- package/skills/migrate-to-hydrogen-2026-10/references/typescript-and-gql-tada.md +1 -1
|
@@ -11,7 +11,12 @@ function getCartIdFromCookie(input) {
|
|
|
11
11
|
if (!header) return null;
|
|
12
12
|
const match = header.match(new RegExp(`(?:^|;\\s*)${COOKIE_NAME}=([^;]*)`));
|
|
13
13
|
if (!match || !match[1]) return null;
|
|
14
|
-
|
|
14
|
+
let token;
|
|
15
|
+
try {
|
|
16
|
+
token = decodeURIComponent(match[1]);
|
|
17
|
+
} catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
15
20
|
if (!token) return null;
|
|
16
21
|
return normalizeCartId(token);
|
|
17
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie.mjs","names":[],"sources":["../../../../src/core/cart/cookie.ts"],"sourcesContent":["const COOKIE_NAME = \"cart\";\nconst MAX_AGE_IN_SECONDS = 1209600; // 14 days\nconst CART_GID_PREFIX = \"gid://shopify/Cart/\";\n\ntype CartCookieSource = Request | { cookie?: string };\n\nexport function normalizeCartId(cartId: string | null | undefined): string | null {\n if (!cartId) return null;\n return cartId.startsWith(CART_GID_PREFIX) ? cartId : CART_GID_PREFIX + cartId;\n}\n\nexport function getCartIdFromCookie(input: CartCookieSource): string | null {\n const header = input instanceof Request ? input.headers.get(\"cookie\") : input.cookie;\n if (!header) return null;\n\n const match = header.match(new RegExp(`(?:^|;\\\\s*)${COOKIE_NAME}=([^;]*)`));\n if (!match || !match[1]) return null;\n\n
|
|
1
|
+
{"version":3,"file":"cookie.mjs","names":[],"sources":["../../../../src/core/cart/cookie.ts"],"sourcesContent":["const COOKIE_NAME = \"cart\";\nconst MAX_AGE_IN_SECONDS = 1209600; // 14 days\nconst CART_GID_PREFIX = \"gid://shopify/Cart/\";\n\ntype CartCookieSource = Request | { cookie?: string };\n\nexport function normalizeCartId(cartId: string | null | undefined): string | null {\n if (!cartId) return null;\n return cartId.startsWith(CART_GID_PREFIX) ? cartId : CART_GID_PREFIX + cartId;\n}\n\nexport function getCartIdFromCookie(input: CartCookieSource): string | null {\n const header = input instanceof Request ? input.headers.get(\"cookie\") : input.cookie;\n if (!header) return null;\n\n const match = header.match(new RegExp(`(?:^|;\\\\s*)${COOKIE_NAME}=([^;]*)`));\n if (!match || !match[1]) return null;\n\n let token: string;\n try {\n token = decodeURIComponent(match[1]);\n } catch {\n // Treat a malformed cookie value as a missing cart instead of failing the request.\n return null;\n }\n if (!token) return null;\n\n return normalizeCartId(token);\n}\n\n/**\n * Creates the `Set-Cookie` header value that stores the cart ID in the `cart` cookie.\n *\n * The cookie holds the cart token without the `gid://shopify/Cart/` prefix and expires\n * after 14 days. The cookie sets `Path=/` and `SameSite=Lax`, and leaves out `HttpOnly`\n * and `Secure`. Append the value to the response headers to keep the response's\n * other cookies.\n *\n * @param cartId The cart GID or cart token to store.\n * @returns The header value that sets the `cart` cookie.\n * @example\n * ```ts\n * const cookie = createCartCookie(\"gid://shopify/Cart/abc123\");\n * // \"cart=abc123; Path=/; SameSite=Lax; Max-Age=1209600\"\n *\n * headers.append(\"Set-Cookie\", cookie);\n * ```\n * @publicDocs\n */\nexport function createCartCookie(cartId: string): string {\n const token = cartId.startsWith(CART_GID_PREFIX) ? cartId.slice(CART_GID_PREFIX.length) : cartId;\n const encoded = encodeURIComponent(token);\n return `${COOKIE_NAME}=${encoded}; Path=/; SameSite=Lax; Max-Age=${MAX_AGE_IN_SECONDS}`;\n}\n\nexport function createExpiredCartCookie(): string {\n return `${COOKIE_NAME}=; Path=/; SameSite=Lax; Max-Age=0`;\n}\n"],"mappings":";AAAA,MAAM,cAAc;AACpB,MAAM,qBAAqB;AAC3B,MAAM,kBAAkB;AAIxB,SAAgB,gBAAgB,QAAkD;AAChF,KAAI,CAAC,OAAQ,QAAO;AACpB,QAAO,OAAO,WAAW,gBAAgB,GAAG,SAAS,kBAAkB;;AAGzE,SAAgB,oBAAoB,OAAwC;CAC1E,MAAM,SAAS,iBAAiB,UAAU,MAAM,QAAQ,IAAI,SAAS,GAAG,MAAM;AAC9E,KAAI,CAAC,OAAQ,QAAO;CAEpB,MAAM,QAAQ,OAAO,MAAM,IAAI,OAAO,cAAc,YAAY,UAAU,CAAC;AAC3E,KAAI,CAAC,SAAS,CAAC,MAAM,GAAI,QAAO;CAEhC,IAAI;AACJ,KAAI;AACF,UAAQ,mBAAmB,MAAM,GAAG;SAC9B;AAEN,SAAO;;AAET,KAAI,CAAC,MAAO,QAAO;AAEnB,QAAO,gBAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;AAsB/B,SAAgB,iBAAiB,QAAwB;CACvD,MAAM,QAAQ,OAAO,WAAW,gBAAgB,GAAG,OAAO,MAAM,GAAuB,GAAG;AAE1F,QAAO,GAAG,YAAY,GADN,mBAAmB,MACH,CAAC,kCAAkC;;AAGrE,SAAgB,0BAAkC;AAChD,QAAO,GAAG,YAAY"}
|
|
@@ -16,6 +16,21 @@ interface SetButtonAttributes {
|
|
|
16
16
|
/** Hides the button from view. */
|
|
17
17
|
hidden: true;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* HTML attributes for the submit button that removes a line from the cart.
|
|
21
|
+
*
|
|
22
|
+
* `register("remove")` returns the attributes. Removing a line reads only the line ID, so the button skips form validation. Invalid text in the line's quantity input doesn't block the removal.
|
|
23
|
+
*
|
|
24
|
+
* @publicDocs
|
|
25
|
+
*/
|
|
26
|
+
interface RemoveButtonAttributes {
|
|
27
|
+
/** The form field that names the cart change. */
|
|
28
|
+
name: "intent";
|
|
29
|
+
/** Removes the line. */
|
|
30
|
+
value: "remove";
|
|
31
|
+
/** Submits the form without checking its fields, such as the quantity input's digits-only pattern. */
|
|
32
|
+
formNoValidate: true;
|
|
33
|
+
}
|
|
19
34
|
/**
|
|
20
35
|
* HTML attributes for a quantity input that submits the form when the customer changes the quantity.
|
|
21
36
|
*
|
|
@@ -157,10 +172,7 @@ type CartFormRegister = {
|
|
|
157
172
|
name: "intent";
|
|
158
173
|
value: "decrease";
|
|
159
174
|
};
|
|
160
|
-
(action: "remove"):
|
|
161
|
-
name: "intent";
|
|
162
|
-
value: "remove";
|
|
163
|
-
};
|
|
175
|
+
(action: "remove"): RemoveButtonAttributes;
|
|
164
176
|
(action: "set"): SetButtonAttributes;
|
|
165
177
|
(action: "discount-apply"): {
|
|
166
178
|
name: "intent";
|
|
@@ -201,5 +213,5 @@ type CartFormRegister = {
|
|
|
201
213
|
*/
|
|
202
214
|
declare function createCartFormRegister(): CartFormRegister;
|
|
203
215
|
//#endregion
|
|
204
|
-
export { CartFormRegister, QuantityInputAttributes, SetButtonAttributes, createCartFormRegister };
|
|
216
|
+
export { CartFormRegister, QuantityInputAttributes, RemoveButtonAttributes, SetButtonAttributes, createCartFormRegister };
|
|
205
217
|
//# sourceMappingURL=form.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/core/cart/form.ts"],"sourcesContent":["/**\n * HTML attributes for the hidden submit button that sets a line to the quantity in the form's quantity input.\n *\n * `register(\"set\")` returns the attributes. Make the set button the form's first submit button. A quantity input submits on change only when the set button comes first.\n *\n * @publicDocs\n */\nexport interface SetButtonAttributes {\n /** The form field that names the cart change. */\n name: \"intent\";\n /** Sets the line to the quantity in the form's quantity input. */\n value: \"set\";\n /** Makes the button the one that submits the form when the quantity changes. */\n type: \"submit\";\n /** Hides the button from view. */\n hidden: true;\n}\n\n/**\n * HTML attributes for a quantity input that submits the form when the customer changes the quantity.\n *\n * `register(\"quantity\", { value, interactive: true })` returns the attributes. The input shows a number keyboard on mobile devices and has no spinner arrows.\n *\n * @publicDocs\n */\nexport interface QuantityInputAttributes {\n /** The form field that holds the quantity. */\n name: \"quantity\";\n /** The current quantity as a string. */\n value: string;\n /** Renders a text input, which has no number spinner arrows. */\n type: \"text\";\n /** Shows a numeric keyboard on mobile devices. */\n inputMode: \"numeric\";\n /** Accepts digits only. */\n pattern: string;\n /** Turns off browser autocomplete for the input. */\n autoComplete: \"off\";\n /** Turns off autocorrect for the input. */\n autoCorrect: \"off\";\n}\n\ntype AttributeValueName = `attributes.${string}`;\n\n/**\n * A function that returns the HTML attributes for a cart form field or action button.\n *\n * Pass a field name to get input attributes: `lineId`, `quantity`,\n * `merchandiseId`, `discountCode`, `note`, `attributeValue`, or `sellingPlanId`.\n * Pass an action name to get submit button attributes: `add`,\n * `increase`, `decrease`, `remove`, `set`, `discount-apply`, `discount-remove`,\n * `note-update`, or `attributes-update`.\n *\n * For an attribute value, pass a `key` option. The function names the field `attributes.<key>` and throws a type error when the key is missing or empty. The line ID input is read-only. Add `type=\"hidden\"` to hide the line ID input.\n *\n * @example\n * ```tsx\n * const register = createCartFormRegister();\n *\n * // Line ID field (register returns readOnly; add type=\"hidden\" to hide it)\n * <input {...register(\"lineId\", { value: line.id })} />\n *\n * // Interactive quantity input (pair with attachQuantityInput to auto-submit on change)\n * <input {...register(\"quantity\", { value: line.quantity, interactive: true })} />\n *\n * // Hidden submit button for the \"set\" intent\n * <button {...register(\"set\")} />\n *\n * // Increase quantity button\n * <button {...register(\"increase\")}>+</button>\n * ```\n *\n * @throws A type error when an attribute value has a missing or empty key.\n */\nexport type CartFormRegister = {\n (field: \"lineId\", opts: { value: string }): { name: \"lineId\"; value: string; readOnly: true };\n (field: \"quantity\", opts: { value: number | string; interactive: true }): QuantityInputAttributes;\n (\n field: \"quantity\",\n opts: { value: number | string; interactive?: false },\n ): { name: \"quantity\"; value: string };\n (field: \"quantity\", opts: { defaultValue: number }): { name: \"quantity\"; defaultValue: string };\n (field: \"discountCode\", opts: { value: string }): { name: \"discountCode\"; value: string };\n (\n field: \"discountCode\",\n opts: { defaultValue: string },\n ): { name: \"discountCode\"; defaultValue: string };\n (field: \"merchandiseId\", opts: { value: string }): { name: \"merchandiseId\"; value: string };\n (field: \"note\", opts: { value: string }): { name: \"note\"; value: string };\n (field: \"note\", opts: { defaultValue: string }): { name: \"note\"; defaultValue: string };\n (\n field: \"attributeValue\",\n opts: { key: string; value: string },\n ): { name: AttributeValueName; value: string };\n (\n field: \"attributeValue\",\n opts: { key: string; defaultValue: string },\n ): { name: AttributeValueName; defaultValue: string };\n (field: \"sellingPlanId\", opts: { value: string }): { name: \"sellingPlanId\"; value: string };\n (action: \"add\"): { name: \"intent\"; value: \"add\" };\n (action: \"increase\"): { name: \"intent\"; value: \"increase\" };\n (action: \"decrease\"): { name: \"intent\"; value: \"decrease\" };\n (action: \"remove\"): { name: \"intent\"; value: \"remove\" };\n (action: \"set\"): SetButtonAttributes;\n (action: \"discount-apply\"): { name: \"intent\"; value: \"discount-apply\" };\n (action: \"discount-remove\"): { name: \"intent\"; value: \"discount-remove\" };\n (action: \"note-update\"): { name: \"intent\"; value: \"note-update\" };\n (action: \"attributes-update\"): { name: \"intent\"; value: \"attributes-update\" };\n};\n\nconst FIELD_REGISTERS = new Set([\n \"lineId\",\n \"quantity\",\n \"discountCode\",\n \"merchandiseId\",\n \"note\",\n \"sellingPlanId\",\n]);\n\nconst ATTRIBUTE_VALUE_NAME_PREFIX = \"attributes.\";\n\ntype RegisterOptions = {\n key?: string;\n value?: string | number;\n defaultValue?: string;\n interactive?: boolean;\n};\n\nexport function getCartAttributeFormEntries(\n formData: FormData,\n): Array<{ key: string; value: FormDataEntryValue }> {\n const attributes: Array<{ key: string; value: FormDataEntryValue }> = [];\n for (const [name, value] of formData.entries()) {\n if (!name.startsWith(ATTRIBUTE_VALUE_NAME_PREFIX)) continue;\n attributes.push({ key: name.slice(ATTRIBUTE_VALUE_NAME_PREFIX.length), value });\n }\n return attributes;\n}\n\nfunction createAttributeValueAttributes(opts?: RegisterOptions) {\n if (!opts?.key) throw new TypeError('Cart attribute values require a non-empty \"key\".');\n const name = `${ATTRIBUTE_VALUE_NAME_PREFIX}${opts.key}` as AttributeValueName;\n if (\"defaultValue\" in opts) {\n return { name, defaultValue: String(opts.defaultValue) };\n }\n return { name, value: String(opts.value ?? \"\") };\n}\n\nfunction createFieldAttributes(name: string, opts?: RegisterOptions) {\n if (opts && \"defaultValue\" in opts) {\n return { name, defaultValue: String(opts.defaultValue) };\n }\n\n const value = String(opts?.value ?? \"\");\n\n if (name === \"quantity\" && opts?.interactive) {\n return {\n name: \"quantity\",\n value,\n type: \"text\",\n inputMode: \"numeric\",\n pattern: \"\\\\d+\",\n autoComplete: \"off\",\n autoCorrect: \"off\",\n } satisfies QuantityInputAttributes;\n }\n\n const attrs: Record<string, string | boolean> = { name, value };\n if (name === \"lineId\") attrs.readOnly = true;\n return attrs;\n}\n\n/**\n * Creates a register function that returns the HTML attributes for cart form fields and action buttons.\n *\n * Use the function to build cart forms without a framework binding. In React, `useCartForm` returns a register function and form props for you. To submit an interactive quantity input on change, call `attachQuantityInput`.\n *\n * The register function holds no state. Share one register function across components.\n *\n * @example\n * ```ts\n * const register = createCartFormRegister();\n *\n * const lineIdAttrs = register(\"lineId\", { value: \"gid://shopify/CartLine/123\" });\n * // → { name: \"lineId\", value: \"gid://shopify/CartLine/123\", readOnly: true }\n *\n * const addAttrs = register(\"add\");\n * // → { name: \"intent\", value: \"add\" }\n * ```\n * @returns A register function for cart form fields and action buttons.\n * @publicDocs\n */\nexport function createCartFormRegister(): CartFormRegister {\n return ((nameOrAction: string, opts?: RegisterOptions) => {\n if (nameOrAction === \"attributeValue\") {\n return createAttributeValueAttributes(opts);\n }\n\n if (FIELD_REGISTERS.has(nameOrAction)) {\n return createFieldAttributes(nameOrAction, opts);\n }\n\n if (nameOrAction === \"set\") {\n return {\n name: \"intent\",\n value: \"set\",\n type: \"submit\",\n hidden: true,\n } satisfies SetButtonAttributes;\n }\n\n return { name: \"intent\", value: nameOrAction };\n }) as CartFormRegister;\n}\n"],"mappings":";AA8GA,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,8BAA8B;AASpC,SAAgB,4BACd,UACmD;CACnD,MAAM,aAAgE,EAAE;AACxE,MAAK,MAAM,CAAC,MAAM,UAAU,SAAS,SAAS,EAAE;AAC9C,MAAI,CAAC,KAAK,WAAW,4BAA4B,CAAE;AACnD,aAAW,KAAK;GAAE,KAAK,KAAK,MAAM,GAAmC;GAAE;GAAO,CAAC;;AAEjF,QAAO;;AAGT,SAAS,+BAA+B,MAAwB;AAC9D,KAAI,CAAC,MAAM,IAAK,OAAM,IAAI,UAAU,qDAAmD;CACvF,MAAM,OAAO,GAAG,8BAA8B,KAAK;AACnD,KAAI,kBAAkB,KACpB,QAAO;EAAE;EAAM,cAAc,OAAO,KAAK,aAAa;EAAE;AAE1D,QAAO;EAAE;EAAM,OAAO,OAAO,KAAK,SAAS,GAAG;EAAE;;AAGlD,SAAS,sBAAsB,MAAc,MAAwB;AACnE,KAAI,QAAQ,kBAAkB,KAC5B,QAAO;EAAE;EAAM,cAAc,OAAO,KAAK,aAAa;EAAE;CAG1D,MAAM,QAAQ,OAAO,MAAM,SAAS,GAAG;AAEvC,KAAI,SAAS,cAAc,MAAM,YAC/B,QAAO;EACL,MAAM;EACN;EACA,MAAM;EACN,WAAW;EACX,SAAS;EACT,cAAc;EACd,aAAa;EACd;CAGH,MAAM,QAA0C;EAAE;EAAM;EAAO;AAC/D,KAAI,SAAS,SAAU,OAAM,WAAW;AACxC,QAAO;;;;;;;;;;;;;;;;;;;;;;AAuBT,SAAgB,yBAA2C;AACzD,UAAS,cAAsB,SAA2B;AACxD,MAAI,iBAAiB,iBACnB,QAAO,+BAA+B,KAAK;AAG7C,MAAI,gBAAgB,IAAI,aAAa,CACnC,QAAO,sBAAsB,cAAc,KAAK;AAGlD,MAAI,iBAAiB,MACnB,QAAO;GACL,MAAM;GACN,OAAO;GACP,MAAM;GACN,QAAQ;GACT;AAGH,SAAO;GAAE,MAAM;GAAU,OAAO;GAAc"}
|
|
1
|
+
{"version":3,"file":"form.mjs","names":[],"sources":["../../../../src/core/cart/form.ts"],"sourcesContent":["/**\n * HTML attributes for the hidden submit button that sets a line to the quantity in the form's quantity input.\n *\n * `register(\"set\")` returns the attributes. Make the set button the form's first submit button. A quantity input submits on change only when the set button comes first.\n *\n * @publicDocs\n */\nexport interface SetButtonAttributes {\n /** The form field that names the cart change. */\n name: \"intent\";\n /** Sets the line to the quantity in the form's quantity input. */\n value: \"set\";\n /** Makes the button the one that submits the form when the quantity changes. */\n type: \"submit\";\n /** Hides the button from view. */\n hidden: true;\n}\n\n/**\n * HTML attributes for the submit button that removes a line from the cart.\n *\n * `register(\"remove\")` returns the attributes. Removing a line reads only the line ID, so the button skips form validation. Invalid text in the line's quantity input doesn't block the removal.\n *\n * @publicDocs\n */\nexport interface RemoveButtonAttributes {\n /** The form field that names the cart change. */\n name: \"intent\";\n /** Removes the line. */\n value: \"remove\";\n /** Submits the form without checking its fields, such as the quantity input's digits-only pattern. */\n formNoValidate: true;\n}\n\n/**\n * HTML attributes for a quantity input that submits the form when the customer changes the quantity.\n *\n * `register(\"quantity\", { value, interactive: true })` returns the attributes. The input shows a number keyboard on mobile devices and has no spinner arrows.\n *\n * @publicDocs\n */\nexport interface QuantityInputAttributes {\n /** The form field that holds the quantity. */\n name: \"quantity\";\n /** The current quantity as a string. */\n value: string;\n /** Renders a text input, which has no number spinner arrows. */\n type: \"text\";\n /** Shows a numeric keyboard on mobile devices. */\n inputMode: \"numeric\";\n /** Accepts digits only. */\n pattern: string;\n /** Turns off browser autocomplete for the input. */\n autoComplete: \"off\";\n /** Turns off autocorrect for the input. */\n autoCorrect: \"off\";\n}\n\ntype AttributeValueName = `attributes.${string}`;\n\n/**\n * A function that returns the HTML attributes for a cart form field or action button.\n *\n * Pass a field name to get input attributes: `lineId`, `quantity`,\n * `merchandiseId`, `discountCode`, `note`, `attributeValue`, or `sellingPlanId`.\n * Pass an action name to get submit button attributes: `add`,\n * `increase`, `decrease`, `remove`, `set`, `discount-apply`, `discount-remove`,\n * `note-update`, or `attributes-update`.\n *\n * For an attribute value, pass a `key` option. The function names the field `attributes.<key>` and throws a type error when the key is missing or empty. The line ID input is read-only. Add `type=\"hidden\"` to hide the line ID input.\n *\n * @example\n * ```tsx\n * const register = createCartFormRegister();\n *\n * // Line ID field (register returns readOnly; add type=\"hidden\" to hide it)\n * <input {...register(\"lineId\", { value: line.id })} />\n *\n * // Interactive quantity input (pair with attachQuantityInput to auto-submit on change)\n * <input {...register(\"quantity\", { value: line.quantity, interactive: true })} />\n *\n * // Hidden submit button for the \"set\" intent\n * <button {...register(\"set\")} />\n *\n * // Increase quantity button\n * <button {...register(\"increase\")}>+</button>\n * ```\n *\n * @throws A type error when an attribute value has a missing or empty key.\n */\nexport type CartFormRegister = {\n (field: \"lineId\", opts: { value: string }): { name: \"lineId\"; value: string; readOnly: true };\n (field: \"quantity\", opts: { value: number | string; interactive: true }): QuantityInputAttributes;\n (\n field: \"quantity\",\n opts: { value: number | string; interactive?: false },\n ): { name: \"quantity\"; value: string };\n (field: \"quantity\", opts: { defaultValue: number }): { name: \"quantity\"; defaultValue: string };\n (field: \"discountCode\", opts: { value: string }): { name: \"discountCode\"; value: string };\n (\n field: \"discountCode\",\n opts: { defaultValue: string },\n ): { name: \"discountCode\"; defaultValue: string };\n (field: \"merchandiseId\", opts: { value: string }): { name: \"merchandiseId\"; value: string };\n (field: \"note\", opts: { value: string }): { name: \"note\"; value: string };\n (field: \"note\", opts: { defaultValue: string }): { name: \"note\"; defaultValue: string };\n (\n field: \"attributeValue\",\n opts: { key: string; value: string },\n ): { name: AttributeValueName; value: string };\n (\n field: \"attributeValue\",\n opts: { key: string; defaultValue: string },\n ): { name: AttributeValueName; defaultValue: string };\n (field: \"sellingPlanId\", opts: { value: string }): { name: \"sellingPlanId\"; value: string };\n (action: \"add\"): { name: \"intent\"; value: \"add\" };\n (action: \"increase\"): { name: \"intent\"; value: \"increase\" };\n (action: \"decrease\"): { name: \"intent\"; value: \"decrease\" };\n (action: \"remove\"): RemoveButtonAttributes;\n (action: \"set\"): SetButtonAttributes;\n (action: \"discount-apply\"): { name: \"intent\"; value: \"discount-apply\" };\n (action: \"discount-remove\"): { name: \"intent\"; value: \"discount-remove\" };\n (action: \"note-update\"): { name: \"intent\"; value: \"note-update\" };\n (action: \"attributes-update\"): { name: \"intent\"; value: \"attributes-update\" };\n};\n\nconst FIELD_REGISTERS = new Set([\n \"lineId\",\n \"quantity\",\n \"discountCode\",\n \"merchandiseId\",\n \"note\",\n \"sellingPlanId\",\n]);\n\nconst ATTRIBUTE_VALUE_NAME_PREFIX = \"attributes.\";\n\ntype RegisterOptions = {\n key?: string;\n value?: string | number;\n defaultValue?: string;\n interactive?: boolean;\n};\n\nexport function getCartAttributeFormEntries(\n formData: FormData,\n): Array<{ key: string; value: FormDataEntryValue }> {\n const attributes: Array<{ key: string; value: FormDataEntryValue }> = [];\n for (const [name, value] of formData.entries()) {\n if (!name.startsWith(ATTRIBUTE_VALUE_NAME_PREFIX)) continue;\n attributes.push({ key: name.slice(ATTRIBUTE_VALUE_NAME_PREFIX.length), value });\n }\n return attributes;\n}\n\nfunction createAttributeValueAttributes(opts?: RegisterOptions) {\n if (!opts?.key) throw new TypeError('Cart attribute values require a non-empty \"key\".');\n const name = `${ATTRIBUTE_VALUE_NAME_PREFIX}${opts.key}` as AttributeValueName;\n if (\"defaultValue\" in opts) {\n return { name, defaultValue: String(opts.defaultValue) };\n }\n return { name, value: String(opts.value ?? \"\") };\n}\n\nfunction createFieldAttributes(name: string, opts?: RegisterOptions) {\n if (opts && \"defaultValue\" in opts) {\n return { name, defaultValue: String(opts.defaultValue) };\n }\n\n const value = String(opts?.value ?? \"\");\n\n if (name === \"quantity\" && opts?.interactive) {\n return {\n name: \"quantity\",\n value,\n type: \"text\",\n inputMode: \"numeric\",\n pattern: \"\\\\d+\",\n autoComplete: \"off\",\n autoCorrect: \"off\",\n } satisfies QuantityInputAttributes;\n }\n\n const attrs: Record<string, string | boolean> = { name, value };\n if (name === \"lineId\") attrs.readOnly = true;\n return attrs;\n}\n\n/**\n * Creates a register function that returns the HTML attributes for cart form fields and action buttons.\n *\n * Use the function to build cart forms without a framework binding. In React, `useCartForm` returns a register function and form props for you. To submit an interactive quantity input on change, call `attachQuantityInput`.\n *\n * The register function holds no state. Share one register function across components.\n *\n * @example\n * ```ts\n * const register = createCartFormRegister();\n *\n * const lineIdAttrs = register(\"lineId\", { value: \"gid://shopify/CartLine/123\" });\n * // → { name: \"lineId\", value: \"gid://shopify/CartLine/123\", readOnly: true }\n *\n * const addAttrs = register(\"add\");\n * // → { name: \"intent\", value: \"add\" }\n * ```\n * @returns A register function for cart form fields and action buttons.\n * @publicDocs\n */\nexport function createCartFormRegister(): CartFormRegister {\n return ((nameOrAction: string, opts?: RegisterOptions) => {\n if (nameOrAction === \"attributeValue\") {\n return createAttributeValueAttributes(opts);\n }\n\n if (FIELD_REGISTERS.has(nameOrAction)) {\n return createFieldAttributes(nameOrAction, opts);\n }\n\n if (nameOrAction === \"set\") {\n return {\n name: \"intent\",\n value: \"set\",\n type: \"submit\",\n hidden: true,\n } satisfies SetButtonAttributes;\n }\n\n if (nameOrAction === \"remove\") {\n return {\n name: \"intent\",\n value: \"remove\",\n formNoValidate: true,\n } satisfies RemoveButtonAttributes;\n }\n\n return { name: \"intent\", value: nameOrAction };\n }) as CartFormRegister;\n}\n"],"mappings":";AA8HA,MAAM,kBAAkB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;CACD,CAAC;AAEF,MAAM,8BAA8B;AASpC,SAAgB,4BACd,UACmD;CACnD,MAAM,aAAgE,EAAE;AACxE,MAAK,MAAM,CAAC,MAAM,UAAU,SAAS,SAAS,EAAE;AAC9C,MAAI,CAAC,KAAK,WAAW,4BAA4B,CAAE;AACnD,aAAW,KAAK;GAAE,KAAK,KAAK,MAAM,GAAmC;GAAE;GAAO,CAAC;;AAEjF,QAAO;;AAGT,SAAS,+BAA+B,MAAwB;AAC9D,KAAI,CAAC,MAAM,IAAK,OAAM,IAAI,UAAU,qDAAmD;CACvF,MAAM,OAAO,GAAG,8BAA8B,KAAK;AACnD,KAAI,kBAAkB,KACpB,QAAO;EAAE;EAAM,cAAc,OAAO,KAAK,aAAa;EAAE;AAE1D,QAAO;EAAE;EAAM,OAAO,OAAO,KAAK,SAAS,GAAG;EAAE;;AAGlD,SAAS,sBAAsB,MAAc,MAAwB;AACnE,KAAI,QAAQ,kBAAkB,KAC5B,QAAO;EAAE;EAAM,cAAc,OAAO,KAAK,aAAa;EAAE;CAG1D,MAAM,QAAQ,OAAO,MAAM,SAAS,GAAG;AAEvC,KAAI,SAAS,cAAc,MAAM,YAC/B,QAAO;EACL,MAAM;EACN;EACA,MAAM;EACN,WAAW;EACX,SAAS;EACT,cAAc;EACd,aAAa;EACd;CAGH,MAAM,QAA0C;EAAE;EAAM;EAAO;AAC/D,KAAI,SAAS,SAAU,OAAM,WAAW;AACxC,QAAO;;;;;;;;;;;;;;;;;;;;;;AAuBT,SAAgB,yBAA2C;AACzD,UAAS,cAAsB,SAA2B;AACxD,MAAI,iBAAiB,iBACnB,QAAO,+BAA+B,KAAK;AAG7C,MAAI,gBAAgB,IAAI,aAAa,CACnC,QAAO,sBAAsB,cAAc,KAAK;AAGlD,MAAI,iBAAiB,MACnB,QAAO;GACL,MAAM;GACN,OAAO;GACP,MAAM;GACN,QAAQ;GACT;AAGH,MAAI,iBAAiB,SACnB,QAAO;GACL,MAAM;GACN,OAAO;GACP,gBAAgB;GACjB;AAGH,SAAO;GAAE,MAAM;GAAU,OAAO;GAAc"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Attribute, CartCost, CartData, CartErrorGroup, CartErrorState, CartLine, CartLineConnection, CartLineCost, CartLineMerchandise, CartNetworkEntry, CartPending, CartState, CartUserError, CartWarning, DiscountCode, EMPTY_CART_DATA, EMPTY_CART_STATE, createEmptyCartErrors, createEmptyErrorGroup } from "./state.mjs";
|
|
2
2
|
import { CartActions, CartNetworkError, CartStore, CreateCartStoreOptions, STANDARD_ACTION_TIMEOUT_IN_MS, configureCartEndpoint, createCartStore } from "./cart.mjs";
|
|
3
|
-
import { CartFormRegister, QuantityInputAttributes, SetButtonAttributes, createCartFormRegister } from "./form.mjs";
|
|
3
|
+
import { CartFormRegister, QuantityInputAttributes, RemoveButtonAttributes, SetButtonAttributes, createCartFormRegister } from "./form.mjs";
|
|
4
4
|
import { attachQuantityInput } from "./attach-quantity-input.mjs";
|
|
5
5
|
import { CartAction, CartAttributeInput, CartLineAddInput, CartLineUpdateInput, parseCartRequest } from "./actions.mjs";
|
|
6
6
|
import { cartQueries } from "./queries.mjs";
|