-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
613 lines (554 loc) · 17.9 KB
/
types.ts
File metadata and controls
613 lines (554 loc) · 17.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: string;
String: string;
Boolean: boolean;
Int: number;
Float: number;
Date: any;
Json: any;
Upload: any;
};
export type AddToCartInput = {
attributes?: InputMaybe<Array<InputMaybe<CustomAttributeInput>>>;
cartId: Scalars['ID'];
currency?: InputMaybe<CurrencyInput>;
description?: InputMaybe<Scalars['String']>;
id: Scalars['ID'];
images?: InputMaybe<Array<InputMaybe<Scalars['String']>>>;
metadata?: InputMaybe<Scalars['Json']>;
name?: InputMaybe<Scalars['String']>;
price: Scalars['Int'];
quantity?: InputMaybe<Scalars['Int']>;
type?: InputMaybe<CartItemType>;
};
/** Addresses are associated with Orders. They can either be shipping or billing addresses. */
export type Address = {
__typename?: 'Address';
/** Use this to keep the city/town name. */
city: Scalars['String'];
/** Use this to keep an optional company name for addresses. */
company?: Maybe<Scalars['String']>;
/** Use this to keep the country name. */
country: Scalars['String'];
/** Use this to keep the first line of the address. */
line1: Scalars['String'];
/** Use this to keep the apartment, door number, etc. */
line2?: Maybe<Scalars['String']>;
/** Use this to keep the name of the recipient. */
name: Scalars['String'];
/** Use this to keep the post/postal/zip code. */
postalCode: Scalars['String'];
/** Use this to keep the state/county name. */
state?: Maybe<Scalars['String']>;
};
export type AddressInput = {
city: Scalars['String'];
company?: InputMaybe<Scalars['String']>;
country: Scalars['String'];
line1: Scalars['String'];
line2?: InputMaybe<Scalars['String']>;
name: Scalars['String'];
postalCode: Scalars['String'];
state?: InputMaybe<Scalars['String']>;
};
export enum CacheControlScope {
Private = 'PRIVATE',
Public = 'PUBLIC'
}
/** Carts are the core concept of CartQL. Bring your own PIM and use CartQL to calculate your Cart and Checkout. */
export type Cart = Node & {
__typename?: 'Cart';
/** A simple helper method to check if the cart hasn't been updated in the last 2 hours. */
abandoned?: Maybe<Scalars['Boolean']>;
/** Custom key/value attributes array for the cart. */
attributes: Array<CustomCartAttribute>;
/** The date and time the cart was created. */
createdAt: Scalars['Date'];
/** The current currency details of the cart. */
currency: Currency;
/** The customer for the cart */
email?: Maybe<Scalars['String']>;
/** The grand total for all items, including shipping, including the raw/formatted amounts and currency details. */
grandTotal: Money;
/** A custom unique identifer for the cart provided by you. */
id: Scalars['ID'];
/** A simple helper method to check if the cart is empty. */
isEmpty?: Maybe<Scalars['Boolean']>;
/** The items currently in the cart. */
items: Array<CartItem>;
/** Custom meta object for the cart */
metadata?: Maybe<Scalars['Json']>;
/** Any notes related to the cart/checkout */
notes?: Maybe<Scalars['String']>;
/** The cart total for all items with type SHIPPING, including the raw/formatted amounts and currency details. */
shippingTotal: Money;
/** Sum of all SKU items, excluding discounts, taxes, shipping, including the raw/formatted amounts and currency details */
subTotal: Money;
/** The cart total for all items with type TAX, including the raw/formatted amounts and currency details. */
taxTotal: Money;
/** The number of total items in the cart */
totalItems?: Maybe<Scalars['Int']>;
/** The number of total unique items in the cart. */
totalUniqueItems?: Maybe<Scalars['Int']>;
/** The date and time the cart was updated. */
updatedAt: Scalars['Date'];
};
/** A Cart Item is used to store data on the items inside the Cart. There are no strict rules about what you use the named fields for. */
export type CartItem = {
__typename?: 'CartItem';
/** Custom key/value attributes array for the item. */
attributes: Array<CustomCartAttribute>;
/** The date and time the item was created. */
createdAt: Scalars['Date'];
/** Description for the item. */
description?: Maybe<Scalars['String']>;
/** A custom unique identifer for the item provided by you. */
id: Scalars['ID'];
/** Array of image URLs for the item. */
images?: Maybe<Array<Maybe<Scalars['String']>>>;
/** Line total (quantity * unit price). */
lineTotal: Money;
/** Custom metadata for the item. */
metadata?: Maybe<Scalars['Json']>;
/** Name for the item. */
name?: Maybe<Scalars['String']>;
/** Quantity for the item. */
quantity: Scalars['Int'];
/** The type of cart item this is. */
type: CartItemType;
/** Unit total for the individual item. */
unitTotal: Money;
/** The date and time the item was updated. */
updatedAt: Scalars['Date'];
};
/** Use these enums to group cart items. Cart totals will reflect these enums. */
export enum CartItemType {
Shipping = 'SHIPPING',
Sku = 'SKU',
Tax = 'TAX'
}
export type CheckoutInput = {
billing?: InputMaybe<AddressInput>;
cartId: Scalars['ID'];
email: Scalars['String'];
metadata?: InputMaybe<Scalars['Json']>;
notes?: InputMaybe<Scalars['String']>;
shipping: AddressInput;
};
/** Cart and Cart Items use the currency object to format their unit/line totals. */
export type Currency = {
__typename?: 'Currency';
/** The currency code, e.g. USD, GBP, EUR */
code?: Maybe<CurrencyCode>;
/** The decimal places for the currency */
decimalDigits?: Maybe<Scalars['Int']>;
/** The decimal separator, e.g. '.' */
decimalSeparator?: Maybe<Scalars['String']>;
/** The currency smybol, e.g. $, £, € */
symbol?: Maybe<Scalars['String']>;
/** The thousand separator, e.g. ',', '.' */
thousandsSeparator?: Maybe<Scalars['String']>;
};
export enum CurrencyCode {
Aed = 'AED',
Afn = 'AFN',
All = 'ALL',
Amd = 'AMD',
Ang = 'ANG',
Aoa = 'AOA',
Ars = 'ARS',
Aud = 'AUD',
Awg = 'AWG',
Azn = 'AZN',
Bam = 'BAM',
Bbd = 'BBD',
Bdt = 'BDT',
Bgn = 'BGN',
Bhd = 'BHD',
Bif = 'BIF',
Bmd = 'BMD',
Bnd = 'BND',
Bob = 'BOB',
Brl = 'BRL',
Bsd = 'BSD',
Btc = 'BTC',
Btn = 'BTN',
Bwp = 'BWP',
Byr = 'BYR',
Bzd = 'BZD',
Cad = 'CAD',
Cdf = 'CDF',
Chf = 'CHF',
Clp = 'CLP',
Cny = 'CNY',
Cop = 'COP',
Crc = 'CRC',
Cuc = 'CUC',
Cup = 'CUP',
Cve = 'CVE',
Czk = 'CZK',
Djf = 'DJF',
Dkk = 'DKK',
Dop = 'DOP',
Dzd = 'DZD',
Egp = 'EGP',
Ern = 'ERN',
Etb = 'ETB',
Eur = 'EUR',
Fjd = 'FJD',
Fkp = 'FKP',
Gbp = 'GBP',
Gel = 'GEL',
Ghs = 'GHS',
Gip = 'GIP',
Gmd = 'GMD',
Gnf = 'GNF',
Gtq = 'GTQ',
Gyd = 'GYD',
Hkd = 'HKD',
Hnl = 'HNL',
Hrk = 'HRK',
Htg = 'HTG',
Huf = 'HUF',
Idr = 'IDR',
Ils = 'ILS',
Inr = 'INR',
Iqd = 'IQD',
Irr = 'IRR',
Isk = 'ISK',
Jmd = 'JMD',
Jod = 'JOD',
Jpy = 'JPY',
Kes = 'KES',
Kgs = 'KGS',
Khr = 'KHR',
Kmf = 'KMF',
Kpw = 'KPW',
Krw = 'KRW',
Kwd = 'KWD',
Kyd = 'KYD',
Kzt = 'KZT',
Lak = 'LAK',
Lbp = 'LBP',
Lkr = 'LKR',
Lrd = 'LRD',
Lsl = 'LSL',
Lyd = 'LYD',
Mad = 'MAD',
Mdl = 'MDL',
Mga = 'MGA',
Mkd = 'MKD',
Mmk = 'MMK',
Mnt = 'MNT',
Mop = 'MOP',
Mro = 'MRO',
Mtl = 'MTL',
Mur = 'MUR',
Mvr = 'MVR',
Mwk = 'MWK',
Mxn = 'MXN',
Myr = 'MYR',
Mzn = 'MZN',
Nad = 'NAD',
Ngn = 'NGN',
Nio = 'NIO',
Nok = 'NOK',
Npr = 'NPR',
Nzd = 'NZD',
Omr = 'OMR',
Pab = 'PAB',
Pen = 'PEN',
Pgk = 'PGK',
Php = 'PHP',
Pkr = 'PKR',
Pln = 'PLN',
Pyg = 'PYG',
Qar = 'QAR',
Ron = 'RON',
Rsd = 'RSD',
Rub = 'RUB',
Rwf = 'RWF',
Sar = 'SAR',
Sbd = 'SBD',
Scr = 'SCR',
Sdd = 'SDD',
Sdg = 'SDG',
Sek = 'SEK',
Sgd = 'SGD',
Shp = 'SHP',
Sll = 'SLL',
Sos = 'SOS',
Srd = 'SRD',
Std = 'STD',
Svc = 'SVC',
Syp = 'SYP',
Szl = 'SZL',
Thb = 'THB',
Tjs = 'TJS',
Tmt = 'TMT',
Tnd = 'TND',
Top = 'TOP',
Try = 'TRY',
Ttd = 'TTD',
Tvd = 'TVD',
Twd = 'TWD',
Tzs = 'TZS',
Uah = 'UAH',
Ugx = 'UGX',
Usd = 'USD',
Uyu = 'UYU',
Uzs = 'UZS',
Veb = 'VEB',
Vef = 'VEF',
Vnd = 'VND',
Vuv = 'VUV',
Won = 'WON',
Wst = 'WST',
Xaf = 'XAF',
Xbt = 'XBT',
Xcd = 'XCD',
Xof = 'XOF',
Xpf = 'XPF',
Yer = 'YER',
Zar = 'ZAR',
Zmw = 'ZMW'
}
export type CurrencyInput = {
code?: InputMaybe<CurrencyCode>;
decimalDigits?: InputMaybe<Scalars['Int']>;
decimalSeparator?: InputMaybe<Scalars['String']>;
symbol?: InputMaybe<Scalars['String']>;
thousandsSeparator?: InputMaybe<Scalars['String']>;
};
export type CustomAttribute = {
__typename?: 'CustomAttribute';
key: Scalars['String'];
value?: Maybe<Scalars['String']>;
};
export type CustomAttributeInput = {
key: Scalars['String'];
value?: InputMaybe<Scalars['String']>;
};
/** Custom Cart Attributes are used for any type of custom data you want to store on a Cart. These are transferred to Orders when you checkout. */
export type CustomCartAttribute = {
__typename?: 'CustomCartAttribute';
key: Scalars['String'];
value?: Maybe<Scalars['String']>;
};
export type DeleteCartInput = {
/** The ID of the Cart you wish to delete. */
id: Scalars['ID'];
};
export type DeletePayload = {
__typename?: 'DeletePayload';
message?: Maybe<Scalars['String']>;
success: Scalars['Boolean'];
};
export type EmptyCartInput = {
/** The ID of the Cart you wish to empty. */
id: Scalars['ID'];
};
/** The Money type is used when describing the Cart and Cart Item unit/line totals. */
export type Money = {
__typename?: 'Money';
/** The raw amount in cents/pence */
amount?: Maybe<Scalars['Int']>;
/** The current currency details of the money amount */
currency: Currency;
/** The formatted amount with the cart currency. */
formatted: Scalars['String'];
};
export type Mutation = {
__typename?: 'Mutation';
/** Use this to add items to the cart. If the item already exists, the provided input will be merged and quantity will be increased. */
addItem: Cart;
/** Use this to convert a cart to an unpaid order. */
checkout?: Maybe<Order>;
/** Use this to decrease the item quantity of the provided item ID. If the item doesn't exist, it'll throw an error. */
decrementItemQuantity: Cart;
/** Use this to delete a cart. If the cart doesn't exist, it'll throw an error. */
deleteCart: DeletePayload;
/** Use this to empty the cart. If the cart doesn't exist, it'll throw an error. */
emptyCart: Cart;
/** Use this to increase the item quantity of the provided item ID. If the item doesn't exist, it'll throw an error. */
incrementItemQuantity: Cart;
/** Use this to remove any items from the cart. If it doesn't exist, it'll throw an error. */
removeItem: Cart;
/** Use this to set all the items at once in the cart. This will override any existing items. */
setItems: Cart;
/** Use this to update the cart currency or metadata. If the cart doesn't exist, it'll throw an error. */
updateCart: Cart;
/** Use this to update any existing items in the cart. If the item doesn't exist, it'll return an error. */
updateItem: Cart;
};
export type MutationAddItemArgs = {
input: AddToCartInput;
};
export type MutationCheckoutArgs = {
input: CheckoutInput;
};
export type MutationDecrementItemQuantityArgs = {
input: UpdateItemQuantityInput;
};
export type MutationDeleteCartArgs = {
input: DeleteCartInput;
};
export type MutationEmptyCartArgs = {
input: EmptyCartInput;
};
export type MutationIncrementItemQuantityArgs = {
input: UpdateItemQuantityInput;
};
export type MutationRemoveItemArgs = {
input: RemoveCartItemInput;
};
export type MutationSetItemsArgs = {
input: SetCartItemsInput;
};
export type MutationUpdateCartArgs = {
input: UpdateCartInput;
};
export type MutationUpdateItemArgs = {
input: UpdateCartItemInput;
};
export type Node = {
id: Scalars['ID'];
};
/** Orders are immutable. Once created, you can't change them. The status will automatically reflect the current payment status. */
export type Order = {
__typename?: 'Order';
/** The custom attributes set at checkout */
attributes: Array<CustomAttribute>;
/** The orders billing address. */
billing: Address;
/** The ID of the cart you want to "checkout". */
cartId: Scalars['ID'];
/** The date and time the order was created. */
createdAt: Scalars['Date'];
/** The email of the recipient. Can be used later for cart recovery emails. */
email: Scalars['String'];
/** The grand total for all items, including shipping, including the raw/formatted amounts and currency details. */
grandTotal: Money;
id: Scalars['ID'];
/** The order items that were in the cart. */
items: Array<OrderItem>;
/** The metadata set at checkout */
metadata?: Maybe<Scalars['Json']>;
/** The notes set at checkout. */
notes?: Maybe<Scalars['String']>;
/** The orders shipping address. */
shipping: Address;
/** The total for all items with type SHIPPING, including the raw/formatted amounts and currency details. */
shippingTotal: Money;
/** The current order status. This will reflect the current payment status. The first stage is 'unpaid'. */
status: OrderStatus;
/** Sum of all SKU items, excluding discounts, taxes, shipping, including the raw/formatted amounts and currency details */
subTotal: Money;
/** The total for all items with type TAX, including the raw/formatted amounts and currency details. */
taxTotal: Money;
/** The total item count. */
totalItems: Scalars['Int'];
/** The total unique item count. */
totalUniqueItems: Scalars['Int'];
/** The date and time the order status was updated. */
updatedAt: Scalars['Date'];
};
/**
* Orders contain items that were converted from the Cart at 'checkout'.
*
* Order items are identical to the CartItem type.
*/
export type OrderItem = {
__typename?: 'OrderItem';
attributes: Array<CustomCartAttribute>;
createdAt: Scalars['Date'];
description?: Maybe<Scalars['String']>;
id: Scalars['ID'];
images?: Maybe<Array<Maybe<Scalars['String']>>>;
lineTotal: Money;
metadata?: Maybe<Scalars['Json']>;
name?: Maybe<Scalars['String']>;
quantity: Scalars['Int'];
type: CartItemType;
unitTotal: Money;
updatedAt: Scalars['Date'];
};
export enum OrderStatus {
Paid = 'PAID',
Unpaid = 'UNPAID'
}
export type Query = {
__typename?: 'Query';
/** Use this to get a cart by a custom ID. If a cart doesn't exist with this ID, it will be created for you. */
cart?: Maybe<Cart>;
node?: Maybe<Node>;
};
export type QueryCartArgs = {
currency?: InputMaybe<CurrencyInput>;
id: Scalars['ID'];
};
export type QueryNodeArgs = {
currency?: InputMaybe<CurrencyInput>;
id: Scalars['ID'];
};
export type RemoveCartItemInput = {
/** The ID of the Cart in which the CartItem belongs to. */
cartId: Scalars['ID'];
/** The ID of the CartItem you wish to remove. */
id: Scalars['ID'];
};
export type SetCartItemInput = {
attributes?: InputMaybe<Array<InputMaybe<CustomAttributeInput>>>;
currency?: InputMaybe<CurrencyInput>;
description?: InputMaybe<Scalars['String']>;
id: Scalars['ID'];
images?: InputMaybe<Array<InputMaybe<Scalars['String']>>>;
metadata?: InputMaybe<Scalars['Json']>;
name?: InputMaybe<Scalars['String']>;
price: Scalars['Int'];
quantity?: InputMaybe<Scalars['Int']>;
type?: InputMaybe<CartItemType>;
};
export type SetCartItemsInput = {
cartId: Scalars['ID'];
items: Array<SetCartItemInput>;
};
export type UpdateCartInput = {
attributes?: InputMaybe<Array<InputMaybe<CustomAttributeInput>>>;
currency?: InputMaybe<CurrencyInput>;
email?: InputMaybe<Scalars['String']>;
id: Scalars['ID'];
metadata?: InputMaybe<Scalars['Json']>;
notes?: InputMaybe<Scalars['String']>;
};
export type UpdateCartItemInput = {
cartId: Scalars['ID'];
description?: InputMaybe<Scalars['String']>;
id: Scalars['ID'];
images?: InputMaybe<Array<InputMaybe<Scalars['String']>>>;
metadata?: InputMaybe<Scalars['Json']>;
name?: InputMaybe<Scalars['String']>;
price?: InputMaybe<Scalars['Int']>;
quantity?: InputMaybe<Scalars['Int']>;
type?: InputMaybe<CartItemType>;
};
export type UpdateItemQuantityInput = {
/** The amount (as Int) you wish to increment the Cart item quantity by. */
by: Scalars['Int'];
/** The ID of the Cart in which the CartItem belongs to. */
cartId: Scalars['ID'];
/** The ID of the CartItem you wish to update. */
id: Scalars['ID'];
};
export type GetCartByIdQueryVariables = Exact<{
id: Scalars['ID'];
}>;
export type GetCartByIdQuery = { __typename?: 'Query', cart?: { __typename?: 'Cart', id: string, totalItems?: number | null, subTotal: { __typename?: 'Money', formatted: string, amount?: number | null } } | null };
export const GetCartByIdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCartById"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cart"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"formatted"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}}]}}]}}]}}]} as unknown as DocumentNode<GetCartByIdQuery, GetCartByIdQueryVariables>;