@bacano/sdk 1.0.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.
package/graphql.cjs ADDED
@@ -0,0 +1,2057 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // libs/sdk/src/graphql.ts
21
+ var graphql_exports = {};
22
+ __export(graphql_exports, {
23
+ APPLY_COUPON: () => APPLY_COUPON,
24
+ CHECKOUT: () => CHECKOUT,
25
+ CHECK_AVAILABILITY: () => CHECK_AVAILABILITY,
26
+ CREATE_CART: () => CREATE_CART,
27
+ CREATE_PAYMENT_SESSION: () => CREATE_PAYMENT_SESSION,
28
+ GET_BRANDS: () => GET_BRANDS,
29
+ GET_CART: () => GET_CART,
30
+ GET_CATALOG_ATTRIBUTE_LIST: () => GET_CATALOG_ATTRIBUTE_LIST,
31
+ GET_CATALOG_CATEGORY_LIST: () => GET_CATALOG_CATEGORY_LIST,
32
+ GET_CATEGORIES: () => GET_CATEGORIES,
33
+ GET_CONTEXTUAL_CATALOG_ATTRIBUTE_LIST: () => GET_CONTEXTUAL_CATALOG_ATTRIBUTE_LIST,
34
+ GET_DELIVERY_OPTIONS: () => GET_DELIVERY_OPTIONS,
35
+ GET_FREE_SHIPPING_PROGRESS: () => GET_FREE_SHIPPING_PROGRESS,
36
+ GET_LOCATION_OPTIONS: () => GET_LOCATION_OPTIONS,
37
+ GET_ORDERS: () => GET_ORDERS,
38
+ GET_ORDER_BY_PK: () => GET_ORDER_BY_PK,
39
+ GET_PAYMENT_METHODS: () => GET_PAYMENT_METHODS,
40
+ GET_PRODUCTS: () => GET_PRODUCTS,
41
+ GET_PRODUCT_BY_PK: () => GET_PRODUCT_BY_PK,
42
+ GET_PRODUCT_BY_SLUG: () => GET_PRODUCT_BY_SLUG,
43
+ GET_PRODUCT_SEO_ENTRIES: () => GET_PRODUCT_SEO_ENTRIES,
44
+ GET_PROFILE: () => GET_PROFILE,
45
+ GET_PUBLIC_ORDER: () => GET_PUBLIC_ORDER,
46
+ GET_SHIPPING_POLICY: () => GET_SHIPPING_POLICY,
47
+ GET_SHIPPING_QUOTES: () => GET_SHIPPING_QUOTES,
48
+ REMOVE_CART_ITEM: () => REMOVE_CART_ITEM,
49
+ REMOVE_COUPON: () => REMOVE_COUPON,
50
+ RESOLVE_WEBSITE_BY_SLUG: () => RESOLVE_WEBSITE_BY_SLUG,
51
+ SET_CART_ITEM: () => SET_CART_ITEM,
52
+ START_GUEST_CHECKOUT: () => START_GUEST_CHECKOUT,
53
+ UPDATE_PROFILE: () => UPDATE_PROFILE,
54
+ VALIDATE_COUPON: () => VALIDATE_COUPON,
55
+ WEBSITE_GET_CONTENT: () => WEBSITE_GET_CONTENT,
56
+ createAuthHeaders: () => createAuthHeaders,
57
+ documents: () => documents
58
+ });
59
+ module.exports = __toCommonJS(graphql_exports);
60
+
61
+ // libs/sdk/src/modules/auth.ts
62
+ function createAuthHeaders(accessToken) {
63
+ return accessToken ? { Authorization: `Bearer ${accessToken}` } : {};
64
+ }
65
+
66
+ // libs/sdk/src/transport/documents.ts
67
+ var RESOLVE_WEBSITE_BY_SLUG = (
68
+ /* GraphQL */
69
+ `
70
+ query ResolveWebsiteBySlug($slug: String!) {
71
+ websites(
72
+ where: { slug: { _eq: $slug }, is_active: { _eq: true } }
73
+ limit: 1
74
+ ) {
75
+ id
76
+ company_id
77
+ chain_id
78
+ name
79
+ slug
80
+ domain
81
+ config
82
+ }
83
+ }
84
+ `
85
+ );
86
+ var GET_PRODUCTS = (
87
+ /* GraphQL */
88
+ `
89
+ query GetProducts(
90
+ $companyId: uuid!
91
+ $chainId: uuid!
92
+ $websiteId: uuid!
93
+ $limit: Int = 20
94
+ $offset: Int = 0
95
+ $where: products_bool_exp = {}
96
+ $orderBy: [products_order_by!] = [{ name: asc }]
97
+ ) {
98
+ products(
99
+ where: {
100
+ _and: [
101
+ { company_id: { _eq: $companyId } }
102
+ {
103
+ product_website_publications: {
104
+ website_id: { _eq: $websiteId }
105
+ is_visible: { _eq: true }
106
+ }
107
+ }
108
+ {
109
+ chain_products: {
110
+ chain_id: { _eq: $chainId }
111
+ is_enabled: { _eq: true }
112
+ status: { _eq: active }
113
+ }
114
+ }
115
+ $where
116
+ ]
117
+ }
118
+ limit: $limit
119
+ offset: $offset
120
+ order_by: $orderBy
121
+ ) {
122
+ id
123
+ name
124
+ description
125
+ long_description
126
+ slug
127
+ seo_title
128
+ seo_description
129
+ seo_image_file_id
130
+ category
131
+ subcategory
132
+ color
133
+ measurement_unit
134
+ created_at
135
+ updated_at
136
+ brand {
137
+ id
138
+ name
139
+ }
140
+ seo_image_file {
141
+ mimeType
142
+ name
143
+ }
144
+ product_variants(
145
+ where: { is_disabled: { _eq: false } }
146
+ order_by: { order: asc }
147
+ ) {
148
+ id
149
+ sku
150
+ barcode
151
+ order
152
+ weight
153
+ depth
154
+ height
155
+ length
156
+ product_variant_prices(
157
+ where: {
158
+ price_type: { _in: [CLIENT, SALE, WHOLESALE, WHOLESALE_2] }
159
+ _or: [
160
+ { chain_id: { _eq: $chainId } }
161
+ { chain_id: { _is_null: true } }
162
+ ]
163
+ }
164
+ ) {
165
+ id
166
+ price
167
+ price_type
168
+ chain_id
169
+ }
170
+ product_variant_attributes(order_by: { order: asc }) {
171
+ id
172
+ value
173
+ order
174
+ attribute_value {
175
+ id
176
+ code
177
+ sort_order
178
+ metadata
179
+ }
180
+ attribute {
181
+ id
182
+ name
183
+ }
184
+ }
185
+ }
186
+ product_media(order_by: { order: asc }) {
187
+ id
188
+ file_id
189
+ order
190
+ file {
191
+ mimeType
192
+ name
193
+ }
194
+ }
195
+ product_related_products(
196
+ where: {
197
+ related_product: {
198
+ chain_products: {
199
+ chain_id: { _eq: $chainId }
200
+ is_enabled: { _eq: true }
201
+ status: { _eq: active }
202
+ }
203
+ }
204
+ }
205
+ order_by: { sort_order: asc }
206
+ ) {
207
+ id
208
+ related_product_id
209
+ display_label
210
+ sort_order
211
+ related_product {
212
+ id
213
+ slug
214
+ name
215
+ sku
216
+ product_media(
217
+ where: { file: { mimeType: { _ilike: "image/%" } } }
218
+ order_by: { order: asc }
219
+ limit: 1
220
+ ) {
221
+ id
222
+ file_id
223
+ order
224
+ file {
225
+ mimeType
226
+ name
227
+ }
228
+ }
229
+ }
230
+ }
231
+ product_attributes {
232
+ id
233
+ value
234
+ attribute_value {
235
+ id
236
+ code
237
+ sort_order
238
+ metadata
239
+ }
240
+ attribute {
241
+ id
242
+ name
243
+ }
244
+ }
245
+ }
246
+ catalog_attribute_lists(
247
+ where: { company_id: { _eq: $companyId }, status: { _eq: published } }
248
+ order_by: { updated_at: desc }
249
+ ) {
250
+ id
251
+ key
252
+ name
253
+ description
254
+ status
255
+ items(
256
+ where: { is_visible: { _eq: true } }
257
+ order_by: [{ sort_order: asc }, { public_label: asc }]
258
+ ) {
259
+ id
260
+ attribute_id
261
+ public_label
262
+ public_slug
263
+ sort_order
264
+ attribute {
265
+ id
266
+ name
267
+ type
268
+ }
269
+ values(
270
+ where: { is_visible: { _eq: true } }
271
+ order_by: [{ sort_order: asc }, { public_label: asc }]
272
+ ) {
273
+ id
274
+ attribute_value_id
275
+ public_label
276
+ public_slug
277
+ sort_order
278
+ attribute_value {
279
+ id
280
+ code
281
+ metadata
282
+ }
283
+ }
284
+ }
285
+ }
286
+ }
287
+ `
288
+ );
289
+ var GET_PRODUCT_BY_PK = (
290
+ /* GraphQL */
291
+ `
292
+ query GetProductByPk(
293
+ $productId: uuid!
294
+ $companyId: uuid!
295
+ $chainId: uuid!
296
+ $websiteId: uuid!
297
+ ) {
298
+ products(
299
+ where: {
300
+ id: { _eq: $productId }
301
+ company_id: { _eq: $companyId }
302
+ product_website_publications: {
303
+ website_id: { _eq: $websiteId }
304
+ is_visible: { _eq: true }
305
+ }
306
+ chain_products: {
307
+ chain_id: { _eq: $chainId }
308
+ is_enabled: { _eq: true }
309
+ status: { _eq: active }
310
+ }
311
+ }
312
+ limit: 1
313
+ ) {
314
+ id
315
+ name
316
+ description
317
+ long_description
318
+ slug
319
+ seo_title
320
+ seo_description
321
+ seo_image_file_id
322
+ category
323
+ subcategory
324
+ color
325
+ measurement_unit
326
+ created_at
327
+ updated_at
328
+ brand {
329
+ id
330
+ name
331
+ }
332
+ seo_image_file {
333
+ mimeType
334
+ name
335
+ }
336
+ product_variants(
337
+ where: { is_disabled: { _eq: false } }
338
+ order_by: { order: asc }
339
+ ) {
340
+ id
341
+ sku
342
+ barcode
343
+ order
344
+ weight
345
+ depth
346
+ height
347
+ length
348
+ product_variant_prices(
349
+ where: {
350
+ price_type: { _in: [CLIENT, SALE, WHOLESALE, WHOLESALE_2] }
351
+ _or: [
352
+ { chain_id: { _eq: $chainId } }
353
+ { chain_id: { _is_null: true } }
354
+ ]
355
+ }
356
+ ) {
357
+ id
358
+ price
359
+ price_type
360
+ chain_id
361
+ }
362
+ product_variant_attributes(order_by: { order: asc }) {
363
+ id
364
+ value
365
+ order
366
+ attribute_value {
367
+ id
368
+ code
369
+ sort_order
370
+ metadata
371
+ }
372
+ attribute {
373
+ id
374
+ name
375
+ }
376
+ }
377
+ }
378
+ product_media(order_by: { order: asc }) {
379
+ id
380
+ file_id
381
+ order
382
+ file {
383
+ mimeType
384
+ name
385
+ }
386
+ }
387
+ product_related_products(
388
+ where: {
389
+ related_product: {
390
+ chain_products: {
391
+ chain_id: { _eq: $chainId }
392
+ is_enabled: { _eq: true }
393
+ status: { _eq: active }
394
+ }
395
+ }
396
+ }
397
+ order_by: { sort_order: asc }
398
+ ) {
399
+ id
400
+ related_product_id
401
+ display_label
402
+ sort_order
403
+ related_product {
404
+ id
405
+ slug
406
+ name
407
+ sku
408
+ product_media(
409
+ where: { file: { mimeType: { _ilike: "image/%" } } }
410
+ order_by: { order: asc }
411
+ limit: 1
412
+ ) {
413
+ id
414
+ file_id
415
+ order
416
+ file {
417
+ mimeType
418
+ name
419
+ }
420
+ }
421
+ }
422
+ }
423
+ product_attributes {
424
+ id
425
+ value
426
+ attribute_value {
427
+ id
428
+ code
429
+ sort_order
430
+ metadata
431
+ }
432
+ attribute {
433
+ id
434
+ name
435
+ }
436
+ }
437
+ }
438
+ catalog_attribute_lists(
439
+ where: { company_id: { _eq: $companyId }, status: { _eq: published } }
440
+ order_by: { updated_at: desc }
441
+ ) {
442
+ id
443
+ key
444
+ name
445
+ description
446
+ status
447
+ items(
448
+ where: { is_visible: { _eq: true } }
449
+ order_by: [{ sort_order: asc }, { public_label: asc }]
450
+ ) {
451
+ id
452
+ attribute_id
453
+ public_label
454
+ public_slug
455
+ sort_order
456
+ attribute {
457
+ id
458
+ name
459
+ type
460
+ }
461
+ values(
462
+ where: { is_visible: { _eq: true } }
463
+ order_by: [{ sort_order: asc }, { public_label: asc }]
464
+ ) {
465
+ id
466
+ attribute_value_id
467
+ public_label
468
+ public_slug
469
+ sort_order
470
+ attribute_value {
471
+ id
472
+ code
473
+ metadata
474
+ }
475
+ }
476
+ }
477
+ }
478
+ }
479
+ `
480
+ );
481
+ var GET_PRODUCT_BY_SLUG = (
482
+ /* GraphQL */
483
+ GET_PRODUCT_BY_PK.replace(
484
+ "query GetProductByPk(",
485
+ "query GetProductBySlug("
486
+ ).replace("$productId: uuid!", "$slug: String!").replace("id: { _eq: $productId }", "slug: { _eq: $slug }")
487
+ );
488
+ var GET_PRODUCT_SEO_ENTRIES = (
489
+ /* GraphQL */
490
+ `
491
+ query GetProductSeoEntries(
492
+ $companyId: uuid!
493
+ $chainId: uuid!
494
+ $websiteId: uuid!
495
+ $limit: Int!
496
+ $offset: Int!
497
+ ) {
498
+ products(
499
+ where: {
500
+ company_id: { _eq: $companyId }
501
+ slug: { _is_null: false }
502
+ product_website_publications: {
503
+ website_id: { _eq: $websiteId }
504
+ is_visible: { _eq: true }
505
+ }
506
+ chain_products: {
507
+ chain_id: { _eq: $chainId }
508
+ is_enabled: { _eq: true }
509
+ status: { _eq: active }
510
+ }
511
+ }
512
+ limit: $limit
513
+ offset: $offset
514
+ order_by: [{ updated_at: desc }, { created_at: desc }]
515
+ ) {
516
+ id
517
+ name
518
+ slug
519
+ seo_title
520
+ seo_description
521
+ seo_image_file_id
522
+ category
523
+ subcategory
524
+ created_at
525
+ updated_at
526
+ seo_image_file {
527
+ mimeType
528
+ name
529
+ }
530
+ product_media(
531
+ where: { file: { mimeType: { _ilike: "image/%" } } }
532
+ order_by: { order: asc }
533
+ limit: 1
534
+ ) {
535
+ id
536
+ file_id
537
+ order
538
+ file {
539
+ mimeType
540
+ name
541
+ }
542
+ }
543
+ product_variants(
544
+ where: { is_disabled: { _eq: false } }
545
+ order_by: { order: asc }
546
+ ) {
547
+ id
548
+ product_variant_prices(
549
+ where: {
550
+ price_type: { _in: [CLIENT, SALE, WHOLESALE, WHOLESALE_2] }
551
+ _or: [
552
+ { chain_id: { _eq: $chainId } }
553
+ { chain_id: { _is_null: true } }
554
+ ]
555
+ }
556
+ ) {
557
+ id
558
+ price
559
+ price_type
560
+ chain_id
561
+ }
562
+ }
563
+ }
564
+ }
565
+ `
566
+ );
567
+ var GET_CATEGORIES = (
568
+ /* GraphQL */
569
+ `
570
+ query GetCategories {
571
+ product_categories {
572
+ name
573
+ description
574
+ product_subcategories {
575
+ id
576
+ name
577
+ description
578
+ }
579
+ }
580
+ }
581
+ `
582
+ );
583
+ var GET_CATALOG_CATEGORY_LIST = (
584
+ /* GraphQL */
585
+ `
586
+ query GetCatalogCategoryList($companyId: uuid!, $key: String!) {
587
+ list: catalog_category_lists(
588
+ where: {
589
+ company_id: { _eq: $companyId }
590
+ key: { _eq: $key }
591
+ status: { _eq: published }
592
+ }
593
+ limit: 1
594
+ ) {
595
+ id
596
+ key
597
+ name
598
+ description
599
+ status
600
+ items(
601
+ where: { is_visible: { _eq: true } }
602
+ order_by: [{ sort_order: asc }, { public_label: asc }]
603
+ ) {
604
+ id
605
+ source_type
606
+ product_category
607
+ product_subcategory_id
608
+ public_label
609
+ public_slug
610
+ sort_order
611
+ category_ref {
612
+ name
613
+ description
614
+ }
615
+ subcategory_ref {
616
+ id
617
+ name
618
+ description
619
+ category
620
+ }
621
+ }
622
+ }
623
+ }
624
+ `
625
+ );
626
+ var GET_CATALOG_ATTRIBUTE_LIST = (
627
+ /* GraphQL */
628
+ `
629
+ query GetCatalogAttributeList($companyId: uuid!, $key: String!) {
630
+ list: catalog_attribute_lists(
631
+ where: {
632
+ company_id: { _eq: $companyId }
633
+ key: { _eq: $key }
634
+ status: { _eq: published }
635
+ }
636
+ limit: 1
637
+ ) {
638
+ id
639
+ key
640
+ name
641
+ description
642
+ status
643
+ items(
644
+ where: { is_visible: { _eq: true } }
645
+ order_by: [{ sort_order: asc }, { public_label: asc }]
646
+ ) {
647
+ id
648
+ attribute_id
649
+ public_label
650
+ public_slug
651
+ sort_order
652
+ attribute {
653
+ id
654
+ name
655
+ type
656
+ }
657
+ values(
658
+ where: { is_visible: { _eq: true } }
659
+ order_by: [{ sort_order: asc }, { public_label: asc }]
660
+ ) {
661
+ id
662
+ attribute_value_id
663
+ public_label
664
+ public_slug
665
+ sort_order
666
+ attribute_value {
667
+ id
668
+ code
669
+ metadata
670
+ }
671
+ }
672
+ }
673
+ }
674
+ }
675
+ `
676
+ );
677
+ var GET_CONTEXTUAL_CATALOG_ATTRIBUTE_LIST = (
678
+ /* GraphQL */
679
+ `
680
+ mutation GetContextualCatalogAttributeList(
681
+ $websiteId: uuid!
682
+ $key: String!
683
+ $onlyApplicable: Boolean
684
+ $filters: WebsiteCatalogFiltersInput
685
+ ) {
686
+ websiteGetAttributeList(
687
+ website_id: $websiteId
688
+ key: $key
689
+ only_applicable: $onlyApplicable
690
+ filters: $filters
691
+ ) {
692
+ success
693
+ errors
694
+ list {
695
+ id
696
+ key
697
+ name
698
+ description
699
+ status
700
+ items {
701
+ id
702
+ attribute_id
703
+ attribute_name
704
+ attribute_type
705
+ public_label
706
+ public_slug
707
+ sort_order
708
+ values {
709
+ id
710
+ attribute_value_id
711
+ code
712
+ public_label
713
+ public_slug
714
+ sort_order
715
+ metadata
716
+ }
717
+ }
718
+ }
719
+ }
720
+ }
721
+ `
722
+ );
723
+ var WEBSITE_GET_CATALOG_PAGE = (
724
+ /* GraphQL */
725
+ `
726
+ mutation WebsiteGetCatalogPage(
727
+ $websiteId: uuid!
728
+ $categoryListKey: String!
729
+ $attributeListKey: String!
730
+ $filters: WebsiteCatalogPageFiltersInput
731
+ $include: WebsiteCatalogPageIncludeInput
732
+ ) {
733
+ result: websiteGetCatalogPage(
734
+ website_id: $websiteId
735
+ category_list_key: $categoryListKey
736
+ attribute_list_key: $attributeListKey
737
+ filters: $filters
738
+ include: $include
739
+ ) {
740
+ success
741
+ products
742
+ category_list
743
+ attribute_list
744
+ filters
745
+ brands
746
+ pagination
747
+ applied_filters
748
+ debug
749
+ errors
750
+ }
751
+ }
752
+ `
753
+ );
754
+ var WEBSITE_GET_PRODUCT_RECOMMENDATIONS = (
755
+ /* GraphQL */
756
+ `
757
+ mutation WebsiteGetProductRecommendations(
758
+ $websiteId: uuid!
759
+ $productId: uuid!
760
+ $limit: Int
761
+ ) {
762
+ result: websiteGetProductRecommendations(
763
+ website_id: $websiteId
764
+ product_id: $productId
765
+ limit: $limit
766
+ ) {
767
+ success
768
+ products
769
+ strategy
770
+ errors
771
+ }
772
+ }
773
+ `
774
+ );
775
+ var GET_BRANDS = (
776
+ /* GraphQL */
777
+ `
778
+ query GetBrands($companyId: uuid!, $chainId: uuid!) {
779
+ brands(
780
+ where: {
781
+ company_id: { _eq: $companyId }
782
+ products: {
783
+ chain_products: {
784
+ chain_id: { _eq: $chainId }
785
+ is_enabled: { _eq: true }
786
+ status: { _eq: active }
787
+ }
788
+ }
789
+ }
790
+ order_by: { name: asc }
791
+ ) {
792
+ id
793
+ name
794
+ }
795
+ }
796
+ `
797
+ );
798
+ var CONTENT_ENTRY_FIELDS = (
799
+ /* GraphQL */
800
+ `
801
+ id
802
+ key
803
+ category_key
804
+ name
805
+ locale
806
+ status
807
+ tags
808
+ content_json
809
+ resolved_fields
810
+ published_at
811
+ updated_at
812
+ content_type {
813
+ id
814
+ key
815
+ name
816
+ kind
817
+ }
818
+ `
819
+ );
820
+ var WEBSITE_GET_CONTENT = (
821
+ /* GraphQL */
822
+ `
823
+ mutation WebsiteGetContent(
824
+ $websiteId: uuid!
825
+ $key: String
826
+ $categoryKey: String
827
+ $tag: String
828
+ $locale: String
829
+ ) {
830
+ result: websiteGetContent(
831
+ website_id: $websiteId
832
+ key: $key
833
+ category_key: $categoryKey
834
+ tag: $tag
835
+ locale: $locale
836
+ ) {
837
+ success
838
+ errors
839
+ entries {
840
+ ${CONTENT_ENTRY_FIELDS}
841
+ }
842
+ }
843
+ }
844
+ `
845
+ );
846
+ var WEBSITE_GET_PRODUCT_CONTENT = (
847
+ /* GraphQL */
848
+ `
849
+ mutation WebsiteGetProductContent(
850
+ $websiteId: uuid!
851
+ $productId: uuid!
852
+ $locale: String
853
+ ) {
854
+ result: websiteGetProductContent(
855
+ website_id: $websiteId
856
+ product_id: $productId
857
+ locale: $locale
858
+ ) {
859
+ success
860
+ errors
861
+ blocks {
862
+ id
863
+ product_id
864
+ locale
865
+ content_json
866
+ resolved_fields
867
+ sort_order
868
+ updated_at
869
+ content_type {
870
+ id
871
+ key
872
+ name
873
+ kind
874
+ }
875
+ }
876
+ }
877
+ }
878
+ `
879
+ );
880
+ var CHECK_AVAILABILITY = (
881
+ /* GraphQL */
882
+ `
883
+ query CheckAvailability($variantIds: [uuid!]!, $chainId: uuid!) {
884
+ websiteProductAvailability(
885
+ product_variant_ids: $variantIds
886
+ chain_id: $chainId
887
+ ) {
888
+ product_variant_id
889
+ in_stock
890
+ label
891
+ }
892
+ }
893
+ `
894
+ );
895
+ var CREATE_CART = (
896
+ /* GraphQL */
897
+ `
898
+ mutation CreateCart(
899
+ $websiteId: uuid!
900
+ $cartToken: String
901
+ $contact: WebsiteGuestContactInput
902
+ $fulfillmentFamily: String
903
+ ) {
904
+ websiteCreateCart(
905
+ website_id: $websiteId
906
+ cart_token: $cartToken
907
+ contact: $contact
908
+ fulfillment_family: $fulfillmentFamily
909
+ ) {
910
+ success
911
+ order_id
912
+ cart_token
913
+ cart {
914
+ id
915
+ status
916
+ discount
917
+ tax
918
+ total_without_tax
919
+ total_with_tax
920
+ total_with_discount
921
+ created_at
922
+ updated_at
923
+ items {
924
+ id
925
+ product_variant_id
926
+ quantity
927
+ product_variant {
928
+ id
929
+ sku
930
+ product {
931
+ id
932
+ name
933
+ }
934
+ prices {
935
+ id
936
+ price
937
+ price_type
938
+ chain_id
939
+ }
940
+ }
941
+ }
942
+ }
943
+ errors
944
+ }
945
+ }
946
+ `
947
+ );
948
+ var GET_CART = (
949
+ /* GraphQL */
950
+ `
951
+ mutation GetCart($orderId: uuid!, $cartToken: String!) {
952
+ websiteGetCart(order_id: $orderId, cart_token: $cartToken) {
953
+ success
954
+ order_id
955
+ cart_token
956
+ cart {
957
+ id
958
+ status
959
+ discount
960
+ tax
961
+ total_without_tax
962
+ total_with_tax
963
+ total_with_discount
964
+ created_at
965
+ updated_at
966
+ items {
967
+ id
968
+ product_variant_id
969
+ quantity
970
+ product_variant {
971
+ id
972
+ sku
973
+ product {
974
+ id
975
+ name
976
+ }
977
+ prices {
978
+ id
979
+ price
980
+ price_type
981
+ chain_id
982
+ }
983
+ }
984
+ }
985
+ }
986
+ errors
987
+ }
988
+ }
989
+ `
990
+ );
991
+ var START_GUEST_CHECKOUT = (
992
+ /* GraphQL */
993
+ `
994
+ mutation StartGuestCheckout(
995
+ $websiteId: uuid!
996
+ $cartToken: String
997
+ $contact: WebsiteGuestContactInput!
998
+ $items: [WebsiteCheckoutItemInput!]!
999
+ $fulfillmentFamily: String
1000
+ ) {
1001
+ websiteStartGuestCheckout(
1002
+ website_id: $websiteId
1003
+ cart_token: $cartToken
1004
+ contact: $contact
1005
+ items: $items
1006
+ fulfillment_family: $fulfillmentFamily
1007
+ ) {
1008
+ success
1009
+ order_id
1010
+ cart_token
1011
+ cart {
1012
+ id
1013
+ status
1014
+ discount
1015
+ tax
1016
+ total_without_tax
1017
+ total_with_tax
1018
+ total_with_discount
1019
+ created_at
1020
+ updated_at
1021
+ items {
1022
+ id
1023
+ product_variant_id
1024
+ quantity
1025
+ product_variant {
1026
+ id
1027
+ sku
1028
+ product {
1029
+ id
1030
+ name
1031
+ }
1032
+ prices {
1033
+ id
1034
+ price
1035
+ price_type
1036
+ chain_id
1037
+ }
1038
+ }
1039
+ }
1040
+ }
1041
+ errors
1042
+ }
1043
+ }
1044
+ `
1045
+ );
1046
+ var SET_CART_ITEM = (
1047
+ /* GraphQL */
1048
+ `
1049
+ mutation SetCartItem(
1050
+ $orderId: uuid!
1051
+ $cartToken: String!
1052
+ $variantId: uuid!
1053
+ $quantity: numeric!
1054
+ ) {
1055
+ websiteSetCartItem(
1056
+ order_id: $orderId
1057
+ cart_token: $cartToken
1058
+ product_variant_id: $variantId
1059
+ quantity: $quantity
1060
+ ) {
1061
+ success
1062
+ order_id
1063
+ cart_token
1064
+ cart {
1065
+ id
1066
+ status
1067
+ discount
1068
+ tax
1069
+ total_without_tax
1070
+ total_with_tax
1071
+ total_with_discount
1072
+ created_at
1073
+ updated_at
1074
+ items {
1075
+ id
1076
+ product_variant_id
1077
+ quantity
1078
+ product_variant {
1079
+ id
1080
+ sku
1081
+ product {
1082
+ id
1083
+ name
1084
+ }
1085
+ prices {
1086
+ id
1087
+ price
1088
+ price_type
1089
+ chain_id
1090
+ }
1091
+ }
1092
+ }
1093
+ }
1094
+ errors
1095
+ }
1096
+ }
1097
+ `
1098
+ );
1099
+ var REMOVE_CART_ITEM = (
1100
+ /* GraphQL */
1101
+ `
1102
+ mutation RemoveCartItem(
1103
+ $orderId: uuid!
1104
+ $cartToken: String!
1105
+ $itemId: uuid!
1106
+ ) {
1107
+ websiteRemoveCartItem(
1108
+ order_id: $orderId
1109
+ cart_token: $cartToken
1110
+ item_id: $itemId
1111
+ ) {
1112
+ success
1113
+ order_id
1114
+ cart_token
1115
+ cart {
1116
+ id
1117
+ status
1118
+ discount
1119
+ tax
1120
+ total_without_tax
1121
+ total_with_tax
1122
+ total_with_discount
1123
+ created_at
1124
+ updated_at
1125
+ items {
1126
+ id
1127
+ product_variant_id
1128
+ quantity
1129
+ product_variant {
1130
+ id
1131
+ sku
1132
+ product {
1133
+ id
1134
+ name
1135
+ }
1136
+ prices {
1137
+ id
1138
+ price
1139
+ price_type
1140
+ chain_id
1141
+ }
1142
+ }
1143
+ }
1144
+ }
1145
+ errors
1146
+ }
1147
+ }
1148
+ `
1149
+ );
1150
+ var CHECKOUT = (
1151
+ /* GraphQL */
1152
+ `
1153
+ mutation Checkout(
1154
+ $orderId: uuid!
1155
+ $cartToken: String!
1156
+ $contact: WebsiteGuestContactInput!
1157
+ $fulfillmentFamily: String
1158
+ $address: WebsiteAddressInput
1159
+ $shippingQuoteId: uuid
1160
+ $paymentMode: String
1161
+ $paymentMethodId: uuid
1162
+ $buyerAccountOptIn: Boolean
1163
+ $initialPayment: WebsiteInitialPaymentInput
1164
+ ) {
1165
+ websiteCheckout(
1166
+ order_id: $orderId
1167
+ cart_token: $cartToken
1168
+ contact: $contact
1169
+ fulfillment_family: $fulfillmentFamily
1170
+ address: $address
1171
+ shipping_quote_id: $shippingQuoteId
1172
+ payment_mode: $paymentMode
1173
+ payment_method_id: $paymentMethodId
1174
+ buyer_account_opt_in: $buyerAccountOptIn
1175
+ initial_payment: $initialPayment
1176
+ ) {
1177
+ success
1178
+ order_id
1179
+ order_number
1180
+ payment_method_id
1181
+ public_order_token
1182
+ requires_payment_session
1183
+ buyer_account_invitation_requested
1184
+ errors
1185
+ }
1186
+ }
1187
+ `
1188
+ );
1189
+ var GET_LOCATION_OPTIONS = (
1190
+ /* GraphQL */
1191
+ `
1192
+ mutation GetLocationOptions($websiteId: uuid!) {
1193
+ websiteGetLocationOptions(website_id: $websiteId) {
1194
+ success
1195
+ country_code
1196
+ departments {
1197
+ department_id
1198
+ department_name
1199
+ department_code
1200
+ municipalities {
1201
+ municipality_id
1202
+ municipality_name
1203
+ municipality_code
1204
+ department_id
1205
+ department_code
1206
+ }
1207
+ }
1208
+ errors
1209
+ }
1210
+ }
1211
+ `
1212
+ );
1213
+ var GET_DELIVERY_OPTIONS = (
1214
+ /* GraphQL */
1215
+ `
1216
+ mutation GetDeliveryOptions($websiteId: uuid!) {
1217
+ websiteGetDeliveryOptions(website_id: $websiteId) {
1218
+ success
1219
+ delivery_options {
1220
+ id
1221
+ fulfillment_family
1222
+ label
1223
+ description
1224
+ is_enabled
1225
+ pickup_info {
1226
+ label
1227
+ address
1228
+ schedule
1229
+ notes
1230
+ }
1231
+ }
1232
+ errors
1233
+ }
1234
+ }
1235
+ `
1236
+ );
1237
+ var GET_SHIPPING_QUOTES = (
1238
+ /* GraphQL */
1239
+ `
1240
+ mutation GetShippingQuotes(
1241
+ $websiteId: uuid!
1242
+ $orderId: uuid
1243
+ $cartToken: String
1244
+ $items: [WebsiteCheckoutItemInput!]
1245
+ $address: WebsiteAddressInput!
1246
+ ) {
1247
+ websiteGetShippingQuotes(
1248
+ website_id: $websiteId
1249
+ order_id: $orderId
1250
+ cart_token: $cartToken
1251
+ items: $items
1252
+ address: $address
1253
+ ) {
1254
+ success
1255
+ quotes {
1256
+ quote_id
1257
+ shipping_service_id
1258
+ label
1259
+ service_name
1260
+ base_amount
1261
+ amount
1262
+ currency
1263
+ collection_mode
1264
+ total_policy
1265
+ estimated_delivery
1266
+ free_shipping_eligible
1267
+ free_shipping_applied
1268
+ free_shipping_threshold
1269
+ free_shipping_remaining
1270
+ free_shipping_eligible_subtotal
1271
+ }
1272
+ errors
1273
+ }
1274
+ }
1275
+ `
1276
+ );
1277
+ var GET_SHIPPING_POLICY = (
1278
+ /* GraphQL */
1279
+ `
1280
+ mutation GetShippingPolicy($websiteId: uuid!) {
1281
+ websiteGetShippingPolicy(website_id: $websiteId) {
1282
+ success
1283
+ policy {
1284
+ free_shipping_enabled
1285
+ free_shipping_threshold
1286
+ currency
1287
+ }
1288
+ errors
1289
+ }
1290
+ }
1291
+ `
1292
+ );
1293
+ var GET_FREE_SHIPPING_PROGRESS = (
1294
+ /* GraphQL */
1295
+ `
1296
+ mutation GetFreeShippingProgress(
1297
+ $websiteId: uuid!
1298
+ $items: [WebsiteCheckoutItemInput!]!
1299
+ ) {
1300
+ websiteGetFreeShippingProgress(website_id: $websiteId, items: $items) {
1301
+ success
1302
+ progress {
1303
+ enabled
1304
+ threshold
1305
+ remaining
1306
+ eligible_subtotal
1307
+ threshold_reached
1308
+ currency
1309
+ }
1310
+ errors
1311
+ }
1312
+ }
1313
+ `
1314
+ );
1315
+ var GET_PAYMENT_METHODS = (
1316
+ /* GraphQL */
1317
+ `
1318
+ mutation GetPaymentMethods($websiteId: uuid!) {
1319
+ websiteGetPaymentMethods(website_id: $websiteId) {
1320
+ success
1321
+ payment_methods {
1322
+ id
1323
+ code
1324
+ label
1325
+ payment_method_type
1326
+ gateway_code
1327
+ description
1328
+ is_enabled
1329
+ sort_order
1330
+ requires_payment_session
1331
+ public_config
1332
+ }
1333
+ errors
1334
+ }
1335
+ }
1336
+ `
1337
+ );
1338
+ var GET_PAYMENT_OPTIONS = (
1339
+ /* GraphQL */
1340
+ `
1341
+ mutation GetPaymentOptions($websiteId: uuid!, $fulfillmentFamily: String!) {
1342
+ websiteGetPaymentOptions(
1343
+ website_id: $websiteId
1344
+ fulfillment_family: $fulfillmentFamily
1345
+ ) {
1346
+ success
1347
+ payment_options {
1348
+ id
1349
+ mode
1350
+ fulfillment_family
1351
+ label
1352
+ description
1353
+ requires_payment_method
1354
+ allows_initial_payment
1355
+ initial_payment_policy
1356
+ requires_initial_payment
1357
+ min_initial_amount
1358
+ suggested_initial_amount
1359
+ sort_order
1360
+ methods {
1361
+ id
1362
+ payment_method_id
1363
+ code
1364
+ label
1365
+ payment_method_type
1366
+ gateway_code
1367
+ description
1368
+ instructions
1369
+ qr_file_id
1370
+ requires_payment_session
1371
+ public_config
1372
+ sort_order
1373
+ }
1374
+ }
1375
+ errors
1376
+ }
1377
+ }
1378
+ `
1379
+ );
1380
+ var VALIDATE_COUPON = (
1381
+ /* GraphQL */
1382
+ `
1383
+ mutation ValidateCoupon(
1384
+ $orderId: uuid!
1385
+ $cartToken: String!
1386
+ $code: String!
1387
+ ) {
1388
+ websiteValidateCoupon(
1389
+ order_id: $orderId
1390
+ cart_token: $cartToken
1391
+ code: $code
1392
+ ) {
1393
+ success
1394
+ order_id
1395
+ coupon_id
1396
+ code
1397
+ name
1398
+ coupon_type
1399
+ discount_amount
1400
+ eligible_subtotal
1401
+ message
1402
+ cart {
1403
+ id
1404
+ status
1405
+ discount
1406
+ total_without_tax
1407
+ tax
1408
+ total_with_tax
1409
+ total_with_discount
1410
+ created_at
1411
+ updated_at
1412
+ items {
1413
+ id
1414
+ product_variant_id
1415
+ quantity
1416
+ product_variant {
1417
+ id
1418
+ sku
1419
+ product {
1420
+ id
1421
+ name
1422
+ }
1423
+ prices {
1424
+ id
1425
+ price
1426
+ price_type
1427
+ chain_id
1428
+ }
1429
+ }
1430
+ }
1431
+ }
1432
+ errors
1433
+ }
1434
+ }
1435
+ `
1436
+ );
1437
+ var APPLY_COUPON = (
1438
+ /* GraphQL */
1439
+ `
1440
+ mutation ApplyCoupon($orderId: uuid!, $cartToken: String!, $code: String!) {
1441
+ websiteApplyCoupon(
1442
+ order_id: $orderId
1443
+ cart_token: $cartToken
1444
+ code: $code
1445
+ ) {
1446
+ success
1447
+ order_id
1448
+ coupon_id
1449
+ code
1450
+ name
1451
+ coupon_type
1452
+ discount_amount
1453
+ eligible_subtotal
1454
+ message
1455
+ cart {
1456
+ id
1457
+ status
1458
+ discount
1459
+ total_without_tax
1460
+ tax
1461
+ total_with_tax
1462
+ total_with_discount
1463
+ created_at
1464
+ updated_at
1465
+ items {
1466
+ id
1467
+ product_variant_id
1468
+ quantity
1469
+ product_variant {
1470
+ id
1471
+ sku
1472
+ product {
1473
+ id
1474
+ name
1475
+ }
1476
+ prices {
1477
+ id
1478
+ price
1479
+ price_type
1480
+ chain_id
1481
+ }
1482
+ }
1483
+ }
1484
+ }
1485
+ errors
1486
+ }
1487
+ }
1488
+ `
1489
+ );
1490
+ var REMOVE_COUPON = (
1491
+ /* GraphQL */
1492
+ `
1493
+ mutation RemoveCoupon(
1494
+ $orderId: uuid!
1495
+ $cartToken: String!
1496
+ $couponId: uuid!
1497
+ ) {
1498
+ websiteRemoveCoupon(
1499
+ order_id: $orderId
1500
+ cart_token: $cartToken
1501
+ coupon_id: $couponId
1502
+ ) {
1503
+ success
1504
+ order_id
1505
+ coupon_id
1506
+ code
1507
+ name
1508
+ coupon_type
1509
+ discount_amount
1510
+ eligible_subtotal
1511
+ message
1512
+ cart {
1513
+ id
1514
+ status
1515
+ discount
1516
+ total_without_tax
1517
+ tax
1518
+ total_with_tax
1519
+ total_with_discount
1520
+ created_at
1521
+ updated_at
1522
+ items {
1523
+ id
1524
+ product_variant_id
1525
+ quantity
1526
+ product_variant {
1527
+ id
1528
+ sku
1529
+ product {
1530
+ id
1531
+ name
1532
+ }
1533
+ prices {
1534
+ id
1535
+ price
1536
+ price_type
1537
+ chain_id
1538
+ }
1539
+ }
1540
+ }
1541
+ }
1542
+ errors
1543
+ }
1544
+ }
1545
+ `
1546
+ );
1547
+ var CREATE_PAYMENT_SESSION = (
1548
+ /* GraphQL */
1549
+ `
1550
+ mutation CreatePaymentSession(
1551
+ $orderId: uuid!
1552
+ $cartToken: String
1553
+ $publicOrderToken: String
1554
+ $paymentMethodId: uuid!
1555
+ $returnUrl: String!
1556
+ ) {
1557
+ websiteCreatePaymentSession(
1558
+ order_id: $orderId
1559
+ cart_token: $cartToken
1560
+ public_order_token: $publicOrderToken
1561
+ payment_method_id: $paymentMethodId
1562
+ return_url: $returnUrl
1563
+ ) {
1564
+ success
1565
+ order_id
1566
+ payment_method_id
1567
+ payment_session_id
1568
+ gateway_code
1569
+ integration_mode
1570
+ status
1571
+ redirect_url
1572
+ public_payload
1573
+ errors
1574
+ }
1575
+ }
1576
+ `
1577
+ );
1578
+ var GET_ORDERS = (
1579
+ /* GraphQL */
1580
+ `
1581
+ query GetOrders($limit: Int = 20, $offset: Int = 0) {
1582
+ orders(
1583
+ where: { order_number: { _is_null: false } }
1584
+ order_by: { created_at: desc }
1585
+ limit: $limit
1586
+ offset: $offset
1587
+ ) {
1588
+ id
1589
+ order_number
1590
+ status
1591
+ fulfillment_family
1592
+ discount
1593
+ tax
1594
+ total_without_tax
1595
+ total_with_tax
1596
+ total_with_discount
1597
+ created_at
1598
+ updated_at
1599
+ order_product_variants {
1600
+ id
1601
+ product_variant_id
1602
+ quantity
1603
+ product_variant {
1604
+ sku
1605
+ product {
1606
+ id
1607
+ name
1608
+ }
1609
+ }
1610
+ }
1611
+ }
1612
+ }
1613
+ `
1614
+ );
1615
+ var GET_ORDER_BY_PK = (
1616
+ /* GraphQL */
1617
+ `
1618
+ query GetOrderByPk($orderId: uuid!) {
1619
+ orders(where: { id: { _eq: $orderId } }) {
1620
+ id
1621
+ order_number
1622
+ status
1623
+ fulfillment_family
1624
+ discount
1625
+ tax
1626
+ total_without_tax
1627
+ total_with_tax
1628
+ total_with_discount
1629
+ created_at
1630
+ updated_at
1631
+ order_product_variants {
1632
+ id
1633
+ product_variant_id
1634
+ quantity
1635
+ product_variant {
1636
+ sku
1637
+ product {
1638
+ id
1639
+ name
1640
+ }
1641
+ }
1642
+ }
1643
+ }
1644
+ }
1645
+ `
1646
+ );
1647
+ var GET_PUBLIC_ORDER = (
1648
+ /* GraphQL */
1649
+ `
1650
+ mutation GetPublicOrder($websiteId: uuid!, $orderId: uuid!, $token: String!) {
1651
+ websiteGetPublicOrder(
1652
+ website_id: $websiteId
1653
+ order_id: $orderId
1654
+ token: $token
1655
+ ) {
1656
+ success
1657
+ order {
1658
+ order_id
1659
+ order_number
1660
+ status
1661
+ payment_status
1662
+ fulfillment_family
1663
+ delivery {
1664
+ fulfillment_family
1665
+ shipping {
1666
+ label
1667
+ amount
1668
+ method_type
1669
+ collection_mode
1670
+ total_policy
1671
+ address
1672
+ }
1673
+ pickup {
1674
+ label
1675
+ }
1676
+ }
1677
+ payment {
1678
+ mode
1679
+ label
1680
+ method {
1681
+ id
1682
+ label
1683
+ payment_method_type
1684
+ gateway_code
1685
+ requires_payment_session
1686
+ }
1687
+ initial_payment {
1688
+ amount
1689
+ payment_method_id
1690
+ method_label
1691
+ payment_method_type
1692
+ gateway_code
1693
+ requires_payment_session
1694
+ }
1695
+ requires_payment_session
1696
+ next_action
1697
+ session {
1698
+ id
1699
+ gateway_code
1700
+ integration_mode
1701
+ status
1702
+ reference
1703
+ amount
1704
+ currency
1705
+ gateway_transaction_id
1706
+ error_message
1707
+ expires_at
1708
+ created_at
1709
+ updated_at
1710
+ }
1711
+ }
1712
+ totals {
1713
+ subtotal
1714
+ tax
1715
+ discount
1716
+ total
1717
+ total_with_discount
1718
+ }
1719
+ items {
1720
+ id
1721
+ product_variant_id
1722
+ sku
1723
+ name
1724
+ image_file_id
1725
+ quantity
1726
+ unit_price
1727
+ line_total
1728
+ }
1729
+ next_steps
1730
+ created_at
1731
+ updated_at
1732
+ }
1733
+ errors
1734
+ }
1735
+ }
1736
+ `
1737
+ );
1738
+ var GET_PROFILE = (
1739
+ /* GraphQL */
1740
+ `
1741
+ query GetProfile {
1742
+ clients {
1743
+ id
1744
+ party_id
1745
+ party {
1746
+ first_name
1747
+ last_name
1748
+ email
1749
+ phone_e164
1750
+ phone_national_number
1751
+ address
1752
+ address_complement
1753
+ birthdate
1754
+ legal_name
1755
+ commercial_name
1756
+ country_code
1757
+ department_code
1758
+ municipality_code
1759
+ geo_country {
1760
+ name
1761
+ }
1762
+ geo_department {
1763
+ name
1764
+ }
1765
+ geo_municipality {
1766
+ name
1767
+ }
1768
+ shipping_addresses(
1769
+ where: { is_primary: { _eq: true } }
1770
+ order_by: { created_at: asc }
1771
+ limit: 1
1772
+ ) {
1773
+ address
1774
+ address_complement
1775
+ country_code
1776
+ department_code
1777
+ municipality_code
1778
+ geo_country {
1779
+ name
1780
+ }
1781
+ geo_department {
1782
+ name
1783
+ }
1784
+ geo_municipality {
1785
+ name
1786
+ }
1787
+ }
1788
+ }
1789
+ }
1790
+ }
1791
+ `
1792
+ );
1793
+ var UPDATE_PROFILE = (
1794
+ /* GraphQL */
1795
+ `
1796
+ mutation UpdateProfile($partyId: uuid!, $data: business_parties_set_input!) {
1797
+ update_business_parties_by_pk(pk_columns: { id: $partyId }, _set: $data) {
1798
+ email
1799
+ first_name
1800
+ last_name
1801
+ phone_e164
1802
+ phone_national_number
1803
+ address
1804
+ address_complement
1805
+ birthdate
1806
+ legal_name
1807
+ commercial_name
1808
+ country_code
1809
+ department_code
1810
+ municipality_code
1811
+ geo_country {
1812
+ name
1813
+ }
1814
+ geo_department {
1815
+ name
1816
+ }
1817
+ geo_municipality {
1818
+ name
1819
+ }
1820
+ shipping_addresses(
1821
+ where: { is_primary: { _eq: true } }
1822
+ order_by: { created_at: asc }
1823
+ limit: 1
1824
+ ) {
1825
+ address
1826
+ address_complement
1827
+ country_code
1828
+ department_code
1829
+ municipality_code
1830
+ geo_country {
1831
+ name
1832
+ }
1833
+ geo_department {
1834
+ name
1835
+ }
1836
+ geo_municipality {
1837
+ name
1838
+ }
1839
+ }
1840
+ }
1841
+ }
1842
+ `
1843
+ );
1844
+ var GET_PRODUCT_FILTERS = (
1845
+ /* GraphQL */
1846
+ `
1847
+ query GetProductFilters(
1848
+ $companyId: uuid!
1849
+ $chainId: uuid!
1850
+ $where: products_bool_exp = {}
1851
+ $attributeListKey: String!
1852
+ ) {
1853
+ products(
1854
+ where: {
1855
+ _and: [
1856
+ { company_id: { _eq: $companyId } }
1857
+ {
1858
+ chain_products: {
1859
+ chain_id: { _eq: $chainId }
1860
+ is_enabled: { _eq: true }
1861
+ status: { _eq: active }
1862
+ }
1863
+ }
1864
+ $where
1865
+ ]
1866
+ }
1867
+ ) {
1868
+ id
1869
+ category
1870
+ subcategory
1871
+ color
1872
+ brand {
1873
+ id
1874
+ name
1875
+ }
1876
+ product_attributes {
1877
+ id
1878
+ value
1879
+ attribute_value {
1880
+ id
1881
+ code
1882
+ sort_order
1883
+ metadata
1884
+ }
1885
+ attribute {
1886
+ id
1887
+ name
1888
+ }
1889
+ }
1890
+ product_variants(where: { is_disabled: { _eq: false } }) {
1891
+ id
1892
+ product_variant_prices(
1893
+ where: {
1894
+ price_type: { _in: [CLIENT, SALE, WHOLESALE, WHOLESALE_2] }
1895
+ _or: [
1896
+ { chain_id: { _eq: $chainId } }
1897
+ { chain_id: { _is_null: true } }
1898
+ ]
1899
+ }
1900
+ ) {
1901
+ id
1902
+ price
1903
+ price_type
1904
+ chain_id
1905
+ }
1906
+ product_variant_attributes(order_by: { order: asc }) {
1907
+ id
1908
+ value
1909
+ order
1910
+ attribute_value {
1911
+ id
1912
+ code
1913
+ sort_order
1914
+ metadata
1915
+ }
1916
+ attribute {
1917
+ id
1918
+ name
1919
+ }
1920
+ }
1921
+ }
1922
+ }
1923
+ catalog_attribute_lists(
1924
+ where: {
1925
+ company_id: { _eq: $companyId }
1926
+ key: { _eq: $attributeListKey }
1927
+ status: { _eq: published }
1928
+ }
1929
+ limit: 1
1930
+ ) {
1931
+ id
1932
+ key
1933
+ name
1934
+ description
1935
+ status
1936
+ items(
1937
+ where: { is_visible: { _eq: true } }
1938
+ order_by: [{ sort_order: asc }, { public_label: asc }]
1939
+ ) {
1940
+ id
1941
+ attribute_id
1942
+ public_label
1943
+ public_slug
1944
+ sort_order
1945
+ attribute {
1946
+ id
1947
+ name
1948
+ type
1949
+ }
1950
+ values(
1951
+ where: { is_visible: { _eq: true } }
1952
+ order_by: [{ sort_order: asc }, { public_label: asc }]
1953
+ ) {
1954
+ id
1955
+ attribute_value_id
1956
+ public_label
1957
+ public_slug
1958
+ sort_order
1959
+ attribute_value {
1960
+ id
1961
+ code
1962
+ metadata
1963
+ }
1964
+ }
1965
+ }
1966
+ }
1967
+ }
1968
+ `
1969
+ );
1970
+ var GET_SEARCH_SUGGESTIONS = (
1971
+ /* GraphQL */
1972
+ `
1973
+ query GetSearchSuggestions(
1974
+ $companyId: uuid!
1975
+ $chainId: uuid!
1976
+ $term: String!
1977
+ $productLimit: Int = 5
1978
+ $brandLimit: Int = 3
1979
+ ) {
1980
+ products(
1981
+ where: {
1982
+ company_id: { _eq: $companyId }
1983
+ chain_products: {
1984
+ chain_id: { _eq: $chainId }
1985
+ is_enabled: { _eq: true }
1986
+ status: { _eq: active }
1987
+ }
1988
+ name: { _ilike: $term }
1989
+ }
1990
+ limit: $productLimit
1991
+ order_by: { name: asc }
1992
+ ) {
1993
+ id
1994
+ name
1995
+ }
1996
+ brands(
1997
+ where: {
1998
+ company_id: { _eq: $companyId }
1999
+ name: { _ilike: $term }
2000
+ products: {
2001
+ chain_products: {
2002
+ chain_id: { _eq: $chainId }
2003
+ is_enabled: { _eq: true }
2004
+ status: { _eq: active }
2005
+ }
2006
+ }
2007
+ }
2008
+ limit: $brandLimit
2009
+ order_by: { name: asc }
2010
+ ) {
2011
+ id
2012
+ name
2013
+ }
2014
+ }
2015
+ `
2016
+ );
2017
+ var documents = {
2018
+ RESOLVE_WEBSITE_BY_SLUG,
2019
+ GET_PRODUCTS,
2020
+ GET_PRODUCT_BY_PK,
2021
+ GET_PRODUCT_BY_SLUG,
2022
+ GET_PRODUCT_SEO_ENTRIES,
2023
+ GET_CATEGORIES,
2024
+ GET_CATALOG_CATEGORY_LIST,
2025
+ GET_CATALOG_ATTRIBUTE_LIST,
2026
+ GET_CONTEXTUAL_CATALOG_ATTRIBUTE_LIST,
2027
+ WEBSITE_GET_CATALOG_PAGE,
2028
+ WEBSITE_GET_PRODUCT_RECOMMENDATIONS,
2029
+ GET_BRANDS,
2030
+ CHECK_AVAILABILITY,
2031
+ GET_PRODUCT_FILTERS,
2032
+ GET_SEARCH_SUGGESTIONS,
2033
+ WEBSITE_GET_CONTENT,
2034
+ WEBSITE_GET_PRODUCT_CONTENT,
2035
+ CREATE_CART,
2036
+ GET_CART,
2037
+ START_GUEST_CHECKOUT,
2038
+ SET_CART_ITEM,
2039
+ REMOVE_CART_ITEM,
2040
+ CHECKOUT,
2041
+ GET_LOCATION_OPTIONS,
2042
+ GET_DELIVERY_OPTIONS,
2043
+ GET_SHIPPING_POLICY,
2044
+ GET_FREE_SHIPPING_PROGRESS,
2045
+ GET_SHIPPING_QUOTES,
2046
+ GET_PAYMENT_METHODS,
2047
+ GET_PAYMENT_OPTIONS,
2048
+ VALIDATE_COUPON,
2049
+ APPLY_COUPON,
2050
+ REMOVE_COUPON,
2051
+ CREATE_PAYMENT_SESSION,
2052
+ GET_ORDERS,
2053
+ GET_ORDER_BY_PK,
2054
+ GET_PUBLIC_ORDER,
2055
+ GET_PROFILE,
2056
+ UPDATE_PROFILE
2057
+ };