arky-sdk 0.9.6 → 0.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +113 -194
  2. package/dist/admin-D8HiRDCl.d.cts +1536 -0
  3. package/dist/admin-Dnnv18wN.d.ts +1536 -0
  4. package/dist/admin.cjs +832 -375
  5. package/dist/admin.cjs.map +1 -1
  6. package/dist/admin.d.cts +3 -3
  7. package/dist/admin.d.ts +3 -3
  8. package/dist/admin.js +832 -375
  9. package/dist/admin.js.map +1 -1
  10. package/dist/api-D4lMmvF0.d.cts +4337 -0
  11. package/dist/api-D4lMmvF0.d.ts +4337 -0
  12. package/dist/{index-nCF3Z6Af.d.cts → index-BS2x278C.d.cts} +1 -1
  13. package/dist/{index-CZxubTDA.d.ts → index-Be8suRwP.d.ts} +1 -1
  14. package/dist/index.cjs +934 -460
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +3 -3
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +934 -460
  19. package/dist/index.js.map +1 -1
  20. package/dist/storefront.cjs +501 -300
  21. package/dist/storefront.cjs.map +1 -1
  22. package/dist/storefront.d.cts +174 -89
  23. package/dist/storefront.d.ts +174 -89
  24. package/dist/storefront.js +499 -299
  25. package/dist/storefront.js.map +1 -1
  26. package/dist/types.cjs.map +1 -1
  27. package/dist/types.d.cts +1 -1
  28. package/dist/types.d.ts +1 -1
  29. package/dist/types.js.map +1 -1
  30. package/dist/utils.d.cts +2 -2
  31. package/dist/utils.d.ts +2 -2
  32. package/package.json +7 -10
  33. package/scripts/contract-admin.mjs +137 -0
  34. package/scripts/contract-storefront.mjs +296 -0
  35. package/dist/admin-DjYydKeB.d.ts +0 -1389
  36. package/dist/admin-DlL8mCxL.d.cts +0 -1389
  37. package/dist/api-BbBHcd4p.d.cts +0 -3289
  38. package/dist/api-BbBHcd4p.d.ts +0 -3289
  39. package/dist/storefront-store.cjs +0 -2809
  40. package/dist/storefront-store.cjs.map +0 -1
  41. package/dist/storefront-store.d.cts +0 -5
  42. package/dist/storefront-store.d.ts +0 -5
  43. package/dist/storefront-store.js +0 -2807
  44. package/dist/storefront-store.js.map +0 -1
  45. package/scripts/smoke-store.mjs +0 -41
package/dist/admin.cjs CHANGED
@@ -1,131 +1,5 @@
1
1
  'use strict';
2
2
 
3
- // src/utils/blocks.ts
4
- function getBlockLabel(block) {
5
- if (!block) return "";
6
- return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) ?? "";
7
- }
8
- function formatBlockValue(block) {
9
- if (!block || block.value === null || block.value === void 0) return "";
10
- const value = block.value;
11
- switch (block.type) {
12
- case "boolean":
13
- return value ? "Yes" : "No";
14
- case "number":
15
- if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
16
- return new Date(value).toLocaleDateString();
17
- }
18
- return String(value);
19
- case "relationship_entry":
20
- case "relationship_media":
21
- if (value && typeof value === "object") {
22
- return value.mime_type ? value.name || value.id : value.title || value.name || value.id;
23
- }
24
- return String(value);
25
- default:
26
- return String(value);
27
- }
28
- }
29
- function prepareBlocksForSubmission(formData, blockTypes) {
30
- return Object.keys(formData).filter((key) => formData[key] !== null && formData[key] !== void 0).map((key) => ({
31
- key,
32
- value: blockTypes?.[key] === "list" && !Array.isArray(formData[key]) ? [formData[key]] : formData[key]
33
- }));
34
- }
35
- function extractBlockValues(blocks) {
36
- const values = {};
37
- blocks.forEach((block) => {
38
- values[block.key] = block.value ?? null;
39
- });
40
- return values;
41
- }
42
- var getBlockValue = (entry, blockKey) => {
43
- const block = entry?.blocks?.find((f) => f.key === blockKey);
44
- return block?.value ?? null;
45
- };
46
- var getBlockTextValue = (block, locale = "en") => {
47
- if (!block || block.value === null || block.value === void 0) return "";
48
- if (block.type === "localized_text" || block.type === "markdown") {
49
- if (typeof block.value === "object" && block.value !== null) {
50
- return block.value[locale] ?? block.value["en"] ?? "";
51
- }
52
- }
53
- if (typeof block.value === "string") return block.value;
54
- return String(block.value ?? "");
55
- };
56
- var getBlockValues = (entry, blockKey) => {
57
- const block = entry?.blocks?.find((f) => f.key === blockKey);
58
- if (!block) return [];
59
- if (block.type === "list" && Array.isArray(block.value)) {
60
- return block.value;
61
- }
62
- return [];
63
- };
64
- function unwrapBlock(block, locale) {
65
- if (!block?.type || block.value === void 0) return block;
66
- if (block.type === "list") {
67
- return block.value.map((obj) => {
68
- const parsed = {};
69
- for (const [k, v] of Object.entries(obj)) {
70
- parsed[k] = unwrapBlock(v, locale);
71
- }
72
- return parsed;
73
- });
74
- }
75
- if (block.type === "map") {
76
- const parsed = {};
77
- for (const [k, v] of Object.entries(block.value || {})) {
78
- parsed[k] = unwrapBlock(v, locale);
79
- }
80
- return parsed;
81
- }
82
- if (block.type === "localized_text" || block.type === "markdown") {
83
- return block.value?.[locale];
84
- }
85
- return block.value;
86
- }
87
- var getBlockObjectValues = (entry, blockKey, locale = "en") => {
88
- const block = entry?.blocks?.find((f) => f.key === blockKey);
89
- if (!block || block.type !== "list" || !Array.isArray(block.value)) return [];
90
- return block.value.map((obj) => {
91
- if (!obj?.value || !Array.isArray(obj.value)) return {};
92
- return obj.value.reduce((acc, current) => {
93
- acc[current.key] = unwrapBlock(current, locale);
94
- return acc;
95
- }, {});
96
- });
97
- };
98
- var getBlockFromArray = (entry, blockKey, locale = "en") => {
99
- const block = entry?.blocks?.find((f) => f.key === blockKey);
100
- if (!block) return {};
101
- if (block.type === "list" && Array.isArray(block.value)) {
102
- return block.value.reduce((acc, current) => {
103
- acc[current.key] = unwrapBlock(current, locale);
104
- return acc;
105
- }, {});
106
- }
107
- if (block.type === "map" && block.value && typeof block.value === "object") {
108
- const result = {};
109
- for (const [k, v] of Object.entries(block.value)) {
110
- result[k] = unwrapBlock(v, locale);
111
- }
112
- return result;
113
- }
114
- return { [block.key]: unwrapBlock(block, locale) };
115
- };
116
- var getImageUrl = (imageBlock, isBlock = true) => {
117
- if (!imageBlock) return null;
118
- if (imageBlock.type === "relationship_media") {
119
- const mediaValue = imageBlock.value;
120
- return mediaValue?.resolutions?.original?.url || mediaValue?.url || null;
121
- }
122
- if (isBlock) {
123
- if (typeof imageBlock === "string") return imageBlock;
124
- if (imageBlock.url) return imageBlock.url;
125
- }
126
- return imageBlock.resolutions?.original?.url || null;
127
- };
128
-
129
3
  // src/utils/orderItems.ts
130
4
  function normalizeOrderQuoteItems(items) {
131
5
  return items.map((item) => {
@@ -247,7 +121,7 @@ function createHttpClient(cfg) {
247
121
  headers["Authorization"] = `Bearer ${tokens.access_token}`;
248
122
  }
249
123
  const finalPath = options?.params ? path + buildQueryString(options.params) : path;
250
- const fetchOpts = { method, headers };
124
+ const fetchOpts = { method, headers, signal: options?.signal };
251
125
  if (!["GET", "DELETE"].includes(method) && body !== void 0) {
252
126
  fetchOpts.body = JSON.stringify(body);
253
127
  }
@@ -258,13 +132,15 @@ function createHttpClient(cfg) {
258
132
  try {
259
133
  res = await fetch(fullUrl, fetchOpts);
260
134
  } catch (error) {
135
+ const aborted = options?.signal?.aborted || error instanceof Error && error.name === "AbortError";
261
136
  const err = new Error(error instanceof Error ? error.message : "Network request failed");
262
- err.name = "NetworkError";
137
+ err.name = aborted ? "AbortError" : "NetworkError";
263
138
  err.method = method;
264
139
  err.url = fullUrl;
140
+ err.aborted = aborted;
265
141
  if (options?.onError && method !== "GET") {
266
142
  Promise.resolve(
267
- options.onError({ error: err, method, url: fullUrl, aborted: false })
143
+ options.onError({ error: err, method, url: fullUrl, aborted })
268
144
  ).catch(() => {
269
145
  });
270
146
  }
@@ -427,9 +303,6 @@ var createAuthApi = (apiConfig, updateSession) => {
427
303
  applyAuthToken(result, params.email);
428
304
  }
429
305
  return result;
430
- },
431
- async magicLink(params, options) {
432
- return apiConfig.httpClient.post("/v1/auth/code", params, options);
433
306
  }
434
307
  };
435
308
  };
@@ -466,14 +339,17 @@ var createStoreApi = (apiConfig, _updateSession) => {
466
339
  });
467
340
  },
468
341
  async getSubscriptionPlans(_params, options) {
469
- return apiConfig.httpClient.get("/v1/stores/plans", options);
342
+ return apiConfig.httpClient.get(
343
+ "/v1/stores/plans",
344
+ options
345
+ );
470
346
  },
471
347
  async subscribe(params, options) {
472
- const { store_id, plan_id, success_url, cancel_url } = params;
348
+ const { store_id, plan_id, action, success_url, cancel_url } = params;
473
349
  const target_store_id = store_id || apiConfig.storeId;
474
350
  return apiConfig.httpClient.put(
475
351
  `/v1/stores/${target_store_id}/subscribe`,
476
- { plan_id, success_url, cancel_url },
352
+ { plan_id, action, success_url, cancel_url },
477
353
  options
478
354
  );
479
355
  },
