@doswiftly/storefront-sdk 4.4.0 → 4.7.1

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.
Files changed (95) hide show
  1. package/dist/core/cart/types.d.ts +75 -20
  2. package/dist/core/cart/types.d.ts.map +1 -1
  3. package/dist/core/cart/types.js +3 -0
  4. package/dist/core/image.d.ts +24 -2
  5. package/dist/core/image.d.ts.map +1 -1
  6. package/dist/core/image.js +145 -2
  7. package/dist/core/index.d.ts +1 -1
  8. package/dist/core/index.d.ts.map +1 -1
  9. package/dist/core/index.js +2 -0
  10. package/dist/core/operations/cart.d.ts +15 -9
  11. package/dist/core/operations/cart.d.ts.map +1 -1
  12. package/dist/core/operations/cart.js +131 -58
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/package.json +19 -14
  16. package/src/__tests__/contract/storefront-api.contract.test.ts +0 -450
  17. package/src/__tests__/unit/auth-client.test.ts +0 -210
  18. package/src/__tests__/unit/bot-protection.test.ts +0 -461
  19. package/src/__tests__/unit/cart-client.test.ts +0 -233
  20. package/src/__tests__/unit/cart-store.test.ts +0 -349
  21. package/src/__tests__/unit/create-client.test.ts +0 -356
  22. package/src/__tests__/unit/helpers.test.ts +0 -377
  23. package/src/__tests__/unit/middleware.test.ts +0 -374
  24. package/src/__tests__/unit/test-helpers.ts +0 -103
  25. package/src/core/auth/auth-client.ts +0 -123
  26. package/src/core/auth/cookie-config.ts +0 -23
  27. package/src/core/auth/handlers.ts +0 -168
  28. package/src/core/auth/routes.ts +0 -26
  29. package/src/core/auth/token-client.ts +0 -51
  30. package/src/core/auth/types.ts +0 -54
  31. package/src/core/bot-protection/abstract-manager.ts +0 -185
  32. package/src/core/bot-protection/create-manager.ts +0 -37
  33. package/src/core/bot-protection/eucaptcha-manager.ts +0 -88
  34. package/src/core/bot-protection/fallback-manager.ts +0 -43
  35. package/src/core/bot-protection/turnstile-manager.ts +0 -92
  36. package/src/core/bot-protection/types/eucaptcha.d.ts +0 -28
  37. package/src/core/bot-protection/types/turnstile.d.ts +0 -33
  38. package/src/core/cache.ts +0 -102
  39. package/src/core/cart/cart-client.ts +0 -150
  40. package/src/core/cart/cookie-config.ts +0 -13
  41. package/src/core/cart/types.ts +0 -104
  42. package/src/core/client/compose.ts +0 -15
  43. package/src/core/client/create-client.ts +0 -129
  44. package/src/core/client/dedupe.ts +0 -19
  45. package/src/core/client/execute.ts +0 -70
  46. package/src/core/client/hash.ts +0 -21
  47. package/src/core/client/operation-name.ts +0 -12
  48. package/src/core/client/types.ts +0 -171
  49. package/src/core/currency/cookie-config.ts +0 -13
  50. package/src/core/errors.ts +0 -67
  51. package/src/core/format.ts +0 -254
  52. package/src/core/helpers/assert-no-user-errors.ts +0 -21
  53. package/src/core/helpers/normalize-connection.ts +0 -48
  54. package/src/core/helpers/sanitize-html.ts +0 -42
  55. package/src/core/image.ts +0 -22
  56. package/src/core/index.ts +0 -174
  57. package/src/core/language/cookie-config.ts +0 -13
  58. package/src/core/middleware/auth.ts +0 -27
  59. package/src/core/middleware/bot-protection.ts +0 -140
  60. package/src/core/middleware/currency.ts +0 -27
  61. package/src/core/middleware/errors.ts +0 -86
  62. package/src/core/middleware/language.ts +0 -30
  63. package/src/core/middleware/retry.ts +0 -75
  64. package/src/core/middleware/timeout.ts +0 -61
  65. package/src/core/operations/auth.ts +0 -123
  66. package/src/core/operations/cart.ts +0 -185
  67. package/src/index.ts +0 -25
  68. package/src/react/bot-protection/bot-protection-context.ts +0 -17
  69. package/src/react/bot-protection/bot-protection-widget.tsx +0 -46
  70. package/src/react/cookies.ts +0 -89
  71. package/src/react/helpers/create-store-context.ts +0 -56
  72. package/src/react/hooks/use-auth.ts +0 -218
  73. package/src/react/hooks/use-bot-protection.ts +0 -31
  74. package/src/react/hooks/use-cart-manager.ts +0 -236
  75. package/src/react/hooks/use-currency.ts +0 -23
  76. package/src/react/hooks/use-debounced-value.ts +0 -30
  77. package/src/react/hooks/use-hydrated.ts +0 -20
  78. package/src/react/hooks/use-storefront-client.ts +0 -12
  79. package/src/react/index.ts +0 -71
  80. package/src/react/providers/currency-provider.tsx +0 -30
  81. package/src/react/providers/language-provider.tsx +0 -34
  82. package/src/react/providers/storefront-client-provider.tsx +0 -107
  83. package/src/react/providers/storefront-provider.tsx +0 -99
  84. package/src/react/server/get-storefront-client.ts +0 -60
  85. package/src/react/server/index.ts +0 -1
  86. package/src/react/stores/auth.store.ts +0 -112
  87. package/src/react/stores/cart.context.ts +0 -10
  88. package/src/react/stores/cart.store.ts +0 -254
  89. package/src/react/stores/currency.store.ts +0 -93
  90. package/src/react/stores/index.ts +0 -17
  91. package/src/react/stores/language.store.ts +0 -90
  92. package/src/react/stores/store-context.tsx +0 -103
  93. package/src/react/types/shop-config.ts +0 -22
  94. package/tsconfig.json +0 -20
  95. package/vitest.config.ts +0 -14
