@doswiftly/storefront-sdk 14.0.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +294 -0
  2. package/README.md +28 -0
  3. package/dist/core/auth/auth-client.d.ts +13 -1
  4. package/dist/core/auth/auth-client.d.ts.map +1 -1
  5. package/dist/core/auth/auth-client.js +16 -1
  6. package/dist/core/auth/types.d.ts +18 -52
  7. package/dist/core/auth/types.d.ts.map +1 -1
  8. package/dist/core/auth/types.js +0 -3
  9. package/dist/core/cart/cart-client.d.ts +50 -1
  10. package/dist/core/cart/cart-client.d.ts.map +1 -1
  11. package/dist/core/cart/cart-client.js +63 -1
  12. package/dist/core/cart/types.d.ts +75 -391
  13. package/dist/core/cart/types.d.ts.map +1 -1
  14. package/dist/core/cart/types.js +0 -8
  15. package/dist/core/format.d.ts +81 -46
  16. package/dist/core/format.d.ts.map +1 -1
  17. package/dist/core/format.js +116 -94
  18. package/dist/core/generated/operation-types.d.ts +4486 -0
  19. package/dist/core/generated/operation-types.d.ts.map +1 -0
  20. package/dist/core/generated/operation-types.js +4 -0
  21. package/dist/core/index.d.ts +3 -3
  22. package/dist/core/index.d.ts.map +1 -1
  23. package/dist/core/index.js +1 -1
  24. package/dist/core/operations/auth.d.ts +7 -0
  25. package/dist/core/operations/auth.d.ts.map +1 -1
  26. package/dist/core/operations/auth.js +68 -0
  27. package/dist/core/operations/cart.d.ts +30 -0
  28. package/dist/core/operations/cart.d.ts.map +1 -1
  29. package/dist/core/operations/cart.js +158 -0
  30. package/dist/react/components/Money.d.ts +22 -8
  31. package/dist/react/components/Money.d.ts.map +1 -1
  32. package/dist/react/components/Money.js +16 -9
  33. package/dist/react/hooks/use-cart.d.ts +78 -0
  34. package/dist/react/hooks/use-cart.d.ts.map +1 -0
  35. package/dist/react/hooks/use-cart.js +121 -0
  36. package/dist/react/hooks/use-format.d.ts +85 -0
  37. package/dist/react/hooks/use-format.d.ts.map +1 -0
  38. package/dist/react/hooks/use-format.js +141 -0
  39. package/dist/react/index.d.ts +2 -0
  40. package/dist/react/index.d.ts.map +1 -1
  41. package/dist/react/index.js +3 -0
  42. package/package.json +7 -1
