@whizzes/wbsc 0.0.1-early-dev-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # wsfc
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@whizzes/wbsc",
3
+ "version": "0.0.1-early-dev-8",
4
+ "main": "./src/index.ts",
5
+ "module": "./src/index.ts",
6
+ "types": "./src/index.d.ts",
7
+ "files": [
8
+ "./src"
9
+ ],
10
+ "exports": {
11
+ ".": "./src/index.ts",
12
+ "./types": "./src/types/index.ts"
13
+ },
14
+ "scripts": {
15
+ "types": "tsc --emitDeclarationOnly",
16
+ "check": "tsc --noEmit",
17
+ "format": "prettier . --write . && eslint . --fix",
18
+ "generate": "graphql-codegen --config codegen.yml -r dotenv/config",
19
+ "lint": "prettier --check . && eslint .",
20
+ "test": "vitest --config ./vitest.config.ts"
21
+ },
22
+ "author": "Whizzes Developers <developers@whizzes.io>",
23
+ "license": "NOLICENSE",
24
+ "description": "",
25
+ "devDependencies": {
26
+ "@graphql-codegen/cli": "^5.0.5",
27
+ "@graphql-codegen/typescript": "^4.1.6",
28
+ "@graphql-codegen/typescript-operations": "^4.6.0",
29
+ "@graphql-codegen/typescript-urql": "^4.0.0",
30
+ "@rollup/plugin-commonjs": "^28.0.3",
31
+ "@rollup/plugin-node-resolve": "^16.0.1",
32
+ "@sinclair/typebox": "^0.34.33",
33
+ "@typescript-eslint/eslint-plugin": "^8.31.0",
34
+ "@typescript-eslint/parser": "^8.31.0",
35
+ "typescript": "^5.8.3",
36
+ "vitest": "^3.1.2"
37
+ },
38
+ "peerDependencies": {
39
+ "@urql/core": "^5.1.1",
40
+ "@urql/exchange-auth": "^2.2.1",
41
+ "graphql-tag": "^2.12.6"
42
+ },
43
+ "resolutions": {
44
+ "graphql": "^16.10.0"
45
+ }
46
+ }
package/src/client.ts ADDED
@@ -0,0 +1,61 @@
1
+ import type { Client, CombinedError, OperationResult } from '@urql/core';
2
+
3
+ export class WizardGraphQLClientError extends Error {
4
+ readonly graphQLError: CombinedError;
5
+
6
+ constructor(graphQLError: CombinedError, message: string) {
7
+ super(message);
8
+
9
+ this.name = 'WizardGraphQLClientError';
10
+ this.graphQLError = graphQLError;
11
+ }
12
+ }
13
+
14
+ export class WizardGraphQLDomainError<ErrorCodeEnum> extends Error {
15
+ readonly code: ErrorCodeEnum;
16
+
17
+ constructor(code: ErrorCodeEnum, message: string) {
18
+ super(message);
19
+
20
+ this.name = 'WizardGraphQLDomainError';
21
+ this.code = code;
22
+ }
23
+ }
24
+
25
+ export class WizardGraphQLClient<ErrorCodeEnum> {
26
+ protected client: Client;
27
+
28
+ protected constructor(client: Client) {
29
+ this.client = client;
30
+ }
31
+
32
+ /**
33
+ *
34
+ * @param operation - The GraphQL operation result
35
+ * @param opName - The name of the GraphQL operation
36
+ * @returns - The error object if present, otherwise null
37
+ */
38
+ unwrapError(
39
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
+ operation: OperationResult<any, any>,
41
+ opName: string
42
+ ) {
43
+ if (operation.error) {
44
+ throw new WizardGraphQLClientError(
45
+ operation.error,
46
+ operation.error.message
47
+ );
48
+ }
49
+
50
+ if (operation.data[opName]?.error) {
51
+ const domainError = operation.data[opName].error;
52
+
53
+ if (domainError.code && domainError.message) {
54
+ throw new WizardGraphQLDomainError<ErrorCodeEnum>(
55
+ domainError.code,
56
+ domainError.message
57
+ );
58
+ }
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,9 @@
1
+ query ProductsList($channel: ChannelCode!) {
2
+ products(channelCode: $channel) {
3
+ edges {
4
+ node {
5
+ ...ProductsListFields
6
+ }
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,45 @@
1
+ fragment ProductsListFields on Product {
2
+ channelCode
3
+ id
4
+ name
5
+ slug
6
+ description
7
+ metadata
8
+ defaultVariantId
9
+ defaultVariant {
10
+ id
11
+ channelCode
12
+ sku
13
+ productId
14
+ requiresShipping
15
+ images {
16
+ id
17
+ channelCode
18
+ height
19
+ width
20
+ url
21
+ thumbnailUrl
22
+ size
23
+ mimeType
24
+ useCase
25
+ createdAt
26
+ updatedAt
27
+ }
28
+ prices {
29
+ variantId
30
+ channelCode
31
+ currency
32
+ price
33
+ }
34
+ }
35
+ position
36
+ categories {
37
+ id
38
+ name
39
+ path
40
+ position
41
+ isActive
42
+ createdAt
43
+ updatedAt
44
+ }
45
+ }
@@ -0,0 +1 @@
1
+ export { ProductService } from './service';
@@ -0,0 +1,34 @@
1
+ import { WizardGraphQLClient } from '../../client';
2
+ import {
3
+ ProductsListDocument
4
+ } from '../../types';
5
+
6
+ import type { Client } from '@urql/core';
7
+ import type {
8
+ ProductErrorCode,
9
+ ProductsListFieldsFragment
10
+ } from '../../types';
11
+
12
+ export class ProductService extends WizardGraphQLClient<ProductErrorCode> {
13
+ constructor(urqlClient: Client) {
14
+ super(urqlClient);
15
+ }
16
+
17
+ async listProducts(
18
+ channel: string,
19
+ ): Promise<ProductsListFieldsFragment[]> {
20
+ const response = await this.client
21
+ .query(ProductsListDocument, {
22
+ channel
23
+ })
24
+ .toPromise();
25
+
26
+ this.unwrapError(response, 'products');
27
+
28
+ return (
29
+ response.data?.products?.edges?.map(
30
+ (edge: { node: ProductsListFieldsFragment }) => edge.node
31
+ ) || []
32
+ );
33
+ }
34
+ }
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ export * from './core/product';
2
+
3
+ import { ProductService } from './core/product';
4
+
5
+ import type { Client as URQLClient } from '@urql/core';
6
+
7
+ export class WizardStorefrontClient {
8
+ readonly baseURL: URL;
9
+ readonly urqlClient: URQLClient;
10
+ readonly product: ProductService;
11
+
12
+ constructor(baseURL: URL, graphQLClient: URQLClient) {
13
+ this.baseURL = baseURL;
14
+ this.urqlClient = graphQLClient;
15
+ this.product = new ProductService(graphQLClient);
16
+ }
17
+ }
@@ -0,0 +1,1062 @@
1
+ import gql from 'graphql-tag';
2
+ export type Maybe<T> = T | null;
3
+ export type InputMaybe<T> = Maybe<T>;
4
+ export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
5
+ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
6
+ export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
7
+ export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
8
+ export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
9
+ export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
10
+ /** All built-in and custom scalars, mapped to their actual values */
11
+ export type Scalars = {
12
+ ID: { input: string; output: string; }
13
+ String: { input: string; output: string; }
14
+ Boolean: { input: boolean; output: boolean; }
15
+ Int: { input: number; output: number; }
16
+ Float: { input: number; output: number; }
17
+ CategoryLabel: { input: any; output: any; }
18
+ ChannelCode: { input: any; output: any; }
19
+ DateTime: { input: any; output: any; }
20
+ Decimal: { input: any; output: any; }
21
+ Email: { input: any; output: any; }
22
+ JsonSchema: { input: any; output: any; }
23
+ JsonString: { input: any; output: any; }
24
+ Slug: { input: any; output: any; }
25
+ UUID: { input: any; output: any; }
26
+ Upload: { input: any; output: any; }
27
+ };
28
+
29
+ export type ActorType = {
30
+ __typename?: 'ActorType';
31
+ actorId: Scalars['String']['output'];
32
+ actorType: ActorTypeKind;
33
+ };
34
+
35
+ export enum ActorTypeKind {
36
+ Admin = 'ADMIN',
37
+ Customer = 'CUSTOMER',
38
+ Integration = 'INTEGRATION',
39
+ Service = 'SERVICE',
40
+ Storefront = 'STOREFRONT'
41
+ }
42
+
43
+ export type AuthError = {
44
+ __typename?: 'AuthError';
45
+ code: AuthErrorCode;
46
+ message: Scalars['String']['output'];
47
+ };
48
+
49
+ export enum AuthErrorCode {
50
+ InvalidCredentials = 'INVALID_CREDENTIALS',
51
+ Unauthorized = 'UNAUTHORIZED',
52
+ Unknown = 'UNKNOWN'
53
+ }
54
+
55
+ /** Platform Category belonging to a Channel. */
56
+ export type Category = {
57
+ __typename?: 'Category';
58
+ channelCode: Scalars['ChannelCode']['output'];
59
+ createdAt: Scalars['DateTime']['output'];
60
+ id: Scalars['UUID']['output'];
61
+ isActive: Scalars['Boolean']['output'];
62
+ name: Scalars['String']['output'];
63
+ path: Array<Scalars['CategoryLabel']['output']>;
64
+ position: Scalars['Int']['output'];
65
+ updatedAt: Scalars['DateTime']['output'];
66
+ };
67
+
68
+ export type CategoryConnection = {
69
+ __typename?: 'CategoryConnection';
70
+ /** A list of edges. */
71
+ edges: Array<CategoryEdge>;
72
+ /** A list of nodes. */
73
+ nodes: Array<Category>;
74
+ /** Information to aid in pagination. */
75
+ pageInfo: PageInfo;
76
+ totalCount: Scalars['Int']['output'];
77
+ totalPages: Scalars['Int']['output'];
78
+ };
79
+
80
+ export type CategoryCreate = {
81
+ __typename?: 'CategoryCreate';
82
+ category?: Maybe<Category>;
83
+ error?: Maybe<CategoryError>;
84
+ };
85
+
86
+ export type CategoryCreateInput = {
87
+ isActive: Scalars['Boolean']['input'];
88
+ name: Scalars['String']['input'];
89
+ path: Array<Scalars['CategoryLabel']['input']>;
90
+ position: Scalars['Int']['input'];
91
+ };
92
+
93
+ export type CategoryDelete = {
94
+ __typename?: 'CategoryDelete';
95
+ error?: Maybe<CategoryError>;
96
+ };
97
+
98
+ /** An edge in a connection. */
99
+ export type CategoryEdge = {
100
+ __typename?: 'CategoryEdge';
101
+ /** A cursor for use in pagination */
102
+ cursor: Scalars['String']['output'];
103
+ /** The item at the end of the edge */
104
+ node: Category;
105
+ };
106
+
107
+ export type CategoryError = {
108
+ __typename?: 'CategoryError';
109
+ code: CategoryErrorCode;
110
+ message: Scalars['String']['output'];
111
+ };
112
+
113
+ export enum CategoryErrorCode {
114
+ DatabaseError = 'DATABASE_ERROR'
115
+ }
116
+
117
+ /** A user's Channel Role */
118
+ export type ChannelRole = {
119
+ __typename?: 'ChannelRole';
120
+ channel: Scalars['ChannelCode']['output'];
121
+ role: Role;
122
+ };
123
+
124
+ export type CmsError = {
125
+ __typename?: 'CmsError';
126
+ code: CmsErrorCode;
127
+ message: Scalars['String']['output'];
128
+ };
129
+
130
+ export enum CmsErrorCode {
131
+ CollectionContentTypeMismatch = 'COLLECTION_CONTENT_TYPE_MISMATCH',
132
+ EntryCollectionMismatch = 'ENTRY_COLLECTION_MISMATCH',
133
+ EntryValidationError = 'ENTRY_VALIDATION_ERROR',
134
+ FieldAlreadyExists = 'FIELD_ALREADY_EXISTS',
135
+ SerdeError = 'SERDE_ERROR',
136
+ Unknown = 'UNKNOWN'
137
+ }
138
+
139
+ /** CMS Content-Type */
140
+ export type ContentType = {
141
+ __typename?: 'ContentType';
142
+ channelCode: Scalars['ChannelCode']['output'];
143
+ createdAt: Scalars['DateTime']['output'];
144
+ name: Scalars['String']['output'];
145
+ schema: Scalars['JsonSchema']['output'];
146
+ slug: Scalars['Slug']['output'];
147
+ updatedAt: Scalars['DateTime']['output'];
148
+ };
149
+
150
+ export type ContentTypeConnection = {
151
+ __typename?: 'ContentTypeConnection';
152
+ /** A list of edges. */
153
+ edges: Array<ContentTypeEdge>;
154
+ /** A list of nodes. */
155
+ nodes: Array<ContentType>;
156
+ /** Information to aid in pagination. */
157
+ pageInfo: PageInfo;
158
+ totalCount: Scalars['Int']['output'];
159
+ totalPages: Scalars['Int']['output'];
160
+ };
161
+
162
+ export type ContentTypeCreate = {
163
+ __typename?: 'ContentTypeCreate';
164
+ contentType?: Maybe<ContentType>;
165
+ error?: Maybe<CmsError>;
166
+ };
167
+
168
+ export type ContentTypeCreateInput = {
169
+ name: Scalars['String']['input'];
170
+ schema: Scalars['JsonSchema']['input'];
171
+ slug: Scalars['Slug']['input'];
172
+ };
173
+
174
+ /** An edge in a connection. */
175
+ export type ContentTypeEdge = {
176
+ __typename?: 'ContentTypeEdge';
177
+ /** A cursor for use in pagination */
178
+ cursor: Scalars['String']['output'];
179
+ /** The item at the end of the edge */
180
+ node: ContentType;
181
+ };
182
+
183
+ /** Platform Customer belonging to a Channel. */
184
+ export type Customer = {
185
+ __typename?: 'Customer';
186
+ channelCode: Scalars['ChannelCode']['output'];
187
+ createdAt: Scalars['DateTime']['output'];
188
+ deletedAt?: Maybe<Scalars['DateTime']['output']>;
189
+ email?: Maybe<Scalars['Email']['output']>;
190
+ id: Scalars['UUID']['output'];
191
+ name: Scalars['String']['output'];
192
+ phoneNumber?: Maybe<Scalars['String']['output']>;
193
+ surname?: Maybe<Scalars['String']['output']>;
194
+ updatedAt: Scalars['DateTime']['output'];
195
+ };
196
+
197
+ export type CustomerConnection = {
198
+ __typename?: 'CustomerConnection';
199
+ /** A list of edges. */
200
+ edges: Array<CustomerEdge>;
201
+ /** A list of nodes. */
202
+ nodes: Array<Customer>;
203
+ /** Information to aid in pagination. */
204
+ pageInfo: PageInfo;
205
+ totalCount: Scalars['Int']['output'];
206
+ totalPages: Scalars['Int']['output'];
207
+ };
208
+
209
+ export type CustomerCreate = {
210
+ __typename?: 'CustomerCreate';
211
+ customer?: Maybe<Customer>;
212
+ error?: Maybe<CustomerError>;
213
+ };
214
+
215
+ export type CustomerCreateInput = {
216
+ email: Scalars['Email']['input'];
217
+ name: Scalars['String']['input'];
218
+ phone?: InputMaybe<Scalars['String']['input']>;
219
+ surname?: InputMaybe<Scalars['String']['input']>;
220
+ };
221
+
222
+ /** An edge in a connection. */
223
+ export type CustomerEdge = {
224
+ __typename?: 'CustomerEdge';
225
+ /** A cursor for use in pagination */
226
+ cursor: Scalars['String']['output'];
227
+ /** The item at the end of the edge */
228
+ node: Customer;
229
+ };
230
+
231
+ export type CustomerError = {
232
+ __typename?: 'CustomerError';
233
+ code: CustomerErrorCode;
234
+ message: Scalars['String']['output'];
235
+ };
236
+
237
+ export enum CustomerErrorCode {
238
+ DatabaseError = 'DATABASE_ERROR'
239
+ }
240
+
241
+ export type EntriesFilterInput = {
242
+ collectionSlug: Scalars['Slug']['input'];
243
+ };
244
+
245
+ /** CMS Entry */
246
+ export type Entry = {
247
+ __typename?: 'Entry';
248
+ channelCode: Scalars['ChannelCode']['output'];
249
+ collectionSlug: Scalars['Slug']['output'];
250
+ createdAt: Scalars['DateTime']['output'];
251
+ id: Scalars['UUID']['output'];
252
+ updatedAt: Scalars['DateTime']['output'];
253
+ value: Scalars['JsonString']['output'];
254
+ };
255
+
256
+ /** CMS Collection */
257
+ export type EntryCollection = {
258
+ __typename?: 'EntryCollection';
259
+ channelCode: Scalars['ChannelCode']['output'];
260
+ contentTypeSlug: Scalars['Slug']['output'];
261
+ createdAt: Scalars['DateTime']['output'];
262
+ description?: Maybe<Scalars['String']['output']>;
263
+ name: Scalars['String']['output'];
264
+ slug: Scalars['Slug']['output'];
265
+ updatedAt: Scalars['DateTime']['output'];
266
+ };
267
+
268
+ export type EntryCollectionConnection = {
269
+ __typename?: 'EntryCollectionConnection';
270
+ /** A list of edges. */
271
+ edges: Array<EntryCollectionEdge>;
272
+ /** A list of nodes. */
273
+ nodes: Array<EntryCollection>;
274
+ /** Information to aid in pagination. */
275
+ pageInfo: PageInfo;
276
+ totalCount: Scalars['Int']['output'];
277
+ totalPages: Scalars['Int']['output'];
278
+ };
279
+
280
+ export type EntryCollectionCreate = {
281
+ __typename?: 'EntryCollectionCreate';
282
+ collection?: Maybe<EntryCollection>;
283
+ error?: Maybe<CmsError>;
284
+ };
285
+
286
+ export type EntryCollectionCreateInput = {
287
+ contentTypeSlug: Scalars['Slug']['input'];
288
+ description?: InputMaybe<Scalars['String']['input']>;
289
+ name: Scalars['String']['input'];
290
+ slug: Scalars['Slug']['input'];
291
+ };
292
+
293
+ /** An edge in a connection. */
294
+ export type EntryCollectionEdge = {
295
+ __typename?: 'EntryCollectionEdge';
296
+ /** A cursor for use in pagination */
297
+ cursor: Scalars['String']['output'];
298
+ /** The item at the end of the edge */
299
+ node: EntryCollection;
300
+ };
301
+
302
+ export type EntryConnection = {
303
+ __typename?: 'EntryConnection';
304
+ /** A list of edges. */
305
+ edges: Array<EntryEdge>;
306
+ /** A list of nodes. */
307
+ nodes: Array<Entry>;
308
+ /** Information to aid in pagination. */
309
+ pageInfo: PageInfo;
310
+ totalCount: Scalars['Int']['output'];
311
+ totalPages: Scalars['Int']['output'];
312
+ };
313
+
314
+ export type EntryCreate = {
315
+ __typename?: 'EntryCreate';
316
+ entry?: Maybe<Entry>;
317
+ error?: Maybe<CmsError>;
318
+ };
319
+
320
+ export type EntryCreateInput = {
321
+ collectionSlug: Scalars['Slug']['input'];
322
+ value: Scalars['JsonString']['input'];
323
+ };
324
+
325
+ /** An edge in a connection. */
326
+ export type EntryEdge = {
327
+ __typename?: 'EntryEdge';
328
+ /** A cursor for use in pagination */
329
+ cursor: Scalars['String']['output'];
330
+ /** The item at the end of the edge */
331
+ node: Entry;
332
+ };
333
+
334
+ /** Platform Image */
335
+ export type Image = {
336
+ __typename?: 'Image';
337
+ channelCode: Scalars['ChannelCode']['output'];
338
+ createdAt: Scalars['DateTime']['output'];
339
+ height: Scalars['Int']['output'];
340
+ id: Scalars['UUID']['output'];
341
+ mimeType: MimeType;
342
+ providerId: Scalars['String']['output'];
343
+ size: Scalars['Int']['output'];
344
+ thumbnailUrl?: Maybe<Scalars['String']['output']>;
345
+ updatedAt: Scalars['DateTime']['output'];
346
+ url: Scalars['String']['output'];
347
+ useCase: UseCase;
348
+ width: Scalars['Int']['output'];
349
+ };
350
+
351
+ /**
352
+ * The ISO 4217 currency code.
353
+ *
354
+ * ```
355
+ * use serde::{Deserialize, Serialize};
356
+ *
357
+ * assert_eq!(serde_json::to_string(&Currency::Euro).unwrap(), "\"EUR\"");
358
+ * assert_eq!(serde_json::to_string(&Currency::UnitedStatesDollar).unwrap(), "\"USD\"");
359
+ * assert_eq!(serde_json::to_string(&Currency::AustralianDollar).unwrap(), "\"AUD\"");
360
+ * ```
361
+ *
362
+ * Read More: [Currency Codes](https://developer.paypal.com/api/rest/reference/currency-codes/)
363
+ */
364
+ export enum Iso4217 {
365
+ Ars = 'ARS',
366
+ Brl = 'BRL',
367
+ Clp = 'CLP',
368
+ Cop = 'COP',
369
+ Crc = 'CRC',
370
+ Dop = 'DOP',
371
+ Eur = 'EUR',
372
+ Gtq = 'GTQ',
373
+ Mxn = 'MXN',
374
+ Pab = 'PAB',
375
+ Pen = 'PEN',
376
+ Pyg = 'PYG',
377
+ Usd = 'USD',
378
+ Uyu = 'UYU',
379
+ Ved = 'VED'
380
+ }
381
+
382
+ export type MagicLinkSend = {
383
+ __typename?: 'MagicLinkSend';
384
+ error?: Maybe<AuthError>;
385
+ };
386
+
387
+ export type MagicLinkVerify = {
388
+ __typename?: 'MagicLinkVerify';
389
+ error?: Maybe<AuthError>;
390
+ };
391
+
392
+ export type Me = {
393
+ __typename?: 'Me';
394
+ error?: Maybe<AuthError>;
395
+ user?: Maybe<User>;
396
+ };
397
+
398
+ /**
399
+ * Image file MIME Types
400
+ *
401
+ * # Reference
402
+ *
403
+ * - [MIME Types][1]
404
+ *
405
+ * [1]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
406
+ */
407
+ export enum MimeType {
408
+ /** Heic Image (HEIC) */
409
+ Heic = 'HEIC',
410
+ /** Joint Photographic Expert Group image (JPEG) */
411
+ Jpeg = 'JPEG',
412
+ /** Portable Network Graphics (PNG) */
413
+ Png = 'PNG',
414
+ /** WebP Image (WEBP) */
415
+ Webp = 'WEBP'
416
+ }
417
+
418
+ export type Mutation = {
419
+ __typename?: 'Mutation';
420
+ /** Creates a Category */
421
+ categoryCreate: CategoryCreate;
422
+ /** Deletes a Category */
423
+ categoryDelete: CategoryDelete;
424
+ /** Creates a CMS Content-Type */
425
+ contentTypeCreate: ContentTypeCreate;
426
+ /** Creates a Customer */
427
+ customerCreate: CustomerCreate;
428
+ /** Creates a CMS Entry Collection */
429
+ entryCollectionCreate: EntryCollectionCreate;
430
+ /** Creates a CMS Entry */
431
+ entryCreate: EntryCreate;
432
+ magicLinkSend: MagicLinkSend;
433
+ magicLinkVerify: MagicLinkVerify;
434
+ /**
435
+ * Creates a order.
436
+ * This order is created with a default status of `Cart`.
437
+ */
438
+ orderCreate: OrderCreate;
439
+ /** Update the customer of an order. */
440
+ orderCustomerUpdate: OrderCustomerUpdate;
441
+ /** Add line item to an order. */
442
+ orderLineItemAdd: OrderLineItemAdd;
443
+ /** Appends a Category to a Product */
444
+ productCategoryAppend: ProductCategoryAppend;
445
+ /** Creates a Product */
446
+ productCreate: ProductCreate;
447
+ /** Updates a Product */
448
+ productUpdate: ProductUpdate;
449
+ /**
450
+ * start checkout process
451
+ * This will update the order status to `Address` or `Payment` depending on the order type.
452
+ */
453
+ startCheckout: OrderStartCheckout;
454
+ /** List Users */
455
+ userCreate: UserCreate;
456
+ /** Uploads an Image and attaches it to a Product Variant */
457
+ variantImageUpload: VariantImageUpload;
458
+ /** Creates a price for a Product Variant */
459
+ variantPriceCreate: VariantPriceCreate;
460
+ };
461
+
462
+
463
+ export type MutationCategoryCreateArgs = {
464
+ channel: Scalars['ChannelCode']['input'];
465
+ input: CategoryCreateInput;
466
+ };
467
+
468
+
469
+ export type MutationCategoryDeleteArgs = {
470
+ channel: Scalars['ChannelCode']['input'];
471
+ path: Array<Scalars['CategoryLabel']['input']>;
472
+ };
473
+
474
+
475
+ export type MutationContentTypeCreateArgs = {
476
+ channel: Scalars['ChannelCode']['input'];
477
+ input: ContentTypeCreateInput;
478
+ };
479
+
480
+
481
+ export type MutationCustomerCreateArgs = {
482
+ channel: Scalars['ChannelCode']['input'];
483
+ input: CustomerCreateInput;
484
+ };
485
+
486
+
487
+ export type MutationEntryCollectionCreateArgs = {
488
+ channel: Scalars['ChannelCode']['input'];
489
+ input: EntryCollectionCreateInput;
490
+ };
491
+
492
+
493
+ export type MutationEntryCreateArgs = {
494
+ channel: Scalars['ChannelCode']['input'];
495
+ input: EntryCreateInput;
496
+ };
497
+
498
+
499
+ export type MutationMagicLinkSendArgs = {
500
+ email: Scalars['Email']['input'];
501
+ };
502
+
503
+
504
+ export type MutationMagicLinkVerifyArgs = {
505
+ email: Scalars['Email']['input'];
506
+ token: Scalars['String']['input'];
507
+ };
508
+
509
+
510
+ export type MutationOrderCreateArgs = {
511
+ channel: Scalars['ChannelCode']['input'];
512
+ input: OrderCreateInput;
513
+ };
514
+
515
+
516
+ export type MutationOrderCustomerUpdateArgs = {
517
+ channel: Scalars['ChannelCode']['input'];
518
+ input: OrderCustomerUpdateInput;
519
+ };
520
+
521
+
522
+ export type MutationOrderLineItemAddArgs = {
523
+ channel: Scalars['ChannelCode']['input'];
524
+ input: OrderLineItemAddInput;
525
+ };
526
+
527
+
528
+ export type MutationProductCategoryAppendArgs = {
529
+ channel: Scalars['ChannelCode']['input'];
530
+ input: ProductCategoryAppendInput;
531
+ };
532
+
533
+
534
+ export type MutationProductCreateArgs = {
535
+ channel: Scalars['ChannelCode']['input'];
536
+ input: ProductCreateInput;
537
+ };
538
+
539
+
540
+ export type MutationProductUpdateArgs = {
541
+ channel: Scalars['ChannelCode']['input'];
542
+ id: Scalars['UUID']['input'];
543
+ input: ProductUpdateInput;
544
+ };
545
+
546
+
547
+ export type MutationStartCheckoutArgs = {
548
+ channel: Scalars['ChannelCode']['input'];
549
+ input: OrderStartCheckoutInput;
550
+ };
551
+
552
+
553
+ export type MutationUserCreateArgs = {
554
+ channelCode: Scalars['ChannelCode']['input'];
555
+ };
556
+
557
+
558
+ export type MutationVariantImageUploadArgs = {
559
+ channel: Scalars['ChannelCode']['input'];
560
+ input: VariantImageUploadInput;
561
+ };
562
+
563
+
564
+ export type MutationVariantPriceCreateArgs = {
565
+ channel: Scalars['ChannelCode']['input'];
566
+ input: VariantPriceCreateInput;
567
+ };
568
+
569
+ /** Platform Order belonging to a Channel. */
570
+ export type Order = {
571
+ __typename?: 'Order';
572
+ channelCode: Scalars['ChannelCode']['output'];
573
+ createdAt: Scalars['DateTime']['output'];
574
+ customer: Customer;
575
+ customerId?: Maybe<Scalars['UUID']['output']>;
576
+ id: Scalars['UUID']['output'];
577
+ lineItems: Array<OrderLineItem>;
578
+ orderEvents: Array<OrderEvent>;
579
+ orderNumber: Scalars['Int']['output'];
580
+ state: OrderState;
581
+ total: Scalars['Decimal']['output'];
582
+ updatedAt: Scalars['DateTime']['output'];
583
+ };
584
+
585
+ export enum OrderAction {
586
+ AddAddress = 'ADD_ADDRESS',
587
+ AddPayment = 'ADD_PAYMENT',
588
+ Advance = 'ADVANCE',
589
+ CancelOrder = 'CANCEL_ORDER',
590
+ ConfirmOrder = 'CONFIRM_ORDER',
591
+ Revert = 'REVERT',
592
+ SelectDelivery = 'SELECT_DELIVERY',
593
+ StartCheckout = 'START_CHECKOUT'
594
+ }
595
+
596
+ export type OrderConnection = {
597
+ __typename?: 'OrderConnection';
598
+ /** A list of edges. */
599
+ edges: Array<OrderEdge>;
600
+ /** A list of nodes. */
601
+ nodes: Array<Order>;
602
+ /** Information to aid in pagination. */
603
+ pageInfo: PageInfo;
604
+ totalCount: Scalars['Int']['output'];
605
+ totalPages: Scalars['Int']['output'];
606
+ };
607
+
608
+ export type OrderCreate = {
609
+ __typename?: 'OrderCreate';
610
+ error?: Maybe<OrderError>;
611
+ order?: Maybe<Order>;
612
+ };
613
+
614
+ export type OrderCreateInput = {
615
+ customerId?: InputMaybe<Scalars['UUID']['input']>;
616
+ };
617
+
618
+ export type OrderCustomerUpdate = {
619
+ __typename?: 'OrderCustomerUpdate';
620
+ error?: Maybe<OrderError>;
621
+ order?: Maybe<Order>;
622
+ };
623
+
624
+ export type OrderCustomerUpdateInput = {
625
+ customerId: Scalars['UUID']['input'];
626
+ orderId: Scalars['UUID']['input'];
627
+ };
628
+
629
+ /** An edge in a connection. */
630
+ export type OrderEdge = {
631
+ __typename?: 'OrderEdge';
632
+ /** A cursor for use in pagination */
633
+ cursor: Scalars['String']['output'];
634
+ /** The item at the end of the edge */
635
+ node: Order;
636
+ };
637
+
638
+ export type OrderError = {
639
+ __typename?: 'OrderError';
640
+ code: OrderErrorCode;
641
+ message: Scalars['String']['output'];
642
+ };
643
+
644
+ export enum OrderErrorCode {
645
+ DatabaseError = 'DATABASE_ERROR'
646
+ }
647
+
648
+ export type OrderEvent = {
649
+ __typename?: 'OrderEvent';
650
+ action: OrderAction;
651
+ actor?: Maybe<ActorType>;
652
+ eventTimestamp: Scalars['DateTime']['output'];
653
+ };
654
+
655
+ export type OrderLineItem = {
656
+ __typename?: 'OrderLineItem';
657
+ channelCode: Scalars['ChannelCode']['output'];
658
+ createdAt: Scalars['DateTime']['output'];
659
+ id: Scalars['UUID']['output'];
660
+ orderId: Scalars['UUID']['output'];
661
+ quantity: Scalars['Int']['output'];
662
+ totalPrice: Scalars['Decimal']['output'];
663
+ unitPrice: Scalars['Decimal']['output'];
664
+ updatedAt: Scalars['DateTime']['output'];
665
+ variant: Variant;
666
+ variantId: Scalars['UUID']['output'];
667
+ };
668
+
669
+ export type OrderLineItemAdd = {
670
+ __typename?: 'OrderLineItemAdd';
671
+ error?: Maybe<OrderError>;
672
+ orderLineItem?: Maybe<OrderLineItem>;
673
+ };
674
+
675
+ export type OrderLineItemAddInput = {
676
+ orderId: Scalars['UUID']['input'];
677
+ quantity: Scalars['Int']['input'];
678
+ variantId: Scalars['UUID']['input'];
679
+ };
680
+
681
+ export type OrderStartCheckout = {
682
+ __typename?: 'OrderStartCheckout';
683
+ error?: Maybe<OrderError>;
684
+ order?: Maybe<Order>;
685
+ };
686
+
687
+ export type OrderStartCheckoutInput = {
688
+ orderId: Scalars['UUID']['input'];
689
+ };
690
+
691
+ export enum OrderState {
692
+ Address = 'ADDRESS',
693
+ Cancel = 'CANCEL',
694
+ Cart = 'CART',
695
+ Complete = 'COMPLETE',
696
+ Confirm = 'CONFIRM',
697
+ Delivery = 'DELIVERY',
698
+ Payment = 'PAYMENT'
699
+ }
700
+
701
+ /** Information about pagination in a connection */
702
+ export type PageInfo = {
703
+ __typename?: 'PageInfo';
704
+ /** When paginating forwards, the cursor to continue. */
705
+ endCursor?: Maybe<Scalars['String']['output']>;
706
+ /** When paginating forwards, are there more items? */
707
+ hasNextPage: Scalars['Boolean']['output'];
708
+ /** When paginating backwards, are there more items? */
709
+ hasPreviousPage: Scalars['Boolean']['output'];
710
+ /** When paginating backwards, the cursor to continue. */
711
+ startCursor?: Maybe<Scalars['String']['output']>;
712
+ };
713
+
714
+ /** Platform Variant Price */
715
+ export type Price = {
716
+ __typename?: 'Price';
717
+ channelCode: Scalars['ChannelCode']['output'];
718
+ currency: Iso4217;
719
+ price: Scalars['Decimal']['output'];
720
+ variantId: Scalars['UUID']['output'];
721
+ };
722
+
723
+ /** Platform Product */
724
+ export type Product = {
725
+ __typename?: 'Product';
726
+ categories: Array<Category>;
727
+ channelCode: Scalars['ChannelCode']['output'];
728
+ createdAt: Scalars['DateTime']['output'];
729
+ defaultVariant: Variant;
730
+ defaultVariantId: Scalars['UUID']['output'];
731
+ description: Scalars['JsonString']['output'];
732
+ id: Scalars['UUID']['output'];
733
+ metadata?: Maybe<Scalars['JsonString']['output']>;
734
+ name: Scalars['String']['output'];
735
+ position: Scalars['Int']['output'];
736
+ publishAt: Scalars['DateTime']['output'];
737
+ slug: Scalars['Slug']['output'];
738
+ updatedAt: Scalars['DateTime']['output'];
739
+ };
740
+
741
+ export type ProductCategoryAppend = {
742
+ __typename?: 'ProductCategoryAppend';
743
+ error?: Maybe<ProductError>;
744
+ };
745
+
746
+ export type ProductCategoryAppendInput = {
747
+ categoryId: Scalars['UUID']['input'];
748
+ productId: Scalars['UUID']['input'];
749
+ };
750
+
751
+ export type ProductConnection = {
752
+ __typename?: 'ProductConnection';
753
+ /** A list of edges. */
754
+ edges: Array<ProductEdge>;
755
+ /** A list of nodes. */
756
+ nodes: Array<Product>;
757
+ /** Information to aid in pagination. */
758
+ pageInfo: PageInfo;
759
+ totalCount: Scalars['Int']['output'];
760
+ totalPages: Scalars['Int']['output'];
761
+ };
762
+
763
+ export type ProductCreate = {
764
+ __typename?: 'ProductCreate';
765
+ error?: Maybe<ProductError>;
766
+ product?: Maybe<Product>;
767
+ };
768
+
769
+ export type ProductCreateInput = {
770
+ name: Scalars['String']['input'];
771
+ };
772
+
773
+ /** An edge in a connection. */
774
+ export type ProductEdge = {
775
+ __typename?: 'ProductEdge';
776
+ /** A cursor for use in pagination */
777
+ cursor: Scalars['String']['output'];
778
+ /** The item at the end of the edge */
779
+ node: Product;
780
+ };
781
+
782
+ export type ProductError = {
783
+ __typename?: 'ProductError';
784
+ code: ProductErrorCode;
785
+ message: Scalars['String']['output'];
786
+ };
787
+
788
+ export enum ProductErrorCode {
789
+ DatabaseError = 'DATABASE_ERROR'
790
+ }
791
+
792
+ export type ProductUpdate = {
793
+ __typename?: 'ProductUpdate';
794
+ error?: Maybe<ProductError>;
795
+ product?: Maybe<Product>;
796
+ };
797
+
798
+ export type ProductUpdateInput = {
799
+ description?: InputMaybe<Scalars['JsonString']['input']>;
800
+ metadata?: InputMaybe<Scalars['JsonString']['input']>;
801
+ name?: InputMaybe<Scalars['String']['input']>;
802
+ position?: InputMaybe<Scalars['Int']['input']>;
803
+ slug?: InputMaybe<Scalars['Slug']['input']>;
804
+ };
805
+
806
+ export type Query = {
807
+ __typename?: 'Query';
808
+ /** Retrieves Categories */
809
+ categories: CategoryConnection;
810
+ /** Retrieves CMS Content Types */
811
+ contentTypes: ContentTypeConnection;
812
+ /** Retrieves Customers */
813
+ customers: CustomerConnection;
814
+ /** Retrieves CMS Entries */
815
+ entries: EntryConnection;
816
+ /** Retrieves CMS Entry Collections */
817
+ entryCollections: EntryCollectionConnection;
818
+ me: Me;
819
+ /** Retrieves Orders */
820
+ orders: OrderConnection;
821
+ /** Retrieves Products */
822
+ products: ProductConnection;
823
+ /** List Users */
824
+ users: Scalars['String']['output'];
825
+ };
826
+
827
+
828
+ export type QueryCategoriesArgs = {
829
+ after?: InputMaybe<Scalars['String']['input']>;
830
+ before?: InputMaybe<Scalars['String']['input']>;
831
+ channelCode: Scalars['ChannelCode']['input'];
832
+ first?: InputMaybe<Scalars['Int']['input']>;
833
+ last?: InputMaybe<Scalars['Int']['input']>;
834
+ };
835
+
836
+
837
+ export type QueryContentTypesArgs = {
838
+ after?: InputMaybe<Scalars['String']['input']>;
839
+ before?: InputMaybe<Scalars['String']['input']>;
840
+ channelCode: Scalars['ChannelCode']['input'];
841
+ first?: InputMaybe<Scalars['Int']['input']>;
842
+ last?: InputMaybe<Scalars['Int']['input']>;
843
+ };
844
+
845
+
846
+ export type QueryCustomersArgs = {
847
+ after?: InputMaybe<Scalars['String']['input']>;
848
+ before?: InputMaybe<Scalars['String']['input']>;
849
+ channelCode: Scalars['ChannelCode']['input'];
850
+ first?: InputMaybe<Scalars['Int']['input']>;
851
+ last?: InputMaybe<Scalars['Int']['input']>;
852
+ };
853
+
854
+
855
+ export type QueryEntriesArgs = {
856
+ after?: InputMaybe<Scalars['String']['input']>;
857
+ before?: InputMaybe<Scalars['String']['input']>;
858
+ channelCode: Scalars['ChannelCode']['input'];
859
+ filter: EntriesFilterInput;
860
+ first?: InputMaybe<Scalars['Int']['input']>;
861
+ last?: InputMaybe<Scalars['Int']['input']>;
862
+ };
863
+
864
+
865
+ export type QueryEntryCollectionsArgs = {
866
+ after?: InputMaybe<Scalars['String']['input']>;
867
+ before?: InputMaybe<Scalars['String']['input']>;
868
+ channelCode: Scalars['ChannelCode']['input'];
869
+ first?: InputMaybe<Scalars['Int']['input']>;
870
+ last?: InputMaybe<Scalars['Int']['input']>;
871
+ };
872
+
873
+
874
+ export type QueryOrdersArgs = {
875
+ after?: InputMaybe<Scalars['String']['input']>;
876
+ before?: InputMaybe<Scalars['String']['input']>;
877
+ channelCode: Scalars['ChannelCode']['input'];
878
+ first?: InputMaybe<Scalars['Int']['input']>;
879
+ last?: InputMaybe<Scalars['Int']['input']>;
880
+ };
881
+
882
+
883
+ export type QueryProductsArgs = {
884
+ after?: InputMaybe<Scalars['String']['input']>;
885
+ before?: InputMaybe<Scalars['String']['input']>;
886
+ channelCode: Scalars['ChannelCode']['input'];
887
+ first?: InputMaybe<Scalars['Int']['input']>;
888
+ last?: InputMaybe<Scalars['Int']['input']>;
889
+ };
890
+
891
+
892
+ export type QueryUsersArgs = {
893
+ channelCode: Scalars['ChannelCode']['input'];
894
+ };
895
+
896
+ /**
897
+ * Channel Role is a role that a user can have in a channel.
898
+ * The roles are:
899
+ * - Owner
900
+ * - Admin
901
+ * - Staff
902
+ */
903
+ export enum Role {
904
+ Admin = 'ADMIN',
905
+ Owner = 'OWNER',
906
+ Staff = 'STAFF'
907
+ }
908
+
909
+ export enum UseCase {
910
+ /** Profile Picture for a user instance */
911
+ Avatar = 'AVATAR',
912
+ /** Logo associated to a brand */
913
+ Logo = 'LOGO',
914
+ /** Image associated to a product variant */
915
+ ProductVariant = 'PRODUCT_VARIANT'
916
+ }
917
+
918
+ /** Wizard Platform User */
919
+ export type User = {
920
+ __typename?: 'User';
921
+ channels: Array<ChannelRole>;
922
+ createdAt: Scalars['DateTime']['output'];
923
+ deletedAt?: Maybe<Scalars['DateTime']['output']>;
924
+ email: Scalars['Email']['output'];
925
+ id: Scalars['UUID']['output'];
926
+ name: Scalars['String']['output'];
927
+ surname: Scalars['String']['output'];
928
+ updatedAt: Scalars['DateTime']['output'];
929
+ };
930
+
931
+ export type UserCreate = {
932
+ __typename?: 'UserCreate';
933
+ error?: Maybe<UserError>;
934
+ user?: Maybe<User>;
935
+ };
936
+
937
+ export type UserError = {
938
+ __typename?: 'UserError';
939
+ code: UserErrorCode;
940
+ message: Scalars['String']['output'];
941
+ };
942
+
943
+ export enum UserErrorCode {
944
+ DatabaseError = 'DATABASE_ERROR'
945
+ }
946
+
947
+ /** Platform Product Variant */
948
+ export type Variant = {
949
+ __typename?: 'Variant';
950
+ channelCode: Scalars['ChannelCode']['output'];
951
+ createdAt: Scalars['DateTime']['output'];
952
+ id: Scalars['UUID']['output'];
953
+ images: Array<Image>;
954
+ prices: Array<Price>;
955
+ product: Product;
956
+ productId: Scalars['UUID']['output'];
957
+ requiresShipping: Scalars['Boolean']['output'];
958
+ sku?: Maybe<Scalars['String']['output']>;
959
+ updatedAt: Scalars['DateTime']['output'];
960
+ };
961
+
962
+ export type VariantError = {
963
+ __typename?: 'VariantError';
964
+ code: VariantErrorCode;
965
+ message: Scalars['String']['output'];
966
+ };
967
+
968
+ export enum VariantErrorCode {
969
+ DatabaseError = 'DATABASE_ERROR',
970
+ ImageUploadError = 'IMAGE_UPLOAD_ERROR'
971
+ }
972
+
973
+ export type VariantImageUpload = {
974
+ __typename?: 'VariantImageUpload';
975
+ error?: Maybe<VariantError>;
976
+ image?: Maybe<Image>;
977
+ };
978
+
979
+ export type VariantImageUploadInput = {
980
+ file: Scalars['Upload']['input'];
981
+ variantId: Scalars['UUID']['input'];
982
+ };
983
+
984
+ export type VariantPriceCreate = {
985
+ __typename?: 'VariantPriceCreate';
986
+ error?: Maybe<VariantError>;
987
+ price?: Maybe<Price>;
988
+ };
989
+
990
+ export type VariantPriceCreateInput = {
991
+ currency: Iso4217;
992
+ price: Scalars['Decimal']['input'];
993
+ variantId: Scalars['UUID']['input'];
994
+ };
995
+
996
+ export type ProductsListQueryVariables = Exact<{
997
+ channel: Scalars['ChannelCode']['input'];
998
+ }>;
999
+
1000
+
1001
+ export type ProductsListQuery = { __typename?: 'Query', products: { __typename?: 'ProductConnection', edges: Array<{ __typename?: 'ProductEdge', node: { __typename?: 'Product', channelCode: any, id: any, name: string, slug: any, description: any, metadata?: any | null, defaultVariantId: any, position: number, defaultVariant: { __typename?: 'Variant', id: any, channelCode: any, sku?: string | null, productId: any, requiresShipping: boolean, images: Array<{ __typename?: 'Image', id: any, channelCode: any, height: number, width: number, url: string, thumbnailUrl?: string | null, size: number, mimeType: MimeType, useCase: UseCase, createdAt: any, updatedAt: any }>, prices: Array<{ __typename?: 'Price', variantId: any, channelCode: any, currency: Iso4217, price: any }> }, categories: Array<{ __typename?: 'Category', id: any, name: string, path: Array<any>, position: number, isActive: boolean, createdAt: any, updatedAt: any }> } }> } };
1002
+
1003
+ export type ProductsListFieldsFragment = { __typename?: 'Product', channelCode: any, id: any, name: string, slug: any, description: any, metadata?: any | null, defaultVariantId: any, position: number, defaultVariant: { __typename?: 'Variant', id: any, channelCode: any, sku?: string | null, productId: any, requiresShipping: boolean, images: Array<{ __typename?: 'Image', id: any, channelCode: any, height: number, width: number, url: string, thumbnailUrl?: string | null, size: number, mimeType: MimeType, useCase: UseCase, createdAt: any, updatedAt: any }>, prices: Array<{ __typename?: 'Price', variantId: any, channelCode: any, currency: Iso4217, price: any }> }, categories: Array<{ __typename?: 'Category', id: any, name: string, path: Array<any>, position: number, isActive: boolean, createdAt: any, updatedAt: any }> };
1004
+
1005
+ export const ProductsListFieldsFragmentDoc = gql`
1006
+ fragment ProductsListFields on Product {
1007
+ channelCode
1008
+ id
1009
+ name
1010
+ slug
1011
+ description
1012
+ metadata
1013
+ defaultVariantId
1014
+ defaultVariant {
1015
+ id
1016
+ channelCode
1017
+ sku
1018
+ productId
1019
+ requiresShipping
1020
+ images {
1021
+ id
1022
+ channelCode
1023
+ height
1024
+ width
1025
+ url
1026
+ thumbnailUrl
1027
+ size
1028
+ mimeType
1029
+ useCase
1030
+ createdAt
1031
+ updatedAt
1032
+ }
1033
+ prices {
1034
+ variantId
1035
+ channelCode
1036
+ currency
1037
+ price
1038
+ }
1039
+ }
1040
+ position
1041
+ categories {
1042
+ id
1043
+ name
1044
+ path
1045
+ position
1046
+ isActive
1047
+ createdAt
1048
+ updatedAt
1049
+ }
1050
+ }
1051
+ `;
1052
+ export const ProductsListDocument = gql`
1053
+ query ProductsList($channel: ChannelCode!) {
1054
+ products(channelCode: $channel) {
1055
+ edges {
1056
+ node {
1057
+ ...ProductsListFields
1058
+ }
1059
+ }
1060
+ }
1061
+ }
1062
+ ${ProductsListFieldsFragmentDoc}`;