@@ -2,32 +2,68 @@
2
2
  * Cart types — manual (no codegen).
3
3
  *
4
4
  * These match the backend storefront-graphql Cart type.
5
+ * Keep in sync with SSOT: backend/storefront-graphql/types/cart.types.ts
6
+ *
7
+ * Validate with: pnpm test:contract (cart-operations-drift test)
5
8
  */
6
9
  export interface Money {
7
10
  amount: string;
8
11
  currencyCode: string;
9
12
  }
13
+ /**
14
+ * Price with full currency-conversion transparency.
15
+ *
16
+ * Used for all cart/checkout prices where the customer may be viewing
17
+ * prices converted from the shop's base currency.
18
+ */
19
+ export interface PriceMoney {
20
+ amount: string;
21
+ currencyCode: string;
22
+ baseAmount: string;
23
+ baseCurrencyCode: string;
24
+ exchangeRate: number | null;
25
+ marginApplied: number | null;
26
+ rateTimestamp: string | null;
27
+ isConverted: boolean;
28
+ }
10
29
  export interface CartCost {
11
- totalAmount: Money;
12
- subtotalAmount: Money;
13
- totalTaxAmount: Money | null;
14
- totalDutyAmount: Money | null;
30
+ totalAmount: PriceMoney;
31
+ subtotalAmount: PriceMoney;
32
+ totalTaxAmount: PriceMoney | null;
33
+ totalDutyAmount: PriceMoney | null;
15
34
  }
16
35
  export interface CartLineCost {
17
- totalAmount: Money;
18
- amountPerQuantity: Money;
19
- compareAtAmountPerQuantity: Money | null;
36
+ amountPerQuantity: PriceMoney;
37
+ subtotalAmount: PriceMoney;
38
+ totalAmount: PriceMoney;
39
+ compareAtAmountPerQuantity: PriceMoney | null;
40
+ }
41
+ export interface SelectedOption {
42
+ name: string;
43
+ value: string;
20
44
  }