@@ -22,7 +22,7 @@
22
22
  * ```
23
23
  */
24
24
  import { assertNoUserErrors } from '../helpers/assert-no-user-errors';
25
- import { CART_QUERY, CART_CREATE, CART_ADD_LINES, CART_UPDATE_LINES, CART_REMOVE_LINES, CART_DISCOUNT_CODES_UPDATE, CART_UPDATE_NOTE, CART_UPDATE_BUYER_IDENTITY, CART_SET_SHIPPING_ADDRESS, CART_SET_BILLING_ADDRESS, CART_SELECT_SHIPPING_METHOD, CART_SELECT_PAYMENT_METHOD, CART_APPLY_GIFT_CARD, CART_REMOVE_GIFT_CARD, CART_UPDATE_GIFT_CARD_RECIPIENT, CART_COMPLETE, CART_VALIDATE_DISCOUNT_CODE, PAYMENT_CREATE, } from '../operations/cart';
25
+ import { CART_QUERY, ORDER_BY_TOKEN_QUERY, CART_AVAILABLE_SHIPPING_METHODS_QUERY, AVAILABLE_PAYMENT_METHODS_QUERY, CART_CREATE, CART_ADD_LINES, CART_UPDATE_LINES, CART_REMOVE_LINES, CART_DISCOUNT_CODES_UPDATE, CART_UPDATE_NOTE, CART_UPDATE_ATTRIBUTES, CART_UPDATE_BUYER_IDENTITY, CART_SET_SHIPPING_ADDRESS, CART_SET_BILLING_ADDRESS, CART_SELECT_SHIPPING_METHOD, CART_SELECT_PAYMENT_METHOD, CART_APPLY_GIFT_CARD, CART_REMOVE_GIFT_CARD, CART_UPDATE_GIFT_CARD_RECIPIENT, CART_COMPLETE, CART_VALIDATE_DISCOUNT_CODE, PAYMENT_CREATE, } from '../operations/cart';
26
26
  export class CartClient {
27
27
  client;
28
28
  constructor(client) {
@@ -36,6 +36,56 @@ export class CartClient {
36
36
  const data = await this.client.query(CART_QUERY, { id: cartId });
37
37
  return data.cart;
38
38
  }
39
+ /**
40
+ * Cart-aware list of shipping methods available for the given destination.
41
+ * Resolves with `null` when the cart does not exist or has expired —
42
+ * symmetric with `CartClient.get(cartId)`. Otherwise resolves with
43
+ * `AvailableShippingMethodsPayload`:
44
+ *
45
+ * - `methods[]` — methods available for this cart at the destination, each
46
+ * carrying `deliveryType` (`HOME` / `PICKUP_POINT` / `LOCKER`).
47
+ * - `freeShippingProgress` — best free-shipping progress across all
48
+ * returned methods (use for a single banner above the picker).
49
+ * - `userErrors[]` — populated by the backend for business conditions
50
+ * (e.g. `DIGITAL_ONLY_NO_SHIPPING` for a cart with no shippable lines,
51
+ * `NO_SHIPPING_METHODS` for an unsupported address). Branch on
52
+ * `userErrors[0].code`; the `message` is localized per the request's
53
+ * `Accept-Language` header.
54
+ */
55
+ async getAvailableShippingMethods(cartId, address) {
56
+ const data = await this.client.query(CART_AVAILABLE_SHIPPING_METHODS_QUERY, { cartId, address });
57
+ return data.cart?.availableShippingMethods ?? null;
58
+ }
59
+ /**
60
+ * Shop-level list of active payment methods. Returns the raw payload from
61
+ * the backend:
62
+ *
63
+ * - `methods[]` — sorted by the merchant's display position.
64
+ * - `defaultMethod` — the merchant-flagged pre-selection (may be null when
65
+ * none is configured). Prefer this over scanning `methods.find(isDefault)`
66
+ * — the merchant may override the default independently of per-method
67
+ * flags.
68
+ */
69
+ async getAvailablePaymentMethods() {
70
+ const data = await this.client.query(AVAILABLE_PAYMENT_METHODS_QUERY);
71
+ return data.availablePaymentMethods;
72
+ }
73
+ /**
74
+ * Fetch a guest order by its opaque access token (returned in
75
+ * `complete().order.accessToken`). Use on the post-checkout confirmation
76
+ * page when the buyer is not signed in.
77
+ *
78
+ * Optional `email` is matched case-insensitively against the order's buyer
79
+ * email as defense in depth — on mismatch the call returns `null` with the
80
+ * same shape as an invalid token (attackers cannot distinguish the two).
81
+ *
82
+ * Backend rate-limits this query (5 requests / minute per IP + shop) and
83
+ * responses are uncached.
84
+ */
85
+ async getOrderByToken(token, email) {
86
+ const data = await this.client.query(ORDER_BY_TOKEN_QUERY, { token, email });
87
+ return data.orderByToken;
88
+ }
39
89
  /**
40
90
  * Create a new cart, optionally with initial lines.
41
91
  */
@@ -85,6 +135,18 @@ export class CartClient {
85
135
  assertNoUserErrors(data.cartUpdateNote);
86
136
  return { cart: data.cartUpdateNote.cart, warnings: data.cartUpdateNote.warnings ?? [] };
87
137
  }
138
+ /**
139
+ * Replace the cart's custom `{ key, value }` attribute pairs — free-form
140
+ * metadata visible to the merchant (delivery instructions, gift-wrap flags,
141
+ * B2B PO numbers). Semantics is REPLACE-ALL (not merge): pass the full set
142
+ * each call, an empty array clears all attributes. Backend rejects oversized
143
+ * sets with `CART_ATTRIBUTES_LIMIT_EXCEEDED` (max 250 pairs, 255-char keys).
144
+ */
145
+ async updateAttributes(cartId, attributes) {
146
+ const data = await this.client.mutate(CART_UPDATE_ATTRIBUTES, { id: cartId, attributes });
147
+ assertNoUserErrors(data.cartUpdateAttributes);
148
+ return { cart: data.cartUpdateAttributes.cart, warnings: data.cartUpdateAttributes.warnings ?? [] };
149
+ }
88
150
  /**
89
151
  * Update buyer identity (email, phone, country, customer link, languageCode).
90
152
  */
@@ -1,421 +1,105 @@
1
1
  /**
2
- * Cart types — manual (no codegen).
2
+ * Cart types — derived from the generated GraphQL operation types.
3
3
  *
4
- * These match the backend storefront-graphql Cart type.
5
- * Keep in sync with SSOT: backend/storefront-graphql/types/cart.types.ts
4
+ * Output types alias the generated `*Fragment` types; input types and enums
5
+ * re-export the generated schema types. This file only assigns stable, public
6
+ * names — it does NOT define shapes.
6
7
  *
7
- * Validate with: pnpm test:contract (cart-operations-drift test)
8
- */
9
- export interface Money {
10
- amount: string;
11
- currencyCode: string;
12
- }
13
- export interface ImageThumbnail {
14
- id: string | null;
15
- url: string;
16
- altText: string | null;
17
- width: number | null;
18
- height: number | null;
19
- thumbhash: string | null;
20
- }
21
- export interface PageInfo {
22
- hasNextPage: boolean;
23
- hasPreviousPage: boolean;
24
- startCursor: string | null;
25
- endCursor: string | null;
26
- }
27
- export interface CartCost {
28
- total: Money;
29
- subtotal: Money;
30
- totalTax: Money | null;
31
- totalDuty: Money | null;
32
- checkoutCharge: Money | null;
33
- }
34
- export interface CartLineCost {
35
- pricePerUnit: Money;
36
- subtotal: Money;
37
- total: Money;
38
- compareAtPricePerUnit: Money | null;
39
- }
40
- export interface SelectedOption {
41
- name: string;
42
- value: string;
43
- }
44
- export interface ProductVariantWeight {
45
- value: number;
46
- unit: string;
47
- }
48
- export interface ProductVariant {
49
- id: string;
50
- title: string;
51
- sku: string | null;
52
- price: Money;
53
- compareAtPrice: Money | null;
54
- isAvailable: boolean;
55
- availableStock: number | null;
56
- image: ImageThumbnail | null;
57
- selectedOptions: SelectedOption[];
58
- barcode: string | null;
59
- weight: ProductVariantWeight | null;
60
- sortOrder: number | null;
61
- }
62
- export interface AttributeSelection {
63
- attributeDefinitionId: string;
64
- attributeName: string;
65
- type: string;
66
- fillingMode: string;
67
- billingMode: string | null;
68
- optionId: string | null;
69
- optionLabel: string | null;
70
- optionIds: string[] | null;
71
- textValue: string | null;
72
- surchargeAmount: number;
73
- surchargeType: string | null;
74
- taxClassId: string | null;
75
- linkedVariantId: string | null;
76
- }
77
- export interface CartLine {
78
- id: string;
79
- quantity: number;
80
- variant: ProductVariant;
81
- cost: CartLineCost;
82
- attributes: Array<{
83
- key: string;
84
- value: string | null;
85
- }>;
86
- attributeSelections: AttributeSelection[];
87
- productId: string | null;
88
- productTitle: string | null;
89
- productHandle: string | null;
90
- productType: string | null;
91
- }
92
- export interface CartLineEdge {
93
- cursor: string;
94
- node: CartLine;
95
- }
96
- export interface CartLineConnection {
97
- edges: CartLineEdge[];
98
- nodes: CartLine[];
99
- pageInfo: PageInfo;
100
- totalCount: number;
101
- }
102
- export interface CartDiscountCode {
103
- code: string;
104
- isApplicable: boolean;
105
- }
106
- export interface CartDiscountAllocation {
107
- discountCode: string;
108
- amount: Money;
109
- }
110
- export interface CartBuyerIdentity {
111
- email: string | null;
112
- phone: string | null;
113
- countryCode: string | null;
114
- }
115
- export interface Cart {
116
- id: string;
117
- checkoutUrl: string | null;
118
- totalQuantity: number;
119
- note: string | null;
120
- createdAt: string;
121
- updatedAt: string;
122
- cost: CartCost;
123
- lines: CartLineConnection;
124
- buyerIdentity: CartBuyerIdentity | null;
125
- discountCodes: CartDiscountCode[];
126
- discountAllocations: CartDiscountAllocation[];
127
- attributes: Array<{
128
- key: string;
129
- value: string | null;
130
- }>;
131
- email: string | null;
132
- phone: string | null;
133
- shippingAddress: MailingAddress | null;
134
- billingAddress: MailingAddress | null;
135
- selectedShippingMethod: CartShippingMethod | null;
136
- selectedPaymentMethod: CartSelectedPaymentMethod | null;
137
- appliedGiftCards: CartAppliedGiftCard[];
138
- }
139
- /**
140
- * Customer-filled attribute selection submitted with a cart line.
8
+ * SSOT chain: backend storefront-graphql schema → `core/operations/*.ts`
9
+ * → `src/core/generated/operation-types.ts` (regenerate with `pnpm codegen`).
141
10
  *
142
- * Mirror of the GraphQL `AttributeSelectionInput`one entry per configurator
143
- * field the shopper filled. Backend validates (required / pattern / option ownership),
144
- * snapshots name/surcharge/taxRate, and stores them on `cart_items.attribute_selections`.
145
- *
146
- * Faza 1: SELECT/RADIO/CHECKBOX use `optionId`; TEXT/TEXTAREA/NUMBER/DATE use `textValue`.
147
- * Faza 2 will enable `optionIds` for MULTI_SELECT.
11
+ * Never hand-edit a shape hereif a type looks wrong, fix the operation /
12
+ * schema and regenerate. `cart-operations-drift` test guards the operations.
148
13
  */