@@ -519,61 +395,52 @@ var createStoreApi = (apiConfig, _updateSession) => {
519
395
  limit: params.limit
520
396
  };
521
397
  if (params.cursor) queryParams.cursor = params.cursor;
522
- if (params.ids && params.ids.length > 0) queryParams.ids = JSON.stringify(params.ids);
398
+ if (params.ids && params.ids.length > 0)
399
+ queryParams.ids = JSON.stringify(params.ids);
523
400
  if (params.query) queryParams.query = params.query;
524
401
  if (params.mime_type) queryParams.mime_type = params.mime_type;
525
402
  if (params.sort_field) queryParams.sort_field = params.sort_field;
526
- if (params.sort_direction) queryParams.sort_direction = params.sort_direction;
527
- return apiConfig.httpClient.get(`/v1/stores/${params.id}/media`, {
528
- ...options,
529
- params: queryParams
530
- });
531
- },
532
- async oauthConnect(params, options) {
533
- return apiConfig.httpClient.post(
534
- `/v1/stores/${params.store_id}/oauth/connect`,
535
- { provider: params.provider, code: params.code, redirect_uri: params.redirect_uri },
536
- options
537
- );
538
- },
539
- async oauthDisconnect(params, options) {
540
- return apiConfig.httpClient.post(
541
- `/v1/stores/${params.store_id}/oauth/disconnect`,
542
- { provider: params.provider },
543
- options
403
+ if (params.sort_direction)
404
+ queryParams.sort_direction = params.sort_direction;
405
+ return apiConfig.httpClient.get(
406
+ `/v1/stores/${params.id}/media`,
407
+ {
408
+ ...options,
409
+ params: queryParams
410
+ }
544
411
  );
545
412
  },
546
- async listIntegrations(params, options) {
413
+ async listBuildHooks(params, options) {
547
414
  return apiConfig.httpClient.get(
548
- `/v1/stores/${params.store_id}/integrations`,
415
+ `/v1/stores/${params.store_id}/build-hooks`,
549
416
  options
550
417
  );
551
418
  },
552
- async createIntegration(params, options) {
419
+ async createBuildHook(params, options) {
553
420
  const { store_id, ...payload } = params;
554
421
  return apiConfig.httpClient.post(
555
- `/v1/stores/${store_id}/integrations`,
422
+ `/v1/stores/${store_id}/build-hooks`,
556
423
  payload,
557
424
  options
558
425
  );
559
426
  },
560
- async updateIntegration(params, options) {
427
+ async updateBuildHook(params, options) {
561
428
  const { store_id, id, ...payload } = params;
562
429
  return apiConfig.httpClient.put(
563
- `/v1/stores/${store_id}/integrations/${id}`,
430
+ `/v1/stores/${store_id}/build-hooks/${id}`,
564
431
  payload,
565
432
  options
566
433
  );
567
434
  },
568
- async deleteIntegration(params, options) {
435
+ async deleteBuildHook(params, options) {
569
436
  return apiConfig.httpClient.delete(
570
- `/v1/stores/${params.store_id}/integrations/${params.id}`,
437
+ `/v1/stores/${params.store_id}/build-hooks/${params.id}`,
571
438
  options
572
439
  );
573
440
  },
574
- async getIntegrationConfig(params, options) {
441
+ async getStoreConfig(params, options) {
575
442
  return apiConfig.httpClient.get(
576
- `/v1/stores/${params.store_id}/integrations/config/${params.type}`,
443
+ `/v1/stores/${params.store_id}/config/${params.type}`,
577
444
  options
578
445
  );
579
446
  },
@@ -618,7 +485,7 @@ var createMediaApi = (apiConfig) => {
618
485
  options
619
486
  );
620
487
  },
621
- async uploadStoreMedia(params, _options) {
488
+ async uploadStoreMedia(params, options) {
622
489
  const { store_id, files = [], urls = [] } = params;
623
490
  const target_store_id = store_id || apiConfig.storeId;
624
491
  const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
@@ -631,7 +498,8 @@ var createMediaApi = (apiConfig) => {
631
498
  body: formData,
632
499
  headers: {
633
500
  Authorization: `Bearer ${tokens?.access_token || ""}`
634
- }
501
+ },
502
+ signal: options?.signal
635
503
  });
636
504
  if (!response.ok) {
637
505
  throw new Error("Upload failed, server said no");
@@ -645,7 +513,7 @@ var createMediaApi = (apiConfig) => {
645
513
  options
646
514
  );
647
515
  },
648
- async getStoreMedia(params, _options) {
516
+ async getStoreMedia(params, options) {
649
517
  const { store_id, cursor, limit, ids, query, mime_type, sort_field, sort_direction } = params;
650
518
  const target_store_id = store_id || apiConfig.storeId;
651
519
  const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
@@ -661,7 +529,8 @@ var createMediaApi = (apiConfig) => {
661
529
  const response = await fetch(`${url}?${queryString}`, {
662
530
  headers: {
663
531
  Authorization: `Bearer ${tokens?.access_token || ""}`
664
- }
532
+ },
533
+ signal: options?.signal
665
534
  });
666
535
  if (!response.ok) {
667
536
  const errorData = await response.json().catch(() => null);
@@ -749,77 +618,97 @@ var createPromoCodeApi = (apiConfig) => {
749
618
  // src/api/cms.ts
750
619
  var createCmsApi = (apiConfig) => {
751
620
  return {
752
- async createNode(params, options) {
621
+ async createCollection(params, options) {
753
622
  const { store_id, ...payload } = params;
754
623
  const target_store_id = store_id || apiConfig.storeId;
755
624
  return apiConfig.httpClient.post(
756
- `/v1/stores/${target_store_id}/nodes`,
625
+ `/v1/stores/${target_store_id}/collections`,
757
626
  payload,
758
627
  options
759
628
  );
760
629
  },
761
- async updateNode(params, options) {
630
+ async updateCollection(params, options) {
762
631
  const { store_id, ...payload } = params;
763
632
  const target_store_id = store_id || apiConfig.storeId;
764
633
  return apiConfig.httpClient.put(
765
- `/v1/stores/${target_store_id}/nodes/${params.id}`,
634
+ `/v1/stores/${target_store_id}/collections/${params.id}`,
766
635
  payload,
767
636
  options
768
637
  );
769
638
  },
770
- async deleteNode(params, options) {
639
+ async deleteCollection(params, options) {
771
640
  const target_store_id = params.store_id || apiConfig.storeId;
772
641
  return apiConfig.httpClient.delete(
773
- `/v1/stores/${target_store_id}/nodes/${params.id}`,
642
+ `/v1/stores/${target_store_id}/collections/${params.id}`,
774
643
  options
775
644
  );
776
645
  },
777
- async getNode(params, options) {
646
+ async getCollection(params, options) {
778
647
  const target_store_id = params.store_id || apiConfig.storeId;
779
648
  let identifier;
780
649
  if (params.id) {
781
650
  identifier = params.id;
782
- } else if (params.slug) {
783
- identifier = `${target_store_id}:${apiConfig.locale}:${params.slug}`;
784
651
  } else if (params.key) {
785
652
  identifier = `${target_store_id}:${params.key}`;
786
653
  } else {
787
- throw new Error("GetNodeParams requires id, slug, or key");
654
+ throw new Error("GetCollectionParams requires id or key");
788
655
  }
789
- const response = await apiConfig.httpClient.get(
790
- `/v1/stores/${target_store_id}/nodes/${identifier}`,
656
+ return apiConfig.httpClient.get(
657
+ `/v1/stores/${target_store_id}/collections/${identifier}`,
791
658
  options
792
659
  );
793
- return {
794
- ...response,
795
- getBlock(key) {
796
- return getBlockFromArray(response, key, apiConfig.locale);
797
- },
798
- getBlockValues(key) {
799
- return getBlockObjectValues(response, key, apiConfig.locale);
800
- },
801
- getImage(key) {
802
- const block = getBlockFromArray(response, key, apiConfig.locale);
803
- return getImageUrl(block, true);
804
- }
805
- };
806
660
  },
807
- async getNodes(params, options) {
661
+ async getCollections(params = {}, options) {
808
662
  const { store_id, ...queryParams } = params;
809
663
  const target_store_id = store_id || apiConfig.storeId;
810
664
  return apiConfig.httpClient.get(
811
- `/v1/stores/${target_store_id}/nodes`,
665
+ `/v1/stores/${target_store_id}/collections`,
812
666
  {
813
667
  ...options,
814
668
  params: queryParams
815
669
  }
816
670
  );
817
671
  },
818
- async getNodeChildren(params, options) {
819
- const { id, store_id, ...queryParams } = params;
672
+ async createEntry(params, options) {
673
+ const { store_id, ...payload } = params;
674
+ const target_store_id = store_id || apiConfig.storeId;
675
+ return apiConfig.httpClient.post(
676
+ `/v1/stores/${target_store_id}/entries`,
677
+ payload,
678
+ options
679
+ );
680
+ },
681
+ async updateEntry(params, options) {
682
+ const { store_id, ...payload } = params;
683
+ const target_store_id = store_id || apiConfig.storeId;
684
+ return apiConfig.httpClient.put(
685
+ `/v1/stores/${target_store_id}/entries/${params.id}`,
686
+ payload,
687
+ options
688
+ );
689
+ },
690
+ async deleteEntry(params, options) {
691
+ const target_store_id = params.store_id || apiConfig.storeId;
692
+ return apiConfig.httpClient.delete(
693
+ `/v1/stores/${target_store_id}/entries/${params.id}`,
694
+ options
695
+ );
696
+ },
697
+ async getEntry(params, options) {
698
+ const target_store_id = params.store_id || apiConfig.storeId;
699
+ if (!params.id) {
700
+ throw new Error("GetEntryParams requires id");
701
+ }
702
+ return apiConfig.httpClient.get(
703
+ `/v1/stores/${target_store_id}/entries/${params.id}`,
704
+ options
705
+ );
706
+ },
707
+ async getEntries(params, options) {
708
+ const { store_id, ...queryParams } = params;
820
709
  const target_store_id = store_id || apiConfig.storeId;
821
710
  return apiConfig.httpClient.get(
822
- `/v1/stores/${target_store_id}/nodes/${id}/children`,
711
+ `/v1/stores/${target_store_id}/entries`,
823
712
  {
824
713
  ...options,
825
714
  params: queryParams
@@ -830,13 +719,6 @@ var createCmsApi = (apiConfig) => {
830
719
  };
831
720
 
832
721
  // src/api/eshop.ts
833
- var normalizeTaxonomyAliases = (payload) => {
834
- const { filters, ...rest } = payload;
835
- return {
836
- ...rest,
837
- ...!rest.taxonomies && filters ? { taxonomies: filters } : {}
838
- };
839
- };
840
722
  var createEshopApi = (apiConfig) => {
841
723
  return {
842
724
  async createProduct(params, options) {
@@ -844,7 +726,7 @@ var createEshopApi = (apiConfig) => {
844
726
  const target_store_id = store_id || apiConfig.storeId;
845
727
  return apiConfig.httpClient.post(
846
728
  `/v1/stores/${target_store_id}/products`,
847
- normalizeTaxonomyAliases(payload),
729
+ payload,
848
730
  options
849
731
  );
850
732
  },
@@ -853,7 +735,7 @@ var createEshopApi = (apiConfig) => {
853
735
  const target_store_id = store_id || apiConfig.storeId;
854
736
  return apiConfig.httpClient.put(
855
737
  `/v1/stores/${target_store_id}/products/${params.id}`,
856
- normalizeTaxonomyAliases(payload),
738
+ payload,
857
739
  options
858
740
  );
859
741
  },
@@ -895,7 +777,7 @@ var createEshopApi = (apiConfig) => {
895
777
  const target_store_id = store_id || apiConfig.storeId;
896
778
  return apiConfig.httpClient.post(
897
779
  `/v1/stores/${target_store_id}/services`,
898
- normalizeTaxonomyAliases(payload),
780
+ payload,
899
781
  options
900
782
  );
901
783
  },
@@ -904,7 +786,7 @@ var createEshopApi = (apiConfig) => {
904
786
  const target_store_id = store_id || apiConfig.storeId;
905
787
  return apiConfig.httpClient.put(
906
788
  `/v1/stores/${target_store_id}/services/${params.id}`,
907
- normalizeTaxonomyAliases(payload),
789
+ payload,
908
790
  options
909
791
  );
910
792
  },
@@ -954,7 +836,7 @@ var createEshopApi = (apiConfig) => {
954
836
  const target_store_id = store_id || apiConfig.storeId;
955
837
  return apiConfig.httpClient.post(
956
838
  `/v1/stores/${target_store_id}/providers`,
957
- normalizeTaxonomyAliases(payload),
839
+ payload,
958
840
  options
959
841
  );
960
842
  },
@@ -963,7 +845,7 @@ var createEshopApi = (apiConfig) => {
963
845
  const target_store_id = store_id || apiConfig.storeId;
964
846
  return apiConfig.httpClient.put(
965
847
  `/v1/stores/${target_store_id}/providers/${params.id}`,
966
- normalizeTaxonomyAliases(payload),
848
+ payload,
967
849
  options
968
850
  );
969
851
  },
@@ -1178,6 +1060,14 @@ var createEshopApi = (apiConfig) => {
1178
1060
  { amount: params.amount },
1179
1061
  options
1180
1062
  );
1063
+ },
1064
+ async downloadDigitalAccess(params, options) {
1065
+ const target_store_id = params.store_id || apiConfig.storeId;
1066
+ return apiConfig.httpClient.post(
1067
+ `/v1/stores/${target_store_id}/orders/${params.id}/digital-access/${params.grant_id}/download`,
1068
+ {},
1069
+ options
1070
+ );
1181
1071
  }
1182
1072
  };
1183
1073
  };
@@ -1268,45 +1158,46 @@ var createMarketApi = (apiConfig) => {
1268
1158
  };
1269
1159
 
1270
1160
  // src/api/crm.ts
1271
- var createActivityAdminApi = (apiConfig) => ({
1161
+ var createActionAdminApi = (apiConfig) => ({
1272
1162
  async timeline(params, options) {
1273
1163
  const store_id = params.store_id || apiConfig.storeId;
1274
- const queryParams = { profile_id: params.profile_id };
1164
+ const queryParams = { contact_id: params.contact_id };
1275
1165
  if (params.limit !== void 0) queryParams.limit = params.limit;
1276
1166
  if (params.cursor) queryParams.cursor = params.cursor;
1277
1167
  return apiConfig.httpClient.get(
1278
- `/v1/stores/${store_id}/activities/timeline`,
1168
+ `/v1/stores/${store_id}/contacts/${params.contact_id}/actions`,
1279
1169
  { ...options, params: queryParams }
1280
1170
  );
1281
1171
  },
1282
1172
  async find(params, options) {
1283
1173
  const store_id = params.store_id || apiConfig.storeId;
1284
1174
  const queryParams = {};
1285
- if (params.profile_id) queryParams.profile_id = params.profile_id;
1175
+ if (params.query) queryParams.query = params.query;
1176
+ if (params.contact_id) queryParams.contact_id = params.contact_id;
1286
1177
  if (params.types && params.types.length > 0) queryParams.types = params.types;
1287
1178
  if (params.from !== void 0) queryParams.from = params.from;
1288
1179
  if (params.to !== void 0) queryParams.to = params.to;
1289
1180
  if (params.limit !== void 0) queryParams.limit = params.limit;
1290
1181
  if (params.cursor) queryParams.cursor = params.cursor;
1291
1182
  return apiConfig.httpClient.get(
1292
- `/v1/stores/${store_id}/activities`,
1183
+ `/v1/stores/${store_id}/actions`,
1293
1184
  { ...options, params: queryParams }
1294
1185
  );
1295
1186
  }
1296
1187
  });
1297
- var createProfileApi = (apiConfig) => {
1188
+ var createContactApi = (apiConfig) => {
1298
1189
  return {
1299
1190
  async create(params, options) {
1300
1191
  const { store_id, ...payload } = params;
1301
1192
  return apiConfig.httpClient.post(
1302
- `/v1/stores/${store_id || apiConfig.storeId}/profiles`,
1193
+ `/v1/stores/${store_id || apiConfig.storeId}/contacts`,
1303
1194
  payload,
1304
1195
  options
1305
1196
  );
1306
1197
  },
1307
1198
  async get(params, options) {
1308
1199
  return apiConfig.httpClient.get(
1309
- `/v1/stores/${params.store_id || apiConfig.storeId}/profiles/${params.id}`,
1200
+ `/v1/stores/${params.store_id || apiConfig.storeId}/contacts/${params.id}`,
1310
1201
  options
1311
1202
  );
1312
1203
  },
@@ -1319,22 +1210,32 @@ var createProfileApi = (apiConfig) => {
1319
1210
  if (params?.query) queryParams.query = params.query;
1320
1211
  if (params?.taxonomy_query) queryParams.taxonomy_query = params.taxonomy_query;
1321
1212
  if (params?.status) queryParams.status = params.status;
1322
- if (params?.has_activity !== void 0) queryParams.has_activity = params.has_activity;
1213
+ if (params?.has_action !== void 0) queryParams.has_action = params.has_action;
1323
1214
  if (params?.has_cart !== void 0) queryParams.has_cart = params.has_cart;
1324
1215
  if (params?.sort_field) queryParams.sort_field = params.sort_field;
1325
1216
  if (params?.sort_direction) queryParams.sort_direction = params.sort_direction;
1326
1217
  return apiConfig.httpClient.get(
1327
- `/v1/stores/${store_id}/profiles`,
1218
+ `/v1/stores/${store_id}/contacts`,
1328
1219
  {
1329
1220
  ...options,
1330
1221
  params: queryParams
1331
1222
  }
1332
1223
  );
1333
1224
  },
1225
+ async findActions(params, options) {
1226
+ const { store_id, ...queryParams } = params || {};
1227
+ return apiConfig.httpClient.get(
1228
+ `/v1/stores/${store_id || apiConfig.storeId}/actions`,
1229
+ {
1230
+ ...options,
1231
+ params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1232
+ }
1233
+ );
1234
+ },
1334
1235
  async update(params, options) {
1335
1236
  const { id, store_id, ...body } = params;
1336
1237
  return apiConfig.httpClient.put(
1337
- `/v1/stores/${store_id || apiConfig.storeId}/profiles/${id}`,
1238
+ `/v1/stores/${store_id || apiConfig.storeId}/contacts/${id}`,
1338
1239
  body,
1339
1240
  options
1340
1241
  );
@@ -1342,7 +1243,7 @@ var createProfileApi = (apiConfig) => {
1342
1243
  async merge(params, options) {
1343
1244
  const store_id = params.store_id || apiConfig.storeId;
1344
1245
  return apiConfig.httpClient.post(
1345
- `/v1/stores/${store_id}/profiles/${params.target_id}/merge`,
1246
+ `/v1/stores/${store_id}/contacts/${params.target_id}/merge`,
1346
1247
  { source_id: params.source_id, store_id },
1347
1248
  options
1348
1249
  );
@@ -1351,7 +1252,7 @@ var createProfileApi = (apiConfig) => {
1351
1252
  const { store_id, ...payload } = params;
1352
1253
  const target_store_id = store_id || apiConfig.storeId;
1353
1254
  return apiConfig.httpClient.post(
1354
- `/v1/stores/${target_store_id}/profiles/import`,
1255
+ `/v1/stores/${target_store_id}/contacts/import`,
1355
1256
  payload,
1356
1257
  options
1357
1258
  );
@@ -1360,7 +1261,7 @@ var createProfileApi = (apiConfig) => {
1360
1261
  const { store_id, ...payload } = params;
1361
1262
  const target_store_id = store_id || apiConfig.storeId;
1362
1263
  return apiConfig.httpClient.post(
1363
- `/v1/stores/${target_store_id}/profiles/import/preview`,
1264
+ `/v1/stores/${target_store_id}/contacts/import/preview`,
1364
1265
  payload,
1365
1266
  options
1366
1267
  );
@@ -1368,23 +1269,23 @@ var createProfileApi = (apiConfig) => {
1368
1269
  async revokeToken(params, options) {
1369
1270
  const store_id = params.store_id || apiConfig.storeId;
1370
1271
  return apiConfig.httpClient.delete(
1371
- `/v1/stores/${store_id}/profiles/${params.id}/sessions/${params.token_id}`,
1272
+ `/v1/stores/${store_id}/contacts/${params.id}/sessions/${params.token_id}`,
1372
1273
  options
1373
1274
  );
1374
1275
  },
1375
1276
  async revokeAllTokens(params, options) {
1376
1277
  const store_id = params.store_id || apiConfig.storeId;
1377
1278
  return apiConfig.httpClient.delete(
1378
- `/v1/stores/${store_id}/profiles/${params.id}/sessions`,
1279
+ `/v1/stores/${store_id}/contacts/${params.id}/sessions`,
1379
1280
  options
1380
1281
  );
1381
1282
  },
1382
- profileList: {
1283
+ contactList: {
1383
1284
  async create(params, options) {
1384
1285
  const { store_id, ...payload } = params;
1385
1286
  const target_store_id = store_id || apiConfig.storeId;
1386
1287
  return apiConfig.httpClient.post(
1387
- `/v1/stores/${target_store_id}/profile-lists`,
1288
+ `/v1/stores/${target_store_id}/contact-lists`,
1388
1289
  payload,
1389
1290
  options
1390
1291
  );
@@ -1393,7 +1294,7 @@ var createProfileApi = (apiConfig) => {
1393
1294
  const { id, store_id, ...payload } = params;
1394
1295
  const target_store_id = store_id || apiConfig.storeId;
1395
1296
  return apiConfig.httpClient.put(
1396
- `/v1/stores/${target_store_id}/profile-lists/${id}`,
1297
+ `/v1/stores/${target_store_id}/contact-lists/${id}`,
1397
1298
  payload,
1398
1299
  options
1399
1300
  );
@@ -1401,7 +1302,7 @@ var createProfileApi = (apiConfig) => {
1401
1302
  async get(params, options) {
1402
1303
  const target_store_id = params.store_id || apiConfig.storeId;
1403
1304
  return apiConfig.httpClient.get(
1404
- `/v1/stores/${target_store_id}/profile-lists/${params.id}`,
1305
+ `/v1/stores/${target_store_id}/contact-lists/${params.id}`,
1405
1306
  options
1406
1307
  );
1407
1308
  },
@@ -1409,79 +1310,43 @@ var createProfileApi = (apiConfig) => {
1409
1310
  const { store_id, ...queryParams } = params || {};
1410
1311
  const target_store_id = store_id || apiConfig.storeId;
1411
1312
  return apiConfig.httpClient.get(
1412
- `/v1/stores/${target_store_id}/profile-lists`,
1313
+ `/v1/stores/${target_store_id}/contact-lists`,
1413
1314
  { ...options, params: queryParams }
1414
1315
  );
1415
1316
  },
1416
- async importProfiles(params, options) {
1417
- const { store_id, profile_list_id, ...payload } = params;
1317
+ async importContacts(params, options) {
1318
+ const { store_id, contact_list_id, ...payload } = params;
1418
1319
  const target_store_id = store_id || apiConfig.storeId;
1419
1320
  return apiConfig.httpClient.post(
1420
- `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/profiles/import`,
1321
+ `/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/import`,
1421
1322
  payload,
1422
1323
  options
1423
1324
  );
1424
1325
  },
1425
- async previewImportProfiles(params, options) {
1426
- const { store_id, profile_list_id, ...payload } = params;
1326
+ async previewImportContacts(params, options) {
1327
+ const { store_id, contact_list_id, ...payload } = params;
1427
1328
  const target_store_id = store_id || apiConfig.storeId;
1428
1329
  return apiConfig.httpClient.post(
1429
- `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/profiles/import/preview`,
1330
+ `/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/import/preview`,
1430
1331
  payload,
1431
1332
  options
1432
1333
  );
1433
1334
  },
1434
1335
  members: {
1435
1336
  async add(params, options) {
1436
- const { store_id, profile_list_id, profile_id, fields, lead_description } = params;
1437
- const target_store_id = store_id || apiConfig.storeId;
1438
- return apiConfig.httpClient.post(
1439
- `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
1440
- { fields, lead_description },
1441
- options
1442
- );
1443
- },
1444
- async update(params, options) {
1445
- const { store_id, profile_list_id, profile_id, status, fields, lead_description } = params;
1446
- const target_store_id = store_id || apiConfig.storeId;
1447
- return apiConfig.httpClient.patch(
1448
- `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
1449
- { status, fields, lead_description },
1450
- options
1451
- );
1452
- },
1453
- async remove(params, options) {
1454
- const target_store_id = params.store_id || apiConfig.storeId;
1455
- return apiConfig.httpClient.delete(
1456
- `/v1/stores/${target_store_id}/profile-lists/${params.profile_list_id}/members/${params.profile_id}`,
1457
- options
1458
- );
1459
- },
1460
- async find(params, options) {
1461
- const { store_id, profile_list_id, ...queryParams } = params;
1462
- const target_store_id = store_id || apiConfig.storeId;
1463
- const path = profile_list_id ? `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members` : `/v1/stores/${target_store_id}/profile-list-members`;
1464
- return apiConfig.httpClient.get(
1465
- path,
1466
- { ...options, params: queryParams }
1467
- );
1468
- }
1469
- },
1470
- profiles: {
1471
- async add(params, options) {
1472
- const { store_id, profile_list_id, profile_id, fields, lead_description } = params;
1337
+ const { store_id, contact_list_id, contact_id, fields, lead_description } = params;
1473
1338
  const target_store_id = store_id || apiConfig.storeId;
1474
1339
  return apiConfig.httpClient.post(
1475
- `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
1340
+ `/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/${contact_id}`,
1476
1341
  { fields, lead_description },
1477
1342
  options
1478
1343
  );
1479
1344
  },
1480
1345
  async update(params, options) {
1481
- const { store_id, profile_list_id, profile_id, status, fields, lead_description } = params;
1346
+ const { store_id, contact_list_id, contact_id, status, fields, lead_description } = params;
1482
1347
  const target_store_id = store_id || apiConfig.storeId;
1483
1348
  return apiConfig.httpClient.patch(
1484
- `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
1349
+ `/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/${contact_id}`,
1485
1350
  { status, fields, lead_description },
1486
1351
  options
1487
1352
  );
@@ -1489,14 +1354,17 @@ var createProfileApi = (apiConfig) => {
1489
1354
  async remove(params, options) {
1490
1355
  const target_store_id = params.store_id || apiConfig.storeId;
1491
1356
  return apiConfig.httpClient.delete(
1492
- `/v1/stores/${target_store_id}/profile-lists/${params.profile_list_id}/members/${params.profile_id}`,
1357
+ `/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/contacts/${params.contact_id}`,
1493
1358
  options
1494
1359
  );
1495
1360
  },
1496
1361
  async find(params, options) {
1497
- const { store_id, profile_list_id, ...queryParams } = params;
1362
+ const { store_id, contact_list_id, ...queryParams } = params;
1363
+ if (!contact_list_id && !queryParams.contact_id) {
1364
+ throw new Error("contact_list_id or contact_id is required");
1365
+ }
1498
1366
  const target_store_id = store_id || apiConfig.storeId;
1499
- const path = profile_list_id ? `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members` : `/v1/stores/${target_store_id}/profile-list-members`;
1367
+ const path = contact_list_id ? `/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts` : `/v1/stores/${target_store_id}/contact-lists/contacts`;
1500
1368
  return apiConfig.httpClient.get(
1501
1369
  path,
1502
1370
  { ...options, params: queryParams }
@@ -1613,11 +1481,11 @@ var createProfileApi = (apiConfig) => {
1613
1481
  options
1614
1482
  );
1615
1483
  },
1616
- async importRecipients(params, options) {
1484
+ async importEnrollments(params, options) {
1617
1485
  const { id, store_id, ...payload } = params;
1618
1486
  const target_store_id = store_id || apiConfig.storeId;
1619
1487
  return apiConfig.httpClient.post(
1620
- `/v1/stores/${target_store_id}/campaigns/${id}/recipients/import`,
1488
+ `/v1/stores/${target_store_id}/campaigns/${id}/enrollments/import`,
1621
1489
  payload,
1622
1490
  options
1623
1491
  );
@@ -1632,12 +1500,12 @@ var createProfileApi = (apiConfig) => {
1632
1500
  );
1633
1501
  }
1634
1502
  },
1635
- campaignRecipient: {
1503
+ campaignEnrollment: {
1636
1504
  async find(params, options) {
1637
1505
  const { store_id, ...queryParams } = params || {};
1638
1506
  const target_store_id = store_id || apiConfig.storeId;
1639
1507
  return apiConfig.httpClient.get(
1640
- `/v1/stores/${target_store_id}/campaign-recipients`,
1508
+ `/v1/stores/${target_store_id}/campaign-enrollments`,
1641
1509
  { ...options, params: queryParams }
1642
1510
  );
1643
1511
  },
@@ -1645,7 +1513,7 @@ var createProfileApi = (apiConfig) => {
1645
1513
  const { store_id, id, ...queryParams } = params;
1646
1514
  const target_store_id = store_id || apiConfig.storeId;
1647
1515
  return apiConfig.httpClient.get(
1648
- `/v1/stores/${target_store_id}/campaign-recipients/${id}`,
1516
+ `/v1/stores/${target_store_id}/campaign-enrollments/${id}`,
1649
1517
  { ...options, params: { ...queryParams, store_id: target_store_id } }
1650
1518
  );
1651
1519
  },
@@ -1653,7 +1521,7 @@ var createProfileApi = (apiConfig) => {
1653
1521
  const { store_id, id, ...payload } = params;
1654
1522
  const target_store_id = store_id || apiConfig.storeId;
1655
1523
  return apiConfig.httpClient.put(
1656
- `/v1/stores/${target_store_id}/campaign-recipients/${id}`,
1524
+ `/v1/stores/${target_store_id}/campaign-enrollments/${id}`,
1657
1525
  payload,
1658
1526
  options
1659
1527
  );
@@ -1662,7 +1530,16 @@ var createProfileApi = (apiConfig) => {
1662
1530
  const { store_id, id, draft_id, ...payload } = params;
1663
1531
  const target_store_id = store_id || apiConfig.storeId;
1664
1532
  return apiConfig.httpClient.put(
1665
- `/v1/stores/${target_store_id}/campaign-recipients/${id}/drafts/${draft_id}`,
1533
+ `/v1/stores/${target_store_id}/campaign-enrollments/${id}/drafts/${draft_id}`,
1534
+ payload,
1535
+ options
1536
+ );
1537
+ },
1538
+ async updateStepExecution(params, options) {
1539
+ const { store_id, id, execution_id, ...payload } = params;
1540
+ const target_store_id = store_id || apiConfig.storeId;
1541
+ return apiConfig.httpClient.post(
1542
+ `/v1/stores/${target_store_id}/campaign-enrollments/${id}/step-executions/${execution_id}`,
1666
1543
  payload,
1667
1544
  options
1668
1545
  );
@@ -1671,7 +1548,7 @@ var createProfileApi = (apiConfig) => {
1671
1548
  const { store_id, id, ...payload } = params;
1672
1549
  const target_store_id = store_id || apiConfig.storeId;
1673
1550
  return apiConfig.httpClient.post(
1674
- `/v1/stores/${target_store_id}/campaign-recipients/${id}/reply`,
1551
+ `/v1/stores/${target_store_id}/campaign-enrollments/${id}/reply`,
1675
1552
  payload,
1676
1553
  options
1677
1554
  );
@@ -1680,7 +1557,7 @@ var createProfileApi = (apiConfig) => {
1680
1557
  const { store_id, id, ...payload } = params;
1681
1558
  const target_store_id = store_id || apiConfig.storeId;
1682
1559
  return apiConfig.httpClient.post(
1683
- `/v1/stores/${target_store_id}/campaign-recipients/${id}/stop`,
1560
+ `/v1/stores/${target_store_id}/campaign-enrollments/${id}/stop`,
1684
1561
  payload,
1685
1562
  options
1686
1563
  );
@@ -1740,7 +1617,7 @@ var createProfileApi = (apiConfig) => {
1740
1617
  );
1741
1618
  }
1742
1619
  },
1743
- activity: createActivityAdminApi(apiConfig)
1620
+ action: createActionAdminApi(apiConfig)
1744
1621
  };
1745
1622
  };
1746
1623
 
@@ -1755,58 +1632,107 @@ function supportConversationQuery(params) {
1755
1632
  function createAdminSupportApi(config) {
1756
1633
  const { httpClient } = config;
1757
1634
  return {
1758
- agent: {
1635
+ channel: {
1759
1636
  async create(params, opts) {
1760
1637
  return httpClient.post(
1761
- `/v1/stores/${params.store_id}/support/agents`,
1638
+ `/v1/stores/${params.store_id}/support/channels`,
1762
1639
  params,
1763
1640
  opts
1764
1641
  );
1765
1642
  },
1766
1643
  async get(params, opts) {
1767
1644
  return httpClient.get(
1768
- `/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
1645
+ `/v1/stores/${params.store_id}/support/channels/${params.id}?store_id=${params.store_id}`,
1769
1646
  opts
1770
1647
  );
1771
1648
  },
1772
1649
  async find(params, opts) {
1773
1650
  const qs = new URLSearchParams({ store_id: params.store_id });
1774
1651
  if (params.status) qs.set("status", params.status);
1652
+ if (params.channel_type) qs.set("channel_type", params.channel_type);
1775
1653
  if (params.limit) qs.set("limit", String(params.limit));
1776
1654
  if (params.cursor) qs.set("cursor", params.cursor);
1777
1655
  return httpClient.get(
1778
- `/v1/stores/${params.store_id}/support/agents?${qs}`,
1656
+ `/v1/stores/${params.store_id}/support/channels?${qs}`,
1779
1657
  opts
1780
1658
  );
1781
1659
  },
1782
1660
  async update(params, opts) {
1783
1661
  return httpClient.put(
1784
- `/v1/stores/${params.store_id}/support/agents/${params.id}`,
1662
+ `/v1/stores/${params.store_id}/support/channels/${params.id}`,
1785
1663
  params,
1786
1664
  opts
1787
1665
  );
1788
1666
  },
1789
1667
  async delete(params, opts) {
1790
1668
  return httpClient.delete(
1791
- `/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
1669
+ `/v1/stores/${params.store_id}/support/channels/${params.id}?store_id=${params.store_id}`,
1670
+ opts
1671
+ );
1672
+ },
1673
+ async receiveMessage(params, opts) {
1674
+ return httpClient.post(
1675
+ `/v1/stores/${params.store_id}/support/channels/${params.channel_id}/messages`,
1676
+ params,
1792
1677
  opts
1793
1678
  );
1794
1679
  }
1795
1680
  },
1796
- conversation: {
1797
- async find(params, opts) {
1798
- const qs = new URLSearchParams({ store_id: params.store_id });
1799
- if (params.status) qs.set("status", params.status);
1800
- if (params.agent_id) qs.set("agent_id", params.agent_id);
1801
- if (params.limit) qs.set("limit", String(params.limit));
1802
- if (params.cursor) qs.set("cursor", params.cursor);
1803
- return httpClient.get(
1804
- `/v1/stores/${params.store_id}/support/conversations?${qs}`,
1681
+ agent: {
1682
+ async create(params, opts) {
1683
+ return httpClient.post(
1684
+ `/v1/stores/${params.store_id}/support/agents`,
1685
+ params,
1805
1686
  opts
1806
1687
  );
1807
1688
  },
1808
1689
  async get(params, opts) {
1809
- const qs = supportConversationQuery(params);
1690
+ return httpClient.get(
1691
+ `/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
1692
+ opts
1693
+ );
1694
+ },
1695
+ async find(params, opts) {
1696
+ const qs = new URLSearchParams({ store_id: params.store_id });
1697
+ if (params.status) qs.set("status", params.status);
1698
+ if (params.limit) qs.set("limit", String(params.limit));
1699
+ if (params.cursor) qs.set("cursor", params.cursor);
1700
+ return httpClient.get(
1701
+ `/v1/stores/${params.store_id}/support/agents?${qs}`,
1702
+ opts
1703
+ );
1704
+ },
1705
+ async update(params, opts) {
1706
+ return httpClient.put(
1707
+ `/v1/stores/${params.store_id}/support/agents/${params.id}`,
1708
+ params,
1709
+ opts
1710
+ );
1711
+ },
1712
+ async delete(params, opts) {
1713
+ return httpClient.delete(
1714
+ `/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
1715
+ opts
1716
+ );
1717
+ }
1718
+ },
1719
+ conversation: {
1720
+ async find(params, opts) {
1721
+ const qs = new URLSearchParams({ store_id: params.store_id });
1722
+ if (params.status) qs.set("status", params.status);
1723
+ if (params.agent_id) qs.set("agent_id", params.agent_id);
1724
+ if (params.channel_id) qs.set("channel_id", params.channel_id);
1725
+ if (params.channel_type) qs.set("channel_type", params.channel_type);
1726
+ if (params.query) qs.set("query", params.query);
1727
+ if (params.limit) qs.set("limit", String(params.limit));
1728
+ if (params.cursor) qs.set("cursor", params.cursor);
1729
+ return httpClient.get(
1730
+ `/v1/stores/${params.store_id}/support/conversations?${qs}`,
1731
+ opts
1732
+ );
1733
+ },
1734
+ async get(params, opts) {
1735
+ const qs = supportConversationQuery(params);
1810
1736
  return httpClient.get(
1811
1737
  `/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}?${qs}`,
1812
1738
  opts
@@ -1910,6 +1836,195 @@ var createLeadResearchApi = (apiConfig) => {
1910
1836
  };
1911
1837
  };
1912
1838
 
1839
+ // src/api/social.ts
1840
+ var createSocialApi = (apiConfig) => {
1841
+ const storeId = (store_id) => store_id || apiConfig.storeId;
1842
+ const api = {
1843
+ async findPublications(params, options) {
1844
+ const { store_id, ...queryParams } = params || {};
1845
+ return apiConfig.httpClient.get(
1846
+ `/v1/stores/${storeId(store_id)}/social-publications`,
1847
+ {
1848
+ ...options,
1849
+ params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1850
+ }
1851
+ );
1852
+ },
1853
+ async getPublication(params, options) {
1854
+ return apiConfig.httpClient.get(
1855
+ `/v1/stores/${storeId(params.store_id)}/social-publications/${params.id}`,
1856
+ options
1857
+ );
1858
+ },
1859
+ async validatePublication(params, options) {
1860
+ const { store_id, ...payload } = params;
1861
+ return apiConfig.httpClient.post(
1862
+ `/v1/stores/${storeId(store_id)}/social-publications/validate`,
1863
+ payload,
1864
+ options
1865
+ );
1866
+ },
1867
+ async createPublication(params, options) {
1868
+ const { store_id, ...payload } = params;
1869
+ return apiConfig.httpClient.post(
1870
+ `/v1/stores/${storeId(store_id)}/social-publications`,
1871
+ payload,
1872
+ options
1873
+ );
1874
+ },
1875
+ async updatePublication(params, options) {
1876
+ const { store_id, id, ...payload } = params;
1877
+ return apiConfig.httpClient.put(
1878
+ `/v1/stores/${storeId(store_id)}/social-publications/${id}`,
1879
+ payload,
1880
+ options
1881
+ );
1882
+ },
1883
+ async schedulePublication(params, options) {
1884
+ const { store_id, id, ...payload } = params;
1885
+ return apiConfig.httpClient.post(
1886
+ `/v1/stores/${storeId(store_id)}/social-publications/${id}/schedule`,
1887
+ payload,
1888
+ options
1889
+ );
1890
+ },
1891
+ async cancelPublication(params, options) {
1892
+ return apiConfig.httpClient.post(
1893
+ `/v1/stores/${storeId(params.store_id)}/social-publications/${params.id}/cancel`,
1894
+ {},
1895
+ options
1896
+ );
1897
+ },
1898
+ async getPublicationComments(params, options) {
1899
+ const { store_id, publication_id, ...queryParams } = params;
1900
+ return apiConfig.httpClient.get(
1901
+ `/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments`,
1902
+ {
1903
+ ...options,
1904
+ params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1905
+ }
1906
+ );
1907
+ },
1908
+ async syncPublicationComments(params, options) {
1909
+ const { store_id, publication_id, ...payload } = params;
1910
+ return apiConfig.httpClient.post(
1911
+ `/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/sync`,
1912
+ payload,
1913
+ options
1914
+ );
1915
+ },
1916
+ async getPublicationCommentThread(params, options) {
1917
+ const { store_id, publication_id, comment_id, ...queryParams } = params;
1918
+ return apiConfig.httpClient.get(
1919
+ `/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/thread`,
1920
+ {
1921
+ ...options,
1922
+ params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1923
+ }
1924
+ );
1925
+ },
1926
+ async syncPublicationCommentThread(params, options) {
1927
+ const { store_id, publication_id, comment_id, ...payload } = params;
1928
+ return apiConfig.httpClient.post(
1929
+ `/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/thread/sync`,
1930
+ payload,
1931
+ options
1932
+ );
1933
+ },
1934
+ async findPublicationComments(params, options) {
1935
+ const { store_id, ...queryParams } = params || {};
1936
+ return apiConfig.httpClient.get(`/v1/stores/${storeId(store_id)}/social-publications/comments`, {
1937
+ ...options,
1938
+ params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1939
+ });
1940
+ },
1941
+ async classifyPublicationComments(params, options) {
1942
+ const { store_id, ...payload } = params || {};
1943
+ return apiConfig.httpClient.post(
1944
+ `/v1/stores/${storeId(store_id)}/social-publications/comments/classify`,
1945
+ payload,
1946
+ options
1947
+ );
1948
+ },
1949
+ async replyToPublicationComment(params, options) {
1950
+ const { store_id, publication_id, comment_id, text } = params;
1951
+ return apiConfig.httpClient.post(
1952
+ `/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/reply`,
1953
+ { text },
1954
+ options
1955
+ );
1956
+ },
1957
+ async getPublicationMetrics(params, options) {
1958
+ return apiConfig.httpClient.get(
1959
+ `/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/metrics`,
1960
+ options
1961
+ );
1962
+ },
1963
+ async syncPublicationMetrics(params, options) {
1964
+ return apiConfig.httpClient.post(
1965
+ `/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/metrics/sync`,
1966
+ {},
1967
+ options
1968
+ );
1969
+ },
1970
+ async syncEngagement(params, options) {
1971
+ const { store_id, ...payload } = params || {};
1972
+ return apiConfig.httpClient.post(
1973
+ `/v1/stores/${storeId(store_id)}/social-publications/engagement/sync`,
1974
+ payload,
1975
+ options
1976
+ );
1977
+ },
1978
+ async getCapabilities(params, options) {
1979
+ return apiConfig.httpClient.get(
1980
+ `/v1/stores/${storeId(params?.store_id)}/social-accounts/capabilities`,
1981
+ options
1982
+ );
1983
+ },
1984
+ async listAccounts(params, options) {
1985
+ return apiConfig.httpClient.get(
1986
+ `/v1/stores/${storeId(params?.store_id)}/social-accounts`,
1987
+ options
1988
+ );
1989
+ },
1990
+ async connect(params, options) {
1991
+ const { store_id, ...payload } = params;
1992
+ return apiConfig.httpClient.post(
1993
+ `/v1/stores/${storeId(store_id)}/social-accounts/oauth/connect`,
1994
+ payload,
1995
+ options
1996
+ );
1997
+ },
1998
+ async getOAuthAttempt(params, options) {
1999
+ return apiConfig.httpClient.get(
2000
+ `/v1/stores/${storeId(params.store_id)}/social-accounts/oauth/attempts/${params.attempt_id}`,
2001
+ options
2002
+ );
2003
+ },
2004
+ async selectDestination(params, options) {
2005
+ const { store_id, ...payload } = params;
2006
+ return apiConfig.httpClient.post(
2007
+ `/v1/stores/${storeId(store_id)}/social-accounts/oauth/select-destination`,
2008
+ payload,
2009
+ options
2010
+ );
2011
+ },
2012
+ async deleteAccount(params, options) {
2013
+ return apiConfig.httpClient.delete(
2014
+ `/v1/stores/${storeId(params.store_id)}/social-accounts/${params.id}`,
2015
+ options
2016
+ );
2017
+ },
2018
+ validatePublications(params, options) {
2019
+ return api.validatePublication(params, options);
2020
+ },
2021
+ createPublications(params, options) {
2022
+ return api.createPublication(params, options);
2023
+ }
2024
+ };
2025
+ return api;
2026
+ };
2027
+
1913
2028
  // src/api/workflow.ts
1914
2029
  var createWorkflowApi = (apiConfig) => {
1915
2030
  return {
@@ -1948,14 +2063,21 @@ var createWorkflowApi = (apiConfig) => {
1948
2063
  async getWorkflows(params, options) {
1949
2064
  const store_id = params?.store_id || apiConfig.storeId;
1950
2065
  const { store_id: _, ...queryParams } = params || {};
1951
- return apiConfig.httpClient.get(`/v1/stores/${store_id}/workflows`, {
1952
- ...options,
1953
- params: Object.keys(queryParams).length > 0 ? queryParams : void 0
1954
- });
2066
+ return apiConfig.httpClient.get(
2067
+ `/v1/stores/${store_id}/workflows`,
2068
+ {
2069
+ ...options,
2070
+ params: Object.keys(queryParams).length > 0 ? queryParams : void 0
2071
+ }
2072
+ );
1955
2073
  },
1956
2074
  async triggerWorkflow(params, options) {
1957
2075
  const { secret, ...payload } = params;
1958
- return apiConfig.httpClient.post(`/v1/workflows/trigger/${secret}`, payload, options);
2076
+ return apiConfig.httpClient.post(
2077
+ `/v1/workflows/trigger/${secret}`,
2078
+ payload,
2079
+ options
2080
+ );
1959
2081
  },
1960
2082
  async getWorkflowExecutions(params, options) {
1961
2083
  const store_id = params.store_id || apiConfig.storeId;
@@ -1974,6 +2096,38 @@ var createWorkflowApi = (apiConfig) => {
1974
2096
  `/v1/stores/${store_id}/workflows/${params.workflow_id}/executions/${params.execution_id}`,
1975
2097
  options
1976
2098
  );
2099
+ },
2100
+ async getWorkflowAccounts(params, options) {
2101
+ const store_id = params?.store_id || apiConfig.storeId;
2102
+ return apiConfig.httpClient.get(
2103
+ `/v1/stores/${store_id}/workflow-accounts`,
2104
+ options
2105
+ );
2106
+ },
2107
+ async getWorkflowAccountConnectUrl(params, options) {
2108
+ const { store_id, type, ...payload } = params;
2109
+ const target_store_id = store_id || apiConfig.storeId;
2110
+ return apiConfig.httpClient.post(
2111
+ `/v1/stores/${target_store_id}/workflow-accounts/connect-url`,
2112
+ { ...payload, type, store_id: target_store_id },
2113
+ options
2114
+ );
2115
+ },
2116
+ async connectWorkflowAccount(params, options) {
2117
+ const { store_id, type, ...payload } = params;
2118
+ const target_store_id = store_id || apiConfig.storeId;
2119
+ return apiConfig.httpClient.post(
2120
+ `/v1/stores/${target_store_id}/workflow-accounts/connect`,
2121
+ { ...payload, type, store_id: target_store_id },
2122
+ options
2123
+ );
2124
+ },
2125
+ async deleteWorkflowAccount(params, options) {
2126
+ const store_id = params.store_id || apiConfig.storeId;
2127
+ return apiConfig.httpClient.delete(
2128
+ `/v1/stores/${store_id}/workflow-accounts/${params.id}`,
2129
+ options
2130
+ );
1977
2131
  }
1978
2132
  };
1979
2133
  };
@@ -1984,8 +2138,8 @@ var createPlatformApi = (apiConfig) => {
1984
2138
  async getCurrencies(options) {
1985
2139
  return apiConfig.httpClient.get("/v1/platform/currencies", options);
1986
2140
  },
1987
- async getIntegrationServices(options) {
1988
- return apiConfig.httpClient.get("/v1/platform/integration-services", options);
2141
+ async getWorkflowTools(options) {
2142
+ return apiConfig.httpClient.get("/v1/platform/workflow-tools", options);
1989
2143
  },
1990
2144
  async getWebhookEvents(options) {
1991
2145
  return apiConfig.httpClient.get("/v1/platform/events", options);
@@ -2031,6 +2185,48 @@ var createShippingApi = (apiConfig) => {
2031
2185
  payload,
2032
2186
  options
2033
2187
  );
2188
+ },
2189
+ async refundLabel(params, options) {
2190
+ const { order_id, shipment_id } = params;
2191
+ return apiConfig.httpClient.post(
2192
+ `/v1/stores/${apiConfig.storeId}/orders/${order_id}/shipments/${shipment_id}/label/refund`,
2193
+ {},
2194
+ options
2195
+ );
2196
+ }
2197
+ };
2198
+ };
2199
+
2200
+ // src/api/paymentProvider.ts
2201
+ var createPaymentProviderApi = (apiConfig) => {
2202
+ const storeId = (store_id) => store_id || apiConfig.storeId;
2203
+ return {
2204
+ async list(params, options) {
2205
+ return apiConfig.httpClient.get(
2206
+ `/v1/stores/${storeId(params?.store_id)}/payment-providers`,
2207
+ options
2208
+ );
2209
+ },
2210
+ async refresh(params, options) {
2211
+ const targetStoreId = storeId(params?.store_id);
2212
+ return apiConfig.httpClient.post(
2213
+ `/v1/stores/${targetStoreId}/payment-providers/refresh`,
2214
+ { store_id: targetStoreId },
2215
+ options
2216
+ );
2217
+ },
2218
+ async connectStripe(params, options) {
2219
+ return apiConfig.httpClient.post(
2220
+ `/v1/stores/${storeId(params.store_id)}/payment-providers/stripe/connect`,
2221
+ params,
2222
+ options
2223
+ );
2224
+ },
2225
+ async delete(params, options) {
2226
+ return apiConfig.httpClient.delete(
2227
+ `/v1/stores/${storeId(params.store_id)}/payment-providers/${params.id}`,
2228
+ options
2229
+ );
2034
2230
  }
2035
2231
  };
2036
2232
  };
@@ -2270,6 +2466,164 @@ var createAnalyticsApi = (apiConfig) => {
2270
2466
  };
2271
2467
  };
2272
2468
 
2469
+ // src/api/experiments.ts
2470
+ var createExperimentsApi = (apiConfig) => {
2471
+ const base = (storeId = apiConfig.storeId) => `/v1/stores/${storeId}/experiments`;
2472
+ return {
2473
+ create(params, options) {
2474
+ const { store_id, ...payload } = params;
2475
+ return apiConfig.httpClient.post(base(store_id), payload, options);
2476
+ },
2477
+ update(params, options) {
2478
+ const { store_id, key, ...payload } = params;
2479
+ return apiConfig.httpClient.put(`${base(store_id)}/${key}`, payload, options);
2480
+ },
2481
+ get(params, options) {
2482
+ return apiConfig.httpClient.get(`${base(params.store_id)}/${params.key}`, options);
2483
+ },
2484
+ find(params = {}, options) {
2485
+ const { store_id, ...queryParams } = params;
2486
+ return apiConfig.httpClient.get(base(store_id), {
2487
+ ...options,
2488
+ params: queryParams
2489
+ });
2490
+ },
2491
+ results(params, options) {
2492
+ return apiConfig.httpClient.get(
2493
+ `${base(params.store_id)}/${params.key}/results`,
2494
+ options
2495
+ );
2496
+ }
2497
+ };
2498
+ };
2499
+
2500
+ // src/utils/blocks.ts
2501
+ function getBlockLabel(block) {
2502
+ if (!block) return "";
2503
+ return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) ?? "";
2504
+ }
2505
+ function formatBlockValue(block) {
2506
+ if (!block || block.value === null || block.value === void 0) return "";
2507
+ const value = block.value;
2508
+ switch (block.type) {
2509
+ case "boolean":
2510
+ return value ? "Yes" : "No";
2511
+ case "number":
2512
+ if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
2513
+ return new Date(value).toLocaleDateString();
2514
+ }
2515
+ return String(value);
2516
+ case "media":
2517
+ if (value && typeof value === "object") {
2518
+ return value.mime_type ? value.name || value.id : value.title || value.name || value.id;
2519
+ }
2520
+ return String(value);
2521
+ default:
2522
+ return String(value);
2523
+ }
2524
+ }
2525
+ function prepareBlocksForSubmission(formData, blockTypes) {
2526
+ return Object.keys(formData).filter((key) => formData[key] !== null && formData[key] !== void 0).map((key) => ({
2527
+ key,
2528
+ value: (blockTypes?.[key] || "text") === "array" && !Array.isArray(formData[key]) ? [formData[key]] : formData[key]
2529
+ }));
2530
+ }
2531
+ function extractBlockValues(blocks) {
2532
+ const values = {};
2533
+ blocks.forEach((block) => {
2534
+ values[block.key] = block.value ?? null;
2535
+ });
2536
+ return values;
2537
+ }
2538
+ var getBlockValue = (entry, blockKey) => {
2539
+ const block = entry?.blocks?.find((f) => f.key === blockKey);
2540
+ return block?.value ?? null;
2541
+ };
2542
+ var getBlockTextValue = (block, locale = "en") => {
2543
+ if (!block || block.value === null || block.value === void 0) return "";
2544
+ const blockType = block.type;
2545
+ if (blockType === "localized_text" || blockType === "markdown") {
2546
+ if (typeof block.value === "object" && block.value !== null) {
2547
+ return block.value[locale] ?? block.value["en"] ?? "";
2548
+ }
2549
+ }
2550
+ if (typeof block.value === "string") return block.value;
2551
+ return String(block.value ?? "");
2552
+ };
2553
+ var getBlockValues = (entry, blockKey) => {
2554
+ const block = entry?.blocks?.find((f) => f.key === blockKey);
2555
+ if (!block) return [];
2556
+ if (block.type === "array" && Array.isArray(block.value)) {
2557
+ return block.value;
2558
+ }
2559
+ return [];
2560
+ };
2561
+ function unwrapBlock(block, locale) {
2562
+ if (!block?.type || block.value === void 0) return block;
2563
+ const blockType = block.type;
2564
+ if (blockType === "array") {
2565
+ return block.value.map((obj) => {
2566
+ const parsed = {};
2567
+ for (const [k, v] of Object.entries(obj)) {
2568
+ parsed[k] = unwrapBlock(v, locale);
2569
+ }
2570
+ return parsed;
2571
+ });
2572
+ }
2573
+ if (blockType === "object") {
2574
+ const parsed = {};
2575
+ for (const [k, v] of Object.entries(block.value || {})) {
2576
+ parsed[k] = unwrapBlock(v, locale);
2577
+ }
2578
+ return parsed;
2579
+ }
2580
+ if (blockType === "localized_text" || blockType === "markdown") {
2581
+ return block.value?.[locale];
2582
+ }
2583
+ return block.value;
2584
+ }
2585
+ var getBlockObjectValues = (entry, blockKey, locale = "en") => {
2586
+ const block = entry?.blocks?.find((f) => f.key === blockKey);
2587
+ if (!block || block.type !== "array" || !Array.isArray(block.value)) return [];
2588
+ return block.value.map((obj) => {
2589
+ if (!obj?.value || !Array.isArray(obj.value)) return {};
2590
+ return obj.value.reduce((acc, current) => {
2591
+ acc[current.key] = unwrapBlock(current, locale);
2592
+ return acc;
2593
+ }, {});
2594
+ });
2595
+ };
2596
+ var getBlockFromArray = (entry, blockKey, locale = "en") => {
2597
+ const block = entry?.blocks?.find((f) => f.key === blockKey);
2598
+ if (!block) return {};
2599
+ if (block.type === "array" && Array.isArray(block.value)) {
2600
+ return block.value.reduce((acc, current) => {
2601
+ acc[current.key] = unwrapBlock(current, locale);
2602
+ return acc;
2603
+ }, {});
2604
+ }
2605
+ if (block.type === "object" && block.value && typeof block.value === "object") {
2606
+ const result = {};
2607
+ for (const [k, v] of Object.entries(block.value)) {
2608
+ result[k] = unwrapBlock(v, locale);
2609
+ }
2610
+ return result;
2611
+ }
2612
+ return { [block.key]: unwrapBlock(block, locale) };
2613
+ };
2614
+ var getImageUrl = (imageBlock, isBlock = true) => {
2615
+ if (!imageBlock) return null;
2616
+ if (imageBlock.type === "media") {
2617
+ const mediaValue = imageBlock.value;
2618
+ return mediaValue?.resolutions?.original?.url || mediaValue?.url || null;
2619
+ }
2620
+ if (isBlock) {
2621
+ if (typeof imageBlock === "string") return imageBlock;
2622
+ if (imageBlock.url) return imageBlock.url;
2623
+ }
2624
+ return imageBlock.resolutions?.original?.url || null;
2625
+ };
2626
+
2273
2627
  // src/utils/price.ts
2274
2628
  function formatCurrency(amount, currencyCode, locale = "en") {
2275
2629
  if (!currencyCode) return "";
@@ -2650,63 +3004,142 @@ function createAdmin(config) {
2650
3004
  const cmsApi = createCmsApi(apiConfig);
2651
3005
  const eshopApi = createEshopApi(apiConfig);
2652
3006
  const promoCodeApi = createPromoCodeApi(apiConfig);
2653
- const crmApi = createProfileApi(apiConfig);
3007
+ const crmApi = createContactApi(apiConfig);
2654
3008
  const supportApi = createAdminSupportApi(apiConfig);
2655
3009
  const leadResearchApi = createLeadResearchApi(apiConfig);
2656
- const leadResearch = {
2657
- run: {
2658
- create: leadResearchApi.createRun,
2659
- find: leadResearchApi.findRuns,
2660
- get: leadResearchApi.getRun,
2661
- update: leadResearchApi.updateRun,
2662
- cancel: leadResearchApi.cancelRun,
2663
- sendMessage: leadResearchApi.sendMessage,
2664
- findMessages: leadResearchApi.findMessages
2665
- },
2666
- message: {
2667
- send: leadResearchApi.sendMessage,
2668
- find: leadResearchApi.findMessages
2669
- },
2670
- email: {
2671
- validate: leadResearchApi.validateEmail
2672
- },
2673
- createRun: leadResearchApi.createRun,
2674
- findRuns: leadResearchApi.findRuns,
2675
- getRun: leadResearchApi.getRun,
2676
- updateRun: leadResearchApi.updateRun,
2677
- cancelRun: leadResearchApi.cancelRun,
2678
- sendMessage: leadResearchApi.sendMessage,
2679
- findMessages: leadResearchApi.findMessages,
2680
- validateEmail: leadResearchApi.validateEmail
2681
- };
3010
+ const socialApi = createSocialApi(apiConfig);
3011
+ const paymentProviderApi = createPaymentProviderApi(apiConfig);
3012
+ const notificationApi = createNotificationApi(apiConfig);
3013
+ const shippingApi = createShippingApi(apiConfig);
2682
3014
  const locationApi = createLocationApi(apiConfig);
2683
3015
  const marketApi = createMarketApi(apiConfig);
2684
3016
  const workflowApi = createWorkflowApi(apiConfig);
3017
+ const storePaymentProviderApi = {
3018
+ list: paymentProviderApi.list,
3019
+ refresh: paymentProviderApi.refresh,
3020
+ connectStripe: paymentProviderApi.connectStripe,
3021
+ delete: paymentProviderApi.delete
3022
+ };
3023
+ const workflowPublicApi = {
3024
+ create: workflowApi.createWorkflow,
3025
+ update: workflowApi.updateWorkflow,
3026
+ delete: workflowApi.deleteWorkflow,
3027
+ get: workflowApi.getWorkflow,
3028
+ find: workflowApi.getWorkflows,
3029
+ trigger: workflowApi.triggerWorkflow,
3030
+ getExecutions: workflowApi.getWorkflowExecutions,
3031
+ getExecution: workflowApi.getWorkflowExecution,
3032
+ listAccounts: workflowApi.getWorkflowAccounts,
3033
+ getAccountConnectUrl: workflowApi.getWorkflowAccountConnectUrl,
3034
+ connectAccount: workflowApi.connectWorkflowAccount,
3035
+ deleteAccount: workflowApi.deleteWorkflowAccount
3036
+ };
2685
3037
  const formApi = createFormApi(apiConfig);
2686
3038
  const taxonomyApi = createTaxonomyApi(apiConfig);
2687
3039
  const emailTemplateApi = createEmailTemplateApi(apiConfig);
2688
3040
  const analyticsApi = createAnalyticsApi(apiConfig);
3041
+ const experimentsApi = createExperimentsApi(apiConfig);
2689
3042
  const sdk = {
2690
- auth: authApi,
2691
- account: accountApi,
3043
+ account: {
3044
+ update: accountApi.updateAccount,
3045
+ delete: accountApi.deleteAccount,
3046
+ getMe: accountApi.getMe,
3047
+ search: accountApi.searchAccounts,
3048
+ auth: authApi
3049
+ },
2692
3050
  store: {
2693
- ...storeApi,
3051
+ create: storeApi.createStore,
3052
+ update: storeApi.updateStore,
3053
+ delete: storeApi.deleteStore,
3054
+ get: storeApi.getStore,
3055
+ find: storeApi.getStores,
3056
+ subscription: {
3057
+ getPlans: storeApi.getSubscriptionPlans,
3058
+ subscribe: storeApi.subscribe,
3059
+ createPortalSession: storeApi.createPortalSession
3060
+ },
3061
+ member: {
3062
+ add: storeApi.addMember,
3063
+ invite: storeApi.inviteUser,
3064
+ remove: storeApi.removeMember
3065
+ },
3066
+ buildHook: {
3067
+ list: storeApi.listBuildHooks,
3068
+ create: storeApi.createBuildHook,
3069
+ update: storeApi.updateBuildHook,
3070
+ delete: storeApi.deleteBuildHook
3071
+ },
3072
+ webhook: {
3073
+ test: storeApi.testWebhook,
3074
+ list: storeApi.listWebhooks,
3075
+ create: storeApi.createWebhook,
3076
+ update: storeApi.updateWebhook,
3077
+ delete: storeApi.deleteWebhook
3078
+ },
3079
+ config: {
3080
+ get: storeApi.getStoreConfig
3081
+ },
3082
+ media: {
3083
+ find: storeApi.getStoreMedia
3084
+ },
2694
3085
  location: locationApi,
2695
- market: marketApi
3086
+ market: marketApi,
3087
+ paymentProvider: storePaymentProviderApi
2696
3088
  },
2697
3089
  media: createMediaApi(apiConfig),
2698
- notification: createNotificationApi(apiConfig),
2699
- promoCode: promoCodeApi,
3090
+ notification: {
3091
+ email: {
3092
+ trackOpen: notificationApi.trackEmailOpen
3093
+ },
3094
+ trigger: {
3095
+ send: notificationApi.trigger
3096
+ },
3097
+ mailbox: crmApi.mailbox
3098
+ },
2700
3099
  platform: platformApi,
2701
- shipping: createShippingApi(apiConfig),
3100
+ social: {
3101
+ account: {
3102
+ getCapabilities: socialApi.getCapabilities,
3103
+ list: socialApi.listAccounts,
3104
+ connect: socialApi.connect,
3105
+ getOAuthAttempt: socialApi.getOAuthAttempt,
3106
+ selectDestination: socialApi.selectDestination,
3107
+ delete: socialApi.deleteAccount
3108
+ },
3109
+ publication: {
3110
+ create: socialApi.createPublication,
3111
+ update: socialApi.updatePublication,
3112
+ get: socialApi.getPublication,
3113
+ find: socialApi.findPublications,
3114
+ validate: socialApi.validatePublication,
3115
+ schedule: socialApi.schedulePublication,
3116
+ cancel: socialApi.cancelPublication,
3117
+ getComments: socialApi.getPublicationComments,
3118
+ syncComments: socialApi.syncPublicationComments,
3119
+ getCommentThread: socialApi.getPublicationCommentThread,
3120
+ syncCommentThread: socialApi.syncPublicationCommentThread,
3121
+ findComments: socialApi.findPublicationComments,
3122
+ classifyComments: socialApi.classifyPublicationComments,
3123
+ replyToComment: socialApi.replyToPublicationComment,
3124
+ getMetrics: socialApi.getPublicationMetrics,
3125
+ syncMetrics: socialApi.syncPublicationMetrics,
3126
+ syncEngagement: socialApi.syncEngagement
3127
+ }
3128
+ },
2702
3129
  cms: {
2703
- node: {
2704
- create: cmsApi.createNode,
2705
- update: cmsApi.updateNode,
2706
- delete: cmsApi.deleteNode,
2707
- get: cmsApi.getNode,
2708
- find: cmsApi.getNodes,
2709
- getChildren: cmsApi.getNodeChildren
3130
+ collection: {
3131
+ create: cmsApi.createCollection,
3132
+ update: cmsApi.updateCollection,
3133
+ delete: cmsApi.deleteCollection,
3134
+ get: cmsApi.getCollection,
3135
+ find: cmsApi.getCollections
3136
+ },
3137
+ entry: {
3138
+ create: cmsApi.createEntry,
3139
+ update: cmsApi.updateEntry,
3140
+ delete: cmsApi.deleteEntry,
3141
+ get: cmsApi.getEntry,
3142
+ find: cmsApi.getEntries
2710
3143
  },
2711
3144
  form: {
2712
3145
  create: formApi.createForm,
@@ -2749,7 +3182,11 @@ function createAdmin(config) {
2749
3182
  get: eshopApi.getOrder,
2750
3183
  find: eshopApi.getOrders,
2751
3184
  getQuote: eshopApi.getQuote,
2752
- processRefund: eshopApi.processRefund
3185
+ processRefund: eshopApi.processRefund,
3186
+ downloadDigitalAccess: eshopApi.downloadDigitalAccess,
3187
+ getShippingRates: shippingApi.getRates,
3188
+ ship: shippingApi.ship,
3189
+ refundShippingLabel: shippingApi.refundLabel
2753
3190
  },
2754
3191
  cart: {
2755
3192
  create: eshopApi.createCart,
@@ -2784,7 +3221,7 @@ function createAdmin(config) {
2784
3221
  promoCode: promoCodeApi
2785
3222
  },
2786
3223
  crm: {
2787
- profile: {
3224
+ contact: {
2788
3225
  create: crmApi.create,
2789
3226
  get: crmApi.get,
2790
3227
  find: crmApi.find,
@@ -2794,30 +3231,51 @@ function createAdmin(config) {
2794
3231
  revokeToken: crmApi.revokeToken,
2795
3232
  revokeAllTokens: crmApi.revokeAllTokens
2796
3233
  },
2797
- profileList: crmApi.profileList,
2798
- mailbox: crmApi.mailbox,
3234
+ contactList: {
3235
+ create: crmApi.contactList.create,
3236
+ update: crmApi.contactList.update,
3237
+ get: crmApi.contactList.get,
3238
+ find: crmApi.contactList.find,
3239
+ importContacts: crmApi.contactList.importContacts,
3240
+ previewImportContacts: crmApi.contactList.previewImportContacts,
3241
+ addMember: crmApi.contactList.members.add,
3242
+ updateMember: crmApi.contactList.members.update,
3243
+ removeMember: crmApi.contactList.members.remove,
3244
+ findMembers: crmApi.contactList.members.find
3245
+ },
3246
+ action: crmApi.action
3247
+ },
3248
+ outreach: {
2799
3249
  campaign: crmApi.campaign,
2800
- campaignRecipient: crmApi.campaignRecipient,
3250
+ campaignEnrollment: crmApi.campaignEnrollment,
2801
3251
  campaignMessage: crmApi.campaignMessage,
2802
3252
  suppression: crmApi.suppression,
2803
- leadResearch,
2804
- activity: crmApi.activity
3253
+ leadResearch: leadResearchApi
2805
3254
  },
2806
- leadResearch,
2807
3255
  automation: {
2808
- workflow: {
2809
- create: workflowApi.createWorkflow,
2810
- update: workflowApi.updateWorkflow,
2811
- delete: workflowApi.deleteWorkflow,
2812
- get: workflowApi.getWorkflow,
2813
- find: workflowApi.getWorkflows,
2814
- trigger: workflowApi.triggerWorkflow,
2815
- getExecutions: workflowApi.getWorkflowExecutions,
2816
- getExecution: workflowApi.getWorkflowExecution
2817
- },
2818
- support: supportApi
3256
+ workflow: workflowPublicApi,
3257
+ support: {
3258
+ createChannel: supportApi.channel.create,
3259
+ getChannel: supportApi.channel.get,
3260
+ findChannels: supportApi.channel.find,
3261
+ updateChannel: supportApi.channel.update,
3262
+ deleteChannel: supportApi.channel.delete,
3263
+ receiveChannelMessage: supportApi.channel.receiveMessage,
3264
+ createAgent: supportApi.agent.create,
3265
+ getAgent: supportApi.agent.get,
3266
+ findAgents: supportApi.agent.find,
3267
+ updateAgent: supportApi.agent.update,
3268
+ deleteAgent: supportApi.agent.delete,
3269
+ findConversations: supportApi.conversation.find,
3270
+ getConversation: supportApi.conversation.get,
3271
+ sendConversationMessage: supportApi.conversation.sendMessage,
3272
+ replyToConversation: supportApi.conversation.reply,
3273
+ resolveConversation: supportApi.conversation.resolve,
3274
+ assignConversation: supportApi.conversation.assign
3275
+ }
2819
3276
  },
2820
3277
  analytics: analyticsApi,
3278
+ experiments: experimentsApi,
2821
3279
  setStoreId: (storeId) => {
2822
3280
  apiConfig.storeId = storeId;
2823
3281
  },
@@ -2853,7 +3311,6 @@ function createAdmin(config) {
2853
3311
  if (config.apiToken) return;
2854
3312
  updateSession(() => null);
2855
3313
  },
2856
- extractBlockValues,
2857
3314
  utils: createUtilitySurface(apiConfig)
2858
3315
  };
2859
3316
  return sdk;