arky-sdk 0.7.72 → 0.7.74
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 +1079 -1215
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -107
- package/dist/index.d.ts +59 -107
- package/dist/index.js +1079 -1212
- package/dist/index.js.map +1 -1
- package/dist/types.d.cts +0 -1
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,143 +7,822 @@ var PaymentMethodType = /* @__PURE__ */ ((PaymentMethodType2) => {
|
|
|
7
7
|
return PaymentMethodType2;
|
|
8
8
|
})(PaymentMethodType || {});
|
|
9
9
|
|
|
10
|
-
// src/utils/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
14
|
-
...serverError,
|
|
15
|
-
validationErrors: validationErrors.map((validationError) => {
|
|
16
|
-
const field = validationError.field;
|
|
17
|
-
return {
|
|
18
|
-
field,
|
|
19
|
-
error: validationError.error || "GENERAL.VALIDATION_ERROR"
|
|
20
|
-
};
|
|
21
|
-
})
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// src/utils/queryParams.ts
|
|
26
|
-
function buildQueryString(params) {
|
|
27
|
-
const queryParts = [];
|
|
28
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
29
|
-
if (value === null || value === void 0) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (Array.isArray(value)) {
|
|
33
|
-
const jsonString = JSON.stringify(value);
|
|
34
|
-
queryParts.push(`${key}=${encodeURIComponent(jsonString)}`);
|
|
35
|
-
} else if (typeof value === "string") {
|
|
36
|
-
queryParts.push(`${key}=${encodeURIComponent(value)}`);
|
|
37
|
-
} else if (typeof value === "number" || typeof value === "boolean") {
|
|
38
|
-
queryParts.push(`${key}=${value}`);
|
|
39
|
-
} else if (typeof value === "object") {
|
|
40
|
-
const jsonString = JSON.stringify(value);
|
|
41
|
-
queryParts.push(`${key}=${encodeURIComponent(jsonString)}`);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
return queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// src/services/createHttpClient.ts
|
|
48
|
-
var STORAGE_KEYS = {
|
|
49
|
-
accessToken: "arky_token",
|
|
50
|
-
refreshToken: "arky_refresh",
|
|
51
|
-
accessExpiresAt: "arky_expires_at"
|
|
52
|
-
};
|
|
53
|
-
function defaultGetToken() {
|
|
54
|
-
if (typeof window === "undefined") return { accessToken: "" };
|
|
55
|
-
return {
|
|
56
|
-
accessToken: localStorage.getItem(STORAGE_KEYS.accessToken) || "",
|
|
57
|
-
refreshToken: localStorage.getItem(STORAGE_KEYS.refreshToken) || "",
|
|
58
|
-
accessExpiresAt: parseInt(localStorage.getItem(STORAGE_KEYS.accessExpiresAt) || "0", 10)
|
|
59
|
-
};
|
|
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()) ?? "";
|
|
60
14
|
}
|
|
61
|
-
function
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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.mimeType ? value.name || value.id : value.title || value.name || value.id;
|
|
30
|
+
}
|
|
31
|
+
return String(value);
|
|
32
|
+
default:
|
|
33
|
+
return String(value);
|
|
69
34
|
}
|
|
70
35
|
}
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
|
|
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
|
+
}));
|
|
74
41
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
42
|
+
function extractBlockValues(blocks) {
|
|
43
|
+
const values = {};
|
|
44
|
+
blocks.forEach((block) => {
|
|
45
|
+
values[block.key] = block.value ?? null;
|
|
46
|
+
});
|
|
47
|
+
return values;
|
|
79
48
|
}
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
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"] ?? "";
|
|
89
58
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
throw err;
|
|
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);
|
|
110
78
|
}
|
|
111
|
-
|
|
112
|
-
setToken(data);
|
|
113
|
-
})().finally(() => {
|
|
114
|
-
refreshPromise = null;
|
|
79
|
+
return parsed;
|
|
115
80
|
});
|
|
116
|
-
return refreshPromise;
|
|
117
81
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
82
|
+
if (block.type === "map") {
|
|
83
|
+
const parsed = {};
|
|
84
|
+
for (const [k, v] of Object.entries(block.value || {})) {
|
|
85
|
+
parsed[k] = unwrapBlock(v, locale);
|
|
121
86
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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);
|
|
133
118
|
}
|
|
134
|
-
|
|
135
|
-
|
|
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
|
+
// src/api/storefront.ts
|
|
137
|
+
var COMMON_ACTIVITY_TYPES = [
|
|
138
|
+
"page_view",
|
|
139
|
+
"product_view",
|
|
140
|
+
"service_view",
|
|
141
|
+
"provider_view",
|
|
142
|
+
"cart_added",
|
|
143
|
+
"cart_removed",
|
|
144
|
+
"checkout_started",
|
|
145
|
+
"purchase",
|
|
146
|
+
"booking_created",
|
|
147
|
+
"signin",
|
|
148
|
+
"signup",
|
|
149
|
+
"verified_email",
|
|
150
|
+
"search",
|
|
151
|
+
"share",
|
|
152
|
+
"wishlist_added"
|
|
153
|
+
];
|
|
154
|
+
async function ensureCustomer(apiConfig) {
|
|
155
|
+
if (apiConfig.getToken) {
|
|
156
|
+
const tokens = await apiConfig.getToken();
|
|
157
|
+
if (tokens?.accessToken) return;
|
|
158
|
+
}
|
|
159
|
+
const response = await apiConfig.httpClient.post(
|
|
160
|
+
`/v1/storefront/${apiConfig.businessId}/customer/initialize`,
|
|
161
|
+
{
|
|
162
|
+
userAgent: typeof navigator !== "undefined" ? navigator.userAgent : void 0
|
|
136
163
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
164
|
+
);
|
|
165
|
+
const accessToken = response?.tokens?.accessToken;
|
|
166
|
+
const refreshToken = response?.tokens?.refreshToken;
|
|
167
|
+
if (accessToken) {
|
|
168
|
+
apiConfig.setToken?.({ accessToken, refreshToken });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
var createActivityApi = (apiConfig) => ({
|
|
172
|
+
COMMON_ACTIVITY_TYPES,
|
|
173
|
+
async track(params) {
|
|
174
|
+
await ensureCustomer(apiConfig);
|
|
175
|
+
await apiConfig.httpClient.post(
|
|
176
|
+
`/v1/storefront/${apiConfig.businessId}/activities/track`,
|
|
177
|
+
{ type: params.type, payload: params.payload }
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
function groupCartToItems(cart) {
|
|
182
|
+
const groups = /* @__PURE__ */ new Map();
|
|
183
|
+
for (const slot of cart) {
|
|
184
|
+
const key = `${slot.serviceId}:${slot.providerId}`;
|
|
185
|
+
if (!groups.has(key)) {
|
|
186
|
+
groups.set(key, {
|
|
187
|
+
serviceId: slot.serviceId,
|
|
188
|
+
providerId: slot.providerId,
|
|
189
|
+
slots: []
|
|
190
|
+
});
|
|
141
191
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
192
|
+
groups.get(key).slots.push({ from: slot.from, to: slot.to });
|
|
193
|
+
}
|
|
194
|
+
return [...groups.values()];
|
|
195
|
+
}
|
|
196
|
+
var createStorefrontApi = (apiConfig) => {
|
|
197
|
+
const base = (businessId = apiConfig.businessId) => `/v1/storefront/${businessId}`;
|
|
198
|
+
let cart = [];
|
|
199
|
+
return {
|
|
200
|
+
business: {
|
|
201
|
+
getBusiness(options) {
|
|
202
|
+
return apiConfig.httpClient.get(base(), options);
|
|
203
|
+
},
|
|
204
|
+
getIntegrationConfig(params, options) {
|
|
205
|
+
return apiConfig.httpClient.get(
|
|
206
|
+
`${base(params.businessId)}/integrations/config/${params.type}`,
|
|
207
|
+
options
|
|
208
|
+
);
|
|
209
|
+
},
|
|
210
|
+
location: {
|
|
211
|
+
getCountries(options) {
|
|
212
|
+
return apiConfig.httpClient.get(`/v1/platform/countries`, options);
|
|
213
|
+
},
|
|
214
|
+
getCountry(countryCode, options) {
|
|
215
|
+
return apiConfig.httpClient.get(
|
|
216
|
+
`/v1/platform/countries/${countryCode}`,
|
|
217
|
+
options
|
|
218
|
+
);
|
|
219
|
+
},
|
|
220
|
+
list(options) {
|
|
221
|
+
return apiConfig.httpClient.get(`${base()}/locations`, options);
|
|
222
|
+
},
|
|
223
|
+
get(id, options) {
|
|
224
|
+
return apiConfig.httpClient.get(`${base()}/locations/${id}`, options);
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
market: {
|
|
228
|
+
list(options) {
|
|
229
|
+
return apiConfig.httpClient.get(`${base()}/markets`, options);
|
|
230
|
+
},
|
|
231
|
+
get(id, options) {
|
|
232
|
+
return apiConfig.httpClient.get(`${base()}/markets/${id}`, options);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
cms: {
|
|
237
|
+
node: {
|
|
238
|
+
async get(params, options) {
|
|
239
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
240
|
+
let identifier;
|
|
241
|
+
if (params.id) {
|
|
242
|
+
identifier = params.id;
|
|
243
|
+
} else if (params.slug) {
|
|
244
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
245
|
+
} else if (params.key) {
|
|
246
|
+
identifier = `${businessId}:${params.key}`;
|
|
247
|
+
} else {
|
|
248
|
+
throw new Error("GetNodeParams requires id, slug, or key");
|
|
249
|
+
}
|
|
250
|
+
const response = await apiConfig.httpClient.get(
|
|
251
|
+
`${base(businessId)}/nodes/${identifier}`,
|
|
252
|
+
options
|
|
253
|
+
);
|
|
254
|
+
return {
|
|
255
|
+
...response,
|
|
256
|
+
getBlock(key) {
|
|
257
|
+
return getBlockFromArray(response, key, apiConfig.locale);
|
|
258
|
+
},
|
|
259
|
+
getBlockValues(key) {
|
|
260
|
+
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
261
|
+
},
|
|
262
|
+
getImage(key) {
|
|
263
|
+
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
264
|
+
return getImageUrl(block, true);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
},
|
|
268
|
+
find(params, options) {
|
|
269
|
+
const { businessId, ...queryParams } = params;
|
|
270
|
+
return apiConfig.httpClient.get(`${base(businessId)}/nodes`, {
|
|
271
|
+
...options,
|
|
272
|
+
params: queryParams
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
getChildren(params, options) {
|
|
276
|
+
const { id, businessId, ...queryParams } = params;
|
|
277
|
+
return apiConfig.httpClient.get(`${base(businessId)}/nodes/${id}/children`, {
|
|
278
|
+
...options,
|
|
279
|
+
params: queryParams
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
form: {
|
|
284
|
+
get(params, options) {
|
|
285
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
286
|
+
let identifier;
|
|
287
|
+
if (params.id) {
|
|
288
|
+
identifier = params.id;
|
|
289
|
+
} else if (params.key) {
|
|
290
|
+
identifier = `${businessId}:${params.key}`;
|
|
291
|
+
} else {
|
|
292
|
+
throw new Error("GetFormParams requires id or key");
|
|
293
|
+
}
|
|
294
|
+
return apiConfig.httpClient.get(
|
|
295
|
+
`${base(businessId)}/forms/${identifier}`,
|
|
296
|
+
options
|
|
297
|
+
);
|
|
298
|
+
},
|
|
299
|
+
submit(params, options) {
|
|
300
|
+
const { businessId, formId, ...payload } = params;
|
|
301
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
302
|
+
return apiConfig.httpClient.post(
|
|
303
|
+
`${base(targetBusinessId)}/forms/${formId}/submissions`,
|
|
304
|
+
{ ...payload, formId, businessId: targetBusinessId },
|
|
305
|
+
options
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
taxonomy: {
|
|
310
|
+
get(params, options) {
|
|
311
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
312
|
+
let identifier;
|
|
313
|
+
if (params.id) {
|
|
314
|
+
identifier = params.id;
|
|
315
|
+
} else if (params.key) {
|
|
316
|
+
identifier = `${businessId}:${params.key}`;
|
|
317
|
+
} else {
|
|
318
|
+
throw new Error("GetTaxonomyParams requires id or key");
|
|
319
|
+
}
|
|
320
|
+
return apiConfig.httpClient.get(
|
|
321
|
+
`${base(businessId)}/taxonomies/${identifier}`,
|
|
322
|
+
options
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
getChildren(params, options) {
|
|
326
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
327
|
+
return apiConfig.httpClient.get(
|
|
328
|
+
`${base(businessId)}/taxonomies/${params.id}/children`,
|
|
329
|
+
options
|
|
330
|
+
);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
eshop: {
|
|
335
|
+
product: {
|
|
336
|
+
get(params, options) {
|
|
337
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
338
|
+
let identifier;
|
|
339
|
+
if (params.id) {
|
|
340
|
+
identifier = params.id;
|
|
341
|
+
} else if (params.slug) {
|
|
342
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
343
|
+
} else {
|
|
344
|
+
throw new Error("GetProductParams requires id or slug");
|
|
345
|
+
}
|
|
346
|
+
return apiConfig.httpClient.get(
|
|
347
|
+
`${base(businessId)}/products/${identifier}`,
|
|
348
|
+
options
|
|
349
|
+
);
|
|
350
|
+
},
|
|
351
|
+
find(params, options) {
|
|
352
|
+
const { businessId, ...queryParams } = params;
|
|
353
|
+
return apiConfig.httpClient.get(`${base(businessId)}/products`, {
|
|
354
|
+
...options,
|
|
355
|
+
params: queryParams
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
order: {
|
|
360
|
+
getQuote(params, options) {
|
|
361
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
362
|
+
const { location, businessId: _businessId, ...rest } = params;
|
|
363
|
+
const shippingAddress = location ? {
|
|
364
|
+
country: location.country || "",
|
|
365
|
+
state: location.state || "",
|
|
366
|
+
city: location.city || "",
|
|
367
|
+
postalCode: location.postalCode || "",
|
|
368
|
+
name: "",
|
|
369
|
+
street1: "",
|
|
370
|
+
street2: null
|
|
371
|
+
} : void 0;
|
|
372
|
+
return apiConfig.httpClient.post(
|
|
373
|
+
`${base(businessId)}/orders/quote`,
|
|
374
|
+
{ ...rest, shippingAddress, market: apiConfig.market },
|
|
375
|
+
options
|
|
376
|
+
);
|
|
377
|
+
},
|
|
378
|
+
checkout(params, options) {
|
|
379
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
380
|
+
return apiConfig.httpClient.post(
|
|
381
|
+
`${base(businessId)}/orders/checkout`,
|
|
382
|
+
{ ...params, businessId, market: apiConfig.market },
|
|
383
|
+
options
|
|
384
|
+
);
|
|
385
|
+
},
|
|
386
|
+
get(params, options) {
|
|
387
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
388
|
+
return apiConfig.httpClient.get(
|
|
389
|
+
`${base(businessId)}/orders/${params.id}`,
|
|
390
|
+
options
|
|
391
|
+
);
|
|
392
|
+
},
|
|
393
|
+
find(params, options) {
|
|
394
|
+
const { businessId, ...queryParams } = params;
|
|
395
|
+
return apiConfig.httpClient.get(`${base(businessId)}/orders`, {
|
|
396
|
+
...options,
|
|
397
|
+
params: queryParams
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
booking: {
|
|
403
|
+
addToCart(slot) {
|
|
404
|
+
cart.push(slot);
|
|
405
|
+
},
|
|
406
|
+
removeFromCart(slotId) {
|
|
407
|
+
cart = cart.filter((slot) => slot.id !== slotId);
|
|
408
|
+
},
|
|
409
|
+
getCart() {
|
|
410
|
+
return [...cart];
|
|
411
|
+
},
|
|
412
|
+
clearCart() {
|
|
413
|
+
cart = [];
|
|
414
|
+
},
|
|
415
|
+
checkout(params, options) {
|
|
416
|
+
const { businessId, items: paramItems, ...payload } = params || {};
|
|
417
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
418
|
+
const items = paramItems || groupCartToItems(cart);
|
|
419
|
+
return apiConfig.httpClient.post(
|
|
420
|
+
`${base(targetBusinessId)}/bookings/checkout`,
|
|
421
|
+
{ market: "booking", ...payload, items },
|
|
422
|
+
options
|
|
423
|
+
);
|
|
424
|
+
},
|
|
425
|
+
get(params, options) {
|
|
426
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
427
|
+
return apiConfig.httpClient.get(
|
|
428
|
+
`${base(businessId)}/bookings/${params.id}`,
|
|
429
|
+
options
|
|
430
|
+
);
|
|
431
|
+
},
|
|
432
|
+
find(params, options) {
|
|
433
|
+
const { businessId, ...queryParams } = params;
|
|
434
|
+
return apiConfig.httpClient.get(`${base(businessId)}/bookings`, {
|
|
435
|
+
...options,
|
|
436
|
+
params: queryParams
|
|
437
|
+
});
|
|
438
|
+
},
|
|
439
|
+
getQuote(params, options) {
|
|
440
|
+
const { businessId, ...payload } = params;
|
|
441
|
+
return apiConfig.httpClient.post(
|
|
442
|
+
`${base(businessId)}/bookings/quote`,
|
|
443
|
+
{ market: "booking", ...payload },
|
|
444
|
+
options
|
|
445
|
+
);
|
|
446
|
+
},
|
|
447
|
+
getAvailability(params, options) {
|
|
448
|
+
const { businessId, ...queryParams } = params;
|
|
449
|
+
return apiConfig.httpClient.get(
|
|
450
|
+
`${base(businessId)}/bookings/availability`,
|
|
451
|
+
{ ...options, params: queryParams }
|
|
452
|
+
);
|
|
453
|
+
},
|
|
454
|
+
cancelItem(params, options) {
|
|
455
|
+
const { businessId, bookingId, itemId, ...payload } = params;
|
|
456
|
+
return apiConfig.httpClient.post(
|
|
457
|
+
`${base(businessId)}/bookings/${bookingId}/items/${itemId}/cancel`,
|
|
458
|
+
payload,
|
|
459
|
+
options
|
|
460
|
+
);
|
|
461
|
+
},
|
|
462
|
+
service: {
|
|
463
|
+
get(params, options) {
|
|
464
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
465
|
+
let identifier;
|
|
466
|
+
if (params.id) {
|
|
467
|
+
identifier = params.id;
|
|
468
|
+
} else if (params.slug) {
|
|
469
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
470
|
+
} else {
|
|
471
|
+
throw new Error("GetServiceParams requires id or slug");
|
|
472
|
+
}
|
|
473
|
+
return apiConfig.httpClient.get(
|
|
474
|
+
`${base(businessId)}/services/${identifier}`,
|
|
475
|
+
options
|
|
476
|
+
);
|
|
477
|
+
},
|
|
478
|
+
find(params, options) {
|
|
479
|
+
const { businessId, ...queryParams } = params;
|
|
480
|
+
return apiConfig.httpClient.get(`${base(businessId)}/services`, {
|
|
481
|
+
...options,
|
|
482
|
+
params: queryParams
|
|
483
|
+
});
|
|
484
|
+
},
|
|
485
|
+
findProviders(params, options) {
|
|
486
|
+
const { businessId, ...queryParams } = params;
|
|
487
|
+
return apiConfig.httpClient.get(`${base(businessId)}/service-providers`, {
|
|
488
|
+
...options,
|
|
489
|
+
params: queryParams
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
},
|
|
493
|
+
provider: {
|
|
494
|
+
get(params, options) {
|
|
495
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
496
|
+
let identifier;
|
|
497
|
+
if (params.id) {
|
|
498
|
+
identifier = params.id;
|
|
499
|
+
} else if (params.slug) {
|
|
500
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
501
|
+
} else {
|
|
502
|
+
throw new Error("GetProviderParams requires id or slug");
|
|
503
|
+
}
|
|
504
|
+
return apiConfig.httpClient.get(
|
|
505
|
+
`${base(businessId)}/providers/${identifier}`,
|
|
506
|
+
options
|
|
507
|
+
);
|
|
508
|
+
},
|
|
509
|
+
find(params, options) {
|
|
510
|
+
const { businessId, ...queryParams } = params;
|
|
511
|
+
return apiConfig.httpClient.get(`${base(businessId)}/providers`, {
|
|
512
|
+
...options,
|
|
513
|
+
params: queryParams
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
crm: {
|
|
519
|
+
customer: {
|
|
520
|
+
initialize(params, options) {
|
|
521
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
522
|
+
return apiConfig.httpClient.post(
|
|
523
|
+
`${base(businessId)}/customers/initialize`,
|
|
524
|
+
{ businessId },
|
|
525
|
+
options
|
|
526
|
+
);
|
|
527
|
+
},
|
|
528
|
+
signInAnonymously(params, options) {
|
|
529
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
530
|
+
return apiConfig.httpClient.post(
|
|
531
|
+
`${base(businessId)}/customers/initialize`,
|
|
532
|
+
{ businessId },
|
|
533
|
+
options
|
|
534
|
+
);
|
|
535
|
+
},
|
|
536
|
+
connect(params, options) {
|
|
537
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
538
|
+
return apiConfig.httpClient.post(
|
|
539
|
+
`${base(businessId)}/customers/connect`,
|
|
540
|
+
{ email: params.email, businessId },
|
|
541
|
+
options
|
|
542
|
+
);
|
|
543
|
+
},
|
|
544
|
+
requestCode(params, options) {
|
|
545
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
546
|
+
return apiConfig.httpClient.post(
|
|
547
|
+
`${base(businessId)}/customers/auth/code`,
|
|
548
|
+
{ email: params.email, businessId },
|
|
549
|
+
options
|
|
550
|
+
);
|
|
551
|
+
},
|
|
552
|
+
verify(params, options) {
|
|
553
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
554
|
+
return apiConfig.httpClient.post(
|
|
555
|
+
`${base(businessId)}/customers/auth/verify`,
|
|
556
|
+
{ email: params.email, code: params.code, businessId },
|
|
557
|
+
options
|
|
558
|
+
);
|
|
559
|
+
},
|
|
560
|
+
refreshToken(params, options) {
|
|
561
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
562
|
+
return apiConfig.httpClient.post(
|
|
563
|
+
`${base(businessId)}/customers/auth/refresh`,
|
|
564
|
+
{ refreshToken: params.refreshToken },
|
|
565
|
+
options
|
|
566
|
+
);
|
|
567
|
+
},
|
|
568
|
+
getMe(options) {
|
|
569
|
+
return apiConfig.httpClient.get(`${base()}/customers/me`, options);
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
audience: {
|
|
573
|
+
get(params, options) {
|
|
574
|
+
let identifier;
|
|
575
|
+
if (params.id) {
|
|
576
|
+
identifier = params.id;
|
|
577
|
+
} else if (params.key) {
|
|
578
|
+
identifier = `${apiConfig.businessId}:${params.key}`;
|
|
579
|
+
} else {
|
|
580
|
+
throw new Error("GetAudienceParams requires id or key");
|
|
581
|
+
}
|
|
582
|
+
return apiConfig.httpClient.get(
|
|
583
|
+
`${base(apiConfig.businessId)}/audiences/${identifier}`,
|
|
584
|
+
options
|
|
585
|
+
);
|
|
586
|
+
},
|
|
587
|
+
find(params, options) {
|
|
588
|
+
return apiConfig.httpClient.get(`${base()}/audiences`, {
|
|
589
|
+
...options,
|
|
590
|
+
params
|
|
591
|
+
});
|
|
592
|
+
},
|
|
593
|
+
subscribe(params, options) {
|
|
594
|
+
return apiConfig.httpClient.post(
|
|
595
|
+
`${base()}/audiences/${params.id}/subscribe`,
|
|
596
|
+
{
|
|
597
|
+
customerId: params.customerId,
|
|
598
|
+
priceId: params.priceId,
|
|
599
|
+
successUrl: params.successUrl,
|
|
600
|
+
cancelUrl: params.cancelUrl,
|
|
601
|
+
confirmUrl: params.confirmUrl
|
|
602
|
+
},
|
|
603
|
+
options
|
|
604
|
+
);
|
|
605
|
+
},
|
|
606
|
+
checkAccess(params, options) {
|
|
607
|
+
return apiConfig.httpClient.get(
|
|
608
|
+
`${base()}/audiences/${params.id}/access`,
|
|
609
|
+
options
|
|
610
|
+
);
|
|
611
|
+
},
|
|
612
|
+
unsubscribe(token, options) {
|
|
613
|
+
return apiConfig.httpClient.get(`${base()}/audiences/unsubscribe`, {
|
|
614
|
+
...options,
|
|
615
|
+
params: { token }
|
|
616
|
+
});
|
|
617
|
+
},
|
|
618
|
+
confirm(token, options) {
|
|
619
|
+
return apiConfig.httpClient.get(`${base()}/audiences/confirm`, {
|
|
620
|
+
...options,
|
|
621
|
+
params: { token }
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
activity: createActivityApi(apiConfig),
|
|
627
|
+
automation: {
|
|
628
|
+
agent: {
|
|
629
|
+
getAgents(params, options) {
|
|
630
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
631
|
+
const queryParams = { ...params || {} };
|
|
632
|
+
delete queryParams.businessId;
|
|
633
|
+
return apiConfig.httpClient.get(`${base(businessId)}/agents`, {
|
|
634
|
+
...options,
|
|
635
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
636
|
+
});
|
|
637
|
+
},
|
|
638
|
+
getAgent(params, options) {
|
|
639
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
640
|
+
return apiConfig.httpClient.get(
|
|
641
|
+
`${base(businessId)}/agents/${params.id}`,
|
|
642
|
+
options
|
|
643
|
+
);
|
|
644
|
+
},
|
|
645
|
+
sendMessage(params, options) {
|
|
646
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
647
|
+
const body = { message: params.message };
|
|
648
|
+
if (params.chatId) body.chatId = params.chatId;
|
|
649
|
+
return apiConfig.httpClient.post(
|
|
650
|
+
`${base(businessId)}/agents/${params.id}/chats/messages`,
|
|
651
|
+
body,
|
|
652
|
+
options
|
|
653
|
+
);
|
|
654
|
+
},
|
|
655
|
+
getChat(params, options) {
|
|
656
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
657
|
+
return apiConfig.httpClient.get(
|
|
658
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}`,
|
|
659
|
+
options
|
|
660
|
+
);
|
|
661
|
+
},
|
|
662
|
+
getChatMessages(params, options) {
|
|
663
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
664
|
+
const queryParams = {};
|
|
665
|
+
if (params.limit) queryParams.limit = String(params.limit);
|
|
666
|
+
return apiConfig.httpClient.get(
|
|
667
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}/messages`,
|
|
668
|
+
{
|
|
669
|
+
...options,
|
|
670
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
671
|
+
}
|
|
672
|
+
);
|
|
673
|
+
},
|
|
674
|
+
rateChat(params, options) {
|
|
675
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
676
|
+
const body = { rating: params.rating };
|
|
677
|
+
if (params.comment) body.comment = params.comment;
|
|
678
|
+
return apiConfig.httpClient.post(
|
|
679
|
+
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}/rate`,
|
|
680
|
+
body,
|
|
681
|
+
options
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
};
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
// src/utils/errors.ts
|
|
690
|
+
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
691
|
+
const validationErrors = serverError?.validationErrors ?? [];
|
|
692
|
+
return {
|
|
693
|
+
...serverError,
|
|
694
|
+
validationErrors: validationErrors.map((validationError) => {
|
|
695
|
+
const field = validationError.field;
|
|
696
|
+
return {
|
|
697
|
+
field,
|
|
698
|
+
error: validationError.error || "GENERAL.VALIDATION_ERROR"
|
|
699
|
+
};
|
|
700
|
+
})
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
|
|
704
|
+
// src/utils/queryParams.ts
|
|
705
|
+
function buildQueryString(params) {
|
|
706
|
+
const queryParts = [];
|
|
707
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
708
|
+
if (value === null || value === void 0) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
if (Array.isArray(value)) {
|
|
712
|
+
const jsonString = JSON.stringify(value);
|
|
713
|
+
queryParts.push(`${key}=${encodeURIComponent(jsonString)}`);
|
|
714
|
+
} else if (typeof value === "string") {
|
|
715
|
+
queryParts.push(`${key}=${encodeURIComponent(value)}`);
|
|
716
|
+
} else if (typeof value === "number" || typeof value === "boolean") {
|
|
717
|
+
queryParts.push(`${key}=${value}`);
|
|
718
|
+
} else if (typeof value === "object") {
|
|
719
|
+
const jsonString = JSON.stringify(value);
|
|
720
|
+
queryParts.push(`${key}=${encodeURIComponent(jsonString)}`);
|
|
721
|
+
}
|
|
722
|
+
});
|
|
723
|
+
return queryParts.length > 0 ? `?${queryParts.join("&")}` : "";
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/services/createHttpClient.ts
|
|
727
|
+
var STORAGE_KEYS = {
|
|
728
|
+
accessToken: "arky_token",
|
|
729
|
+
refreshToken: "arky_refresh",
|
|
730
|
+
accessExpiresAt: "arky_expires_at"
|
|
731
|
+
};
|
|
732
|
+
function defaultGetToken() {
|
|
733
|
+
if (typeof window === "undefined") return { accessToken: "" };
|
|
734
|
+
return {
|
|
735
|
+
accessToken: localStorage.getItem(STORAGE_KEYS.accessToken) || "",
|
|
736
|
+
refreshToken: localStorage.getItem(STORAGE_KEYS.refreshToken) || "",
|
|
737
|
+
accessExpiresAt: parseInt(localStorage.getItem(STORAGE_KEYS.accessExpiresAt) || "0", 10)
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function defaultSetToken(tokens) {
|
|
741
|
+
if (typeof window === "undefined") return;
|
|
742
|
+
if (tokens.accessToken) {
|
|
743
|
+
localStorage.setItem(STORAGE_KEYS.accessToken, tokens.accessToken);
|
|
744
|
+
localStorage.setItem(STORAGE_KEYS.refreshToken, tokens.refreshToken || "");
|
|
745
|
+
localStorage.setItem(STORAGE_KEYS.accessExpiresAt, (tokens.accessExpiresAt || 0).toString());
|
|
746
|
+
} else {
|
|
747
|
+
Object.values(STORAGE_KEYS).forEach((key) => localStorage.removeItem(key));
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
function defaultLogout() {
|
|
751
|
+
if (typeof window === "undefined") return;
|
|
752
|
+
Object.values(STORAGE_KEYS).forEach((key) => localStorage.removeItem(key));
|
|
753
|
+
}
|
|
754
|
+
function defaultIsAuthenticated() {
|
|
755
|
+
if (typeof window === "undefined") return false;
|
|
756
|
+
const token = localStorage.getItem(STORAGE_KEYS.accessToken) || "";
|
|
757
|
+
return token.startsWith("customer_") || token.startsWith("account_");
|
|
758
|
+
}
|
|
759
|
+
function createHttpClient(cfg) {
|
|
760
|
+
const getToken = cfg.getToken || defaultGetToken;
|
|
761
|
+
const setToken = cfg.setToken || defaultSetToken;
|
|
762
|
+
const logout = cfg.logout || defaultLogout;
|
|
763
|
+
const refreshEndpoint = `${cfg.baseUrl}${cfg.refreshPath || "/v1/auth/refresh"}`;
|
|
764
|
+
let refreshPromise = null;
|
|
765
|
+
async function ensureFreshToken() {
|
|
766
|
+
if (refreshPromise) {
|
|
767
|
+
return refreshPromise;
|
|
768
|
+
}
|
|
769
|
+
refreshPromise = (async () => {
|
|
770
|
+
const { refreshToken } = await getToken();
|
|
771
|
+
if (!refreshToken) {
|
|
772
|
+
logout();
|
|
773
|
+
const err = new Error("No refresh token available");
|
|
774
|
+
err.name = "ApiError";
|
|
775
|
+
err.statusCode = 401;
|
|
776
|
+
throw err;
|
|
777
|
+
}
|
|
778
|
+
const refRes = await fetch(refreshEndpoint, {
|
|
779
|
+
method: "POST",
|
|
780
|
+
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
781
|
+
body: JSON.stringify({ refreshToken })
|
|
782
|
+
});
|
|
783
|
+
if (!refRes.ok) {
|
|
784
|
+
logout();
|
|
785
|
+
const err = new Error("Token refresh failed");
|
|
786
|
+
err.name = "ApiError";
|
|
787
|
+
err.statusCode = 401;
|
|
788
|
+
throw err;
|
|
789
|
+
}
|
|
790
|
+
const data = await refRes.json();
|
|
791
|
+
setToken(data);
|
|
792
|
+
})().finally(() => {
|
|
793
|
+
refreshPromise = null;
|
|
794
|
+
});
|
|
795
|
+
return refreshPromise;
|
|
796
|
+
}
|
|
797
|
+
async function request(method, path, body, options) {
|
|
798
|
+
if (options?.transformRequest) {
|
|
799
|
+
body = options.transformRequest(body);
|
|
800
|
+
}
|
|
801
|
+
const headers = {
|
|
802
|
+
Accept: "application/json",
|
|
803
|
+
"Content-Type": "application/json",
|
|
804
|
+
...options?.headers || {}
|
|
805
|
+
};
|
|
806
|
+
let { accessToken, accessExpiresAt } = await getToken();
|
|
807
|
+
const nowSec = Date.now() / 1e3;
|
|
808
|
+
if (accessExpiresAt && nowSec > accessExpiresAt) {
|
|
809
|
+
await ensureFreshToken();
|
|
810
|
+
const tokens = await getToken();
|
|
811
|
+
accessToken = tokens.accessToken;
|
|
812
|
+
}
|
|
813
|
+
if (accessToken) {
|
|
814
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
815
|
+
}
|
|
816
|
+
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
817
|
+
const fetchOpts = { method, headers };
|
|
818
|
+
if (!["GET", "DELETE"].includes(method) && body !== void 0) {
|
|
819
|
+
fetchOpts.body = JSON.stringify(body);
|
|
820
|
+
}
|
|
821
|
+
const fullUrl = `${cfg.baseUrl}${finalPath}`;
|
|
822
|
+
let res;
|
|
823
|
+
let data;
|
|
824
|
+
const startedAt = Date.now();
|
|
825
|
+
try {
|
|
147
826
|
res = await fetch(fullUrl, fetchOpts);
|
|
148
827
|
} catch (error) {
|
|
149
828
|
const err = new Error(error instanceof Error ? error.message : "Network request failed");
|
|
@@ -601,132 +1280,6 @@ var createPromoCodeApi = (apiConfig) => {
|
|
|
601
1280
|
};
|
|
602
1281
|
};
|
|
603
1282
|
|
|
604
|
-
// src/utils/blocks.ts
|
|
605
|
-
function getBlockLabel(block) {
|
|
606
|
-
if (!block) return "";
|
|
607
|
-
return block.key?.replace(/_/g, " ").replace(/\b\w/g, (l) => l.toUpperCase()) ?? "";
|
|
608
|
-
}
|
|
609
|
-
function formatBlockValue(block) {
|
|
610
|
-
if (!block || block.value === null || block.value === void 0) return "";
|
|
611
|
-
const value = block.value;
|
|
612
|
-
switch (block.type) {
|
|
613
|
-
case "boolean":
|
|
614
|
-
return value ? "Yes" : "No";
|
|
615
|
-
case "number":
|
|
616
|
-
if (block.properties?.variant === "DATE" || block.properties?.variant === "DATE_TIME") {
|
|
617
|
-
return new Date(value).toLocaleDateString();
|
|
618
|
-
}
|
|
619
|
-
return String(value);
|
|
620
|
-
case "relationship_entry":
|
|
621
|
-
case "relationship_media":
|
|
622
|
-
if (value && typeof value === "object") {
|
|
623
|
-
return value.mimeType ? value.name || value.id : value.title || value.name || value.id;
|
|
624
|
-
}
|
|
625
|
-
return String(value);
|
|
626
|
-
default:
|
|
627
|
-
return String(value);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
function prepareBlocksForSubmission(formData, blockTypes) {
|
|
631
|
-
return Object.keys(formData).filter((key) => formData[key] !== null && formData[key] !== void 0).map((key) => ({
|
|
632
|
-
key,
|
|
633
|
-
value: blockTypes?.[key] === "list" && !Array.isArray(formData[key]) ? [formData[key]] : formData[key]
|
|
634
|
-
}));
|
|
635
|
-
}
|
|
636
|
-
function extractBlockValues(blocks) {
|
|
637
|
-
const values = {};
|
|
638
|
-
blocks.forEach((block) => {
|
|
639
|
-
values[block.key] = block.value ?? null;
|
|
640
|
-
});
|
|
641
|
-
return values;
|
|
642
|
-
}
|
|
643
|
-
var getBlockValue = (entry, blockKey) => {
|
|
644
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
645
|
-
return block?.value ?? null;
|
|
646
|
-
};
|
|
647
|
-
var getBlockTextValue = (block, locale = "en") => {
|
|
648
|
-
if (!block || block.value === null || block.value === void 0) return "";
|
|
649
|
-
if (block.type === "localized_text" || block.type === "markdown") {
|
|
650
|
-
if (typeof block.value === "object" && block.value !== null) {
|
|
651
|
-
return block.value[locale] ?? block.value["en"] ?? "";
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
if (typeof block.value === "string") return block.value;
|
|
655
|
-
return String(block.value ?? "");
|
|
656
|
-
};
|
|
657
|
-
var getBlockValues = (entry, blockKey) => {
|
|
658
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
659
|
-
if (!block) return [];
|
|
660
|
-
if (block.type === "list" && Array.isArray(block.value)) {
|
|
661
|
-
return block.value;
|
|
662
|
-
}
|
|
663
|
-
return [];
|
|
664
|
-
};
|
|
665
|
-
function unwrapBlock(block, locale) {
|
|
666
|
-
if (!block?.type || block.value === void 0) return block;
|
|
667
|
-
if (block.type === "list") {
|
|
668
|
-
return block.value.map((obj) => {
|
|
669
|
-
const parsed = {};
|
|
670
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
671
|
-
parsed[k] = unwrapBlock(v, locale);
|
|
672
|
-
}
|
|
673
|
-
return parsed;
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
if (block.type === "map") {
|
|
677
|
-
const parsed = {};
|
|
678
|
-
for (const [k, v] of Object.entries(block.value || {})) {
|
|
679
|
-
parsed[k] = unwrapBlock(v, locale);
|
|
680
|
-
}
|
|
681
|
-
return parsed;
|
|
682
|
-
}
|
|
683
|
-
if (block.type === "localized_text" || block.type === "markdown") {
|
|
684
|
-
return block.value?.[locale];
|
|
685
|
-
}
|
|
686
|
-
return block.value;
|
|
687
|
-
}
|
|
688
|
-
var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
689
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
690
|
-
if (!block || block.type !== "list" || !Array.isArray(block.value)) return [];
|
|
691
|
-
return block.value.map((obj) => {
|
|
692
|
-
if (!obj?.value || !Array.isArray(obj.value)) return {};
|
|
693
|
-
return obj.value.reduce((acc, current) => {
|
|
694
|
-
acc[current.key] = unwrapBlock(current, locale);
|
|
695
|
-
return acc;
|
|
696
|
-
}, {});
|
|
697
|
-
});
|
|
698
|
-
};
|
|
699
|
-
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
700
|
-
const block = entry?.blocks?.find((f) => f.key === blockKey);
|
|
701
|
-
if (!block) return {};
|
|
702
|
-
if (block.type === "list" && Array.isArray(block.value)) {
|
|
703
|
-
return block.value.reduce((acc, current) => {
|
|
704
|
-
acc[current.key] = unwrapBlock(current, locale);
|
|
705
|
-
return acc;
|
|
706
|
-
}, {});
|
|
707
|
-
}
|
|
708
|
-
if (block.type === "map" && block.value && typeof block.value === "object") {
|
|
709
|
-
const result = {};
|
|
710
|
-
for (const [k, v] of Object.entries(block.value)) {
|
|
711
|
-
result[k] = unwrapBlock(v, locale);
|
|
712
|
-
}
|
|
713
|
-
return result;
|
|
714
|
-
}
|
|
715
|
-
return { [block.key]: unwrapBlock(block, locale) };
|
|
716
|
-
};
|
|
717
|
-
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
718
|
-
if (!imageBlock) return null;
|
|
719
|
-
if (imageBlock.type === "relationship_media") {
|
|
720
|
-
const mediaValue = imageBlock.value;
|
|
721
|
-
return mediaValue?.resolutions?.original?.url || mediaValue?.url || null;
|
|
722
|
-
}
|
|
723
|
-
if (isBlock) {
|
|
724
|
-
if (typeof imageBlock === "string") return imageBlock;
|
|
725
|
-
if (imageBlock.url) return imageBlock.url;
|
|
726
|
-
}
|
|
727
|
-
return imageBlock.resolutions?.original?.url || null;
|
|
728
|
-
};
|
|
729
|
-
|
|
730
1283
|
// src/api/cms.ts
|
|
731
1284
|
var createCmsApi = (apiConfig) => {
|
|
732
1285
|
return {
|
|
@@ -1220,6 +1773,37 @@ var createMarketApi = (apiConfig) => {
|
|
|
1220
1773
|
};
|
|
1221
1774
|
|
|
1222
1775
|
// src/api/crm.ts
|
|
1776
|
+
var createActivityAdminApi = (apiConfig) => ({
|
|
1777
|
+
async timeline(params, options) {
|
|
1778
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1779
|
+
const queryParams = { customerId: params.customerId };
|
|
1780
|
+
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1781
|
+
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1782
|
+
return apiConfig.httpClient.get(
|
|
1783
|
+
`/v1/businesses/${businessId}/activities/timeline`,
|
|
1784
|
+
{ ...options, params: queryParams }
|
|
1785
|
+
);
|
|
1786
|
+
},
|
|
1787
|
+
async count(params, options) {
|
|
1788
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1789
|
+
const queryParams = {};
|
|
1790
|
+
if (params.type) queryParams.type = params.type;
|
|
1791
|
+
if (params.payloadKey) queryParams.payloadKey = params.payloadKey;
|
|
1792
|
+
if (params.payloadValue) queryParams.payloadValue = params.payloadValue;
|
|
1793
|
+
if (params.windowSeconds !== void 0) queryParams.windowSeconds = params.windowSeconds;
|
|
1794
|
+
return apiConfig.httpClient.get(
|
|
1795
|
+
`/v1/businesses/${businessId}/activities/count`,
|
|
1796
|
+
{ ...options, params: queryParams }
|
|
1797
|
+
);
|
|
1798
|
+
},
|
|
1799
|
+
async types(params, options) {
|
|
1800
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
1801
|
+
return apiConfig.httpClient.get(
|
|
1802
|
+
`/v1/businesses/${businessId}/activities/types`,
|
|
1803
|
+
options
|
|
1804
|
+
);
|
|
1805
|
+
}
|
|
1806
|
+
});
|
|
1223
1807
|
var createCustomerApi = (apiConfig) => {
|
|
1224
1808
|
return {
|
|
1225
1809
|
async create(params, options) {
|
|
@@ -1338,149 +1922,8 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1338
1922
|
options
|
|
1339
1923
|
);
|
|
1340
1924
|
}
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
};
|
|
1344
|
-
|
|
1345
|
-
// src/api/reaction.ts
|
|
1346
|
-
var DEFAULT_REACTION_KINDS = [
|
|
1347
|
-
"like",
|
|
1348
|
-
"love",
|
|
1349
|
-
"laugh",
|
|
1350
|
-
"wow",
|
|
1351
|
-
"sad",
|
|
1352
|
-
"insightful",
|
|
1353
|
-
"review",
|
|
1354
|
-
"comment",
|
|
1355
|
-
"star_1",
|
|
1356
|
-
"star_2",
|
|
1357
|
-
"star_3",
|
|
1358
|
-
"star_4",
|
|
1359
|
-
"star_5"
|
|
1360
|
-
];
|
|
1361
|
-
var REACTION_KIND_REGEX = /^[a-z0-9_]{1,32}$/;
|
|
1362
|
-
function isValidReactionKind(kind) {
|
|
1363
|
-
return REACTION_KIND_REGEX.test(kind);
|
|
1364
|
-
}
|
|
1365
|
-
function computeAverageStars(counts) {
|
|
1366
|
-
let total = 0;
|
|
1367
|
-
let weighted = 0;
|
|
1368
|
-
for (let i = 1; i <= 5; i++) {
|
|
1369
|
-
const c = counts[`star_${i}`] ?? 0;
|
|
1370
|
-
total += c;
|
|
1371
|
-
weighted += c * i;
|
|
1372
|
-
}
|
|
1373
|
-
return {
|
|
1374
|
-
average: total > 0 ? weighted / total : 0,
|
|
1375
|
-
count: total
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
var createReactionApi = (apiConfig) => {
|
|
1379
|
-
const base = (businessId) => `/v1/businesses/${businessId || apiConfig.businessId}/reactions`;
|
|
1380
|
-
return {
|
|
1381
|
-
DEFAULT_REACTION_KINDS,
|
|
1382
|
-
isValidReactionKind,
|
|
1383
|
-
computeAverageStars,
|
|
1384
|
-
async create(params, options) {
|
|
1385
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1386
|
-
return apiConfig.httpClient.post(
|
|
1387
|
-
base(businessId),
|
|
1388
|
-
{
|
|
1389
|
-
businessId,
|
|
1390
|
-
target: params.target,
|
|
1391
|
-
kind: params.kind,
|
|
1392
|
-
blocks: params.blocks || [],
|
|
1393
|
-
parentId: params.parentId,
|
|
1394
|
-
taxonomies: params.taxonomies || []
|
|
1395
|
-
},
|
|
1396
|
-
options
|
|
1397
|
-
);
|
|
1398
|
-
},
|
|
1399
|
-
async get(params, options) {
|
|
1400
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1401
|
-
return apiConfig.httpClient.get(
|
|
1402
|
-
`${base(businessId)}/${params.id}`,
|
|
1403
|
-
options
|
|
1404
|
-
);
|
|
1405
|
-
},
|
|
1406
|
-
async find(params, options) {
|
|
1407
|
-
const businessId = params?.businessId || apiConfig.businessId;
|
|
1408
|
-
const queryParams = {};
|
|
1409
|
-
if (params?.targetType) queryParams.targetType = params.targetType;
|
|
1410
|
-
if (params?.targetId) queryParams.targetId = params.targetId;
|
|
1411
|
-
if (params?.parentId) queryParams.parentId = params.parentId;
|
|
1412
|
-
if (params?.customerId) queryParams.customerId = params.customerId;
|
|
1413
|
-
if (params?.kind) queryParams.kind = params.kind;
|
|
1414
|
-
if (params?.status) queryParams.status = params.status;
|
|
1415
|
-
if (params?.contentOnly !== void 0)
|
|
1416
|
-
queryParams.contentOnly = params.contentOnly;
|
|
1417
|
-
if (params?.verified !== void 0)
|
|
1418
|
-
queryParams.verified = params.verified;
|
|
1419
|
-
if (params?.query) queryParams.query = params.query;
|
|
1420
|
-
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1421
|
-
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1422
|
-
return apiConfig.httpClient.get(
|
|
1423
|
-
base(businessId),
|
|
1424
|
-
{ ...options, params: queryParams }
|
|
1425
|
-
);
|
|
1426
|
-
},
|
|
1427
|
-
async update(params, options) {
|
|
1428
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1429
|
-
return apiConfig.httpClient.put(
|
|
1430
|
-
`${base(businessId)}/${params.id}`,
|
|
1431
|
-
{
|
|
1432
|
-
id: params.id,
|
|
1433
|
-
businessId,
|
|
1434
|
-
blocks: params.blocks,
|
|
1435
|
-
taxonomies: params.taxonomies
|
|
1436
|
-
},
|
|
1437
|
-
options
|
|
1438
|
-
);
|
|
1439
|
-
},
|
|
1440
|
-
async remove(params, options) {
|
|
1441
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1442
|
-
return apiConfig.httpClient.delete(
|
|
1443
|
-
`${base(businessId)}/${params.id}`,
|
|
1444
|
-
options
|
|
1445
|
-
);
|
|
1446
|
-
},
|
|
1447
|
-
async moderate(params, options) {
|
|
1448
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1449
|
-
return apiConfig.httpClient.post(
|
|
1450
|
-
`${base(businessId)}/${params.id}/moderate`,
|
|
1451
|
-
{
|
|
1452
|
-
id: params.id,
|
|
1453
|
-
businessId,
|
|
1454
|
-
status: params.status
|
|
1455
|
-
},
|
|
1456
|
-
options
|
|
1457
|
-
);
|
|
1458
|
-
},
|
|
1459
|
-
async listAdmin(params, options) {
|
|
1460
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1461
|
-
const queryParams = { businessId };
|
|
1462
|
-
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1463
|
-
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1464
|
-
return apiConfig.httpClient.get(
|
|
1465
|
-
`${base(businessId)}/admin`,
|
|
1466
|
-
{ ...options, params: queryParams }
|
|
1467
|
-
);
|
|
1468
|
-
},
|
|
1469
|
-
async summary(params, options) {
|
|
1470
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1471
|
-
return apiConfig.httpClient.get(
|
|
1472
|
-
`${base(businessId)}/summary`,
|
|
1473
|
-
{
|
|
1474
|
-
...options,
|
|
1475
|
-
params: {
|
|
1476
|
-
businessId,
|
|
1477
|
-
targetType: params.targetType,
|
|
1478
|
-
targetId: params.targetId,
|
|
1479
|
-
parentId: params.parentId
|
|
1480
|
-
}
|
|
1481
|
-
}
|
|
1482
|
-
);
|
|
1483
|
-
}
|
|
1925
|
+
},
|
|
1926
|
+
activity: createActivityAdminApi(apiConfig)
|
|
1484
1927
|
};
|
|
1485
1928
|
};
|
|
1486
1929
|
|
|
@@ -1658,847 +2101,271 @@ var createAgentApi = (apiConfig) => {
|
|
|
1658
2101
|
);
|
|
1659
2102
|
},
|
|
1660
2103
|
async rateChat(params, options) {
|
|
1661
|
-
const body = { rating: params.rating };
|
|
1662
|
-
if (params.comment) body.comment = params.comment;
|
|
1663
|
-
return apiConfig.httpClient.post(
|
|
1664
|
-
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chatId}/rate`,
|
|
1665
|
-
body,
|
|
1666
|
-
options
|
|
1667
|
-
);
|
|
1668
|
-
},
|
|
1669
|
-
async getBusinessChats(params, options) {
|
|
1670
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1671
|
-
const { businessId: _, ...queryParams } = params;
|
|
1672
|
-
return apiConfig.httpClient.get(`/v1/businesses/${businessId}/chats`, {
|
|
1673
|
-
...options,
|
|
1674
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1675
|
-
});
|
|
1676
|
-
},
|
|
1677
|
-
async getChatMessages(params, options) {
|
|
1678
|
-
const queryParams = {};
|
|
1679
|
-
if (params.limit) queryParams.limit = String(params.limit);
|
|
1680
|
-
return apiConfig.httpClient.get(
|
|
1681
|
-
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chatId}/messages`,
|
|
1682
|
-
{
|
|
1683
|
-
...options,
|
|
1684
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1685
|
-
}
|
|
1686
|
-
);
|
|
1687
|
-
}
|
|
1688
|
-
};
|
|
1689
|
-
};
|
|
1690
|
-
|
|
1691
|
-
// src/api/emailTemplate.ts
|
|
1692
|
-
var createEmailTemplateApi = (apiConfig) => {
|
|
1693
|
-
return {
|
|
1694
|
-
async createEmailTemplate(params, options) {
|
|
1695
|
-
const { businessId, ...payload } = params;
|
|
1696
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1697
|
-
return apiConfig.httpClient.post(
|
|
1698
|
-
`/v1/businesses/${targetBusinessId}/email-templates`,
|
|
1699
|
-
payload,
|
|
1700
|
-
options
|
|
1701
|
-
);
|
|
1702
|
-
},
|
|
1703
|
-
async updateEmailTemplate(params, options) {
|
|
1704
|
-
const { businessId, ...payload } = params;
|
|
1705
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1706
|
-
return apiConfig.httpClient.put(
|
|
1707
|
-
`/v1/businesses/${targetBusinessId}/email-templates/${params.id}`,
|
|
1708
|
-
payload,
|
|
1709
|
-
options
|
|
1710
|
-
);
|
|
1711
|
-
},
|
|
1712
|
-
async deleteEmailTemplate(params, options) {
|
|
1713
|
-
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1714
|
-
return apiConfig.httpClient.delete(
|
|
1715
|
-
`/v1/businesses/${targetBusinessId}/email-templates/${params.id}`,
|
|
1716
|
-
options
|
|
1717
|
-
);
|
|
1718
|
-
},
|
|
1719
|
-
async getEmailTemplate(params, options) {
|
|
1720
|
-
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1721
|
-
let identifier;
|
|
1722
|
-
if (params.id) {
|
|
1723
|
-
identifier = params.id;
|
|
1724
|
-
} else if (params.key) {
|
|
1725
|
-
identifier = `${targetBusinessId}:${params.key}`;
|
|
1726
|
-
} else {
|
|
1727
|
-
throw new Error("GetEmailTemplateParams requires id or key");
|
|
1728
|
-
}
|
|
1729
|
-
return apiConfig.httpClient.get(
|
|
1730
|
-
`/v1/businesses/${targetBusinessId}/email-templates/${identifier}`,
|
|
1731
|
-
options
|
|
1732
|
-
);
|
|
1733
|
-
},
|
|
1734
|
-
async getEmailTemplates(params, options) {
|
|
1735
|
-
const { businessId, ...queryParams } = params;
|
|
1736
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1737
|
-
return apiConfig.httpClient.get(
|
|
1738
|
-
`/v1/businesses/${targetBusinessId}/email-templates`,
|
|
1739
|
-
{
|
|
1740
|
-
...options,
|
|
1741
|
-
params: queryParams
|
|
1742
|
-
}
|
|
1743
|
-
);
|
|
1744
|
-
}
|
|
1745
|
-
};
|
|
1746
|
-
};
|
|
1747
|
-
|
|
1748
|
-
// src/api/form.ts
|
|
1749
|
-
var createFormApi = (apiConfig) => {
|
|
1750
|
-
return {
|
|
1751
|
-
async createForm(params, options) {
|
|
1752
|
-
const { businessId, ...payload } = params;
|
|
1753
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1754
|
-
return apiConfig.httpClient.post(
|
|
1755
|
-
`/v1/businesses/${targetBusinessId}/forms`,
|
|
1756
|
-
payload,
|
|
1757
|
-
options
|
|
1758
|
-
);
|
|
1759
|
-
},
|
|
1760
|
-
async updateForm(params, options) {
|
|
1761
|
-
const { businessId, ...payload } = params;
|
|
1762
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1763
|
-
return apiConfig.httpClient.put(
|
|
1764
|
-
`/v1/businesses/${targetBusinessId}/forms/${params.id}`,
|
|
1765
|
-
payload,
|
|
1766
|
-
options
|
|
1767
|
-
);
|
|
1768
|
-
},
|
|
1769
|
-
async deleteForm(params, options) {
|
|
1770
|
-
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1771
|
-
return apiConfig.httpClient.delete(
|
|
1772
|
-
`/v1/businesses/${targetBusinessId}/forms/${params.id}`,
|
|
1773
|
-
options
|
|
1774
|
-
);
|
|
1775
|
-
},
|
|
1776
|
-
async getForm(params, options) {
|
|
1777
|
-
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1778
|
-
let identifier;
|
|
1779
|
-
if (params.id) {
|
|
1780
|
-
identifier = params.id;
|
|
1781
|
-
} else if (params.key) {
|
|
1782
|
-
identifier = `${targetBusinessId}:${params.key}`;
|
|
1783
|
-
} else {
|
|
1784
|
-
throw new Error("GetFormParams requires id or key");
|
|
1785
|
-
}
|
|
1786
|
-
return apiConfig.httpClient.get(
|
|
1787
|
-
`/v1/businesses/${targetBusinessId}/forms/${identifier}`,
|
|
1788
|
-
options
|
|
1789
|
-
);
|
|
1790
|
-
},
|
|
1791
|
-
async getForms(params, options) {
|
|
1792
|
-
const { businessId, ...queryParams } = params;
|
|
1793
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1794
|
-
return apiConfig.httpClient.get(
|
|
1795
|
-
`/v1/businesses/${targetBusinessId}/forms`,
|
|
1796
|
-
{
|
|
1797
|
-
...options,
|
|
1798
|
-
params: queryParams
|
|
1799
|
-
}
|
|
1800
|
-
);
|
|
1801
|
-
},
|
|
1802
|
-
async submit(params, options) {
|
|
1803
|
-
const { businessId, formId, ...payload } = params;
|
|
1804
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1805
|
-
return apiConfig.httpClient.post(
|
|
1806
|
-
`/v1/businesses/${targetBusinessId}/forms/${formId}/submissions`,
|
|
1807
|
-
{ ...payload, formId, businessId: targetBusinessId },
|
|
1808
|
-
options
|
|
1809
|
-
);
|
|
1810
|
-
},
|
|
1811
|
-
async getSubmissions(params, options) {
|
|
1812
|
-
const { businessId, formId, ...queryParams } = params;
|
|
1813
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1814
|
-
return apiConfig.httpClient.get(
|
|
1815
|
-
`/v1/businesses/${targetBusinessId}/forms/${formId}/submissions`,
|
|
1816
|
-
{
|
|
1817
|
-
...options,
|
|
1818
|
-
params: { ...queryParams, formId, businessId: targetBusinessId }
|
|
1819
|
-
}
|
|
1820
|
-
);
|
|
1821
|
-
},
|
|
1822
|
-
async getSubmission(params, options) {
|
|
1823
|
-
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1824
|
-
return apiConfig.httpClient.get(
|
|
1825
|
-
`/v1/businesses/${targetBusinessId}/forms/${params.formId}/submissions/${params.id}`,
|
|
1826
|
-
options
|
|
1827
|
-
);
|
|
1828
|
-
},
|
|
1829
|
-
async updateSubmission(params, options) {
|
|
1830
|
-
const { businessId, formId, id, ...payload } = params;
|
|
1831
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1832
|
-
return apiConfig.httpClient.put(
|
|
1833
|
-
`/v1/businesses/${targetBusinessId}/forms/${formId}/submissions/${id}`,
|
|
1834
|
-
{ ...payload, formId, businessId: targetBusinessId, id },
|
|
1835
|
-
options
|
|
1836
|
-
);
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
};
|
|
1840
|
-
|
|
1841
|
-
// src/api/taxonomy.ts
|
|
1842
|
-
var createTaxonomyApi = (apiConfig) => {
|
|
1843
|
-
return {
|
|
1844
|
-
async createTaxonomy(params, options) {
|
|
1845
|
-
const { businessId, ...payload } = params;
|
|
1846
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1847
|
-
return apiConfig.httpClient.post(
|
|
1848
|
-
`/v1/businesses/${targetBusinessId}/taxonomies`,
|
|
1849
|
-
payload,
|
|
1850
|
-
options
|
|
1851
|
-
);
|
|
1852
|
-
},
|
|
1853
|
-
async updateTaxonomy(params, options) {
|
|
1854
|
-
const { businessId, ...payload } = params;
|
|
1855
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1856
|
-
return apiConfig.httpClient.put(
|
|
1857
|
-
`/v1/businesses/${targetBusinessId}/taxonomies/${params.id}`,
|
|
1858
|
-
payload,
|
|
1859
|
-
options
|
|
1860
|
-
);
|
|
1861
|
-
},
|
|
1862
|
-
async deleteTaxonomy(params, options) {
|
|
1863
|
-
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1864
|
-
return apiConfig.httpClient.delete(
|
|
1865
|
-
`/v1/businesses/${targetBusinessId}/taxonomies/${params.id}`,
|
|
1866
|
-
options
|
|
1867
|
-
);
|
|
1868
|
-
},
|
|
1869
|
-
async getTaxonomy(params, options) {
|
|
1870
|
-
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1871
|
-
let identifier;
|
|
1872
|
-
if (params.id) {
|
|
1873
|
-
identifier = params.id;
|
|
1874
|
-
} else if (params.key) {
|
|
1875
|
-
identifier = `${targetBusinessId}:${params.key}`;
|
|
1876
|
-
} else {
|
|
1877
|
-
throw new Error("GetTaxonomyParams requires id or key");
|
|
1878
|
-
}
|
|
1879
|
-
return apiConfig.httpClient.get(
|
|
1880
|
-
`/v1/businesses/${targetBusinessId}/taxonomies/${identifier}`,
|
|
1881
|
-
options
|
|
1882
|
-
);
|
|
1883
|
-
},
|
|
1884
|
-
async getTaxonomies(params, options) {
|
|
1885
|
-
const { businessId, ...queryParams } = params;
|
|
1886
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1887
|
-
return apiConfig.httpClient.get(
|
|
1888
|
-
`/v1/businesses/${targetBusinessId}/taxonomies`,
|
|
1889
|
-
{
|
|
1890
|
-
...options,
|
|
1891
|
-
params: queryParams
|
|
1892
|
-
}
|
|
1893
|
-
);
|
|
1894
|
-
},
|
|
1895
|
-
async getTaxonomyChildren(params, options) {
|
|
1896
|
-
const { id, businessId } = params;
|
|
1897
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1898
|
-
return apiConfig.httpClient.get(
|
|
1899
|
-
`/v1/businesses/${targetBusinessId}/taxonomies/${id}/children`,
|
|
1900
|
-
options
|
|
1901
|
-
);
|
|
1902
|
-
}
|
|
1903
|
-
};
|
|
1904
|
-
};
|
|
1905
|
-
|
|
1906
|
-
// src/api/analytics.ts
|
|
1907
|
-
var createAnalyticsApi = (apiConfig) => {
|
|
1908
|
-
return {
|
|
1909
|
-
async getSummary(params, options) {
|
|
1910
|
-
return apiConfig.httpClient.get(
|
|
1911
|
-
`/v1/businesses/${apiConfig.businessId}/analytics/summary`,
|
|
1912
|
-
{
|
|
1913
|
-
...options,
|
|
1914
|
-
params: params || {}
|
|
1915
|
-
}
|
|
2104
|
+
const body = { rating: params.rating };
|
|
2105
|
+
if (params.comment) body.comment = params.comment;
|
|
2106
|
+
return apiConfig.httpClient.post(
|
|
2107
|
+
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chatId}/rate`,
|
|
2108
|
+
body,
|
|
2109
|
+
options
|
|
1916
2110
|
);
|
|
1917
2111
|
},
|
|
1918
|
-
async
|
|
2112
|
+
async getBusinessChats(params, options) {
|
|
2113
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
2114
|
+
const { businessId: _, ...queryParams } = params;
|
|
2115
|
+
return apiConfig.httpClient.get(`/v1/businesses/${businessId}/chats`, {
|
|
2116
|
+
...options,
|
|
2117
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2118
|
+
});
|
|
2119
|
+
},
|
|
2120
|
+
async getChatMessages(params, options) {
|
|
2121
|
+
const queryParams = {};
|
|
2122
|
+
if (params.limit) queryParams.limit = String(params.limit);
|
|
1919
2123
|
return apiConfig.httpClient.get(
|
|
1920
|
-
`/v1/businesses/${apiConfig.businessId}/
|
|
2124
|
+
`/v1/businesses/${apiConfig.businessId}/agents/${params.id}/chats/${params.chatId}/messages`,
|
|
1921
2125
|
{
|
|
1922
2126
|
...options,
|
|
1923
|
-
params
|
|
2127
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1924
2128
|
}
|
|
1925
2129
|
);
|
|
1926
2130
|
}
|
|
1927
2131
|
};
|
|
1928
2132
|
};
|
|
1929
2133
|
|
|
1930
|
-
// src/api/
|
|
1931
|
-
|
|
1932
|
-
const groups = /* @__PURE__ */ new Map();
|
|
1933
|
-
for (const slot of cart) {
|
|
1934
|
-
const key = `${slot.serviceId}:${slot.providerId}`;
|
|
1935
|
-
if (!groups.has(key)) {
|
|
1936
|
-
groups.set(key, {
|
|
1937
|
-
serviceId: slot.serviceId,
|
|
1938
|
-
providerId: slot.providerId,
|
|
1939
|
-
slots: []
|
|
1940
|
-
});
|
|
1941
|
-
}
|
|
1942
|
-
groups.get(key).slots.push({ from: slot.from, to: slot.to });
|
|
1943
|
-
}
|
|
1944
|
-
return [...groups.values()];
|
|
1945
|
-
}
|
|
1946
|
-
var createStorefrontApi = (apiConfig) => {
|
|
1947
|
-
const base = (businessId = apiConfig.businessId) => `/v1/storefront/${businessId}`;
|
|
1948
|
-
let cart = [];
|
|
2134
|
+
// src/api/emailTemplate.ts
|
|
2135
|
+
var createEmailTemplateApi = (apiConfig) => {
|
|
1949
2136
|
return {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
);
|
|
1959
|
-
},
|
|
1960
|
-
location: {
|
|
1961
|
-
getCountries(options) {
|
|
1962
|
-
return apiConfig.httpClient.get(`/v1/platform/countries`, options);
|
|
1963
|
-
},
|
|
1964
|
-
getCountry(countryCode, options) {
|
|
1965
|
-
return apiConfig.httpClient.get(
|
|
1966
|
-
`/v1/platform/countries/${countryCode}`,
|
|
1967
|
-
options
|
|
1968
|
-
);
|
|
1969
|
-
},
|
|
1970
|
-
list(options) {
|
|
1971
|
-
return apiConfig.httpClient.get(`${base()}/locations`, options);
|
|
1972
|
-
},
|
|
1973
|
-
get(id, options) {
|
|
1974
|
-
return apiConfig.httpClient.get(`${base()}/locations/${id}`, options);
|
|
1975
|
-
}
|
|
1976
|
-
},
|
|
1977
|
-
market: {
|
|
1978
|
-
list(options) {
|
|
1979
|
-
return apiConfig.httpClient.get(`${base()}/markets`, options);
|
|
1980
|
-
},
|
|
1981
|
-
get(id, options) {
|
|
1982
|
-
return apiConfig.httpClient.get(`${base()}/markets/${id}`, options);
|
|
1983
|
-
}
|
|
1984
|
-
}
|
|
1985
|
-
},
|
|
1986
|
-
cms: {
|
|
1987
|
-
node: {
|
|
1988
|
-
async get(params, options) {
|
|
1989
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1990
|
-
let identifier;
|
|
1991
|
-
if (params.id) {
|
|
1992
|
-
identifier = params.id;
|
|
1993
|
-
} else if (params.slug) {
|
|
1994
|
-
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
1995
|
-
} else if (params.key) {
|
|
1996
|
-
identifier = `${businessId}:${params.key}`;
|
|
1997
|
-
} else {
|
|
1998
|
-
throw new Error("GetNodeParams requires id, slug, or key");
|
|
1999
|
-
}
|
|
2000
|
-
const response = await apiConfig.httpClient.get(
|
|
2001
|
-
`${base(businessId)}/nodes/${identifier}`,
|
|
2002
|
-
options
|
|
2003
|
-
);
|
|
2004
|
-
return {
|
|
2005
|
-
...response,
|
|
2006
|
-
getBlock(key) {
|
|
2007
|
-
return getBlockFromArray(response, key, apiConfig.locale);
|
|
2008
|
-
},
|
|
2009
|
-
getBlockValues(key) {
|
|
2010
|
-
return getBlockObjectValues(response, key, apiConfig.locale);
|
|
2011
|
-
},
|
|
2012
|
-
getImage(key) {
|
|
2013
|
-
const block = getBlockFromArray(response, key, apiConfig.locale);
|
|
2014
|
-
return getImageUrl(block, true);
|
|
2015
|
-
}
|
|
2016
|
-
};
|
|
2017
|
-
},
|
|
2018
|
-
find(params, options) {
|
|
2019
|
-
const { businessId, ...queryParams } = params;
|
|
2020
|
-
return apiConfig.httpClient.get(`${base(businessId)}/nodes`, {
|
|
2021
|
-
...options,
|
|
2022
|
-
params: queryParams
|
|
2023
|
-
});
|
|
2024
|
-
},
|
|
2025
|
-
getChildren(params, options) {
|
|
2026
|
-
const { id, businessId, ...queryParams } = params;
|
|
2027
|
-
return apiConfig.httpClient.get(`${base(businessId)}/nodes/${id}/children`, {
|
|
2028
|
-
...options,
|
|
2029
|
-
params: queryParams
|
|
2030
|
-
});
|
|
2031
|
-
}
|
|
2032
|
-
},
|
|
2033
|
-
form: {
|
|
2034
|
-
get(params, options) {
|
|
2035
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2036
|
-
let identifier;
|
|
2037
|
-
if (params.id) {
|
|
2038
|
-
identifier = params.id;
|
|
2039
|
-
} else if (params.key) {
|
|
2040
|
-
identifier = `${businessId}:${params.key}`;
|
|
2041
|
-
} else {
|
|
2042
|
-
throw new Error("GetFormParams requires id or key");
|
|
2043
|
-
}
|
|
2044
|
-
return apiConfig.httpClient.get(
|
|
2045
|
-
`${base(businessId)}/forms/${identifier}`,
|
|
2046
|
-
options
|
|
2047
|
-
);
|
|
2048
|
-
},
|
|
2049
|
-
submit(params, options) {
|
|
2050
|
-
const { businessId, formId, ...payload } = params;
|
|
2051
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2052
|
-
return apiConfig.httpClient.post(
|
|
2053
|
-
`${base(targetBusinessId)}/forms/${formId}/submissions`,
|
|
2054
|
-
{ ...payload, formId, businessId: targetBusinessId },
|
|
2055
|
-
options
|
|
2056
|
-
);
|
|
2057
|
-
}
|
|
2058
|
-
},
|
|
2059
|
-
taxonomy: {
|
|
2060
|
-
get(params, options) {
|
|
2061
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2062
|
-
let identifier;
|
|
2063
|
-
if (params.id) {
|
|
2064
|
-
identifier = params.id;
|
|
2065
|
-
} else if (params.key) {
|
|
2066
|
-
identifier = `${businessId}:${params.key}`;
|
|
2067
|
-
} else {
|
|
2068
|
-
throw new Error("GetTaxonomyParams requires id or key");
|
|
2069
|
-
}
|
|
2070
|
-
return apiConfig.httpClient.get(
|
|
2071
|
-
`${base(businessId)}/taxonomies/${identifier}`,
|
|
2072
|
-
options
|
|
2073
|
-
);
|
|
2074
|
-
},
|
|
2075
|
-
getChildren(params, options) {
|
|
2076
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2077
|
-
return apiConfig.httpClient.get(
|
|
2078
|
-
`${base(businessId)}/taxonomies/${params.id}/children`,
|
|
2079
|
-
options
|
|
2080
|
-
);
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2137
|
+
async createEmailTemplate(params, options) {
|
|
2138
|
+
const { businessId, ...payload } = params;
|
|
2139
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2140
|
+
return apiConfig.httpClient.post(
|
|
2141
|
+
`/v1/businesses/${targetBusinessId}/email-templates`,
|
|
2142
|
+
payload,
|
|
2143
|
+
options
|
|
2144
|
+
);
|
|
2083
2145
|
},
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
`${base(businessId)}/orders/quote`,
|
|
2124
|
-
{ ...rest, shippingAddress, market: apiConfig.market },
|
|
2125
|
-
options
|
|
2126
|
-
);
|
|
2127
|
-
},
|
|
2128
|
-
checkout(params, options) {
|
|
2129
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2130
|
-
return apiConfig.httpClient.post(
|
|
2131
|
-
`${base(businessId)}/orders/checkout`,
|
|
2132
|
-
{ ...params, businessId, market: apiConfig.market },
|
|
2133
|
-
options
|
|
2134
|
-
);
|
|
2135
|
-
},
|
|
2136
|
-
get(params, options) {
|
|
2137
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2138
|
-
return apiConfig.httpClient.get(
|
|
2139
|
-
`${base(businessId)}/orders/${params.id}`,
|
|
2140
|
-
options
|
|
2141
|
-
);
|
|
2142
|
-
},
|
|
2143
|
-
find(params, options) {
|
|
2144
|
-
const { businessId, ...queryParams } = params;
|
|
2145
|
-
return apiConfig.httpClient.get(`${base(businessId)}/orders`, {
|
|
2146
|
-
...options,
|
|
2147
|
-
params: queryParams
|
|
2148
|
-
});
|
|
2146
|
+
async updateEmailTemplate(params, options) {
|
|
2147
|
+
const { businessId, ...payload } = params;
|
|
2148
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2149
|
+
return apiConfig.httpClient.put(
|
|
2150
|
+
`/v1/businesses/${targetBusinessId}/email-templates/${params.id}`,
|
|
2151
|
+
payload,
|
|
2152
|
+
options
|
|
2153
|
+
);
|
|
2154
|
+
},
|
|
2155
|
+
async deleteEmailTemplate(params, options) {
|
|
2156
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
2157
|
+
return apiConfig.httpClient.delete(
|
|
2158
|
+
`/v1/businesses/${targetBusinessId}/email-templates/${params.id}`,
|
|
2159
|
+
options
|
|
2160
|
+
);
|
|
2161
|
+
},
|
|
2162
|
+
async getEmailTemplate(params, options) {
|
|
2163
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
2164
|
+
let identifier;
|
|
2165
|
+
if (params.id) {
|
|
2166
|
+
identifier = params.id;
|
|
2167
|
+
} else if (params.key) {
|
|
2168
|
+
identifier = `${targetBusinessId}:${params.key}`;
|
|
2169
|
+
} else {
|
|
2170
|
+
throw new Error("GetEmailTemplateParams requires id or key");
|
|
2171
|
+
}
|
|
2172
|
+
return apiConfig.httpClient.get(
|
|
2173
|
+
`/v1/businesses/${targetBusinessId}/email-templates/${identifier}`,
|
|
2174
|
+
options
|
|
2175
|
+
);
|
|
2176
|
+
},
|
|
2177
|
+
async getEmailTemplates(params, options) {
|
|
2178
|
+
const { businessId, ...queryParams } = params;
|
|
2179
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2180
|
+
return apiConfig.httpClient.get(
|
|
2181
|
+
`/v1/businesses/${targetBusinessId}/email-templates`,
|
|
2182
|
+
{
|
|
2183
|
+
...options,
|
|
2184
|
+
params: queryParams
|
|
2149
2185
|
}
|
|
2186
|
+
);
|
|
2187
|
+
}
|
|
2188
|
+
};
|
|
2189
|
+
};
|
|
2190
|
+
|
|
2191
|
+
// src/api/form.ts
|
|
2192
|
+
var createFormApi = (apiConfig) => {
|
|
2193
|
+
return {
|
|
2194
|
+
async createForm(params, options) {
|
|
2195
|
+
const { businessId, ...payload } = params;
|
|
2196
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2197
|
+
return apiConfig.httpClient.post(
|
|
2198
|
+
`/v1/businesses/${targetBusinessId}/forms`,
|
|
2199
|
+
payload,
|
|
2200
|
+
options
|
|
2201
|
+
);
|
|
2202
|
+
},
|
|
2203
|
+
async updateForm(params, options) {
|
|
2204
|
+
const { businessId, ...payload } = params;
|
|
2205
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2206
|
+
return apiConfig.httpClient.put(
|
|
2207
|
+
`/v1/businesses/${targetBusinessId}/forms/${params.id}`,
|
|
2208
|
+
payload,
|
|
2209
|
+
options
|
|
2210
|
+
);
|
|
2211
|
+
},
|
|
2212
|
+
async deleteForm(params, options) {
|
|
2213
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
2214
|
+
return apiConfig.httpClient.delete(
|
|
2215
|
+
`/v1/businesses/${targetBusinessId}/forms/${params.id}`,
|
|
2216
|
+
options
|
|
2217
|
+
);
|
|
2218
|
+
},
|
|
2219
|
+
async getForm(params, options) {
|
|
2220
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
2221
|
+
let identifier;
|
|
2222
|
+
if (params.id) {
|
|
2223
|
+
identifier = params.id;
|
|
2224
|
+
} else if (params.key) {
|
|
2225
|
+
identifier = `${targetBusinessId}:${params.key}`;
|
|
2226
|
+
} else {
|
|
2227
|
+
throw new Error("GetFormParams requires id or key");
|
|
2150
2228
|
}
|
|
2229
|
+
return apiConfig.httpClient.get(
|
|
2230
|
+
`/v1/businesses/${targetBusinessId}/forms/${identifier}`,
|
|
2231
|
+
options
|
|
2232
|
+
);
|
|
2151
2233
|
},
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
},
|
|
2159
|
-
getCart() {
|
|
2160
|
-
return [...cart];
|
|
2161
|
-
},
|
|
2162
|
-
clearCart() {
|
|
2163
|
-
cart = [];
|
|
2164
|
-
},
|
|
2165
|
-
checkout(params, options) {
|
|
2166
|
-
const { businessId, items: paramItems, ...payload } = params || {};
|
|
2167
|
-
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2168
|
-
const items = paramItems || groupCartToItems(cart);
|
|
2169
|
-
return apiConfig.httpClient.post(
|
|
2170
|
-
`${base(targetBusinessId)}/bookings/checkout`,
|
|
2171
|
-
{ market: "booking", ...payload, items },
|
|
2172
|
-
options
|
|
2173
|
-
);
|
|
2174
|
-
},
|
|
2175
|
-
get(params, options) {
|
|
2176
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2177
|
-
return apiConfig.httpClient.get(
|
|
2178
|
-
`${base(businessId)}/bookings/${params.id}`,
|
|
2179
|
-
options
|
|
2180
|
-
);
|
|
2181
|
-
},
|
|
2182
|
-
find(params, options) {
|
|
2183
|
-
const { businessId, ...queryParams } = params;
|
|
2184
|
-
return apiConfig.httpClient.get(`${base(businessId)}/bookings`, {
|
|
2234
|
+
async getForms(params, options) {
|
|
2235
|
+
const { businessId, ...queryParams } = params;
|
|
2236
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2237
|
+
return apiConfig.httpClient.get(
|
|
2238
|
+
`/v1/businesses/${targetBusinessId}/forms`,
|
|
2239
|
+
{
|
|
2185
2240
|
...options,
|
|
2186
2241
|
params: queryParams
|
|
2187
|
-
});
|
|
2188
|
-
},
|
|
2189
|
-
getQuote(params, options) {
|
|
2190
|
-
const { businessId, ...payload } = params;
|
|
2191
|
-
return apiConfig.httpClient.post(
|
|
2192
|
-
`${base(businessId)}/bookings/quote`,
|
|
2193
|
-
{ market: "booking", ...payload },
|
|
2194
|
-
options
|
|
2195
|
-
);
|
|
2196
|
-
},
|
|
2197
|
-
getAvailability(params, options) {
|
|
2198
|
-
const { businessId, ...queryParams } = params;
|
|
2199
|
-
return apiConfig.httpClient.get(
|
|
2200
|
-
`${base(businessId)}/bookings/availability`,
|
|
2201
|
-
{ ...options, params: queryParams }
|
|
2202
|
-
);
|
|
2203
|
-
},
|
|
2204
|
-
cancelItem(params, options) {
|
|
2205
|
-
const { businessId, bookingId, itemId, ...payload } = params;
|
|
2206
|
-
return apiConfig.httpClient.post(
|
|
2207
|
-
`${base(businessId)}/bookings/${bookingId}/items/${itemId}/cancel`,
|
|
2208
|
-
payload,
|
|
2209
|
-
options
|
|
2210
|
-
);
|
|
2211
|
-
},
|
|
2212
|
-
service: {
|
|
2213
|
-
get(params, options) {
|
|
2214
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2215
|
-
let identifier;
|
|
2216
|
-
if (params.id) {
|
|
2217
|
-
identifier = params.id;
|
|
2218
|
-
} else if (params.slug) {
|
|
2219
|
-
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
2220
|
-
} else {
|
|
2221
|
-
throw new Error("GetServiceParams requires id or slug");
|
|
2222
|
-
}
|
|
2223
|
-
return apiConfig.httpClient.get(
|
|
2224
|
-
`${base(businessId)}/services/${identifier}`,
|
|
2225
|
-
options
|
|
2226
|
-
);
|
|
2227
|
-
},
|
|
2228
|
-
find(params, options) {
|
|
2229
|
-
const { businessId, ...queryParams } = params;
|
|
2230
|
-
return apiConfig.httpClient.get(`${base(businessId)}/services`, {
|
|
2231
|
-
...options,
|
|
2232
|
-
params: queryParams
|
|
2233
|
-
});
|
|
2234
|
-
},
|
|
2235
|
-
findProviders(params, options) {
|
|
2236
|
-
const { businessId, ...queryParams } = params;
|
|
2237
|
-
return apiConfig.httpClient.get(`${base(businessId)}/service-providers`, {
|
|
2238
|
-
...options,
|
|
2239
|
-
params: queryParams
|
|
2240
|
-
});
|
|
2241
2242
|
}
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
return apiConfig.httpClient.get(`${base(businessId)}/providers`, {
|
|
2262
|
-
...options,
|
|
2263
|
-
params: queryParams
|
|
2264
|
-
});
|
|
2243
|
+
);
|
|
2244
|
+
},
|
|
2245
|
+
async submit(params, options) {
|
|
2246
|
+
const { businessId, formId, ...payload } = params;
|
|
2247
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2248
|
+
return apiConfig.httpClient.post(
|
|
2249
|
+
`/v1/businesses/${targetBusinessId}/forms/${formId}/submissions`,
|
|
2250
|
+
{ ...payload, formId, businessId: targetBusinessId },
|
|
2251
|
+
options
|
|
2252
|
+
);
|
|
2253
|
+
},
|
|
2254
|
+
async getSubmissions(params, options) {
|
|
2255
|
+
const { businessId, formId, ...queryParams } = params;
|
|
2256
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2257
|
+
return apiConfig.httpClient.get(
|
|
2258
|
+
`/v1/businesses/${targetBusinessId}/forms/${formId}/submissions`,
|
|
2259
|
+
{
|
|
2260
|
+
...options,
|
|
2261
|
+
params: { ...queryParams, formId, businessId: targetBusinessId }
|
|
2265
2262
|
}
|
|
2263
|
+
);
|
|
2264
|
+
},
|
|
2265
|
+
async getSubmission(params, options) {
|
|
2266
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
2267
|
+
return apiConfig.httpClient.get(
|
|
2268
|
+
`/v1/businesses/${targetBusinessId}/forms/${params.formId}/submissions/${params.id}`,
|
|
2269
|
+
options
|
|
2270
|
+
);
|
|
2271
|
+
},
|
|
2272
|
+
async updateSubmission(params, options) {
|
|
2273
|
+
const { businessId, formId, id, ...payload } = params;
|
|
2274
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2275
|
+
return apiConfig.httpClient.put(
|
|
2276
|
+
`/v1/businesses/${targetBusinessId}/forms/${formId}/submissions/${id}`,
|
|
2277
|
+
{ ...payload, formId, businessId: targetBusinessId, id },
|
|
2278
|
+
options
|
|
2279
|
+
);
|
|
2280
|
+
}
|
|
2281
|
+
};
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
// src/api/taxonomy.ts
|
|
2285
|
+
var createTaxonomyApi = (apiConfig) => {
|
|
2286
|
+
return {
|
|
2287
|
+
async createTaxonomy(params, options) {
|
|
2288
|
+
const { businessId, ...payload } = params;
|
|
2289
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2290
|
+
return apiConfig.httpClient.post(
|
|
2291
|
+
`/v1/businesses/${targetBusinessId}/taxonomies`,
|
|
2292
|
+
payload,
|
|
2293
|
+
options
|
|
2294
|
+
);
|
|
2295
|
+
},
|
|
2296
|
+
async updateTaxonomy(params, options) {
|
|
2297
|
+
const { businessId, ...payload } = params;
|
|
2298
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2299
|
+
return apiConfig.httpClient.put(
|
|
2300
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${params.id}`,
|
|
2301
|
+
payload,
|
|
2302
|
+
options
|
|
2303
|
+
);
|
|
2304
|
+
},
|
|
2305
|
+
async deleteTaxonomy(params, options) {
|
|
2306
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
2307
|
+
return apiConfig.httpClient.delete(
|
|
2308
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${params.id}`,
|
|
2309
|
+
options
|
|
2310
|
+
);
|
|
2311
|
+
},
|
|
2312
|
+
async getTaxonomy(params, options) {
|
|
2313
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
2314
|
+
let identifier;
|
|
2315
|
+
if (params.id) {
|
|
2316
|
+
identifier = params.id;
|
|
2317
|
+
} else if (params.key) {
|
|
2318
|
+
identifier = `${targetBusinessId}:${params.key}`;
|
|
2319
|
+
} else {
|
|
2320
|
+
throw new Error("GetTaxonomyParams requires id or key");
|
|
2266
2321
|
}
|
|
2322
|
+
return apiConfig.httpClient.get(
|
|
2323
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${identifier}`,
|
|
2324
|
+
options
|
|
2325
|
+
);
|
|
2267
2326
|
},
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
);
|
|
2277
|
-
},
|
|
2278
|
-
signInAnonymously(params, options) {
|
|
2279
|
-
const businessId = params?.businessId || apiConfig.businessId;
|
|
2280
|
-
return apiConfig.httpClient.post(
|
|
2281
|
-
`${base(businessId)}/customers/initialize`,
|
|
2282
|
-
{ businessId },
|
|
2283
|
-
options
|
|
2284
|
-
);
|
|
2285
|
-
},
|
|
2286
|
-
connect(params, options) {
|
|
2287
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2288
|
-
return apiConfig.httpClient.post(
|
|
2289
|
-
`${base(businessId)}/customers/connect`,
|
|
2290
|
-
{ email: params.email, businessId },
|
|
2291
|
-
options
|
|
2292
|
-
);
|
|
2293
|
-
},
|
|
2294
|
-
requestCode(params, options) {
|
|
2295
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2296
|
-
return apiConfig.httpClient.post(
|
|
2297
|
-
`${base(businessId)}/customers/auth/code`,
|
|
2298
|
-
{ email: params.email, businessId },
|
|
2299
|
-
options
|
|
2300
|
-
);
|
|
2301
|
-
},
|
|
2302
|
-
verify(params, options) {
|
|
2303
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2304
|
-
return apiConfig.httpClient.post(
|
|
2305
|
-
`${base(businessId)}/customers/auth/verify`,
|
|
2306
|
-
{ email: params.email, code: params.code, businessId },
|
|
2307
|
-
options
|
|
2308
|
-
);
|
|
2309
|
-
},
|
|
2310
|
-
refreshToken(params, options) {
|
|
2311
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2312
|
-
return apiConfig.httpClient.post(
|
|
2313
|
-
`${base(businessId)}/customers/auth/refresh`,
|
|
2314
|
-
{ refreshToken: params.refreshToken },
|
|
2315
|
-
options
|
|
2316
|
-
);
|
|
2317
|
-
},
|
|
2318
|
-
getMe(options) {
|
|
2319
|
-
return apiConfig.httpClient.get(`${base()}/customers/me`, options);
|
|
2320
|
-
}
|
|
2321
|
-
},
|
|
2322
|
-
audience: {
|
|
2323
|
-
get(params, options) {
|
|
2324
|
-
let identifier;
|
|
2325
|
-
if (params.id) {
|
|
2326
|
-
identifier = params.id;
|
|
2327
|
-
} else if (params.key) {
|
|
2328
|
-
identifier = `${apiConfig.businessId}:${params.key}`;
|
|
2329
|
-
} else {
|
|
2330
|
-
throw new Error("GetAudienceParams requires id or key");
|
|
2331
|
-
}
|
|
2332
|
-
return apiConfig.httpClient.get(
|
|
2333
|
-
`${base(apiConfig.businessId)}/audiences/${identifier}`,
|
|
2334
|
-
options
|
|
2335
|
-
);
|
|
2336
|
-
},
|
|
2337
|
-
find(params, options) {
|
|
2338
|
-
return apiConfig.httpClient.get(`${base()}/audiences`, {
|
|
2339
|
-
...options,
|
|
2340
|
-
params
|
|
2341
|
-
});
|
|
2342
|
-
},
|
|
2343
|
-
subscribe(params, options) {
|
|
2344
|
-
return apiConfig.httpClient.post(
|
|
2345
|
-
`${base()}/audiences/${params.id}/subscribe`,
|
|
2346
|
-
{
|
|
2347
|
-
customerId: params.customerId,
|
|
2348
|
-
priceId: params.priceId,
|
|
2349
|
-
successUrl: params.successUrl,
|
|
2350
|
-
cancelUrl: params.cancelUrl,
|
|
2351
|
-
confirmUrl: params.confirmUrl
|
|
2352
|
-
},
|
|
2353
|
-
options
|
|
2354
|
-
);
|
|
2355
|
-
},
|
|
2356
|
-
checkAccess(params, options) {
|
|
2357
|
-
return apiConfig.httpClient.get(
|
|
2358
|
-
`${base()}/audiences/${params.id}/access`,
|
|
2359
|
-
options
|
|
2360
|
-
);
|
|
2361
|
-
},
|
|
2362
|
-
unsubscribe(token, options) {
|
|
2363
|
-
return apiConfig.httpClient.get(`${base()}/audiences/unsubscribe`, {
|
|
2364
|
-
...options,
|
|
2365
|
-
params: { token }
|
|
2366
|
-
});
|
|
2367
|
-
},
|
|
2368
|
-
confirm(token, options) {
|
|
2369
|
-
return apiConfig.httpClient.get(`${base()}/audiences/confirm`, {
|
|
2370
|
-
...options,
|
|
2371
|
-
params: { token }
|
|
2372
|
-
});
|
|
2327
|
+
async getTaxonomies(params, options) {
|
|
2328
|
+
const { businessId, ...queryParams } = params;
|
|
2329
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2330
|
+
return apiConfig.httpClient.get(
|
|
2331
|
+
`/v1/businesses/${targetBusinessId}/taxonomies`,
|
|
2332
|
+
{
|
|
2333
|
+
...options,
|
|
2334
|
+
params: queryParams
|
|
2373
2335
|
}
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
return apiConfig.httpClient.get(
|
|
2397
|
-
`${base(businessId)}/reactions/${params.id}`,
|
|
2398
|
-
options
|
|
2399
|
-
);
|
|
2400
|
-
},
|
|
2401
|
-
find(params, options) {
|
|
2402
|
-
const businessId = params?.businessId || apiConfig.businessId;
|
|
2403
|
-
const queryParams = { ...params || {} };
|
|
2404
|
-
delete queryParams.businessId;
|
|
2405
|
-
return apiConfig.httpClient.get(`${base(businessId)}/reactions`, {
|
|
2406
|
-
...options,
|
|
2407
|
-
params: queryParams
|
|
2408
|
-
});
|
|
2409
|
-
},
|
|
2410
|
-
update(params, options) {
|
|
2411
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2412
|
-
return apiConfig.httpClient.put(
|
|
2413
|
-
`${base(businessId)}/reactions/${params.id}`,
|
|
2414
|
-
{
|
|
2415
|
-
id: params.id,
|
|
2416
|
-
businessId,
|
|
2417
|
-
blocks: params.blocks,
|
|
2418
|
-
taxonomies: params.taxonomies
|
|
2419
|
-
},
|
|
2420
|
-
options
|
|
2421
|
-
);
|
|
2422
|
-
},
|
|
2423
|
-
remove(params, options) {
|
|
2424
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2425
|
-
return apiConfig.httpClient.delete(
|
|
2426
|
-
`${base(businessId)}/reactions/${params.id}`,
|
|
2427
|
-
options
|
|
2428
|
-
);
|
|
2429
|
-
},
|
|
2430
|
-
summary(params, options) {
|
|
2431
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2432
|
-
return apiConfig.httpClient.get(`${base(businessId)}/reactions/summary`, {
|
|
2433
|
-
...options,
|
|
2434
|
-
params: {
|
|
2435
|
-
businessId,
|
|
2436
|
-
targetType: params.targetType,
|
|
2437
|
-
targetId: params.targetId,
|
|
2438
|
-
parentId: params.parentId
|
|
2439
|
-
}
|
|
2440
|
-
});
|
|
2336
|
+
);
|
|
2337
|
+
},
|
|
2338
|
+
async getTaxonomyChildren(params, options) {
|
|
2339
|
+
const { id, businessId } = params;
|
|
2340
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
2341
|
+
return apiConfig.httpClient.get(
|
|
2342
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${id}/children`,
|
|
2343
|
+
options
|
|
2344
|
+
);
|
|
2345
|
+
}
|
|
2346
|
+
};
|
|
2347
|
+
};
|
|
2348
|
+
|
|
2349
|
+
// src/api/analytics.ts
|
|
2350
|
+
var createAnalyticsApi = (apiConfig) => {
|
|
2351
|
+
return {
|
|
2352
|
+
async getSummary(params, options) {
|
|
2353
|
+
return apiConfig.httpClient.get(
|
|
2354
|
+
`/v1/businesses/${apiConfig.businessId}/analytics/summary`,
|
|
2355
|
+
{
|
|
2356
|
+
...options,
|
|
2357
|
+
params: params || {}
|
|
2441
2358
|
}
|
|
2442
|
-
|
|
2359
|
+
);
|
|
2443
2360
|
},
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
return apiConfig.httpClient.get(`${base(businessId)}/agents`, {
|
|
2451
|
-
...options,
|
|
2452
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2453
|
-
});
|
|
2454
|
-
},
|
|
2455
|
-
getAgent(params, options) {
|
|
2456
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2457
|
-
return apiConfig.httpClient.get(
|
|
2458
|
-
`${base(businessId)}/agents/${params.id}`,
|
|
2459
|
-
options
|
|
2460
|
-
);
|
|
2461
|
-
},
|
|
2462
|
-
sendMessage(params, options) {
|
|
2463
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2464
|
-
const body = { message: params.message };
|
|
2465
|
-
if (params.chatId) body.chatId = params.chatId;
|
|
2466
|
-
return apiConfig.httpClient.post(
|
|
2467
|
-
`${base(businessId)}/agents/${params.id}/chats/messages`,
|
|
2468
|
-
body,
|
|
2469
|
-
options
|
|
2470
|
-
);
|
|
2471
|
-
},
|
|
2472
|
-
getChat(params, options) {
|
|
2473
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2474
|
-
return apiConfig.httpClient.get(
|
|
2475
|
-
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}`,
|
|
2476
|
-
options
|
|
2477
|
-
);
|
|
2478
|
-
},
|
|
2479
|
-
getChatMessages(params, options) {
|
|
2480
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2481
|
-
const queryParams = {};
|
|
2482
|
-
if (params.limit) queryParams.limit = String(params.limit);
|
|
2483
|
-
return apiConfig.httpClient.get(
|
|
2484
|
-
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}/messages`,
|
|
2485
|
-
{
|
|
2486
|
-
...options,
|
|
2487
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
2488
|
-
}
|
|
2489
|
-
);
|
|
2490
|
-
},
|
|
2491
|
-
rateChat(params, options) {
|
|
2492
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
2493
|
-
const body = { rating: params.rating };
|
|
2494
|
-
if (params.comment) body.comment = params.comment;
|
|
2495
|
-
return apiConfig.httpClient.post(
|
|
2496
|
-
`${base(businessId)}/agents/${params.id}/chats/${params.chatId}/rate`,
|
|
2497
|
-
body,
|
|
2498
|
-
options
|
|
2499
|
-
);
|
|
2361
|
+
async getStatusBreakdown(params, options) {
|
|
2362
|
+
return apiConfig.httpClient.get(
|
|
2363
|
+
`/v1/businesses/${apiConfig.businessId}/analytics/status`,
|
|
2364
|
+
{
|
|
2365
|
+
...options,
|
|
2366
|
+
params
|
|
2500
2367
|
}
|
|
2501
|
-
|
|
2368
|
+
);
|
|
2502
2369
|
}
|
|
2503
2370
|
};
|
|
2504
2371
|
};
|
|
@@ -2773,7 +2640,7 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
2773
2640
|
}
|
|
2774
2641
|
|
|
2775
2642
|
// src/index.ts
|
|
2776
|
-
var SDK_VERSION = "0.7.
|
|
2643
|
+
var SDK_VERSION = "0.7.74";
|
|
2777
2644
|
var SUPPORTED_FRAMEWORKS = [
|
|
2778
2645
|
"astro",
|
|
2779
2646
|
"react",
|
|
@@ -2856,7 +2723,6 @@ async function createAdmin(config) {
|
|
|
2856
2723
|
const eshopApi = createEshopApi(apiConfig);
|
|
2857
2724
|
const bookingApi = createBookingApi(apiConfig);
|
|
2858
2725
|
const crmApi = createCustomerApi(apiConfig);
|
|
2859
|
-
const reactionApi = createReactionApi(apiConfig);
|
|
2860
2726
|
const locationApi = createLocationApi(apiConfig);
|
|
2861
2727
|
const marketApi = createMarketApi(apiConfig);
|
|
2862
2728
|
const agentApi = createAgentApi(apiConfig);
|
|
@@ -2982,7 +2848,7 @@ async function createAdmin(config) {
|
|
|
2982
2848
|
addSubscriber: crmApi.audiences.addSubscriber,
|
|
2983
2849
|
removeSubscriber: crmApi.audiences.removeSubscriber
|
|
2984
2850
|
},
|
|
2985
|
-
|
|
2851
|
+
activity: crmApi.activity
|
|
2986
2852
|
},
|
|
2987
2853
|
automation: {
|
|
2988
2854
|
agent: {
|
|
@@ -3095,6 +2961,7 @@ async function createStorefront(config) {
|
|
|
3095
2961
|
eshop: storefrontApi.eshop,
|
|
3096
2962
|
booking: storefrontApi.booking,
|
|
3097
2963
|
crm: storefrontApi.crm,
|
|
2964
|
+
activity: storefrontApi.activity,
|
|
3098
2965
|
automation: storefrontApi.automation,
|
|
3099
2966
|
analytics: {
|
|
3100
2967
|
track
|
|
@@ -3119,14 +2986,11 @@ async function createStorefront(config) {
|
|
|
3119
2986
|
};
|
|
3120
2987
|
}
|
|
3121
2988
|
|
|
3122
|
-
exports.
|
|
2989
|
+
exports.COMMON_ACTIVITY_TYPES = COMMON_ACTIVITY_TYPES;
|
|
3123
2990
|
exports.PaymentMethodType = PaymentMethodType;
|
|
3124
|
-
exports.REACTION_KIND_REGEX = REACTION_KIND_REGEX;
|
|
3125
2991
|
exports.SDK_VERSION = SDK_VERSION;
|
|
3126
2992
|
exports.SUPPORTED_FRAMEWORKS = SUPPORTED_FRAMEWORKS;
|
|
3127
|
-
exports.computeAverageStars = computeAverageStars;
|
|
3128
2993
|
exports.createAdmin = createAdmin;
|
|
3129
2994
|
exports.createStorefront = createStorefront;
|
|
3130
|
-
exports.isValidReactionKind = isValidReactionKind;
|
|
3131
2995
|
//# sourceMappingURL=index.cjs.map
|
|
3132
2996
|
//# sourceMappingURL=index.cjs.map
|