149
- export interface CartAttributeSelectionInput {
150
- attributeDefinitionId: string;
151
- optionId?: string | null;
152
- optionIds?: string[] | null;
153
- textValue?: string | null;
154
- }
155
- export interface CartLineInput {
156
- variantId: string;
157
- quantity?: number;
158
- /** Raw Line Item Properties (gift messages, engraving notes, etc.). */
159
- attributes?: Array<{
160
- key: string;
161
- value: string;
162
- }>;
163
- /** Faza 1 typed customer configurator selections (Finiszer, service phone, etc.). */
164
- attributeSelections?: CartAttributeSelectionInput[];
165
- }
166
- export interface CartLineUpdateInput {
167
- id: string;
168
- quantity: number;
169
- attributes?: Array<{
170
- key: string;
171
- value: string;
172
- }>;
173
- /** Faza 1 — pass `null` to preserve, `[]` to clear, or array to replace selections. */
174
- attributeSelections?: CartAttributeSelectionInput[] | null;
175
- }
176
- export interface CartCreateInput {
177
- lines?: CartLineInput[];
178
- buyerIdentity?: CartBuyerIdentityInput;
179
- discountCodes?: string[];
180
- note?: string;
181
- attributes?: Array<{
182
- key: string;
183
- value: string;
184
- }>;
185
- /** Phase 3 Task 3.2 — initial checkout fields w jednym round-trip. */
186
- email?: string;
187
- shippingAddress?: CartAddressInput;
188
- }
189
- export interface CartBuyerIdentityInput {
190
- email?: string;
191
- phone?: string;
192
- /** ISO 3166-1 alpha-2 country code (e.g. 'PL', 'DE'). */
193
- countryCode?: string;
194
- customerId?: string;
195
- /** ISO 639-1 preferred language code (e.g. 'PL', 'EN'). Accepted by backend; not yet persisted server-side. */
196
- languageCode?: string;
197
- }
14
+ import type { CartFragment, CartCostFragment, CartLineFragment, CartLineCostFragment, ProductVariantFragment, MoneyFragment, ImageThumbnailFragment, SelectedOptionFragment, AttributeSelectionFragment, PageInfoFragment, CartBuyerIdentityFragment, CartDiscountCodeFragment, CartDiscountAllocationFragment, CartWarningFragment, CartShippingMethodFragment, CartAppliedGiftCardFragment, CartSelectedPaymentMethodFragment, OrderFragment, PaymentSessionFragment, CartValidateDiscountCodeQuery, AvailableShippingMethodFragment, AvailablePaymentMethodsFragment, PaymentMethodFragment, UserErrorFragment, AvailableShippingMethodsPayload as AvailableShippingMethodsPayloadSchema } from '../generated/operation-types';
15
+ export type Money = MoneyFragment;
16
+ export type ImageThumbnail = ImageThumbnailFragment;
17
+ export type PageInfo = PageInfoFragment;
18
+ export type CartCost = CartCostFragment;
19
+ export type CartLineCost = CartLineCostFragment;
20
+ export type SelectedOption = SelectedOptionFragment;
21
+ export type ProductVariant = ProductVariantFragment;
22
+ /** Weight of a product variant — non-null shape of `ProductVariant.weight`. */
23
+ export type ProductVariantWeight = NonNullable<ProductVariantFragment['weight']>;
24
+ export type AttributeSelection = AttributeSelectionFragment;
25
+ export type CartLine = CartLineFragment;
26
+ /** Cart line list as returned by the cart query (`totalCount` + `nodes` + `pageInfo`). */
27
+ export type CartLineConnection = CartFragment['lines'];
28
+ export type CartBuyerIdentity = CartBuyerIdentityFragment;
29
+ export type CartDiscountCode = CartDiscountCodeFragment;
30
+ export type CartDiscountAllocation = CartDiscountAllocationFragment;
31
+ export type Cart = CartFragment;
198
32
  /**
199
33
  * Non-blocking cart warning surfaced by mutations alongside a successful
200
- * payload. Cart mutation completes these are advisory hints (low stock,
201
- * partial availability, etc.) for the storefront UI to render as soft warnings.
202
- *
203
- * Mirror of GraphQL `CartWarning` type.
34
+ * payload — advisory hints (low stock, partial availability, etc.) for the UI.
204
35
  */
