@forgecart/sdk 1.2.5 → 1.2.6

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 (58) hide show
  1. package/README.md +2 -87
  2. package/dist/admin-types.generated.d.ts +9884 -0
  3. package/dist/admin.d.ts +55 -8
  4. package/dist/admin.generated.d.ts +790 -0
  5. package/dist/admin.generated.js +1801 -0
  6. package/dist/admin.js +112 -23
  7. package/dist/client.generated.d.ts +251 -0
  8. package/dist/client.generated.js +757 -0
  9. package/dist/documents.generated.d.ts +465 -0
  10. package/dist/documents.generated.js +24283 -0
  11. package/dist/error-utils.d.ts +25 -0
  12. package/dist/error-utils.js +59 -0
  13. package/dist/hook-event-map.generated.d.ts +243 -0
  14. package/dist/hook-event-map.generated.js +9 -0
  15. package/dist/index.d.ts +23 -59
  16. package/dist/index.js +35 -83
  17. package/dist/sdk-hook-subscription.generated.d.ts +29 -0
  18. package/dist/sdk-hook-subscription.generated.js +73 -0
  19. package/dist/sdk-plugin.generated.d.ts +38 -0
  20. package/dist/sdk-plugin.generated.js +31 -0
  21. package/dist/sdk-types.generated.d.ts +56 -0
  22. package/dist/sdk-types.generated.js +28 -0
  23. package/dist/shop-types.generated.d.ts +4776 -0
  24. package/dist/shop.d.ts +18 -8
  25. package/dist/shop.generated.d.ts +213 -0
  26. package/dist/shop.generated.js +465 -0
  27. package/dist/shop.js +37 -23
  28. package/dist/upload.d.ts +14 -0
  29. package/dist/upload.js +163 -0
  30. package/package.json +10 -25
  31. package/src/admin-types.generated.ts +28377 -0
  32. package/src/admin.generated.ts +1771 -0
  33. package/src/admin.ts +55 -9
  34. package/src/client.generated.ts +845 -0
  35. package/src/documents.generated.ts +24730 -0
  36. package/src/error-utils.ts +74 -0
  37. package/src/hook-event-map.generated.ts +252 -0
  38. package/src/index.ts +23 -115
  39. package/src/sdk-hook-subscription.generated.ts +93 -0
  40. package/src/sdk-plugin.generated.ts +59 -0
  41. package/src/sdk-types.generated.ts +79 -0
  42. package/src/shop-types.generated.ts +10400 -0
  43. package/src/shop.generated.ts +452 -0
  44. package/src/shop.ts +18 -9
  45. package/src/upload.ts +211 -0
  46. package/LICENSE +0 -21
  47. package/dist/admin-namespace.d.ts +0 -2688
  48. package/dist/admin-namespace.js +0 -9691
  49. package/dist/admin-types.d.ts +0 -16195
  50. package/dist/shop-namespace.d.ts +0 -718
  51. package/dist/shop-namespace.js +0 -3124
  52. package/dist/shop-types.d.ts +0 -6310
  53. package/src/admin-namespace.ts +0 -11428
  54. package/src/admin-types.ts +0 -10809
  55. package/src/shop-namespace.ts +0 -3547
  56. package/src/shop-types.ts +0 -4684
  57. /package/dist/{admin-types.js → admin-types.generated.js} +0 -0
  58. /package/dist/{shop-types.js → shop-types.generated.js} +0 -0
