arky-sdk 0.7.80 → 0.7.85
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/dist/index.cjs +222 -187
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -59
- package/dist/index.d.ts +76 -59
- package/dist/index.js +222 -187
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +518 -521
- package/dist/types.d.ts +518 -521
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +4 -2
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +4 -2
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { atom, computed } from 'nanostores';
|
|
2
|
+
|
|
1
3
|
// src/types/index.ts
|
|
2
4
|
var PaymentMethodType = /* @__PURE__ */ ((PaymentMethodType2) => {
|
|
3
5
|
PaymentMethodType2["Cash"] = "cash";
|
|
@@ -24,7 +26,7 @@ function formatBlockValue(block) {
|
|
|
24
26
|
case "relationship_entry":
|
|
25
27
|
case "relationship_media":
|
|
26
28
|
if (value && typeof value === "object") {
|
|
27
|
-
return value.
|
|
29
|
+
return value.mime_type ? value.name || value.id : value.title || value.name || value.id;
|
|
28
30
|
}
|
|
29
31
|
return String(value);
|
|
30
32
|
default:
|
|
@@ -149,42 +151,26 @@ var COMMON_ACTIVITY_TYPES = [
|
|
|
149
151
|
"share",
|
|
150
152
|
"wishlist_added"
|
|
151
153
|
];
|
|
152
|
-
async function ensureCustomer(apiConfig) {
|
|
153
|
-
if (apiConfig.getToken) {
|
|
154
|
-
const tokens = await apiConfig.getToken();
|
|
155
|
-
if (tokens?.accessToken) return;
|
|
156
|
-
}
|
|
157
|
-
const response = await apiConfig.httpClient.post(
|
|
158
|
-
`/v1/storefront/${apiConfig.businessId}/customers/initialize`,
|
|
159
|
-
{
|
|
160
|
-
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0
|
|
161
|
-
}
|
|
162
|
-
);
|
|
163
|
-
const accessToken = response?.accessToken;
|
|
164
|
-
const refreshToken = response?.refreshToken;
|
|
165
|
-
const accessExpiresAt = response?.accessExpiresAt;
|
|
166
|
-
if (accessToken) {
|
|
167
|
-
apiConfig.setToken?.({ accessToken, refreshToken, accessExpiresAt });
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
154
|
var createActivityApi = (apiConfig) => ({
|
|
171
155
|
COMMON_ACTIVITY_TYPES,
|
|
172
156
|
async track(params) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
157
|
+
try {
|
|
158
|
+
await apiConfig.httpClient.post(
|
|
159
|
+
`/v1/storefront/${apiConfig.businessId}/activities/track`,
|
|
160
|
+
{ type: params.type, payload: params.payload }
|
|
161
|
+
);
|
|
162
|
+
} catch {
|
|
163
|
+
}
|
|
178
164
|
}
|
|
179
165
|
});
|
|
180
166
|
function groupCartToItems(cart) {
|
|
181
167
|
const groups = /* @__PURE__ */ new Map();
|
|
182
168
|
for (const slot of cart) {
|
|
183
|
-
const key = `${slot.
|
|
169
|
+
const key = `${slot.service_id}:${slot.provider_id}`;
|
|
184
170
|
if (!groups.has(key)) {
|
|
185
171
|
groups.set(key, {
|
|
186
|
-
|
|
187
|
-
|
|
172
|
+
service_id: slot.service_id,
|
|
173
|
+
provider_id: slot.provider_id,
|
|
188
174
|
slots: []
|
|
189
175
|
});
|
|
190
176
|
}
|
|
@@ -200,12 +186,6 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
200
186
|
getBusiness(options) {
|
|
201
187
|
return apiConfig.httpClient.get(base(), options);
|
|
202
188
|
},
|
|
203
|
-
getIntegrationConfig(params, options) {
|
|
204
|
-
return apiConfig.httpClient.get(
|
|
205
|
-
`${base(params.businessId)}/integrations/config/${params.type}`,
|
|
206
|
-
options
|
|
207
|
-
);
|
|
208
|
-
},
|
|
209
189
|
location: {
|
|
210
190
|
getCountries(options) {
|
|
211
191
|
return apiConfig.httpClient.get(`/v1/platform/countries`, options);
|
|
@@ -359,18 +339,18 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
359
339
|
getQuote(params, options) {
|
|
360
340
|
const businessId = params.businessId || apiConfig.businessId;
|
|
361
341
|
const { location, businessId: _businessId, ...rest } = params;
|
|
362
|
-
const
|
|
342
|
+
const shipping_address = location ? {
|
|
363
343
|
country: location.country || "",
|
|
364
344
|
state: location.state || "",
|
|
365
345
|
city: location.city || "",
|
|
366
|
-
|
|
346
|
+
postal_code: location.postal_code || "",
|
|
367
347
|
name: "",
|
|
368
348
|
street1: "",
|
|
369
349
|
street2: null
|
|
370
350
|
} : void 0;
|
|
371
351
|
return apiConfig.httpClient.post(
|
|
372
352
|
`${base(businessId)}/orders/quote`,
|
|
373
|
-
{ ...rest,
|
|
353
|
+
{ ...rest, shipping_address, market: apiConfig.market },
|
|
374
354
|
options
|
|
375
355
|
);
|
|
376
356
|
},
|
|
@@ -520,15 +500,7 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
520
500
|
const businessId = params?.businessId || apiConfig.businessId;
|
|
521
501
|
return apiConfig.httpClient.post(
|
|
522
502
|
`${base(businessId)}/customers/initialize`,
|
|
523
|
-
{ businessId },
|
|
524
|
-
options
|
|
525
|
-
);
|
|
526
|
-
},
|
|
527
|
-
signInAnonymously(params, options) {
|
|
528
|
-
const businessId = params?.businessId || apiConfig.businessId;
|
|
529
|
-
return apiConfig.httpClient.post(
|
|
530
|
-
`${base(businessId)}/customers/initialize`,
|
|
531
|
-
{ businessId },
|
|
503
|
+
{ business_id: businessId, market: params?.market || apiConfig.market },
|
|
532
504
|
options
|
|
533
505
|
);
|
|
534
506
|
},
|
|
@@ -560,7 +532,7 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
560
532
|
const businessId = params.businessId || apiConfig.businessId;
|
|
561
533
|
return apiConfig.httpClient.post(
|
|
562
534
|
`${base(businessId)}/customers/auth/refresh`,
|
|
563
|
-
{
|
|
535
|
+
{ refresh_token: params.refresh_token },
|
|
564
536
|
options
|
|
565
537
|
);
|
|
566
538
|
},
|
|
@@ -593,11 +565,11 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
593
565
|
return apiConfig.httpClient.post(
|
|
594
566
|
`${base()}/audiences/${params.id}/subscribe`,
|
|
595
567
|
{
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
568
|
+
customer_id: params.customer_id,
|
|
569
|
+
price_id: params.price_id,
|
|
570
|
+
success_url: params.success_url,
|
|
571
|
+
cancel_url: params.cancel_url,
|
|
572
|
+
confirm_url: params.confirm_url
|
|
601
573
|
},
|
|
602
574
|
options
|
|
603
575
|
);
|
|
@@ -644,7 +616,7 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
644
616
|
sendMessage(params, options) {
|
|
645
617
|
const businessId = params.businessId || apiConfig.businessId;
|
|
646
618
|
const body = { message: params.message };
|
|
647
|
-
if (params.
|
|
619
|
+
if (params.chat_id) body.chat_id = params.chat_id;
|
|
648
620
|
return apiConfig.httpClient.post(
|
|
649
621
|
`${base(businessId)}/agents/${params.id}/chats/messages`,
|
|
650
622
|
body,
|
|
@@ -654,7 +626,7 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
654
626
|
getChat(params, options) {
|
|
655
627
|
const businessId = params.businessId || apiConfig.businessId;
|
|
656
628
|
return apiConfig.httpClient.get(
|
|
657
|
-
`${base(businessId)}/agents/${params.id}/chats/${params.
|
|
629
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chat_id}`,
|
|
658
630
|
options
|
|
659
631
|
);
|
|
660
632
|
},
|
|
@@ -663,7 +635,7 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
663
635
|
const queryParams = {};
|
|
664
636
|
if (params.limit) queryParams.limit = String(params.limit);
|
|
665
637
|
return apiConfig.httpClient.get(
|
|
666
|
-
`${base(businessId)}/agents/${params.id}/chats/${params.
|
|
638
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chat_id}/messages`,
|
|
667
639
|
{
|
|
668
640
|
...options,
|
|
669
641
|
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
@@ -675,7 +647,7 @@ var createStorefrontApi = (apiConfig) => {
|
|
|
675
647
|
const body = { rating: params.rating };
|
|
676
648
|
if (params.comment) body.comment = params.comment;
|
|
677
649
|
return apiConfig.httpClient.post(
|
|
678
|
-
`${base(businessId)}/agents/${params.id}/chats/${params.
|
|
650
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chat_id}/rate`,
|
|
679
651
|
body,
|
|
680
652
|
options
|
|
681
653
|
);
|
|
@@ -729,19 +701,19 @@ var STORAGE_KEYS = {
|
|
|
729
701
|
accessExpiresAt: "arky_expires_at"
|
|
730
702
|
};
|
|
731
703
|
function defaultGetToken() {
|
|
732
|
-
if (typeof window === "undefined") return {
|
|
704
|
+
if (typeof window === "undefined") return { access_token: "" };
|
|
733
705
|
return {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
706
|
+
access_token: localStorage.getItem(STORAGE_KEYS.accessToken) || "",
|
|
707
|
+
refresh_token: localStorage.getItem(STORAGE_KEYS.refreshToken) || "",
|
|
708
|
+
access_expires_at: parseInt(localStorage.getItem(STORAGE_KEYS.accessExpiresAt) || "0", 10)
|
|
737
709
|
};
|
|
738
710
|
}
|
|
739
711
|
function defaultSetToken(tokens) {
|
|
740
712
|
if (typeof window === "undefined") return;
|
|
741
|
-
if (tokens.
|
|
742
|
-
localStorage.setItem(STORAGE_KEYS.accessToken, tokens.
|
|
743
|
-
localStorage.setItem(STORAGE_KEYS.refreshToken, tokens.
|
|
744
|
-
localStorage.setItem(STORAGE_KEYS.accessExpiresAt, (tokens.
|
|
713
|
+
if (tokens.access_token) {
|
|
714
|
+
localStorage.setItem(STORAGE_KEYS.accessToken, tokens.access_token);
|
|
715
|
+
localStorage.setItem(STORAGE_KEYS.refreshToken, tokens.refresh_token || "");
|
|
716
|
+
localStorage.setItem(STORAGE_KEYS.accessExpiresAt, (tokens.access_expires_at || 0).toString());
|
|
745
717
|
} else {
|
|
746
718
|
Object.values(STORAGE_KEYS).forEach((key) => localStorage.removeItem(key));
|
|
747
719
|
}
|
|
@@ -766,8 +738,8 @@ function createHttpClient(cfg) {
|
|
|
766
738
|
return refreshPromise;
|
|
767
739
|
}
|
|
768
740
|
refreshPromise = (async () => {
|
|
769
|
-
const {
|
|
770
|
-
if (!
|
|
741
|
+
const { refresh_token } = await getToken();
|
|
742
|
+
if (!refresh_token) {
|
|
771
743
|
logout();
|
|
772
744
|
const err = new Error("No refresh token available");
|
|
773
745
|
err.name = "ApiError";
|
|
@@ -777,7 +749,7 @@ function createHttpClient(cfg) {
|
|
|
777
749
|
const refRes = await fetch(refreshEndpoint, {
|
|
778
750
|
method: "POST",
|
|
779
751
|
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
780
|
-
body: JSON.stringify({
|
|
752
|
+
body: JSON.stringify({ refresh_token })
|
|
781
753
|
});
|
|
782
754
|
if (!refRes.ok) {
|
|
783
755
|
logout();
|
|
@@ -802,15 +774,15 @@ function createHttpClient(cfg) {
|
|
|
802
774
|
"Content-Type": "application/json",
|
|
803
775
|
...options?.headers || {}
|
|
804
776
|
};
|
|
805
|
-
let {
|
|
777
|
+
let { access_token, access_expires_at } = await getToken();
|
|
806
778
|
const nowSec = Date.now() / 1e3;
|
|
807
|
-
if (
|
|
779
|
+
if (access_expires_at && nowSec > access_expires_at) {
|
|
808
780
|
await ensureFreshToken();
|
|
809
781
|
const tokens = await getToken();
|
|
810
|
-
|
|
782
|
+
access_token = tokens.access_token;
|
|
811
783
|
}
|
|
812
|
-
if (
|
|
813
|
-
headers["Authorization"] = `Bearer ${
|
|
784
|
+
if (access_token) {
|
|
785
|
+
headers["Authorization"] = `Bearer ${access_token}`;
|
|
814
786
|
}
|
|
815
787
|
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
816
788
|
const fetchOpts = { method, headers };
|
|
@@ -840,7 +812,7 @@ function createHttpClient(cfg) {
|
|
|
840
812
|
try {
|
|
841
813
|
await ensureFreshToken();
|
|
842
814
|
const tokens = await getToken();
|
|
843
|
-
headers["Authorization"] = `Bearer ${tokens.
|
|
815
|
+
headers["Authorization"] = `Bearer ${tokens.access_token}`;
|
|
844
816
|
fetchOpts.headers = headers;
|
|
845
817
|
return request(method, path, body, { ...options, _retried: true });
|
|
846
818
|
} catch (refreshError) {
|
|
@@ -925,9 +897,9 @@ var createAccountApi = (apiConfig) => {
|
|
|
925
897
|
return {
|
|
926
898
|
async updateAccount(params, options) {
|
|
927
899
|
const payload = {};
|
|
928
|
-
if (params.
|
|
900
|
+
if (params.phone_numbers !== void 0) payload.phone_numbers = params.phone_numbers;
|
|
929
901
|
if (params.addresses !== void 0) payload.addresses = params.addresses;
|
|
930
|
-
if (params.
|
|
902
|
+
if (params.api_tokens !== void 0) payload.api_tokens = params.api_tokens;
|
|
931
903
|
return apiConfig.httpClient.put("/v1/accounts", payload, options);
|
|
932
904
|
},
|
|
933
905
|
async deleteAccount(params, options) {
|
|
@@ -956,8 +928,8 @@ var createAuthApi = (apiConfig) => {
|
|
|
956
928
|
},
|
|
957
929
|
async verify(params, options) {
|
|
958
930
|
const result = await apiConfig.httpClient.post("/v1/auth/verify", params, options);
|
|
959
|
-
if (result?.
|
|
960
|
-
apiConfig.setToken({ ...result, email: params.email,
|
|
931
|
+
if (result?.access_token) {
|
|
932
|
+
apiConfig.setToken({ ...result, email: params.email, is_verified: true });
|
|
961
933
|
}
|
|
962
934
|
return result;
|
|
963
935
|
},
|
|
@@ -969,8 +941,8 @@ var createAuthApi = (apiConfig) => {
|
|
|
969
941
|
},
|
|
970
942
|
async businessVerify(businessId, params, options) {
|
|
971
943
|
const result = await apiConfig.httpClient.post(`/v1/businesses/${businessId}/auth/verify`, params, options);
|
|
972
|
-
if (result?.
|
|
973
|
-
apiConfig.setToken({ ...result, email: params.email,
|
|
944
|
+
if (result?.access_token) {
|
|
945
|
+
apiConfig.setToken({ ...result, email: params.email, is_verified: true });
|
|
974
946
|
}
|
|
975
947
|
return result;
|
|
976
948
|
},
|
|
@@ -1037,7 +1009,7 @@ var createBusinessApi = (apiConfig) => {
|
|
|
1037
1009
|
},
|
|
1038
1010
|
async removeMember(params, options) {
|
|
1039
1011
|
return apiConfig.httpClient.delete(
|
|
1040
|
-
`/v1/businesses/${apiConfig.businessId}/members/${params.
|
|
1012
|
+
`/v1/businesses/${apiConfig.businessId}/members/${params.account_id}`,
|
|
1041
1013
|
options
|
|
1042
1014
|
);
|
|
1043
1015
|
},
|
|
@@ -1062,9 +1034,9 @@ var createBusinessApi = (apiConfig) => {
|
|
|
1062
1034
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1063
1035
|
if (params.ids && params.ids.length > 0) queryParams.ids = params.ids.join(",");
|
|
1064
1036
|
if (params.query) queryParams.query = params.query;
|
|
1065
|
-
if (params.
|
|
1066
|
-
if (params.
|
|
1067
|
-
if (params.
|
|
1037
|
+
if (params.mime_type) queryParams.mime_type = params.mime_type;
|
|
1038
|
+
if (params.sort_field) queryParams.sort_field = params.sort_field;
|
|
1039
|
+
if (params.sort_direction) queryParams.sort_direction = params.sort_direction;
|
|
1068
1040
|
return apiConfig.httpClient.get(`/v1/businesses/${params.id}/media`, {
|
|
1069
1041
|
...options,
|
|
1070
1042
|
params: queryParams
|
|
@@ -1073,7 +1045,7 @@ var createBusinessApi = (apiConfig) => {
|
|
|
1073
1045
|
async oauthConnect(params, options) {
|
|
1074
1046
|
return apiConfig.httpClient.post(
|
|
1075
1047
|
`/v1/businesses/${params.businessId}/oauth/connect`,
|
|
1076
|
-
{ provider: params.provider, code: params.code,
|
|
1048
|
+
{ provider: params.provider, code: params.code, redirect_uri: params.redirect_uri },
|
|
1077
1049
|
options
|
|
1078
1050
|
);
|
|
1079
1051
|
},
|
|
@@ -1171,7 +1143,7 @@ var createMediaApi = (apiConfig) => {
|
|
|
1171
1143
|
method: "POST",
|
|
1172
1144
|
body: formData,
|
|
1173
1145
|
headers: {
|
|
1174
|
-
Authorization: `Bearer ${tokens.
|
|
1146
|
+
Authorization: `Bearer ${tokens.access_token}`
|
|
1175
1147
|
}
|
|
1176
1148
|
});
|
|
1177
1149
|
if (!response.ok) {
|
|
@@ -1187,21 +1159,21 @@ var createMediaApi = (apiConfig) => {
|
|
|
1187
1159
|
);
|
|
1188
1160
|
},
|
|
1189
1161
|
async getBusinessMedia(params, options) {
|
|
1190
|
-
const { businessId, cursor, limit, ids, query,
|
|
1162
|
+
const { businessId, cursor, limit, ids, query, mime_type, sort_field, sort_direction } = params;
|
|
1191
1163
|
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1192
1164
|
const url = `${apiConfig.baseUrl}/v1/businesses/${targetBusinessId}/media`;
|
|
1193
1165
|
const queryParams = { limit: String(limit) };
|
|
1194
1166
|
if (cursor) queryParams.cursor = cursor;
|
|
1195
1167
|
if (ids && ids.length > 0) queryParams.ids = ids.join(",");
|
|
1196
1168
|
if (query) queryParams.query = query;
|
|
1197
|
-
if (
|
|
1198
|
-
if (
|
|
1199
|
-
if (
|
|
1169
|
+
if (mime_type) queryParams.mime_type = mime_type;
|
|
1170
|
+
if (sort_field) queryParams.sort_field = sort_field;
|
|
1171
|
+
if (sort_direction) queryParams.sort_direction = sort_direction;
|
|
1200
1172
|
const queryString = new URLSearchParams(queryParams).toString();
|
|
1201
1173
|
const tokens = await apiConfig.getToken();
|
|
1202
1174
|
const response = await fetch(`${url}?${queryString}`, {
|
|
1203
1175
|
headers: {
|
|
1204
|
-
Authorization: `Bearer ${tokens.
|
|
1176
|
+
Authorization: `Bearer ${tokens.access_token}`
|
|
1205
1177
|
}
|
|
1206
1178
|
});
|
|
1207
1179
|
if (!response.ok) {
|
|
@@ -1227,7 +1199,7 @@ var createNotificationApi = (apiConfig) => {
|
|
|
1227
1199
|
return {
|
|
1228
1200
|
async trackEmailOpen(params, options) {
|
|
1229
1201
|
return apiConfig.httpClient.get(
|
|
1230
|
-
`/v1/notifications/track/pixel/${params.
|
|
1202
|
+
`/v1/notifications/track/pixel/${params.tracking_pixel_id}`,
|
|
1231
1203
|
options
|
|
1232
1204
|
);
|
|
1233
1205
|
},
|
|
@@ -1439,18 +1411,18 @@ var createEshopApi = (apiConfig) => {
|
|
|
1439
1411
|
},
|
|
1440
1412
|
async getQuote(params, options) {
|
|
1441
1413
|
const { location, ...rest } = params;
|
|
1442
|
-
const
|
|
1414
|
+
const shipping_address = location ? {
|
|
1443
1415
|
country: location.country || "",
|
|
1444
1416
|
state: location.state || "",
|
|
1445
1417
|
city: location.city || "",
|
|
1446
|
-
|
|
1418
|
+
postal_code: location.postal_code || "",
|
|
1447
1419
|
name: "",
|
|
1448
1420
|
street1: "",
|
|
1449
1421
|
street2: null
|
|
1450
1422
|
} : void 0;
|
|
1451
1423
|
return apiConfig.httpClient.post(
|
|
1452
1424
|
`/v1/businesses/${apiConfig.businessId}/orders/quote`,
|
|
1453
|
-
{ ...rest,
|
|
1425
|
+
{ ...rest, shipping_address, market: apiConfig.market },
|
|
1454
1426
|
options
|
|
1455
1427
|
);
|
|
1456
1428
|
},
|
|
@@ -1642,10 +1614,10 @@ var createBookingApi = (apiConfig) => {
|
|
|
1642
1614
|
);
|
|
1643
1615
|
},
|
|
1644
1616
|
async cancelBookingItem(params, options) {
|
|
1645
|
-
const { businessId,
|
|
1617
|
+
const { businessId, booking_id, item_id, ...payload } = params;
|
|
1646
1618
|
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1647
1619
|
return apiConfig.httpClient.post(
|
|
1648
|
-
`/v1/businesses/${targetBusinessId}/bookings/${
|
|
1620
|
+
`/v1/businesses/${targetBusinessId}/bookings/${booking_id}/items/${item_id}/cancel`,
|
|
1649
1621
|
payload,
|
|
1650
1622
|
options
|
|
1651
1623
|
);
|
|
@@ -1775,7 +1747,7 @@ var createMarketApi = (apiConfig) => {
|
|
|
1775
1747
|
var createActivityAdminApi = (apiConfig) => ({
|
|
1776
1748
|
async timeline(params, options) {
|
|
1777
1749
|
const businessId = params.businessId || apiConfig.businessId;
|
|
1778
|
-
const queryParams = {
|
|
1750
|
+
const queryParams = { customer_id: params.customer_id };
|
|
1779
1751
|
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1780
1752
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1781
1753
|
return apiConfig.httpClient.get(
|
|
@@ -1805,8 +1777,8 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1805
1777
|
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1806
1778
|
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1807
1779
|
if (params?.query) queryParams.query = params.query;
|
|
1808
|
-
if (params?.
|
|
1809
|
-
if (params?.
|
|
1780
|
+
if (params?.sort_field) queryParams.sort_field = params.sort_field;
|
|
1781
|
+
if (params?.sort_direction) queryParams.sort_direction = params.sort_direction;
|
|
1810
1782
|
return apiConfig.httpClient.get(
|
|
1811
1783
|
`/v1/businesses/${businessId}/customers`,
|
|
1812
1784
|
{
|
|
@@ -1826,8 +1798,8 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1826
1798
|
async merge(params, options) {
|
|
1827
1799
|
const businessId = params.businessId || apiConfig.businessId;
|
|
1828
1800
|
return apiConfig.httpClient.post(
|
|
1829
|
-
`/v1/businesses/${businessId}/customers/${params.
|
|
1830
|
-
{
|
|
1801
|
+
`/v1/businesses/${businessId}/customers/${params.target_id}/merge`,
|
|
1802
|
+
{ source_id: params.source_id, businessId },
|
|
1831
1803
|
options
|
|
1832
1804
|
);
|
|
1833
1805
|
},
|
|
@@ -1892,13 +1864,13 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1892
1864
|
async addSubscriber(params, options) {
|
|
1893
1865
|
return apiConfig.httpClient.post(
|
|
1894
1866
|
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}/subscribers`,
|
|
1895
|
-
{
|
|
1867
|
+
{ customer_id: params.customer_id },
|
|
1896
1868
|
options
|
|
1897
1869
|
);
|
|
1898
1870
|
},
|
|
1899
1871
|
async removeSubscriber(params, options) {
|
|
1900
1872
|
return apiConfig.httpClient.delete(
|
|
1901
|
-
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}/subscribers/${params.
|
|
1873
|
+
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}/subscribers/${params.customer_id}`,
|
|
1902
1874
|
options
|
|
1903
1875
|
);
|
|
1904
1876
|
}
|
|
@@ -1951,9 +1923,9 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
1951
1923
|
},
|
|
1952
1924
|
async getWorkflowExecutions(params, options) {
|
|
1953
1925
|
const businessId = params.businessId || apiConfig.businessId;
|
|
1954
|
-
const { businessId: _,
|
|
1926
|
+
const { businessId: _, workflow_id, ...queryParams } = params;
|
|
1955
1927
|
return apiConfig.httpClient.get(
|
|
1956
|
-
`/v1/businesses/${businessId}/workflows/${
|
|
1928
|
+
`/v1/businesses/${businessId}/workflows/${workflow_id}/executions`,
|
|
1957
1929
|
{
|
|
1958
1930
|
...options,
|
|
1959
1931
|
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
@@ -1963,7 +1935,7 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
1963
1935
|
async getWorkflowExecution(params, options) {
|
|
1964
1936
|
const businessId = params.businessId || apiConfig.businessId;
|
|
1965
1937
|
return apiConfig.httpClient.get(
|
|
1966
|
-
`/v1/businesses/${businessId}/workflows/${params.
|
|
1938
|
+
`/v1/businesses/${businessId}/workflows/${params.workflow_id}/executions/${params.execution_id}`,
|
|
1967
1939
|
options
|
|
1968
1940
|
);
|
|
1969
1941
|
}
|
|
@@ -1989,17 +1961,17 @@ var createPlatformApi = (apiConfig) => {
|
|
|
1989
1961
|
var createShippingApi = (apiConfig) => {
|
|
1990
1962
|
return {
|
|
1991
1963
|
async getRates(params, options) {
|
|
1992
|
-
const {
|
|
1964
|
+
const { order_id, ...payload } = params;
|
|
1993
1965
|
return apiConfig.httpClient.post(
|
|
1994
|
-
`/v1/businesses/${apiConfig.businessId}/orders/${
|
|
1966
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${order_id}/shipping/rates`,
|
|
1995
1967
|
payload,
|
|
1996
1968
|
options
|
|
1997
1969
|
);
|
|
1998
1970
|
},
|
|
1999
1971
|
async ship(params, options) {
|
|
2000
|
-
const {
|
|
1972
|
+
const { order_id, ...payload } = params;
|
|
2001
1973
|
return apiConfig.httpClient.post(
|
|
2002
|
-
`/v1/businesses/${apiConfig.businessId}/orders/${
|
|
1974
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${order_id}/ship`,
|
|
2003
1975
|
payload,
|
|
2004
1976
|
options
|
|
2005
1977
|
);
|
|
@@ -2047,7 +2019,7 @@ var createAgentApi = (apiConfig) => {
|
|
|
2047
2019
|
},
|
|
2048
2020
|
async sendMessage(params, options) {
|
|
2049
2021
|
const body = { message: params.message };
|
|
2050
|
-
if (params.
|
|
2022
|
+
if (params.chat_id) body.chat_id = params.chat_id;
|
|
2051
2023
|
if (params.direct) body.direct = params.direct;
|
|
2052
2024
|
return apiConfig.httpClient.post(
|
|
2053
2025
|
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/messages`,
|
|
@@ -2069,13 +2041,13 @@ var createAgentApi = (apiConfig) => {
|
|
|
2069
2041
|
},
|
|
2070
2042
|
async getChat(params, options) {
|
|
2071
2043
|
return apiConfig.httpClient.get(
|
|
2072
|
-
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.
|
|
2044
|
+
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chat_id}`,
|
|
2073
2045
|
options
|
|
2074
2046
|
);
|
|
2075
2047
|
},
|
|
2076
2048
|
async updateChat(params, options) {
|
|
2077
2049
|
return apiConfig.httpClient.put(
|
|
2078
|
-
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.
|
|
2050
|
+
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chat_id}`,
|
|
2079
2051
|
{ status: params.status },
|
|
2080
2052
|
options
|
|
2081
2053
|
);
|
|
@@ -2084,7 +2056,7 @@ var createAgentApi = (apiConfig) => {
|
|
|
2084
2056
|
const body = { rating: params.rating };
|
|
2085
2057
|
if (params.comment) body.comment = params.comment;
|
|
2086
2058
|
return apiConfig.httpClient.post(
|
|
2087
|
-
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.
|
|
2059
|
+
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chat_id}/rate`,
|
|
2088
2060
|
body,
|
|
2089
2061
|
options
|
|
2090
2062
|
);
|
|
@@ -2101,7 +2073,7 @@ var createAgentApi = (apiConfig) => {
|
|
|
2101
2073
|
const queryParams = {};
|
|
2102
2074
|
if (params.limit) queryParams.limit = String(params.limit);
|
|
2103
2075
|
return apiConfig.httpClient.get(
|
|
2104
|
-
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.
|
|
2076
|
+
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chat_id}/messages`,
|
|
2105
2077
|
{
|
|
2106
2078
|
...options,
|
|
2107
2079
|
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
@@ -2342,6 +2314,7 @@ var createAnalyticsApi = (apiConfig) => {
|
|
|
2342
2314
|
|
|
2343
2315
|
// src/utils/price.ts
|
|
2344
2316
|
function formatCurrency(amount, currencyCode, locale = "en") {
|
|
2317
|
+
if (!currencyCode) return "";
|
|
2345
2318
|
return new Intl.NumberFormat(locale, {
|
|
2346
2319
|
style: "currency",
|
|
2347
2320
|
currency: currencyCode.toUpperCase()
|
|
@@ -2383,6 +2356,7 @@ function getCurrencyName(currency) {
|
|
|
2383
2356
|
}
|
|
2384
2357
|
}
|
|
2385
2358
|
function formatMinor(amountMinor, currency) {
|
|
2359
|
+
if (!currency) return "";
|
|
2386
2360
|
return formatCurrency(convertToMajor(amountMinor, currency), currency);
|
|
2387
2361
|
}
|
|
2388
2362
|
function formatPayment(payment) {
|
|
@@ -2414,6 +2388,57 @@ function validatePhoneNumber(phone) {
|
|
|
2414
2388
|
}
|
|
2415
2389
|
return { isValid: true };
|
|
2416
2390
|
}
|
|
2391
|
+
function createStores() {
|
|
2392
|
+
const $business = atom(null);
|
|
2393
|
+
const $market = atom(null);
|
|
2394
|
+
const $loading = atom(false);
|
|
2395
|
+
const $error = atom(null);
|
|
2396
|
+
const $initialized = atom(false);
|
|
2397
|
+
const $currency = computed($market, (m) => m?.currency);
|
|
2398
|
+
const $currencySymbol = computed($market, (m) => {
|
|
2399
|
+
if (!m?.currency) return void 0;
|
|
2400
|
+
return new Intl.NumberFormat("en", {
|
|
2401
|
+
style: "currency",
|
|
2402
|
+
currency: m.currency.toUpperCase(),
|
|
2403
|
+
currencyDisplay: "narrowSymbol"
|
|
2404
|
+
}).formatToParts(0).find((p) => p.type === "currency")?.value || m.currency.toUpperCase();
|
|
2405
|
+
});
|
|
2406
|
+
const $paymentMethods = computed(
|
|
2407
|
+
$market,
|
|
2408
|
+
(m) => (m?.payment_methods || []).map((pm) => pm.id)
|
|
2409
|
+
);
|
|
2410
|
+
const $paymentMethodObjects = computed(
|
|
2411
|
+
$market,
|
|
2412
|
+
(m) => m?.payment_methods || []
|
|
2413
|
+
);
|
|
2414
|
+
const $paymentConfig = computed([$business, $paymentMethods], (biz, methods) => {
|
|
2415
|
+
const payment = biz?.payment || null;
|
|
2416
|
+
const hasCreditCard = methods.includes("credit_card");
|
|
2417
|
+
return {
|
|
2418
|
+
provider: payment,
|
|
2419
|
+
enabled: hasCreditCard && !!payment
|
|
2420
|
+
};
|
|
2421
|
+
});
|
|
2422
|
+
const $zones = computed($market, (m) => m?.zones || []);
|
|
2423
|
+
return {
|
|
2424
|
+
business: $business,
|
|
2425
|
+
market: $market,
|
|
2426
|
+
loading: $loading,
|
|
2427
|
+
error: $error,
|
|
2428
|
+
initialized: $initialized,
|
|
2429
|
+
currency: $currency,
|
|
2430
|
+
currencySymbol: $currencySymbol,
|
|
2431
|
+
paymentMethods: $paymentMethods,
|
|
2432
|
+
paymentMethodObjects: $paymentMethodObjects,
|
|
2433
|
+
paymentConfig: $paymentConfig,
|
|
2434
|
+
zones: $zones
|
|
2435
|
+
};
|
|
2436
|
+
}
|
|
2437
|
+
function populateStores(stores, data) {
|
|
2438
|
+
stores.business.set(data.business);
|
|
2439
|
+
stores.market.set(data.market);
|
|
2440
|
+
stores.initialized.set(true);
|
|
2441
|
+
}
|
|
2417
2442
|
|
|
2418
2443
|
// src/utils/timezone.ts
|
|
2419
2444
|
var tzGroups = [
|
|
@@ -2567,28 +2592,6 @@ function nameToKey(name) {
|
|
|
2567
2592
|
return toKey(name);
|
|
2568
2593
|
}
|
|
2569
2594
|
|
|
2570
|
-
// src/utils/analytics.ts
|
|
2571
|
-
function injectGA4Script(measurementId) {
|
|
2572
|
-
if (typeof window === "undefined") return;
|
|
2573
|
-
if (document.querySelector(`script[src*="${measurementId}"]`)) return;
|
|
2574
|
-
window.dataLayer = window.dataLayer || [];
|
|
2575
|
-
window.gtag = function gtag(...args) {
|
|
2576
|
-
window.dataLayer.push(args);
|
|
2577
|
-
};
|
|
2578
|
-
window.gtag("js", /* @__PURE__ */ new Date());
|
|
2579
|
-
window.gtag("config", measurementId);
|
|
2580
|
-
const script = document.createElement("script");
|
|
2581
|
-
script.async = true;
|
|
2582
|
-
script.src = `https://www.googletagmanager.com/gtag/js?id=${measurementId}`;
|
|
2583
|
-
document.head.appendChild(script);
|
|
2584
|
-
}
|
|
2585
|
-
function track(eventName, params) {
|
|
2586
|
-
if (typeof window === "undefined") return;
|
|
2587
|
-
if (window.gtag) {
|
|
2588
|
-
window.gtag("event", eventName, params);
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
|
|
2592
2595
|
// src/utils/inventory.ts
|
|
2593
2596
|
function getAvailableStock(variant) {
|
|
2594
2597
|
if (!variant?.inventory) return 0;
|
|
@@ -2602,15 +2605,15 @@ function hasStock(variant, quantity = 1) {
|
|
|
2602
2605
|
return getAvailableStock(variant) >= quantity;
|
|
2603
2606
|
}
|
|
2604
2607
|
function getInventoryAt(variant, locationId) {
|
|
2605
|
-
return variant?.inventory?.find((inv) => inv.
|
|
2608
|
+
return variant?.inventory?.find((inv) => inv.location_id === locationId);
|
|
2606
2609
|
}
|
|
2607
2610
|
function getFirstAvailableFCId(variant, quantity = 1) {
|
|
2608
2611
|
const inv = variant?.inventory?.find((i) => i.available >= quantity);
|
|
2609
|
-
return inv?.
|
|
2612
|
+
return inv?.location_id;
|
|
2610
2613
|
}
|
|
2611
2614
|
|
|
2612
2615
|
// src/index.ts
|
|
2613
|
-
var SDK_VERSION = "0.7.
|
|
2616
|
+
var SDK_VERSION = "0.7.85";
|
|
2614
2617
|
var SUPPORTED_FRAMEWORKS = [
|
|
2615
2618
|
"astro",
|
|
2616
2619
|
"react",
|
|
@@ -2650,7 +2653,6 @@ function createUtilitySurface(apiConfig) {
|
|
|
2650
2653
|
validateKey,
|
|
2651
2654
|
toKey,
|
|
2652
2655
|
nameToKey,
|
|
2653
|
-
track,
|
|
2654
2656
|
getAvailableStock,
|
|
2655
2657
|
getReservedStock,
|
|
2656
2658
|
hasStock,
|
|
@@ -2678,17 +2680,6 @@ async function createAdmin(config) {
|
|
|
2678
2680
|
const authApi = createAuthApi(apiConfig);
|
|
2679
2681
|
const businessApi = createBusinessApi(apiConfig);
|
|
2680
2682
|
const platformApi = createPlatformApi(apiConfig);
|
|
2681
|
-
if (typeof window !== "undefined" && apiConfig.businessId) {
|
|
2682
|
-
businessApi.getIntegrationConfig({ businessId: apiConfig.businessId, type: "analytics" }).then((configs) => {
|
|
2683
|
-
if (!configs) return;
|
|
2684
|
-
for (const c of Array.isArray(configs) ? configs : [configs]) {
|
|
2685
|
-
if (c.measurementId) {
|
|
2686
|
-
injectGA4Script(c.measurementId);
|
|
2687
|
-
}
|
|
2688
|
-
}
|
|
2689
|
-
}).catch(() => {
|
|
2690
|
-
});
|
|
2691
|
-
}
|
|
2692
2683
|
const cmsApi = createCmsApi(apiConfig);
|
|
2693
2684
|
const eshopApi = createEshopApi(apiConfig);
|
|
2694
2685
|
const bookingApi = createBookingApi(apiConfig);
|
|
@@ -2847,7 +2838,6 @@ async function createAdmin(config) {
|
|
|
2847
2838
|
}
|
|
2848
2839
|
},
|
|
2849
2840
|
analytics: {
|
|
2850
|
-
track,
|
|
2851
2841
|
query: analyticsApi.query
|
|
2852
2842
|
},
|
|
2853
2843
|
setBusinessId: (businessId) => {
|
|
@@ -2870,8 +2860,35 @@ async function createAdmin(config) {
|
|
|
2870
2860
|
};
|
|
2871
2861
|
return sdk;
|
|
2872
2862
|
}
|
|
2873
|
-
|
|
2863
|
+
var SESSION_CACHE_TTL = 36e5;
|
|
2864
|
+
function getCachedSession(businessId) {
|
|
2865
|
+
if (typeof window === "undefined") return null;
|
|
2866
|
+
try {
|
|
2867
|
+
const raw = localStorage.getItem(`arky_session_${businessId}`);
|
|
2868
|
+
if (!raw) return null;
|
|
2869
|
+
const parsed = JSON.parse(raw);
|
|
2870
|
+
if (Date.now() - (parsed.timestamp || 0) > SESSION_CACHE_TTL) {
|
|
2871
|
+
localStorage.removeItem(`arky_session_${businessId}`);
|
|
2872
|
+
return null;
|
|
2873
|
+
}
|
|
2874
|
+
return { business: parsed.business, market: parsed.market };
|
|
2875
|
+
} catch {
|
|
2876
|
+
return null;
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
function setCachedSession(businessId, data) {
|
|
2880
|
+
if (typeof window === "undefined") return;
|
|
2881
|
+
try {
|
|
2882
|
+
localStorage.setItem(
|
|
2883
|
+
`arky_session_${businessId}`,
|
|
2884
|
+
JSON.stringify({ ...data, timestamp: Date.now() })
|
|
2885
|
+
);
|
|
2886
|
+
} catch {
|
|
2887
|
+
}
|
|
2888
|
+
}
|
|
2889
|
+
function createStorefront(config) {
|
|
2874
2890
|
const locale = config.locale || "en";
|
|
2891
|
+
const market = config.market || "";
|
|
2875
2892
|
const getToken = config.getToken || defaultGetToken;
|
|
2876
2893
|
const setToken = config.setToken || defaultSetToken;
|
|
2877
2894
|
const logout = config.logout || defaultLogout;
|
|
@@ -2887,44 +2904,67 @@ async function createStorefront(config) {
|
|
|
2887
2904
|
httpClient,
|
|
2888
2905
|
businessId: config.businessId,
|
|
2889
2906
|
baseUrl: config.baseUrl,
|
|
2890
|
-
market
|
|
2907
|
+
market,
|
|
2891
2908
|
locale,
|
|
2892
2909
|
setToken,
|
|
2893
2910
|
getToken
|
|
2894
2911
|
};
|
|
2895
2912
|
const storefrontApi = createStorefrontApi(apiConfig);
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
if (
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
const
|
|
2904
|
-
|
|
2905
|
-
|
|
2913
|
+
const stores = createStores();
|
|
2914
|
+
let initPromise = null;
|
|
2915
|
+
function init() {
|
|
2916
|
+
if (initPromise) return initPromise;
|
|
2917
|
+
initPromise = (async () => {
|
|
2918
|
+
stores.loading.set(true);
|
|
2919
|
+
stores.error.set(null);
|
|
2920
|
+
const cached = getCachedSession(config.businessId);
|
|
2921
|
+
const tokens = await getToken();
|
|
2922
|
+
const hasToken = !!tokens.access_token;
|
|
2923
|
+
if (hasToken && cached) {
|
|
2924
|
+
populateStores(stores, cached);
|
|
2925
|
+
stores.loading.set(false);
|
|
2926
|
+
return cached;
|
|
2906
2927
|
}
|
|
2907
|
-
|
|
2908
|
-
|
|
2928
|
+
if (hasToken) {
|
|
2929
|
+
const [business, allMarkets] = await Promise.all([
|
|
2930
|
+
storefrontApi.business.getBusiness(),
|
|
2931
|
+
storefrontApi.business.market.list().catch(() => [])
|
|
2932
|
+
]);
|
|
2933
|
+
const marketData = market ? allMarkets.find((m) => m.key === market) || null : null;
|
|
2934
|
+
const session2 = { business, market: marketData };
|
|
2935
|
+
populateStores(stores, session2);
|
|
2936
|
+
setCachedSession(config.businessId, session2);
|
|
2937
|
+
stores.loading.set(false);
|
|
2938
|
+
return session2;
|
|
2939
|
+
}
|
|
2940
|
+
const result = await storefrontApi.crm.customer.initialize({
|
|
2941
|
+
market
|
|
2942
|
+
});
|
|
2943
|
+
if (result?.token?.access_token) {
|
|
2944
|
+
setToken(result.token);
|
|
2945
|
+
}
|
|
2946
|
+
const session = {
|
|
2947
|
+
business: result.business,
|
|
2948
|
+
market: result.market
|
|
2949
|
+
};
|
|
2950
|
+
populateStores(stores, session);
|
|
2951
|
+
setCachedSession(config.businessId, session);
|
|
2952
|
+
stores.loading.set(false);
|
|
2953
|
+
return session;
|
|
2954
|
+
})().catch((err) => {
|
|
2955
|
+
stores.error.set(err.message || "Initialization failed");
|
|
2956
|
+
stores.loading.set(false);
|
|
2957
|
+
initPromise = null;
|
|
2958
|
+
throw err;
|
|
2909
2959
|
});
|
|
2910
|
-
return
|
|
2960
|
+
return initPromise;
|
|
2911
2961
|
}
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
});
|
|
2915
|
-
if (apiConfig.businessId) {
|
|
2916
|
-
storefrontApi.business.getIntegrationConfig({ businessId: apiConfig.businessId, type: "analytics" }).then((configs) => {
|
|
2917
|
-
if (!configs) return;
|
|
2918
|
-
for (const c of Array.isArray(configs) ? configs : [configs]) {
|
|
2919
|
-
if (c.measurementId) {
|
|
2920
|
-
injectGA4Script(c.measurementId);
|
|
2921
|
-
}
|
|
2922
|
-
}
|
|
2923
|
-
}).catch(() => {
|
|
2924
|
-
});
|
|
2925
|
-
}
|
|
2962
|
+
function setMarket(key) {
|
|
2963
|
+
apiConfig.market = key;
|
|
2926
2964
|
}
|
|
2927
2965
|
return {
|
|
2966
|
+
init,
|
|
2967
|
+
stores,
|
|
2928
2968
|
business: storefrontApi.business,
|
|
2929
2969
|
cms: storefrontApi.cms,
|
|
2930
2970
|
eshop: storefrontApi.eshop,
|
|
@@ -2932,16 +2972,11 @@ async function createStorefront(config) {
|
|
|
2932
2972
|
crm: storefrontApi.crm,
|
|
2933
2973
|
activity: storefrontApi.activity,
|
|
2934
2974
|
automation: storefrontApi.automation,
|
|
2935
|
-
analytics: {
|
|
2936
|
-
track
|
|
2937
|
-
},
|
|
2938
2975
|
setBusinessId: (businessId) => {
|
|
2939
2976
|
apiConfig.businessId = businessId;
|
|
2940
2977
|
},
|
|
2941
2978
|
getBusinessId: () => apiConfig.businessId,
|
|
2942
|
-
setMarket
|
|
2943
|
-
apiConfig.market = market;
|
|
2944
|
-
},
|
|
2979
|
+
setMarket,
|
|
2945
2980
|
getMarket: () => apiConfig.market,
|
|
2946
2981
|
setLocale: (locale2) => {
|
|
2947
2982
|
apiConfig.locale = locale2;
|