205
- export interface CartWarning {
206
- message: string;
207
- code: string;
208
- target: string | null;
209
- }
36
+ export type CartWarning = CartWarningFragment;
37
+ /** Shipping method selected on a cart — returned from `cart.selectedShippingMethod`. */
38
+ export type CartShippingMethod = CartShippingMethodFragment;
39
+ /** Gift card applied to the cart — balance debited atomically at `cartComplete`. */
40
+ export type CartAppliedGiftCard = CartAppliedGiftCardFragment;
41
+ /** Payment method (integration provider) selected on the cart. */
42
+ export type CartSelectedPaymentMethod = CartSelectedPaymentMethodFragment;
210
43
  /**
211
- * Mailing address shape used for shipping/billing addresses on the cart.
212
- * Mirrors backend `MailingAddress` GraphQL type. Subset of fields surface'd
213
- * for storefront usage full shape z optional id when address is persisted.
44
+ * Single payment method enabled for the shop returned by
45
+ * `CartClient.getAvailablePaymentMethods()` inside the payload `methods[]`
46
+ * and `defaultMethod` slots. Same shape as `CartSelectedPaymentMethod`,
47
+ * different framing (one of the "available" choices vs the chosen one).
214
48
  */
215
- export interface MailingAddress {
216
- id: string | null;
217
- firstName: string | null;
218
- lastName: string | null;
219
- name: string | null;
220
- company: string | null;
221
- streetLine1: string | null;
222
- streetLine2: string | null;
223
- city: string | null;
224
- state: string | null;
225
- stateCode: string | null;
226
- country: string | null;
227
- countryCode: string | null;
228
- postalCode: string | null;
229
- phone: string | null;
230
- isDefault: boolean | null;
231
- }
49
+ export type PaymentMethod = PaymentMethodFragment;
232
50
  /**
233
- * Input for cartSetShippingAddress / cartSetBillingAddress / CartCreateInput.shippingAddress.
234
- * Mirror of GraphQL `CartAddressInput` server validates required fields
235
- * (firstName/lastName/streetLine1/city/country/postalCode).
51
+ * Result of the shop-level "available payment methods" query — returned by
52
+ * `CartClient.getAvailablePaymentMethods()`. Carries the methods list plus
53
+ * the merchant-flagged `defaultMethod` (may be null when none is configured).
236
54
  */
