arky-sdk 0.9.6 → 0.9.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -194
- package/dist/admin-D8HiRDCl.d.cts +1536 -0
- package/dist/admin-Dnnv18wN.d.ts +1536 -0
- package/dist/admin.cjs +832 -375
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +3 -3
- package/dist/admin.d.ts +3 -3
- package/dist/admin.js +832 -375
- package/dist/admin.js.map +1 -1
- package/dist/api-D4lMmvF0.d.cts +4337 -0
- package/dist/api-D4lMmvF0.d.ts +4337 -0
- package/dist/{index-nCF3Z6Af.d.cts → index-BS2x278C.d.cts} +1 -1
- package/dist/{index-CZxubTDA.d.ts → index-Be8suRwP.d.ts} +1 -1
- package/dist/index.cjs +934 -460
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +934 -460
- package/dist/index.js.map +1 -1
- package/dist/storefront.cjs +501 -300
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.d.cts +174 -89
- package/dist/storefront.d.ts +174 -89
- package/dist/storefront.js +499 -299
- package/dist/storefront.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +7 -10
- package/scripts/contract-admin.mjs +137 -0
- package/scripts/contract-storefront.mjs +296 -0
- package/dist/admin-DjYydKeB.d.ts +0 -1389
- package/dist/admin-DlL8mCxL.d.cts +0 -1389
- package/dist/api-BbBHcd4p.d.cts +0 -3289
- package/dist/api-BbBHcd4p.d.ts +0 -3289
- package/dist/storefront-store.cjs +0 -2809
- package/dist/storefront-store.cjs.map +0 -1
- package/dist/storefront-store.d.cts +0 -5
- package/dist/storefront-store.d.ts +0 -5
- package/dist/storefront-store.js +0 -2807
- package/dist/storefront-store.js.map +0 -1
- package/scripts/smoke-store.mjs +0 -41
package/dist/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, updateProfileSession) => {
|
|
|
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, updateProfileSession) => {
|
|
|
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, updateProfileSession) => {
|
|
|
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, updateProfileSession) => {
|
|
|
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, updateProfileSession) => {
|
|
|
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, updateProfileSession) => {
|
|
|
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,29 +424,29 @@ var createStorefrontApi = (apiConfig, updateProfileSession) => {
|
|
|
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
441
|
const store_id = params.store_id || apiConfig.storeId;
|
|
573
442
|
return apiConfig.httpClient.get(
|
|
574
|
-
`${base(store_id)}/
|
|
443
|
+
`${base(store_id)}/contact-lists/${params.id}`,
|
|
575
444
|
options
|
|
576
445
|
);
|
|
577
446
|
},
|
|
578
447
|
find(params, options) {
|
|
579
448
|
const { store_id, ...queryParams } = params || {};
|
|
580
|
-
return apiConfig.httpClient.get(`${base(store_id)}/
|
|
449
|
+
return apiConfig.httpClient.get(`${base(store_id)}/contact-lists`, {
|
|
581
450
|
...options,
|
|
582
451
|
params: queryParams
|
|
583
452
|
});
|
|
@@ -585,7 +454,7 @@ var createStorefrontApi = (apiConfig, updateProfileSession) => {
|
|
|
585
454
|
subscribe(params, options) {
|
|
586
455
|
const { store_id, id, ...payload } = params;
|
|
587
456
|
return apiConfig.httpClient.post(
|
|
588
|
-
`${base(store_id)}/
|
|
457
|
+
`${base(store_id)}/contact-lists/${id}/subscribe`,
|
|
589
458
|
payload,
|
|
590
459
|
options
|
|
591
460
|
);
|
|
@@ -593,25 +462,45 @@ var createStorefrontApi = (apiConfig, updateProfileSession) => {
|
|
|
593
462
|
checkAccess(params, options) {
|
|
594
463
|
const store_id = params.store_id || apiConfig.storeId;
|
|
595
464
|
return apiConfig.httpClient.get(
|
|
596
|
-
`${base(store_id)}/
|
|
465
|
+
`${base(store_id)}/contact-lists/${params.id}/access`,
|
|
466
|
+
options
|
|
467
|
+
);
|
|
468
|
+
},
|
|
469
|
+
checkContentAccess(params, options) {
|
|
470
|
+
const { store_id, ...payload } = params;
|
|
471
|
+
return apiConfig.httpClient.post(
|
|
472
|
+
`${base(store_id)}/contact-lists/access`,
|
|
473
|
+
payload,
|
|
597
474
|
options
|
|
598
475
|
);
|
|
599
476
|
},
|
|
600
477
|
unsubscribe(token, options) {
|
|
601
|
-
return apiConfig.httpClient.
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
478
|
+
return apiConfig.httpClient.post(
|
|
479
|
+
`${base()}/contact-lists/unsubscribe`,
|
|
480
|
+
{ token },
|
|
481
|
+
options
|
|
482
|
+
);
|
|
605
483
|
},
|
|
606
484
|
confirm(token, options) {
|
|
607
|
-
return apiConfig.httpClient.
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
485
|
+
return apiConfig.httpClient.post(
|
|
486
|
+
`${base()}/contact-lists/confirm`,
|
|
487
|
+
{ token },
|
|
488
|
+
options
|
|
489
|
+
);
|
|
611
490
|
}
|
|
612
491
|
}
|
|
613
492
|
},
|
|
614
|
-
|
|
493
|
+
action: createActionApi(apiConfig),
|
|
494
|
+
experiments: {
|
|
495
|
+
use(params, options) {
|
|
496
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
497
|
+
return apiConfig.httpClient.post(
|
|
498
|
+
`${base(store_id)}/experiments/use`,
|
|
499
|
+
{ key: params.key },
|
|
500
|
+
options
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
615
504
|
};
|
|
616
505
|
};
|
|
617
506
|
|
|
@@ -836,7 +725,7 @@ function createHttpClient(cfg) {
|
|
|
836
725
|
headers["Authorization"] = `Bearer ${tokens.access_token}`;
|
|
837
726
|
}
|
|
838
727
|
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
839
|
-
const fetchOpts = { method, headers };
|
|
728
|
+
const fetchOpts = { method, headers, signal: options?.signal };
|
|
840
729
|
if (!["GET", "DELETE"].includes(method) && body !== void 0) {
|
|
841
730
|
fetchOpts.body = JSON.stringify(body);
|
|
842
731
|
}
|
|
@@ -847,13 +736,15 @@ function createHttpClient(cfg) {
|
|
|
847
736
|
try {
|
|
848
737
|
res = await fetch(fullUrl, fetchOpts);
|
|
849
738
|
} catch (error) {
|
|
739
|
+
const aborted = options?.signal?.aborted || error instanceof Error && error.name === "AbortError";
|
|
850
740
|
const err = new Error(error instanceof Error ? error.message : "Network request failed");
|
|
851
|
-
err.name = "NetworkError";
|
|
741
|
+
err.name = aborted ? "AbortError" : "NetworkError";
|
|
852
742
|
err.method = method;
|
|
853
743
|
err.url = fullUrl;
|
|
744
|
+
err.aborted = aborted;
|
|
854
745
|
if (options?.onError && method !== "GET") {
|
|
855
746
|
Promise.resolve(
|
|
856
|
-
options.onError({ error: err, method, url: fullUrl, aborted
|
|
747
|
+
options.onError({ error: err, method, url: fullUrl, aborted })
|
|
857
748
|
).catch(() => {
|
|
858
749
|
});
|
|
859
750
|
}
|
|
@@ -1016,9 +907,6 @@ var createAuthApi = (apiConfig, updateSession) => {
|
|
|
1016
907
|
applyAuthToken(result, params.email);
|
|
1017
908
|
}
|
|
1018
909
|
return result;
|
|
1019
|
-
},
|
|
1020
|
-
async magicLink(params, options) {
|
|
1021
|
-
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
1022
910
|
}
|
|
1023
911
|
};
|
|
1024
912
|
};
|
|
@@ -1055,14 +943,17 @@ var createStoreApi = (apiConfig, _updateSession) => {
|
|
|
1055
943
|
});
|
|
1056
944
|
},
|
|
1057
945
|
async getSubscriptionPlans(_params, options) {
|
|
1058
|
-
return apiConfig.httpClient.get(
|
|
946
|
+
return apiConfig.httpClient.get(
|
|
947
|
+
"/v1/stores/plans",
|
|
948
|
+
options
|
|
949
|
+
);
|
|
1059
950
|
},
|
|
1060
951
|
async subscribe(params, options) {
|
|
1061
|
-
const { store_id, plan_id, success_url, cancel_url } = params;
|
|
952
|
+
const { store_id, plan_id, action, success_url, cancel_url } = params;
|
|
1062
953
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1063
954
|
return apiConfig.httpClient.put(
|
|
1064
955
|
`/v1/stores/${target_store_id}/subscribe`,
|
|
1065
|
-
{ plan_id, success_url, cancel_url },
|
|
956
|
+
{ plan_id, action, success_url, cancel_url },
|
|
1066
957
|
options
|
|
1067
958
|
);
|
|
1068
959
|
},
|
|
@@ -1108,61 +999,52 @@ var createStoreApi = (apiConfig, _updateSession) => {
|
|
|
1108
999
|
limit: params.limit
|
|
1109
1000
|
};
|
|
1110
1001
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1111
|
-
if (params.ids && params.ids.length > 0)
|
|
1002
|
+
if (params.ids && params.ids.length > 0)
|
|
1003
|
+
queryParams.ids = JSON.stringify(params.ids);
|
|
1112
1004
|
if (params.query) queryParams.query = params.query;
|
|
1113
1005
|
if (params.mime_type) queryParams.mime_type = params.mime_type;
|
|
1114
1006
|
if (params.sort_field) queryParams.sort_field = params.sort_field;
|
|
1115
|
-
if (params.sort_direction)
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
params
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
`/v1/stores/${params.store_id}/oauth/connect`,
|
|
1124
|
-
{ provider: params.provider, code: params.code, redirect_uri: params.redirect_uri },
|
|
1125
|
-
options
|
|
1126
|
-
);
|
|
1127
|
-
},
|
|
1128
|
-
async oauthDisconnect(params, options) {
|
|
1129
|
-
return apiConfig.httpClient.post(
|
|
1130
|
-
`/v1/stores/${params.store_id}/oauth/disconnect`,
|
|
1131
|
-
{ provider: params.provider },
|
|
1132
|
-
options
|
|
1007
|
+
if (params.sort_direction)
|
|
1008
|
+
queryParams.sort_direction = params.sort_direction;
|
|
1009
|
+
return apiConfig.httpClient.get(
|
|
1010
|
+
`/v1/stores/${params.id}/media`,
|
|
1011
|
+
{
|
|
1012
|
+
...options,
|
|
1013
|
+
params: queryParams
|
|
1014
|
+
}
|
|
1133
1015
|
);
|
|
1134
1016
|
},
|
|
1135
|
-
async
|
|
1017
|
+
async listBuildHooks(params, options) {
|
|
1136
1018
|
return apiConfig.httpClient.get(
|
|
1137
|
-
`/v1/stores/${params.store_id}/
|
|
1019
|
+
`/v1/stores/${params.store_id}/build-hooks`,
|
|
1138
1020
|
options
|
|
1139
1021
|
);
|
|
1140
1022
|
},
|
|
1141
|
-
async
|
|
1023
|
+
async createBuildHook(params, options) {
|
|
1142
1024
|
const { store_id, ...payload } = params;
|
|
1143
1025
|
return apiConfig.httpClient.post(
|
|
1144
|
-
`/v1/stores/${store_id}/
|
|
1026
|
+
`/v1/stores/${store_id}/build-hooks`,
|
|
1145
1027
|
payload,
|
|
1146
1028
|
options
|
|
1147
1029
|
);
|
|
1148
1030
|
},
|
|
1149
|
-
async
|
|
1031
|
+
async updateBuildHook(params, options) {
|
|
1150
1032
|
const { store_id, id, ...payload } = params;
|
|
1151
1033
|
return apiConfig.httpClient.put(
|
|
1152
|
-
`/v1/stores/${store_id}/
|
|
1034
|
+
`/v1/stores/${store_id}/build-hooks/${id}`,
|
|
1153
1035
|
payload,
|
|
1154
1036
|
options
|
|
1155
1037
|
);
|
|
1156
1038
|
},
|
|
1157
|
-
async
|
|
1039
|
+
async deleteBuildHook(params, options) {
|
|
1158
1040
|
return apiConfig.httpClient.delete(
|
|
1159
|
-
`/v1/stores/${params.store_id}/
|
|
1041
|
+
`/v1/stores/${params.store_id}/build-hooks/${params.id}`,
|
|
1160
1042
|
options
|
|
1161
1043
|
);
|
|
1162
1044
|
},
|
|
1163
|
-
async
|
|
1045
|
+
async getStoreConfig(params, options) {
|
|
1164
1046
|
return apiConfig.httpClient.get(
|
|
1165
|
-
`/v1/stores/${params.store_id}/
|
|
1047
|
+
`/v1/stores/${params.store_id}/config/${params.type}`,
|
|
1166
1048
|
options
|
|
1167
1049
|
);
|
|
1168
1050
|
},
|
|
@@ -1207,7 +1089,7 @@ var createMediaApi = (apiConfig) => {
|
|
|
1207
1089
|
options
|
|
1208
1090
|
);
|
|
1209
1091
|
},
|
|
1210
|
-
async uploadStoreMedia(params,
|
|
1092
|
+
async uploadStoreMedia(params, options) {
|
|
1211
1093
|
const { store_id, files = [], urls = [] } = params;
|
|
1212
1094
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1213
1095
|
const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
|
|
@@ -1220,7 +1102,8 @@ var createMediaApi = (apiConfig) => {
|
|
|
1220
1102
|
body: formData,
|
|
1221
1103
|
headers: {
|
|
1222
1104
|
Authorization: `Bearer ${tokens?.access_token || ""}`
|
|
1223
|
-
}
|
|
1105
|
+
},
|
|
1106
|
+
signal: options?.signal
|
|
1224
1107
|
});
|
|
1225
1108
|
if (!response.ok) {
|
|
1226
1109
|
throw new Error("Upload failed, server said no");
|
|
@@ -1234,7 +1117,7 @@ var createMediaApi = (apiConfig) => {
|
|
|
1234
1117
|
options
|
|
1235
1118
|
);
|
|
1236
1119
|
},
|
|
1237
|
-
async getStoreMedia(params,
|
|
1120
|
+
async getStoreMedia(params, options) {
|
|
1238
1121
|
const { store_id, cursor, limit, ids, query, mime_type, sort_field, sort_direction } = params;
|
|
1239
1122
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1240
1123
|
const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
|
|
@@ -1250,7 +1133,8 @@ var createMediaApi = (apiConfig) => {
|
|
|
1250
1133
|
const response = await fetch(`${url}?${queryString}`, {
|
|
1251
1134
|
headers: {
|
|
1252
1135
|
Authorization: `Bearer ${tokens?.access_token || ""}`
|
|
1253
|
-
}
|
|
1136
|
+
},
|
|
1137
|
+
signal: options?.signal
|
|
1254
1138
|
});
|
|
1255
1139
|
if (!response.ok) {
|
|
1256
1140
|
const errorData = await response.json().catch(() => null);
|
|
@@ -1338,77 +1222,97 @@ var createPromoCodeApi = (apiConfig) => {
|
|
|
1338
1222
|
// src/api/cms.ts
|
|
1339
1223
|
var createCmsApi = (apiConfig) => {
|
|
1340
1224
|
return {
|
|
1341
|
-
async
|
|
1225
|
+
async createCollection(params, options) {
|
|
1342
1226
|
const { store_id, ...payload } = params;
|
|
1343
1227
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1344
1228
|
return apiConfig.httpClient.post(
|
|
1345
|
-
`/v1/stores/${target_store_id}/
|
|
1229
|
+
`/v1/stores/${target_store_id}/collections`,
|
|
1346
1230
|
payload,
|
|
1347
1231
|
options
|
|
1348
1232
|
);
|
|
1349
1233
|
},
|
|
1350
|
-
async
|
|
1234
|
+
async updateCollection(params, options) {
|
|
1351
1235
|
const { store_id, ...payload } = params;
|
|
1352
1236
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1353
1237
|
return apiConfig.httpClient.put(
|
|
1354
|
-
`/v1/stores/${target_store_id}/
|
|
1238
|
+
`/v1/stores/${target_store_id}/collections/${params.id}`,
|
|
1355
1239
|
payload,
|
|
1356
1240
|
options
|
|
1357
1241
|
);
|
|
1358
1242
|
},
|
|
1359
|
-
async
|
|
1243
|
+
async deleteCollection(params, options) {
|
|
1360
1244
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1361
1245
|
return apiConfig.httpClient.delete(
|
|
1362
|
-
`/v1/stores/${target_store_id}/
|
|
1246
|
+
`/v1/stores/${target_store_id}/collections/${params.id}`,
|
|
1363
1247
|
options
|
|
1364
1248
|
);
|
|
1365
1249
|
},
|
|
1366
|
-
async
|
|
1250
|
+
async getCollection(params, options) {
|
|
1367
1251
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1368
1252
|
let identifier;
|
|
1369
1253
|
if (params.id) {
|
|
1370
1254
|
identifier = params.id;
|
|
1371
|
-
} else if (params.slug) {
|
|
1372
|
-
identifier = `${target_store_id}:${apiConfig.locale}:${params.slug}`;
|
|
1373
1255
|
} else if (params.key) {
|
|
1374
1256
|
identifier = `${target_store_id}:${params.key}`;
|
|
1375
1257
|
} else {
|
|
1376
|
-
throw new Error("
|
|
1258
|
+
throw new Error("GetCollectionParams requires id or key");
|
|
1377
1259
|
}
|
|
1378
|
-
|
|
1379
|
-
`/v1/stores/${target_store_id}/
|
|
1260
|
+
return apiConfig.httpClient.get(
|
|
1261
|
+
`/v1/stores/${target_store_id}/collections/${identifier}`,
|
|
1380
1262
|
options
|
|
1381
1263
|
);
|
|
1382
|
-
return {
|
|
1383
|
-
...response,
|
|
1384
|
-
getBlock(key) {
|
|
1385
|
-
return getBlockFromArray(response, key, apiConfig.locale);
|
|
1386
|
-
},
|
|
1387
|
-
getBlockValues(key) {
|
|
1388
|
-
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
1389
|
-
},
|
|
1390
|
-
getImage(key) {
|
|
1391
|
-
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
1392
|
-
return getImageUrl(block, true);
|
|
1393
|
-
}
|
|
1394
|
-
};
|
|
1395
1264
|
},
|
|
1396
|
-
async
|
|
1265
|
+
async getCollections(params = {}, options) {
|
|
1397
1266
|
const { store_id, ...queryParams } = params;
|
|
1398
1267
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1399
1268
|
return apiConfig.httpClient.get(
|
|
1400
|
-
`/v1/stores/${target_store_id}/
|
|
1269
|
+
`/v1/stores/${target_store_id}/collections`,
|
|
1401
1270
|
{
|
|
1402
1271
|
...options,
|
|
1403
1272
|
params: queryParams
|
|
1404
1273
|
}
|
|
1405
1274
|
);
|
|
1406
1275
|
},
|
|
1407
|
-
async
|
|
1408
|
-
const {
|
|
1276
|
+
async createEntry(params, options) {
|
|
1277
|
+
const { store_id, ...payload } = params;
|
|
1278
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1279
|
+
return apiConfig.httpClient.post(
|
|
1280
|
+
`/v1/stores/${target_store_id}/entries`,
|
|
1281
|
+
payload,
|
|
1282
|
+
options
|
|
1283
|
+
);
|
|
1284
|
+
},
|
|
1285
|
+
async updateEntry(params, options) {
|
|
1286
|
+
const { store_id, ...payload } = params;
|
|
1287
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1288
|
+
return apiConfig.httpClient.put(
|
|
1289
|
+
`/v1/stores/${target_store_id}/entries/${params.id}`,
|
|
1290
|
+
payload,
|
|
1291
|
+
options
|
|
1292
|
+
);
|
|
1293
|
+
},
|
|
1294
|
+
async deleteEntry(params, options) {
|
|
1295
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1296
|
+
return apiConfig.httpClient.delete(
|
|
1297
|
+
`/v1/stores/${target_store_id}/entries/${params.id}`,
|
|
1298
|
+
options
|
|
1299
|
+
);
|
|
1300
|
+
},
|
|
1301
|
+
async getEntry(params, options) {
|
|
1302
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1303
|
+
if (!params.id) {
|
|
1304
|
+
throw new Error("GetEntryParams requires id");
|
|
1305
|
+
}
|
|
1306
|
+
return apiConfig.httpClient.get(
|
|
1307
|
+
`/v1/stores/${target_store_id}/entries/${params.id}`,
|
|
1308
|
+
options
|
|
1309
|
+
);
|
|
1310
|
+
},
|
|
1311
|
+
async getEntries(params, options) {
|
|
1312
|
+
const { store_id, ...queryParams } = params;
|
|
1409
1313
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1410
1314
|
return apiConfig.httpClient.get(
|
|
1411
|
-
`/v1/stores/${target_store_id}/
|
|
1315
|
+
`/v1/stores/${target_store_id}/entries`,
|
|
1412
1316
|
{
|
|
1413
1317
|
...options,
|
|
1414
1318
|
params: queryParams
|
|
@@ -1419,13 +1323,6 @@ var createCmsApi = (apiConfig) => {
|
|
|
1419
1323
|
};
|
|
1420
1324
|
|
|
1421
1325
|
// src/api/eshop.ts
|
|
1422
|
-
var normalizeTaxonomyAliases = (payload) => {
|
|
1423
|
-
const { filters, ...rest } = payload;
|
|
1424
|
-
return {
|
|
1425
|
-
...rest,
|
|
1426
|
-
...!rest.taxonomies && filters ? { taxonomies: filters } : {}
|
|
1427
|
-
};
|
|
1428
|
-
};
|
|
1429
1326
|
var createEshopApi = (apiConfig) => {
|
|
1430
1327
|
return {
|
|
1431
1328
|
async createProduct(params, options) {
|
|
@@ -1433,7 +1330,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1433
1330
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1434
1331
|
return apiConfig.httpClient.post(
|
|
1435
1332
|
`/v1/stores/${target_store_id}/products`,
|
|
1436
|
-
|
|
1333
|
+
payload,
|
|
1437
1334
|
options
|
|
1438
1335
|
);
|
|
1439
1336
|
},
|
|
@@ -1442,7 +1339,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1442
1339
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1443
1340
|
return apiConfig.httpClient.put(
|
|
1444
1341
|
`/v1/stores/${target_store_id}/products/${params.id}`,
|
|
1445
|
-
|
|
1342
|
+
payload,
|
|
1446
1343
|
options
|
|
1447
1344
|
);
|
|
1448
1345
|
},
|
|
@@ -1484,7 +1381,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1484
1381
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1485
1382
|
return apiConfig.httpClient.post(
|
|
1486
1383
|
`/v1/stores/${target_store_id}/services`,
|
|
1487
|
-
|
|
1384
|
+
payload,
|
|
1488
1385
|
options
|
|
1489
1386
|
);
|
|
1490
1387
|
},
|
|
@@ -1493,7 +1390,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1493
1390
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1494
1391
|
return apiConfig.httpClient.put(
|
|
1495
1392
|
`/v1/stores/${target_store_id}/services/${params.id}`,
|
|
1496
|
-
|
|
1393
|
+
payload,
|
|
1497
1394
|
options
|
|
1498
1395
|
);
|
|
1499
1396
|
},
|
|
@@ -1543,7 +1440,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1543
1440
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1544
1441
|
return apiConfig.httpClient.post(
|
|
1545
1442
|
`/v1/stores/${target_store_id}/providers`,
|
|
1546
|
-
|
|
1443
|
+
payload,
|
|
1547
1444
|
options
|
|
1548
1445
|
);
|
|
1549
1446
|
},
|
|
@@ -1552,7 +1449,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
1552
1449
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1553
1450
|
return apiConfig.httpClient.put(
|
|
1554
1451
|
`/v1/stores/${target_store_id}/providers/${params.id}`,
|
|
1555
|
-
|
|
1452
|
+
payload,
|
|
1556
1453
|
options
|
|
1557
1454
|
);
|
|
1558
1455
|
},
|
|
@@ -1767,6 +1664,14 @@ var createEshopApi = (apiConfig) => {
|
|
|
1767
1664
|
{ amount: params.amount },
|
|
1768
1665
|
options
|
|
1769
1666
|
);
|
|
1667
|
+
},
|
|
1668
|
+
async downloadDigitalAccess(params, options) {
|
|
1669
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1670
|
+
return apiConfig.httpClient.post(
|
|
1671
|
+
`/v1/stores/${target_store_id}/orders/${params.id}/digital-access/${params.grant_id}/download`,
|
|
1672
|
+
{},
|
|
1673
|
+
options
|
|
1674
|
+
);
|
|
1770
1675
|
}
|
|
1771
1676
|
};
|
|
1772
1677
|
};
|
|
@@ -1857,45 +1762,46 @@ var createMarketApi = (apiConfig) => {
|
|
|
1857
1762
|
};
|
|
1858
1763
|
|
|
1859
1764
|
// src/api/crm.ts
|
|
1860
|
-
var
|
|
1765
|
+
var createActionAdminApi = (apiConfig) => ({
|
|
1861
1766
|
async timeline(params, options) {
|
|
1862
1767
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1863
|
-
const queryParams = {
|
|
1768
|
+
const queryParams = { contact_id: params.contact_id };
|
|
1864
1769
|
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1865
1770
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1866
1771
|
return apiConfig.httpClient.get(
|
|
1867
|
-
`/v1/stores/${store_id}/
|
|
1772
|
+
`/v1/stores/${store_id}/contacts/${params.contact_id}/actions`,
|
|
1868
1773
|
{ ...options, params: queryParams }
|
|
1869
1774
|
);
|
|
1870
1775
|
},
|
|
1871
1776
|
async find(params, options) {
|
|
1872
1777
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1873
1778
|
const queryParams = {};
|
|
1874
|
-
if (params.
|
|
1779
|
+
if (params.query) queryParams.query = params.query;
|
|
1780
|
+
if (params.contact_id) queryParams.contact_id = params.contact_id;
|
|
1875
1781
|
if (params.types && params.types.length > 0) queryParams.types = params.types;
|
|
1876
1782
|
if (params.from !== void 0) queryParams.from = params.from;
|
|
1877
1783
|
if (params.to !== void 0) queryParams.to = params.to;
|
|
1878
1784
|
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1879
1785
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1880
1786
|
return apiConfig.httpClient.get(
|
|
1881
|
-
`/v1/stores/${store_id}/
|
|
1787
|
+
`/v1/stores/${store_id}/actions`,
|
|
1882
1788
|
{ ...options, params: queryParams }
|
|
1883
1789
|
);
|
|
1884
1790
|
}
|
|
1885
1791
|
});
|
|
1886
|
-
var
|
|
1792
|
+
var createContactApi = (apiConfig) => {
|
|
1887
1793
|
return {
|
|
1888
1794
|
async create(params, options) {
|
|
1889
1795
|
const { store_id, ...payload } = params;
|
|
1890
1796
|
return apiConfig.httpClient.post(
|
|
1891
|
-
`/v1/stores/${store_id || apiConfig.storeId}/
|
|
1797
|
+
`/v1/stores/${store_id || apiConfig.storeId}/contacts`,
|
|
1892
1798
|
payload,
|
|
1893
1799
|
options
|
|
1894
1800
|
);
|
|
1895
1801
|
},
|
|
1896
1802
|
async get(params, options) {
|
|
1897
1803
|
return apiConfig.httpClient.get(
|
|
1898
|
-
`/v1/stores/${params.store_id || apiConfig.storeId}/
|
|
1804
|
+
`/v1/stores/${params.store_id || apiConfig.storeId}/contacts/${params.id}`,
|
|
1899
1805
|
options
|
|
1900
1806
|
);
|
|
1901
1807
|
},
|
|
@@ -1908,22 +1814,32 @@ var createProfileApi = (apiConfig) => {
|
|
|
1908
1814
|
if (params?.query) queryParams.query = params.query;
|
|
1909
1815
|
if (params?.taxonomy_query) queryParams.taxonomy_query = params.taxonomy_query;
|
|
1910
1816
|
if (params?.status) queryParams.status = params.status;
|
|
1911
|
-
if (params?.
|
|
1817
|
+
if (params?.has_action !== void 0) queryParams.has_action = params.has_action;
|
|
1912
1818
|
if (params?.has_cart !== void 0) queryParams.has_cart = params.has_cart;
|
|
1913
1819
|
if (params?.sort_field) queryParams.sort_field = params.sort_field;
|
|
1914
1820
|
if (params?.sort_direction) queryParams.sort_direction = params.sort_direction;
|
|
1915
1821
|
return apiConfig.httpClient.get(
|
|
1916
|
-
`/v1/stores/${store_id}/
|
|
1822
|
+
`/v1/stores/${store_id}/contacts`,
|
|
1917
1823
|
{
|
|
1918
1824
|
...options,
|
|
1919
1825
|
params: queryParams
|
|
1920
1826
|
}
|
|
1921
1827
|
);
|
|
1922
1828
|
},
|
|
1829
|
+
async findActions(params, options) {
|
|
1830
|
+
const { store_id, ...queryParams } = params || {};
|
|
1831
|
+
return apiConfig.httpClient.get(
|
|
1832
|
+
`/v1/stores/${store_id || apiConfig.storeId}/actions`,
|
|
1833
|
+
{
|
|
1834
|
+
...options,
|
|
1835
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1836
|
+
}
|
|
1837
|
+
);
|
|
1838
|
+
},
|
|
1923
1839
|
async update(params, options) {
|
|
1924
1840
|
const { id, store_id, ...body } = params;
|
|
1925
1841
|
return apiConfig.httpClient.put(
|
|
1926
|
-
`/v1/stores/${store_id || apiConfig.storeId}/
|
|
1842
|
+
`/v1/stores/${store_id || apiConfig.storeId}/contacts/${id}`,
|
|
1927
1843
|
body,
|
|
1928
1844
|
options
|
|
1929
1845
|
);
|
|
@@ -1931,7 +1847,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
1931
1847
|
async merge(params, options) {
|
|
1932
1848
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1933
1849
|
return apiConfig.httpClient.post(
|
|
1934
|
-
`/v1/stores/${store_id}/
|
|
1850
|
+
`/v1/stores/${store_id}/contacts/${params.target_id}/merge`,
|
|
1935
1851
|
{ source_id: params.source_id, store_id },
|
|
1936
1852
|
options
|
|
1937
1853
|
);
|
|
@@ -1940,7 +1856,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
1940
1856
|
const { store_id, ...payload } = params;
|
|
1941
1857
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1942
1858
|
return apiConfig.httpClient.post(
|
|
1943
|
-
`/v1/stores/${target_store_id}/
|
|
1859
|
+
`/v1/stores/${target_store_id}/contacts/import`,
|
|
1944
1860
|
payload,
|
|
1945
1861
|
options
|
|
1946
1862
|
);
|
|
@@ -1949,7 +1865,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
1949
1865
|
const { store_id, ...payload } = params;
|
|
1950
1866
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1951
1867
|
return apiConfig.httpClient.post(
|
|
1952
|
-
`/v1/stores/${target_store_id}/
|
|
1868
|
+
`/v1/stores/${target_store_id}/contacts/import/preview`,
|
|
1953
1869
|
payload,
|
|
1954
1870
|
options
|
|
1955
1871
|
);
|
|
@@ -1957,23 +1873,23 @@ var createProfileApi = (apiConfig) => {
|
|
|
1957
1873
|
async revokeToken(params, options) {
|
|
1958
1874
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1959
1875
|
return apiConfig.httpClient.delete(
|
|
1960
|
-
`/v1/stores/${store_id}/
|
|
1876
|
+
`/v1/stores/${store_id}/contacts/${params.id}/sessions/${params.token_id}`,
|
|
1961
1877
|
options
|
|
1962
1878
|
);
|
|
1963
1879
|
},
|
|
1964
1880
|
async revokeAllTokens(params, options) {
|
|
1965
1881
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1966
1882
|
return apiConfig.httpClient.delete(
|
|
1967
|
-
`/v1/stores/${store_id}/
|
|
1883
|
+
`/v1/stores/${store_id}/contacts/${params.id}/sessions`,
|
|
1968
1884
|
options
|
|
1969
1885
|
);
|
|
1970
1886
|
},
|
|
1971
|
-
|
|
1887
|
+
contactList: {
|
|
1972
1888
|
async create(params, options) {
|
|
1973
1889
|
const { store_id, ...payload } = params;
|
|
1974
1890
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1975
1891
|
return apiConfig.httpClient.post(
|
|
1976
|
-
`/v1/stores/${target_store_id}/
|
|
1892
|
+
`/v1/stores/${target_store_id}/contact-lists`,
|
|
1977
1893
|
payload,
|
|
1978
1894
|
options
|
|
1979
1895
|
);
|
|
@@ -1982,7 +1898,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
1982
1898
|
const { id, store_id, ...payload } = params;
|
|
1983
1899
|
const target_store_id = store_id || apiConfig.storeId;
|
|
1984
1900
|
return apiConfig.httpClient.put(
|
|
1985
|
-
`/v1/stores/${target_store_id}/
|
|
1901
|
+
`/v1/stores/${target_store_id}/contact-lists/${id}`,
|
|
1986
1902
|
payload,
|
|
1987
1903
|
options
|
|
1988
1904
|
);
|
|
@@ -1990,7 +1906,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
1990
1906
|
async get(params, options) {
|
|
1991
1907
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1992
1908
|
return apiConfig.httpClient.get(
|
|
1993
|
-
`/v1/stores/${target_store_id}/
|
|
1909
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.id}`,
|
|
1994
1910
|
options
|
|
1995
1911
|
);
|
|
1996
1912
|
},
|
|
@@ -1998,43 +1914,43 @@ var createProfileApi = (apiConfig) => {
|
|
|
1998
1914
|
const { store_id, ...queryParams } = params || {};
|
|
1999
1915
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2000
1916
|
return apiConfig.httpClient.get(
|
|
2001
|
-
`/v1/stores/${target_store_id}/
|
|
1917
|
+
`/v1/stores/${target_store_id}/contact-lists`,
|
|
2002
1918
|
{ ...options, params: queryParams }
|
|
2003
1919
|
);
|
|
2004
1920
|
},
|
|
2005
|
-
async
|
|
2006
|
-
const { store_id,
|
|
1921
|
+
async importContacts(params, options) {
|
|
1922
|
+
const { store_id, contact_list_id, ...payload } = params;
|
|
2007
1923
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2008
1924
|
return apiConfig.httpClient.post(
|
|
2009
|
-
`/v1/stores/${target_store_id}/
|
|
1925
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/import`,
|
|
2010
1926
|
payload,
|
|
2011
1927
|
options
|
|
2012
1928
|
);
|
|
2013
1929
|
},
|
|
2014
|
-
async
|
|
2015
|
-
const { store_id,
|
|
1930
|
+
async previewImportContacts(params, options) {
|
|
1931
|
+
const { store_id, contact_list_id, ...payload } = params;
|
|
2016
1932
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2017
1933
|
return apiConfig.httpClient.post(
|
|
2018
|
-
`/v1/stores/${target_store_id}/
|
|
1934
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/import/preview`,
|
|
2019
1935
|
payload,
|
|
2020
1936
|
options
|
|
2021
1937
|
);
|
|
2022
1938
|
},
|
|
2023
1939
|
members: {
|
|
2024
1940
|
async add(params, options) {
|
|
2025
|
-
const { store_id,
|
|
1941
|
+
const { store_id, contact_list_id, contact_id, fields, lead_description } = params;
|
|
2026
1942
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2027
1943
|
return apiConfig.httpClient.post(
|
|
2028
|
-
`/v1/stores/${target_store_id}/
|
|
1944
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/${contact_id}`,
|
|
2029
1945
|
{ fields, lead_description },
|
|
2030
1946
|
options
|
|
2031
1947
|
);
|
|
2032
1948
|
},
|
|
2033
1949
|
async update(params, options) {
|
|
2034
|
-
const { store_id,
|
|
1950
|
+
const { store_id, contact_list_id, contact_id, status, fields, lead_description } = params;
|
|
2035
1951
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2036
1952
|
return apiConfig.httpClient.patch(
|
|
2037
|
-
`/v1/stores/${target_store_id}/
|
|
1953
|
+
`/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts/${contact_id}`,
|
|
2038
1954
|
{ status, fields, lead_description },
|
|
2039
1955
|
options
|
|
2040
1956
|
);
|
|
@@ -2042,50 +1958,17 @@ var createProfileApi = (apiConfig) => {
|
|
|
2042
1958
|
async remove(params, options) {
|
|
2043
1959
|
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2044
1960
|
return apiConfig.httpClient.delete(
|
|
2045
|
-
`/v1/stores/${target_store_id}/
|
|
1961
|
+
`/v1/stores/${target_store_id}/contact-lists/${params.contact_list_id}/contacts/${params.contact_id}`,
|
|
2046
1962
|
options
|
|
2047
1963
|
);
|
|
2048
1964
|
},
|
|
2049
1965
|
async find(params, options) {
|
|
2050
|
-
const { store_id,
|
|
1966
|
+
const { store_id, contact_list_id, ...queryParams } = params;
|
|
1967
|
+
if (!contact_list_id && !queryParams.contact_id) {
|
|
1968
|
+
throw new Error("contact_list_id or contact_id is required");
|
|
1969
|
+
}
|
|
2051
1970
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2052
|
-
const path =
|
|
2053
|
-
return apiConfig.httpClient.get(
|
|
2054
|
-
path,
|
|
2055
|
-
{ ...options, params: queryParams }
|
|
2056
|
-
);
|
|
2057
|
-
}
|
|
2058
|
-
},
|
|
2059
|
-
profiles: {
|
|
2060
|
-
async add(params, options) {
|
|
2061
|
-
const { store_id, profile_list_id, profile_id, fields, lead_description } = params;
|
|
2062
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
2063
|
-
return apiConfig.httpClient.post(
|
|
2064
|
-
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
|
|
2065
|
-
{ fields, lead_description },
|
|
2066
|
-
options
|
|
2067
|
-
);
|
|
2068
|
-
},
|
|
2069
|
-
async update(params, options) {
|
|
2070
|
-
const { store_id, profile_list_id, profile_id, status, fields, lead_description } = params;
|
|
2071
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
2072
|
-
return apiConfig.httpClient.patch(
|
|
2073
|
-
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
|
|
2074
|
-
{ status, fields, lead_description },
|
|
2075
|
-
options
|
|
2076
|
-
);
|
|
2077
|
-
},
|
|
2078
|
-
async remove(params, options) {
|
|
2079
|
-
const target_store_id = params.store_id || apiConfig.storeId;
|
|
2080
|
-
return apiConfig.httpClient.delete(
|
|
2081
|
-
`/v1/stores/${target_store_id}/profile-lists/${params.profile_list_id}/members/${params.profile_id}`,
|
|
2082
|
-
options
|
|
2083
|
-
);
|
|
2084
|
-
},
|
|
2085
|
-
async find(params, options) {
|
|
2086
|
-
const { store_id, profile_list_id, ...queryParams } = params;
|
|
2087
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
2088
|
-
const path = profile_list_id ? `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members` : `/v1/stores/${target_store_id}/profile-list-members`;
|
|
1971
|
+
const path = contact_list_id ? `/v1/stores/${target_store_id}/contact-lists/${contact_list_id}/contacts` : `/v1/stores/${target_store_id}/contact-lists/contacts`;
|
|
2089
1972
|
return apiConfig.httpClient.get(
|
|
2090
1973
|
path,
|
|
2091
1974
|
{ ...options, params: queryParams }
|
|
@@ -2202,11 +2085,11 @@ var createProfileApi = (apiConfig) => {
|
|
|
2202
2085
|
options
|
|
2203
2086
|
);
|
|
2204
2087
|
},
|
|
2205
|
-
async
|
|
2088
|
+
async importEnrollments(params, options) {
|
|
2206
2089
|
const { id, store_id, ...payload } = params;
|
|
2207
2090
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2208
2091
|
return apiConfig.httpClient.post(
|
|
2209
|
-
`/v1/stores/${target_store_id}/campaigns/${id}/
|
|
2092
|
+
`/v1/stores/${target_store_id}/campaigns/${id}/enrollments/import`,
|
|
2210
2093
|
payload,
|
|
2211
2094
|
options
|
|
2212
2095
|
);
|
|
@@ -2221,12 +2104,12 @@ var createProfileApi = (apiConfig) => {
|
|
|
2221
2104
|
);
|
|
2222
2105
|
}
|
|
2223
2106
|
},
|
|
2224
|
-
|
|
2107
|
+
campaignEnrollment: {
|
|
2225
2108
|
async find(params, options) {
|
|
2226
2109
|
const { store_id, ...queryParams } = params || {};
|
|
2227
2110
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2228
2111
|
return apiConfig.httpClient.get(
|
|
2229
|
-
`/v1/stores/${target_store_id}/campaign-
|
|
2112
|
+
`/v1/stores/${target_store_id}/campaign-enrollments`,
|
|
2230
2113
|
{ ...options, params: queryParams }
|
|
2231
2114
|
);
|
|
2232
2115
|
},
|
|
@@ -2234,7 +2117,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
2234
2117
|
const { store_id, id, ...queryParams } = params;
|
|
2235
2118
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2236
2119
|
return apiConfig.httpClient.get(
|
|
2237
|
-
`/v1/stores/${target_store_id}/campaign-
|
|
2120
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}`,
|
|
2238
2121
|
{ ...options, params: { ...queryParams, store_id: target_store_id } }
|
|
2239
2122
|
);
|
|
2240
2123
|
},
|
|
@@ -2242,7 +2125,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
2242
2125
|
const { store_id, id, ...payload } = params;
|
|
2243
2126
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2244
2127
|
return apiConfig.httpClient.put(
|
|
2245
|
-
`/v1/stores/${target_store_id}/campaign-
|
|
2128
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}`,
|
|
2246
2129
|
payload,
|
|
2247
2130
|
options
|
|
2248
2131
|
);
|
|
@@ -2251,7 +2134,16 @@ var createProfileApi = (apiConfig) => {
|
|
|
2251
2134
|
const { store_id, id, draft_id, ...payload } = params;
|
|
2252
2135
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2253
2136
|
return apiConfig.httpClient.put(
|
|
2254
|
-
`/v1/stores/${target_store_id}/campaign-
|
|
2137
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/drafts/${draft_id}`,
|
|
2138
|
+
payload,
|
|
2139
|
+
options
|
|
2140
|
+
);
|
|
2141
|
+
},
|
|
2142
|
+
async updateStepExecution(params, options) {
|
|
2143
|
+
const { store_id, id, execution_id, ...payload } = params;
|
|
2144
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2145
|
+
return apiConfig.httpClient.post(
|
|
2146
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/step-executions/${execution_id}`,
|
|
2255
2147
|
payload,
|
|
2256
2148
|
options
|
|
2257
2149
|
);
|
|
@@ -2260,7 +2152,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
2260
2152
|
const { store_id, id, ...payload } = params;
|
|
2261
2153
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2262
2154
|
return apiConfig.httpClient.post(
|
|
2263
|
-
`/v1/stores/${target_store_id}/campaign-
|
|
2155
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/reply`,
|
|
2264
2156
|
payload,
|
|
2265
2157
|
options
|
|
2266
2158
|
);
|
|
@@ -2269,7 +2161,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
2269
2161
|
const { store_id, id, ...payload } = params;
|
|
2270
2162
|
const target_store_id = store_id || apiConfig.storeId;
|
|
2271
2163
|
return apiConfig.httpClient.post(
|
|
2272
|
-
`/v1/stores/${target_store_id}/campaign-
|
|
2164
|
+
`/v1/stores/${target_store_id}/campaign-enrollments/${id}/stop`,
|
|
2273
2165
|
payload,
|
|
2274
2166
|
options
|
|
2275
2167
|
);
|
|
@@ -2329,7 +2221,7 @@ var createProfileApi = (apiConfig) => {
|
|
|
2329
2221
|
);
|
|
2330
2222
|
}
|
|
2331
2223
|
},
|
|
2332
|
-
|
|
2224
|
+
action: createActionAdminApi(apiConfig)
|
|
2333
2225
|
};
|
|
2334
2226
|
};
|
|
2335
2227
|
|
|
@@ -2370,6 +2262,52 @@ function createStorefrontSupportApi(config) {
|
|
|
2370
2262
|
function createAdminSupportApi(config) {
|
|
2371
2263
|
const { httpClient } = config;
|
|
2372
2264
|
return {
|
|
2265
|
+
channel: {
|
|
2266
|
+
async create(params, opts) {
|
|
2267
|
+
return httpClient.post(
|
|
2268
|
+
`/v1/stores/${params.store_id}/support/channels`,
|
|
2269
|
+
params,
|
|
2270
|
+
opts
|
|
2271
|
+
);
|
|
2272
|
+
},
|
|
2273
|
+
async get(params, opts) {
|
|
2274
|
+
return httpClient.get(
|
|
2275
|
+
`/v1/stores/${params.store_id}/support/channels/${params.id}?store_id=${params.store_id}`,
|
|
2276
|
+
opts
|
|
2277
|
+
);
|
|
2278
|
+
},
|
|
2279
|
+
async find(params, opts) {
|
|
2280
|
+
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
2281
|
+
if (params.status) qs.set("status", params.status);
|
|
2282
|
+
if (params.channel_type) qs.set("channel_type", params.channel_type);
|
|
2283
|
+
if (params.limit) qs.set("limit", String(params.limit));
|
|
2284
|
+
if (params.cursor) qs.set("cursor", params.cursor);
|
|
2285
|
+
return httpClient.get(
|
|
2286
|
+
`/v1/stores/${params.store_id}/support/channels?${qs}`,
|
|
2287
|
+
opts
|
|
2288
|
+
);
|
|
2289
|
+
},
|
|
2290
|
+
async update(params, opts) {
|
|
2291
|
+
return httpClient.put(
|
|
2292
|
+
`/v1/stores/${params.store_id}/support/channels/${params.id}`,
|
|
2293
|
+
params,
|
|
2294
|
+
opts
|
|
2295
|
+
);
|
|
2296
|
+
},
|
|
2297
|
+
async delete(params, opts) {
|
|
2298
|
+
return httpClient.delete(
|
|
2299
|
+
`/v1/stores/${params.store_id}/support/channels/${params.id}?store_id=${params.store_id}`,
|
|
2300
|
+
opts
|
|
2301
|
+
);
|
|
2302
|
+
},
|
|
2303
|
+
async receiveMessage(params, opts) {
|
|
2304
|
+
return httpClient.post(
|
|
2305
|
+
`/v1/stores/${params.store_id}/support/channels/${params.channel_id}/messages`,
|
|
2306
|
+
params,
|
|
2307
|
+
opts
|
|
2308
|
+
);
|
|
2309
|
+
}
|
|
2310
|
+
},
|
|
2373
2311
|
agent: {
|
|
2374
2312
|
async create(params, opts) {
|
|
2375
2313
|
return httpClient.post(
|
|
@@ -2413,6 +2351,9 @@ function createAdminSupportApi(config) {
|
|
|
2413
2351
|
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
2414
2352
|
if (params.status) qs.set("status", params.status);
|
|
2415
2353
|
if (params.agent_id) qs.set("agent_id", params.agent_id);
|
|
2354
|
+
if (params.channel_id) qs.set("channel_id", params.channel_id);
|
|
2355
|
+
if (params.channel_type) qs.set("channel_type", params.channel_type);
|
|
2356
|
+
if (params.query) qs.set("query", params.query);
|
|
2416
2357
|
if (params.limit) qs.set("limit", String(params.limit));
|
|
2417
2358
|
if (params.cursor) qs.set("cursor", params.cursor);
|
|
2418
2359
|
return httpClient.get(
|
|
@@ -2525,6 +2466,195 @@ var createLeadResearchApi = (apiConfig) => {
|
|
|
2525
2466
|
};
|
|
2526
2467
|
};
|
|
2527
2468
|
|
|
2469
|
+
// src/api/social.ts
|
|
2470
|
+
var createSocialApi = (apiConfig) => {
|
|
2471
|
+
const storeId = (store_id) => store_id || apiConfig.storeId;
|
|
2472
|
+
const api = {
|
|
2473
|
+
async findPublications(params, options) {
|
|
2474
|
+
const { store_id, ...queryParams } = params || {};
|
|
2475
|
+
return apiConfig.httpClient.get(
|
|
2476
|
+
`/v1/stores/${storeId(store_id)}/social-publications`,
|
|
2477
|
+
{
|
|
2478
|
+
...options,
|
|
2479
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2480
|
+
}
|
|
2481
|
+
);
|
|
2482
|
+
},
|
|
2483
|
+
async getPublication(params, options) {
|
|
2484
|
+
return apiConfig.httpClient.get(
|
|
2485
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.id}`,
|
|
2486
|
+
options
|
|
2487
|
+
);
|
|
2488
|
+
},
|
|
2489
|
+
async validatePublication(params, options) {
|
|
2490
|
+
const { store_id, ...payload } = params;
|
|
2491
|
+
return apiConfig.httpClient.post(
|
|
2492
|
+
`/v1/stores/${storeId(store_id)}/social-publications/validate`,
|
|
2493
|
+
payload,
|
|
2494
|
+
options
|
|
2495
|
+
);
|
|
2496
|
+
},
|
|
2497
|
+
async createPublication(params, options) {
|
|
2498
|
+
const { store_id, ...payload } = params;
|
|
2499
|
+
return apiConfig.httpClient.post(
|
|
2500
|
+
`/v1/stores/${storeId(store_id)}/social-publications`,
|
|
2501
|
+
payload,
|
|
2502
|
+
options
|
|
2503
|
+
);
|
|
2504
|
+
},
|
|
2505
|
+
async updatePublication(params, options) {
|
|
2506
|
+
const { store_id, id, ...payload } = params;
|
|
2507
|
+
return apiConfig.httpClient.put(
|
|
2508
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${id}`,
|
|
2509
|
+
payload,
|
|
2510
|
+
options
|
|
2511
|
+
);
|
|
2512
|
+
},
|
|
2513
|
+
async schedulePublication(params, options) {
|
|
2514
|
+
const { store_id, id, ...payload } = params;
|
|
2515
|
+
return apiConfig.httpClient.post(
|
|
2516
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${id}/schedule`,
|
|
2517
|
+
payload,
|
|
2518
|
+
options
|
|
2519
|
+
);
|
|
2520
|
+
},
|
|
2521
|
+
async cancelPublication(params, options) {
|
|
2522
|
+
return apiConfig.httpClient.post(
|
|
2523
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.id}/cancel`,
|
|
2524
|
+
{},
|
|
2525
|
+
options
|
|
2526
|
+
);
|
|
2527
|
+
},
|
|
2528
|
+
async getPublicationComments(params, options) {
|
|
2529
|
+
const { store_id, publication_id, ...queryParams } = params;
|
|
2530
|
+
return apiConfig.httpClient.get(
|
|
2531
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments`,
|
|
2532
|
+
{
|
|
2533
|
+
...options,
|
|
2534
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2535
|
+
}
|
|
2536
|
+
);
|
|
2537
|
+
},
|
|
2538
|
+
async syncPublicationComments(params, options) {
|
|
2539
|
+
const { store_id, publication_id, ...payload } = params;
|
|
2540
|
+
return apiConfig.httpClient.post(
|
|
2541
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/sync`,
|
|
2542
|
+
payload,
|
|
2543
|
+
options
|
|
2544
|
+
);
|
|
2545
|
+
},
|
|
2546
|
+
async getPublicationCommentThread(params, options) {
|
|
2547
|
+
const { store_id, publication_id, comment_id, ...queryParams } = params;
|
|
2548
|
+
return apiConfig.httpClient.get(
|
|
2549
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/thread`,
|
|
2550
|
+
{
|
|
2551
|
+
...options,
|
|
2552
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2553
|
+
}
|
|
2554
|
+
);
|
|
2555
|
+
},
|
|
2556
|
+
async syncPublicationCommentThread(params, options) {
|
|
2557
|
+
const { store_id, publication_id, comment_id, ...payload } = params;
|
|
2558
|
+
return apiConfig.httpClient.post(
|
|
2559
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/thread/sync`,
|
|
2560
|
+
payload,
|
|
2561
|
+
options
|
|
2562
|
+
);
|
|
2563
|
+
},
|
|
2564
|
+
async findPublicationComments(params, options) {
|
|
2565
|
+
const { store_id, ...queryParams } = params || {};
|
|
2566
|
+
return apiConfig.httpClient.get(`/v1/stores/${storeId(store_id)}/social-publications/comments`, {
|
|
2567
|
+
...options,
|
|
2568
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2569
|
+
});
|
|
2570
|
+
},
|
|
2571
|
+
async classifyPublicationComments(params, options) {
|
|
2572
|
+
const { store_id, ...payload } = params || {};
|
|
2573
|
+
return apiConfig.httpClient.post(
|
|
2574
|
+
`/v1/stores/${storeId(store_id)}/social-publications/comments/classify`,
|
|
2575
|
+
payload,
|
|
2576
|
+
options
|
|
2577
|
+
);
|
|
2578
|
+
},
|
|
2579
|
+
async replyToPublicationComment(params, options) {
|
|
2580
|
+
const { store_id, publication_id, comment_id, text } = params;
|
|
2581
|
+
return apiConfig.httpClient.post(
|
|
2582
|
+
`/v1/stores/${storeId(store_id)}/social-publications/${publication_id}/comments/${comment_id}/reply`,
|
|
2583
|
+
{ text },
|
|
2584
|
+
options
|
|
2585
|
+
);
|
|
2586
|
+
},
|
|
2587
|
+
async getPublicationMetrics(params, options) {
|
|
2588
|
+
return apiConfig.httpClient.get(
|
|
2589
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/metrics`,
|
|
2590
|
+
options
|
|
2591
|
+
);
|
|
2592
|
+
},
|
|
2593
|
+
async syncPublicationMetrics(params, options) {
|
|
2594
|
+
return apiConfig.httpClient.post(
|
|
2595
|
+
`/v1/stores/${storeId(params.store_id)}/social-publications/${params.publication_id}/metrics/sync`,
|
|
2596
|
+
{},
|
|
2597
|
+
options
|
|
2598
|
+
);
|
|
2599
|
+
},
|
|
2600
|
+
async syncEngagement(params, options) {
|
|
2601
|
+
const { store_id, ...payload } = params || {};
|
|
2602
|
+
return apiConfig.httpClient.post(
|
|
2603
|
+
`/v1/stores/${storeId(store_id)}/social-publications/engagement/sync`,
|
|
2604
|
+
payload,
|
|
2605
|
+
options
|
|
2606
|
+
);
|
|
2607
|
+
},
|
|
2608
|
+
async getCapabilities(params, options) {
|
|
2609
|
+
return apiConfig.httpClient.get(
|
|
2610
|
+
`/v1/stores/${storeId(params?.store_id)}/social-accounts/capabilities`,
|
|
2611
|
+
options
|
|
2612
|
+
);
|
|
2613
|
+
},
|
|
2614
|
+
async listAccounts(params, options) {
|
|
2615
|
+
return apiConfig.httpClient.get(
|
|
2616
|
+
`/v1/stores/${storeId(params?.store_id)}/social-accounts`,
|
|
2617
|
+
options
|
|
2618
|
+
);
|
|
2619
|
+
},
|
|
2620
|
+
async connect(params, options) {
|
|
2621
|
+
const { store_id, ...payload } = params;
|
|
2622
|
+
return apiConfig.httpClient.post(
|
|
2623
|
+
`/v1/stores/${storeId(store_id)}/social-accounts/oauth/connect`,
|
|
2624
|
+
payload,
|
|
2625
|
+
options
|
|
2626
|
+
);
|
|
2627
|
+
},
|
|
2628
|
+
async getOAuthAttempt(params, options) {
|
|
2629
|
+
return apiConfig.httpClient.get(
|
|
2630
|
+
`/v1/stores/${storeId(params.store_id)}/social-accounts/oauth/attempts/${params.attempt_id}`,
|
|
2631
|
+
options
|
|
2632
|
+
);
|
|
2633
|
+
},
|
|
2634
|
+
async selectDestination(params, options) {
|
|
2635
|
+
const { store_id, ...payload } = params;
|
|
2636
|
+
return apiConfig.httpClient.post(
|
|
2637
|
+
`/v1/stores/${storeId(store_id)}/social-accounts/oauth/select-destination`,
|
|
2638
|
+
payload,
|
|
2639
|
+
options
|
|
2640
|
+
);
|
|
2641
|
+
},
|
|
2642
|
+
async deleteAccount(params, options) {
|
|
2643
|
+
return apiConfig.httpClient.delete(
|
|
2644
|
+
`/v1/stores/${storeId(params.store_id)}/social-accounts/${params.id}`,
|
|
2645
|
+
options
|
|
2646
|
+
);
|
|
2647
|
+
},
|
|
2648
|
+
validatePublications(params, options) {
|
|
2649
|
+
return api.validatePublication(params, options);
|
|
2650
|
+
},
|
|
2651
|
+
createPublications(params, options) {
|
|
2652
|
+
return api.createPublication(params, options);
|
|
2653
|
+
}
|
|
2654
|
+
};
|
|
2655
|
+
return api;
|
|
2656
|
+
};
|
|
2657
|
+
|
|
2528
2658
|
// src/api/workflow.ts
|
|
2529
2659
|
var createWorkflowApi = (apiConfig) => {
|
|
2530
2660
|
return {
|
|
@@ -2563,14 +2693,21 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
2563
2693
|
async getWorkflows(params, options) {
|
|
2564
2694
|
const store_id = params?.store_id || apiConfig.storeId;
|
|
2565
2695
|
const { store_id: _, ...queryParams } = params || {};
|
|
2566
|
-
return apiConfig.httpClient.get(
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2696
|
+
return apiConfig.httpClient.get(
|
|
2697
|
+
`/v1/stores/${store_id}/workflows`,
|
|
2698
|
+
{
|
|
2699
|
+
...options,
|
|
2700
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2701
|
+
}
|
|
2702
|
+
);
|
|
2570
2703
|
},
|
|
2571
2704
|
async triggerWorkflow(params, options) {
|
|
2572
2705
|
const { secret, ...payload } = params;
|
|
2573
|
-
return apiConfig.httpClient.post(
|
|
2706
|
+
return apiConfig.httpClient.post(
|
|
2707
|
+
`/v1/workflows/trigger/${secret}`,
|
|
2708
|
+
payload,
|
|
2709
|
+
options
|
|
2710
|
+
);
|
|
2574
2711
|
},
|
|
2575
2712
|
async getWorkflowExecutions(params, options) {
|
|
2576
2713
|
const store_id = params.store_id || apiConfig.storeId;
|
|
@@ -2589,6 +2726,38 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
2589
2726
|
`/v1/stores/${store_id}/workflows/${params.workflow_id}/executions/${params.execution_id}`,
|
|
2590
2727
|
options
|
|
2591
2728
|
);
|
|
2729
|
+
},
|
|
2730
|
+
async getWorkflowAccounts(params, options) {
|
|
2731
|
+
const store_id = params?.store_id || apiConfig.storeId;
|
|
2732
|
+
return apiConfig.httpClient.get(
|
|
2733
|
+
`/v1/stores/${store_id}/workflow-accounts`,
|
|
2734
|
+
options
|
|
2735
|
+
);
|
|
2736
|
+
},
|
|
2737
|
+
async getWorkflowAccountConnectUrl(params, options) {
|
|
2738
|
+
const { store_id, type, ...payload } = params;
|
|
2739
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2740
|
+
return apiConfig.httpClient.post(
|
|
2741
|
+
`/v1/stores/${target_store_id}/workflow-accounts/connect-url`,
|
|
2742
|
+
{ ...payload, type, store_id: target_store_id },
|
|
2743
|
+
options
|
|
2744
|
+
);
|
|
2745
|
+
},
|
|
2746
|
+
async connectWorkflowAccount(params, options) {
|
|
2747
|
+
const { store_id, type, ...payload } = params;
|
|
2748
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2749
|
+
return apiConfig.httpClient.post(
|
|
2750
|
+
`/v1/stores/${target_store_id}/workflow-accounts/connect`,
|
|
2751
|
+
{ ...payload, type, store_id: target_store_id },
|
|
2752
|
+
options
|
|
2753
|
+
);
|
|
2754
|
+
},
|
|
2755
|
+
async deleteWorkflowAccount(params, options) {
|
|
2756
|
+
const store_id = params.store_id || apiConfig.storeId;
|
|
2757
|
+
return apiConfig.httpClient.delete(
|
|
2758
|
+
`/v1/stores/${store_id}/workflow-accounts/${params.id}`,
|
|
2759
|
+
options
|
|
2760
|
+
);
|
|
2592
2761
|
}
|
|
2593
2762
|
};
|
|
2594
2763
|
};
|
|
@@ -2599,8 +2768,8 @@ var createPlatformApi = (apiConfig) => {
|
|
|
2599
2768
|
async getCurrencies(options) {
|
|
2600
2769
|
return apiConfig.httpClient.get("/v1/platform/currencies", options);
|
|
2601
2770
|
},
|
|
2602
|
-
async
|
|
2603
|
-
return apiConfig.httpClient.get("/v1/platform/
|
|
2771
|
+
async getWorkflowTools(options) {
|
|
2772
|
+
return apiConfig.httpClient.get("/v1/platform/workflow-tools", options);
|
|
2604
2773
|
},
|
|
2605
2774
|
async getWebhookEvents(options) {
|
|
2606
2775
|
return apiConfig.httpClient.get("/v1/platform/events", options);
|
|
@@ -2646,6 +2815,48 @@ var createShippingApi = (apiConfig) => {
|
|
|
2646
2815
|
payload,
|
|
2647
2816
|
options
|
|
2648
2817
|
);
|
|
2818
|
+
},
|
|
2819
|
+
async refundLabel(params, options) {
|
|
2820
|
+
const { order_id, shipment_id } = params;
|
|
2821
|
+
return apiConfig.httpClient.post(
|
|
2822
|
+
`/v1/stores/${apiConfig.storeId}/orders/${order_id}/shipments/${shipment_id}/label/refund`,
|
|
2823
|
+
{},
|
|
2824
|
+
options
|
|
2825
|
+
);
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
};
|
|
2829
|
+
|
|
2830
|
+
// src/api/paymentProvider.ts
|
|
2831
|
+
var createPaymentProviderApi = (apiConfig) => {
|
|
2832
|
+
const storeId = (store_id) => store_id || apiConfig.storeId;
|
|
2833
|
+
return {
|
|
2834
|
+
async list(params, options) {
|
|
2835
|
+
return apiConfig.httpClient.get(
|
|
2836
|
+
`/v1/stores/${storeId(params?.store_id)}/payment-providers`,
|
|
2837
|
+
options
|
|
2838
|
+
);
|
|
2839
|
+
},
|
|
2840
|
+
async refresh(params, options) {
|
|
2841
|
+
const targetStoreId = storeId(params?.store_id);
|
|
2842
|
+
return apiConfig.httpClient.post(
|
|
2843
|
+
`/v1/stores/${targetStoreId}/payment-providers/refresh`,
|
|
2844
|
+
{ store_id: targetStoreId },
|
|
2845
|
+
options
|
|
2846
|
+
);
|
|
2847
|
+
},
|
|
2848
|
+
async connectStripe(params, options) {
|
|
2849
|
+
return apiConfig.httpClient.post(
|
|
2850
|
+
`/v1/stores/${storeId(params.store_id)}/payment-providers/stripe/connect`,
|
|
2851
|
+
params,
|
|
2852
|
+
options
|
|
2853
|
+
);
|
|
2854
|
+
},
|
|
2855
|
+
async delete(params, options) {
|
|
2856
|
+
return apiConfig.httpClient.delete(
|
|
2857
|
+
`/v1/stores/${storeId(params.store_id)}/payment-providers/${params.id}`,
|
|
2858
|
+
options
|
|
2859
|
+
);
|
|
2649
2860
|
}
|
|
2650
2861
|
};
|
|
2651
2862
|
};
|
|
@@ -2885,6 +3096,164 @@ var createAnalyticsApi = (apiConfig) => {
|
|
|
2885
3096
|
};
|
|
2886
3097
|
};
|
|
2887
3098
|
|
|
3099
|
+
// src/api/experiments.ts
|
|
3100
|
+
var createExperimentsApi = (apiConfig) => {
|
|
3101
|
+
const base = (storeId = apiConfig.storeId) => `/v1/stores/${storeId}/experiments`;
|
|
3102
|
+
return {
|
|
3103
|
+
create(params, options) {
|
|
3104
|
+
const { store_id, ...payload } = params;
|
|
3105
|
+
return apiConfig.httpClient.post(base(store_id), payload, options);
|
|
3106
|
+
},
|
|
3107
|
+
update(params, options) {
|
|
3108
|
+
const { store_id, key, ...payload } = params;
|
|
3109
|
+
return apiConfig.httpClient.put(`${base(store_id)}/${key}`, payload, options);
|
|
3110
|
+
},
|
|
3111
|
+
get(params, options) {
|
|
3112
|
+
return apiConfig.httpClient.get(`${base(params.store_id)}/${params.key}`, options);
|
|
3113
|
+
},
|
|
3114
|
+
find(params = {}, options) {
|
|
3115
|
+
const { store_id, ...queryParams } = params;
|
|
3116
|
+
return apiConfig.httpClient.get(base(store_id), {
|
|
3117
|
+
...options,
|
|
3118
|
+
params: queryParams
|
|
3119
|
+
});
|
|
3120
|
+
},
|
|
3121
|
+
results(params, options) {
|
|
3122
|
+
return apiConfig.httpClient.get(
|
|
3123
|
+
`${base(params.store_id)}/${params.key}/results`,
|
|
3124
|
+
options
|
|
3125
|
+
);
|
|
3126
|
+
}
|
|
3127
|
+
};
|
|
3128
|
+
};
|
|
3129
|
+
|
|
3130
|
+
// src/utils/blocks.ts
|
|
3131
|
+
function getBlockLabel(block) {
|
|
3132
|
+
if (!block) return "";
|
|
3133
|
+
return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) ?? "";
|
|
3134
|
+
}
|
|
3135
|
+
function formatBlockValue(block) {
|
|
3136
|
+
if (!block || block.value === null || block.value === void 0) return "";
|
|
3137
|
+
const value = block.value;
|
|
3138
|
+
switch (block.type) {
|
|
3139
|
+
case "boolean":
|
|
3140
|
+
return value ? "Yes" : "No";
|
|
3141
|
+
case "number":
|
|
3142
|
+
if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
|
|
3143
|
+
return new Date(value).toLocaleDateString();
|
|
3144
|
+
}
|
|
3145
|
+
return String(value);
|
|
3146
|
+
case "media":
|
|
3147
|
+
if (value && typeof value === "object") {
|
|
3148
|
+
return value.mime_type ? value.name || value.id : value.title || value.name || value.id;
|
|
3149
|
+
}
|
|
3150
|
+
return String(value);
|
|
3151
|
+
default:
|
|
3152
|
+
return String(value);
|
|
3153
|
+
}
|
|
3154
|
+
}
|
|
3155
|
+
function prepareBlocksForSubmission(formData, blockTypes) {
|
|
3156
|
+
return Object.keys(formData).filter((key) => formData[key] !== null && formData[key] !== void 0).map((key) => ({
|
|
3157
|
+
key,
|
|
3158
|
+
value: (blockTypes?.[key] || "text") === "array" && !Array.isArray(formData[key]) ? [formData[key]] : formData[key]
|
|
3159
|
+
}));
|
|
3160
|
+
}
|
|
3161
|
+
function extractBlockValues(blocks) {
|
|
3162
|
+
const values = {};
|
|
3163
|
+
blocks.forEach((block) => {
|
|
3164
|
+
values[block.key] = block.value ?? null;
|
|
3165
|
+
});
|
|
3166
|
+
return values;
|
|
3167
|
+
}
|
|
3168
|
+
var getBlockValue = (entry, blockKey) => {
|
|
3169
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3170
|
+
return block?.value ?? null;
|
|
3171
|
+
};
|
|
3172
|
+
var getBlockTextValue = (block, locale = "en") => {
|
|
3173
|
+
if (!block || block.value === null || block.value === void 0) return "";
|
|
3174
|
+
const blockType = block.type;
|
|
3175
|
+
if (blockType === "localized_text" || blockType === "markdown") {
|
|
3176
|
+
if (typeof block.value === "object" && block.value !== null) {
|
|
3177
|
+
return block.value[locale] ?? block.value["en"] ?? "";
|
|
3178
|
+
}
|
|
3179
|
+
}
|
|
3180
|
+
if (typeof block.value === "string") return block.value;
|
|
3181
|
+
return String(block.value ?? "");
|
|
3182
|
+
};
|
|
3183
|
+
var getBlockValues = (entry, blockKey) => {
|
|
3184
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3185
|
+
if (!block) return [];
|
|
3186
|
+
if (block.type === "array" && Array.isArray(block.value)) {
|
|
3187
|
+
return block.value;
|
|
3188
|
+
}
|
|
3189
|
+
return [];
|
|
3190
|
+
};
|
|
3191
|
+
function unwrapBlock(block, locale) {
|
|
3192
|
+
if (!block?.type || block.value === void 0) return block;
|
|
3193
|
+
const blockType = block.type;
|
|
3194
|
+
if (blockType === "array") {
|
|
3195
|
+
return block.value.map((obj) => {
|
|
3196
|
+
const parsed = {};
|
|
3197
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
3198
|
+
parsed[k] = unwrapBlock(v, locale);
|
|
3199
|
+
}
|
|
3200
|
+
return parsed;
|
|
3201
|
+
});
|
|
3202
|
+
}
|
|
3203
|
+
if (blockType === "object") {
|
|
3204
|
+
const parsed = {};
|
|
3205
|
+
for (const [k, v] of Object.entries(block.value || {})) {
|
|
3206
|
+
parsed[k] = unwrapBlock(v, locale);
|
|
3207
|
+
}
|
|
3208
|
+
return parsed;
|
|
3209
|
+
}
|
|
3210
|
+
if (blockType === "localized_text" || blockType === "markdown") {
|
|
3211
|
+
return block.value?.[locale];
|
|
3212
|
+
}
|
|
3213
|
+
return block.value;
|
|
3214
|
+
}
|
|
3215
|
+
var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
3216
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3217
|
+
if (!block || block.type !== "array" || !Array.isArray(block.value)) return [];
|
|
3218
|
+
return block.value.map((obj) => {
|
|
3219
|
+
if (!obj?.value || !Array.isArray(obj.value)) return {};
|
|
3220
|
+
return obj.value.reduce((acc, current) => {
|
|
3221
|
+
acc[current.key] = unwrapBlock(current, locale);
|
|
3222
|
+
return acc;
|
|
3223
|
+
}, {});
|
|
3224
|
+
});
|
|
3225
|
+
};
|
|
3226
|
+
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
3227
|
+
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
3228
|
+
if (!block) return {};
|
|
3229
|
+
if (block.type === "array" && Array.isArray(block.value)) {
|
|
3230
|
+
return block.value.reduce((acc, current) => {
|
|
3231
|
+
acc[current.key] = unwrapBlock(current, locale);
|
|
3232
|
+
return acc;
|
|
3233
|
+
}, {});
|
|
3234
|
+
}
|
|
3235
|
+
if (block.type === "object" && block.value && typeof block.value === "object") {
|
|
3236
|
+
const result = {};
|
|
3237
|
+
for (const [k, v] of Object.entries(block.value)) {
|
|
3238
|
+
result[k] = unwrapBlock(v, locale);
|
|
3239
|
+
}
|
|
3240
|
+
return result;
|
|
3241
|
+
}
|
|
3242
|
+
return { [block.key]: unwrapBlock(block, locale) };
|
|
3243
|
+
};
|
|
3244
|
+
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
3245
|
+
if (!imageBlock) return null;
|
|
3246
|
+
if (imageBlock.type === "media") {
|
|
3247
|
+
const mediaValue = imageBlock.value;
|
|
3248
|
+
return mediaValue?.resolutions?.original?.url || mediaValue?.url || null;
|
|
3249
|
+
}
|
|
3250
|
+
if (isBlock) {
|
|
3251
|
+
if (typeof imageBlock === "string") return imageBlock;
|
|
3252
|
+
if (imageBlock.url) return imageBlock.url;
|
|
3253
|
+
}
|
|
3254
|
+
return imageBlock.resolutions?.original?.url || null;
|
|
3255
|
+
};
|
|
3256
|
+
|
|
2888
3257
|
// src/utils/price.ts
|
|
2889
3258
|
function formatCurrency(amount, currencyCode, locale = "en") {
|
|
2890
3259
|
if (!currencyCode) return "";
|
|
@@ -3135,7 +3504,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
3135
3504
|
}
|
|
3136
3505
|
|
|
3137
3506
|
// src/index.ts
|
|
3138
|
-
var SDK_VERSION = "0.9.
|
|
3507
|
+
var SDK_VERSION = "0.9.11";
|
|
3139
3508
|
var SUPPORTED_FRAMEWORKS = [
|
|
3140
3509
|
"astro",
|
|
3141
3510
|
"react",
|
|
@@ -3273,63 +3642,142 @@ function createAdmin(config) {
|
|
|
3273
3642
|
const cmsApi = createCmsApi(apiConfig);
|
|
3274
3643
|
const eshopApi = createEshopApi(apiConfig);
|
|
3275
3644
|
const promoCodeApi = createPromoCodeApi(apiConfig);
|
|
3276
|
-
const crmApi =
|
|
3645
|
+
const crmApi = createContactApi(apiConfig);
|
|
3277
3646
|
const supportApi = createAdminSupportApi(apiConfig);
|
|
3278
3647
|
const leadResearchApi = createLeadResearchApi(apiConfig);
|
|
3279
|
-
const
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
get: leadResearchApi.getRun,
|
|
3284
|
-
update: leadResearchApi.updateRun,
|
|
3285
|
-
cancel: leadResearchApi.cancelRun,
|
|
3286
|
-
sendMessage: leadResearchApi.sendMessage,
|
|
3287
|
-
findMessages: leadResearchApi.findMessages
|
|
3288
|
-
},
|
|
3289
|
-
message: {
|
|
3290
|
-
send: leadResearchApi.sendMessage,
|
|
3291
|
-
find: leadResearchApi.findMessages
|
|
3292
|
-
},
|
|
3293
|
-
email: {
|
|
3294
|
-
validate: leadResearchApi.validateEmail
|
|
3295
|
-
},
|
|
3296
|
-
createRun: leadResearchApi.createRun,
|
|
3297
|
-
findRuns: leadResearchApi.findRuns,
|
|
3298
|
-
getRun: leadResearchApi.getRun,
|
|
3299
|
-
updateRun: leadResearchApi.updateRun,
|
|
3300
|
-
cancelRun: leadResearchApi.cancelRun,
|
|
3301
|
-
sendMessage: leadResearchApi.sendMessage,
|
|
3302
|
-
findMessages: leadResearchApi.findMessages,
|
|
3303
|
-
validateEmail: leadResearchApi.validateEmail
|
|
3304
|
-
};
|
|
3648
|
+
const socialApi = createSocialApi(apiConfig);
|
|
3649
|
+
const paymentProviderApi = createPaymentProviderApi(apiConfig);
|
|
3650
|
+
const notificationApi = createNotificationApi(apiConfig);
|
|
3651
|
+
const shippingApi = createShippingApi(apiConfig);
|
|
3305
3652
|
const locationApi = createLocationApi(apiConfig);
|
|
3306
3653
|
const marketApi = createMarketApi(apiConfig);
|
|
3307
3654
|
const workflowApi = createWorkflowApi(apiConfig);
|
|
3655
|
+
const storePaymentProviderApi = {
|
|
3656
|
+
list: paymentProviderApi.list,
|
|
3657
|
+
refresh: paymentProviderApi.refresh,
|
|
3658
|
+
connectStripe: paymentProviderApi.connectStripe,
|
|
3659
|
+
delete: paymentProviderApi.delete
|
|
3660
|
+
};
|
|
3661
|
+
const workflowPublicApi = {
|
|
3662
|
+
create: workflowApi.createWorkflow,
|
|
3663
|
+
update: workflowApi.updateWorkflow,
|
|
3664
|
+
delete: workflowApi.deleteWorkflow,
|
|
3665
|
+
get: workflowApi.getWorkflow,
|
|
3666
|
+
find: workflowApi.getWorkflows,
|
|
3667
|
+
trigger: workflowApi.triggerWorkflow,
|
|
3668
|
+
getExecutions: workflowApi.getWorkflowExecutions,
|
|
3669
|
+
getExecution: workflowApi.getWorkflowExecution,
|
|
3670
|
+
listAccounts: workflowApi.getWorkflowAccounts,
|
|
3671
|
+
getAccountConnectUrl: workflowApi.getWorkflowAccountConnectUrl,
|
|
3672
|
+
connectAccount: workflowApi.connectWorkflowAccount,
|
|
3673
|
+
deleteAccount: workflowApi.deleteWorkflowAccount
|
|
3674
|
+
};
|
|
3308
3675
|
const formApi = createFormApi(apiConfig);
|
|
3309
3676
|
const taxonomyApi = createTaxonomyApi(apiConfig);
|
|
3310
3677
|
const emailTemplateApi = createEmailTemplateApi(apiConfig);
|
|
3311
3678
|
const analyticsApi = createAnalyticsApi(apiConfig);
|
|
3679
|
+
const experimentsApi = createExperimentsApi(apiConfig);
|
|
3312
3680
|
const sdk = {
|
|
3313
|
-
|
|
3314
|
-
|
|
3681
|
+
account: {
|
|
3682
|
+
update: accountApi.updateAccount,
|
|
3683
|
+
delete: accountApi.deleteAccount,
|
|
3684
|
+
getMe: accountApi.getMe,
|
|
3685
|
+
search: accountApi.searchAccounts,
|
|
3686
|
+
auth: authApi
|
|
3687
|
+
},
|
|
3315
3688
|
store: {
|
|
3316
|
-
|
|
3689
|
+
create: storeApi.createStore,
|
|
3690
|
+
update: storeApi.updateStore,
|
|
3691
|
+
delete: storeApi.deleteStore,
|
|
3692
|
+
get: storeApi.getStore,
|
|
3693
|
+
find: storeApi.getStores,
|
|
3694
|
+
subscription: {
|
|
3695
|
+
getPlans: storeApi.getSubscriptionPlans,
|
|
3696
|
+
subscribe: storeApi.subscribe,
|
|
3697
|
+
createPortalSession: storeApi.createPortalSession
|
|
3698
|
+
},
|
|
3699
|
+
member: {
|
|
3700
|
+
add: storeApi.addMember,
|
|
3701
|
+
invite: storeApi.inviteUser,
|
|
3702
|
+
remove: storeApi.removeMember
|
|
3703
|
+
},
|
|
3704
|
+
buildHook: {
|
|
3705
|
+
list: storeApi.listBuildHooks,
|
|
3706
|
+
create: storeApi.createBuildHook,
|
|
3707
|
+
update: storeApi.updateBuildHook,
|
|
3708
|
+
delete: storeApi.deleteBuildHook
|
|
3709
|
+
},
|
|
3710
|
+
webhook: {
|
|
3711
|
+
test: storeApi.testWebhook,
|
|
3712
|
+
list: storeApi.listWebhooks,
|
|
3713
|
+
create: storeApi.createWebhook,
|
|
3714
|
+
update: storeApi.updateWebhook,
|
|
3715
|
+
delete: storeApi.deleteWebhook
|
|
3716
|
+
},
|
|
3717
|
+
config: {
|
|
3718
|
+
get: storeApi.getStoreConfig
|
|
3719
|
+
},
|
|
3720
|
+
media: {
|
|
3721
|
+
find: storeApi.getStoreMedia
|
|
3722
|
+
},
|
|
3317
3723
|
location: locationApi,
|
|
3318
|
-
market: marketApi
|
|
3724
|
+
market: marketApi,
|
|
3725
|
+
paymentProvider: storePaymentProviderApi
|
|
3319
3726
|
},
|
|
3320
3727
|
media: createMediaApi(apiConfig),
|
|
3321
|
-
notification:
|
|
3322
|
-
|
|
3728
|
+
notification: {
|
|
3729
|
+
email: {
|
|
3730
|
+
trackOpen: notificationApi.trackEmailOpen
|
|
3731
|
+
},
|
|
3732
|
+
trigger: {
|
|
3733
|
+
send: notificationApi.trigger
|
|
3734
|
+
},
|
|
3735
|
+
mailbox: crmApi.mailbox
|
|
3736
|
+
},
|
|
3323
3737
|
platform: platformApi,
|
|
3324
|
-
|
|
3738
|
+
social: {
|
|
3739
|
+
account: {
|
|
3740
|
+
getCapabilities: socialApi.getCapabilities,
|
|
3741
|
+
list: socialApi.listAccounts,
|
|
3742
|
+
connect: socialApi.connect,
|
|
3743
|
+
getOAuthAttempt: socialApi.getOAuthAttempt,
|
|
3744
|
+
selectDestination: socialApi.selectDestination,
|
|
3745
|
+
delete: socialApi.deleteAccount
|
|
3746
|
+
},
|
|
3747
|
+
publication: {
|
|
3748
|
+
create: socialApi.createPublication,
|
|
3749
|
+
update: socialApi.updatePublication,
|
|
3750
|
+
get: socialApi.getPublication,
|
|
3751
|
+
find: socialApi.findPublications,
|
|
3752
|
+
validate: socialApi.validatePublication,
|
|
3753
|
+
schedule: socialApi.schedulePublication,
|
|
3754
|
+
cancel: socialApi.cancelPublication,
|
|
3755
|
+
getComments: socialApi.getPublicationComments,
|
|
3756
|
+
syncComments: socialApi.syncPublicationComments,
|
|
3757
|
+
getCommentThread: socialApi.getPublicationCommentThread,
|
|
3758
|
+
syncCommentThread: socialApi.syncPublicationCommentThread,
|
|
3759
|
+
findComments: socialApi.findPublicationComments,
|
|
3760
|
+
classifyComments: socialApi.classifyPublicationComments,
|
|
3761
|
+
replyToComment: socialApi.replyToPublicationComment,
|
|
3762
|
+
getMetrics: socialApi.getPublicationMetrics,
|
|
3763
|
+
syncMetrics: socialApi.syncPublicationMetrics,
|
|
3764
|
+
syncEngagement: socialApi.syncEngagement
|
|
3765
|
+
}
|
|
3766
|
+
},
|
|
3325
3767
|
cms: {
|
|
3326
|
-
|
|
3327
|
-
create: cmsApi.
|
|
3328
|
-
update: cmsApi.
|
|
3329
|
-
delete: cmsApi.
|
|
3330
|
-
get: cmsApi.
|
|
3331
|
-
find: cmsApi.
|
|
3332
|
-
|
|
3768
|
+
collection: {
|
|
3769
|
+
create: cmsApi.createCollection,
|
|
3770
|
+
update: cmsApi.updateCollection,
|
|
3771
|
+
delete: cmsApi.deleteCollection,
|
|
3772
|
+
get: cmsApi.getCollection,
|
|
3773
|
+
find: cmsApi.getCollections
|
|
3774
|
+
},
|
|
3775
|
+
entry: {
|
|
3776
|
+
create: cmsApi.createEntry,
|
|
3777
|
+
update: cmsApi.updateEntry,
|
|
3778
|
+
delete: cmsApi.deleteEntry,
|
|
3779
|
+
get: cmsApi.getEntry,
|
|
3780
|
+
find: cmsApi.getEntries
|
|
3333
3781
|
},
|
|
3334
3782
|
form: {
|
|
3335
3783
|
create: formApi.createForm,
|
|
@@ -3372,7 +3820,11 @@ function createAdmin(config) {
|
|
|
3372
3820
|
get: eshopApi.getOrder,
|
|
3373
3821
|
find: eshopApi.getOrders,
|
|
3374
3822
|
getQuote: eshopApi.getQuote,
|
|
3375
|
-
processRefund: eshopApi.processRefund
|
|
3823
|
+
processRefund: eshopApi.processRefund,
|
|
3824
|
+
downloadDigitalAccess: eshopApi.downloadDigitalAccess,
|
|
3825
|
+
getShippingRates: shippingApi.getRates,
|
|
3826
|
+
ship: shippingApi.ship,
|
|
3827
|
+
refundShippingLabel: shippingApi.refundLabel
|
|
3376
3828
|
},
|
|
3377
3829
|
cart: {
|
|
3378
3830
|
create: eshopApi.createCart,
|
|
@@ -3407,7 +3859,7 @@ function createAdmin(config) {
|
|
|
3407
3859
|
promoCode: promoCodeApi
|
|
3408
3860
|
},
|
|
3409
3861
|
crm: {
|
|
3410
|
-
|
|
3862
|
+
contact: {
|
|
3411
3863
|
create: crmApi.create,
|
|
3412
3864
|
get: crmApi.get,
|
|
3413
3865
|
find: crmApi.find,
|
|
@@ -3417,30 +3869,51 @@ function createAdmin(config) {
|
|
|
3417
3869
|
revokeToken: crmApi.revokeToken,
|
|
3418
3870
|
revokeAllTokens: crmApi.revokeAllTokens
|
|
3419
3871
|
},
|
|
3420
|
-
|
|
3421
|
-
|
|
3872
|
+
contactList: {
|
|
3873
|
+
create: crmApi.contactList.create,
|
|
3874
|
+
update: crmApi.contactList.update,
|
|
3875
|
+
get: crmApi.contactList.get,
|
|
3876
|
+
find: crmApi.contactList.find,
|
|
3877
|
+
importContacts: crmApi.contactList.importContacts,
|
|
3878
|
+
previewImportContacts: crmApi.contactList.previewImportContacts,
|
|
3879
|
+
addMember: crmApi.contactList.members.add,
|
|
3880
|
+
updateMember: crmApi.contactList.members.update,
|
|
3881
|
+
removeMember: crmApi.contactList.members.remove,
|
|
3882
|
+
findMembers: crmApi.contactList.members.find
|
|
3883
|
+
},
|
|
3884
|
+
action: crmApi.action
|
|
3885
|
+
},
|
|
3886
|
+
outreach: {
|
|
3422
3887
|
campaign: crmApi.campaign,
|
|
3423
|
-
|
|
3888
|
+
campaignEnrollment: crmApi.campaignEnrollment,
|
|
3424
3889
|
campaignMessage: crmApi.campaignMessage,
|
|
3425
3890
|
suppression: crmApi.suppression,
|
|
3426
|
-
leadResearch
|
|
3427
|
-
activity: crmApi.activity
|
|
3891
|
+
leadResearch: leadResearchApi
|
|
3428
3892
|
},
|
|
3429
|
-
leadResearch,
|
|
3430
3893
|
automation: {
|
|
3431
|
-
workflow:
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3894
|
+
workflow: workflowPublicApi,
|
|
3895
|
+
support: {
|
|
3896
|
+
createChannel: supportApi.channel.create,
|
|
3897
|
+
getChannel: supportApi.channel.get,
|
|
3898
|
+
findChannels: supportApi.channel.find,
|
|
3899
|
+
updateChannel: supportApi.channel.update,
|
|
3900
|
+
deleteChannel: supportApi.channel.delete,
|
|
3901
|
+
receiveChannelMessage: supportApi.channel.receiveMessage,
|
|
3902
|
+
createAgent: supportApi.agent.create,
|
|
3903
|
+
getAgent: supportApi.agent.get,
|
|
3904
|
+
findAgents: supportApi.agent.find,
|
|
3905
|
+
updateAgent: supportApi.agent.update,
|
|
3906
|
+
deleteAgent: supportApi.agent.delete,
|
|
3907
|
+
findConversations: supportApi.conversation.find,
|
|
3908
|
+
getConversation: supportApi.conversation.get,
|
|
3909
|
+
sendConversationMessage: supportApi.conversation.sendMessage,
|
|
3910
|
+
replyToConversation: supportApi.conversation.reply,
|
|
3911
|
+
resolveConversation: supportApi.conversation.resolve,
|
|
3912
|
+
assignConversation: supportApi.conversation.assign
|
|
3913
|
+
}
|
|
3442
3914
|
},
|
|
3443
3915
|
analytics: analyticsApi,
|
|
3916
|
+
experiments: experimentsApi,
|
|
3444
3917
|
setStoreId: (storeId) => {
|
|
3445
3918
|
apiConfig.storeId = storeId;
|
|
3446
3919
|
},
|
|
@@ -3476,27 +3949,26 @@ function createAdmin(config) {
|
|
|
3476
3949
|
if (config.apiToken) return;
|
|
3477
3950
|
updateSession(() => null);
|
|
3478
3951
|
},
|
|
3479
|
-
extractBlockValues,
|
|
3480
3952
|
utils: createUtilitySurface(apiConfig)
|
|
3481
3953
|
};
|
|
3482
3954
|
return sdk;
|
|
3483
3955
|
}
|
|
3484
|
-
var
|
|
3485
|
-
function
|
|
3956
|
+
var CONTACT_STORAGE_KEY = "arky_contact_session";
|
|
3957
|
+
function readContactSession() {
|
|
3486
3958
|
if (typeof window === "undefined") return null;
|
|
3487
3959
|
try {
|
|
3488
|
-
const raw = localStorage.getItem(
|
|
3960
|
+
const raw = localStorage.getItem(CONTACT_STORAGE_KEY);
|
|
3489
3961
|
return raw ? JSON.parse(raw) : null;
|
|
3490
3962
|
} catch {
|
|
3491
3963
|
return null;
|
|
3492
3964
|
}
|
|
3493
3965
|
}
|
|
3494
|
-
function
|
|
3966
|
+
function writeContactSession(s) {
|
|
3495
3967
|
if (typeof window === "undefined") return;
|
|
3496
3968
|
if (s) {
|
|
3497
|
-
localStorage.setItem(
|
|
3969
|
+
localStorage.setItem(CONTACT_STORAGE_KEY, JSON.stringify(s));
|
|
3498
3970
|
} else {
|
|
3499
|
-
localStorage.removeItem(
|
|
3971
|
+
localStorage.removeItem(CONTACT_STORAGE_KEY);
|
|
3500
3972
|
}
|
|
3501
3973
|
}
|
|
3502
3974
|
function createStorefront(config) {
|
|
@@ -3505,10 +3977,10 @@ function createStorefront(config) {
|
|
|
3505
3977
|
const listeners = /* @__PURE__ */ new Set();
|
|
3506
3978
|
let bareIdentifyPromise = null;
|
|
3507
3979
|
function toPublic(s) {
|
|
3508
|
-
return s ? {
|
|
3980
|
+
return s ? { contact: s.contact, store: s.store, market: s.market } : null;
|
|
3509
3981
|
}
|
|
3510
3982
|
function emit() {
|
|
3511
|
-
const pub = toPublic(
|
|
3983
|
+
const pub = toPublic(readContactSession());
|
|
3512
3984
|
for (const l of listeners) {
|
|
3513
3985
|
Promise.resolve().then(() => l(pub)).catch(() => {
|
|
3514
3986
|
});
|
|
@@ -3516,9 +3988,9 @@ function createStorefront(config) {
|
|
|
3516
3988
|
}
|
|
3517
3989
|
const updateSession = (updater) => {
|
|
3518
3990
|
if (config.apiToken) return;
|
|
3519
|
-
const prev =
|
|
3991
|
+
const prev = readContactSession();
|
|
3520
3992
|
const next = updater(prev);
|
|
3521
|
-
|
|
3993
|
+
writeContactSession(next);
|
|
3522
3994
|
emit();
|
|
3523
3995
|
};
|
|
3524
3996
|
const authStorage = config.apiToken ? {
|
|
@@ -3529,7 +4001,7 @@ function createStorefront(config) {
|
|
|
3529
4001
|
}
|
|
3530
4002
|
} : {
|
|
3531
4003
|
getTokens() {
|
|
3532
|
-
const s =
|
|
4004
|
+
const s = readContactSession();
|
|
3533
4005
|
return s ? { access_token: s.access_token } : null;
|
|
3534
4006
|
},
|
|
3535
4007
|
onTokensRefreshed() {
|
|
@@ -3556,20 +4028,20 @@ function createStorefront(config) {
|
|
|
3556
4028
|
authStorage
|
|
3557
4029
|
};
|
|
3558
4030
|
const storefrontApi = createStorefrontApi(apiConfig, updateSession);
|
|
3559
|
-
const
|
|
4031
|
+
const contactApi = storefrontApi.crm.contact;
|
|
3560
4032
|
function identify(params) {
|
|
3561
4033
|
if (params?.market !== void 0) apiConfig.market = params.market;
|
|
3562
4034
|
const isBareCall = !params?.email && !params?.verify;
|
|
3563
4035
|
if (isBareCall && bareIdentifyPromise) return bareIdentifyPromise;
|
|
3564
4036
|
const promise = (async () => {
|
|
3565
4037
|
try {
|
|
3566
|
-
const result = await
|
|
4038
|
+
const result = await contactApi.identify({
|
|
3567
4039
|
market: apiConfig.market,
|
|
3568
4040
|
email: params?.email,
|
|
3569
4041
|
verify: params?.verify
|
|
3570
4042
|
});
|
|
3571
4043
|
return {
|
|
3572
|
-
|
|
4044
|
+
contact: result.contact,
|
|
3573
4045
|
store: result.store,
|
|
3574
4046
|
market: result.market
|
|
3575
4047
|
};
|
|
@@ -3578,9 +4050,11 @@ function createStorefront(config) {
|
|
|
3578
4050
|
const status = e?.statusCode || e?.status || e?.response?.status;
|
|
3579
4051
|
if (isBareCall && status === 401) {
|
|
3580
4052
|
updateSession(() => null);
|
|
3581
|
-
const result = await
|
|
4053
|
+
const result = await contactApi.identify({
|
|
4054
|
+
market: apiConfig.market
|
|
4055
|
+
});
|
|
3582
4056
|
return {
|
|
3583
|
-
|
|
4057
|
+
contact: result.contact,
|
|
3584
4058
|
store: result.store,
|
|
3585
4059
|
market: result.market
|
|
3586
4060
|
};
|
|
@@ -3595,7 +4069,7 @@ function createStorefront(config) {
|
|
|
3595
4069
|
return promise;
|
|
3596
4070
|
}
|
|
3597
4071
|
async function verify(params) {
|
|
3598
|
-
const result = await
|
|
4072
|
+
const result = await contactApi.verify(params);
|
|
3599
4073
|
bareIdentifyPromise = null;
|
|
3600
4074
|
return result;
|
|
3601
4075
|
}
|
|
@@ -3603,7 +4077,7 @@ function createStorefront(config) {
|
|
|
3603
4077
|
if (config.apiToken) return;
|
|
3604
4078
|
bareIdentifyPromise = null;
|
|
3605
4079
|
try {
|
|
3606
|
-
await
|
|
4080
|
+
await contactApi.logout();
|
|
3607
4081
|
} catch {
|
|
3608
4082
|
updateSession(() => null);
|
|
3609
4083
|
}
|
|
@@ -3612,19 +4086,19 @@ function createStorefront(config) {
|
|
|
3612
4086
|
identify,
|
|
3613
4087
|
verify,
|
|
3614
4088
|
logout,
|
|
3615
|
-
me: () =>
|
|
4089
|
+
me: () => contactApi.getMe(),
|
|
3616
4090
|
get session() {
|
|
3617
4091
|
if (config.apiToken) return null;
|
|
3618
|
-
return toPublic(
|
|
4092
|
+
return toPublic(readContactSession());
|
|
3619
4093
|
},
|
|
3620
4094
|
get isAuthenticated() {
|
|
3621
4095
|
if (config.apiToken) return true;
|
|
3622
|
-
const s =
|
|
4096
|
+
const s = readContactSession();
|
|
3623
4097
|
return s !== null && !!s.access_token;
|
|
3624
4098
|
},
|
|
3625
4099
|
onAuthStateChanged(listener) {
|
|
3626
4100
|
listeners.add(listener);
|
|
3627
|
-
const current = toPublic(
|
|
4101
|
+
const current = toPublic(readContactSession());
|
|
3628
4102
|
if (current) {
|
|
3629
4103
|
Promise.resolve().then(() => listener(current)).catch(() => {
|
|
3630
4104
|
});
|
|
@@ -3638,7 +4112,8 @@ function createStorefront(config) {
|
|
|
3638
4112
|
cms: storefrontApi.cms,
|
|
3639
4113
|
eshop: storefrontApi.eshop,
|
|
3640
4114
|
crm: storefrontApi.crm,
|
|
3641
|
-
|
|
4115
|
+
action: storefrontApi.action,
|
|
4116
|
+
experiments: storefrontApi.experiments,
|
|
3642
4117
|
support: createStorefrontSupportApi(apiConfig),
|
|
3643
4118
|
setStoreId: (storeId) => {
|
|
3644
4119
|
apiConfig.storeId = storeId;
|
|
@@ -3654,12 +4129,11 @@ function createStorefront(config) {
|
|
|
3654
4129
|
apiConfig.locale = l;
|
|
3655
4130
|
},
|
|
3656
4131
|
getLocale: () => apiConfig.locale,
|
|
3657
|
-
extractBlockValues,
|
|
3658
4132
|
utils: createUtilitySurface(apiConfig)
|
|
3659
4133
|
};
|
|
3660
4134
|
}
|
|
3661
4135
|
|
|
3662
|
-
exports.
|
|
4136
|
+
exports.COMMON_ACTION_KEYS = COMMON_ACTION_KEYS;
|
|
3663
4137
|
exports.PaymentMethodType = PaymentMethodType;
|
|
3664
4138
|
exports.SDK_VERSION = SDK_VERSION;
|
|
3665
4139
|
exports.SUPPORTED_FRAMEWORKS = SUPPORTED_FRAMEWORKS;
|