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