21
45
  export interface CartLineMerchandise {
22
46
  id: string;
23
47
  title: string;
24
48
  sku: string | null;
49
+ price: PriceMoney;
50
+ originalPrice: Money | null;
51
+ compareAtPrice: PriceMoney | null;
52
+ originalCompareAtPrice: Money | null;
53
+ available: boolean;
54
+ quantityAvailable: number | null;
25
55
  image: {
56
+ id: string | null;
26
57
  url: string;
27
58
  altText: string | null;
59
+ width: number | null;
60
+ height: number | null;
61
+ thumbhash: string | null;
28
62
  } | null;
29
- price: Money;
30
- compareAtPrice: Money | null;
63
+ selectedOptions: SelectedOption[];
64
+ barcode: string | null;
65
+ weight: number | null;
66
+ position: number | null;
31
67
  }
32
68
  export interface CartLine {
33
69
  id: string;
@@ -36,18 +72,20 @@ export interface CartLine {
36
72
  cost: CartLineCost;
37
73
  attributes: Array<{
38
74
  key: string;
39
- value: string;
75
+ value: string | null;
40
76
  }>;
41
- productId: string;
42
- productTitle: string;
43
- productHandle: string;
77
+ productId: string | null;
78
+ productTitle: string | null;
79
+ productHandle: string | null;
80
+ productType: string | null;
44
81
  }
45
82
  export interface CartDiscountCode {
46
83
  code: string;
47
84
  applicable: boolean;
48
85
  }
49
86
  export interface CartDiscountAllocation {
50
- discountedAmount: Money;
87
+ discountCode: string;
88
+ amount: Money;
51
89
  }
52
90
  export interface CartBuyerIdentity {
53
91
  email: string | null;
@@ -62,26 +100,41 @@ export interface Cart {
62
100
  createdAt: string;
63
101
  updatedAt: string;
64
102
  cost: CartCost;
65
- lines: {
66
- edges: Array<{
67
- node: CartLine;
68
- }>;
69
- };
103
+ lines: CartLine[];
70
104
  buyerIdentity: CartBuyerIdentity | null;
71
105
  discountCodes: CartDiscountCode[];
72
106
  discountAllocations: CartDiscountAllocation[];
73
107
  attributes: Array<{
74
108
  key: string;
75
- value: string;
109
+ value: string | null;
76
110
  }>;
77
111
  }
112
+ /**
113
+ * Customer-filled attribute selection submitted with a cart line.
114
+ *
115
+ * Mirror of the GraphQL `AttributeSelectionInput` — one entry per configurator
116
+ * field the shopper filled. Backend validates (required / pattern / option ownership),
117
+ * snapshots name/surcharge/taxRate, and stores them on `cart_items.attribute_selections`.
118
+ *
119
+ * Faza 1: SELECT/RADIO/CHECKBOX use `optionId`; TEXT/TEXTAREA/NUMBER/DATE use `textValue`.
120
+ * Faza 2 will enable `optionIds` for MULTI_SELECT.
121
+ */
122
+ export interface CartAttributeSelectionInput {
123
+ attributeDefinitionId: string;
124
+ optionId?: string | null;
125
+ optionIds?: string[] | null;
126
+ textValue?: string | null;
127
+ }
78
128
  export interface CartLineInput {
79
129
  merchandiseId: string;
80
130
  quantity?: number;
131
+ /** Shopify-style raw Line Item Properties (gift messages, engraving notes, etc.). */
81
132
  attributes?: Array<{
82
133
  key: string;
83
134
  value: string;
84
135
  }>;
136
+ /** Faza 1 — typed customer configurator selections (Finiszer, service phone, etc.). */
137
+ attributeSelections?: CartAttributeSelectionInput[];
85
138
  }
86
139
  export interface CartLineUpdateInput {
87
140
  id: string;
@@ -90,6 +143,8 @@ export interface CartLineUpdateInput {
90
143
  key: string;
91
144
  value: string;
92
145
  }>;
146
+ /** Faza 1 — pass `null` to preserve, `[]` to clear, or array to replace selections. */
147
+ attributeSelections?: CartAttributeSelectionInput[] | null;
93
148
  }
94
149
  export interface CartCreateInput {
95
150
  lines?: CartLineInput[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/cart/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB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;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qFAAqF;IACrF,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,uFAAuF;IACvF,mBAAmB,CAAC,EAAE,2BAA2B,EAAE,CAAC;CACrD;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,uFAAuF;IACvF,mBAAmB,CAAC,EAAE,2BAA2B,EAAE,GAAG,IAAI,CAAC;CAC5D;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,aAAa,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -2,5 +2,8 @@
2
2
  * Cart types — manual (no codegen).
3
3
  *
4
4
  * These match the backend storefront-graphql Cart type.
5
+ * Keep in sync with SSOT: backend/storefront-graphql/types/cart.types.ts
6
+ *
7
+ * Validate with: pnpm test:contract (cart-operations-drift test)
5
8
  */
6
9
  export {};
@@ -1,14 +1,17 @@
1
1
  /**
2
- * Image types for DoSwiftly storefronts.
2
+ * Image types and utilities for DoSwiftly storefronts.
3
3
  *
4
4
  * GraphQL API returns ready-to-use CDN URLs with transform query params.
5
5
  * No client-side loader needed — use `url(transform: { maxWidth: 800 })` in queries.
6
+ *
7
+ * imgproxy auto-negotiates AVIF/WEBP from browser Accept header (IMGPROXY_AUTO_AVIF=true).
8
+ * Do NOT hardcode preferredContentType — let CDN serve the best format.
6
9
  */
7
10
  /**
8
11
  * Image data from GraphQL API (matches Image type in storefront schema).
9
12
  */
10
13
  export interface ImageData {
11
- /** Image URL from GraphQL (ready-to-use CDN URL, optionally with transform query params) */
14
+ /** Image URL from GraphQL (ready-to-use CDN URL with transform query params) */
12
15
  url: string;
13
16
  /** Alt text for accessibility + SEO */
14
17
  altText?: string | null;
@@ -18,5 +21,24 @@ export interface ImageData {
18
21
  height?: number | null;
19
22
  /** Image ID */
20
23
  id?: string | null;
24
+ /** ThumbHash placeholder (base64-encoded ~40 chars). Decode with thumbHashToDataURL() for blur preview. */
25
+ thumbhash?: string | null;
21
26
  }
27
+ /**
28
+ * Decode a base64-encoded ThumbHash to a data URL for use as a blur placeholder.
29
+ *
30
+ * Typical usage with Next.js Image:
31
+ * ```tsx
32
+ * <Image
33
+ * src={image.url}
34
+ * alt={image.altText}
35
+ * placeholder={blurUrl ? "blur" : undefined}
36
+ * blurDataURL={blurUrl}
37
+ * />
38
+ * ```
39
+ *
40
+ * @param base64Hash - Base64-encoded ThumbHash string from GraphQL `Image.thumbhash`
41
+ * @returns `data:image/bmp;base64,...` URL, or `undefined` if input is falsy
42
+ */
43
+ export declare function thumbHashToDataURL(base64Hash: string | null | undefined): string | undefined;
22
44
  //# sourceMappingURL=image.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/core/image.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,4FAA4F;IAC5F,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB"}
1
+ {"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/core/image.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,eAAe;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,2GAA2G;IAC3G,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAiD5F"}
@@ -1,7 +1,150 @@
1
1
  /**
2
- * Image types for DoSwiftly storefronts.
2
+ * Image types and utilities for DoSwiftly storefronts.
3
3
  *
4
4
  * GraphQL API returns ready-to-use CDN URLs with transform query params.
5
5
  * No client-side loader needed — use `url(transform: { maxWidth: 800 })` in queries.
6
+ *
7
+ * imgproxy auto-negotiates AVIF/WEBP from browser Accept header (IMGPROXY_AUTO_AVIF=true).
8
+ * Do NOT hardcode preferredContentType — let CDN serve the best format.
9
+ */
10
+ // ---------------------------------------------------------------------------
11
+ // ThumbHash decoder (client-side) — algorithm by Evan Wallace
12
+ // Pure math, zero dependencies, framework-agnostic.
13
+ // ---------------------------------------------------------------------------
14
+ /**
15
+ * Decode a base64-encoded ThumbHash to a data URL for use as a blur placeholder.
16
+ *
17
+ * Typical usage with Next.js Image:
18
+ * ```tsx
19
+ * <Image
20
+ * src={image.url}
21
+ * alt={image.altText}
22
+ * placeholder={blurUrl ? "blur" : undefined}
23
+ * blurDataURL={blurUrl}
24
+ * />
25
+ * ```
26
+ *
27
+ * @param base64Hash - Base64-encoded ThumbHash string from GraphQL `Image.thumbhash`
28
+ * @returns `data:image/bmp;base64,...` URL, or `undefined` if input is falsy
6
29
  */
7
- export {};
30
+ export function thumbHashToDataURL(base64Hash) {
31
+ if (!base64Hash)
32
+ return undefined;
33
+ try {
34
+ const hash = Uint8Array.from(atob(base64Hash), (c) => c.charCodeAt(0));
35
+ const { w, h, rgba } = decodeThumbHash(hash);
36
+ // Encode as BMP (simpler than PNG, works in data URLs, supports alpha)
37
+ const headerSize = 122;
38
+ const rowPad = (4 - ((w * 4) % 4)) % 4;
39
+ const bmpSize = headerSize + (w * 4 + rowPad) * h;
40
+ const bmp = new Uint8Array(bmpSize);
41
+ const view = new DataView(bmp.buffer);
42
+ // BMP file header
43
+ bmp[0] = 0x42;
44
+ bmp[1] = 0x4d; // 'BM'
45
+ view.setUint32(2, bmpSize, true);
46
+ view.setUint32(10, headerSize, true);
47
+ // DIB header (BITMAPV4HEADER)
48
+ view.setUint32(14, 108, true);
49
+ view.setInt32(18, w, true);
50
+ view.setInt32(22, -h, true); // top-down
51
+ view.setUint16(26, 1, true); // planes
52
+ view.setUint16(28, 32, true); // bpp
53
+ view.setUint32(30, 3, true); // BI_BITFIELDS
54
+ view.setUint32(54, 0x00ff0000, true); // red mask
55
+ view.setUint32(58, 0x0000ff00, true); // green mask
56
+ view.setUint32(62, 0x000000ff, true); // blue mask
57
+ view.setUint32(66, 0xff000000, true); // alpha mask
58
+ // Pixel data (BGRA)
59
+ let offset = headerSize;
60
+ for (let y = 0; y < h; y++) {
61
+ for (let x = 0; x < w; x++) {
62
+ const i = (y * w + x) * 4;
63
+ bmp[offset++] = rgba[i + 2]; // B
64
+ bmp[offset++] = rgba[i + 1]; // G
65
+ bmp[offset++] = rgba[i]; // R
66
+ bmp[offset++] = rgba[i + 3]; // A
67
+ }
68
+ offset += rowPad;
69
+ }
70
+ return `data:image/bmp;base64,${btoa(String.fromCharCode(...bmp))}`;
71
+ }
72
+ catch {
73
+ return undefined;
74
+ }
75
+ }
76
+ /** Decode ThumbHash bytes to RGBA pixels. */
77
+ function decodeThumbHash(hash) {
78
+ const { PI, min, max, cos, round } = Math;
79
+ const h24 = hash[0] | (hash[1] << 8) | (hash[2] << 16);
80
+ const h16 = hash[3] | (hash[4] << 8);
81
+ const lDC = (h24 & 63) / 63;
82
+ const pDC = ((h24 >> 6) & 63) / 31.5 - 1;
83
+ const qDC = ((h24 >> 12) & 63) / 31.5 - 1;
84
+ const lScale = ((h24 >> 18) & 31) / 31;
85
+ const hasAlpha = (h24 >> 23) !== 0;
86
+ const pScale = ((h16 >> 3) & 63) / 63;
87
+ const qScale = ((h16 >> 9) & 63) / 63;
88
+ const isLandscape = (h16 >> 15) !== 0;
89
+ const lx = max(3, isLandscape ? (hasAlpha ? 5 : 7) : h16 & 7);
90
+ const ly = max(3, isLandscape ? (h16 & 7) : hasAlpha ? 5 : 7);
91
+ let aDC = 1;
92
+ let aScale = 1;
93
+ if (hasAlpha) {
94
+ aDC = (hash[5] & 15) / 15;
95
+ aScale = (hash[5] >> 4) / 15;
96
+ }
97
+ // Extract AC coefficients from nibbles
98
+ const readAC = (start, count) => {
99
+ const result = [];
100
+ for (let i = 0; i < count; i++) {
101
+ const idx = start + i;
102
+ const data = hash[idx >> 1];
103
+ result.push(((idx & 1) !== 0 ? data >> 4 : data & 15) / 7.5 - 1);
104
+ }
105
+ return result;
106
+ };
107
+ const acStart = hasAlpha ? 12 : 10;
108
+ const lCount = lx * ly - 1;
109
+ const pCount = 8; // 3*3 - 1
110
+ const qCount = 8;
111
+ const aCount = hasAlpha ? 24 : 0; // 5*5 - 1
112
+ const lAC = readAC(acStart, lCount);
113
+ const pAC = readAC(acStart + lCount, pCount);
114
+ const qAC = readAC(acStart + lCount + pCount, qCount);
115
+ const aAC = hasAlpha ? readAC(acStart + lCount + pCount + qCount, aCount) : [];
116
+ const ratio = (isLandscape ? ly : lx) / (isLandscape ? lx : ly);
117
+ const w = round(ratio > 1 ? 32 : 32 * ratio);
118
+ const h = round(ratio > 1 ? 32 / ratio : 32);
119
+ const rgba = new Uint8Array(w * h * 4);
120
+ const decode = (dc, ac, scale, nx, ny, x, y) => {
121
+ let v = dc;
122
+ let n = 0;
123
+ for (let cy = 0; cy < ny; cy++) {
124
+ for (let cx = 0; cx * ny < nx * (ny - cy); cx++) {
125
+ if (cx > 0 || cy > 0) {
126
+ v += ac[n] * scale * cos((PI / w) * x * (cx + 0.5)) * cos((PI / h) * y * (cy + 0.5));
127
+ n++;
128
+ }
129
+ }
130
+ }
131
+ return v;
132
+ };
133
+ for (let y = 0; y < h; y++) {
134
+ for (let x = 0; x < w; x++) {
135
+ const l = decode(lDC, lAC, lScale, lx, ly, x, y);
136
+ const p = decode(pDC, pAC, pScale, 3, 3, x, y);
137
+ const q = decode(qDC, qAC, qScale, 3, 3, x, y);
138
+ const a = hasAlpha ? decode(aDC, aAC, aScale, 5, 5, x, y) : 1;
139
+ const b = l - (2 / 3) * p;
140
+ const r = (3 * l - b + q) / 2;
141
+ const g = r - q;
142
+ const i = (y * w + x) * 4;
143
+ rgba[i] = max(0, 255 * min(1, r));
144
+ rgba[i + 1] = max(0, 255 * min(1, g));
145
+ rgba[i + 2] = max(0, 255 * min(1, b));
146
+ rgba[i + 3] = max(0, 255 * min(1, a));
147
+ }
148
+ }
149
+ return { w, h, rgba };
150
+ }
@@ -61,7 +61,7 @@ export { CART_COOKIE_NAME, CART_COOKIE_MAX_AGE } from './cart/cookie-config';
61
61
  export { matchesRoute, type RouteProtectionConfig } from './auth/routes';
62
62
  export { createSetTokenHandler, createClearTokenHandler } from './auth/handlers';
63
63
  export { createAuthTokenClient, type AuthTokenClient } from './auth/token-client';
64
- export { type ImageData } from './image';
64
+ export { type ImageData, thumbHashToDataURL } from './image';
65
65
  export { getOperationName } from './client/operation-name';
66
66
  export { hashQuery } from './client/hash';
67
67
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,YAAY,EACV,gBAAgB,EAChB,sBAAsB,EACtB,UAAU,EACV,SAAS,EACT,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACnC,KAAK,YAAY,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,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,UAAU,GAChB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAG/G,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAG/G,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG7E,OAAO,EAAE,YAAY,EAAE,KAAK,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGzE,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAGjF,OAAO,EAAE,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGlF,OAAO,EAAE,KAAK,SAAS,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC"}
@@ -74,6 +74,8 @@ export { matchesRoute } from './auth/routes';
74
74
  export { createSetTokenHandler, createClearTokenHandler } from './auth/handlers';
75
75
  // Auth token client (client-side fetch helpers)
76
76
  export { createAuthTokenClient } from './auth/token-client';
77
+ // Image types (loaders removed — GraphQL returns ready-to-use CDN URLs with transform params)
78
+ export { thumbHashToDataURL } from './image';
77
79
  // Utilities
78
80
  export { getOperationName } from './client/operation-name';
79
81
  export { hashQuery } from './client/hash';
@@ -1,15 +1,21 @@
1
1
  /**
2
2
  * Cart GraphQL operations — manual query strings (no codegen).
3
3
  *
4
- * These match the backend storefront-graphql schema exactly.
4
+ * SSOT: packages/backend/src/commerce/storefront-graphql/operations/
5
+ * - fragments.graphql (CartCost, CartLineCost, CartLine, Cart, etc.)
6
+ * - queries.graphql (Cart query)
7
+ * - mutations.graphql (cartCreate, cartLinesAdd, etc.)
8
+ *
9
+ * Validate drift: pnpm test:contract (cart-operations-drift test)
10
+ *
5
11
  * Cart mutations always return full Cart + userErrors.
6
12
  */
7
- export declare const CART_QUERY = "\n query Cart($id: ID!) {\n cart(id: $id) {\n ...CartFields\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n";
8
- export declare const CART_CREATE = "\n mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart { ...CartFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
9
- export declare const CART_LINES_ADD = "\n mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart { ...CartFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
10
- export declare const CART_LINES_UPDATE = "\n mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { ...CartFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
11
- export declare const CART_LINES_REMOVE = "\n mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { ...CartFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
12
- export declare const CART_DISCOUNT_CODES_UPDATE = "\n mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart { ...CartFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
13
- export declare const CART_NOTE_UPDATE = "\n mutation CartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { ...CartFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
14
- export declare const CART_BUYER_IDENTITY_UPDATE = "\n mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart { ...CartFields }\n userErrors { ...UserErrorFields }\n }\n }\n \n fragment CartFields on Cart {\n id\n checkoutUrl\n totalQuantity\n note\n createdAt\n updatedAt\n cost { ...CartCost }\n lines(first: 100) {\n edges {\n node { ...CartLineFields }\n }\n }\n buyerIdentity {\n email\n phone\n countryCode\n }\n discountCodes {\n code\n applicable\n }\n discountAllocations {\n discountedAmount { ...Money }\n }\n attributes { key value }\n }\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment CartCost on CartCost {\n totalAmount { ...Money }\n subtotalAmount { ...Money }\n totalTaxAmount { ...Money }\n totalDutyAmount { ...Money }\n }\n\n \n fragment CartLineFields on CartLine {\n id\n quantity\n merchandise {\n id\n title\n sku\n image { url altText }\n price { ...Money }\n compareAtPrice { ...Money }\n }\n cost {\n totalAmount { ...Money }\n amountPerQuantity { ...Money }\n compareAtAmountPerQuantity { ...Money }\n }\n attributes { key value }\n productId\n productTitle\n productHandle\n }\n\n\n \n fragment UserErrorFields on UserError {\n message\n field\n code\n }\n\n";
13
+ export declare const CART_QUERY = "\n query Cart($id: ID!) {\n cart(id: $id) {\n ...Cart\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n";
14
+ export declare const CART_CREATE = "\n mutation CartCreate($input: CartCreateInput) {\n cartCreate(input: $input) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
15
+ export declare const CART_LINES_ADD = "\n mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {\n cartLinesAdd(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
16
+ export declare const CART_LINES_UPDATE = "\n mutation CartLinesUpdate($cartId: ID!, $lines: [CartLineUpdateInput!]!) {\n cartLinesUpdate(cartId: $cartId, lines: $lines) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
17
+ export declare const CART_LINES_REMOVE = "\n mutation CartLinesRemove($cartId: ID!, $lineIds: [ID!]!) {\n cartLinesRemove(cartId: $cartId, lineIds: $lineIds) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
18
+ export declare const CART_DISCOUNT_CODES_UPDATE = "\n mutation CartDiscountCodesUpdate($cartId: ID!, $discountCodes: [String!]!) {\n cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
19
+ export declare const CART_NOTE_UPDATE = "\n mutation CartNoteUpdate($cartId: ID!, $note: String!) {\n cartNoteUpdate(cartId: $cartId, note: $note) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
20
+ export declare const CART_BUYER_IDENTITY_UPDATE = "\n mutation CartBuyerIdentityUpdate($cartId: ID!, $buyerIdentity: CartBuyerIdentityInput!) {\n cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {\n cart { ...Cart }\n userErrors { ...UserError }\n }\n }\n \n fragment Cart on Cart {\n id\n checkoutUrl\n totalQuantity\n cost { ...CartCost }\n lines(first: 100) { ...CartLine }\n buyerIdentity { ...CartBuyerIdentity }\n discountCodes { ...CartDiscountCode }\n discountAllocations { ...CartDiscountAllocation }\n note\n attributes { key value }\n createdAt\n updatedAt\n }\n \n fragment CartCost on CartCost {\n totalAmount { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalTaxAmount { ...PriceMoney }\n totalDutyAmount { ...PriceMoney }\n }\n\n \n fragment CartLine on CartLine {\n id\n quantity\n merchandise { ...ProductVariant }\n cost { ...CartLineCost }\n attributes { key value }\n productId\n productTitle\n productHandle\n productType\n }\n \n fragment CartLineCost on CartLineCost {\n amountPerQuantity { ...PriceMoney }\n subtotalAmount { ...PriceMoney }\n totalAmount { ...PriceMoney }\n compareAtAmountPerQuantity { ...PriceMoney }\n }\n\n \n fragment ProductVariant on ProductVariant {\n id\n title\n sku\n price { ...PriceMoney }\n originalPrice { ...Money }\n compareAtPrice { ...PriceMoney }\n originalCompareAtPrice { ...Money }\n available\n quantityAvailable\n image { ...Image }\n selectedOptions { ...SelectedOption }\n barcode\n weight\n position\n }\n \n fragment PriceMoney on PriceMoney {\n ...Price\n baseAmount\n baseCurrencyCode\n exchangeRate\n marginApplied\n rateTimestamp\n isConverted\n }\n \n fragment Price on PriceMoney {\n amount\n currencyCode\n }\n\n\n \n fragment Money on Money {\n amount\n currencyCode\n }\n\n \n fragment Image on Image {\n id\n url(transform: { maxWidth: 300 })\n altText\n width\n height\n thumbhash\n }\n\n \n fragment SelectedOption on SelectedOption {\n name\n value\n }\n\n\n\n \n fragment CartBuyerIdentity on CartBuyerIdentity {\n email\n phone\n countryCode\n }\n\n \n fragment CartDiscountCode on CartDiscountCode {\n code\n applicable\n }\n\n \n fragment CartDiscountAllocation on CartDiscountAllocation {\n discountCode\n amount { ...Money }\n }\n\n\n \n fragment UserError on UserError {\n message\n code\n field\n }\n\n";
15
21
  //# sourceMappingURL=cart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../../src/core/operations/cart.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2FH,eAAO,MAAM,UAAU,quCAOtB,CAAC;AAMF,eAAO,MAAM,WAAW,m5CASvB,CAAC;AAEF,eAAO,MAAM,cAAc,w7CAS1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,o8CAS7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,y7CAS7B,CAAC;AAEF,eAAO,MAAM,0BAA0B,+9CAStC,CAAC;AAEF,eAAO,MAAM,gBAAgB,+6CAS5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4+CAStC,CAAC"}
1
+ {"version":3,"file":"cart.d.ts","sourceRoot":"","sources":["../../../src/core/operations/cart.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAwKH,eAAO,MAAM,UAAU,iwEAOtB,CAAC;AAMF,eAAO,MAAM,WAAW,m6EASvB,CAAC;AAEF,eAAO,MAAM,cAAc,w8EAS1B,CAAC;AAEF,eAAO,MAAM,iBAAiB,o9EAS7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,y8EAS7B,CAAC;AAEF,eAAO,MAAM,0BAA0B,++EAStC,CAAC;AAEF,eAAO,MAAM,gBAAgB,+7EAS5B,CAAC;AAEF,eAAO,MAAM,0BAA0B,4/EAStC,CAAC"}