237
- export interface CartAddressInput {
238
- firstName?: string;
239
- lastName?: string;
240
- company?: string;
241
- streetLine1: string;
242
- streetLine2?: string;
243
- city: string;
244
- state?: string;
245
- country: string;
246
- postalCode: string;
247
- phone?: string;
248
- }
55
+ export type AvailablePaymentMethods = AvailablePaymentMethodsFragment;
249
56
  /**
250
- * Shipping method selected on a cart (Decision D8 term unification —
251
- * formerly `ShippingRate`). Returned from `cart.selectedShippingMethod`.
57
+ * Single shipping method offered for the destination + cart shape element of
58
+ * `AvailableShippingMethodsPayload.methods`. `deliveryType` decides the UI:
59
+ * `HOME` renders the standard form, `PICKUP_POINT` / `LOCKER` triggers the
60
+ * pickup picker.
252
61
  */
253
- export interface CartShippingMethod {
254
- handle: string;
255
- title: string;
256
- price: Money;
257
- }
62
+ export type AvailableShippingMethod = AvailableShippingMethodFragment;
258
63
  /**
259
- * Gift card currently applied to the cart (one entry per gift card).
260
- * Balance NOT yet debited actual deduction happens atomically at cartComplete.
64
+ * Result of the cart-aware "available shipping methods" query returned by
65
+ * `CartClient.getAvailableShippingMethods()`. Carries the methods list, the
66
+ * best free-shipping progress across all methods, and `userErrors[]` populated
67
+ * by the backend with translated messages (e.g. `DIGITAL_ONLY_NO_SHIPPING`
68
+ * when the cart contains only non-physical items). Branch on
69
+ * `result.userErrors[0].code`; the `message` is already localized per the
70
+ * request's `Accept-Language`.
261
71
  */
