arky-sdk 0.9.0 → 0.9.11
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-BKXmDIVk.d.ts +1396 -0
- package/dist/admin-CAwQrMOX.d.cts +1396 -0
- package/dist/admin.cjs +1239 -455
- 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 +1239 -455
- package/dist/admin.js.map +1 -1
- package/dist/api-DJI3S6XA.d.cts +4204 -0
- package/dist/api-DJI3S6XA.d.ts +4204 -0
- package/dist/{index-C5gikdBg.d.cts → index-BaSBPLdF.d.ts} +1 -1
- package/dist/{index-MFMjlIfS.d.ts → index-u-gjHnKs.d.cts} +1 -1
- package/dist/index.cjs +1360 -610
- 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 +1360 -610
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +590 -382
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.d.cts +182 -156
- package/dist/storefront.d.ts +182 -156
- package/dist/storefront.js +588 -381
- package/dist/storefront.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -2666
- package/dist/types.d.ts +1 -2666
- package/dist/types.js.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +9 -11
- package/scripts/contract-admin.mjs +137 -0
- package/scripts/contract-storefront.mjs +296 -0
- package/dist/admin-CfHen7c5.d.cts +0 -1036
- package/dist/admin-ru7pX5bd.d.ts +0 -1036
- package/dist/storefront-store.cjs +0 -2794
- 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 -2792
- package/dist/storefront-store.js.map +0 -1
- package/scripts/smoke-store.mjs +0 -41
package/dist/index.cjs
CHANGED
|
@@ -7,132 +7,6 @@ var PaymentMethodType = /* @__PURE__ */ ((PaymentMethodType2) => {
|
|
|
7
7
|
return PaymentMethodType2;
|
|
8
8
|
})(PaymentMethodType || {});
|
|
9
9
|
|
|
10
|
-
// src/utils/blocks.ts
|
|
11
|
-
function getBlockLabel(block) {
|
|
12
|
-
if (!block) return "";
|
|
13
|
-
return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) ?? "";
|
|
14
|
-
}
|
|
15
|
-
function formatBlockValue(block) {
|
|
16
|
-
if (!block || block.value === null || block.value === void 0) return "";
|
|
17
|
-
const value = block.value;
|
|
18
|
-
switch (block.type) {
|
|
19
|
-
case "boolean":
|
|
20
|
-
return value ? "Yes" : "No";
|
|
21
|
-
case "number":
|
|
22
|
-
if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
|
|
23
|
-
return new Date(value).toLocaleDateString();
|
|
24
|
-
}
|
|
25
|
-
return String(value);
|
|
26
|
-
case "relationship_entry":
|
|
27
|
-
case "relationship_media":
|
|
28
|
-
if (value && typeof value === "object") {
|
|
29
|
-
return value.mime_type ? value.name || value.id : value.title || value.name || value.id;
|
|
30
|
-
}
|
|
31
|
-
return String(value);
|
|
32
|
-
default:
|
|
33
|
-
return String(value);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function prepareBlocksForSubmission(formData, blockTypes) {
|
|
37
|
-
return Object.keys(formData).filter((key) => formData[key] !== null && formData[key] !== void 0).map((key) => ({
|
|
38
|
-
key,
|
|
39
|
-
value: blockTypes?.[key] === "list" && !Array.isArray(formData[key]) ? [formData[key]] : formData[key]
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
function extractBlockValues(blocks) {
|
|
43
|
-
const values = {};
|
|
44
|
-
blocks.forEach((block) => {
|
|
45
|
-
values[block.key] = block.value ?? null;
|
|
46
|
-
});
|
|
47
|
-
return values;
|
|
48
|
-
}
|
|
49
|
-
var getBlockValue = (entry, blockKey) => {
|
|
50
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
51
|
-
return block?.value ?? null;
|
|
52
|
-
};
|
|
53
|
-
var getBlockTextValue = (block, locale = "en") => {
|
|
54
|
-
if (!block || block.value === null || block.value === void 0) return "";
|
|
55
|
-
if (block.type === "localized_text" || block.type === "markdown") {
|
|
56
|
-
if (typeof block.value === "object" && block.value !== null) {
|
|
57
|
-
return block.value[locale] ?? block.value["en"] ?? "";
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (typeof block.value === "string") return block.value;
|
|
61
|
-
return String(block.value ?? "");
|
|
62
|
-
};
|
|
63
|
-
var getBlockValues = (entry, blockKey) => {
|
|
64
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
65
|
-
if (!block) return [];
|
|
66
|
-
if (block.type === "list" && Array.isArray(block.value)) {
|
|
67
|
-
return block.value;
|
|
68
|
-
}
|
|
69
|
-
return [];
|
|
70
|
-
};
|
|
71
|
-
function unwrapBlock(block, locale) {
|
|
72
|
-
if (!block?.type || block.value === void 0) return block;
|
|
73
|
-
if (block.type === "list") {
|
|
74
|
-
return block.value.map((obj) => {
|
|
75
|
-
const parsed = {};
|
|
76
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
77
|
-
parsed[k] = unwrapBlock(v, locale);
|
|
78
|
-
}
|
|
79
|
-
return parsed;
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
if (block.type === "map") {
|
|
83
|
-
const parsed = {};
|
|
84
|
-
for (const [k, v] of Object.entries(block.value || {})) {
|
|
85
|
-
parsed[k] = unwrapBlock(v, locale);
|
|
86
|
-
}
|
|
87
|
-
return parsed;
|
|
88
|
-
}
|
|
89
|
-
if (block.type === "localized_text" || block.type === "markdown") {
|
|
90
|
-
return block.value?.[locale];
|
|
91
|
-
}
|
|
92
|
-
return block.value;
|
|
93
|
-
}
|
|
94
|
-
var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
95
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
96
|
-
if (!block || block.type !== "list" || !Array.isArray(block.value)) return [];
|
|
97
|
-
return block.value.map((obj) => {
|
|
98
|
-
if (!obj?.value || !Array.isArray(obj.value)) return {};
|
|
99
|
-
return obj.value.reduce((acc, current) => {
|
|
100
|
-
acc[current.key] = unwrapBlock(current, locale);
|
|
101
|
-
return acc;
|
|
102
|
-
}, {});
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
106
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
107
|
-
if (!block) return {};
|
|
108
|
-
if (block.type === "list" && Array.isArray(block.value)) {
|
|
109
|
-
return block.value.reduce((acc, current) => {
|
|
110
|
-
acc[current.key] = unwrapBlock(current, locale);
|
|
111
|
-
return acc;
|
|
112
|
-
}, {});
|
|
113
|
-
}
|
|
114
|
-
if (block.type === "map" && block.value && typeof block.value === "object") {
|
|
115
|
-
const result = {};
|
|
116
|
-
for (const [k, v] of Object.entries(block.value)) {
|
|
117
|
-
result[k] = unwrapBlock(v, locale);
|
|
118
|
-
}
|
|
119
|
-
return result;
|
|
120
|
-
}
|
|
121
|
-
return { [block.key]: unwrapBlock(block, locale) };
|
|
122
|
-
};
|
|
123
|
-
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
124
|
-
if (!imageBlock) return null;
|
|
125
|
-
if (imageBlock.type === "relationship_media") {
|
|
126
|
-
const mediaValue = imageBlock.value;
|
|
127
|
-
return mediaValue?.resolutions?.original?.url || mediaValue?.url || null;
|
|
128
|
-
}
|
|
129
|
-
if (isBlock) {
|
|
130
|
-
if (typeof imageBlock === "string") return imageBlock;
|
|
131
|
-
if (imageBlock.url) return imageBlock.url;
|
|
132
|
-
}
|
|
133
|
-
return imageBlock.resolutions?.original?.url || null;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
10
|
// src/utils/orderItems.ts
|
|
137
11
|
function normalizeOrderQuoteItems(items) {
|
|
138
12
|
return items.map((item) => {
|
|
@@ -164,36 +38,36 @@ function normalizePublicCheckoutItems(items) {
|
|
|
164
38
|
}
|
|
165
39
|
|
|
166
40
|
// src/api/storefront.ts
|
|
167
|
-
var
|
|
168
|
-
"
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
175
|
-
"
|
|
176
|
-
"order_created",
|
|
41
|
+
var COMMON_ACTION_KEYS = [
|
|
42
|
+
"page.view",
|
|
43
|
+
"product.view",
|
|
44
|
+
"service.view",
|
|
45
|
+
"provider.view",
|
|
46
|
+
"cart.added",
|
|
47
|
+
"cart.removed",
|
|
48
|
+
"checkout.started",
|
|
49
|
+
"order.created",
|
|
177
50
|
"signin",
|
|
178
51
|
"signup",
|
|
179
|
-
"
|
|
52
|
+
"verified.email",
|
|
180
53
|
"search",
|
|
181
54
|
"share",
|
|
182
|
-
"
|
|
55
|
+
"wishlist.added"
|
|
183
56
|
];
|
|
184
|
-
var
|
|
185
|
-
|
|
57
|
+
var createActionApi = (apiConfig) => ({
|
|
58
|
+
COMMON_ACTION_KEYS,
|
|
186
59
|
async track(params) {
|
|
187
60
|
try {
|
|
61
|
+
const key = "key" in params && params.key ? params.key : params.type;
|
|
188
62
|
await apiConfig.httpClient.post(
|
|
189
|
-
`/v1/storefront/${apiConfig.storeId}/
|
|
190
|
-
{
|
|
63
|
+
`/v1/storefront/${apiConfig.storeId}/actions/track`,
|
|
64
|
+
{ key, payload: params.payload }
|
|
191
65
|
);
|
|
192
66
|
} catch {
|
|
193
67
|
}
|
|
194
68
|
}
|
|
195
69
|
});
|
|
196
|
-
var createStorefrontApi = (apiConfig,
|
|
70
|
+
var createStorefrontApi = (apiConfig, updateContactSession) => {
|
|
197
71
|
const base = (storeId = apiConfig.storeId) => `/v1/storefront/${storeId}`;
|
|
198
72
|
return {
|
|
199
73
|
store: {
|
|
@@ -227,47 +101,32 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
|
|
|
227
101
|
}
|
|
228
102
|
},
|
|
229
103
|
cms: {
|
|
230
|
-
|
|
231
|
-
|
|
104
|
+
collection: {
|
|
105
|
+
get(params, options) {
|
|
232
106
|
const store_id = params.store_id || apiConfig.storeId;
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
identifier = params.id;
|
|
236
|
-
} else if (params.slug) {
|
|
237
|
-
identifier = `${store_id}:${apiConfig.locale}:${params.slug}`;
|
|
238
|
-
} else if (params.key) {
|
|
239
|
-
identifier = `${store_id}:${params.key}`;
|
|
240
|
-
} else {
|
|
241
|
-
throw new Error("GetNodeParams requires id, slug, or key");
|
|
107
|
+
if (!params.id) {
|
|
108
|
+
throw new Error("GetCollectionParams requires id");
|
|
242
109
|
}
|
|
243
|
-
|
|
244
|
-
`${base(store_id)}/
|
|
110
|
+
return apiConfig.httpClient.get(
|
|
111
|
+
`${base(store_id)}/collections/${params.id}`,
|
|
112
|
+
options
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
entry: {
|
|
117
|
+
get(params, options) {
|
|
118
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
119
|
+
if (!params.id) {
|
|
120
|
+
throw new Error("GetEntryParams requires id");
|
|
121
|
+
}
|
|
122
|
+
return apiConfig.httpClient.get(
|
|
123
|
+
`${base(store_id)}/entries/${params.id}`,
|
|
245
124
|
options
|
|
246
125
|
);
|
|
247
|
-
return {
|
|
248
|
-
...response,
|
|
249
|
-
getBlock(key) {
|
|
250
|
-
return getBlockFromArray(response, key, apiConfig.locale);
|
|
251
|
-
},
|
|
252
|
-
getBlockValues(key) {
|
|
253
|
-
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
254
|
-
},
|
|
255
|
-
getImage(key) {
|
|
256
|
-
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
257
|
-
return getImageUrl(block, true);
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
126
|
},
|
|
261
127
|
find(params, options) {
|
|
262
128
|
const { store_id, ...queryParams } = params;
|
|
263
|
-
return apiConfig.httpClient.get(`${base(store_id)}/
|
|
264
|
-
...options,
|
|
265
|
-
params: queryParams
|
|
266
|
-
});
|
|
267
|
-
},
|
|
268
|
-
getChildren(params, options) {
|
|
269
|
-
const { id, store_id, ...queryParams } = params;
|
|
270
|
-
return apiConfig.httpClient.get(`${base(store_id)}/nodes/${id}/children`, {
|
|
129
|
+
return apiConfig.httpClient.get(`${base(store_id)}/entries`, {
|
|
271
130
|
...options,
|
|
272
131
|
params: queryParams
|
|
273
132
|
});
|
|
@@ -427,7 +286,9 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
|
|
|
427
286
|
{
|
|
428
287
|
id: params.id,
|
|
429
288
|
store_id,
|
|
430
|
-
|
|
289
|
+
payment_method_key: params.payment_method_key,
|
|
290
|
+
confirmation_token_id: params.confirmation_token_id,
|
|
291
|
+
return_url: params.return_url
|
|
431
292
|
},
|
|
432
293
|
options
|
|
433
294
|
);
|
|
@@ -447,6 +308,14 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
|
|
|
447
308
|
...options,
|
|
448
309
|
params: queryParams
|
|
449
310
|
});
|
|
311
|
+
},
|
|
312
|
+
downloadDigitalAccess(params, options) {
|
|
313
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
314
|
+
return apiConfig.httpClient.post(
|
|
315
|
+
`${base(store_id)}/orders/${params.id}/digital-access/${params.grant_id}/download`,
|
|
316
|
+
{},
|
|
317
|
+
options
|
|
318
|
+
);
|
|
450
319
|
}
|
|
451
320
|
},
|
|
452
321
|
service: {
|
|
@@ -514,11 +383,11 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
|
|
|
514
383
|
}
|
|
515
384
|
},
|
|
516
385
|
crm: {
|
|
517
|
-
|
|
386
|
+
contact: {
|
|
518
387
|
async identify(params, options) {
|
|
519
388
|
const store_id = apiConfig.storeId;
|
|
520
389
|
const result = await apiConfig.httpClient.post(
|
|
521
|
-
`${base(store_id)}/
|
|
390
|
+
`${base(store_id)}/account/identify`,
|
|
522
391
|
{
|
|
523
392
|
store_id,
|
|
524
393
|
market: params?.market || apiConfig.market || null,
|
|
@@ -528,9 +397,9 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
|
|
|
528
397
|
options
|
|
529
398
|
);
|
|
530
399
|
if (result?.token?.token) {
|
|
531
|
-
|
|
400
|
+
updateContactSession(() => ({
|
|
532
401
|
access_token: result.token.token,
|
|
533
|
-
|
|
402
|
+
contact: result.contact,
|
|
534
403
|
store: result.store,
|
|
535
404
|
market: result.market
|
|
536
405
|
}));
|
|
@@ -540,12 +409,12 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
|
|
|
540
409
|
async verify(params, options) {
|
|
541
410
|
const store_id = apiConfig.storeId;
|
|
542
411
|
const result = await apiConfig.httpClient.post(
|
|
543
|
-
`${base(store_id)}/
|
|
412
|
+
`${base(store_id)}/account/verify`,
|
|
544
413
|
{ store_id, code: params.code },
|
|
545
414
|
options
|
|
546
415
|
);
|
|
547
416
|
if (result?.token) {
|
|
548
|
-
|
|
417
|
+
updateContactSession(
|
|
549
418
|
(prev) => prev ? { ...prev, access_token: result.token } : null
|
|
550
419
|
);
|
|
551
420
|
}
|
|
@@ -555,131 +424,74 @@ var createStorefrontApi = (apiConfig, updateCustomerSession) => {
|
|
|
555
424
|
const store_id = apiConfig.storeId;
|
|
556
425
|
try {
|
|
557
426
|
await apiConfig.httpClient.post(
|
|
558
|
-
`${base(store_id)}/
|
|
427
|
+
`${base(store_id)}/account/logout`,
|
|
559
428
|
{},
|
|
560
429
|
options
|
|
561
430
|
);
|
|
562
431
|
} finally {
|
|
563
|
-
|
|
432
|
+
updateContactSession(() => null);
|
|
564
433
|
}
|
|
565
434
|
},
|
|
566
435
|
getMe(options) {
|
|
567
|
-
return apiConfig.httpClient.get(`${base()}/
|
|
436
|
+
return apiConfig.httpClient.get(`${base()}/account/me`, options);
|
|
568
437
|
}
|
|
569
438
|
},
|
|
570
|
-
|
|
439
|
+
contactList: {
|
|
571
440
|
get(params, options) {
|
|
572
|
-
|
|
573
|
-
if (params.id) {
|
|
574
|
-
identifier = params.id;
|
|
575
|
-
} else if (params.key) {
|
|
576
|
-
identifier = `${apiConfig.storeId}:${params.key}`;
|
|
577
|
-
} else {
|
|
578
|
-
throw new Error("GetAudienceParams requires id or key");
|
|
579
|
-
}
|
|
441
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
580
442
|
return apiConfig.httpClient.get(
|
|
581
|
-
`${base(
|
|
443
|
+
`${base(store_id)}/contact-lists/${params.id}`,
|
|
582
444
|
options
|
|
583
445
|
);
|
|
584
446
|
},
|
|
585
447
|
find(params, options) {
|
|
586
|
-
|
|
448
|
+
const { store_id, ...queryParams } = params || {};
|
|
449
|
+
return apiConfig.httpClient.get(`${base(store_id)}/contact-lists`, {
|
|
587
450
|
...options,
|
|
588
|
-
params
|
|
451
|
+
params: queryParams
|
|
589
452
|
});
|
|
590
453
|
},
|
|
591
454
|
subscribe(params, options) {
|
|
455
|
+
const { store_id, id, ...payload } = params;
|
|
592
456
|
return apiConfig.httpClient.post(
|
|
593
|
-
`${base()}/
|
|
594
|
-
|
|
595
|
-
customer_id: params.customer_id,
|
|
596
|
-
price_id: params.price_id,
|
|
597
|
-
success_url: params.success_url,
|
|
598
|
-
cancel_url: params.cancel_url,
|
|
599
|
-
confirm_url: params.confirm_url
|
|
600
|
-
},
|
|
457
|
+
`${base(store_id)}/contact-lists/${id}/subscribe`,
|
|
458
|
+
payload,
|
|
601
459
|
options
|
|
602
460
|
);
|
|
603
461
|
},
|
|
604
462
|
checkAccess(params, options) {
|
|
605
|
-
return apiConfig.httpClient.get(
|
|
606
|
-
`${base()}/audiences/${params.id}/access`,
|
|
607
|
-
options
|
|
608
|
-
);
|
|
609
|
-
},
|
|
610
|
-
unsubscribe(token, options) {
|
|
611
|
-
return apiConfig.httpClient.get(`${base()}/audiences/unsubscribe`, {
|
|
612
|
-
...options,
|
|
613
|
-
params: { token }
|
|
614
|
-
});
|
|
615
|
-
},
|
|
616
|
-
confirm(token, options) {
|
|
617
|
-
return apiConfig.httpClient.get(`${base()}/audiences/confirm`, {
|
|
618
|
-
...options,
|
|
619
|
-
params: { token }
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
},
|
|
624
|
-
activity: createActivityApi(apiConfig),
|
|
625
|
-
automation: {
|
|
626
|
-
agent: {
|
|
627
|
-
getAgents(params, options) {
|
|
628
|
-
const store_id = params?.store_id || apiConfig.storeId;
|
|
629
|
-
const queryParams = { ...params || {} };
|
|
630
|
-
delete queryParams.store_id;
|
|
631
|
-
return apiConfig.httpClient.get(`${base(store_id)}/agents`, {
|
|
632
|
-
...options,
|
|
633
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
634
|
-
});
|
|
635
|
-
},
|
|
636
|
-
getAgent(params, options) {
|
|
637
463
|
const store_id = params.store_id || apiConfig.storeId;
|
|
638
464
|
return apiConfig.httpClient.get(
|
|
639
|
-
`${base(store_id)}/
|
|
465
|
+
`${base(store_id)}/contact-lists/${params.id}/access`,
|
|
640
466
|
options
|
|
641
467
|
);
|
|
642
468
|
},
|
|
643
|
-
|
|
644
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
645
|
-
const body = { message: params.message };
|
|
646
|
-
if (params.chat_id) body.chat_id = params.chat_id;
|
|
469
|
+
unsubscribe(token, options) {
|
|
647
470
|
return apiConfig.httpClient.post(
|
|
648
|
-
`${base(
|
|
649
|
-
|
|
471
|
+
`${base()}/contact-lists/unsubscribe`,
|
|
472
|
+
{ token },
|
|
650
473
|
options
|
|
651
474
|
);
|
|
652
475
|
},
|
|
653
|
-
|
|
654
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
655
|
-
return apiConfig.httpClient.get(
|
|
656
|
-
`${base(store_id)}/agents/${params.id}/chats/${params.chat_id}`,
|
|
657
|
-
options
|
|
658
|
-
);
|
|
659
|
-
},
|
|
660
|
-
getChatMessages(params, options) {
|
|
661
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
662
|
-
const queryParams = {};
|
|
663
|
-
if (params.limit) queryParams.limit = String(params.limit);
|
|
664
|
-
return apiConfig.httpClient.get(
|
|
665
|
-
`${base(store_id)}/agents/${params.id}/chats/${params.chat_id}/messages`,
|
|
666
|
-
{
|
|
667
|
-
...options,
|
|
668
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
669
|
-
}
|
|
670
|
-
);
|
|
671
|
-
},
|
|
672
|
-
rateChat(params, options) {
|
|
673
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
674
|
-
const body = { rating: params.rating };
|
|
675
|
-
if (params.comment) body.comment = params.comment;
|
|
476
|
+
confirm(token, options) {
|
|
676
477
|
return apiConfig.httpClient.post(
|
|
677
|
-
`${base(
|
|
678
|
-
|
|
478
|
+
`${base()}/contact-lists/confirm`,
|
|
479
|
+
{ token },
|
|
679
480
|
options
|
|
680
481
|
);
|
|
681
482
|
}
|
|
682
483
|
}
|
|
484
|
+
},
|
|
485
|
+
action: createActionApi(apiConfig),
|
|
486
|
+
experiments: {
|
|
487
|
+
use(params, options) {
|
|
488
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
489
|
+
return apiConfig.httpClient.post(
|
|
490
|
+
`${base(store_id)}/experiments/use`,
|
|
491
|
+
{ key: params.key },
|
|
492
|
+
options
|
|
493
|
+
);
|
|
494
|
+
}
|
|
683
495
|
}
|
|
684
496
|
};
|
|
685
497
|
};
|
|
@@ -905,7 +717,7 @@ function createHttpClient(cfg) {
|
|
|
905
717
|
headers["Authorization"] = `Bearer ${tokens.access_token}`;
|
|
906
718
|
}
|
|
907
719
|
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
908
|
-
const fetchOpts = { method, headers };
|
|
720
|
+
const fetchOpts = { method, headers, signal: options?.signal };
|
|
909
721
|
if (!["GET", "DELETE"].includes(method) && body !== void 0) {
|
|
910
722
|
fetchOpts.body = JSON.stringify(body);
|
|
911
723
|
}
|
|
@@ -916,13 +728,15 @@ function createHttpClient(cfg) {
|
|
|
916
728
|
try {
|
|
917
729
|
res = await fetch(fullUrl, fetchOpts);
|
|
918
730
|
} catch (error) {
|
|
731
|
+
const aborted = options?.signal?.aborted || error instanceof Error && error.name === "AbortError";
|
|
919
732
|
const err = new Error(error instanceof Error ? error.message : "Network request failed");
|
|
920
|
-
err.name = "NetworkError";
|
|
733
|
+
err.name = aborted ? "AbortError" : "NetworkError";
|
|
921
734
|
err.method = method;
|
|
922
735
|
err.url = fullUrl;
|
|
736
|
+
err.aborted = aborted;
|
|
923
737
|
if (options?.onError && method !== "GET") {
|
|
924
738
|
Promise.resolve(
|
|
925
|
-
options.onError({ error: err, method, url: fullUrl, aborted
|
|
739
|
+
options.onError({ error: err, method, url: fullUrl, aborted })
|
|
926
740
|
).catch(() => {
|
|
927
741
|
});
|
|
928
742
|
}
|
|
@@ -1085,15 +899,12 @@ var createAuthApi = (apiConfig, updateSession) => {
|
|
|
1085
899
|
applyAuthToken(result, params.email);
|
|
1086
900
|
}
|
|
1087
901
|
return result;
|
|
1088
|
-
},
|
|
1089
|
-
async magicLink(params, options) {
|
|
1090
|
-
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
1091
902
|
}
|
|
1092
903
|
};
|
|
1093
904
|
};
|
|
1094
905
|
|
|
1095
906
|
// src/api/store.ts
|
|
1096
|
-
var createStoreApi = (apiConfig,
|
|
907
|
+
var createStoreApi = (apiConfig, _updateSession) => {
|
|
1097
908
|
return {
|
|
1098
909
|
async createStore(params, options) {
|
|
1099
910
|
return apiConfig.httpClient.post(`/v1/stores`, params, options);
|
|
@@ -1124,14 +935,17 @@ var createStoreApi = (apiConfig, updateSession) => {
|
|
|
1124
935
|
});
|
|
1125
936
|
},
|
|
1126
937
|
async getSubscriptionPlans(_params, options) {
|
|
1127
|
-
return apiConfig.httpClient.get(
|
|
938
|
+
return apiConfig.httpClient.get(
|
|
939
|
+
"/v1/stores/plans",
|
|
940
|
+
options
|
|
941
|
+
);
|
|
1128
942
|
},
|
|
1129
943
|
async subscribe(params, options) {
|
|
1130
|
-
const { store_id, plan_id, success_url, cancel_url } = params;
|
|
944
|
+
const { store_id, plan_id, action, success_url, cancel_url } = params;
|
|
1131
945
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1132
946
|
return apiConfig.httpClient.put(
|
|
1133
947
|
`/v1/stores/${target_store_id}/subscribe`,
|
|
1134
|
-
{ plan_id, success_url, cancel_url },
|
|
948
|
+
{ plan_id, action, success_url, cancel_url },
|
|
1135
949
|
options
|
|
1136
950
|
);
|
|
1137
951
|
},
|
|
@@ -1143,10 +957,19 @@ var createStoreApi = (apiConfig, updateSession) => {
|
|
|
1143
957
|
options
|
|
1144
958
|
);
|
|
1145
959
|
},
|
|
960
|
+
async addMember(params, options) {
|
|
961
|
+
const { store_id, ...payload } = params;
|
|
962
|
+
return apiConfig.httpClient.post(
|
|
963
|
+
`/v1/stores/${store_id || apiConfig.storeId}/members`,
|
|
964
|
+
payload,
|
|
965
|
+
options
|
|
966
|
+
);
|
|
967
|
+
},
|
|
1146
968
|
async inviteUser(params, options) {
|
|
969
|
+
const { store_id, ...payload } = params;
|
|
1147
970
|
return apiConfig.httpClient.post(
|
|
1148
|
-
`/v1/stores/${apiConfig.storeId}/
|
|
1149
|
-
|
|
971
|
+
`/v1/stores/${store_id || apiConfig.storeId}/members`,
|
|
972
|
+
payload,
|
|
1150
973
|
options
|
|
1151
974
|
);
|
|
1152
975
|
},
|
|
@@ -1156,22 +979,6 @@ var createStoreApi = (apiConfig, updateSession) => {
|
|
|
1156
979
|
options
|
|
1157
980
|
);
|
|
1158
981
|
},
|
|
1159
|
-
async handleInvitation(params, options) {
|
|
1160
|
-
const { store_id, ...payload } = params;
|
|
1161
|
-
const result = await apiConfig.httpClient.put(
|
|
1162
|
-
`/v1/stores/${store_id || apiConfig.storeId}/invitation`,
|
|
1163
|
-
payload,
|
|
1164
|
-
options
|
|
1165
|
-
);
|
|
1166
|
-
if (params.action === "accept" && result?.auth?.access_token) {
|
|
1167
|
-
updateSession(() => ({
|
|
1168
|
-
access_token: result.auth.access_token,
|
|
1169
|
-
refresh_token: result.auth.refresh_token,
|
|
1170
|
-
access_expires_at: result.auth.access_expires_at
|
|
1171
|
-
}));
|
|
1172
|
-
}
|
|
1173
|
-
return result;
|
|
1174
|
-
},
|
|
1175
982
|
async testWebhook(params, options) {
|
|
1176
983
|
return apiConfig.httpClient.post(
|
|
1177
984
|
`/v1/stores/${apiConfig.storeId}/webhooks/test`,
|
|
@@ -1184,61 +991,52 @@ var createStoreApi = (apiConfig, updateSession) => {
|
|
|
1184
991
|
limit: params.limit
|
|
1185
992
|
};
|
|
1186
993
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1187
|
-
if (params.ids && params.ids.length > 0)
|
|
994
|
+
if (params.ids && params.ids.length > 0)
|
|
995
|
+
queryParams.ids = JSON.stringify(params.ids);
|
|
1188
996
|
if (params.query) queryParams.query = params.query;
|
|
1189
997
|
if (params.mime_type) queryParams.mime_type = params.mime_type;
|
|
1190
998
|
if (params.sort_field) queryParams.sort_field = params.sort_field;
|
|
1191
|
-
if (params.sort_direction)
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
params
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
`/v1/stores/${params.store_id}/oauth/connect`,
|
|
1200
|
-
{ provider: params.provider, code: params.code, redirect_uri: params.redirect_uri },
|
|
1201
|
-
options
|
|
1202
|
-
);
|
|
1203
|
-
},
|
|
1204
|
-
async oauthDisconnect(params, options) {
|
|
1205
|
-
return apiConfig.httpClient.post(
|
|
1206
|
-
`/v1/stores/${params.store_id}/oauth/disconnect`,
|
|
1207
|
-
{ provider: params.provider },
|
|
1208
|
-
options
|
|
999
|
+
if (params.sort_direction)
|
|
1000
|
+
queryParams.sort_direction = params.sort_direction;
|
|
1001
|
+
return apiConfig.httpClient.get(
|
|
1002
|
+
`/v1/stores/${params.id}/media`,
|
|
1003
|
+
{
|
|
1004
|
+
...options,
|
|
1005
|
+
params: queryParams
|
|
1006
|
+
}
|
|
1209
1007
|
);
|
|
1210
1008
|
},
|
|
1211
|
-
async
|
|
1009
|
+
async listBuildHooks(params, options) {
|
|
1212
1010
|
return apiConfig.httpClient.get(
|
|
1213
|
-
`/v1/stores/${params.store_id}/
|
|
1011
|
+
`/v1/stores/${params.store_id}/build-hooks`,
|
|
1214
1012
|
options
|
|
1215
1013
|
);
|
|
1216
1014
|
},
|
|
1217
|
-
async
|
|
1015
|
+
async createBuildHook(params, options) {
|
|
1218
1016
|
const { store_id, ...payload } = params;
|
|
1219
1017
|
return apiConfig.httpClient.post(
|
|
1220
|
-
`/v1/stores/${store_id}/
|
|
1018
|
+
`/v1/stores/${store_id}/build-hooks`,
|
|
1221
1019
|
payload,
|
|
1222
1020
|
options
|
|
1223
1021
|
);
|
|
1224
1022
|
},
|
|
1225
|
-
async
|
|
1023
|
+
async updateBuildHook(params, options) {
|
|
1226
1024
|
const { store_id, id, ...payload } = params;
|
|
1227
1025
|
return apiConfig.httpClient.put(
|
|
1228
|
-
`/v1/stores/${store_id}/
|
|
1026
|
+
`/v1/stores/${store_id}/build-hooks/${id}`,
|
|
1229
1027
|
payload,
|
|
1230
1028
|
options
|
|
1231
1029
|
);
|
|
1232
1030
|
},
|
|
1233
|
-
async
|
|
1031
|
+
async deleteBuildHook(params, options) {
|
|
1234
1032
|
return apiConfig.httpClient.delete(
|
|
1235
|
-
`/v1/stores/${params.store_id}/
|
|
1033
|
+
`/v1/stores/${params.store_id}/build-hooks/${params.id}`,
|
|
1236
1034
|
options
|
|
1237
1035
|
);
|
|
1238
1036
|
},
|
|
1239
|
-
async
|
|
1037
|
+
async getStoreConfig(params, options) {
|
|
1240
1038
|
return apiConfig.httpClient.get(
|
|
1241
|
-
`/v1/stores/${params.store_id}/
|
|
1039
|
+
`/v1/stores/${params.store_id}/config/${params.type}`,
|
|
1242
1040
|
options
|
|
1243
1041
|
);
|
|
1244
1042
|
},
|
|
@@ -1283,7 +1081,7 @@ var createMediaApi = (apiConfig) => {
|
|
|
1283
1081
|
options
|
|
1284
1082
|
);
|
|
1285
1083
|
},
|
|
1286
|
-
async uploadStoreMedia(params,
|
|
1084
|
+
async uploadStoreMedia(params, options) {
|
|
1287
1085
|
const { store_id, files = [], urls = [] } = params;
|
|
1288
1086
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1289
1087
|
const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
|
|
@@ -1296,7 +1094,8 @@ var createMediaApi = (apiConfig) => {
|
|
|
1296
1094
|
body: formData,
|
|
1297
1095
|
headers: {
|
|
1298
1096
|
Authorization: `Bearer ${tokens?.access_token || ""}`
|
|
1299
|
-
}
|
|
1097
|
+
},
|
|
1098
|
+
signal: options?.signal
|
|
1300
1099
|
});
|
|
1301
1100
|
if (!response.ok) {
|
|
1302
1101
|
throw new Error("Upload failed, server said no");
|
|
@@ -1310,13 +1109,13 @@ var createMediaApi = (apiConfig) => {
|
|
|
1310
1109
|
options
|
|
1311
1110
|
);
|
|
1312
1111
|
},
|
|
1313
|
-
async getStoreMedia(params,
|
|
1112
|
+
async getStoreMedia(params, options) {
|
|
1314
1113
|
const { store_id, cursor, limit, ids, query, mime_type, sort_field, sort_direction } = params;
|
|
1315
1114
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1316
1115
|
const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
|
|
1317
1116
|
const queryParams = { limit: String(limit) };
|
|
1318
1117
|
if (cursor) queryParams.cursor = cursor;
|
|
1319
|
-
if (ids && ids.length > 0) queryParams.ids =
|
|
1118
|
+
if (ids && ids.length > 0) queryParams.ids = JSON.stringify(ids);
|
|
1320
1119
|
if (query) queryParams.query = query;
|
|
1321
1120
|
if (mime_type) queryParams.mime_type = mime_type;
|
|
1322
1121
|
if (sort_field) queryParams.sort_field = sort_field;
|
|
@@ -1326,7 +1125,8 @@ var createMediaApi = (apiConfig) => {
|
|
|
1326
1125
|
const response = await fetch(`${url}?${queryString}`, {
|
|
1327
1126
|
headers: {
|
|
1328
1127
|
Authorization: `Bearer ${tokens?.access_token || ""}`
|
|
1329
|
-
}
|
|
1128
|
+
},
|
|
1129
|
+
signal: options?.signal
|
|
1330
1130
|
});
|
|
1331
1131
|
if (!response.ok) {
|
|
1332
1132
|
const errorData = await response.json().catch(() => null);
|
|
@@ -1414,94 +1214,107 @@ var createPromoCodeApi = (apiConfig) => {
|
|
|
1414
1214
|
// src/api/cms.ts
|
|
1415
1215
|
var createCmsApi = (apiConfig) => {
|
|
1416
1216
|
return {
|
|
1417
|
-
async
|
|
1217
|
+
async createCollection(params, options) {
|
|
1418
1218
|
const { store_id, ...payload } = params;
|
|
1419
1219
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1420
1220
|
return apiConfig.httpClient.post(
|
|
1421
|
-
`/v1/stores/${target_store_id}/
|
|
1221
|
+
`/v1/stores/${target_store_id}/collections`,
|
|
1422
1222
|
payload,
|
|
1423
1223
|
options
|
|
1424
1224
|
);
|
|
1425
1225
|
},
|
|
1426
|
-
async
|
|
1226
|
+
async updateCollection(params, options) {
|
|
1427
1227
|
const { store_id, ...payload } = params;
|
|
1428
1228
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1429
1229
|
return apiConfig.httpClient.put(
|
|
1430
|
-
`/v1/stores/${target_store_id}/
|
|
1230
|
+
`/v1/stores/${target_store_id}/collections/${params.id}`,
|
|
1431
1231
|
payload,
|
|
1432
1232
|
options
|
|
1433
1233
|
);
|
|
1434
1234
|
},
|
|
1435
|
-
async
|
|
1235
|
+
async deleteCollection(params, options) {
|
|
1436
1236
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1437
1237
|
return apiConfig.httpClient.delete(
|
|
1438
|
-
`/v1/stores/${target_store_id}/
|
|
1238
|
+
`/v1/stores/${target_store_id}/collections/${params.id}`,
|
|
1439
1239
|
options
|
|
1440
1240
|
);
|
|
1441
1241
|
},
|
|
1442
|
-
async
|
|
1242
|
+
async getCollection(params, options) {
|
|
1443
1243
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1444
1244
|
let identifier;
|
|
1445
1245
|
if (params.id) {
|
|
1446
1246
|
identifier = params.id;
|
|
1447
|
-
} else if (params.slug) {
|
|
1448
|
-
identifier = `${target_store_id}:${apiConfig.locale}:${params.slug}`;
|
|
1449
1247
|
} else if (params.key) {
|
|
1450
1248
|
identifier = `${target_store_id}:${params.key}`;
|
|
1451
1249
|
} else {
|
|
1452
|
-
throw new Error("
|
|
1250
|
+
throw new Error("GetCollectionParams requires id or key");
|
|
1453
1251
|
}
|
|
1454
|
-
|
|
1455
|
-
`/v1/stores/${target_store_id}/
|
|
1252
|
+
return apiConfig.httpClient.get(
|
|
1253
|
+
`/v1/stores/${target_store_id}/collections/${identifier}`,
|
|
1456
1254
|
options
|
|
1457
1255
|
);
|
|
1458
|
-
return {
|
|
1459
|
-
...response,
|
|
1460
|
-
getBlock(key) {
|
|
1461
|
-
return getBlockFromArray(response, key, apiConfig.locale);
|
|
1462
|
-
},
|
|
1463
|
-
getBlockValues(key) {
|
|
1464
|
-
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
1465
|
-
},
|
|
1466
|
-
getImage(key) {
|
|
1467
|
-
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
1468
|
-
return getImageUrl(block, true);
|
|
1469
|
-
}
|
|
1470
|
-
};
|
|
1471
1256
|
},
|
|
1472
|
-
async
|
|
1257
|
+
async getCollections(params = {}, options) {
|
|
1473
1258
|
const { store_id, ...queryParams } = params;
|
|
1474
1259
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1475
1260
|
return apiConfig.httpClient.get(
|
|
1476
|
-
`/v1/stores/${target_store_id}/
|
|
1261
|
+
`/v1/stores/${target_store_id}/collections`,
|
|
1477
1262
|
{
|
|
1478
1263
|
...options,
|
|
1479
1264
|
params: queryParams
|
|
1480
1265
|
}
|
|
1481
1266
|
);
|
|
1482
1267
|
},
|
|
1483
|
-
async
|
|
1484
|
-
const {
|
|
1268
|
+
async createEntry(params, options) {
|
|
1269
|
+
const { store_id, ...payload } = params;
|
|
1485
1270
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1486
|
-
return apiConfig.httpClient.
|
|
1487
|
-
`/v1/stores/${target_store_id}/
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
params: queryParams
|
|
1491
|
-
}
|
|
1271
|
+
return apiConfig.httpClient.post(
|
|
1272
|
+
`/v1/stores/${target_store_id}/entries`,
|
|
1273
|
+
payload,
|
|
1274
|
+
options
|
|
1492
1275
|
);
|
|
1493
|
-
}
|
|
1494
|
-
|
|
1495
|
-
};
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1276
|
+
},
|
|
1277
|
+
async updateEntry(params, options) {
|
|
1278
|
+
const { store_id, ...payload } = params;
|
|
1279
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1280
|
+
return apiConfig.httpClient.put(
|
|
1281
|
+
`/v1/stores/${target_store_id}/entries/${params.id}`,
|
|
1282
|
+
payload,
|
|
1283
|
+
options
|
|
1284
|
+
);
|
|
1285
|
+
},
|
|
1286
|
+
async deleteEntry(params, options) {
|
|
1287
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1288
|
+
return apiConfig.httpClient.delete(
|
|
1289
|
+
`/v1/stores/${target_store_id}/entries/${params.id}`,
|
|
1290
|
+
options
|
|
1291
|
+
);
|
|
1292
|
+
},
|
|
1293
|
+
async getEntry(params, options) {
|
|
1294
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1295
|
+
if (!params.id) {
|
|
1296
|
+
throw new Error("GetEntryParams requires id");
|
|
1297
|
+
}
|
|
1298
|
+
return apiConfig.httpClient.get(
|
|
1299
|
+
`/v1/stores/${target_store_id}/entries/${params.id}`,
|
|
1300
|
+
options
|
|
1301
|
+
);
|
|
1302
|
+
},
|
|
1303
|
+
async getEntries(params, options) {
|
|
1304
|
+
const { store_id, ...queryParams } = params;
|
|
1305
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1306
|
+
return apiConfig.httpClient.get(
|
|
1307
|
+
`/v1/stores/${target_store_id}/entries`,
|
|
1308
|
+
{
|
|
1309
|
+
...options,
|
|
1310
|
+
params: queryParams
|
|
1311
|
+
}
|
|
1312
|
+
);
|
|
1313
|
+
}
|
|
1503
1314
|
};
|
|
1504
1315
|
};
|
|
1316
|
+
|
|
1317
|
+
// src/api/eshop.ts
|
|
1505
1318
|
var createEshopApi = (apiConfig) => {
|
|
1506
1319
|
return {
|
|
1507
1320
|
async createProduct(params, options) {
|
|
@@ -1509,7 +1322,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1509
1322
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1510
1323
|
return apiConfig.httpClient.post(
|
|
1511
1324
|
`/v1/stores/${target_store_id}/products`,
|
|
1512
|
-
|
|
1325
|
+
payload,
|
|
1513
1326
|
options
|
|
1514
1327
|
);
|
|
1515
1328
|
},
|
|
@@ -1518,7 +1331,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1518
1331
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1519
1332
|
return apiConfig.httpClient.put(
|
|
1520
1333
|
`/v1/stores/${target_store_id}/products/${params.id}`,
|
|
1521
|
-
|
|
1334
|
+
payload,
|
|
1522
1335
|
options
|
|
1523
1336
|
);
|
|
1524
1337
|
},
|
|
@@ -1560,7 +1373,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1560
1373
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1561
1374
|
return apiConfig.httpClient.post(
|
|
1562
1375
|
`/v1/stores/${target_store_id}/services`,
|
|
1563
|
-
|
|
1376
|
+
payload,
|
|
1564
1377
|
options
|
|
1565
1378
|
);
|
|
1566
1379
|
},
|
|
@@ -1569,7 +1382,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1569
1382
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1570
1383
|
return apiConfig.httpClient.put(
|
|
1571
1384
|
`/v1/stores/${target_store_id}/services/${params.id}`,
|
|
1572
|
-
|
|
1385
|
+
payload,
|
|
1573
1386
|
options
|
|
1574
1387
|
);
|
|
1575
1388
|
},
|
|
@@ -1619,7 +1432,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1619
1432
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1620
1433
|
return apiConfig.httpClient.post(
|
|
1621
1434
|
`/v1/stores/${target_store_id}/providers`,
|
|
1622
|
-
|
|
1435
|
+
payload,
|
|
1623
1436
|
options
|
|
1624
1437
|
);
|
|
1625
1438
|
},
|
|
@@ -1628,7 +1441,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1628
1441
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1629
1442
|
return apiConfig.httpClient.put(
|
|
1630
1443
|
`/v1/stores/${target_store_id}/providers/${params.id}`,
|
|
1631
|
-
|
|
1444
|
+
payload,
|
|
1632
1445
|
options
|
|
1633
1446
|
);
|
|
1634
1447
|
},
|
|
@@ -1843,6 +1656,14 @@ var createEshopApi = (apiConfig) => {
|
|
|
1843
1656
|
{ amount: params.amount },
|
|
1844
1657
|
options
|
|
1845
1658
|
);
|
|
1659
|
+
},
|
|
1660
|
+
async downloadDigitalAccess(params, options) {
|
|
1661
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1662
|
+
return apiConfig.httpClient.post(
|
|
1663
|
+
`/v1/stores/${target_store_id}/orders/${params.id}/digital-access/${params.grant_id}/download`,
|
|
1664
|
+
{},
|
|
1665
|
+
options
|
|
1666
|
+
);
|
|
1846
1667
|
}
|
|
1847
1668
|
};
|
|
1848
1669
|
};
|
|
@@ -1933,72 +1754,84 @@ var createMarketApi = (apiConfig) => {
|
|
|
1933
1754
|
};
|
|
1934
1755
|
|
|
1935
1756
|
// src/api/crm.ts
|
|
1936
|
-
var
|
|
1757
|
+
var createActionAdminApi = (apiConfig) => ({
|
|
1937
1758
|
async timeline(params, options) {
|
|
1938
1759
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1939
|
-
const queryParams = {
|
|
1760
|
+
const queryParams = { contact_id: params.contact_id };
|
|
1940
1761
|
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1941
1762
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1942
1763
|
return apiConfig.httpClient.get(
|
|
1943
|
-
`/v1/stores/${store_id}/
|
|
1764
|
+
`/v1/stores/${store_id}/contacts/${params.contact_id}/actions`,
|
|
1944
1765
|
{ ...options, params: queryParams }
|
|
1945
1766
|
);
|
|
1946
1767
|
},
|
|
1947
1768
|
async find(params, options) {
|
|
1948
1769
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1949
1770
|
const queryParams = {};
|
|
1950
|
-
if (params.
|
|
1771
|
+
if (params.query) queryParams.query = params.query;
|
|
1772
|
+
if (params.contact_id) queryParams.contact_id = params.contact_id;
|
|
1951
1773
|
if (params.types && params.types.length > 0) queryParams.types = params.types;
|
|
1952
1774
|
if (params.from !== void 0) queryParams.from = params.from;
|
|
1953
1775
|
if (params.to !== void 0) queryParams.to = params.to;
|
|
1954
1776
|
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1955
1777
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1956
1778
|
return apiConfig.httpClient.get(
|
|
1957
|
-
`/v1/stores/${store_id}/
|
|
1779
|
+
`/v1/stores/${store_id}/actions`,
|
|
1958
1780
|
{ ...options, params: queryParams }
|
|
1959
1781
|
);
|
|
1960
1782
|
}
|
|
1961
1783
|
});
|
|
1962
|
-
var
|
|
1784
|
+
var createContactApi = (apiConfig) => {
|
|
1963
1785
|
return {
|
|
1964
1786
|
async create(params, options) {
|
|
1965
1787
|
const { store_id, ...payload } = params;
|
|
1966
1788
|
return apiConfig.httpClient.post(
|
|
1967
|
-
`/v1/stores/${store_id || apiConfig.storeId}/
|
|
1789
|
+
`/v1/stores/${store_id || apiConfig.storeId}/contacts`,
|
|
1968
1790
|
payload,
|
|
1969
1791
|
options
|
|
1970
1792
|
);
|
|
1971
1793
|
},
|
|
1972
1794
|
async get(params, options) {
|
|
1973
1795
|
return apiConfig.httpClient.get(
|
|
1974
|
-
`/v1/stores/${params.store_id || apiConfig.storeId}/
|
|
1796
|
+
`/v1/stores/${params.store_id || apiConfig.storeId}/contacts/${params.id}`,
|
|
1975
1797
|
options
|
|
1976
1798
|
);
|
|
1977
1799
|
},
|
|
1978
1800
|
async find(params, options) {
|
|
1979
1801
|
const store_id = params?.store_id || apiConfig.storeId;
|
|
1980
1802
|
const queryParams = {};
|
|
1803
|
+
if (params?.ids && params.ids.length > 0) queryParams.ids = JSON.stringify(params.ids);
|
|
1981
1804
|
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1982
1805
|
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1983
1806
|
if (params?.query) queryParams.query = params.query;
|
|
1984
1807
|
if (params?.taxonomy_query) queryParams.taxonomy_query = params.taxonomy_query;
|
|
1985
1808
|
if (params?.status) queryParams.status = params.status;
|
|
1986
|
-
if (params?.
|
|
1809
|
+
if (params?.has_action !== void 0) queryParams.has_action = params.has_action;
|
|
1987
1810
|
if (params?.has_cart !== void 0) queryParams.has_cart = params.has_cart;
|
|
1988
1811
|
if (params?.sort_field) queryParams.sort_field = params.sort_field;
|
|
1989
1812
|
if (params?.sort_direction) queryParams.sort_direction = params.sort_direction;
|
|
1990
1813
|
return apiConfig.httpClient.get(
|
|
1991
|
-
`/v1/stores/${store_id}/
|
|
1814
|
+
`/v1/stores/${store_id}/contacts`,
|
|
1992
1815
|
{
|
|
1993
1816
|
...options,
|
|
1994
1817
|
params: queryParams
|
|
1995
1818
|
}
|
|
1996
1819
|
);
|
|
1997
1820
|
},
|
|
1821
|
+
async findActions(params, options) {
|
|
1822
|
+
const { store_id, ...queryParams } = params || {};
|
|
1823
|
+
return apiConfig.httpClient.get(
|
|
1824
|
+
`/v1/stores/${store_id || apiConfig.storeId}/actions`,
|
|
1825
|
+
{
|
|
1826
|
+
...options,
|
|
1827
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1828
|
+
}
|
|
1829
|
+
);
|
|
1830
|
+
},
|
|
1998
1831
|
async update(params, options) {
|
|
1999
1832
|
const { id, store_id, ...body } = params;
|
|
2000
1833
|
return apiConfig.httpClient.put(
|
|
2001
|
-
`/v1/stores/${store_id || apiConfig.storeId}/
|
|
1834
|
+
`/v1/stores/${store_id || apiConfig.storeId}/contacts/${id}`,
|
|
2002
1835
|
body,
|
|
2003
1836
|
options
|
|
2004
1837
|
);
|
|
@@ -2006,85 +1839,764 @@ var createCustomerApi = (apiConfig) => {
|
|
|
2006
1839
|
async merge(params, options) {
|
|
2007
1840
|
const store_id = params.store_id || apiConfig.storeId;
|
|
2008
1841
|
return apiConfig.httpClient.post(
|
|
2009
|
-
`/v1/stores/${store_id}/
|
|
1842
|
+
`/v1/stores/${store_id}/contacts/${params.target_id}/merge`,
|
|
2010
1843
|
{ source_id: params.source_id, store_id },
|
|
2011
1844
|
options
|
|
2012
1845
|
);
|
|
2013
1846
|
},
|
|
1847
|
+
"import": async (params, options) => {
|
|
1848
|
+
const { store_id, ...payload } = params;
|
|
1849
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1850
|
+
return apiConfig.httpClient.post(
|
|
1851
|
+
`/v1/stores/${target_store_id}/contacts/import`,
|
|
1852
|
+
payload,
|
|
1853
|
+
options
|
|
1854
|
+
);
|
|
1855
|
+
},
|
|
1856
|
+
previewImport: async (params, options) => {
|
|
1857
|
+
const { store_id, ...payload } = params;
|
|
1858
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1859
|
+
return apiConfig.httpClient.post(
|
|
1860
|
+
`/v1/stores/${target_store_id}/contacts/import/preview`,
|
|
1861
|
+
payload,
|
|
1862
|
+
options
|
|
1863
|
+
);
|
|
1864
|
+
},
|
|
2014
1865
|
async revokeToken(params, options) {
|
|
2015
1866
|
const store_id = params.store_id || apiConfig.storeId;
|
|
2016
1867
|
return apiConfig.httpClient.delete(
|
|
2017
|
-
`/v1/stores/${store_id}/
|
|
1868
|
+
`/v1/stores/${store_id}/contacts/${params.id}/sessions/${params.token_id}`,
|
|
2018
1869
|
options
|
|
2019
1870
|
);
|
|
2020
1871
|
},
|
|
2021
1872
|
async revokeAllTokens(params, options) {
|
|
2022
1873
|
const store_id = params.store_id || apiConfig.storeId;
|
|
2023
1874
|
return apiConfig.httpClient.delete(
|
|
2024
|
-
`/v1/stores/${store_id}/
|
|
1875
|
+
`/v1/stores/${store_id}/contacts/${params.id}/sessions`,
|
|
2025
1876
|
options
|
|
2026
1877
|
);
|
|
2027
1878
|
},
|
|
2028
|
-
|
|
1879
|
+
contactList: {
|
|
2029
1880
|
async create(params, options) {
|
|
1881
|
+
const { store_id, ...payload } = params;
|
|
1882
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2030
1883
|
return apiConfig.httpClient.post(
|
|
2031
|
-
`/v1/stores/${
|
|
2032
|
-
|
|
1884
|
+
`/v1/stores/${target_store_id}/contact-lists`,
|
|
1885
|
+
payload,
|
|
2033
1886
|
options
|
|
2034
1887
|
);
|
|
2035
1888
|
},
|
|
2036
1889
|
async update(params, options) {
|
|
1890
|
+
const { id, store_id, ...payload } = params;
|
|
1891
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2037
1892
|
return apiConfig.httpClient.put(
|
|
2038
|
-
`/v1/stores/${
|
|
2039
|
-
|
|
1893
|
+
`/v1/stores/${target_store_id}/contact-lists/${id}`,
|
|
1894
|
+
payload,
|
|
2040
1895
|
options
|
|
2041
1896
|
);
|
|
2042
1897
|
},
|
|
2043
1898
|
async get(params, options) {
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
1899
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1900
|
+
return apiConfig.httpClient.get(
|
|
1901
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.id}`,
|
|
1902
|
+
options
|
|
1903
|
+
);
|
|
1904
|
+
},
|
|
1905
|
+
async find(params, options) {
|
|
1906
|
+
const { store_id, ...queryParams } = params || {};
|
|
1907
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1908
|
+
return apiConfig.httpClient.get(
|
|
1909
|
+
`/v1/stores/${target_store_id}/contact-lists`,
|
|
1910
|
+
{ ...options, params: queryParams }
|
|
1911
|
+
);
|
|
1912
|
+
},
|
|
1913
|
+
async importContacts(params, options) {
|
|
1914
|
+
const { store_id, contact_list_id, ...payload } = params;
|
|
1915
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1916
|
+
return apiConfig.httpClient.post(
|
|
1917
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/import`,
|
|
1918
|
+
payload,
|
|
1919
|
+
options
|
|
1920
|
+
);
|
|
1921
|
+
},
|
|
1922
|
+
async previewImportContacts(params, options) {
|
|
1923
|
+
const { store_id, contact_list_id, ...payload } = params;
|
|
1924
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1925
|
+
return apiConfig.httpClient.post(
|
|
1926
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/import/preview`,
|
|
1927
|
+
payload,
|
|
1928
|
+
options
|
|
1929
|
+
);
|
|
1930
|
+
},
|
|
1931
|
+
members: {
|
|
1932
|
+
async add(params, options) {
|
|
1933
|
+
const { store_id, contact_list_id, contact_id, fields, lead_description } = params;
|
|
1934
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1935
|
+
return apiConfig.httpClient.post(
|
|
1936
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/${contact_id}`,
|
|
1937
|
+
{ fields, lead_description },
|
|
1938
|
+
options
|
|
1939
|
+
);
|
|
1940
|
+
},
|
|
1941
|
+
async update(params, options) {
|
|
1942
|
+
const { store_id, contact_list_id, contact_id, status, fields, lead_description } = params;
|
|
1943
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1944
|
+
return apiConfig.httpClient.patch(
|
|
1945
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/${contact_id}`,
|
|
1946
|
+
{ status, fields, lead_description },
|
|
1947
|
+
options
|
|
1948
|
+
);
|
|
1949
|
+
},
|
|
1950
|
+
async remove(params, options) {
|
|
1951
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1952
|
+
return apiConfig.httpClient.delete(
|
|
1953
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/contacts/${params.contact_id}`,
|
|
1954
|
+
options
|
|
1955
|
+
);
|
|
1956
|
+
},
|
|
1957
|
+
async find(params, options) {
|
|
1958
|
+
const { store_id, contact_list_id, ...queryParams } = params;
|
|
1959
|
+
if (!contact_list_id && !queryParams.contact_id) {
|
|
1960
|
+
throw new Error("contact_list_id or contact_id is required");
|
|
1961
|
+
}
|
|
1962
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1963
|
+
const path = contact_list_id ? `/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts` : `/v1/stores/${target_store_id}/contact-lists/contacts`;
|
|
1964
|
+
return apiConfig.httpClient.get(
|
|
1965
|
+
path,
|
|
1966
|
+
{ ...options, params: queryParams }
|
|
1967
|
+
);
|
|
2051
1968
|
}
|
|
1969
|
+
}
|
|
1970
|
+
},
|
|
1971
|
+
mailbox: {
|
|
1972
|
+
async create(params, options) {
|
|
1973
|
+
const { store_id, ...payload } = params;
|
|
1974
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1975
|
+
return apiConfig.httpClient.post(
|
|
1976
|
+
`/v1/stores/${target_store_id}/mailboxes`,
|
|
1977
|
+
payload,
|
|
1978
|
+
options
|
|
1979
|
+
);
|
|
1980
|
+
},
|
|
1981
|
+
async update(params, options) {
|
|
1982
|
+
const { id, store_id, ...payload } = params;
|
|
1983
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1984
|
+
return apiConfig.httpClient.put(
|
|
1985
|
+
`/v1/stores/${target_store_id}/mailboxes/${id}`,
|
|
1986
|
+
payload,
|
|
1987
|
+
options
|
|
1988
|
+
);
|
|
1989
|
+
},
|
|
1990
|
+
async get(params, options) {
|
|
1991
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2052
1992
|
return apiConfig.httpClient.get(
|
|
2053
|
-
`/v1/stores/${
|
|
1993
|
+
`/v1/stores/${target_store_id}/mailboxes/${params.id}`,
|
|
1994
|
+
options
|
|
1995
|
+
);
|
|
1996
|
+
},
|
|
1997
|
+
async test(params, options) {
|
|
1998
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1999
|
+
return apiConfig.httpClient.post(
|
|
2000
|
+
`/v1/stores/${target_store_id}/mailboxes/${params.id}/test`,
|
|
2001
|
+
{},
|
|
2002
|
+
options
|
|
2003
|
+
);
|
|
2004
|
+
},
|
|
2005
|
+
async prepare(params, options) {
|
|
2006
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2007
|
+
return apiConfig.httpClient.post(
|
|
2008
|
+
`/v1/stores/${target_store_id}/mailboxes/${params.id}/prepare`,
|
|
2009
|
+
{},
|
|
2054
2010
|
options
|
|
2055
2011
|
);
|
|
2056
2012
|
},
|
|
2057
2013
|
async find(params, options) {
|
|
2014
|
+
const { store_id, ...queryParams } = params || {};
|
|
2015
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2058
2016
|
return apiConfig.httpClient.get(
|
|
2059
|
-
`/v1/stores/${
|
|
2060
|
-
{ ...options, params }
|
|
2017
|
+
`/v1/stores/${target_store_id}/mailboxes`,
|
|
2018
|
+
{ ...options, params: queryParams }
|
|
2019
|
+
);
|
|
2020
|
+
}
|
|
2021
|
+
},
|
|
2022
|
+
campaign: {
|
|
2023
|
+
async create(params, options) {
|
|
2024
|
+
const { store_id, ...payload } = params;
|
|
2025
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2026
|
+
return apiConfig.httpClient.post(
|
|
2027
|
+
`/v1/stores/${target_store_id}/campaigns`,
|
|
2028
|
+
payload,
|
|
2029
|
+
options
|
|
2061
2030
|
);
|
|
2062
2031
|
},
|
|
2063
|
-
async
|
|
2032
|
+
async update(params, options) {
|
|
2033
|
+
const { id, store_id, ...payload } = params;
|
|
2034
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2035
|
+
return apiConfig.httpClient.put(
|
|
2036
|
+
`/v1/stores/${target_store_id}/campaigns/${id}`,
|
|
2037
|
+
payload,
|
|
2038
|
+
options
|
|
2039
|
+
);
|
|
2040
|
+
},
|
|
2041
|
+
async get(params, options) {
|
|
2042
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2064
2043
|
return apiConfig.httpClient.get(
|
|
2065
|
-
`/v1/stores/${
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2044
|
+
`/v1/stores/${target_store_id}/campaigns/${params.id}`,
|
|
2045
|
+
options
|
|
2046
|
+
);
|
|
2047
|
+
},
|
|
2048
|
+
async find(params, options) {
|
|
2049
|
+
const { store_id, ...queryParams } = params || {};
|
|
2050
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2051
|
+
return apiConfig.httpClient.get(
|
|
2052
|
+
`/v1/stores/${target_store_id}/campaigns`,
|
|
2053
|
+
{ ...options, params: queryParams }
|
|
2054
|
+
);
|
|
2055
|
+
},
|
|
2056
|
+
async launch(params, options) {
|
|
2057
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2058
|
+
return apiConfig.httpClient.post(
|
|
2059
|
+
`/v1/stores/${target_store_id}/campaigns/${params.id}/launch`,
|
|
2060
|
+
{},
|
|
2061
|
+
options
|
|
2070
2062
|
);
|
|
2071
2063
|
},
|
|
2072
|
-
async
|
|
2064
|
+
async duplicate(params, options) {
|
|
2065
|
+
const { id, store_id, ...payload } = params;
|
|
2066
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2073
2067
|
return apiConfig.httpClient.post(
|
|
2074
|
-
`/v1/stores/${
|
|
2075
|
-
|
|
2068
|
+
`/v1/stores/${target_store_id}/campaigns/${id}/duplicate`,
|
|
2069
|
+
payload,
|
|
2076
2070
|
options
|
|
2077
2071
|
);
|
|
2078
2072
|
},
|
|
2079
|
-
async
|
|
2080
|
-
|
|
2081
|
-
|
|
2073
|
+
async launchReadiness(params, options) {
|
|
2074
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2075
|
+
return apiConfig.httpClient.get(
|
|
2076
|
+
`/v1/stores/${target_store_id}/campaigns/${params.id}/launch-readiness`,
|
|
2077
|
+
options
|
|
2078
|
+
);
|
|
2079
|
+
},
|
|
2080
|
+
async importEnrollments(params, options) {
|
|
2081
|
+
const { id, store_id, ...payload } = params;
|
|
2082
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2083
|
+
return apiConfig.httpClient.post(
|
|
2084
|
+
`/v1/stores/${target_store_id}/campaigns/${id}/enrollments/import`,
|
|
2085
|
+
payload,
|
|
2082
2086
|
options
|
|
2083
2087
|
);
|
|
2088
|
+
},
|
|
2089
|
+
async generatePersonalizedDrafts(params, options) {
|
|
2090
|
+
const { id, store_id, ...payload } = params;
|
|
2091
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2092
|
+
return apiConfig.httpClient.post(
|
|
2093
|
+
`/v1/stores/${target_store_id}/campaigns/${id}/personalized-drafts`,
|
|
2094
|
+
payload,
|
|
2095
|
+
options
|
|
2096
|
+
);
|
|
2097
|
+
}
|
|
2098
|
+
},
|
|
2099
|
+
campaignEnrollment: {
|
|
2100
|
+
async find(params, options) {
|
|
2101
|
+
const { store_id, ...queryParams } = params || {};
|
|
2102
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2103
|
+
return apiConfig.httpClient.get(
|
|
2104
|
+
`/v1/stores/${target_store_id}/campaign-enrollments`,
|
|
2105
|
+
{ ...options, params: queryParams }
|
|
2106
|
+
);
|
|
2107
|
+
},
|
|
2108
|
+
async get(params, options) {
|
|
2109
|
+
const { store_id, id, ...queryParams } = params;
|
|
2110
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2111
|
+
return apiConfig.httpClient.get(
|
|
2112
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}`,
|
|
2113
|
+
{ ...options, params: { ...queryParams, store_id: target_store_id } }
|
|
2114
|
+
);
|
|
2115
|
+
},
|
|
2116
|
+
async update(params, options) {
|
|
2117
|
+
const { store_id, id, ...payload } = params;
|
|
2118
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2119
|
+
return apiConfig.httpClient.put(
|
|
2120
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}`,
|
|
2121
|
+
payload,
|
|
2122
|
+
options
|
|
2123
|
+
);
|
|
2124
|
+
},
|
|
2125
|
+
async updateDraft(params, options) {
|
|
2126
|
+
const { store_id, id, draft_id, ...payload } = params;
|
|
2127
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2128
|
+
return apiConfig.httpClient.put(
|
|
2129
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/drafts/${draft_id}`,
|
|
2130
|
+
payload,
|
|
2131
|
+
options
|
|
2132
|
+
);
|
|
2133
|
+
},
|
|
2134
|
+
async updateStepExecution(params, options) {
|
|
2135
|
+
const { store_id, id, execution_id, ...payload } = params;
|
|
2136
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2137
|
+
return apiConfig.httpClient.post(
|
|
2138
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/step-executions/${execution_id}`,
|
|
2139
|
+
payload,
|
|
2140
|
+
options
|
|
2141
|
+
);
|
|
2142
|
+
},
|
|
2143
|
+
async reply(params, options) {
|
|
2144
|
+
const { store_id, id, ...payload } = params;
|
|
2145
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2146
|
+
return apiConfig.httpClient.post(
|
|
2147
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/reply`,
|
|
2148
|
+
payload,
|
|
2149
|
+
options
|
|
2150
|
+
);
|
|
2151
|
+
},
|
|
2152
|
+
async stop(params, options) {
|
|
2153
|
+
const { store_id, id, ...payload } = params;
|
|
2154
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2155
|
+
return apiConfig.httpClient.post(
|
|
2156
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/stop`,
|
|
2157
|
+
payload,
|
|
2158
|
+
options
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
},
|
|
2162
|
+
campaignMessage: {
|
|
2163
|
+
async find(params, options) {
|
|
2164
|
+
const { store_id, ...queryParams } = params || {};
|
|
2165
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2166
|
+
return apiConfig.httpClient.get(
|
|
2167
|
+
`/v1/stores/${target_store_id}/campaign-messages`,
|
|
2168
|
+
{ ...options, params: queryParams }
|
|
2169
|
+
);
|
|
2170
|
+
},
|
|
2171
|
+
async update(params, options) {
|
|
2172
|
+
const { id, store_id, ...payload } = params;
|
|
2173
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2174
|
+
return apiConfig.httpClient.put(
|
|
2175
|
+
`/v1/stores/${target_store_id}/campaign-messages/${id}`,
|
|
2176
|
+
payload,
|
|
2177
|
+
options
|
|
2178
|
+
);
|
|
2179
|
+
}
|
|
2180
|
+
},
|
|
2181
|
+
suppression: {
|
|
2182
|
+
async create(params, options) {
|
|
2183
|
+
const { store_id, ...payload } = params;
|
|
2184
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2185
|
+
return apiConfig.httpClient.post(
|
|
2186
|
+
`/v1/stores/${target_store_id}/suppressions`,
|
|
2187
|
+
payload,
|
|
2188
|
+
options
|
|
2189
|
+
);
|
|
2190
|
+
},
|
|
2191
|
+
async update(params, options) {
|
|
2192
|
+
const { id, store_id, ...payload } = params;
|
|
2193
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2194
|
+
return apiConfig.httpClient.put(
|
|
2195
|
+
`/v1/stores/${target_store_id}/suppressions/${id}`,
|
|
2196
|
+
payload,
|
|
2197
|
+
options
|
|
2198
|
+
);
|
|
2199
|
+
},
|
|
2200
|
+
async get(params, options) {
|
|
2201
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2202
|
+
return apiConfig.httpClient.get(
|
|
2203
|
+
`/v1/stores/${target_store_id}/suppressions/${params.id}`,
|
|
2204
|
+
options
|
|
2205
|
+
);
|
|
2206
|
+
},
|
|
2207
|
+
async find(params, options) {
|
|
2208
|
+
const { store_id, ...queryParams } = params || {};
|
|
2209
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2210
|
+
return apiConfig.httpClient.get(
|
|
2211
|
+
`/v1/stores/${target_store_id}/suppressions`,
|
|
2212
|
+
{ ...options, params: queryParams }
|
|
2213
|
+
);
|
|
2214
|
+
}
|
|
2215
|
+
},
|
|
2216
|
+
action: createActionAdminApi(apiConfig)
|
|
2217
|
+
};
|
|
2218
|
+
};
|
|
2219
|
+
|
|
2220
|
+
// src/api/support.ts
|
|
2221
|
+
function supportConversationQuery(params) {
|
|
2222
|
+
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
2223
|
+
if (params.message_limit) qs.set("message_limit", String(params.message_limit));
|
|
2224
|
+
if (typeof params.after_created_at === "number") qs.set("after_created_at", String(params.after_created_at));
|
|
2225
|
+
if (params.after_id) qs.set("after_id", params.after_id);
|
|
2226
|
+
return qs.toString();
|
|
2227
|
+
}
|
|
2228
|
+
function createStorefrontSupportApi(config) {
|
|
2229
|
+
const { httpClient, storeId } = config;
|
|
2230
|
+
return {
|
|
2231
|
+
async startConversation(params = {}, opts) {
|
|
2232
|
+
return httpClient.post(
|
|
2233
|
+
`/v1/storefront/${storeId}/support/conversations`,
|
|
2234
|
+
{ store_id: storeId, ...params },
|
|
2235
|
+
opts
|
|
2236
|
+
);
|
|
2237
|
+
},
|
|
2238
|
+
async sendMessage(params, opts) {
|
|
2239
|
+
return httpClient.post(
|
|
2240
|
+
`/v1/storefront/${storeId}/support/conversations/${params.conversation_id}/messages`,
|
|
2241
|
+
{ store_id: storeId, ...params },
|
|
2242
|
+
opts
|
|
2243
|
+
);
|
|
2244
|
+
},
|
|
2245
|
+
async getConversation(params, opts) {
|
|
2246
|
+
const qs = supportConversationQuery({ store_id: storeId, ...params });
|
|
2247
|
+
return httpClient.get(
|
|
2248
|
+
`/v1/storefront/${storeId}/support/conversations/${params.conversation_id}?${qs}`,
|
|
2249
|
+
opts
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
function createAdminSupportApi(config) {
|
|
2255
|
+
const { httpClient } = config;
|
|
2256
|
+
return {
|
|
2257
|
+
agent: {
|
|
2258
|
+
async create(params, opts) {
|
|
2259
|
+
return httpClient.post(
|
|
2260
|
+
`/v1/stores/${params.store_id}/support/agents`,
|
|
2261
|
+
params,
|
|
2262
|
+
opts
|
|
2263
|
+
);
|
|
2264
|
+
},
|
|
2265
|
+
async get(params, opts) {
|
|
2266
|
+
return httpClient.get(
|
|
2267
|
+
`/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
|
|
2268
|
+
opts
|
|
2269
|
+
);
|
|
2270
|
+
},
|
|
2271
|
+
async find(params, opts) {
|
|
2272
|
+
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
2273
|
+
if (params.status) qs.set("status", params.status);
|
|
2274
|
+
if (params.limit) qs.set("limit", String(params.limit));
|
|
2275
|
+
if (params.cursor) qs.set("cursor", params.cursor);
|
|
2276
|
+
return httpClient.get(
|
|
2277
|
+
`/v1/stores/${params.store_id}/support/agents?${qs}`,
|
|
2278
|
+
opts
|
|
2279
|
+
);
|
|
2280
|
+
},
|
|
2281
|
+
async update(params, opts) {
|
|
2282
|
+
return httpClient.put(
|
|
2283
|
+
`/v1/stores/${params.store_id}/support/agents/${params.id}`,
|
|
2284
|
+
params,
|
|
2285
|
+
opts
|
|
2286
|
+
);
|
|
2287
|
+
},
|
|
2288
|
+
async delete(params, opts) {
|
|
2289
|
+
return httpClient.delete(
|
|
2290
|
+
`/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
|
|
2291
|
+
opts
|
|
2292
|
+
);
|
|
2293
|
+
}
|
|
2294
|
+
},
|
|
2295
|
+
conversation: {
|
|
2296
|
+
async find(params, opts) {
|
|
2297
|
+
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
2298
|
+
if (params.status) qs.set("status", params.status);
|
|
2299
|
+
if (params.agent_id) qs.set("agent_id", params.agent_id);
|
|
2300
|
+
if (params.query) qs.set("query", params.query);
|
|
2301
|
+
if (params.limit) qs.set("limit", String(params.limit));
|
|
2302
|
+
if (params.cursor) qs.set("cursor", params.cursor);
|
|
2303
|
+
return httpClient.get(
|
|
2304
|
+
`/v1/stores/${params.store_id}/support/conversations?${qs}`,
|
|
2305
|
+
opts
|
|
2306
|
+
);
|
|
2307
|
+
},
|
|
2308
|
+
async get(params, opts) {
|
|
2309
|
+
const qs = supportConversationQuery(params);
|
|
2310
|
+
return httpClient.get(
|
|
2311
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}?${qs}`,
|
|
2312
|
+
opts
|
|
2313
|
+
);
|
|
2314
|
+
},
|
|
2315
|
+
async sendMessage(params, opts) {
|
|
2316
|
+
return httpClient.post(
|
|
2317
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/messages`,
|
|
2318
|
+
params,
|
|
2319
|
+
opts
|
|
2320
|
+
);
|
|
2321
|
+
},
|
|
2322
|
+
async reply(params, opts) {
|
|
2323
|
+
return httpClient.post(
|
|
2324
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/reply`,
|
|
2325
|
+
params,
|
|
2326
|
+
opts
|
|
2327
|
+
);
|
|
2328
|
+
},
|
|
2329
|
+
async resolve(params, opts) {
|
|
2330
|
+
return httpClient.post(
|
|
2331
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/resolve`,
|
|
2332
|
+
params,
|
|
2333
|
+
opts
|
|
2334
|
+
);
|
|
2335
|
+
},
|
|
2336
|
+
async assign(params, opts) {
|
|
2337
|
+
return httpClient.post(
|
|
2338
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/assign`,
|
|
2339
|
+
params,
|
|
2340
|
+
opts
|
|
2341
|
+
);
|
|
2084
2342
|
}
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
// src/api/leadResearch.ts
|
|
2348
|
+
var createLeadResearchApi = (apiConfig) => {
|
|
2349
|
+
const storeId = (store_id) => store_id || apiConfig.storeId;
|
|
2350
|
+
return {
|
|
2351
|
+
async createRun(params, options) {
|
|
2352
|
+
const { store_id, ...payload } = params;
|
|
2353
|
+
return apiConfig.httpClient.post(
|
|
2354
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs`,
|
|
2355
|
+
payload,
|
|
2356
|
+
options
|
|
2357
|
+
);
|
|
2358
|
+
},
|
|
2359
|
+
async findRuns(params, options) {
|
|
2360
|
+
const { store_id, ...queryParams } = params || {};
|
|
2361
|
+
return apiConfig.httpClient.get(
|
|
2362
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs`,
|
|
2363
|
+
{ ...options, params: queryParams }
|
|
2364
|
+
);
|
|
2365
|
+
},
|
|
2366
|
+
async getRun(params, options) {
|
|
2367
|
+
return apiConfig.httpClient.get(
|
|
2368
|
+
`/v1/stores/${storeId(params.store_id)}/lead-research/runs/${params.id}`,
|
|
2369
|
+
options
|
|
2370
|
+
);
|
|
2371
|
+
},
|
|
2372
|
+
async updateRun(params, options) {
|
|
2373
|
+
const { store_id, id, ...payload } = params;
|
|
2374
|
+
return apiConfig.httpClient.patch(
|
|
2375
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs/${id}`,
|
|
2376
|
+
payload,
|
|
2377
|
+
options
|
|
2378
|
+
);
|
|
2379
|
+
},
|
|
2380
|
+
async cancelRun(params, options) {
|
|
2381
|
+
return apiConfig.httpClient.post(
|
|
2382
|
+
`/v1/stores/${storeId(params.store_id)}/lead-research/runs/${params.id}/cancel`,
|
|
2383
|
+
{},
|
|
2384
|
+
options
|
|
2385
|
+
);
|
|
2386
|
+
},
|
|
2387
|
+
async sendMessage(params, options) {
|
|
2388
|
+
const { store_id, run_id, ...payload } = params;
|
|
2389
|
+
return apiConfig.httpClient.post(
|
|
2390
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs/${run_id}/messages`,
|
|
2391
|
+
payload,
|
|
2392
|
+
options
|
|
2393
|
+
);
|
|
2394
|
+
},
|
|
2395
|
+
async findMessages(params, options) {
|
|
2396
|
+
const { store_id, run_id, ...queryParams } = params;
|
|
2397
|
+
return apiConfig.httpClient.get(
|
|
2398
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs/${run_id}/messages`,
|
|
2399
|
+
{ ...options, params: queryParams }
|
|
2400
|
+
);
|
|
2401
|
+
},
|
|
2402
|
+
async validateEmail(params, options) {
|
|
2403
|
+
const { store_id, ...payload } = params;
|
|
2404
|
+
return apiConfig.httpClient.post(
|
|
2405
|
+
`/v1/stores/${storeId(store_id)}/lead-research/validate-email`,
|
|
2406
|
+
payload,
|
|
2407
|
+
options
|
|
2408
|
+
);
|
|
2409
|
+
}
|
|
2410
|
+
};
|
|
2411
|
+
};
|
|
2412
|
+
|
|
2413
|
+
// src/api/social.ts
|
|
2414
|
+
var createSocialApi = (apiConfig) => {
|
|
2415
|
+
const storeId = (store_id) => store_id || apiConfig.storeId;
|
|
2416
|
+
const api = {
|
|
2417
|
+
async findPublications(params, options) {
|
|
2418
|
+
const { store_id, ...queryParams } = params || {};
|
|
2419
|
+
return apiConfig.httpClient.get(
|
|
2420
|
+
`/v1/stores/${storeId(store_id)}/social-publications`,
|
|
2421
|
+
{
|
|
2422
|
+
...options,
|
|
2423
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2424
|
+
}
|
|
2425
|
+
);
|
|
2426
|
+
},
|
|
2427
|
+
async getPublication(params, options) {
|
|
2428
|
+
return apiConfig.httpClient.get(
|
|
2429
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.id}`,
|
|
2430
|
+
options
|
|
2431
|
+
);
|
|
2432
|
+
},
|
|
2433
|
+
async validatePublication(params, options) {
|
|
2434
|
+
const { store_id, ...payload } = params;
|
|
2435
|
+
return apiConfig.httpClient.post(
|
|
2436
|
+
`/v1/stores/${storeId(store_id)}/social-publications/validate`,
|
|
2437
|
+
payload,
|
|
2438
|
+
options
|
|
2439
|
+
);
|
|
2440
|
+
},
|
|
2441
|
+
async createPublication(params, options) {
|
|
2442
|
+
const { store_id, ...payload } = params;
|
|
2443
|
+
return apiConfig.httpClient.post(
|
|
2444
|
+
`/v1/stores/${storeId(store_id)}/social-publications`,
|
|
2445
|
+
payload,
|
|
2446
|
+
options
|
|
2447
|
+
);
|
|
2448
|
+
},
|
|
2449
|
+
async updatePublication(params, options) {
|
|
2450
|
+
const { store_id, id, ...payload } = params;
|
|
2451
|
+
return apiConfig.httpClient.put(
|
|
2452
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${id}`,
|
|
2453
|
+
payload,
|
|
2454
|
+
options
|
|
2455
|
+
);
|
|
2456
|
+
},
|
|
2457
|
+
async schedulePublication(params, options) {
|
|
2458
|
+
const { store_id, id, ...payload } = params;
|
|
2459
|
+
return apiConfig.httpClient.post(
|
|
2460
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${id}/schedule`,
|
|
2461
|
+
payload,
|
|
2462
|
+
options
|
|
2463
|
+
);
|
|
2464
|
+
},
|
|
2465
|
+
async cancelPublication(params, options) {
|
|
2466
|
+
return apiConfig.httpClient.post(
|
|
2467
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.id}/cancel`,
|
|
2468
|
+
{},
|
|
2469
|
+
options
|
|
2470
|
+
);
|
|
2471
|
+
},
|
|
2472
|
+
async getPublicationComments(params, options) {
|
|
2473
|
+
const { store_id, publication_id, ...queryParams } = params;
|
|
2474
|
+
return apiConfig.httpClient.get(
|
|
2475
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments`,
|
|
2476
|
+
{
|
|
2477
|
+
...options,
|
|
2478
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2479
|
+
}
|
|
2480
|
+
);
|
|
2481
|
+
},
|
|
2482
|
+
async syncPublicationComments(params, options) {
|
|
2483
|
+
const { store_id, publication_id, ...payload } = params;
|
|
2484
|
+
return apiConfig.httpClient.post(
|
|
2485
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/sync`,
|
|
2486
|
+
payload,
|
|
2487
|
+
options
|
|
2488
|
+
);
|
|
2489
|
+
},
|
|
2490
|
+
async getPublicationCommentThread(params, options) {
|
|
2491
|
+
const { store_id, publication_id, comment_id, ...queryParams } = params;
|
|
2492
|
+
return apiConfig.httpClient.get(
|
|
2493
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/thread`,
|
|
2494
|
+
{
|
|
2495
|
+
...options,
|
|
2496
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2497
|
+
}
|
|
2498
|
+
);
|
|
2085
2499
|
},
|
|
2086
|
-
|
|
2500
|
+
async syncPublicationCommentThread(params, options) {
|
|
2501
|
+
const { store_id, publication_id, comment_id, ...payload } = params;
|
|
2502
|
+
return apiConfig.httpClient.post(
|
|
2503
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/thread/sync`,
|
|
2504
|
+
payload,
|
|
2505
|
+
options
|
|
2506
|
+
);
|
|
2507
|
+
},
|
|
2508
|
+
async findPublicationComments(params, options) {
|
|
2509
|
+
const { store_id, ...queryParams } = params || {};
|
|
2510
|
+
return apiConfig.httpClient.get(`/v1/stores/${storeId(store_id)}/social-publications/comments`, {
|
|
2511
|
+
...options,
|
|
2512
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2513
|
+
});
|
|
2514
|
+
},
|
|
2515
|
+
async classifyPublicationComments(params, options) {
|
|
2516
|
+
const { store_id, ...payload } = params || {};
|
|
2517
|
+
return apiConfig.httpClient.post(
|
|
2518
|
+
`/v1/stores/${storeId(store_id)}/social-publications/comments/classify`,
|
|
2519
|
+
payload,
|
|
2520
|
+
options
|
|
2521
|
+
);
|
|
2522
|
+
},
|
|
2523
|
+
async replyToPublicationComment(params, options) {
|
|
2524
|
+
const { store_id, publication_id, comment_id, text } = params;
|
|
2525
|
+
return apiConfig.httpClient.post(
|
|
2526
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/reply`,
|
|
2527
|
+
{ text },
|
|
2528
|
+
options
|
|
2529
|
+
);
|
|
2530
|
+
},
|
|
2531
|
+
async getPublicationMetrics(params, options) {
|
|
2532
|
+
return apiConfig.httpClient.get(
|
|
2533
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/metrics`,
|
|
2534
|
+
options
|
|
2535
|
+
);
|
|
2536
|
+
},
|
|
2537
|
+
async syncPublicationMetrics(params, options) {
|
|
2538
|
+
return apiConfig.httpClient.post(
|
|
2539
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/metrics/sync`,
|
|
2540
|
+
{},
|
|
2541
|
+
options
|
|
2542
|
+
);
|
|
2543
|
+
},
|
|
2544
|
+
async syncEngagement(params, options) {
|
|
2545
|
+
const { store_id, ...payload } = params || {};
|
|
2546
|
+
return apiConfig.httpClient.post(
|
|
2547
|
+
`/v1/stores/${storeId(store_id)}/social-publications/engagement/sync`,
|
|
2548
|
+
payload,
|
|
2549
|
+
options
|
|
2550
|
+
);
|
|
2551
|
+
},
|
|
2552
|
+
async getCapabilities(params, options) {
|
|
2553
|
+
return apiConfig.httpClient.get(
|
|
2554
|
+
`/v1/stores/${storeId(params?.store_id)}/social-accounts/capabilities`,
|
|
2555
|
+
options
|
|
2556
|
+
);
|
|
2557
|
+
},
|
|
2558
|
+
async listAccounts(params, options) {
|
|
2559
|
+
return apiConfig.httpClient.get(
|
|
2560
|
+
`/v1/stores/${storeId(params?.store_id)}/social-accounts`,
|
|
2561
|
+
options
|
|
2562
|
+
);
|
|
2563
|
+
},
|
|
2564
|
+
async connect(params, options) {
|
|
2565
|
+
const { store_id, ...payload } = params;
|
|
2566
|
+
return apiConfig.httpClient.post(
|
|
2567
|
+
`/v1/stores/${storeId(store_id)}/social-accounts/oauth/connect`,
|
|
2568
|
+
payload,
|
|
2569
|
+
options
|
|
2570
|
+
);
|
|
2571
|
+
},
|
|
2572
|
+
async getOAuthAttempt(params, options) {
|
|
2573
|
+
return apiConfig.httpClient.get(
|
|
2574
|
+
`/v1/stores/${storeId(params.store_id)}/social-accounts/oauth/attempts/${params.attempt_id}`,
|
|
2575
|
+
options
|
|
2576
|
+
);
|
|
2577
|
+
},
|
|
2578
|
+
async selectDestination(params, options) {
|
|
2579
|
+
const { store_id, ...payload } = params;
|
|
2580
|
+
return apiConfig.httpClient.post(
|
|
2581
|
+
`/v1/stores/${storeId(store_id)}/social-accounts/oauth/select-destination`,
|
|
2582
|
+
payload,
|
|
2583
|
+
options
|
|
2584
|
+
);
|
|
2585
|
+
},
|
|
2586
|
+
async deleteAccount(params, options) {
|
|
2587
|
+
return apiConfig.httpClient.delete(
|
|
2588
|
+
`/v1/stores/${storeId(params.store_id)}/social-accounts/${params.id}`,
|
|
2589
|
+
options
|
|
2590
|
+
);
|
|
2591
|
+
},
|
|
2592
|
+
validatePublications(params, options) {
|
|
2593
|
+
return api.validatePublication(params, options);
|
|
2594
|
+
},
|
|
2595
|
+
createPublications(params, options) {
|
|
2596
|
+
return api.createPublication(params, options);
|
|
2597
|
+
}
|
|
2087
2598
|
};
|
|
2599
|
+
return api;
|
|
2088
2600
|
};
|
|
2089
2601
|
|
|
2090
2602
|
// src/api/workflow.ts
|
|
@@ -2125,14 +2637,21 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
2125
2637
|
async getWorkflows(params, options) {
|
|
2126
2638
|
const store_id = params?.store_id || apiConfig.storeId;
|
|
2127
2639
|
const { store_id: _, ...queryParams } = params || {};
|
|
2128
|
-
return apiConfig.httpClient.get(
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2640
|
+
return apiConfig.httpClient.get(
|
|
2641
|
+
`/v1/stores/${store_id}/workflows`,
|
|
2642
|
+
{
|
|
2643
|
+
...options,
|
|
2644
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2645
|
+
}
|
|
2646
|
+
);
|
|
2132
2647
|
},
|
|
2133
2648
|
async triggerWorkflow(params, options) {
|
|
2134
2649
|
const { secret, ...payload } = params;
|
|
2135
|
-
return apiConfig.httpClient.post(
|
|
2650
|
+
return apiConfig.httpClient.post(
|
|
2651
|
+
`/v1/workflows/trigger/${secret}`,
|
|
2652
|
+
payload,
|
|
2653
|
+
options
|
|
2654
|
+
);
|
|
2136
2655
|
},
|
|
2137
2656
|
async getWorkflowExecutions(params, options) {
|
|
2138
2657
|
const store_id = params.store_id || apiConfig.storeId;
|
|
@@ -2151,6 +2670,38 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
2151
2670
|
`/v1/stores/${store_id}/workflows/${params.workflow_id}/executions/${params.execution_id}`,
|
|
2152
2671
|
options
|
|
2153
2672
|
);
|
|
2673
|
+
},
|
|
2674
|
+
async getWorkflowAccounts(params, options) {
|
|
2675
|
+
const store_id = params?.store_id || apiConfig.storeId;
|
|
2676
|
+
return apiConfig.httpClient.get(
|
|
2677
|
+
`/v1/stores/${store_id}/workflow-accounts`,
|
|
2678
|
+
options
|
|
2679
|
+
);
|
|
2680
|
+
},
|
|
2681
|
+
async getWorkflowAccountConnectUrl(params, options) {
|
|
2682
|
+
const { store_id, type, ...payload } = params;
|
|
2683
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2684
|
+
return apiConfig.httpClient.post(
|
|
2685
|
+
`/v1/stores/${target_store_id}/workflow-accounts/connect-url`,
|
|
2686
|
+
{ ...payload, type, store_id: target_store_id },
|
|
2687
|
+
options
|
|
2688
|
+
);
|
|
2689
|
+
},
|
|
2690
|
+
async connectWorkflowAccount(params, options) {
|
|
2691
|
+
const { store_id, type, ...payload } = params;
|
|
2692
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2693
|
+
return apiConfig.httpClient.post(
|
|
2694
|
+
`/v1/stores/${target_store_id}/workflow-accounts/connect`,
|
|
2695
|
+
{ ...payload, type, store_id: target_store_id },
|
|
2696
|
+
options
|
|
2697
|
+
);
|
|
2698
|
+
},
|
|
2699
|
+
async deleteWorkflowAccount(params, options) {
|
|
2700
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
2701
|
+
return apiConfig.httpClient.delete(
|
|
2702
|
+
`/v1/stores/${store_id}/workflow-accounts/${params.id}`,
|
|
2703
|
+
options
|
|
2704
|
+
);
|
|
2154
2705
|
}
|
|
2155
2706
|
};
|
|
2156
2707
|
};
|
|
@@ -2161,8 +2712,8 @@ var createPlatformApi = (apiConfig) => {
|
|
|
2161
2712
|
async getCurrencies(options) {
|
|
2162
2713
|
return apiConfig.httpClient.get("/v1/platform/currencies", options);
|
|
2163
2714
|
},
|
|
2164
|
-
async
|
|
2165
|
-
return apiConfig.httpClient.get("/v1/platform/
|
|
2715
|
+
async getWorkflowTools(options) {
|
|
2716
|
+
return apiConfig.httpClient.get("/v1/platform/workflow-tools", options);
|
|
2166
2717
|
},
|
|
2167
2718
|
async getWebhookEvents(options) {
|
|
2168
2719
|
return apiConfig.httpClient.get("/v1/platform/events", options);
|
|
@@ -2212,116 +2763,35 @@ var createShippingApi = (apiConfig) => {
|
|
|
2212
2763
|
};
|
|
2213
2764
|
};
|
|
2214
2765
|
|
|
2215
|
-
// src/api/
|
|
2216
|
-
var
|
|
2766
|
+
// src/api/paymentProvider.ts
|
|
2767
|
+
var createPaymentProviderApi = (apiConfig) => {
|
|
2768
|
+
const storeId = (store_id) => store_id || apiConfig.storeId;
|
|
2217
2769
|
return {
|
|
2218
|
-
async
|
|
2219
|
-
const { store_id, ...payload } = params;
|
|
2220
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
2221
|
-
return apiConfig.httpClient.post(
|
|
2222
|
-
`/v1/stores/${target_store_id}/agents`,
|
|
2223
|
-
{ ...payload, store_id: target_store_id },
|
|
2224
|
-
options
|
|
2225
|
-
);
|
|
2226
|
-
},
|
|
2227
|
-
async updateAgent(params, options) {
|
|
2228
|
-
const { store_id, id, ...payload } = params;
|
|
2229
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
2230
|
-
return apiConfig.httpClient.put(
|
|
2231
|
-
`/v1/stores/${target_store_id}/agents/${id}`,
|
|
2232
|
-
payload,
|
|
2233
|
-
options
|
|
2234
|
-
);
|
|
2235
|
-
},
|
|
2236
|
-
async deleteAgent(params, options) {
|
|
2237
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2238
|
-
return apiConfig.httpClient.delete(
|
|
2239
|
-
`/v1/stores/${store_id}/agents/${params.id}`,
|
|
2240
|
-
options
|
|
2241
|
-
);
|
|
2242
|
-
},
|
|
2243
|
-
async getAgent(params, options) {
|
|
2244
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2770
|
+
async list(params, options) {
|
|
2245
2771
|
return apiConfig.httpClient.get(
|
|
2246
|
-
`/v1/stores/${store_id}/
|
|
2772
|
+
`/v1/stores/${storeId(params?.store_id)}/payment-providers`,
|
|
2247
2773
|
options
|
|
2248
2774
|
);
|
|
2249
2775
|
},
|
|
2250
|
-
async
|
|
2251
|
-
const
|
|
2252
|
-
const { store_id: _, ...queryParams } = params || {};
|
|
2253
|
-
return apiConfig.httpClient.get(`/v1/stores/${store_id}/agents`, {
|
|
2254
|
-
...options,
|
|
2255
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2256
|
-
});
|
|
2257
|
-
},
|
|
2258
|
-
async sendMessage(params, options) {
|
|
2259
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2260
|
-
const body = { message: params.message };
|
|
2261
|
-
if (params.chat_id) body.chat_id = params.chat_id;
|
|
2262
|
-
if (params.direct) body.direct = params.direct;
|
|
2776
|
+
async refresh(params, options) {
|
|
2777
|
+
const targetStoreId = storeId(params?.store_id);
|
|
2263
2778
|
return apiConfig.httpClient.post(
|
|
2264
|
-
`/v1/stores/${
|
|
2265
|
-
|
|
2266
|
-
options
|
|
2267
|
-
);
|
|
2268
|
-
},
|
|
2269
|
-
async getChats(params, options) {
|
|
2270
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2271
|
-
const queryParams = {};
|
|
2272
|
-
if (params.limit) queryParams.limit = String(params.limit);
|
|
2273
|
-
if (params.cursor) queryParams.cursor = params.cursor;
|
|
2274
|
-
return apiConfig.httpClient.get(
|
|
2275
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats`,
|
|
2276
|
-
{
|
|
2277
|
-
...options,
|
|
2278
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2279
|
-
}
|
|
2280
|
-
);
|
|
2281
|
-
},
|
|
2282
|
-
async getChat(params, options) {
|
|
2283
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2284
|
-
return apiConfig.httpClient.get(
|
|
2285
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}`,
|
|
2286
|
-
options
|
|
2287
|
-
);
|
|
2288
|
-
},
|
|
2289
|
-
async updateChat(params, options) {
|
|
2290
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2291
|
-
return apiConfig.httpClient.put(
|
|
2292
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}`,
|
|
2293
|
-
{ status: params.status },
|
|
2779
|
+
`/v1/stores/${targetStoreId}/payment-providers/refresh`,
|
|
2780
|
+
{ store_id: targetStoreId },
|
|
2294
2781
|
options
|
|
2295
2782
|
);
|
|
2296
2783
|
},
|
|
2297
|
-
async
|
|
2298
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2299
|
-
const body = { rating: params.rating };
|
|
2300
|
-
if (params.comment) body.comment = params.comment;
|
|
2784
|
+
async connectStripe(params, options) {
|
|
2301
2785
|
return apiConfig.httpClient.post(
|
|
2302
|
-
`/v1/stores/${
|
|
2303
|
-
|
|
2786
|
+
`/v1/stores/${storeId(params.store_id)}/payment-providers/stripe/connect`,
|
|
2787
|
+
params,
|
|
2304
2788
|
options
|
|
2305
2789
|
);
|
|
2306
2790
|
},
|
|
2307
|
-
async
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
...options,
|
|
2312
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2313
|
-
});
|
|
2314
|
-
},
|
|
2315
|
-
async getChatMessages(params, options) {
|
|
2316
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
2317
|
-
const queryParams = {};
|
|
2318
|
-
if (params.limit) queryParams.limit = String(params.limit);
|
|
2319
|
-
return apiConfig.httpClient.get(
|
|
2320
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}/messages`,
|
|
2321
|
-
{
|
|
2322
|
-
...options,
|
|
2323
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2324
|
-
}
|
|
2791
|
+
async delete(params, options) {
|
|
2792
|
+
return apiConfig.httpClient.delete(
|
|
2793
|
+
`/v1/stores/${storeId(params.store_id)}/payment-providers/${params.id}`,
|
|
2794
|
+
options
|
|
2325
2795
|
);
|
|
2326
2796
|
}
|
|
2327
2797
|
};
|
|
@@ -2380,6 +2850,15 @@ var createEmailTemplateApi = (apiConfig) => {
|
|
|
2380
2850
|
params: queryParams
|
|
2381
2851
|
}
|
|
2382
2852
|
);
|
|
2853
|
+
},
|
|
2854
|
+
async previewEmailTemplate(params, options) {
|
|
2855
|
+
const { store_id, id, ...payload } = params;
|
|
2856
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2857
|
+
return apiConfig.httpClient.post(
|
|
2858
|
+
`/v1/stores/${target_store_id}/email-templates/${id}/preview`,
|
|
2859
|
+
payload,
|
|
2860
|
+
options
|
|
2861
|
+
);
|
|
2383
2862
|
}
|
|
2384
2863
|
};
|
|
2385
2864
|
};
|
|
@@ -2553,6 +3032,164 @@ var createAnalyticsApi = (apiConfig) => {
|
|
|
2553
3032
|
};
|
|
2554
3033
|
};
|
|
2555
3034
|
|
|
3035
|
+
// src/api/experiments.ts
|
|
3036
|
+
var createExperimentsApi = (apiConfig) => {
|
|
3037
|
+
const base = (storeId = apiConfig.storeId) => `/v1/stores/${storeId}/experiments`;
|
|
3038
|
+
return {
|
|
3039
|
+
create(params, options) {
|
|
3040
|
+
const { store_id, ...payload } = params;
|
|
3041
|
+
return apiConfig.httpClient.post(base(store_id), payload, options);
|
|
3042
|
+
},
|
|
3043
|
+
update(params, options) {
|
|
3044
|
+
const { store_id, key, ...payload } = params;
|
|
3045
|
+
return apiConfig.httpClient.put(`${base(store_id)}/${key}`, payload, options);
|
|
3046
|
+
},
|
|
3047
|
+
get(params, options) {
|
|
3048
|
+
return apiConfig.httpClient.get(`${base(params.store_id)}/${params.key}`, options);
|
|
3049
|
+
},
|
|
3050
|
+
find(params = {}, options) {
|
|
3051
|
+
const { store_id, ...queryParams } = params;
|
|
3052
|
+
return apiConfig.httpClient.get(base(store_id), {
|
|
3053
|
+
...options,
|
|
3054
|
+
params: queryParams
|
|
3055
|
+
});
|
|
3056
|
+
},
|
|
3057
|
+
results(params, options) {
|
|
3058
|
+
return apiConfig.httpClient.get(
|
|
3059
|
+
`${base(params.store_id)}/${params.key}/results`,
|
|
3060
|
+
options
|
|
3061
|
+
);
|
|
3062
|
+
}
|
|
3063
|
+
};
|
|
3064
|
+
};
|
|
3065
|
+
|
|
3066
|
+
// src/utils/blocks.ts
|
|
3067
|
+
function getBlockLabel(block) {
|
|
3068
|
+
if (!block) return "";
|
|
3069
|
+
return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) ?? "";
|
|
3070
|
+
}
|
|
3071
|
+
function formatBlockValue(block) {
|
|
3072
|
+
if (!block || block.value === null || block.value === void 0) return "";
|
|
3073
|
+
const value = block.value;
|
|
3074
|
+
switch (block.type) {
|
|
3075
|
+
case "boolean":
|
|
3076
|
+
return value ? "Yes" : "No";
|
|
3077
|
+
case "number":
|
|
3078
|
+
if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
|
|
3079
|
+
return new Date(value).toLocaleDateString();
|
|
3080
|
+
}
|
|
3081
|
+
return String(value);
|
|
3082
|
+
case "media":
|
|
3083
|
+
if (value && typeof value === "object") {
|
|
3084
|
+
return value.mime_type ? value.name || value.id : value.title || value.name || value.id;
|
|
3085
|
+
}
|
|
3086
|
+
return String(value);
|
|
3087
|
+
default:
|
|
3088
|
+
return String(value);
|
|
3089
|
+
}
|
|
3090
|
+
}
|
|
3091
|
+
function prepareBlocksForSubmission(formData, blockTypes) {
|
|
3092
|
+
return Object.keys(formData).filter((key) => formData[key] !== null && formData[key] !== void 0).map((key) => ({
|
|
3093
|
+
key,
|
|
3094
|
+
value: (blockTypes?.[key] || "text") === "array" && !Array.isArray(formData[key]) ? [formData[key]] : formData[key]
|
|
3095
|
+
}));
|
|
3096
|
+
}
|
|
3097
|
+
function extractBlockValues(blocks) {
|
|
3098
|
+
const values = {};
|
|
3099
|
+
blocks.forEach((block) => {
|
|
3100
|
+
values[block.key] = block.value ?? null;
|
|
3101
|
+
});
|
|
3102
|
+
return values;
|
|
3103
|
+
}
|
|
3104
|
+
var getBlockValue = (entry, blockKey) => {
|
|
3105
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3106
|
+
return block?.value ?? null;
|
|
3107
|
+
};
|
|
3108
|
+
var getBlockTextValue = (block, locale = "en") => {
|
|
3109
|
+
if (!block || block.value === null || block.value === void 0) return "";
|
|
3110
|
+
const blockType = block.type;
|
|
3111
|
+
if (blockType === "localized_text" || blockType === "markdown") {
|
|
3112
|
+
if (typeof block.value === "object" && block.value !== null) {
|
|
3113
|
+
return block.value[locale] ?? block.value["en"] ?? "";
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
if (typeof block.value === "string") return block.value;
|
|
3117
|
+
return String(block.value ?? "");
|
|
3118
|
+
};
|
|
3119
|
+
var getBlockValues = (entry, blockKey) => {
|
|
3120
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3121
|
+
if (!block) return [];
|
|
3122
|
+
if (block.type === "array" && Array.isArray(block.value)) {
|
|
3123
|
+
return block.value;
|
|
3124
|
+
}
|
|
3125
|
+
return [];
|
|
3126
|
+
};
|
|
3127
|
+
function unwrapBlock(block, locale) {
|
|
3128
|
+
if (!block?.type || block.value === void 0) return block;
|
|
3129
|
+
const blockType = block.type;
|
|
3130
|
+
if (blockType === "array") {
|
|
3131
|
+
return block.value.map((obj) => {
|
|
3132
|
+
const parsed = {};
|
|
3133
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
3134
|
+
parsed[k] = unwrapBlock(v, locale);
|
|
3135
|
+
}
|
|
3136
|
+
return parsed;
|
|
3137
|
+
});
|
|
3138
|
+
}
|
|
3139
|
+
if (blockType === "object") {
|
|
3140
|
+
const parsed = {};
|
|
3141
|
+
for (const [k, v] of Object.entries(block.value || {})) {
|
|
3142
|
+
parsed[k] = unwrapBlock(v, locale);
|
|
3143
|
+
}
|
|
3144
|
+
return parsed;
|
|
3145
|
+
}
|
|
3146
|
+
if (blockType === "localized_text" || blockType === "markdown") {
|
|
3147
|
+
return block.value?.[locale];
|
|
3148
|
+
}
|
|
3149
|
+
return block.value;
|
|
3150
|
+
}
|
|
3151
|
+
var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
3152
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3153
|
+
if (!block || block.type !== "array" || !Array.isArray(block.value)) return [];
|
|
3154
|
+
return block.value.map((obj) => {
|
|
3155
|
+
if (!obj?.value || !Array.isArray(obj.value)) return {};
|
|
3156
|
+
return obj.value.reduce((acc, current) => {
|
|
3157
|
+
acc[current.key] = unwrapBlock(current, locale);
|
|
3158
|
+
return acc;
|
|
3159
|
+
}, {});
|
|
3160
|
+
});
|
|
3161
|
+
};
|
|
3162
|
+
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
3163
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3164
|
+
if (!block) return {};
|
|
3165
|
+
if (block.type === "array" && Array.isArray(block.value)) {
|
|
3166
|
+
return block.value.reduce((acc, current) => {
|
|
3167
|
+
acc[current.key] = unwrapBlock(current, locale);
|
|
3168
|
+
return acc;
|
|
3169
|
+
}, {});
|
|
3170
|
+
}
|
|
3171
|
+
if (block.type === "object" && block.value && typeof block.value === "object") {
|
|
3172
|
+
const result = {};
|
|
3173
|
+
for (const [k, v] of Object.entries(block.value)) {
|
|
3174
|
+
result[k] = unwrapBlock(v, locale);
|
|
3175
|
+
}
|
|
3176
|
+
return result;
|
|
3177
|
+
}
|
|
3178
|
+
return { [block.key]: unwrapBlock(block, locale) };
|
|
3179
|
+
};
|
|
3180
|
+
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
3181
|
+
if (!imageBlock) return null;
|
|
3182
|
+
if (imageBlock.type === "media") {
|
|
3183
|
+
const mediaValue = imageBlock.value;
|
|
3184
|
+
return mediaValue?.resolutions?.original?.url || mediaValue?.url || null;
|
|
3185
|
+
}
|
|
3186
|
+
if (isBlock) {
|
|
3187
|
+
if (typeof imageBlock === "string") return imageBlock;
|
|
3188
|
+
if (imageBlock.url) return imageBlock.url;
|
|
3189
|
+
}
|
|
3190
|
+
return imageBlock.resolutions?.original?.url || null;
|
|
3191
|
+
};
|
|
3192
|
+
|
|
2556
3193
|
// src/utils/price.ts
|
|
2557
3194
|
function formatCurrency(amount, currencyCode, locale = "en") {
|
|
2558
3195
|
if (!currencyCode) return "";
|
|
@@ -2803,7 +3440,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
2803
3440
|
}
|
|
2804
3441
|
|
|
2805
3442
|
// src/index.ts
|
|
2806
|
-
var SDK_VERSION = "0.
|
|
3443
|
+
var SDK_VERSION = "0.9.11";
|
|
2807
3444
|
var SUPPORTED_FRAMEWORKS = [
|
|
2808
3445
|
"astro",
|
|
2809
3446
|
"react",
|
|
@@ -2936,41 +3573,147 @@ function createAdmin(config) {
|
|
|
2936
3573
|
};
|
|
2937
3574
|
const accountApi = createAccountApi(apiConfig);
|
|
2938
3575
|
const authApi = createAuthApi(apiConfig, updateSession);
|
|
2939
|
-
const storeApi = createStoreApi(apiConfig
|
|
3576
|
+
const storeApi = createStoreApi(apiConfig);
|
|
2940
3577
|
const platformApi = createPlatformApi(apiConfig);
|
|
2941
3578
|
const cmsApi = createCmsApi(apiConfig);
|
|
2942
3579
|
const eshopApi = createEshopApi(apiConfig);
|
|
2943
3580
|
const promoCodeApi = createPromoCodeApi(apiConfig);
|
|
2944
|
-
const crmApi =
|
|
3581
|
+
const crmApi = createContactApi(apiConfig);
|
|
3582
|
+
const supportApi = createAdminSupportApi(apiConfig);
|
|
3583
|
+
const leadResearchApi = createLeadResearchApi(apiConfig);
|
|
3584
|
+
const socialApi = createSocialApi(apiConfig);
|
|
3585
|
+
const paymentProviderApi = createPaymentProviderApi(apiConfig);
|
|
3586
|
+
const notificationApi = createNotificationApi(apiConfig);
|
|
3587
|
+
const shippingApi = createShippingApi(apiConfig);
|
|
2945
3588
|
const locationApi = createLocationApi(apiConfig);
|
|
2946
3589
|
const marketApi = createMarketApi(apiConfig);
|
|
2947
|
-
const agentApi = createAgentApi(apiConfig);
|
|
2948
3590
|
const workflowApi = createWorkflowApi(apiConfig);
|
|
3591
|
+
const storePaymentProviderApi = {
|
|
3592
|
+
list: paymentProviderApi.list,
|
|
3593
|
+
refresh: paymentProviderApi.refresh,
|
|
3594
|
+
connectStripe: paymentProviderApi.connectStripe,
|
|
3595
|
+
delete: paymentProviderApi.delete
|
|
3596
|
+
};
|
|
3597
|
+
const workflowPublicApi = {
|
|
3598
|
+
create: workflowApi.createWorkflow,
|
|
3599
|
+
update: workflowApi.updateWorkflow,
|
|
3600
|
+
delete: workflowApi.deleteWorkflow,
|
|
3601
|
+
get: workflowApi.getWorkflow,
|
|
3602
|
+
find: workflowApi.getWorkflows,
|
|
3603
|
+
trigger: workflowApi.triggerWorkflow,
|
|
3604
|
+
getExecutions: workflowApi.getWorkflowExecutions,
|
|
3605
|
+
getExecution: workflowApi.getWorkflowExecution,
|
|
3606
|
+
listAccounts: workflowApi.getWorkflowAccounts,
|
|
3607
|
+
getAccountConnectUrl: workflowApi.getWorkflowAccountConnectUrl,
|
|
3608
|
+
connectAccount: workflowApi.connectWorkflowAccount,
|
|
3609
|
+
deleteAccount: workflowApi.deleteWorkflowAccount
|
|
3610
|
+
};
|
|
2949
3611
|
const formApi = createFormApi(apiConfig);
|
|
2950
3612
|
const taxonomyApi = createTaxonomyApi(apiConfig);
|
|
2951
3613
|
const emailTemplateApi = createEmailTemplateApi(apiConfig);
|
|
2952
3614
|
const analyticsApi = createAnalyticsApi(apiConfig);
|
|
3615
|
+
const experimentsApi = createExperimentsApi(apiConfig);
|
|
2953
3616
|
const sdk = {
|
|
2954
|
-
|
|
2955
|
-
|
|
3617
|
+
account: {
|
|
3618
|
+
update: accountApi.updateAccount,
|
|
3619
|
+
delete: accountApi.deleteAccount,
|
|
3620
|
+
getMe: accountApi.getMe,
|
|
3621
|
+
search: accountApi.searchAccounts,
|
|
3622
|
+
auth: authApi
|
|
3623
|
+
},
|
|
2956
3624
|
store: {
|
|
2957
|
-
|
|
3625
|
+
create: storeApi.createStore,
|
|
3626
|
+
update: storeApi.updateStore,
|
|
3627
|
+
delete: storeApi.deleteStore,
|
|
3628
|
+
get: storeApi.getStore,
|
|
3629
|
+
find: storeApi.getStores,
|
|
3630
|
+
subscription: {
|
|
3631
|
+
getPlans: storeApi.getSubscriptionPlans,
|
|
3632
|
+
subscribe: storeApi.subscribe,
|
|
3633
|
+
createPortalSession: storeApi.createPortalSession
|
|
3634
|
+
},
|
|
3635
|
+
member: {
|
|
3636
|
+
add: storeApi.addMember,
|
|
3637
|
+
invite: storeApi.inviteUser,
|
|
3638
|
+
remove: storeApi.removeMember
|
|
3639
|
+
},
|
|
3640
|
+
buildHook: {
|
|
3641
|
+
list: storeApi.listBuildHooks,
|
|
3642
|
+
create: storeApi.createBuildHook,
|
|
3643
|
+
update: storeApi.updateBuildHook,
|
|
3644
|
+
delete: storeApi.deleteBuildHook
|
|
3645
|
+
},
|
|
3646
|
+
webhook: {
|
|
3647
|
+
test: storeApi.testWebhook,
|
|
3648
|
+
list: storeApi.listWebhooks,
|
|
3649
|
+
create: storeApi.createWebhook,
|
|
3650
|
+
update: storeApi.updateWebhook,
|
|
3651
|
+
delete: storeApi.deleteWebhook
|
|
3652
|
+
},
|
|
3653
|
+
config: {
|
|
3654
|
+
get: storeApi.getStoreConfig
|
|
3655
|
+
},
|
|
3656
|
+
media: {
|
|
3657
|
+
find: storeApi.getStoreMedia
|
|
3658
|
+
},
|
|
2958
3659
|
location: locationApi,
|
|
2959
|
-
market: marketApi
|
|
3660
|
+
market: marketApi,
|
|
3661
|
+
paymentProvider: storePaymentProviderApi
|
|
2960
3662
|
},
|
|
2961
3663
|
media: createMediaApi(apiConfig),
|
|
2962
|
-
notification:
|
|
2963
|
-
|
|
3664
|
+
notification: {
|
|
3665
|
+
email: {
|
|
3666
|
+
trackOpen: notificationApi.trackEmailOpen
|
|
3667
|
+
},
|
|
3668
|
+
trigger: {
|
|
3669
|
+
send: notificationApi.trigger
|
|
3670
|
+
},
|
|
3671
|
+
mailbox: crmApi.mailbox
|
|
3672
|
+
},
|
|
2964
3673
|
platform: platformApi,
|
|
2965
|
-
|
|
3674
|
+
social: {
|
|
3675
|
+
account: {
|
|
3676
|
+
getCapabilities: socialApi.getCapabilities,
|
|
3677
|
+
list: socialApi.listAccounts,
|
|
3678
|
+
connect: socialApi.connect,
|
|
3679
|
+
getOAuthAttempt: socialApi.getOAuthAttempt,
|
|
3680
|
+
selectDestination: socialApi.selectDestination,
|
|
3681
|
+
delete: socialApi.deleteAccount
|
|
3682
|
+
},
|
|
3683
|
+
publication: {
|
|
3684
|
+
create: socialApi.createPublication,
|
|
3685
|
+
update: socialApi.updatePublication,
|
|
3686
|
+
get: socialApi.getPublication,
|
|
3687
|
+
find: socialApi.findPublications,
|
|
3688
|
+
validate: socialApi.validatePublication,
|
|
3689
|
+
schedule: socialApi.schedulePublication,
|
|
3690
|
+
cancel: socialApi.cancelPublication,
|
|
3691
|
+
getComments: socialApi.getPublicationComments,
|
|
3692
|
+
syncComments: socialApi.syncPublicationComments,
|
|
3693
|
+
getCommentThread: socialApi.getPublicationCommentThread,
|
|
3694
|
+
syncCommentThread: socialApi.syncPublicationCommentThread,
|
|
3695
|
+
findComments: socialApi.findPublicationComments,
|
|
3696
|
+
classifyComments: socialApi.classifyPublicationComments,
|
|
3697
|
+
replyToComment: socialApi.replyToPublicationComment,
|
|
3698
|
+
getMetrics: socialApi.getPublicationMetrics,
|
|
3699
|
+
syncMetrics: socialApi.syncPublicationMetrics,
|
|
3700
|
+
syncEngagement: socialApi.syncEngagement
|
|
3701
|
+
}
|
|
3702
|
+
},
|
|
2966
3703
|
cms: {
|
|
2967
|
-
|
|
2968
|
-
create: cmsApi.
|
|
2969
|
-
update: cmsApi.
|
|
2970
|
-
delete: cmsApi.
|
|
2971
|
-
get: cmsApi.
|
|
2972
|
-
find: cmsApi.
|
|
2973
|
-
|
|
3704
|
+
collection: {
|
|
3705
|
+
create: cmsApi.createCollection,
|
|
3706
|
+
update: cmsApi.updateCollection,
|
|
3707
|
+
delete: cmsApi.deleteCollection,
|
|
3708
|
+
get: cmsApi.getCollection,
|
|
3709
|
+
find: cmsApi.getCollections
|
|
3710
|
+
},
|
|
3711
|
+
entry: {
|
|
3712
|
+
create: cmsApi.createEntry,
|
|
3713
|
+
update: cmsApi.updateEntry,
|
|
3714
|
+
delete: cmsApi.deleteEntry,
|
|
3715
|
+
get: cmsApi.getEntry,
|
|
3716
|
+
find: cmsApi.getEntries
|
|
2974
3717
|
},
|
|
2975
3718
|
form: {
|
|
2976
3719
|
create: formApi.createForm,
|
|
@@ -2996,7 +3739,8 @@ function createAdmin(config) {
|
|
|
2996
3739
|
update: emailTemplateApi.updateEmailTemplate,
|
|
2997
3740
|
delete: emailTemplateApi.deleteEmailTemplate,
|
|
2998
3741
|
get: emailTemplateApi.getEmailTemplate,
|
|
2999
|
-
find: emailTemplateApi.getEmailTemplates
|
|
3742
|
+
find: emailTemplateApi.getEmailTemplates,
|
|
3743
|
+
preview: emailTemplateApi.previewEmailTemplate
|
|
3000
3744
|
}
|
|
3001
3745
|
},
|
|
3002
3746
|
eshop: {
|
|
@@ -3012,7 +3756,10 @@ function createAdmin(config) {
|
|
|
3012
3756
|
get: eshopApi.getOrder,
|
|
3013
3757
|
find: eshopApi.getOrders,
|
|
3014
3758
|
getQuote: eshopApi.getQuote,
|
|
3015
|
-
processRefund: eshopApi.processRefund
|
|
3759
|
+
processRefund: eshopApi.processRefund,
|
|
3760
|
+
downloadDigitalAccess: eshopApi.downloadDigitalAccess,
|
|
3761
|
+
getShippingRates: shippingApi.getRates,
|
|
3762
|
+
ship: shippingApi.ship
|
|
3016
3763
|
},
|
|
3017
3764
|
cart: {
|
|
3018
3765
|
create: eshopApi.createCart,
|
|
@@ -3047,53 +3794,55 @@ function createAdmin(config) {
|
|
|
3047
3794
|
promoCode: promoCodeApi
|
|
3048
3795
|
},
|
|
3049
3796
|
crm: {
|
|
3050
|
-
|
|
3797
|
+
contact: {
|
|
3051
3798
|
create: crmApi.create,
|
|
3052
3799
|
get: crmApi.get,
|
|
3053
3800
|
find: crmApi.find,
|
|
3054
3801
|
update: crmApi.update,
|
|
3055
3802
|
merge: crmApi.merge,
|
|
3803
|
+
import: crmApi.import,
|
|
3056
3804
|
revokeToken: crmApi.revokeToken,
|
|
3057
3805
|
revokeAllTokens: crmApi.revokeAllTokens
|
|
3058
3806
|
},
|
|
3059
|
-
|
|
3060
|
-
create: crmApi.
|
|
3061
|
-
update: crmApi.
|
|
3062
|
-
get: crmApi.
|
|
3063
|
-
find: crmApi.
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3807
|
+
contactList: {
|
|
3808
|
+
create: crmApi.contactList.create,
|
|
3809
|
+
update: crmApi.contactList.update,
|
|
3810
|
+
get: crmApi.contactList.get,
|
|
3811
|
+
find: crmApi.contactList.find,
|
|
3812
|
+
importContacts: crmApi.contactList.importContacts,
|
|
3813
|
+
previewImportContacts: crmApi.contactList.previewImportContacts,
|
|
3814
|
+
addMember: crmApi.contactList.members.add,
|
|
3815
|
+
updateMember: crmApi.contactList.members.update,
|
|
3816
|
+
removeMember: crmApi.contactList.members.remove,
|
|
3817
|
+
findMembers: crmApi.contactList.members.find
|
|
3067
3818
|
},
|
|
3068
|
-
|
|
3819
|
+
action: crmApi.action
|
|
3820
|
+
},
|
|
3821
|
+
outreach: {
|
|
3822
|
+
campaign: crmApi.campaign,
|
|
3823
|
+
campaignEnrollment: crmApi.campaignEnrollment,
|
|
3824
|
+
campaignMessage: crmApi.campaignMessage,
|
|
3825
|
+
suppression: crmApi.suppression,
|
|
3826
|
+
leadResearch: leadResearchApi
|
|
3069
3827
|
},
|
|
3070
3828
|
automation: {
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
},
|
|
3085
|
-
workflow: {
|
|
3086
|
-
create: workflowApi.createWorkflow,
|
|
3087
|
-
update: workflowApi.updateWorkflow,
|
|
3088
|
-
delete: workflowApi.deleteWorkflow,
|
|
3089
|
-
get: workflowApi.getWorkflow,
|
|
3090
|
-
find: workflowApi.getWorkflows,
|
|
3091
|
-
trigger: workflowApi.triggerWorkflow,
|
|
3092
|
-
getExecutions: workflowApi.getWorkflowExecutions,
|
|
3093
|
-
getExecution: workflowApi.getWorkflowExecution
|
|
3829
|
+
workflow: workflowPublicApi,
|
|
3830
|
+
support: {
|
|
3831
|
+
createAgent: supportApi.agent.create,
|
|
3832
|
+
getAgent: supportApi.agent.get,
|
|
3833
|
+
findAgents: supportApi.agent.find,
|
|
3834
|
+
updateAgent: supportApi.agent.update,
|
|
3835
|
+
deleteAgent: supportApi.agent.delete,
|
|
3836
|
+
findConversations: supportApi.conversation.find,
|
|
3837
|
+
getConversation: supportApi.conversation.get,
|
|
3838
|
+
sendConversationMessage: supportApi.conversation.sendMessage,
|
|
3839
|
+
replyToConversation: supportApi.conversation.reply,
|
|
3840
|
+
resolveConversation: supportApi.conversation.resolve,
|
|
3841
|
+
assignConversation: supportApi.conversation.assign
|
|
3094
3842
|
}
|
|
3095
3843
|
},
|
|
3096
3844
|
analytics: analyticsApi,
|
|
3845
|
+
experiments: experimentsApi,
|
|
3097
3846
|
setStoreId: (storeId) => {
|
|
3098
3847
|
apiConfig.storeId = storeId;
|
|
3099
3848
|
},
|
|
@@ -3129,27 +3878,26 @@ function createAdmin(config) {
|
|
|
3129
3878
|
if (config.apiToken) return;
|
|
3130
3879
|
updateSession(() => null);
|
|
3131
3880
|
},
|
|
3132
|
-
extractBlockValues,
|
|
3133
3881
|
utils: createUtilitySurface(apiConfig)
|
|
3134
3882
|
};
|
|
3135
3883
|
return sdk;
|
|
3136
3884
|
}
|
|
3137
|
-
var
|
|
3138
|
-
function
|
|
3885
|
+
var CONTACT_STORAGE_KEY = "arky_contact_session";
|
|
3886
|
+
function readContactSession() {
|
|
3139
3887
|
if (typeof window === "undefined") return null;
|
|
3140
3888
|
try {
|
|
3141
|
-
const raw = localStorage.getItem(
|
|
3889
|
+
const raw = localStorage.getItem(CONTACT_STORAGE_KEY);
|
|
3142
3890
|
return raw ? JSON.parse(raw) : null;
|
|
3143
3891
|
} catch {
|
|
3144
3892
|
return null;
|
|
3145
3893
|
}
|
|
3146
3894
|
}
|
|
3147
|
-
function
|
|
3895
|
+
function writeContactSession(s) {
|
|
3148
3896
|
if (typeof window === "undefined") return;
|
|
3149
3897
|
if (s) {
|
|
3150
|
-
localStorage.setItem(
|
|
3898
|
+
localStorage.setItem(CONTACT_STORAGE_KEY, JSON.stringify(s));
|
|
3151
3899
|
} else {
|
|
3152
|
-
localStorage.removeItem(
|
|
3900
|
+
localStorage.removeItem(CONTACT_STORAGE_KEY);
|
|
3153
3901
|
}
|
|
3154
3902
|
}
|
|
3155
3903
|
function createStorefront(config) {
|
|
@@ -3158,10 +3906,10 @@ function createStorefront(config) {
|
|
|
3158
3906
|
const listeners = /* @__PURE__ */ new Set();
|
|
3159
3907
|
let bareIdentifyPromise = null;
|
|
3160
3908
|
function toPublic(s) {
|
|
3161
|
-
return s ? {
|
|
3909
|
+
return s ? { contact: s.contact, store: s.store, market: s.market } : null;
|
|
3162
3910
|
}
|
|
3163
3911
|
function emit() {
|
|
3164
|
-
const pub = toPublic(
|
|
3912
|
+
const pub = toPublic(readContactSession());
|
|
3165
3913
|
for (const l of listeners) {
|
|
3166
3914
|
Promise.resolve().then(() => l(pub)).catch(() => {
|
|
3167
3915
|
});
|
|
@@ -3169,9 +3917,9 @@ function createStorefront(config) {
|
|
|
3169
3917
|
}
|
|
3170
3918
|
const updateSession = (updater) => {
|
|
3171
3919
|
if (config.apiToken) return;
|
|
3172
|
-
const prev =
|
|
3920
|
+
const prev = readContactSession();
|
|
3173
3921
|
const next = updater(prev);
|
|
3174
|
-
|
|
3922
|
+
writeContactSession(next);
|
|
3175
3923
|
emit();
|
|
3176
3924
|
};
|
|
3177
3925
|
const authStorage = config.apiToken ? {
|
|
@@ -3182,7 +3930,7 @@ function createStorefront(config) {
|
|
|
3182
3930
|
}
|
|
3183
3931
|
} : {
|
|
3184
3932
|
getTokens() {
|
|
3185
|
-
const s =
|
|
3933
|
+
const s = readContactSession();
|
|
3186
3934
|
return s ? { access_token: s.access_token } : null;
|
|
3187
3935
|
},
|
|
3188
3936
|
onTokensRefreshed() {
|
|
@@ -3209,20 +3957,20 @@ function createStorefront(config) {
|
|
|
3209
3957
|
authStorage
|
|
3210
3958
|
};
|
|
3211
3959
|
const storefrontApi = createStorefrontApi(apiConfig, updateSession);
|
|
3212
|
-
const
|
|
3960
|
+
const contactApi = storefrontApi.crm.contact;
|
|
3213
3961
|
function identify(params) {
|
|
3214
3962
|
if (params?.market !== void 0) apiConfig.market = params.market;
|
|
3215
3963
|
const isBareCall = !params?.email && !params?.verify;
|
|
3216
3964
|
if (isBareCall && bareIdentifyPromise) return bareIdentifyPromise;
|
|
3217
3965
|
const promise = (async () => {
|
|
3218
3966
|
try {
|
|
3219
|
-
const result = await
|
|
3967
|
+
const result = await contactApi.identify({
|
|
3220
3968
|
market: apiConfig.market,
|
|
3221
3969
|
email: params?.email,
|
|
3222
3970
|
verify: params?.verify
|
|
3223
3971
|
});
|
|
3224
3972
|
return {
|
|
3225
|
-
|
|
3973
|
+
contact: result.contact,
|
|
3226
3974
|
store: result.store,
|
|
3227
3975
|
market: result.market
|
|
3228
3976
|
};
|
|
@@ -3231,9 +3979,11 @@ function createStorefront(config) {
|
|
|
3231
3979
|
const status = e?.statusCode || e?.status || e?.response?.status;
|
|
3232
3980
|
if (isBareCall && status === 401) {
|
|
3233
3981
|
updateSession(() => null);
|
|
3234
|
-
const result = await
|
|
3982
|
+
const result = await contactApi.identify({
|
|
3983
|
+
market: apiConfig.market
|
|
3984
|
+
});
|
|
3235
3985
|
return {
|
|
3236
|
-
|
|
3986
|
+
contact: result.contact,
|
|
3237
3987
|
store: result.store,
|
|
3238
3988
|
market: result.market
|
|
3239
3989
|
};
|
|
@@ -3248,7 +3998,7 @@ function createStorefront(config) {
|
|
|
3248
3998
|
return promise;
|
|
3249
3999
|
}
|
|
3250
4000
|
async function verify(params) {
|
|
3251
|
-
const result = await
|
|
4001
|
+
const result = await contactApi.verify(params);
|
|
3252
4002
|
bareIdentifyPromise = null;
|
|
3253
4003
|
return result;
|
|
3254
4004
|
}
|
|
@@ -3256,7 +4006,7 @@ function createStorefront(config) {
|
|
|
3256
4006
|
if (config.apiToken) return;
|
|
3257
4007
|
bareIdentifyPromise = null;
|
|
3258
4008
|
try {
|
|
3259
|
-
await
|
|
4009
|
+
await contactApi.logout();
|
|
3260
4010
|
} catch {
|
|
3261
4011
|
updateSession(() => null);
|
|
3262
4012
|
}
|
|
@@ -3265,19 +4015,19 @@ function createStorefront(config) {
|
|
|
3265
4015
|
identify,
|
|
3266
4016
|
verify,
|
|
3267
4017
|
logout,
|
|
3268
|
-
me: () =>
|
|
4018
|
+
me: () => contactApi.getMe(),
|
|
3269
4019
|
get session() {
|
|
3270
4020
|
if (config.apiToken) return null;
|
|
3271
|
-
return toPublic(
|
|
4021
|
+
return toPublic(readContactSession());
|
|
3272
4022
|
},
|
|
3273
4023
|
get isAuthenticated() {
|
|
3274
4024
|
if (config.apiToken) return true;
|
|
3275
|
-
const s =
|
|
4025
|
+
const s = readContactSession();
|
|
3276
4026
|
return s !== null && !!s.access_token;
|
|
3277
4027
|
},
|
|
3278
4028
|
onAuthStateChanged(listener) {
|
|
3279
4029
|
listeners.add(listener);
|
|
3280
|
-
const current = toPublic(
|
|
4030
|
+
const current = toPublic(readContactSession());
|
|
3281
4031
|
if (current) {
|
|
3282
4032
|
Promise.resolve().then(() => listener(current)).catch(() => {
|
|
3283
4033
|
});
|
|
@@ -3291,8 +4041,9 @@ function createStorefront(config) {
|
|
|
3291
4041
|
cms: storefrontApi.cms,
|
|
3292
4042
|
eshop: storefrontApi.eshop,
|
|
3293
4043
|
crm: storefrontApi.crm,
|
|
3294
|
-
|
|
3295
|
-
|
|
4044
|
+
action: storefrontApi.action,
|
|
4045
|
+
experiments: storefrontApi.experiments,
|
|
4046
|
+
support: createStorefrontSupportApi(apiConfig),
|
|
3296
4047
|
setStoreId: (storeId) => {
|
|
3297
4048
|
apiConfig.storeId = storeId;
|
|
3298
4049
|
bareIdentifyPromise = null;
|
|
@@ -3307,12 +4058,11 @@ function createStorefront(config) {
|
|
|
3307
4058
|
apiConfig.locale = l;
|
|
3308
4059
|
},
|
|
3309
4060
|
getLocale: () => apiConfig.locale,
|
|
3310
|
-
extractBlockValues,
|
|
3311
4061
|
utils: createUtilitySurface(apiConfig)
|
|
3312
4062
|
};
|
|
3313
4063
|
}
|
|
3314
4064
|
|
|
3315
|
-
exports.
|
|
4065
|
+
exports.COMMON_ACTION_KEYS = COMMON_ACTION_KEYS;
|
|
3316
4066
|
exports.PaymentMethodType = PaymentMethodType;
|
|
3317
4067
|
exports.SDK_VERSION = SDK_VERSION;
|
|
3318
4068
|
exports.SUPPORTED_FRAMEWORKS = SUPPORTED_FRAMEWORKS;
|