@forgecart/sdk 0.1.0 → 1.2.0

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