262
- export interface CartAppliedGiftCard {
263
- maskedCode: string;
264
- lastCharacters: string;
265
- appliedAmount: Money;
266
- remainingBalance: Money;
267
- }
72
+ export type AvailableShippingMethodsPayload = AvailableShippingMethodsPayloadSchema;
268
73
  /**
269
- * Payment method (integration provider) selected on the cart.
270
- * Mirror of GraphQL `PaymentMethod` type.
74
+ * `userErrors[]` envelope element. Surfaces machine-readable `code`
75
+ * alongside a human message — branch on `code` for translation / retry
76
+ * logic, never on `message`.
271
77
  */
272
- export interface CartSelectedPaymentMethod {
273
- id: string;
274
- name: string;
275
- provider: string;
276
- type: PaymentMethodType;
277
- icon: string | null;
278
- description: string | null;
279
- isDefault: boolean | null;
280
- supportedCurrencies: string[] | null;
281
- position: number | null;
282
- }
78
+ export type UserError = UserErrorFragment;
283
79
  /**
284
- * Payment method category the set of values the backend actually returns
285
- * today. Each value corresponds to a registered provider mapping on the
286
- * server. Wallet categories (Apple Pay, Google Pay, PayPal) intentionally
287
- * not present until their respective providers are deployed — `OTHER` is
288
- * the fallback for any registered-but-unmapped provider.
289
- */
290
- export type PaymentMethodType = 'CARD' | 'BLIK' | 'BANK_TRANSFER' | 'CASH_ON_DELIVERY' | 'OTHER';
291
- export interface CartSetShippingAddressInput {
292
- cartId: string;
293
- address: CartAddressInput;
294
- }
295
- export interface CartSetBillingAddressInput {
296
- cartId: string;
297
- address: CartAddressInput;
298
- }
299
- export interface CartSelectShippingMethodInput {
300
- cartId: string;
301
- shippingMethodId: string;
302
- }
303
- export interface CartSelectPaymentMethodInput {
304
- cartId: string;
305
- paymentMethodId: string;
306
- }
307
- export interface CartApplyGiftCardInput {
308
- cartId: string;
309
- giftCardCode: string;
310
- }
311
- export interface CartRemoveGiftCardInput {
312
- cartId: string;
313
- giftCardCode: string;
314
- }
315
- export interface CartUpdateGiftCardRecipientInput {
316
- cartId: string;
317
- lineItemId: string;
318
- recipientEmail?: string;
319
- recipientName?: string;
320
- message?: string;
321
- }
322
- export interface CartCompleteInput {
323
- cartId: string;
324
- idempotencyKey?: string;
325
- }
326
- /**
327
- * Order surface — matches SSOT `Order` fragment shape (status + totals + lifecycle
328
- * timestamps + shipping address + payment capability signal). The
329
- * `canCreatePayment` + `paymentMethodType` fields let the storefront decide
80
+ * Order surface returned by `cartComplete` and the `orderByToken` query
81
+ * status + totals + lifecycle timestamps + payment capability signals.
82
+ * `canCreatePayment` + `paymentMethodType` let the storefront pick the
330
83
  * post-completion payment flow without hard-coded provider checks.
331
- *
332
- * Line items NOT included — query them via the separate `order(id).lineItems`
333
- * field when needed (Relay Connection, paginated).
334
84
  */