@@ -1,3124 +0,0 @@
1
- "use strict";
2
- /**
3
- * @forgecart/sdk - Auto-generated TypeScript SDK
4
- *
5
- * This file was automatically generated and should not be manually edited.
6
- * To regenerate, run: npm run codegen:ts
7
- *
8
- * Generated at: 2025-12-17T10:24:29.175Z
9
- * Generator version: 1.0.0
10
- *
11
- * 🤖 Generated with ForgeCart SDK Generator
12
- */
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.ShopNamespace = exports.SDKLogger = void 0;
15
- const graphql_request_1 = require("graphql-request");
16
- const graphql_ws_1 = require("graphql-ws");
17
- /**
18
- * SDK Logger - Cross-platform logging with colors
19
- * Respects debug flag for log/warn, errors are always visible
20
- */
21
- class SDKLogger {
22
- constructor(debug = false) {
23
- this.prefix = '[ForgeCart SDK]';
24
- this.debug = debug;
25
- }
26
- isNode() {
27
- return typeof process !== 'undefined' && process.versions?.node != null;
28
- }
29
- /**
30
- * Debug log - only outputs when debug: true
31
- */
32
- log(message, ...args) {
33
- if (!this.debug)
34
- return;
35
- if (this.isNode()) {
36
- console.log(`\x1b[36m${this.prefix}\x1b[0m ${message}`, ...args);
37
- }
38
- else {
39
- console.log(`%c${this.prefix}%c ${message}`, 'color: #06b6d4; font-weight: bold', 'color: inherit', ...args);
40
- }
41
- }
42
- /**
43
- * Warning log - only outputs when debug: true
44
- */
45
- warn(message, ...args) {
46
- if (!this.debug)
47
- return;
48
- if (this.isNode()) {
49
- console.warn(`\x1b[33m${this.prefix}\x1b[0m ${message}`, ...args);
50
- }
51
- else {
52
- console.warn(`%c${this.prefix}%c ${message}`, 'color: #eab308; font-weight: bold', 'color: inherit', ...args);
53
- }
54
- }
55
- /**
56
- * Error log - always outputs (errors should always be visible)
57
- */
58
- error(message, ...args) {
59
- if (this.isNode()) {
60
- console.error(`\x1b[31m${this.prefix}\x1b[0m ${message}`, ...args);
61
- }
62
- else {
63
- console.error(`%c${this.prefix}%c ${message}`, 'color: #ef4444; font-weight: bold', 'color: inherit', ...args);
64
- }
65
- }
66
- }
67
- exports.SDKLogger = SDKLogger;
68
- const assetDocument = `query asset($id: ID!) {
69
- asset(id: $id) {
70
- id
71
- createdAt
72
- updatedAt
73
- name
74
- type
75
- fileSize
76
- mimeType
77
- width
78
- height
79
- source
80
- preview
81
- thumbnail
82
- focalPoint {
83
- x
84
- y
85
- }
86
- tags {
87
- id
88
- value
89
- }
90
- customFields
91
- }
92
- }`;
93
- const assetsDocument = `query assets($options: AssetListOptions) {
94
- assets(options: $options) {
95
- items {
96
- id
97
- createdAt
98
- updatedAt
99
- name
100
- type
101
- fileSize
102
- mimeType
103
- width
104
- height
105
- source
106
- preview
107
- thumbnail
108
- focalPoint {
109
- x
110
- y
111
- }
112
- tags {
113
- id
114
- value
115
- }
116
- }
117
- totalItems
118
- }
119
- }`;
120
- const meDocument = `query me {
121
- me {
122
- id
123
- identifier
124
- channels {
125
- id
126
- token
127
- code
128
- permissions
129
- }
130
- }
131
- }`;
132
- const authenticateDocument = `mutation authenticate($input: AuthenticationInput!, $rememberMe: Boolean) {
133
- authenticate(input: $input, rememberMe: $rememberMe) {
134
- ... on CurrentUser {
135
- id
136
- identifier
137
- channels {
138
- id
139
- token
140
- code
141
- permissions
142
- }
143
- }
144
- ... on InvalidCredentialsError {
145
- errorCode
146
- message
147
- }
148
- ... on NotVerifiedError {
149
- errorCode
150
- message
151
- }
152
- }
153
- }`;
154
- const generateOtpDocument = `mutation generateOtp($customerId: ID!) {
155
- generateOtp(customerId: $customerId)
156
- }`;
157
- const verifyOtpDocument = `mutation verifyOtp($input: VerifyOtpInput!) {
158
- verifyOtp(input: $input)
159
- }`;
160
- const registerCustomerAccountDocument = `mutation registerCustomerAccount($input: RegisterCustomerInput!) {
161
- registerCustomerAccount(input: $input) {
162
- ... on Success {
163
- success
164
- }
165
- ... on MissingPasswordError {
166
- errorCode
167
- message
168
- }
169
- ... on PasswordValidationError {
170
- errorCode
171
- message
172
- validationErrorMessage
173
- }
174
- ... on NativeAuthStrategyError {
175
- errorCode
176
- message
177
- }
178
- }
179
- }`;
180
- const verifyCustomerAccountDocument = `mutation verifyCustomerAccount($token: String!, $password: String) {
181
- verifyCustomerAccount(token: $token, password: $password) {
182
- ... on CurrentUser {
183
- id
184
- identifier
185
- channels {
186
- id
187
- token
188
- code
189
- permissions
190
- }
191
- }
192
- ... on VerificationTokenInvalidError {
193
- errorCode
194
- message
195
- }
196
- ... on VerificationTokenExpiredError {
197
- errorCode
198
- message
199
- }
200
- ... on MissingPasswordError {
201
- errorCode
202
- message
203
- }
204
- ... on PasswordValidationError {
205
- errorCode
206
- message
207
- validationErrorMessage
208
- }
209
- ... on PasswordAlreadySetError {
210
- errorCode
211
- message
212
- }
213
- ... on NativeAuthStrategyError {
214
- errorCode
215
- message
216
- }
217
- }
218
- }`;
219
- const refreshCustomerVerificationDocument = `mutation refreshCustomerVerification($emailAddress: String!) {
220
- refreshCustomerVerification(emailAddress: $emailAddress) {
221
- ... on Success {
222
- success
223
- }
224
- ... on NativeAuthStrategyError {
225
- errorCode
226
- message
227
- }
228
- }
229
- }`;
230
- const updateCustomerDocument = `mutation updateCustomer($input: UpdateCustomerInput!) {
231
- updateCustomer(input: $input) {
232
- id
233
- title
234
- firstName
235
- lastName
236
- phoneNumber
237
- }
238
- }`;
239
- const updateCustomerPasswordDocument = `mutation updateCustomerPassword($currentPassword: String!, $newPassword: String!) {
240
- updateCustomerPassword(
241
- currentPassword: $currentPassword
242
- newPassword: $newPassword
243
- ) {
244
- ... on Success {
245
- success
246
- }
247
- ... on InvalidCredentialsError {
248
- errorCode
249
- message
250
- }
251
- ... on PasswordValidationError {
252
- errorCode
253
- message
254
- validationErrorMessage
255
- }
256
- ... on NativeAuthStrategyError {
257
- errorCode
258
- message
259
- }
260
- }
261
- }`;
262
- const updateCustomerEmailAddressDocument = `mutation updateCustomerEmailAddress($token: String!) {
263
- updateCustomerEmailAddress(token: $token) {
264
- ... on Success {
265
- success
266
- }
267
- ... on IdentifierChangeTokenInvalidError {
268
- errorCode
269
- message
270
- }
271
- ... on IdentifierChangeTokenExpiredError {
272
- errorCode
273
- message
274
- }
275
- ... on NativeAuthStrategyError {
276
- errorCode
277
- message
278
- }
279
- }
280
- }`;
281
- const requestUpdateCustomerEmailAddressDocument = `mutation requestUpdateCustomerEmailAddress($password: String!, $newEmailAddress: String!) {
282
- requestUpdateCustomerEmailAddress(
283
- password: $password
284
- newEmailAddress: $newEmailAddress
285
- ) {
286
- ... on Success {
287
- success
288
- }
289
- ... on InvalidCredentialsError {
290
- errorCode
291
- message
292
- }
293
- ... on EmailAddressConflictError {
294
- errorCode
295
- message
296
- }
297
- ... on NativeAuthStrategyError {
298
- errorCode
299
- message
300
- }
301
- }
302
- }`;
303
- const requestPasswordResetDocument = `mutation requestPasswordReset($emailAddress: String!) {
304
- requestPasswordReset(emailAddress: $emailAddress) {
305
- ... on Success {
306
- success
307
- }
308
- ... on NativeAuthStrategyError {
309
- errorCode
310
- message
311
- }
312
- }
313
- }`;
314
- const blogPostDocument = `query blogPost($slug: String!) {
315
- blogPost(slug: $slug) {
316
- id
317
- name
318
- title
319
- slug
320
- content
321
- excerpt
322
- author
323
- isPublished
324
- publishedAt
325
- createdAt
326
- updatedAt
327
- featuredAsset {
328
- id
329
- name
330
- preview
331
- source
332
- fileSize
333
- mimeType
334
- }
335
- facetValues {
336
- id
337
- code
338
- name
339
- }
340
- meta {
341
- id
342
- title
343
- description
344
- keywords
345
- structuredData
346
- }
347
- }
348
- }`;
349
- const blogPostsDocument = `query blogPosts($options: BlogPostListOptions) {
350
- blogPosts(options: $options) {
351
- items {
352
- id
353
- name
354
- title
355
- slug
356
- content
357
- excerpt
358
- author
359
- isPublished
360
- publishedAt
361
- createdAt
362
- updatedAt
363
- featuredAsset {
364
- id
365
- name
366
- preview
367
- source
368
- }
369
- facetValues {
370
- id
371
- code
372
- name
373
- }
374
- meta {
375
- id
376
- title
377
- description
378
- keywords
379
- }
380
- }
381
- totalItems
382
- }
383
- }`;
384
- const blogPostsByFacetsDocument = `query blogPostsByFacets($facetValueIds: [ID!]!) {
385
- blogPostsByFacets(facetValueIds: $facetValueIds) {
386
- items {
387
- id
388
- name
389
- title
390
- slug
391
- content
392
- excerpt
393
- author
394
- isPublished
395
- publishedAt
396
- createdAt
397
- updatedAt
398
- featuredAsset {
399
- id
400
- name
401
- preview
402
- source
403
- }
404
- facetValues {
405
- id
406
- code
407
- name
408
- }
409
- meta {
410
- id
411
- title
412
- description
413
- keywords
414
- }
415
- }
416
- totalItems
417
- }
418
- }`;
419
- const activeChannelDocument = `query activeChannel {
420
- activeChannel {
421
- id
422
- code
423
- token
424
- defaultLanguageCode
425
- availableLanguageCodes
426
- defaultCurrencyCode
427
- availableCurrencyCodes
428
- pricesIncludeTax
429
- defaultShippingZone {
430
- id
431
- name
432
- }
433
- defaultTaxZone {
434
- id
435
- name
436
- }
437
- seller {
438
- id
439
- name
440
- }
441
- customFields
442
- createdAt
443
- updatedAt
444
- }
445
- }`;
446
- const collectionDocument = `query collection($id: ID, $slug: String) {
447
- collection(id: $id, slug: $slug) {
448
- id
449
- createdAt
450
- updatedAt
451
- languageCode
452
- name
453
- slug
454
- description
455
- position
456
- parentId
457
- breadcrumbs {
458
- id
459
- name
460
- slug
461
- }
462
- featuredAsset {
463
- id
464
- name
465
- preview
466
- source
467
- fileSize
468
- mimeType
469
- }
470
- assets {
471
- id
472
- name
473
- preview
474
- source
475
- }
476
- parent {
477
- id
478
- name
479
- slug
480
- }
481
- children {
482
- id
483
- name
484
- slug
485
- }
486
- translations {
487
- id
488
- languageCode
489
- name
490
- slug
491
- description
492
- }
493
- }
494
- }`;
495
- const collectionsDocument = `query collections($options: CollectionListOptions) {
496
- collections(options: $options) {
497
- items {
498
- id
499
- createdAt
500
- updatedAt
501
- languageCode
502
- name
503
- slug
504
- description
505
- position
506
- parentId
507
- breadcrumbs {
508
- id
509
- name
510
- slug
511
- }
512
- featuredAsset {
513
- id
514
- name
515
- preview
516
- source
517
- }
518
- assets {
519
- id
520
- name
521
- preview
522
- source
523
- }
524
- parent {
525
- id
526
- name
527
- slug
528
- }
529
- children {
530
- id
531
- name
532
- slug
533
- }
534
- }
535
- totalItems
536
- }
537
- }`;
538
- const availableCountriesDocument = `query availableCountries {
539
- availableCountries {
540
- id
541
- createdAt
542
- updatedAt
543
- languageCode
544
- code
545
- type
546
- name
547
- enabled
548
- translations {
549
- id
550
- createdAt
551
- updatedAt
552
- languageCode
553
- name
554
- }
555
- }
556
- }`;
557
- const getAllFieldsDocument = `query getAllFields($input: GetAllFieldsInput!) {
558
- getAllFields(input: $input) {
559
- ... on BooleanFieldDefinition {
560
- __typename
561
- id
562
- fieldName
563
- title
564
- description
565
- required
566
- sortOrder
567
- template
568
- }
569
- ... on DateFieldDefinition {
570
- __typename
571
- id
572
- fieldName
573
- title
574
- description
575
- required
576
- sortOrder
577
- template
578
- }
579
- ... on FloatFieldDefinition {
580
- __typename
581
- id
582
- fieldName
583
- title
584
- description
585
- required
586
- sortOrder
587
- template
588
- }
589
- ... on GroupFieldDefinition {
590
- __typename
591
- id
592
- fieldName
593
- title
594
- description
595
- required
596
- sortOrder
597
- list
598
- template
599
- fields {
600
- ... on BooleanFieldDefinition {
601
- __typename
602
- id
603
- fieldName
604
- title
605
- }
606
- ... on StringFieldDefinition {
607
- __typename
608
- id
609
- fieldName
610
- title
611
- }
612
- ... on IntegerFieldDefinition {
613
- __typename
614
- id
615
- fieldName
616
- title
617
- }
618
- }
619
- }
620
- ... on IntegerFieldDefinition {
621
- __typename
622
- id
623
- fieldName
624
- title
625
- description
626
- required
627
- sortOrder
628
- template
629
- }
630
- ... on RelationFieldDefinition {
631
- __typename
632
- id
633
- fieldName
634
- title
635
- description
636
- required
637
- sortOrder
638
- relatedEntityName
639
- template
640
- }
641
- ... on RichTextFieldDefinition {
642
- __typename
643
- id
644
- fieldName
645
- title
646
- description
647
- required
648
- sortOrder
649
- template
650
- }
651
- ... on StringFieldDefinition {
652
- __typename
653
- id
654
- fieldName
655
- title
656
- description
657
- required
658
- sortOrder
659
- defaultValue
660
- maxLength
661
- template
662
- }
663
- }
664
- }`;
665
- const getAllValuesDocument = `query getAllValues($input: GetAllValuesInput!) {
666
- getAllValues(input: $input) {
667
- ... on BooleanValue {
668
- __typename
669
- id
670
- template
671
- booleanValue: value
672
- field {
673
- id
674
- fieldName
675
- title
676
- }
677
- }
678
- ... on DateValue {
679
- __typename
680
- id
681
- template
682
- dateValue: value
683
- field {
684
- id
685
- fieldName
686
- title
687
- }
688
- }
689
- ... on FloatValue {
690
- __typename
691
- id
692
- template
693
- floatValue: value
694
- field {
695
- id
696
- fieldName
697
- title
698
- }
699
- }
700
- ... on IntegerValue {
701
- __typename
702
- id
703
- template
704
- integerValue: value
705
- field {
706
- id
707
- fieldName
708
- title
709
- }
710
- }
711
- ... on RelationValue {
712
- __typename
713
- id
714
- template
715
- relationValue: value
716
- entity
717
- field {
718
- id
719
- fieldName
720
- title
721
- relatedEntityName
722
- }
723
- }
724
- ... on RichTextValue {
725
- __typename
726
- id
727
- template
728
- richTextValue: value
729
- field {
730
- id
731
- fieldName
732
- title
733
- }
734
- }
735
- ... on StringValue {
736
- __typename
737
- id
738
- template
739
- stringValue: value
740
- field {
741
- id
742
- fieldName
743
- title
744
- }
745
- }
746
- ... on GroupValue {
747
- __typename
748
- id
749
- template
750
- field {
751
- id
752
- fieldName
753
- title
754
- }
755
- members {
756
- id
757
- sortOrder
758
- value {
759
- ... on BooleanValue {
760
- __typename
761
- id
762
- booleanValue: value
763
- }
764
- ... on StringValue {
765
- __typename
766
- id
767
- stringValue: value
768
- }
769
- ... on IntegerValue {
770
- __typename
771
- id
772
- integerValue: value
773
- }
774
- }
775
- }
776
- }
777
- }
778
- }`;
779
- const getBooleanValueDocument = `query getBooleanValue($input: GetBooleanValueInput!) {
780
- getBooleanValue(input: $input) {
781
- id
782
- template
783
- value
784
- field {
785
- id
786
- fieldName
787
- title
788
- description
789
- required
790
- sortOrder
791
- template
792
- }
793
- }
794
- }`;
795
- const getDateValueDocument = `query getDateValue($input: GetDateValueInput!) {
796
- getDateValue(input: $input) {
797
- id
798
- template
799
- value
800
- field {
801
- id
802
- fieldName
803
- title
804
- description
805
- required
806
- sortOrder
807
- template
808
- }
809
- }
810
- }`;
811
- const getFloatValueDocument = `query getFloatValue($input: GetFloatValueInput!) {
812
- getFloatValue(input: $input) {
813
- id
814
- template
815
- value
816
- field {
817
- id
818
- fieldName
819
- title
820
- description
821
- required
822
- sortOrder
823
- template
824
- }
825
- }
826
- }`;
827
- const getGroupFieldDefinitionByIdDocument = `query getGroupFieldDefinitionById($id: String!) {
828
- getGroupFieldDefinitionById(id: $id) {
829
- id
830
- fieldName
831
- title
832
- description
833
- required
834
- sortOrder
835
- list
836
- template
837
- fields {
838
- ... on BooleanFieldDefinition {
839
- __typename
840
- id
841
- fieldName
842
- title
843
- description
844
- required
845
- sortOrder
846
- }
847
- ... on DateFieldDefinition {
848
- __typename
849
- id
850
- fieldName
851
- title
852
- description
853
- required
854
- sortOrder
855
- }
856
- ... on FloatFieldDefinition {
857
- __typename
858
- id
859
- fieldName
860
- title
861
- description
862
- required
863
- sortOrder
864
- }
865
- ... on IntegerFieldDefinition {
866
- __typename
867
- id
868
- fieldName
869
- title
870
- description
871
- required
872
- sortOrder
873
- }
874
- ... on RelationFieldDefinition {
875
- __typename
876
- id
877
- fieldName
878
- title
879
- description
880
- required
881
- sortOrder
882
- relatedEntityName
883
- }
884
- ... on RichTextFieldDefinition {
885
- __typename
886
- id
887
- fieldName
888
- title
889
- description
890
- required
891
- sortOrder
892
- }
893
- ... on StringFieldDefinition {
894
- __typename
895
- id
896
- fieldName
897
- title
898
- description
899
- required
900
- sortOrder
901
- defaultValue
902
- maxLength
903
- }
904
- }
905
- }
906
- }`;
907
- const getGroupValueDocument = `query getGroupValue($input: GetGroupValueInput!) {
908
- getGroupValue(input: $input) {
909
- id
910
- template
911
- field {
912
- id
913
- fieldName
914
- title
915
- description
916
- required
917
- sortOrder
918
- list
919
- template
920
- fields {
921
- ... on BooleanFieldDefinition {
922
- __typename
923
- id
924
- fieldName
925
- title
926
- }
927
- ... on StringFieldDefinition {
928
- __typename
929
- id
930
- fieldName
931
- title
932
- }
933
- ... on IntegerFieldDefinition {
934
- __typename
935
- id
936
- fieldName
937
- title
938
- }
939
- }
940
- }
941
- members {
942
- id
943
- sortOrder
944
- value {
945
- ... on BooleanValue {
946
- __typename
947
- id
948
- booleanValue: value
949
- field {
950
- id
951
- fieldName
952
- title
953
- }
954
- }
955
- ... on DateValue {
956
- __typename
957
- id
958
- dateValue: value
959
- field {
960
- id
961
- fieldName
962
- title
963
- }
964
- }
965
- ... on FloatValue {
966
- __typename
967
- id
968
- floatValue: value
969
- field {
970
- id
971
- fieldName
972
- title
973
- }
974
- }
975
- ... on IntegerValue {
976
- __typename
977
- id
978
- integerValue: value
979
- field {
980
- id
981
- fieldName
982
- title
983
- }
984
- }
985
- ... on RelationValue {
986
- __typename
987
- id
988
- relationValue: value
989
- entity
990
- field {
991
- id
992
- fieldName
993
- title
994
- }
995
- }
996
- ... on RichTextValue {
997
- __typename
998
- id
999
- richTextValue: value
1000
- field {
1001
- id
1002
- fieldName
1003
- title
1004
- }
1005
- }
1006
- ... on StringValue {
1007
- __typename
1008
- id
1009
- stringValue: value
1010
- field {
1011
- id
1012
- fieldName
1013
- title
1014
- }
1015
- }
1016
- }
1017
- }
1018
- }
1019
- }`;
1020
- const getIntegerValueDocument = `query getIntegerValue($input: GetIntegerValueInput!) {
1021
- getIntegerValue(input: $input) {
1022
- id
1023
- template
1024
- value
1025
- field {
1026
- id
1027
- fieldName
1028
- title
1029
- description
1030
- required
1031
- sortOrder
1032
- template
1033
- }
1034
- }
1035
- }`;
1036
- const getRelationValueDocument = `query getRelationValue($input: GetRelationValueInput!) {
1037
- getRelationValue(input: $input) {
1038
- id
1039
- template
1040
- value
1041
- entity
1042
- field {
1043
- id
1044
- fieldName
1045
- title
1046
- description
1047
- required
1048
- sortOrder
1049
- relatedEntityName
1050
- template
1051
- }
1052
- }
1053
- }`;
1054
- const getRichTextValueDocument = `query getRichTextValue($input: GetRichTextValueInput!) {
1055
- getRichTextValue(input: $input) {
1056
- id
1057
- template
1058
- value
1059
- field {
1060
- id
1061
- fieldName
1062
- title
1063
- description
1064
- required
1065
- sortOrder
1066
- template
1067
- }
1068
- }
1069
- }`;
1070
- const getStringValueDocument = `query getStringValue($input: GetStringValueInput!) {
1071
- getStringValue(input: $input) {
1072
- id
1073
- template
1074
- value
1075
- field {
1076
- id
1077
- fieldName
1078
- title
1079
- description
1080
- required
1081
- sortOrder
1082
- defaultValue
1083
- maxLength
1084
- template
1085
- }
1086
- }
1087
- }`;
1088
- const getTemplatesByEntityIdDocument = `query getTemplatesByEntityId($entityId: String!) {
1089
- getTemplatesByEntityId(entityId: $entityId)
1090
- }`;
1091
- const getUniqueTemplatesDocument = `query getUniqueTemplates($entityName: String!) {
1092
- getUniqueTemplates(entityName: $entityName)
1093
- }`;
1094
- const createCustomerAddressDocument = `mutation createCustomerAddress($input: CreateAddressInput!) {
1095
- createCustomerAddress(input: $input) {
1096
- id
1097
- createdAt
1098
- updatedAt
1099
- fullName
1100
- company
1101
- streetLine1
1102
- streetLine2
1103
- city
1104
- province
1105
- postalCode
1106
- country {
1107
- id
1108
- code
1109
- name
1110
- }
1111
- phoneNumber
1112
- defaultShippingAddress
1113
- defaultBillingAddress
1114
- }
1115
- }`;
1116
- const updateCustomerAddressDocument = `mutation updateCustomerAddress($input: UpdateAddressInput!) {
1117
- updateCustomerAddress(input: $input) {
1118
- id
1119
- createdAt
1120
- updatedAt
1121
- fullName
1122
- company
1123
- streetLine1
1124
- streetLine2
1125
- city
1126
- province
1127
- postalCode
1128
- country {
1129
- id
1130
- code
1131
- name
1132
- }
1133
- phoneNumber
1134
- defaultShippingAddress
1135
- defaultBillingAddress
1136
- }
1137
- }`;
1138
- const deleteCustomerAddressDocument = `mutation deleteCustomerAddress($id: ID!) {
1139
- deleteCustomerAddress(id: $id) {
1140
- success
1141
- }
1142
- }`;
1143
- const facetDocument = `query facet($id: ID!) {
1144
- facet(id: $id) {
1145
- id
1146
- createdAt
1147
- updatedAt
1148
- languageCode
1149
- name
1150
- code
1151
- translations {
1152
- id
1153
- languageCode
1154
- name
1155
- }
1156
- values {
1157
- id
1158
- createdAt
1159
- updatedAt
1160
- languageCode
1161
- name
1162
- code
1163
- facetId
1164
- translations {
1165
- id
1166
- languageCode
1167
- name
1168
- }
1169
- }
1170
- valueList {
1171
- items {
1172
- id
1173
- createdAt
1174
- updatedAt
1175
- languageCode
1176
- name
1177
- code
1178
- facetId
1179
- translations {
1180
- id
1181
- languageCode
1182
- name
1183
- }
1184
- }
1185
- totalItems
1186
- }
1187
- }
1188
- }`;
1189
- const facetsDocument = `query facets($options: FacetListOptions) {
1190
- facets(options: $options) {
1191
- items {
1192
- id
1193
- createdAt
1194
- updatedAt
1195
- languageCode
1196
- name
1197
- code
1198
- translations {
1199
- id
1200
- languageCode
1201
- name
1202
- }
1203
- values {
1204
- id
1205
- code
1206
- name
1207
- }
1208
- }
1209
- totalItems
1210
- }
1211
- }`;
1212
- const getOnboardingDocument = `query getOnboarding($customerId: ID!) {
1213
- getOnboarding(customerId: $customerId) {
1214
- id
1215
- countryCode
1216
- zip
1217
- city
1218
- address
1219
- state
1220
- resolveUrl
1221
- }
1222
- }`;
1223
- const createOnboardingDocument = `mutation createOnboarding($input: OnboardingCreateInput!) {
1224
- createOnboarding(input: $input) {
1225
- id
1226
- countryCode
1227
- zip
1228
- city
1229
- address
1230
- state
1231
- resolveUrl
1232
- }
1233
- }`;
1234
- const updateOnboardingDocument = `mutation updateOnboarding($input: OnboardingUpdateInput!) {
1235
- updateOnboarding(input: $input) {
1236
- id
1237
- countryCode
1238
- zip
1239
- city
1240
- address
1241
- state
1242
- resolveUrl
1243
- }
1244
- }`;
1245
- const activeOrderDocument = `query activeOrder {
1246
- activeOrder {
1247
- id
1248
- code
1249
- state
1250
- active
1251
- createdAt
1252
- updatedAt
1253
- orderPlacedAt
1254
- currencyCode
1255
- totalQuantity
1256
- subTotal
1257
- subTotalWithTax
1258
- shipping
1259
- shippingWithTax
1260
- total
1261
- totalWithTax
1262
- couponCodes
1263
- discounts {
1264
- adjustmentSource
1265
- type
1266
- description
1267
- amount
1268
- amountWithTax
1269
- }
1270
- promotions {
1271
- id
1272
- name
1273
- }
1274
- lines {
1275
- id
1276
- quantity
1277
- linePrice
1278
- linePriceWithTax
1279
- unitPrice
1280
- unitPriceWithTax
1281
- productVariant {
1282
- id
1283
- name
1284
- sku
1285
- price
1286
- priceWithTax
1287
- }
1288
- }
1289
- shippingLines {
1290
- id
1291
- priceWithTax
1292
- shippingMethod {
1293
- id
1294
- code
1295
- name
1296
- }
1297
- }
1298
- customer {
1299
- id
1300
- firstName
1301
- lastName
1302
- emailAddress
1303
- }
1304
- shippingAddress {
1305
- fullName
1306
- streetLine1
1307
- streetLine2
1308
- city
1309
- province
1310
- postalCode
1311
- country
1312
- phoneNumber
1313
- }
1314
- billingAddress {
1315
- fullName
1316
- streetLine1
1317
- streetLine2
1318
- city
1319
- province
1320
- postalCode
1321
- country
1322
- phoneNumber
1323
- }
1324
- payments {
1325
- id
1326
- amount
1327
- method
1328
- state
1329
- transactionId
1330
- }
1331
- }
1332
- }`;
1333
- const orderDocument = `query order($id: ID!) {
1334
- order(id: $id) {
1335
- id
1336
- code
1337
- state
1338
- active
1339
- createdAt
1340
- updatedAt
1341
- orderPlacedAt
1342
- currencyCode
1343
- totalQuantity
1344
- subTotal
1345
- subTotalWithTax
1346
- shipping
1347
- shippingWithTax
1348
- total
1349
- totalWithTax
1350
- couponCodes
1351
- taxSummary {
1352
- description
1353
- taxRate
1354
- taxBase
1355
- taxTotal
1356
- }
1357
- discounts {
1358
- adjustmentSource
1359
- type
1360
- description
1361
- amount
1362
- amountWithTax
1363
- }
1364
- promotions {
1365
- id
1366
- name
1367
- }
1368
- lines {
1369
- id
1370
- quantity
1371
- linePrice
1372
- linePriceWithTax
1373
- unitPrice
1374
- unitPriceWithTax
1375
- productVariant {
1376
- id
1377
- name
1378
- sku
1379
- price
1380
- priceWithTax
1381
- }
1382
- }
1383
- shippingLines {
1384
- id
1385
- priceWithTax
1386
- shippingMethod {
1387
- id
1388
- code
1389
- name
1390
- description
1391
- }
1392
- }
1393
- customer {
1394
- id
1395
- firstName
1396
- lastName
1397
- emailAddress
1398
- phoneNumber
1399
- }
1400
- shippingAddress {
1401
- fullName
1402
- streetLine1
1403
- streetLine2
1404
- city
1405
- province
1406
- postalCode
1407
- country
1408
- phoneNumber
1409
- }
1410
- billingAddress {
1411
- fullName
1412
- streetLine1
1413
- streetLine2
1414
- city
1415
- province
1416
- postalCode
1417
- country
1418
- phoneNumber
1419
- }
1420
- payments {
1421
- id
1422
- amount
1423
- method
1424
- state
1425
- transactionId
1426
- metadata
1427
- }
1428
- }
1429
- }`;
1430
- const orderByCodeDocument = `query orderByCode($code: String!) {
1431
- orderByCode(code: $code) {
1432
- id
1433
- code
1434
- state
1435
- active
1436
- type
1437
- createdAt
1438
- updatedAt
1439
- orderPlacedAt
1440
- currencyCode
1441
- totalQuantity
1442
- subTotal
1443
- subTotalWithTax
1444
- shipping
1445
- shippingWithTax
1446
- total
1447
- totalWithTax
1448
- couponCodes
1449
- taxSummary {
1450
- description
1451
- taxRate
1452
- taxBase
1453
- taxTotal
1454
- }
1455
- discounts {
1456
- adjustmentSource
1457
- type
1458
- description
1459
- amount
1460
- amountWithTax
1461
- }
1462
- promotions {
1463
- id
1464
- name
1465
- }
1466
- surcharges {
1467
- id
1468
- description
1469
- sku
1470
- price
1471
- priceWithTax
1472
- }
1473
- lines {
1474
- id
1475
- quantity
1476
- linePrice
1477
- linePriceWithTax
1478
- productVariant {
1479
- id
1480
- name
1481
- sku
1482
- }
1483
- }
1484
- shippingLines {
1485
- id
1486
- priceWithTax
1487
- shippingMethod {
1488
- id
1489
- code
1490
- name
1491
- }
1492
- }
1493
- customer {
1494
- id
1495
- firstName
1496
- lastName
1497
- emailAddress
1498
- }
1499
- shippingAddress {
1500
- fullName
1501
- streetLine1
1502
- city
1503
- postalCode
1504
- country
1505
- }
1506
- billingAddress {
1507
- fullName
1508
- streetLine1
1509
- city
1510
- postalCode
1511
- country
1512
- }
1513
- payments {
1514
- id
1515
- amount
1516
- method
1517
- state
1518
- }
1519
- fulfillments {
1520
- id
1521
- state
1522
- method
1523
- trackingCode
1524
- }
1525
- history {
1526
- items {
1527
- id
1528
- type
1529
- data
1530
- createdAt
1531
- }
1532
- }
1533
- }
1534
- }`;
1535
- const nextOrderStatesDocument = `query nextOrderStates {
1536
- nextOrderStates
1537
- }`;
1538
- const addItemToOrderDocument = `mutation addItemToOrder($productVariantId: ID!, $quantity: Int!) {
1539
- addItemToOrder(productVariantId: $productVariantId, quantity: $quantity) {
1540
- ... on Order {
1541
- __typename
1542
- id
1543
- code
1544
- state
1545
- totalQuantity
1546
- subTotal
1547
- subTotalWithTax
1548
- total
1549
- totalWithTax
1550
- lines {
1551
- id
1552
- quantity
1553
- linePrice
1554
- linePriceWithTax
1555
- productVariant {
1556
- id
1557
- name
1558
- sku
1559
- price
1560
- }
1561
- }
1562
- }
1563
- ... on OrderModificationError {
1564
- __typename
1565
- errorCode
1566
- message
1567
- }
1568
- ... on OrderLimitError {
1569
- __typename
1570
- errorCode
1571
- message
1572
- maxItems
1573
- }
1574
- ... on NegativeQuantityError {
1575
- __typename
1576
- errorCode
1577
- message
1578
- }
1579
- ... on InsufficientStockError {
1580
- __typename
1581
- errorCode
1582
- message
1583
- quantityAvailable
1584
- }
1585
- ... on OrderInterceptorError {
1586
- __typename
1587
- errorCode
1588
- message
1589
- }
1590
- }
1591
- }`;
1592
- const adjustOrderLineDocument = `mutation adjustOrderLine($orderLineId: ID!, $quantity: Int!) {
1593
- adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity) {
1594
- ... on Order {
1595
- __typename
1596
- id
1597
- code
1598
- totalQuantity
1599
- subTotal
1600
- subTotalWithTax
1601
- total
1602
- totalWithTax
1603
- lines {
1604
- id
1605
- quantity
1606
- linePrice
1607
- linePriceWithTax
1608
- productVariant {
1609
- id
1610
- name
1611
- }
1612
- }
1613
- }
1614
- ... on OrderModificationError {
1615
- __typename
1616
- errorCode
1617
- message
1618
- }
1619
- ... on OrderLimitError {
1620
- __typename
1621
- errorCode
1622
- message
1623
- maxItems
1624
- }
1625
- ... on NegativeQuantityError {
1626
- __typename
1627
- errorCode
1628
- message
1629
- }
1630
- ... on InsufficientStockError {
1631
- __typename
1632
- errorCode
1633
- message
1634
- quantityAvailable
1635
- }
1636
- ... on OrderInterceptorError {
1637
- __typename
1638
- errorCode
1639
- message
1640
- }
1641
- }
1642
- }`;
1643
- const removeOrderLineDocument = `mutation removeOrderLine($orderLineId: ID!) {
1644
- removeOrderLine(orderLineId: $orderLineId) {
1645
- ... on Order {
1646
- __typename
1647
- id
1648
- code
1649
- totalQuantity
1650
- subTotal
1651
- total
1652
- totalWithTax
1653
- lines {
1654
- id
1655
- quantity
1656
- }
1657
- }
1658
- ... on OrderModificationError {
1659
- __typename
1660
- errorCode
1661
- message
1662
- }
1663
- ... on OrderInterceptorError {
1664
- __typename
1665
- errorCode
1666
- message
1667
- }
1668
- }
1669
- }`;
1670
- const removeAllOrderLinesDocument = `mutation removeAllOrderLines {
1671
- removeAllOrderLines {
1672
- ... on Order {
1673
- __typename
1674
- id
1675
- code
1676
- totalQuantity
1677
- total
1678
- totalWithTax
1679
- lines {
1680
- id
1681
- }
1682
- }
1683
- ... on OrderModificationError {
1684
- __typename
1685
- errorCode
1686
- message
1687
- }
1688
- ... on OrderInterceptorError {
1689
- __typename
1690
- errorCode
1691
- message
1692
- }
1693
- }
1694
- }`;
1695
- const applyCouponCodeDocument = `mutation applyCouponCode($couponCode: String!) {
1696
- applyCouponCode(couponCode: $couponCode) {
1697
- ... on Order {
1698
- __typename
1699
- id
1700
- code
1701
- couponCodes
1702
- subTotal
1703
- subTotalWithTax
1704
- total
1705
- totalWithTax
1706
- discounts {
1707
- type
1708
- description
1709
- amount
1710
- amountWithTax
1711
- }
1712
- promotions {
1713
- id
1714
- name
1715
- }
1716
- }
1717
- ... on CouponCodeExpiredError {
1718
- __typename
1719
- errorCode
1720
- message
1721
- couponCode
1722
- }
1723
- ... on CouponCodeInvalidError {
1724
- __typename
1725
- errorCode
1726
- message
1727
- couponCode
1728
- }
1729
- ... on CouponCodeLimitError {
1730
- __typename
1731
- errorCode
1732
- message
1733
- couponCode
1734
- limit
1735
- }
1736
- }
1737
- }`;
1738
- const removeCouponCodeDocument = `mutation removeCouponCode($couponCode: String!) {
1739
- removeCouponCode(couponCode: $couponCode) {
1740
- id
1741
- code
1742
- couponCodes
1743
- subTotal
1744
- total
1745
- totalWithTax
1746
- discounts {
1747
- type
1748
- description
1749
- amount
1750
- }
1751
- }
1752
- }`;
1753
- const setOrderShippingAddressDocument = `mutation setOrderShippingAddress($input: CreateAddressInput!) {
1754
- setOrderShippingAddress(input: $input) {
1755
- ... on Order {
1756
- __typename
1757
- id
1758
- code
1759
- shippingAddress {
1760
- fullName
1761
- streetLine1
1762
- streetLine2
1763
- city
1764
- province
1765
- postalCode
1766
- country
1767
- phoneNumber
1768
- }
1769
- }
1770
- ... on NoActiveOrderError {
1771
- __typename
1772
- errorCode
1773
- message
1774
- }
1775
- }
1776
- }`;
1777
- const unsetOrderShippingAddressDocument = `mutation unsetOrderShippingAddress {
1778
- unsetOrderShippingAddress {
1779
- ... on Order {
1780
- __typename
1781
- id
1782
- code
1783
- shippingAddress {
1784
- fullName
1785
- streetLine1
1786
- city
1787
- }
1788
- }
1789
- ... on NoActiveOrderError {
1790
- __typename
1791
- errorCode
1792
- message
1793
- }
1794
- }
1795
- }`;
1796
- const setOrderBillingAddressDocument = `mutation setOrderBillingAddress($input: CreateAddressInput!) {
1797
- setOrderBillingAddress(input: $input) {
1798
- ... on Order {
1799
- __typename
1800
- id
1801
- code
1802
- billingAddress {
1803
- fullName
1804
- streetLine1
1805
- streetLine2
1806
- city
1807
- province
1808
- postalCode
1809
- country
1810
- phoneNumber
1811
- }
1812
- }
1813
- ... on NoActiveOrderError {
1814
- __typename
1815
- errorCode
1816
- message
1817
- }
1818
- }
1819
- }`;
1820
- const unsetOrderBillingAddressDocument = `mutation unsetOrderBillingAddress {
1821
- unsetOrderBillingAddress {
1822
- ... on Order {
1823
- __typename
1824
- id
1825
- code
1826
- billingAddress {
1827
- fullName
1828
- streetLine1
1829
- city
1830
- }
1831
- }
1832
- ... on NoActiveOrderError {
1833
- __typename
1834
- errorCode
1835
- message
1836
- }
1837
- }
1838
- }`;
1839
- const eligibleShippingMethodsDocument = `query eligibleShippingMethods {
1840
- eligibleShippingMethods {
1841
- id
1842
- name
1843
- code
1844
- description
1845
- price
1846
- priceWithTax
1847
- metadata
1848
- }
1849
- }`;
1850
- const activeShippingMethodsDocument = `query activeShippingMethods {
1851
- activeShippingMethods {
1852
- id
1853
- code
1854
- name
1855
- description
1856
- translations {
1857
- id
1858
- languageCode
1859
- name
1860
- description
1861
- }
1862
- }
1863
- }`;
1864
- const setOrderShippingMethodDocument = `mutation setOrderShippingMethod($shippingMethodId: [ID!]!) {
1865
- setOrderShippingMethod(shippingMethodId: $shippingMethodId) {
1866
- ... on Order {
1867
- __typename
1868
- id
1869
- code
1870
- shipping
1871
- shippingWithTax
1872
- total
1873
- totalWithTax
1874
- shippingLines {
1875
- id
1876
- priceWithTax
1877
- shippingMethod {
1878
- id
1879
- code
1880
- name
1881
- }
1882
- }
1883
- }
1884
- ... on OrderModificationError {
1885
- __typename
1886
- errorCode
1887
- message
1888
- }
1889
- ... on IneligibleShippingMethodError {
1890
- __typename
1891
- errorCode
1892
- message
1893
- }
1894
- ... on NoActiveOrderError {
1895
- __typename
1896
- errorCode
1897
- message
1898
- }
1899
- }
1900
- }`;
1901
- const eligiblePaymentMethodsDocument = `query eligiblePaymentMethods {
1902
- eligiblePaymentMethods {
1903
- id
1904
- code
1905
- name
1906
- description
1907
- isEligible
1908
- eligibilityMessage
1909
- }
1910
- }`;
1911
- const activePaymentMethodsDocument = `query activePaymentMethods {
1912
- activePaymentMethods {
1913
- id
1914
- code
1915
- name
1916
- description
1917
- translations {
1918
- id
1919
- languageCode
1920
- name
1921
- description
1922
- }
1923
- }
1924
- }`;
1925
- const addPaymentToOrderDocument = `mutation addPaymentToOrder($input: PaymentInput!) {
1926
- addPaymentToOrder(input: $input) {
1927
- ... on Order {
1928
- __typename
1929
- id
1930
- code
1931
- state
1932
- active
1933
- total
1934
- totalWithTax
1935
- payments {
1936
- id
1937
- amount
1938
- method
1939
- state
1940
- transactionId
1941
- metadata
1942
- }
1943
- }
1944
- ... on OrderPaymentStateError {
1945
- __typename
1946
- errorCode
1947
- message
1948
- }
1949
- ... on IneligiblePaymentMethodError {
1950
- __typename
1951
- errorCode
1952
- message
1953
- eligibilityCheckerMessage
1954
- }
1955
- ... on PaymentFailedError {
1956
- __typename
1957
- errorCode
1958
- message
1959
- paymentErrorMessage
1960
- }
1961
- ... on PaymentDeclinedError {
1962
- __typename
1963
- errorCode
1964
- message
1965
- paymentErrorMessage
1966
- }
1967
- ... on OrderStateTransitionError {
1968
- __typename
1969
- errorCode
1970
- message
1971
- transitionError
1972
- fromState
1973
- toState
1974
- }
1975
- ... on NoActiveOrderError {
1976
- __typename
1977
- errorCode
1978
- message
1979
- }
1980
- }
1981
- }`;
1982
- const transitionOrderToStateDocument = `mutation transitionOrderToState($state: String!) {
1983
- transitionOrderToState(state: $state) {
1984
- ... on Order {
1985
- __typename
1986
- id
1987
- code
1988
- state
1989
- active
1990
- }
1991
- ... on OrderStateTransitionError {
1992
- __typename
1993
- errorCode
1994
- message
1995
- transitionError
1996
- fromState
1997
- toState
1998
- }
1999
- }
2000
- }`;
2001
- const setCustomerForOrderDocument = `mutation setCustomerForOrder($input: CreateCustomerInput!) {
2002
- setCustomerForOrder(input: $input) {
2003
- ... on Order {
2004
- __typename
2005
- id
2006
- code
2007
- customer {
2008
- id
2009
- firstName
2010
- lastName
2011
- emailAddress
2012
- phoneNumber
2013
- }
2014
- }
2015
- ... on AlreadyLoggedInError {
2016
- __typename
2017
- errorCode
2018
- message
2019
- }
2020
- ... on EmailAddressConflictError {
2021
- __typename
2022
- errorCode
2023
- message
2024
- }
2025
- ... on NoActiveOrderError {
2026
- __typename
2027
- errorCode
2028
- message
2029
- }
2030
- ... on GuestCheckoutError {
2031
- __typename
2032
- errorCode
2033
- message
2034
- errorDetail
2035
- }
2036
- }
2037
- }`;
2038
- const setOrderCustomFieldsDocument = `mutation setOrderCustomFields($input: UpdateOrderInput!) {
2039
- setOrderCustomFields(input: $input) {
2040
- ... on Order {
2041
- __typename
2042
- id
2043
- code
2044
- }
2045
- ... on NoActiveOrderError {
2046
- __typename
2047
- errorCode
2048
- message
2049
- }
2050
- }
2051
- }`;
2052
- const productsDocument = `query products($options: ProductListOptions) {
2053
- products(options: $options) {
2054
- items {
2055
- id
2056
- name
2057
- slug
2058
- description
2059
- featuredAsset {
2060
- id
2061
- preview
2062
- }
2063
- variants {
2064
- id
2065
- name
2066
- sku
2067
- price
2068
- priceWithTax
2069
- stockLevel
2070
- }
2071
- }
2072
- totalItems
2073
- }
2074
- }`;
2075
- const productDocument = `query product($id: ID, $slug: String) {
2076
- product(id: $id, slug: $slug) {
2077
- id
2078
- name
2079
- slug
2080
- description
2081
- enabled
2082
- createdAt
2083
- updatedAt
2084
- languageCode
2085
- customFields
2086
- featuredAsset {
2087
- id
2088
- preview
2089
- source
2090
- }
2091
- assets {
2092
- id
2093
- preview
2094
- source
2095
- }
2096
- variants {
2097
- id
2098
- name
2099
- sku
2100
- price
2101
- priceWithTax
2102
- stockLevel
2103
- options {
2104
- id
2105
- name
2106
- code
2107
- }
2108
- }
2109
- optionGroups {
2110
- id
2111
- name
2112
- code
2113
- options {
2114
- id
2115
- name
2116
- code
2117
- }
2118
- }
2119
- facetValues {
2120
- id
2121
- name
2122
- code
2123
- }
2124
- collections {
2125
- id
2126
- name
2127
- slug
2128
- }
2129
- translations {
2130
- id
2131
- languageCode
2132
- name
2133
- slug
2134
- description
2135
- }
2136
- variantList {
2137
- items {
2138
- id
2139
- name
2140
- sku
2141
- }
2142
- totalItems
2143
- }
2144
- }
2145
- }`;
2146
- const searchDocument = `query search($input: SearchInput!) {
2147
- search(input: $input) {
2148
- totalItems
2149
- items {
2150
- productId
2151
- productName
2152
- productVariantId
2153
- productVariantName
2154
- sku
2155
- slug
2156
- description
2157
- productAsset {
2158
- id
2159
- preview
2160
- focalPoint {
2161
- x
2162
- y
2163
- }
2164
- }
2165
- productVariantAsset {
2166
- id
2167
- preview
2168
- focalPoint {
2169
- x
2170
- y
2171
- }
2172
- }
2173
- price {
2174
- ... on SinglePrice {
2175
- __typename
2176
- value
2177
- }
2178
- ... on PriceRange {
2179
- __typename
2180
- min
2181
- max
2182
- }
2183
- }
2184
- priceWithTax {
2185
- ... on SinglePrice {
2186
- __typename
2187
- value
2188
- }
2189
- ... on PriceRange {
2190
- __typename
2191
- min
2192
- max
2193
- }
2194
- }
2195
- currencyCode
2196
- facetIds
2197
- facetValueIds
2198
- collectionIds
2199
- score
2200
- }
2201
- facetValues {
2202
- count
2203
- facetValue {
2204
- id
2205
- name
2206
- code
2207
- }
2208
- }
2209
- collections {
2210
- count
2211
- collection {
2212
- id
2213
- name
2214
- slug
2215
- description
2216
- parentId
2217
- position
2218
- createdAt
2219
- updatedAt
2220
- languageCode
2221
- featuredAsset {
2222
- id
2223
- preview
2224
- }
2225
- breadcrumbs {
2226
- id
2227
- name
2228
- slug
2229
- }
2230
- parent {
2231
- id
2232
- name
2233
- }
2234
- children {
2235
- id
2236
- name
2237
- }
2238
- }
2239
- }
2240
- }
2241
- }`;
2242
- /**
2243
- * Base GraphQL Client
2244
- * Uses WebSocket as primary layer with HTTP fallback
2245
- * Handles queries, mutations, and subscriptions over WebSocket when available
2246
- */
2247
- class BaseGraphQLClient {
2248
- constructor(config) {
2249
- this.wsClient = null;
2250
- this.wsConnected = false;
2251
- this.wsInitializing = null;
2252
- this.isDisposing = false;
2253
- this.authToken = null;
2254
- this.endpoint = config.endpoint || 'https://api.forgecart.com/shop-api';
2255
- this.wsEndpoint = config.wsEndpoint || 'wss://api.forgecart.com/shop-api';
2256
- this.config = config;
2257
- this.logger = new SDKLogger(config?.debug ?? false);
2258
- // Custom fetch that captures session token from response headers
2259
- const customFetch = async (url, options) => {
2260
- const response = await fetch(url, options);
2261
- // Capture session token from response header
2262
- const authToken = response.headers.get('forge-auth-token');
2263
- if (authToken && authToken !== this.authToken) {
2264
- this.authToken = authToken;
2265
- // Reconnect WebSocket with new token
2266
- if (this.wsClient) {
2267
- this.wsConnected = false;
2268
- this.wsClient.dispose();
2269
- this.wsClient = null;
2270
- this.wsInitializing = null;
2271
- this.initializeWebSocket();
2272
- }
2273
- }
2274
- return response;
2275
- };
2276
- // Initialize HTTP client with custom fetch
2277
- this.httpClient = new graphql_request_1.GraphQLClient(this.endpoint, {
2278
- headers: config.headers || {},
2279
- credentials: 'include',
2280
- fetch: customFetch,
2281
- });
2282
- // Initialize WebSocket connection immediately
2283
- this.initializeWebSocket();
2284
- }
2285
- /**
2286
- * Extract operation name from GraphQL document
2287
- */
2288
- getOperationName(document) {
2289
- const docString = typeof document === 'string' ? document : String(document);
2290
- const match = docString.match(/(?:query|mutation|subscription)\s+(\w+)/);
2291
- return match ? match[1] : 'UnknownOperation';
2292
- }
2293
- /**
2294
- * Execute a GraphQL query or mutation
2295
- * Uses WebSocket if available, falls back to HTTP
2296
- */
2297
- async request(document, variables) {
2298
- const startTime = this.config.debug ? performance.now() : 0;
2299
- const operationName = this.config.debug ? this.getOperationName(document) : '';
2300
- let transport = 'HTTP';
2301
- // Try WebSocket first if available
2302
- if (this.wsClient && this.wsConnected) {
2303
- try {
2304
- transport = 'WebSocket';
2305
- const result = await this.requestViaWebSocket(document, variables);
2306
- if (this.config.debug) {
2307
- this.logger.log(`${operationName} (${transport}) - ${(performance.now() - startTime).toFixed(0)}ms`);
2308
- }
2309
- return result;
2310
- }
2311
- catch (wsError) {
2312
- transport = 'WebSocket -> HTTP';
2313
- this.logger.warn('WebSocket request failed, falling back to HTTP:', wsError);
2314
- // Fall through to HTTP
2315
- }
2316
- }
2317
- // Use HTTP as fallback or when WebSocket is not available
2318
- try {
2319
- const result = await this.httpClient.request(document, variables);
2320
- if (this.config.debug) {
2321
- this.logger.log(`${operationName} (${transport}) - ${(performance.now() - startTime).toFixed(0)}ms`);
2322
- }
2323
- return result;
2324
- }
2325
- catch (error) {
2326
- if (this.config.debug) {
2327
- this.logger.log(`${operationName} (${transport}) - FAILED after ${(performance.now() - startTime).toFixed(0)}ms`);
2328
- }
2329
- this.handleError(error);
2330
- throw error;
2331
- }
2332
- }
2333
- /**
2334
- * Execute request via WebSocket
2335
- * @private
2336
- */
2337
- async requestViaWebSocket(document, variables) {
2338
- if (!this.wsClient) {
2339
- throw new Error('WebSocket client not initialized');
2340
- }
2341
- return new Promise((resolve, reject) => {
2342
- const unsubscribe = this.wsClient.subscribe({
2343
- query: document,
2344
- variables,
2345
- }, {
2346
- next: (result) => {
2347
- if (result.errors) {
2348
- reject(new Error(result.errors.map(e => e.message).join(', ')));
2349
- }
2350
- else {
2351
- resolve(result.data);
2352
- }
2353
- unsubscribe();
2354
- },
2355
- error: (error) => {
2356
- reject(error);
2357
- unsubscribe();
2358
- },
2359
- complete: () => {
2360
- unsubscribe();
2361
- },
2362
- });
2363
- });
2364
- }
2365
- /**
2366
- * Handle GraphQL errors
2367
- */
2368
- handleError(error) {
2369
- this.logger.error('GraphQL Error:', error);
2370
- }
2371
- /**
2372
- * Get WebSocket implementation for current environment
2373
- */
2374
- getWebSocketImpl() {
2375
- // Use custom implementation if provided
2376
- if (this.config.webSocketImpl) {
2377
- return this.config.webSocketImpl;
2378
- }
2379
- // Browser environment (native WebSocket)
2380
- if (typeof WebSocket !== 'undefined') {
2381
- return WebSocket;
2382
- }
2383
- // Node.js environment (try to import 'ws' package)
2384
- try {
2385
- // Dynamic import for Node.js
2386
- return require('ws');
2387
- }
2388
- catch (e) {
2389
- this.logger.warn('WebSocket not available. Install "ws" package for Node.js support or provide webSocketImpl in config.');
2390
- return undefined;
2391
- }
2392
- }
2393
- /**
2394
- * Initialize WebSocket client
2395
- * Connects immediately and tracks connection state
2396
- */
2397
- initializeWebSocket() {
2398
- // Skip WebSocket if httpOnly mode is enabled
2399
- if (this.config.httpOnly) {
2400
- return;
2401
- }
2402
- // Prevent multiple simultaneous initializations
2403
- if (this.wsClient || this.wsInitializing) {
2404
- return;
2405
- }
2406
- const WebSocketImpl = this.getWebSocketImpl();
2407
- if (!WebSocketImpl) {
2408
- this.logger.warn('WebSocket not available. Will use HTTP fallback only.');
2409
- return;
2410
- }
2411
- this.wsInitializing = new Promise((resolve, reject) => {
2412
- let isResolved = false;
2413
- try {
2414
- const wsOptions = {
2415
- url: this.wsEndpoint,
2416
- webSocketImpl: WebSocketImpl,
2417
- lazy: false, // Connect immediately
2418
- keepAlive: 10000, // Send keep-alive pings every 10 seconds
2419
- connectionParams: async () => {
2420
- try {
2421
- const params = {};
2422
- // Add session token if available
2423
- if (this.authToken) {
2424
- params.Authorization = `bearer ${this.authToken}`;
2425
- }
2426
- // Pass all configured headers (including forge-token for channel)
2427
- if (this.config.headers) {
2428
- Object.entries(this.config.headers).forEach(([key, value]) => {
2429
- if (value) {
2430
- params[key] = value;
2431
- }
2432
- });
2433
- }
2434
- return params;
2435
- }
2436
- catch (error) {
2437
- this.logger.error('Error in connectionParams:', error);
2438
- return {};
2439
- }
2440
- },
2441
- retryAttempts: Infinity, // Keep retrying
2442
- shouldRetry: () => true,
2443
- retryWait: async (retries) => {
2444
- // Exponential backoff: 1s, 2s, 4s, 8s, max 30s
2445
- await new Promise(resolve => setTimeout(resolve, Math.min(1000 * Math.pow(2, retries), 30000)));
2446
- },
2447
- on: {
2448
- connected: () => {
2449
- this.wsConnected = true;
2450
- this.logger.log('WebSocket connected');
2451
- if (!isResolved) {
2452
- isResolved = true;
2453
- resolve();
2454
- }
2455
- },
2456
- closed: () => {
2457
- this.wsConnected = false;
2458
- if (!this.isDisposing) {
2459
- this.logger.log('WebSocket disconnected');
2460
- }
2461
- },
2462
- error: (error) => {
2463
- // Suppress errors during disposal - they're expected
2464
- if (!this.isDisposing && this.wsConnected) {
2465
- this.logger.error('WebSocket error:', error);
2466
- }
2467
- // Don't fail the connection on errors - let retry logic handle it
2468
- // Only log errors if we're connected (unexpected errors)
2469
- this.wsConnected = false;
2470
- },
2471
- },
2472
- };
2473
- this.wsClient = (0, graphql_ws_1.createClient)(wsOptions);
2474
- this.wsInitializing = null;
2475
- }
2476
- catch (error) {
2477
- this.logger.error('Failed to create WebSocket client:', error);
2478
- this.wsInitializing = null;
2479
- // Resolve anyway to not block - we'll fallback to HTTP
2480
- if (!isResolved) {
2481
- isResolved = true;
2482
- resolve();
2483
- }
2484
- }
2485
- });
2486
- }
2487
- /**
2488
- * Subscribe to a GraphQL subscription
2489
- */
2490
- subscribe(document, variables) {
2491
- if (!this.wsClient) {
2492
- throw new Error('WebSocket client not available. Cannot create subscription.');
2493
- }
2494
- const subscription = this.wsClient.iterate({
2495
- query: document,
2496
- variables,
2497
- });
2498
- const iterator = {
2499
- async next() {
2500
- const result = await subscription.next();
2501
- if (result.done) {
2502
- return { done: true, value: undefined };
2503
- }
2504
- if (result.value.errors) {
2505
- throw new Error(result.value.errors.map(e => e.message).join(', '));
2506
- }
2507
- return { done: false, value: result.value.data };
2508
- },
2509
- async return() {
2510
- subscription.return?.();
2511
- return { done: true, value: undefined };
2512
- },
2513
- async throw(error) {
2514
- subscription.throw?.(error);
2515
- return { done: true, value: undefined };
2516
- },
2517
- [Symbol.asyncIterator]() {
2518
- return this;
2519
- },
2520
- };
2521
- return iterator;
2522
- }
2523
- /**
2524
- * Set authentication token
2525
- * Updates both HTTP and WebSocket connections
2526
- */
2527
- setAuthToken(token) {
2528
- this.authToken = token;
2529
- this.httpClient.setHeader('Authorization', `Bearer ${token}`);
2530
- // Reconnect WebSocket with new token
2531
- if (this.wsClient) {
2532
- this.wsConnected = false;
2533
- this.wsClient.dispose();
2534
- this.wsClient = null;
2535
- this.wsInitializing = null;
2536
- // Reinitialize with new token
2537
- this.initializeWebSocket();
2538
- }
2539
- }
2540
- /**
2541
- * Clear authentication token
2542
- * Updates both HTTP and WebSocket connections
2543
- */
2544
- clearAuthToken() {
2545
- this.authToken = null;
2546
- this.httpClient.setHeader('Authorization', '');
2547
- // Reconnect WebSocket without token
2548
- if (this.wsClient) {
2549
- this.wsConnected = false;
2550
- this.wsClient.dispose();
2551
- this.wsClient = null;
2552
- this.wsInitializing = null;
2553
- // Reinitialize without token
2554
- this.initializeWebSocket();
2555
- }
2556
- }
2557
- /**
2558
- * Dispose of the client and close all connections
2559
- */
2560
- dispose() {
2561
- this.isDisposing = true;
2562
- if (this.wsClient) {
2563
- this.wsConnected = false;
2564
- this.wsClient.dispose();
2565
- this.wsClient = null;
2566
- this.wsInitializing = null;
2567
- }
2568
- }
2569
- }
2570
- /**
2571
- * Asset operations
2572
- */
2573
- class AssetOperations {
2574
- constructor(client) {
2575
- this.client = client;
2576
- }
2577
- /**
2578
- * asset query
2579
- */
2580
- async asset(variables) {
2581
- return await this.client.request(assetDocument, variables);
2582
- }
2583
- /**
2584
- * assets query
2585
- */
2586
- async assets(variables) {
2587
- return await this.client.request(assetsDocument, variables);
2588
- }
2589
- }
2590
- /**
2591
- * Auth operations
2592
- */
2593
- class AuthOperations {
2594
- constructor(client) {
2595
- this.client = client;
2596
- }
2597
- /**
2598
- * me query
2599
- */
2600
- async me() {
2601
- return await this.client.request(meDocument);
2602
- }
2603
- /**
2604
- * authenticate mutation
2605
- */
2606
- async authenticate(variables) {
2607
- return await this.client.request(authenticateDocument, variables);
2608
- }
2609
- /**
2610
- * generateOtp mutation
2611
- */
2612
- async generateOtp(variables) {
2613
- return await this.client.request(generateOtpDocument, variables);
2614
- }
2615
- /**
2616
- * verifyOtp mutation
2617
- */
2618
- async verifyOtp(variables) {
2619
- return await this.client.request(verifyOtpDocument, variables);
2620
- }
2621
- /**
2622
- * registerCustomerAccount mutation
2623
- */
2624
- async registerCustomerAccount(variables) {
2625
- return await this.client.request(registerCustomerAccountDocument, variables);
2626
- }
2627
- /**
2628
- * verifyCustomerAccount mutation
2629
- */
2630
- async verifyCustomerAccount(variables) {
2631
- return await this.client.request(verifyCustomerAccountDocument, variables);
2632
- }
2633
- /**
2634
- * refreshCustomerVerification mutation
2635
- */
2636
- async refreshCustomerVerification(variables) {
2637
- return await this.client.request(refreshCustomerVerificationDocument, variables);
2638
- }
2639
- /**
2640
- * updateCustomer mutation
2641
- */
2642
- async updateCustomer(variables) {
2643
- return await this.client.request(updateCustomerDocument, variables);
2644
- }
2645
- /**
2646
- * updateCustomerPassword mutation
2647
- */
2648
- async updateCustomerPassword(variables) {
2649
- return await this.client.request(updateCustomerPasswordDocument, variables);
2650
- }
2651
- /**
2652
- * updateCustomerEmailAddress mutation
2653
- */
2654
- async updateCustomerEmailAddress(variables) {
2655
- return await this.client.request(updateCustomerEmailAddressDocument, variables);
2656
- }
2657
- /**
2658
- * requestUpdateCustomerEmailAddress mutation
2659
- */
2660
- async requestUpdateCustomerEmailAddress(variables) {
2661
- return await this.client.request(requestUpdateCustomerEmailAddressDocument, variables);
2662
- }
2663
- /**
2664
- * requestPasswordReset mutation
2665
- */
2666
- async requestPasswordReset(variables) {
2667
- return await this.client.request(requestPasswordResetDocument, variables);
2668
- }
2669
- }
2670
- /**
2671
- * Blog operations
2672
- */
2673
- class BlogOperations {
2674
- constructor(client) {
2675
- this.client = client;
2676
- }
2677
- /**
2678
- * blogPost query
2679
- */
2680
- async blogPost(variables) {
2681
- return await this.client.request(blogPostDocument, variables);
2682
- }
2683
- /**
2684
- * blogPosts query
2685
- */
2686
- async blogPosts(variables) {
2687
- return await this.client.request(blogPostsDocument, variables);
2688
- }
2689
- /**
2690
- * blogPostsByFacets query
2691
- */
2692
- async blogPostsByFacets(variables) {
2693
- return await this.client.request(blogPostsByFacetsDocument, variables);
2694
- }
2695
- }
2696
- /**
2697
- * Channel operations
2698
- */
2699
- class ChannelOperations {
2700
- constructor(client) {
2701
- this.client = client;
2702
- }
2703
- /**
2704
- * activeChannel query
2705
- */
2706
- async activeChannel() {
2707
- return await this.client.request(activeChannelDocument);
2708
- }
2709
- }
2710
- /**
2711
- * Collection operations
2712
- */
2713
- class CollectionOperations {
2714
- constructor(client) {
2715
- this.client = client;
2716
- }
2717
- /**
2718
- * collection query
2719
- */
2720
- async collection(variables) {
2721
- return await this.client.request(collectionDocument, variables);
2722
- }
2723
- /**
2724
- * collections query
2725
- */
2726
- async collections(variables) {
2727
- return await this.client.request(collectionsDocument, variables);
2728
- }
2729
- }
2730
- /**
2731
- * Country operations
2732
- */
2733
- class CountryOperations {
2734
- constructor(client) {
2735
- this.client = client;
2736
- }
2737
- /**
2738
- * availableCountries query
2739
- */
2740
- async availableCountries() {
2741
- return await this.client.request(availableCountriesDocument);
2742
- }
2743
- }
2744
- /**
2745
- * CustomFields operations
2746
- */
2747
- class CustomFieldsOperations {
2748
- constructor(client) {
2749
- this.client = client;
2750
- }
2751
- /**
2752
- * getAllFields query
2753
- */
2754
- async getAllFields(variables) {
2755
- return await this.client.request(getAllFieldsDocument, variables);
2756
- }
2757
- /**
2758
- * getAllValues query
2759
- */
2760
- async getAllValues(variables) {
2761
- return await this.client.request(getAllValuesDocument, variables);
2762
- }
2763
- /**
2764
- * getBooleanValue query
2765
- */
2766
- async getBooleanValue(variables) {
2767
- return await this.client.request(getBooleanValueDocument, variables);
2768
- }
2769
- /**
2770
- * getDateValue query
2771
- */
2772
- async getDateValue(variables) {
2773
- return await this.client.request(getDateValueDocument, variables);
2774
- }
2775
- /**
2776
- * getFloatValue query
2777
- */
2778
- async getFloatValue(variables) {
2779
- return await this.client.request(getFloatValueDocument, variables);
2780
- }
2781
- /**
2782
- * getGroupFieldDefinitionById query
2783
- */
2784
- async getGroupFieldDefinitionById(variables) {
2785
- return await this.client.request(getGroupFieldDefinitionByIdDocument, variables);
2786
- }
2787
- /**
2788
- * getGroupValue query
2789
- */
2790
- async getGroupValue(variables) {
2791
- return await this.client.request(getGroupValueDocument, variables);
2792
- }
2793
- /**
2794
- * getIntegerValue query
2795
- */
2796
- async getIntegerValue(variables) {
2797
- return await this.client.request(getIntegerValueDocument, variables);
2798
- }
2799
- /**
2800
- * getRelationValue query
2801
- */
2802
- async getRelationValue(variables) {
2803
- return await this.client.request(getRelationValueDocument, variables);
2804
- }
2805
- /**
2806
- * getRichTextValue query
2807
- */
2808
- async getRichTextValue(variables) {
2809
- return await this.client.request(getRichTextValueDocument, variables);
2810
- }
2811
- /**
2812
- * getStringValue query
2813
- */
2814
- async getStringValue(variables) {
2815
- return await this.client.request(getStringValueDocument, variables);
2816
- }
2817
- /**
2818
- * getTemplatesByEntityId query
2819
- */
2820
- async getTemplatesByEntityId(variables) {
2821
- return await this.client.request(getTemplatesByEntityIdDocument, variables);
2822
- }
2823
- /**
2824
- * getUniqueTemplates query
2825
- */
2826
- async getUniqueTemplates(variables) {
2827
- return await this.client.request(getUniqueTemplatesDocument, variables);
2828
- }
2829
- }
2830
- /**
2831
- * Customer operations
2832
- */
2833
- class CustomerOperations {
2834
- constructor(client) {
2835
- this.client = client;
2836
- }
2837
- /**
2838
- * createCustomerAddress mutation
2839
- */
2840
- async createCustomerAddress(variables) {
2841
- return await this.client.request(createCustomerAddressDocument, variables);
2842
- }
2843
- /**
2844
- * updateCustomerAddress mutation
2845
- */
2846
- async updateCustomerAddress(variables) {
2847
- return await this.client.request(updateCustomerAddressDocument, variables);
2848
- }
2849
- /**
2850
- * deleteCustomerAddress mutation
2851
- */
2852
- async deleteCustomerAddress(variables) {
2853
- return await this.client.request(deleteCustomerAddressDocument, variables);
2854
- }
2855
- }
2856
- /**
2857
- * Facet operations
2858
- */
2859
- class FacetOperations {
2860
- constructor(client) {
2861
- this.client = client;
2862
- }
2863
- /**
2864
- * facet query
2865
- */
2866
- async facet(variables) {
2867
- return await this.client.request(facetDocument, variables);
2868
- }
2869
- /**
2870
- * facets query
2871
- */
2872
- async facets(variables) {
2873
- return await this.client.request(facetsDocument, variables);
2874
- }
2875
- }
2876
- /**
2877
- * Onboarding operations
2878
- */
2879
- class OnboardingOperations {
2880
- constructor(client) {
2881
- this.client = client;
2882
- }
2883
- /**
2884
- * getOnboarding query
2885
- */
2886
- async getOnboarding(variables) {
2887
- return await this.client.request(getOnboardingDocument, variables);
2888
- }
2889
- /**
2890
- * createOnboarding mutation
2891
- */
2892
- async createOnboarding(variables) {
2893
- return await this.client.request(createOnboardingDocument, variables);
2894
- }
2895
- /**
2896
- * updateOnboarding mutation
2897
- */
2898
- async updateOnboarding(variables) {
2899
- return await this.client.request(updateOnboardingDocument, variables);
2900
- }
2901
- }
2902
- /**
2903
- * Order operations
2904
- */
2905
- class OrderOperations {
2906
- constructor(client) {
2907
- this.client = client;
2908
- }
2909
- /**
2910
- * activeOrder query
2911
- */
2912
- async activeOrder() {
2913
- return await this.client.request(activeOrderDocument);
2914
- }
2915
- /**
2916
- * order query
2917
- */
2918
- async order(variables) {
2919
- return await this.client.request(orderDocument, variables);
2920
- }
2921
- /**
2922
- * orderByCode query
2923
- */
2924
- async orderByCode(variables) {
2925
- return await this.client.request(orderByCodeDocument, variables);
2926
- }
2927
- /**
2928
- * nextOrderStates query
2929
- */
2930
- async nextOrderStates() {
2931
- return await this.client.request(nextOrderStatesDocument);
2932
- }
2933
- /**
2934
- * addItemToOrder mutation
2935
- */
2936
- async addItemToOrder(variables) {
2937
- return await this.client.request(addItemToOrderDocument, variables);
2938
- }
2939
- /**
2940
- * adjustOrderLine mutation
2941
- */
2942
- async adjustOrderLine(variables) {
2943
- return await this.client.request(adjustOrderLineDocument, variables);
2944
- }
2945
- /**
2946
- * removeOrderLine mutation
2947
- */
2948
- async removeOrderLine(variables) {
2949
- return await this.client.request(removeOrderLineDocument, variables);
2950
- }
2951
- /**
2952
- * removeAllOrderLines mutation
2953
- */
2954
- async removeAllOrderLines() {
2955
- return await this.client.request(removeAllOrderLinesDocument);
2956
- }
2957
- /**
2958
- * applyCouponCode mutation
2959
- */
2960
- async applyCouponCode(variables) {
2961
- return await this.client.request(applyCouponCodeDocument, variables);
2962
- }
2963
- /**
2964
- * removeCouponCode mutation
2965
- */
2966
- async removeCouponCode(variables) {
2967
- return await this.client.request(removeCouponCodeDocument, variables);
2968
- }
2969
- /**
2970
- * setOrderShippingAddress mutation
2971
- */
2972
- async setOrderShippingAddress(variables) {
2973
- return await this.client.request(setOrderShippingAddressDocument, variables);
2974
- }
2975
- /**
2976
- * unsetOrderShippingAddress mutation
2977
- */
2978
- async unsetOrderShippingAddress() {
2979
- return await this.client.request(unsetOrderShippingAddressDocument);
2980
- }
2981
- /**
2982
- * setOrderBillingAddress mutation
2983
- */
2984
- async setOrderBillingAddress(variables) {
2985
- return await this.client.request(setOrderBillingAddressDocument, variables);
2986
- }
2987
- /**
2988
- * unsetOrderBillingAddress mutation
2989
- */
2990
- async unsetOrderBillingAddress() {
2991
- return await this.client.request(unsetOrderBillingAddressDocument);
2992
- }
2993
- /**
2994
- * eligibleShippingMethods query
2995
- */
2996
- async eligibleShippingMethods() {
2997
- return await this.client.request(eligibleShippingMethodsDocument);
2998
- }
2999
- /**
3000
- * activeShippingMethods query
3001
- */
3002
- async activeShippingMethods() {
3003
- return await this.client.request(activeShippingMethodsDocument);
3004
- }
3005
- /**
3006
- * setOrderShippingMethod mutation
3007
- */
3008
- async setOrderShippingMethod(variables) {
3009
- return await this.client.request(setOrderShippingMethodDocument, variables);
3010
- }
3011
- /**
3012
- * eligiblePaymentMethods query
3013
- */
3014
- async eligiblePaymentMethods() {
3015
- return await this.client.request(eligiblePaymentMethodsDocument);
3016
- }
3017
- /**
3018
- * activePaymentMethods query
3019
- */
3020
- async activePaymentMethods() {
3021
- return await this.client.request(activePaymentMethodsDocument);
3022
- }
3023
- /**
3024
- * addPaymentToOrder mutation
3025
- */
3026
- async addPaymentToOrder(variables) {
3027
- return await this.client.request(addPaymentToOrderDocument, variables);
3028
- }
3029
- /**
3030
- * transitionOrderToState mutation
3031
- */
3032
- async transitionOrderToState(variables) {
3033
- return await this.client.request(transitionOrderToStateDocument, variables);
3034
- }
3035
- /**
3036
- * setCustomerForOrder mutation
3037
- */
3038
- async setCustomerForOrder(variables) {
3039
- return await this.client.request(setCustomerForOrderDocument, variables);
3040
- }
3041
- /**
3042
- * setOrderCustomFields mutation
3043
- */
3044
- async setOrderCustomFields(variables) {
3045
- return await this.client.request(setOrderCustomFieldsDocument, variables);
3046
- }
3047
- }
3048
- /**
3049
- * Products operations
3050
- */
3051
- class ProductsOperations {
3052
- constructor(client) {
3053
- this.client = client;
3054
- }
3055
- /**
3056
- * products query
3057
- */
3058
- async products(variables) {
3059
- return await this.client.request(productsDocument, variables);
3060
- }
3061
- /**
3062
- * product query
3063
- */
3064
- async product(variables) {
3065
- return await this.client.request(productDocument, variables);
3066
- }
3067
- }
3068
- /**
3069
- * Search operations
3070
- */
3071
- class SearchOperations {
3072
- constructor(client) {
3073
- this.client = client;
3074
- }
3075
- /**
3076
- * search query
3077
- */
3078
- async search(variables) {
3079
- return await this.client.request(searchDocument, variables);
3080
- }
3081
- }
3082
- /**
3083
- * Shop namespace
3084
- * Contains categorized operations for shop API
3085
- */
3086
- class ShopNamespace {
3087
- constructor(config) {
3088
- this.client = new BaseGraphQLClient(config);
3089
- this.logger = new SDKLogger(config?.debug ?? false);
3090
- this.asset = new AssetOperations(this.client);
3091
- this.auth = new AuthOperations(this.client);
3092
- this.blog = new BlogOperations(this.client);
3093
- this.channel = new ChannelOperations(this.client);
3094
- this.collection = new CollectionOperations(this.client);
3095
- this.country = new CountryOperations(this.client);
3096
- this.customFields = new CustomFieldsOperations(this.client);
3097
- this.customer = new CustomerOperations(this.client);
3098
- this.facet = new FacetOperations(this.client);
3099
- this.onboarding = new OnboardingOperations(this.client);
3100
- this.order = new OrderOperations(this.client);
3101
- this.products = new ProductsOperations(this.client);
3102
- this.search = new SearchOperations(this.client);
3103
- }
3104
- /**
3105
- * Set authentication token
3106
- * Updates the client with the new token
3107
- */
3108
- setAuthToken(token) {
3109
- this.client.setAuthToken(token);
3110
- }
3111
- /**
3112
- * Clear authentication token
3113
- */
3114
- clearAuthToken() {
3115
- this.client.clearAuthToken();
3116
- }
3117
- /**
3118
- * Dispose of the namespace and close all connections
3119
- */
3120
- dispose() {
3121
- this.client.dispose();
3122
- }
3123
- }
3124
- exports.ShopNamespace = ShopNamespace;