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