335
- export interface Order {
336
- id: string;
337
- orderNumber: string;
338
- totals: {
339
- total: Money;
340
- subtotal: Money;
341
- totalTax: Money | null;
342
- totalShipping: Money | null;
343
- };
344
- status: string;
345
- paymentStatus: string;
346
- fulfillmentStatus: string;
347
- processedAt: string;
348
- confirmedAt: string | null;
349
- cancelledAt: string | null;
350
- expiredAt: string | null;
351
- shippingAddress: MailingAddress | null;
352
- itemCount: number;
353
- canCreatePayment: boolean;
354
- paymentMethodType: PaymentMethodType;
355
- }
85
+ export type Order = OrderFragment;
356
86
  /**
357
- * How the storefront launches the payment after `createPayment`. Branch on this:
358
- * - `ONLINE_REDIRECT` redirect the browser to `PaymentSession.redirectUrl`
359
- * - `ONLINE_EMBEDDED` render an in-page widget with `PaymentSession.clientSecret`
360
- * - `INSTANT_DIRECT` — already settled with no UI, read `PaymentSession.status`
361
- * - `OFFLINE_MANUAL` — never returned (`order.canCreatePayment` is false for offline methods)
362
- *
363
- * Mirror of GraphQL `PaymentInitiationFlow` enum.
87
+ * Initiated payment session for an order returned by `CartClient.createPayment`.
88
+ * Branch on `flow`: `redirectUrl` for redirect, `clientSecret` for an embedded
89
+ * widget, `status` for an instant settlement.
364
90
  */
365
- export type PaymentInitiationFlow = 'ONLINE_REDIRECT' | 'ONLINE_EMBEDDED' | 'INSTANT_DIRECT' | 'OFFLINE_MANUAL';
91
+ export type PaymentSession = PaymentSessionFragment;
92
+ /** Read-only discount preview returned by `CartClient.validateDiscountCode`. */
93
+ export type DiscountValidationResult = CartValidateDiscountCodeQuery['cartValidateDiscountCode'];
94
+ export type DiscountInfo = NonNullable<DiscountValidationResult['discount']>;
95
+ export type DiscountValidationError = NonNullable<DiscountValidationResult['error']>;
96
+ export type { CartCreateInput, CartLineInput, CartLineUpdateInput, CartBuyerIdentityInput, CartAddressInput, CartAttributeInput, CartCompleteInput, CartApplyGiftCardInput, CartRemoveGiftCardInput, CartSelectPaymentMethodInput, CartSelectShippingMethodInput, CartSetBillingAddressInput, CartSetShippingAddressInput, CartUpdateGiftCardRecipientInput, PaymentCreateInput, ShippingAddressInput, PickupPointInput, DeliveryType, DeliveryEstimate, ShippingCarrier, FreeShippingProgress, PickupPoint, AttributeSelectionInput as CartAttributeSelectionInput, PaymentMethodType, PaymentInitiationFlow, DiscountApplicationType, DiscountErrorCode, CurrencyCode, CountryCode, LanguageCode, ProductTypeEnum, WeightUnit, CartWarningCode, AttributeType, AttributeFillingMode, AttributeBillingMode, AttributeOptionSurchargeType, StorefrontOrderStatus, OrderPaymentStatus, OrderFulfillmentStatus, } from '../generated/operation-types';
366
97
  /**
367
98
  * Machine-readable error code surfaced when `createPayment` fails. The call
368
99
  * throws a `StorefrontError` on `userErrors` — read `.userErrors[0].code` off
369
100
  * the thrown error and compare against these values.
101
+ *
102
+ * This is a hand-curated `userErrors[].code` contract, not a GraphQL enum.
370
103
  */
