arky-sdk 0.4.0 → 0.4.2
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 +537 -429
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +184 -71
- package/dist/index.d.ts +184 -71
- package/dist/index.js +537 -429
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +565 -334
- package/dist/types.d.ts +565 -334
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +25 -695
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +41 -121
- package/dist/utils.d.ts +41 -121
- package/dist/utils.js +22 -655
- package/dist/utils.js.map +1 -1
- package/package.json +2 -1
- package/dist/svg-3F_m7296.d.cts +0 -133
- package/dist/svg-4hIdMU6f.d.ts +0 -133
package/dist/index.cjs
CHANGED
|
@@ -10,9 +10,10 @@ var PaymentMethodType = /* @__PURE__ */ ((PaymentMethodType2) => {
|
|
|
10
10
|
|
|
11
11
|
// src/utils/errors.ts
|
|
12
12
|
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
13
|
+
const validationErrors = serverError?.validationErrors ?? [];
|
|
13
14
|
return {
|
|
14
15
|
...serverError,
|
|
15
|
-
validationErrors:
|
|
16
|
+
validationErrors: validationErrors.map((validationError) => {
|
|
16
17
|
const field = validationError.field;
|
|
17
18
|
return {
|
|
18
19
|
field,
|
|
@@ -46,14 +47,14 @@ function buildQueryString(params) {
|
|
|
46
47
|
|
|
47
48
|
// src/services/createHttpClient.ts
|
|
48
49
|
function createHttpClient(cfg) {
|
|
49
|
-
const refreshEndpoint = `${cfg.baseUrl}/v1/
|
|
50
|
+
const refreshEndpoint = `${cfg.baseUrl}/v1/auth/refresh`;
|
|
50
51
|
let refreshPromise = null;
|
|
51
52
|
async function ensureFreshToken() {
|
|
52
53
|
if (refreshPromise) {
|
|
53
54
|
return refreshPromise;
|
|
54
55
|
}
|
|
55
56
|
refreshPromise = (async () => {
|
|
56
|
-
const { refreshToken
|
|
57
|
+
const { refreshToken } = await cfg.getToken();
|
|
57
58
|
if (!refreshToken) {
|
|
58
59
|
cfg.logout();
|
|
59
60
|
const err = new Error("No refresh token available");
|
|
@@ -64,7 +65,7 @@ function createHttpClient(cfg) {
|
|
|
64
65
|
const refRes = await fetch(refreshEndpoint, {
|
|
65
66
|
method: "POST",
|
|
66
67
|
headers: { Accept: "application/json", "Content-Type": "application/json" },
|
|
67
|
-
body: JSON.stringify({
|
|
68
|
+
body: JSON.stringify({ refreshToken })
|
|
68
69
|
});
|
|
69
70
|
if (!refRes.ok) {
|
|
70
71
|
cfg.logout();
|
|
@@ -89,20 +90,15 @@ function createHttpClient(cfg) {
|
|
|
89
90
|
"Content-Type": "application/json",
|
|
90
91
|
...options?.headers || {}
|
|
91
92
|
};
|
|
92
|
-
let { accessToken, expiresAt
|
|
93
|
+
let { accessToken, expiresAt } = await cfg.getToken();
|
|
93
94
|
const nowSec = Date.now() / 1e3;
|
|
94
95
|
if (expiresAt && nowSec > expiresAt) {
|
|
95
96
|
await ensureFreshToken();
|
|
96
97
|
const tokens = await cfg.getToken();
|
|
97
98
|
accessToken = tokens.accessToken;
|
|
98
|
-
provider = tokens.provider;
|
|
99
99
|
}
|
|
100
100
|
if (accessToken) {
|
|
101
|
-
|
|
102
|
-
headers["X-API-Key"] = accessToken;
|
|
103
|
-
} else {
|
|
104
|
-
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
105
|
-
}
|
|
101
|
+
headers["Authorization"] = `Bearer ${accessToken}`;
|
|
106
102
|
}
|
|
107
103
|
const finalPath = options?.params ? path + buildQueryString(options.params) : path;
|
|
108
104
|
const fetchOpts = { method, headers };
|
|
@@ -212,32 +208,31 @@ function createHttpClient(cfg) {
|
|
|
212
208
|
};
|
|
213
209
|
}
|
|
214
210
|
|
|
215
|
-
// src/api/
|
|
216
|
-
var
|
|
211
|
+
// src/api/account.ts
|
|
212
|
+
var createAccountApi = (apiConfig) => {
|
|
217
213
|
return {
|
|
218
|
-
// =====
|
|
219
|
-
async
|
|
214
|
+
// ===== ACCOUNT PROFILE =====
|
|
215
|
+
async updateAccount(params, options) {
|
|
220
216
|
const payload = {};
|
|
221
|
-
if (params.name !== void 0) payload.name = params.name;
|
|
222
217
|
if (params.phoneNumbers !== void 0) payload.phoneNumbers = params.phoneNumbers;
|
|
223
218
|
if (params.addresses !== void 0) payload.addresses = params.addresses;
|
|
224
219
|
if (params.apiTokens !== void 0) payload.apiTokens = params.apiTokens;
|
|
225
|
-
return apiConfig.httpClient.put("/v1/
|
|
220
|
+
return apiConfig.httpClient.put("/v1/accounts", payload, options);
|
|
226
221
|
},
|
|
227
|
-
async
|
|
228
|
-
return apiConfig.httpClient.delete("/v1/
|
|
222
|
+
async deleteAccount(params, options) {
|
|
223
|
+
return apiConfig.httpClient.delete("/v1/accounts", options);
|
|
229
224
|
},
|
|
230
225
|
async addPhoneNumber(params, options) {
|
|
231
|
-
return apiConfig.httpClient.post("/v1/
|
|
226
|
+
return apiConfig.httpClient.post("/v1/accounts/phone-number", params, options);
|
|
232
227
|
},
|
|
233
228
|
async phoneNumberConfirm(params, options) {
|
|
234
|
-
return apiConfig.httpClient.post("/v1/
|
|
229
|
+
return apiConfig.httpClient.post("/v1/accounts/phone-number/confirm", params, options);
|
|
235
230
|
},
|
|
236
231
|
async getMe(params, options) {
|
|
237
|
-
return apiConfig.httpClient.get("/v1/
|
|
232
|
+
return apiConfig.httpClient.get("/v1/accounts/me", options);
|
|
238
233
|
},
|
|
239
|
-
async
|
|
240
|
-
return apiConfig.httpClient.get("/v1/
|
|
234
|
+
async searchAccounts(params, options) {
|
|
235
|
+
return apiConfig.httpClient.get("/v1/accounts/search", {
|
|
241
236
|
...options,
|
|
242
237
|
params: {
|
|
243
238
|
...params,
|
|
@@ -245,40 +240,99 @@ var createUserApi = (apiConfig) => {
|
|
|
245
240
|
}
|
|
246
241
|
});
|
|
247
242
|
},
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
243
|
+
// ===== SUBSCRIPTION =====
|
|
244
|
+
async subscribe(params, options) {
|
|
245
|
+
return apiConfig.httpClient.post("/v1/accounts/subscribe", params, options);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// src/api/auth.ts
|
|
251
|
+
var createAuthApi = (apiConfig) => {
|
|
252
|
+
return {
|
|
253
|
+
/**
|
|
254
|
+
* Create a guest session (anonymous user)
|
|
255
|
+
* POST /auth/session
|
|
256
|
+
*/
|
|
257
|
+
async session(options) {
|
|
258
|
+
return apiConfig.httpClient.post("/v1/auth/session", {}, options);
|
|
254
259
|
},
|
|
255
|
-
|
|
256
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Sign in anonymously (creates guest session if not already authenticated)
|
|
262
|
+
* Following Firebase/Supabase pattern - idempotent, safe to call multiple times
|
|
263
|
+
*/
|
|
264
|
+
async signInAnonymously(options) {
|
|
265
|
+
const tokens = await apiConfig.getToken();
|
|
266
|
+
if (tokens?.accessToken) {
|
|
267
|
+
return tokens;
|
|
268
|
+
}
|
|
269
|
+
const result = await apiConfig.httpClient.post("/v1/auth/session", {}, options);
|
|
270
|
+
if (result?.accessToken) {
|
|
271
|
+
apiConfig.setToken({ ...result, isGuest: true });
|
|
272
|
+
}
|
|
273
|
+
return result;
|
|
257
274
|
},
|
|
258
|
-
|
|
259
|
-
|
|
275
|
+
/**
|
|
276
|
+
* Check if current user is a guest (anonymous)
|
|
277
|
+
* Guest emails follow pattern: guest+uuid@arky.io
|
|
278
|
+
*/
|
|
279
|
+
async isGuest() {
|
|
280
|
+
const tokens = await apiConfig.getToken();
|
|
281
|
+
if (!tokens?.accessToken) return true;
|
|
282
|
+
const email = tokens.email || "";
|
|
283
|
+
return !email || email.startsWith("guest+");
|
|
260
284
|
},
|
|
261
|
-
|
|
262
|
-
|
|
285
|
+
// ==================== PLATFORM AUTH (Admin) ====================
|
|
286
|
+
/**
|
|
287
|
+
* Request platform auth code (Arky admin)
|
|
288
|
+
* POST /auth/code
|
|
289
|
+
*/
|
|
290
|
+
async code(params, options) {
|
|
291
|
+
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
263
292
|
},
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
293
|
+
/**
|
|
294
|
+
* Verify platform auth code - automatically sets token on success
|
|
295
|
+
* POST /auth/verify
|
|
296
|
+
*/
|
|
297
|
+
async verify(params, options) {
|
|
298
|
+
const result = await apiConfig.httpClient.post("/v1/auth/verify", params, options);
|
|
299
|
+
if (result?.accessToken) {
|
|
300
|
+
apiConfig.setToken({ ...result, email: params.email, isGuest: false });
|
|
301
|
+
}
|
|
302
|
+
return result;
|
|
269
303
|
},
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
304
|
+
/**
|
|
305
|
+
* Refresh access token
|
|
306
|
+
* POST /auth/refresh
|
|
307
|
+
*/
|
|
308
|
+
async refresh(params, options) {
|
|
309
|
+
return apiConfig.httpClient.post("/v1/auth/refresh", params, options);
|
|
273
310
|
},
|
|
274
|
-
|
|
275
|
-
|
|
311
|
+
// ==================== BUSINESS AUTH (arky.io, delfin, korvus) ====================
|
|
312
|
+
/**
|
|
313
|
+
* Request business auth code
|
|
314
|
+
* POST /businesses/{businessId}/auth/code
|
|
315
|
+
*/
|
|
316
|
+
async businessCode(businessId, params, options) {
|
|
317
|
+
return apiConfig.httpClient.post(`/v1/businesses/${businessId}/auth/code`, params, options);
|
|
276
318
|
},
|
|
277
|
-
|
|
278
|
-
|
|
319
|
+
/**
|
|
320
|
+
* Verify business auth code - automatically sets token on success
|
|
321
|
+
* POST /businesses/{businessId}/auth/verify
|
|
322
|
+
*/
|
|
323
|
+
async businessVerify(businessId, params, options) {
|
|
324
|
+
const result = await apiConfig.httpClient.post(`/v1/businesses/${businessId}/auth/verify`, params, options);
|
|
325
|
+
if (result?.accessToken) {
|
|
326
|
+
apiConfig.setToken({ ...result, email: params.email, isGuest: false });
|
|
327
|
+
}
|
|
328
|
+
return result;
|
|
279
329
|
},
|
|
280
|
-
|
|
281
|
-
|
|
330
|
+
// ==================== DEPRECATED (for backwards compatibility) ====================
|
|
331
|
+
/**
|
|
332
|
+
* @deprecated Use code() instead
|
|
333
|
+
*/
|
|
334
|
+
async magicLink(params, options) {
|
|
335
|
+
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
282
336
|
}
|
|
283
337
|
};
|
|
284
338
|
};
|
|
@@ -309,7 +363,10 @@ var createBusinessApi = (apiConfig) => {
|
|
|
309
363
|
);
|
|
310
364
|
},
|
|
311
365
|
async getBusinesses(params, options) {
|
|
312
|
-
return apiConfig.httpClient.get(`/v1/businesses`,
|
|
366
|
+
return apiConfig.httpClient.get(`/v1/businesses`, {
|
|
367
|
+
...options,
|
|
368
|
+
params
|
|
369
|
+
});
|
|
313
370
|
},
|
|
314
371
|
async getBusinessParents(params, options) {
|
|
315
372
|
return apiConfig.httpClient.get(
|
|
@@ -369,22 +426,20 @@ var createBusinessApi = (apiConfig) => {
|
|
|
369
426
|
);
|
|
370
427
|
},
|
|
371
428
|
async getBusinessMedia(params, options) {
|
|
429
|
+
const queryParams = {
|
|
430
|
+
limit: params.limit
|
|
431
|
+
};
|
|
432
|
+
if (params.cursor) queryParams.cursor = params.cursor;
|
|
433
|
+
if (params.ids && params.ids.length > 0) queryParams.ids = params.ids.join(",");
|
|
434
|
+
if (params.query) queryParams.query = params.query;
|
|
435
|
+
if (params.mimeType) queryParams.mimeType = params.mimeType;
|
|
436
|
+
if (params.sortField) queryParams.sortField = params.sortField;
|
|
437
|
+
if (params.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
372
438
|
return apiConfig.httpClient.get(`/v1/businesses/${params.id}/media`, {
|
|
373
439
|
...options,
|
|
374
|
-
params:
|
|
375
|
-
cursor: params.cursor,
|
|
376
|
-
limit: params.limit || 20
|
|
377
|
-
}
|
|
440
|
+
params: queryParams
|
|
378
441
|
});
|
|
379
442
|
},
|
|
380
|
-
async setProviderSchedule(params, options) {
|
|
381
|
-
const { id, ...payload } = params;
|
|
382
|
-
return apiConfig.httpClient.put(
|
|
383
|
-
`/v1/businesses/${id}/schedules`,
|
|
384
|
-
payload,
|
|
385
|
-
options
|
|
386
|
-
);
|
|
387
|
-
},
|
|
388
443
|
async processRefund(params, options) {
|
|
389
444
|
const { id, ...payload } = params;
|
|
390
445
|
return apiConfig.httpClient.post(
|
|
@@ -400,11 +455,12 @@ var createBusinessApi = (apiConfig) => {
|
|
|
400
455
|
var createMediaApi = (apiConfig) => {
|
|
401
456
|
return {
|
|
402
457
|
async uploadBusinessMedia(params, options) {
|
|
403
|
-
const { files = [], urls = [] } = params;
|
|
404
|
-
const
|
|
458
|
+
const { businessId, files = [], urls = [] } = params;
|
|
459
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
460
|
+
const url = `${apiConfig.baseUrl}/v1/businesses/${targetBusinessId}/media`;
|
|
405
461
|
const formData = new FormData();
|
|
406
462
|
files.forEach((file) => formData.append("files", file));
|
|
407
|
-
urls.forEach((url2) => formData.append("
|
|
463
|
+
urls.forEach((url2) => formData.append("urls", url2));
|
|
408
464
|
const tokens = await apiConfig.getToken();
|
|
409
465
|
const response = await fetch(url, {
|
|
410
466
|
method: "POST",
|
|
@@ -426,12 +482,23 @@ var createMediaApi = (apiConfig) => {
|
|
|
426
482
|
);
|
|
427
483
|
},
|
|
428
484
|
async getBusinessMedia(params, options) {
|
|
429
|
-
const { cursor
|
|
430
|
-
const
|
|
431
|
-
const
|
|
485
|
+
const { businessId, cursor, limit, ids, query, mimeType, sortField, sortDirection } = params;
|
|
486
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
487
|
+
const url = `${apiConfig.baseUrl}/v1/businesses/${targetBusinessId}/media`;
|
|
488
|
+
const queryParams = { limit: String(limit) };
|
|
432
489
|
if (cursor) queryParams.cursor = cursor;
|
|
490
|
+
if (ids && ids.length > 0) queryParams.ids = ids.join(",");
|
|
491
|
+
if (query) queryParams.query = query;
|
|
492
|
+
if (mimeType) queryParams.mimeType = mimeType;
|
|
493
|
+
if (sortField) queryParams.sortField = sortField;
|
|
494
|
+
if (sortDirection) queryParams.sortDirection = sortDirection;
|
|
433
495
|
const queryString = new URLSearchParams(queryParams).toString();
|
|
434
|
-
const
|
|
496
|
+
const tokens = await apiConfig.getToken();
|
|
497
|
+
const response = await fetch(`${url}?${queryString}`, {
|
|
498
|
+
headers: {
|
|
499
|
+
Authorization: `Bearer ${tokens.accessToken}`
|
|
500
|
+
}
|
|
501
|
+
});
|
|
435
502
|
if (!response.ok) {
|
|
436
503
|
const errorData = await response.json().catch(() => null);
|
|
437
504
|
throw new Error(errorData?.message || "Failed to fetch media");
|
|
@@ -439,9 +506,10 @@ var createMediaApi = (apiConfig) => {
|
|
|
439
506
|
return await response.json();
|
|
440
507
|
},
|
|
441
508
|
async updateMedia(params, options) {
|
|
442
|
-
const { mediaId, ...updateData } = params;
|
|
509
|
+
const { mediaId, businessId, ...updateData } = params;
|
|
510
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
443
511
|
return apiConfig.httpClient.put(
|
|
444
|
-
`/v1/businesses/${
|
|
512
|
+
`/v1/businesses/${targetBusinessId}/media/${mediaId}`,
|
|
445
513
|
updateData,
|
|
446
514
|
options
|
|
447
515
|
);
|
|
@@ -449,37 +517,6 @@ var createMediaApi = (apiConfig) => {
|
|
|
449
517
|
};
|
|
450
518
|
};
|
|
451
519
|
|
|
452
|
-
// src/api/role.ts
|
|
453
|
-
var createRoleApi = (apiConfig) => {
|
|
454
|
-
return {
|
|
455
|
-
async createRole(params, options) {
|
|
456
|
-
return apiConfig.httpClient.post(`/v1/roles`, params, options);
|
|
457
|
-
},
|
|
458
|
-
async updateRole(params, options) {
|
|
459
|
-
return apiConfig.httpClient.put(
|
|
460
|
-
`/v1/roles/${params.id}`,
|
|
461
|
-
params,
|
|
462
|
-
options
|
|
463
|
-
);
|
|
464
|
-
},
|
|
465
|
-
async deleteRole(params, options) {
|
|
466
|
-
return apiConfig.httpClient.delete(`/v1/roles/${params.id}`, options);
|
|
467
|
-
},
|
|
468
|
-
async getRole(params, options) {
|
|
469
|
-
return apiConfig.httpClient.get(`/v1/roles/${params.id}`, options);
|
|
470
|
-
},
|
|
471
|
-
async getRoles(params, options) {
|
|
472
|
-
return apiConfig.httpClient.get(`/v1/roles`, {
|
|
473
|
-
...options,
|
|
474
|
-
params: {
|
|
475
|
-
action: params.action,
|
|
476
|
-
businessId: apiConfig.businessId
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
};
|
|
482
|
-
|
|
483
520
|
// src/api/notification.ts
|
|
484
521
|
var createNotificationApi = (apiConfig) => {
|
|
485
522
|
return {
|
|
@@ -548,21 +585,6 @@ var createAnalyticsApi = (apiConfig) => {
|
|
|
548
585
|
};
|
|
549
586
|
};
|
|
550
587
|
|
|
551
|
-
// src/utils/slug.ts
|
|
552
|
-
var isUuid = (str) => {
|
|
553
|
-
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
554
|
-
return uuidRegex.test(str);
|
|
555
|
-
};
|
|
556
|
-
var formatIdOrSlug = (id, apiConfig) => {
|
|
557
|
-
if (isUuid(id)) {
|
|
558
|
-
return id;
|
|
559
|
-
}
|
|
560
|
-
if (id.includes(":")) {
|
|
561
|
-
return id;
|
|
562
|
-
}
|
|
563
|
-
return `${apiConfig.businessId}:${apiConfig.locale}:${id}`;
|
|
564
|
-
};
|
|
565
|
-
|
|
566
588
|
// src/utils/blocks.ts
|
|
567
589
|
function getBlockLabel(block, locale = "en") {
|
|
568
590
|
if (!block) return "";
|
|
@@ -662,7 +684,7 @@ function unwrapBlock(block, locale) {
|
|
|
662
684
|
return parsed;
|
|
663
685
|
});
|
|
664
686
|
}
|
|
665
|
-
const isLocalized = block.type === "
|
|
687
|
+
const isLocalized = block.type === "LOCALIZED_TEXT" || block.type === "MARKDOWN";
|
|
666
688
|
const isList = block.properties?.ui === "list" || (block.properties?.maxValues ?? 1) > 1 || block.value.length > 1;
|
|
667
689
|
if (isList) {
|
|
668
690
|
return isLocalized ? block.value.map((v) => v[locale] || v["en"]) : [...block.value];
|
|
@@ -674,7 +696,13 @@ var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
|
674
696
|
return [];
|
|
675
697
|
}
|
|
676
698
|
const values = getBlockValues(entry, blockKey);
|
|
699
|
+
if (!values || !Array.isArray(values)) {
|
|
700
|
+
return [];
|
|
701
|
+
}
|
|
677
702
|
const parsed = values.map((obj) => {
|
|
703
|
+
if (!obj || !obj.value || !Array.isArray(obj.value)) {
|
|
704
|
+
return {};
|
|
705
|
+
}
|
|
678
706
|
const res = obj.value.reduce((acc, current) => {
|
|
679
707
|
acc[current.key] = unwrapBlock(current, locale);
|
|
680
708
|
return acc;
|
|
@@ -685,13 +713,16 @@ var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
|
685
713
|
};
|
|
686
714
|
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
687
715
|
if (!entry) {
|
|
688
|
-
return
|
|
716
|
+
return {};
|
|
689
717
|
}
|
|
690
718
|
const values = getBlockValues(entry, blockKey);
|
|
719
|
+
if (!values || !Array.isArray(values)) {
|
|
720
|
+
return {};
|
|
721
|
+
}
|
|
691
722
|
return values.reduce((acc, current) => {
|
|
692
723
|
acc[current.key] = unwrapBlock(current, locale);
|
|
693
724
|
return acc;
|
|
694
|
-
});
|
|
725
|
+
}, {});
|
|
695
726
|
};
|
|
696
727
|
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
697
728
|
if (!imageBlock) return null;
|
|
@@ -724,31 +755,45 @@ var getImageUrl = (imageBlock, isBlock = true) => {
|
|
|
724
755
|
// src/api/cms.ts
|
|
725
756
|
var createCmsApi = (apiConfig) => {
|
|
726
757
|
return {
|
|
727
|
-
|
|
728
|
-
|
|
758
|
+
async createNode(params, options) {
|
|
759
|
+
const { businessId, ...payload } = params;
|
|
760
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
729
761
|
return apiConfig.httpClient.post(
|
|
730
|
-
`/v1/businesses/${
|
|
731
|
-
|
|
762
|
+
`/v1/businesses/${targetBusinessId}/nodes`,
|
|
763
|
+
payload,
|
|
732
764
|
options
|
|
733
765
|
);
|
|
734
766
|
},
|
|
735
|
-
async
|
|
767
|
+
async updateNode(params, options) {
|
|
768
|
+
const { businessId, ...payload } = params;
|
|
769
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
736
770
|
return apiConfig.httpClient.put(
|
|
737
|
-
`/v1/businesses/${
|
|
738
|
-
|
|
771
|
+
`/v1/businesses/${targetBusinessId}/nodes/${params.id}`,
|
|
772
|
+
payload,
|
|
739
773
|
options
|
|
740
774
|
);
|
|
741
775
|
},
|
|
742
|
-
async
|
|
776
|
+
async deleteNode(params, options) {
|
|
777
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
743
778
|
return apiConfig.httpClient.delete(
|
|
744
|
-
`/v1/businesses/${
|
|
779
|
+
`/v1/businesses/${targetBusinessId}/nodes/${params.id}`,
|
|
745
780
|
options
|
|
746
781
|
);
|
|
747
782
|
},
|
|
748
|
-
async
|
|
749
|
-
const
|
|
783
|
+
async getNode(params, options) {
|
|
784
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
785
|
+
let identifier;
|
|
786
|
+
if (params.id) {
|
|
787
|
+
identifier = params.id;
|
|
788
|
+
} else if (params.slug) {
|
|
789
|
+
identifier = `${targetBusinessId}:${apiConfig.locale}:${params.slug}`;
|
|
790
|
+
} else if (params.key) {
|
|
791
|
+
identifier = `${targetBusinessId}:${params.key}`;
|
|
792
|
+
} else {
|
|
793
|
+
throw new Error("GetNodeParams requires id, slug, or key");
|
|
794
|
+
}
|
|
750
795
|
const response = await apiConfig.httpClient.get(
|
|
751
|
-
`/v1/businesses/${
|
|
796
|
+
`/v1/businesses/${targetBusinessId}/nodes/${identifier}`,
|
|
752
797
|
options
|
|
753
798
|
);
|
|
754
799
|
return {
|
|
@@ -765,86 +810,38 @@ var createCmsApi = (apiConfig) => {
|
|
|
765
810
|
}
|
|
766
811
|
};
|
|
767
812
|
},
|
|
768
|
-
async
|
|
813
|
+
async getNodes(params, options) {
|
|
814
|
+
const { businessId, ...queryParams } = params;
|
|
815
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
769
816
|
return apiConfig.httpClient.get(
|
|
770
|
-
`/v1/businesses/${
|
|
817
|
+
`/v1/businesses/${targetBusinessId}/nodes`,
|
|
771
818
|
{
|
|
772
819
|
...options,
|
|
773
|
-
params
|
|
820
|
+
params: queryParams
|
|
774
821
|
}
|
|
775
822
|
);
|
|
776
823
|
},
|
|
777
|
-
async
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
params,
|
|
781
|
-
options
|
|
782
|
-
);
|
|
783
|
-
},
|
|
784
|
-
// ===== ENTRIES =====
|
|
785
|
-
async getCollectionEntries(params, options) {
|
|
786
|
-
const { collectionId, ...queryParams } = params;
|
|
824
|
+
async getNodeChildren(params, options) {
|
|
825
|
+
const { id, businessId, ...queryParams } = params;
|
|
826
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
787
827
|
return apiConfig.httpClient.get(
|
|
788
|
-
`/v1/businesses/${
|
|
828
|
+
`/v1/businesses/${targetBusinessId}/nodes/${id}/children`,
|
|
789
829
|
{
|
|
790
830
|
...options,
|
|
791
831
|
params: queryParams
|
|
792
832
|
}
|
|
793
833
|
);
|
|
794
834
|
},
|
|
795
|
-
async
|
|
796
|
-
const { collectionId, ...payload } = params;
|
|
797
|
-
return apiConfig.httpClient.post(
|
|
798
|
-
`/v1/businesses/${apiConfig.businessId}/collections/${collectionId}/entries`,
|
|
799
|
-
{ ...payload, collectionId },
|
|
800
|
-
options
|
|
801
|
-
);
|
|
802
|
-
},
|
|
803
|
-
async updateCollectionEntry(params, options) {
|
|
804
|
-
const { collectionId, id, ...payload } = params;
|
|
805
|
-
return apiConfig.httpClient.put(
|
|
806
|
-
`/v1/businesses/${apiConfig.businessId}/collections/${collectionId}/entries/${id}`,
|
|
807
|
-
{ ...payload, collectionId },
|
|
808
|
-
options
|
|
809
|
-
);
|
|
810
|
-
},
|
|
811
|
-
async deleteCollectionEntry(params, options) {
|
|
812
|
-
return apiConfig.httpClient.delete(
|
|
813
|
-
`/v1/businesses/${apiConfig.businessId}/collections/${params.collectionId}/entries/${params.id}`,
|
|
814
|
-
options
|
|
815
|
-
);
|
|
816
|
-
},
|
|
817
|
-
async getCollectionEntry(params, options) {
|
|
818
|
-
const formattedId = formatIdOrSlug(params.id, apiConfig);
|
|
819
|
-
return apiConfig.httpClient.get(
|
|
820
|
-
`/v1/businesses/${apiConfig.businessId}/collections/${params.collectionId}/entries/${formattedId}`,
|
|
821
|
-
options
|
|
822
|
-
);
|
|
823
|
-
},
|
|
824
|
-
async sendEntry(params, options) {
|
|
825
|
-
const { collectionId, entryId, scheduledAt } = params;
|
|
835
|
+
async generateBlocks(params, options) {
|
|
826
836
|
return apiConfig.httpClient.post(
|
|
827
|
-
`/v1/businesses/${apiConfig.businessId}/
|
|
828
|
-
|
|
829
|
-
businessId: apiConfig.businessId,
|
|
830
|
-
entryId,
|
|
831
|
-
scheduledAt: scheduledAt ?? Math.floor(Date.now() / 1e3)
|
|
832
|
-
},
|
|
837
|
+
`/v1/businesses/${apiConfig.businessId}/nodes/blocks/generate`,
|
|
838
|
+
params,
|
|
833
839
|
options
|
|
834
840
|
);
|
|
835
841
|
},
|
|
836
|
-
// ===== VARIABLES / METADATA =====
|
|
837
842
|
async getVariableMetadata(params, options) {
|
|
838
843
|
return apiConfig.httpClient.get(
|
|
839
|
-
`/v1/
|
|
840
|
-
options
|
|
841
|
-
);
|
|
842
|
-
},
|
|
843
|
-
// ===== COLLECTION SUBSCRIPTIONS =====
|
|
844
|
-
async getCollectionSubscribers(params, options) {
|
|
845
|
-
const formattedId = formatIdOrSlug(params.id, apiConfig);
|
|
846
|
-
return apiConfig.httpClient.get(
|
|
847
|
-
`/v1/businesses/${apiConfig.businessId}/collections/${formattedId}/subscribers`,
|
|
844
|
+
`/v1/businesses/${apiConfig.businessId}/nodes/types/${params.nodeType}/variables`,
|
|
848
845
|
options
|
|
849
846
|
);
|
|
850
847
|
}
|
|
@@ -876,22 +873,18 @@ var createEshopApi = (apiConfig) => {
|
|
|
876
873
|
);
|
|
877
874
|
},
|
|
878
875
|
async getProduct(params, options) {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
876
|
+
let identifier;
|
|
877
|
+
if (params.id) {
|
|
878
|
+
identifier = params.id;
|
|
879
|
+
} else if (params.slug) {
|
|
880
|
+
identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
|
|
881
|
+
} else {
|
|
882
|
+
throw new Error("GetProductParams requires id or slug");
|
|
883
|
+
}
|
|
884
|
+
return apiConfig.httpClient.get(
|
|
885
|
+
`/v1/businesses/${apiConfig.businessId}/products/${identifier}`,
|
|
882
886
|
options
|
|
883
887
|
);
|
|
884
|
-
return {
|
|
885
|
-
...response,
|
|
886
|
-
getName() {
|
|
887
|
-
const locale = apiConfig.locale;
|
|
888
|
-
return response.name?.[locale] || response.name?.en || response.name || "";
|
|
889
|
-
},
|
|
890
|
-
getDescription() {
|
|
891
|
-
const locale = apiConfig.locale;
|
|
892
|
-
return response.description?.[locale] || response.description?.en || response.description || "";
|
|
893
|
-
}
|
|
894
|
-
};
|
|
895
888
|
},
|
|
896
889
|
async getProducts(params, options) {
|
|
897
890
|
return apiConfig.httpClient.get(
|
|
@@ -912,7 +905,7 @@ var createEshopApi = (apiConfig) => {
|
|
|
912
905
|
},
|
|
913
906
|
async updateOrder(params, options) {
|
|
914
907
|
return apiConfig.httpClient.put(
|
|
915
|
-
`/v1/businesses/${apiConfig.businessId}/orders
|
|
908
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${params.id}`,
|
|
916
909
|
params,
|
|
917
910
|
options
|
|
918
911
|
);
|
|
@@ -932,42 +925,31 @@ var createEshopApi = (apiConfig) => {
|
|
|
932
925
|
}
|
|
933
926
|
);
|
|
934
927
|
},
|
|
935
|
-
async updateOrderStatus(params, options) {
|
|
936
|
-
return apiConfig.httpClient.put(
|
|
937
|
-
`/v1/businesses/${apiConfig.businessId}/orders/${params.id}/status`,
|
|
938
|
-
params,
|
|
939
|
-
options
|
|
940
|
-
);
|
|
941
|
-
},
|
|
942
|
-
async updateOrderPaymentStatus(params, options) {
|
|
943
|
-
return apiConfig.httpClient.put(
|
|
944
|
-
`/v1/businesses/${apiConfig.businessId}/orders/${params.id}/payment-status`,
|
|
945
|
-
params,
|
|
946
|
-
options
|
|
947
|
-
);
|
|
948
|
-
},
|
|
949
928
|
// ===== PAYMENTS =====
|
|
950
929
|
async getQuote(params, options) {
|
|
951
|
-
const lines = params.items.map((item) => ({
|
|
952
|
-
type: "PRODUCT_VARIANT",
|
|
953
|
-
productId: item.productId,
|
|
954
|
-
variantId: item.variantId,
|
|
955
|
-
quantity: item.quantity
|
|
956
|
-
}));
|
|
957
|
-
const { items, ...rest } = params;
|
|
958
930
|
const payload = {
|
|
959
|
-
businessId: apiConfig.businessId,
|
|
960
931
|
market: apiConfig.market,
|
|
961
|
-
|
|
962
|
-
|
|
932
|
+
items: params.items,
|
|
933
|
+
blocks: params.blocks || [],
|
|
934
|
+
paymentMethodId: params.paymentMethodId,
|
|
935
|
+
shippingMethodId: params.shippingMethodId,
|
|
936
|
+
promoCode: params.promoCode
|
|
963
937
|
};
|
|
964
|
-
return apiConfig.httpClient.post(
|
|
938
|
+
return apiConfig.httpClient.post(
|
|
939
|
+
`/v1/businesses/${apiConfig.businessId}/orders/quote`,
|
|
940
|
+
payload,
|
|
941
|
+
options
|
|
942
|
+
);
|
|
965
943
|
},
|
|
966
944
|
async checkout(params, options) {
|
|
967
945
|
const payload = {
|
|
968
946
|
businessId: apiConfig.businessId,
|
|
969
947
|
market: apiConfig.market,
|
|
970
|
-
|
|
948
|
+
items: params.items,
|
|
949
|
+
blocks: params.blocks || [],
|
|
950
|
+
paymentMethodId: params.paymentMethodId,
|
|
951
|
+
shippingMethodId: params.shippingMethodId,
|
|
952
|
+
promoCodeId: params.promoCodeId
|
|
971
953
|
};
|
|
972
954
|
return apiConfig.httpClient.post(
|
|
973
955
|
`/v1/businesses/${apiConfig.businessId}/orders/checkout`,
|
|
@@ -997,129 +979,131 @@ var createReservationApi = (apiConfig) => {
|
|
|
997
979
|
},
|
|
998
980
|
// ===== RESERVATIONS =====
|
|
999
981
|
async createReservation(params, options) {
|
|
982
|
+
const { businessId, ...rest } = params;
|
|
983
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1000
984
|
const payload = {
|
|
1001
|
-
businessId: apiConfig.businessId,
|
|
1002
985
|
market: apiConfig.market,
|
|
1003
|
-
...
|
|
986
|
+
...rest
|
|
1004
987
|
};
|
|
1005
|
-
return apiConfig.httpClient.post(
|
|
988
|
+
return apiConfig.httpClient.post(
|
|
989
|
+
`/v1/businesses/${targetBusinessId}/reservations`,
|
|
990
|
+
payload,
|
|
991
|
+
options
|
|
992
|
+
);
|
|
1006
993
|
},
|
|
1007
994
|
async updateReservation(params, options) {
|
|
1008
995
|
const { id, ...payload } = params;
|
|
1009
996
|
return apiConfig.httpClient.put(
|
|
1010
|
-
`/v1/reservations/${id}`,
|
|
997
|
+
`/v1/businesses/${apiConfig.businessId}/reservations/${id}`,
|
|
1011
998
|
payload,
|
|
1012
999
|
options
|
|
1013
1000
|
);
|
|
1014
1001
|
},
|
|
1015
1002
|
async checkout(params, options) {
|
|
1016
|
-
const
|
|
1003
|
+
const { businessId, ...rest } = params || {};
|
|
1004
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1005
|
+
const items = rest?.items || cart.map((s) => ({
|
|
1017
1006
|
serviceId: s.serviceId,
|
|
1018
1007
|
providerId: s.providerId,
|
|
1019
1008
|
from: s.from,
|
|
1020
1009
|
to: s.to
|
|
1021
1010
|
}));
|
|
1022
1011
|
const payload = {
|
|
1023
|
-
businessId: apiConfig.businessId,
|
|
1024
1012
|
market: apiConfig.market,
|
|
1025
|
-
...
|
|
1013
|
+
...rest,
|
|
1026
1014
|
items
|
|
1027
1015
|
};
|
|
1028
1016
|
return apiConfig.httpClient.post(
|
|
1029
|
-
`/v1/reservations/checkout`,
|
|
1017
|
+
`/v1/businesses/${targetBusinessId}/reservations/checkout`,
|
|
1030
1018
|
payload,
|
|
1031
1019
|
options
|
|
1032
1020
|
);
|
|
1033
1021
|
},
|
|
1034
1022
|
async getReservation(params, options) {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
params
|
|
1038
|
-
|
|
1023
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1024
|
+
return apiConfig.httpClient.get(
|
|
1025
|
+
`/v1/businesses/${targetBusinessId}/reservations/${params.id}`,
|
|
1026
|
+
options
|
|
1027
|
+
);
|
|
1039
1028
|
},
|
|
1040
1029
|
async searchReservations(params, options) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1030
|
+
const { businessId, ...queryParams } = params;
|
|
1031
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1032
|
+
return apiConfig.httpClient.get(
|
|
1033
|
+
`/v1/businesses/${targetBusinessId}/reservations`,
|
|
1034
|
+
{
|
|
1035
|
+
...options,
|
|
1036
|
+
params: queryParams
|
|
1046
1037
|
}
|
|
1047
|
-
|
|
1048
|
-
},
|
|
1049
|
-
async searchMyReservations(params, options) {
|
|
1050
|
-
return apiConfig.httpClient.get(`/v1/reservations`, {
|
|
1051
|
-
...options,
|
|
1052
|
-
params
|
|
1053
|
-
});
|
|
1038
|
+
);
|
|
1054
1039
|
},
|
|
1055
1040
|
// ===== QUOTES =====
|
|
1056
1041
|
async getQuote(params, options) {
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1059
|
-
serviceId: item.serviceId,
|
|
1060
|
-
quantity: 1
|
|
1061
|
-
}));
|
|
1062
|
-
const { items, ...rest } = params;
|
|
1042
|
+
const { businessId, ...rest } = params;
|
|
1043
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1063
1044
|
const payload = {
|
|
1064
|
-
businessId: apiConfig.businessId,
|
|
1065
1045
|
market: apiConfig.market,
|
|
1066
|
-
lines,
|
|
1067
1046
|
...rest
|
|
1068
1047
|
};
|
|
1069
|
-
return apiConfig.httpClient.post(
|
|
1048
|
+
return apiConfig.httpClient.post(
|
|
1049
|
+
`/v1/businesses/${targetBusinessId}/reservations/quote`,
|
|
1050
|
+
payload,
|
|
1051
|
+
options
|
|
1052
|
+
);
|
|
1070
1053
|
},
|
|
1071
1054
|
// ===== SERVICES =====
|
|
1072
1055
|
async createService(params, options) {
|
|
1056
|
+
const { businessId, ...payload } = params;
|
|
1057
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1073
1058
|
return apiConfig.httpClient.post(
|
|
1074
|
-
`/v1/businesses/${
|
|
1075
|
-
|
|
1059
|
+
`/v1/businesses/${targetBusinessId}/services`,
|
|
1060
|
+
payload,
|
|
1076
1061
|
options
|
|
1077
1062
|
);
|
|
1078
1063
|
},
|
|
1079
1064
|
async updateService(params, options) {
|
|
1065
|
+
const { businessId, ...payload } = params;
|
|
1066
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1080
1067
|
return apiConfig.httpClient.put(
|
|
1081
|
-
`/v1/businesses/${
|
|
1082
|
-
|
|
1068
|
+
`/v1/businesses/${targetBusinessId}/services/${params.id}`,
|
|
1069
|
+
payload,
|
|
1083
1070
|
options
|
|
1084
1071
|
);
|
|
1085
1072
|
},
|
|
1086
1073
|
async deleteService(params, options) {
|
|
1074
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1087
1075
|
return apiConfig.httpClient.delete(
|
|
1088
|
-
`/v1/businesses/${
|
|
1076
|
+
`/v1/businesses/${targetBusinessId}/services/${params.id}`,
|
|
1089
1077
|
options
|
|
1090
1078
|
);
|
|
1091
1079
|
},
|
|
1092
|
-
async
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1080
|
+
async bulkSchedule(params, options) {
|
|
1081
|
+
return apiConfig.httpClient.post(
|
|
1082
|
+
`/v1/businesses/${apiConfig.businessId}/services/bulk-schedule`,
|
|
1083
|
+
params,
|
|
1096
1084
|
options
|
|
1097
1085
|
);
|
|
1098
|
-
return {
|
|
1099
|
-
...response,
|
|
1100
|
-
getName() {
|
|
1101
|
-
const locale = apiConfig.locale;
|
|
1102
|
-
return response.name?.[locale] || response.name?.en || response.name || "";
|
|
1103
|
-
},
|
|
1104
|
-
getDescription() {
|
|
1105
|
-
const locale = apiConfig.locale;
|
|
1106
|
-
return response.description?.[locale] || response.description?.en || response.description || "";
|
|
1107
|
-
}
|
|
1108
|
-
};
|
|
1109
1086
|
},
|
|
1110
|
-
async
|
|
1087
|
+
async getService(params, options) {
|
|
1088
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1089
|
+
let identifier;
|
|
1090
|
+
if (params.id) {
|
|
1091
|
+
identifier = params.id;
|
|
1092
|
+
} else if (params.slug) {
|
|
1093
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
1094
|
+
} else {
|
|
1095
|
+
throw new Error("GetServiceParams requires id or slug");
|
|
1096
|
+
}
|
|
1111
1097
|
return apiConfig.httpClient.get(
|
|
1112
|
-
`/v1/businesses/${
|
|
1113
|
-
|
|
1114
|
-
...options,
|
|
1115
|
-
params
|
|
1116
|
-
}
|
|
1098
|
+
`/v1/businesses/${businessId}/services/${identifier}`,
|
|
1099
|
+
options
|
|
1117
1100
|
);
|
|
1118
1101
|
},
|
|
1119
|
-
async
|
|
1120
|
-
const {
|
|
1102
|
+
async getServices(params, options) {
|
|
1103
|
+
const { businessId, ...queryParams } = params;
|
|
1104
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1121
1105
|
return apiConfig.httpClient.get(
|
|
1122
|
-
`/v1/businesses/${
|
|
1106
|
+
`/v1/businesses/${targetBusinessId}/services`,
|
|
1123
1107
|
{
|
|
1124
1108
|
...options,
|
|
1125
1109
|
params: queryParams
|
|
@@ -1128,37 +1112,53 @@ var createReservationApi = (apiConfig) => {
|
|
|
1128
1112
|
},
|
|
1129
1113
|
// ===== PROVIDERS =====
|
|
1130
1114
|
async createProvider(params, options) {
|
|
1115
|
+
const { businessId, ...payload } = params;
|
|
1116
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1131
1117
|
return apiConfig.httpClient.post(
|
|
1132
|
-
`/v1/businesses/${
|
|
1133
|
-
|
|
1118
|
+
`/v1/businesses/${targetBusinessId}/providers`,
|
|
1119
|
+
payload,
|
|
1134
1120
|
options
|
|
1135
1121
|
);
|
|
1136
1122
|
},
|
|
1137
1123
|
async updateProvider(params, options) {
|
|
1124
|
+
const { businessId, ...payload } = params;
|
|
1125
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1138
1126
|
return apiConfig.httpClient.put(
|
|
1139
|
-
`/v1/businesses/${
|
|
1140
|
-
|
|
1127
|
+
`/v1/businesses/${targetBusinessId}/providers/${params.id}`,
|
|
1128
|
+
payload,
|
|
1141
1129
|
options
|
|
1142
1130
|
);
|
|
1143
1131
|
},
|
|
1144
1132
|
async deleteProvider(params, options) {
|
|
1133
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1145
1134
|
return apiConfig.httpClient.delete(
|
|
1146
|
-
`/v1/businesses/${
|
|
1135
|
+
`/v1/businesses/${targetBusinessId}/providers/${params.id}`,
|
|
1147
1136
|
options
|
|
1148
1137
|
);
|
|
1149
1138
|
},
|
|
1150
1139
|
async getProvider(params, options) {
|
|
1140
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1141
|
+
let identifier;
|
|
1142
|
+
if (params.id) {
|
|
1143
|
+
identifier = params.id;
|
|
1144
|
+
} else if (params.slug) {
|
|
1145
|
+
identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
|
|
1146
|
+
} else {
|
|
1147
|
+
throw new Error("GetProviderParams requires id or slug");
|
|
1148
|
+
}
|
|
1151
1149
|
return apiConfig.httpClient.get(
|
|
1152
|
-
`/v1/businesses/${
|
|
1150
|
+
`/v1/businesses/${businessId}/providers/${identifier}`,
|
|
1153
1151
|
options
|
|
1154
1152
|
);
|
|
1155
1153
|
},
|
|
1156
1154
|
async getProviders(params, options) {
|
|
1155
|
+
const { businessId, ...queryParams } = params;
|
|
1156
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1157
1157
|
return apiConfig.httpClient.get(
|
|
1158
|
-
`/v1/businesses/${
|
|
1158
|
+
`/v1/businesses/${targetBusinessId}/providers`,
|
|
1159
1159
|
{
|
|
1160
1160
|
...options,
|
|
1161
|
-
params
|
|
1161
|
+
params: queryParams
|
|
1162
1162
|
}
|
|
1163
1163
|
);
|
|
1164
1164
|
},
|
|
@@ -1184,7 +1184,8 @@ var createDatabaseApi = (apiConfig) => {
|
|
|
1184
1184
|
{
|
|
1185
1185
|
...options,
|
|
1186
1186
|
params: {
|
|
1187
|
-
key: params.key
|
|
1187
|
+
key: params.key,
|
|
1188
|
+
limit: params.limit || 200
|
|
1188
1189
|
}
|
|
1189
1190
|
}
|
|
1190
1191
|
);
|
|
@@ -1214,146 +1215,230 @@ var createDatabaseApi = (apiConfig) => {
|
|
|
1214
1215
|
};
|
|
1215
1216
|
};
|
|
1216
1217
|
|
|
1217
|
-
// src/api/
|
|
1218
|
-
var
|
|
1218
|
+
// src/api/location.ts
|
|
1219
|
+
var createLocationApi = (apiConfig) => {
|
|
1219
1220
|
return {
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
*/
|
|
1223
|
-
async createFlag(params, options) {
|
|
1224
|
-
return apiConfig.httpClient.post(
|
|
1225
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags`,
|
|
1226
|
-
params,
|
|
1227
|
-
options
|
|
1228
|
-
);
|
|
1221
|
+
async getCountries(options) {
|
|
1222
|
+
return apiConfig.httpClient.get(`/v1/operations/location/countries`, options);
|
|
1229
1223
|
},
|
|
1230
|
-
|
|
1231
|
-
* Get a feature flag by ID
|
|
1232
|
-
*/
|
|
1233
|
-
async getFlag(params, options) {
|
|
1224
|
+
async getCountryStates(countryCode, options) {
|
|
1234
1225
|
return apiConfig.httpClient.get(
|
|
1235
|
-
`/v1/
|
|
1226
|
+
`/v1/operations/location/countries/${countryCode}/states`,
|
|
1236
1227
|
options
|
|
1237
1228
|
);
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
};
|
|
1232
|
+
|
|
1233
|
+
// src/api/network.ts
|
|
1234
|
+
var createNetworkApi = (apiConfig) => {
|
|
1235
|
+
return {
|
|
1236
|
+
/**
|
|
1237
|
+
* Search services across all businesses that have opted into a network
|
|
1238
|
+
* @param networkKey - The network key (e.g., "delfin")
|
|
1239
|
+
* @param params - Search parameters
|
|
1240
|
+
*/
|
|
1241
|
+
async searchServices(networkKey, params, options) {
|
|
1242
|
+
const queryParams = {};
|
|
1243
|
+
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1244
|
+
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1245
|
+
if (params?.query) queryParams.query = params.query;
|
|
1246
|
+
if (params?.nodeId) queryParams.nodeId = params.nodeId;
|
|
1247
|
+
if (params?.nodeIds && params.nodeIds.length > 0)
|
|
1248
|
+
queryParams.nodeIds = params.nodeIds.join(",");
|
|
1249
|
+
if (params?.statuses && params.statuses.length > 0)
|
|
1250
|
+
queryParams.statuses = params.statuses.join(",");
|
|
1251
|
+
if (params?.sortField) queryParams.sortField = params.sortField;
|
|
1252
|
+
if (params?.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
1253
|
+
if (params?.createdAtFrom !== void 0)
|
|
1254
|
+
queryParams.createdAtFrom = params.createdAtFrom;
|
|
1255
|
+
if (params?.createdAtTo !== void 0)
|
|
1256
|
+
queryParams.createdAtTo = params.createdAtTo;
|
|
1257
|
+
if (params?.priceFrom !== void 0) queryParams.priceFrom = params.priceFrom;
|
|
1258
|
+
if (params?.priceTo !== void 0) queryParams.priceTo = params.priceTo;
|
|
1259
|
+
if (params?.matchAll !== void 0) queryParams.matchAll = params.matchAll;
|
|
1260
|
+
if (params?.blocks && params.blocks.length > 0)
|
|
1261
|
+
queryParams.blocks = JSON.stringify(params.blocks);
|
|
1262
|
+
return apiConfig.httpClient.get(`/v1/networks/${networkKey}/services`, {
|
|
1263
|
+
...options,
|
|
1264
|
+
params: queryParams
|
|
1265
|
+
});
|
|
1238
1266
|
},
|
|
1239
1267
|
/**
|
|
1240
|
-
*
|
|
1268
|
+
* Search products across all businesses that have opted into a network
|
|
1269
|
+
* @param networkKey - The network key (e.g., "delfin")
|
|
1270
|
+
* @param params - Search parameters
|
|
1241
1271
|
*/
|
|
1242
|
-
async
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1272
|
+
async searchProducts(networkKey, params, options) {
|
|
1273
|
+
const queryParams = {};
|
|
1274
|
+
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1275
|
+
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1276
|
+
if (params?.query) queryParams.query = params.query;
|
|
1277
|
+
if (params?.nodeId) queryParams.nodeId = params.nodeId;
|
|
1278
|
+
if (params?.nodeIds && params.nodeIds.length > 0)
|
|
1279
|
+
queryParams.nodeIds = params.nodeIds.join(",");
|
|
1280
|
+
if (params?.statuses && params.statuses.length > 0)
|
|
1281
|
+
queryParams.statuses = params.statuses.join(",");
|
|
1282
|
+
if (params?.sortField) queryParams.sortField = params.sortField;
|
|
1283
|
+
if (params?.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
1284
|
+
if (params?.createdAtFrom !== void 0)
|
|
1285
|
+
queryParams.createdAtFrom = params.createdAtFrom;
|
|
1286
|
+
if (params?.createdAtTo !== void 0)
|
|
1287
|
+
queryParams.createdAtTo = params.createdAtTo;
|
|
1288
|
+
if (params?.priceFrom !== void 0) queryParams.priceFrom = params.priceFrom;
|
|
1289
|
+
if (params?.priceTo !== void 0) queryParams.priceTo = params.priceTo;
|
|
1290
|
+
if (params?.matchAll !== void 0) queryParams.matchAll = params.matchAll;
|
|
1291
|
+
if (params?.blocks && params.blocks.length > 0)
|
|
1292
|
+
queryParams.blocks = JSON.stringify(params.blocks);
|
|
1293
|
+
return apiConfig.httpClient.get(`/v1/networks/${networkKey}/products`, {
|
|
1294
|
+
...options,
|
|
1295
|
+
params: queryParams
|
|
1296
|
+
});
|
|
1250
1297
|
},
|
|
1251
1298
|
/**
|
|
1252
|
-
*
|
|
1299
|
+
* Search providers across all businesses that have opted into a network
|
|
1300
|
+
* @param networkKey - The network key (e.g., "delfin")
|
|
1301
|
+
* @param params - Search parameters
|
|
1253
1302
|
*/
|
|
1254
|
-
async
|
|
1255
|
-
const
|
|
1303
|
+
async searchProviders(networkKey, params, options) {
|
|
1304
|
+
const queryParams = {};
|
|
1305
|
+
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1306
|
+
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1307
|
+
if (params?.query) queryParams.query = params.query;
|
|
1308
|
+
if (params?.nodeId) queryParams.nodeId = params.nodeId;
|
|
1309
|
+
if (params?.nodeIds && params.nodeIds.length > 0)
|
|
1310
|
+
queryParams.nodeIds = params.nodeIds.join(",");
|
|
1311
|
+
if (params?.statuses && params.statuses.length > 0)
|
|
1312
|
+
queryParams.statuses = params.statuses.join(",");
|
|
1313
|
+
if (params?.sortField) queryParams.sortField = params.sortField;
|
|
1314
|
+
if (params?.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
1315
|
+
if (params?.createdAtFrom !== void 0)
|
|
1316
|
+
queryParams.createdAtFrom = params.createdAtFrom;
|
|
1317
|
+
if (params?.createdAtTo !== void 0)
|
|
1318
|
+
queryParams.createdAtTo = params.createdAtTo;
|
|
1319
|
+
if (params?.matchAll !== void 0) queryParams.matchAll = params.matchAll;
|
|
1320
|
+
if (params?.blocks && params.blocks.length > 0)
|
|
1321
|
+
queryParams.blocks = JSON.stringify(params.blocks);
|
|
1322
|
+
return apiConfig.httpClient.get(`/v1/networks/${networkKey}/providers`, {
|
|
1323
|
+
...options,
|
|
1324
|
+
params: queryParams
|
|
1325
|
+
});
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
};
|
|
1329
|
+
|
|
1330
|
+
// src/api/workflow.ts
|
|
1331
|
+
var createWorkflowApi = (apiConfig) => {
|
|
1332
|
+
return {
|
|
1333
|
+
async createWorkflow(params, options) {
|
|
1334
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1335
|
+
return apiConfig.httpClient.post(
|
|
1336
|
+
`/v1/businesses/${businessId}/workflows`,
|
|
1337
|
+
{ ...params, businessId },
|
|
1338
|
+
options
|
|
1339
|
+
);
|
|
1340
|
+
},
|
|
1341
|
+
async updateWorkflow(params, options) {
|
|
1256
1342
|
return apiConfig.httpClient.put(
|
|
1257
|
-
`/v1/businesses/${apiConfig.businessId}/
|
|
1258
|
-
|
|
1343
|
+
`/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
|
|
1344
|
+
params,
|
|
1259
1345
|
options
|
|
1260
1346
|
);
|
|
1261
1347
|
},
|
|
1262
|
-
|
|
1263
|
-
* Delete a feature flag
|
|
1264
|
-
*/
|
|
1265
|
-
async deleteFlag(params, options) {
|
|
1348
|
+
async deleteWorkflow(params, options) {
|
|
1266
1349
|
return apiConfig.httpClient.delete(
|
|
1267
|
-
`/v1/businesses/${apiConfig.businessId}/
|
|
1350
|
+
`/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
|
|
1268
1351
|
options
|
|
1269
1352
|
);
|
|
1270
1353
|
},
|
|
1271
|
-
|
|
1272
|
-
* Get experiment results for a feature flag
|
|
1273
|
-
*/
|
|
1274
|
-
async getResults(params, options) {
|
|
1354
|
+
async getWorkflow(params, options) {
|
|
1275
1355
|
return apiConfig.httpClient.get(
|
|
1276
|
-
`/v1/businesses/${apiConfig.businessId}/
|
|
1356
|
+
`/v1/businesses/${apiConfig.businessId}/workflows/${params.id}`,
|
|
1277
1357
|
options
|
|
1278
1358
|
);
|
|
1279
1359
|
},
|
|
1360
|
+
async getWorkflows(params, options) {
|
|
1361
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
1362
|
+
const { businessId: _, ...queryParams } = params || {};
|
|
1363
|
+
return apiConfig.httpClient.get(`/v1/businesses/${businessId}/workflows`, {
|
|
1364
|
+
...options,
|
|
1365
|
+
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1366
|
+
});
|
|
1367
|
+
},
|
|
1280
1368
|
/**
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1369
|
+
* Trigger a workflow execution via webhook
|
|
1370
|
+
* No authentication required - the secret in the URL validates the request
|
|
1283
1371
|
*/
|
|
1284
|
-
async
|
|
1285
|
-
|
|
1286
|
-
|
|
1372
|
+
async triggerWorkflow(params, options) {
|
|
1373
|
+
const { secret, ...input } = params;
|
|
1374
|
+
return apiConfig.httpClient.post(`/v1/workflows/trigger/${secret}`, input, options);
|
|
1375
|
+
}
|
|
1376
|
+
};
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
// src/api/audience.ts
|
|
1380
|
+
var createAudienceApi = (apiConfig) => {
|
|
1381
|
+
return {
|
|
1382
|
+
async createAudience(params, options) {
|
|
1383
|
+
return apiConfig.httpClient.post(
|
|
1384
|
+
`/v1/businesses/${apiConfig.businessId}/audiences`,
|
|
1385
|
+
params,
|
|
1287
1386
|
options
|
|
1288
1387
|
);
|
|
1289
1388
|
},
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
async trackEvent(params, options) {
|
|
1294
|
-
return apiConfig.httpClient.post(
|
|
1295
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags/track`,
|
|
1389
|
+
async updateAudience(params, options) {
|
|
1390
|
+
return apiConfig.httpClient.put(
|
|
1391
|
+
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}`,
|
|
1296
1392
|
params,
|
|
1297
1393
|
options
|
|
1298
1394
|
);
|
|
1299
1395
|
},
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
async isEnabled(flagKey) {
|
|
1306
|
-
try {
|
|
1307
|
-
const response = await this.getVariant({ flagKey });
|
|
1308
|
-
return response.variantKey !== "control";
|
|
1309
|
-
} catch {
|
|
1310
|
-
return false;
|
|
1311
|
-
}
|
|
1396
|
+
async deleteAudience(params, options) {
|
|
1397
|
+
return apiConfig.httpClient.delete(
|
|
1398
|
+
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}`,
|
|
1399
|
+
options
|
|
1400
|
+
);
|
|
1312
1401
|
},
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
try {
|
|
1319
|
-
const response = await this.getVariant({ flagKey });
|
|
1320
|
-
return {
|
|
1321
|
-
variantKey: response.variantKey,
|
|
1322
|
-
payload: response.payload ?? defaultValue
|
|
1323
|
-
};
|
|
1324
|
-
} catch {
|
|
1325
|
-
return {
|
|
1326
|
-
variantKey: "control",
|
|
1327
|
-
payload: defaultValue
|
|
1328
|
-
};
|
|
1329
|
-
}
|
|
1402
|
+
async getAudience(params, options) {
|
|
1403
|
+
return apiConfig.httpClient.get(
|
|
1404
|
+
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}`,
|
|
1405
|
+
options
|
|
1406
|
+
);
|
|
1330
1407
|
},
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1408
|
+
async getAudiences(params, options) {
|
|
1409
|
+
return apiConfig.httpClient.get(
|
|
1410
|
+
`/v1/businesses/${apiConfig.businessId}/audiences`,
|
|
1411
|
+
{ ...options, params }
|
|
1412
|
+
);
|
|
1336
1413
|
},
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
var createLocationApi = (apiConfig) => {
|
|
1348
|
-
return {
|
|
1349
|
-
async getCountries(options) {
|
|
1350
|
-
return apiConfig.httpClient.get(`/v1/operations/location/countries`, options);
|
|
1414
|
+
async subscribe(params, options) {
|
|
1415
|
+
return apiConfig.httpClient.post(
|
|
1416
|
+
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}/subscribe`,
|
|
1417
|
+
{
|
|
1418
|
+
priceId: params.priceId,
|
|
1419
|
+
successUrl: params.successUrl,
|
|
1420
|
+
cancelUrl: params.cancelUrl
|
|
1421
|
+
},
|
|
1422
|
+
options
|
|
1423
|
+
);
|
|
1351
1424
|
},
|
|
1352
|
-
async
|
|
1425
|
+
async checkAccess(params, options) {
|
|
1353
1426
|
return apiConfig.httpClient.get(
|
|
1354
|
-
`/v1/
|
|
1427
|
+
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}/access`,
|
|
1355
1428
|
options
|
|
1356
1429
|
);
|
|
1430
|
+
},
|
|
1431
|
+
async getSubscribers(params, options) {
|
|
1432
|
+
return apiConfig.httpClient.get(
|
|
1433
|
+
`/v1/businesses/${apiConfig.businessId}/audiences/${params.id}/subscribers`,
|
|
1434
|
+
{
|
|
1435
|
+
...options,
|
|
1436
|
+
params: {
|
|
1437
|
+
limit: params.limit,
|
|
1438
|
+
cursor: params.cursor
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
);
|
|
1357
1442
|
}
|
|
1358
1443
|
};
|
|
1359
1444
|
};
|
|
@@ -1561,6 +1646,8 @@ function createPaymentForCheckout(subtotalMinor, marketId, currency, paymentMeth
|
|
|
1561
1646
|
shipping: 0,
|
|
1562
1647
|
discount,
|
|
1563
1648
|
total,
|
|
1649
|
+
paid: 0,
|
|
1650
|
+
refunds: [],
|
|
1564
1651
|
type: paymentMethod,
|
|
1565
1652
|
...taxAmount > 0 && {
|
|
1566
1653
|
tax: {
|
|
@@ -1712,8 +1799,37 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1712
1799
|
}
|
|
1713
1800
|
}
|
|
1714
1801
|
|
|
1802
|
+
// src/utils/keyValidation.ts
|
|
1803
|
+
var KEY_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
1804
|
+
function isValidKey(key) {
|
|
1805
|
+
if (!key || key.length === 0) return false;
|
|
1806
|
+
return KEY_PATTERN.test(key);
|
|
1807
|
+
}
|
|
1808
|
+
function validateKey(key) {
|
|
1809
|
+
if (!key || key.length === 0) {
|
|
1810
|
+
return { valid: false, error: "Key is required" };
|
|
1811
|
+
}
|
|
1812
|
+
if (key.length > 255) {
|
|
1813
|
+
return { valid: false, error: "Key must be 255 characters or less" };
|
|
1814
|
+
}
|
|
1815
|
+
if (!KEY_PATTERN.test(key)) {
|
|
1816
|
+
return {
|
|
1817
|
+
valid: false,
|
|
1818
|
+
error: "Key can only contain letters, numbers, underscores (_) and hyphens (-)"
|
|
1819
|
+
};
|
|
1820
|
+
}
|
|
1821
|
+
return { valid: true };
|
|
1822
|
+
}
|
|
1823
|
+
function toKey(input) {
|
|
1824
|
+
if (!input) return "";
|
|
1825
|
+
return input.toLowerCase().trim().replace(/\s+/g, "_").replace(/[^a-z0-9_-]/g, "").replace(/^[-_]+|[-_]+$/g, "").replace(/[-_]{2,}/g, "_");
|
|
1826
|
+
}
|
|
1827
|
+
function nameToKey(name) {
|
|
1828
|
+
return toKey(name);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1715
1831
|
// src/index.ts
|
|
1716
|
-
var SDK_VERSION = "0.
|
|
1832
|
+
var SDK_VERSION = "0.3.167";
|
|
1717
1833
|
var SUPPORTED_FRAMEWORKS = [
|
|
1718
1834
|
"astro",
|
|
1719
1835
|
"react",
|
|
@@ -1733,28 +1849,13 @@ async function createArkySDK(config) {
|
|
|
1733
1849
|
setToken: config.setToken,
|
|
1734
1850
|
getToken: config.getToken
|
|
1735
1851
|
};
|
|
1736
|
-
const
|
|
1737
|
-
const
|
|
1738
|
-
if (autoGuest) {
|
|
1739
|
-
try {
|
|
1740
|
-
const tokens = await config.getToken();
|
|
1741
|
-
if (!tokens.accessToken && !tokens.refreshToken) {
|
|
1742
|
-
const result = await httpClient.post("/v1/users/login", {
|
|
1743
|
-
provider: "GUEST"
|
|
1744
|
-
});
|
|
1745
|
-
const token = result.accessToken || result.token || "";
|
|
1746
|
-
if (token) {
|
|
1747
|
-
config.setToken(result);
|
|
1748
|
-
}
|
|
1749
|
-
}
|
|
1750
|
-
} catch (error) {
|
|
1751
|
-
}
|
|
1752
|
-
}
|
|
1852
|
+
const accountApi = createAccountApi(apiConfig);
|
|
1853
|
+
const authApi = createAuthApi(apiConfig);
|
|
1753
1854
|
const sdk = {
|
|
1754
|
-
|
|
1855
|
+
auth: authApi,
|
|
1856
|
+
account: accountApi,
|
|
1755
1857
|
business: createBusinessApi(apiConfig),
|
|
1756
1858
|
media: createMediaApi(apiConfig),
|
|
1757
|
-
role: createRoleApi(apiConfig),
|
|
1758
1859
|
notification: createNotificationApi(apiConfig),
|
|
1759
1860
|
promoCode: createPromoCodeApi(apiConfig),
|
|
1760
1861
|
analytics: createAnalyticsApi(apiConfig),
|
|
@@ -1762,8 +1863,10 @@ async function createArkySDK(config) {
|
|
|
1762
1863
|
eshop: createEshopApi(apiConfig),
|
|
1763
1864
|
reservation: createReservationApi(apiConfig),
|
|
1764
1865
|
database: createDatabaseApi(apiConfig),
|
|
1765
|
-
featureFlags: createFeatureFlagsApi(apiConfig),
|
|
1766
1866
|
location: createLocationApi(apiConfig),
|
|
1867
|
+
network: createNetworkApi(apiConfig),
|
|
1868
|
+
workflow: createWorkflowApi(apiConfig),
|
|
1869
|
+
audience: createAudienceApi(apiConfig),
|
|
1767
1870
|
setBusinessId: (businessId) => {
|
|
1768
1871
|
apiConfig.businessId = businessId;
|
|
1769
1872
|
},
|
|
@@ -1814,7 +1917,12 @@ async function createArkySDK(config) {
|
|
|
1814
1917
|
// SVG utilities
|
|
1815
1918
|
getSvgContentForAstro,
|
|
1816
1919
|
fetchSvgContent,
|
|
1817
|
-
injectSvgIntoElement
|
|
1920
|
+
injectSvgIntoElement,
|
|
1921
|
+
// Key validation utilities
|
|
1922
|
+
isValidKey,
|
|
1923
|
+
validateKey,
|
|
1924
|
+
toKey,
|
|
1925
|
+
nameToKey
|
|
1818
1926
|
}
|
|
1819
1927
|
};
|
|
1820
1928
|
return sdk;
|