371
104
  export type PaymentErrorCode = 'ORDER_NOT_FOUND' | 'ORDER_ALREADY_PAID' | 'ORDER_NOT_PAYABLE' | 'PAYMENT_PROVIDER_NOT_CONFIGURED' | 'RETURN_URL_INVALID' | 'INVALID_ID_FORMAT' | 'PAYMENT_FAILED';
372
- /**
373
- * Initiated payment session for an order — returned by `CartClient.createPayment`.
374
- * Mirror of GraphQL `PaymentSession`. Branch on `flow` to decide the next step
375
- * (`redirectUrl` for redirect, `clientSecret` for an embedded widget, `status`
376
- * for an instant settlement).
377
- */
378
- export interface PaymentSession {
379
- id: string;
380
- orderId: string;
381
- flow: PaymentInitiationFlow;
382
- /** Provider code that created the session (e.g. `PAYU`). */
383
- provider: string;
384
- /** Hosted gateway URL — present for the `ONLINE_REDIRECT` flow. */
385
- redirectUrl: string | null;
386
- /** In-page widget token — present for the `ONLINE_EMBEDDED` flow. */
387
- clientSecret: string | null;
388
- /** Order payment status at session creation. */
389
- status: string;
390
- /** When `redirectUrl` / `clientSecret` expires (ISO 8601), if the gateway sets a TTL. */
391
- expiresAt: string | null;
392
- }
393
- /**
394
- * Input for `CartClient.createPayment`. `returnUrl` / `cancelUrl` are optional —
395
- * when supplied they must point to a verified domain of the shop (the server
396
- * rejects others to prevent open redirects).
397
- */
398
- export interface PaymentCreateInput {
399
- orderId: string;
400
- returnUrl?: string;
401
- cancelUrl?: string;
402
- }
403
- export type DiscountErrorCode = 'NOT_FOUND' | 'INACTIVE' | 'NOT_STARTED' | 'EXPIRED' | 'USAGE_LIMIT_REACHED' | 'CUSTOMER_USAGE_LIMIT_REACHED' | 'CUSTOMER_NOT_ELIGIBLE' | 'MINIMUM_ORDER_NOT_MET' | 'MINIMUM_QUANTITY_NOT_MET' | 'DISCOUNT_COMBINATION_NOT_ALLOWED' | 'SHOP_NOT_FOUND';
404
- export type DiscountApplicationType = 'PERCENTAGE' | 'FIXED_AMOUNT' | 'FREE_SHIPPING' | 'BUY_X_GET_Y';
405
- export interface DiscountInfo {
406
- code: string;
407
- title: string;
408
- type: DiscountApplicationType;
409
- value: number;
410
- discountAmount: Money | null;
411
- }
412
- export interface DiscountValidationError {
413
- code: DiscountErrorCode;
414
- message: string;
415
- }
416
- export interface DiscountValidationResult {
417
- isValid: boolean;
418
- discount: DiscountInfo | null;
419
- error: DiscountValidationError | null;
420
- }
421
105
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/cart/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA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M,iBAAiB,GACzB,WAAW,GACX,UAAU,GACV,aAAa,GACb,SAAS,GACT,qBAAqB,GACrB,8BAA8B,GAC9B,uBAAuB,GACvB,uBAAuB,GACvB,0BAA0B,GAC1B,kCAAkC,GAClC,gBAAgB,CAAC;AAErB,MAAM,MAAM,uBAAuB,GAC/B,YAAY,GACZ,cAAc,GACd,eAAe,GACf,aAAa,CAAC;AAElB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,uBAAuB,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,KAAK,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,KAAK,EAAE,uBAAuB,GAAG,IAAI,CAAC;CACvC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/cart/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,gBAAgB,EAChB,yBAAyB,EACzB,wBAAwB,EACxB,8BAA8B,EAC9B,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,iCAAiC,EACjC,aAAa,EACb,sBAAsB,EACtB,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,EAC/B,qBAAqB,EACrB,iBAAiB,EACjB,+BAA+B,IAAI,qCAAqC,EACzE,MAAM,8BAA8B,CAAC;AAMtC,MAAM,MAAM,KAAK,GAAG,a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
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)
8
- */
9
1
  export {};