arky-sdk 0.3.127 → 0.3.129
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 +301 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +354 -117
- package/dist/index.d.ts +354 -117
- package/dist/index.js +301 -28
- package/dist/index.js.map +1 -1
- package/dist/types.cjs +7 -16
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +783 -752
- package/dist/types.d.ts +783 -752
- package/dist/types.js +7 -16
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +25 -697
- 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 -657
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/svg-ByOFlX-F.d.ts +0 -134
- package/dist/svg-DaEaIf5S.d.cts +0 -134
package/dist/index.cjs
CHANGED
|
@@ -7,6 +7,12 @@ var PaymentMethodType = /* @__PURE__ */ ((PaymentMethodType2) => {
|
|
|
7
7
|
PaymentMethodType2["Free"] = "FREE";
|
|
8
8
|
return PaymentMethodType2;
|
|
9
9
|
})(PaymentMethodType || {});
|
|
10
|
+
var TaxonomyScope = /* @__PURE__ */ ((TaxonomyScope2) => {
|
|
11
|
+
TaxonomyScope2["SERVICE"] = "SERVICE";
|
|
12
|
+
TaxonomyScope2["PROVIDER"] = "PROVIDER";
|
|
13
|
+
TaxonomyScope2["PRODUCT"] = "PRODUCT";
|
|
14
|
+
return TaxonomyScope2;
|
|
15
|
+
})(TaxonomyScope || {});
|
|
10
16
|
|
|
11
17
|
// src/utils/errors.ts
|
|
12
18
|
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
@@ -369,12 +375,18 @@ var createBusinessApi = (apiConfig) => {
|
|
|
369
375
|
);
|
|
370
376
|
},
|
|
371
377
|
async getBusinessMedia(params, options) {
|
|
378
|
+
const queryParams = {
|
|
379
|
+
limit: params.limit
|
|
380
|
+
};
|
|
381
|
+
if (params.cursor) queryParams.cursor = params.cursor;
|
|
382
|
+
if (params.ids && params.ids.length > 0) queryParams.ids = params.ids.join(",");
|
|
383
|
+
if (params.query) queryParams.query = params.query;
|
|
384
|
+
if (params.mimeType) queryParams.mimeType = params.mimeType;
|
|
385
|
+
if (params.sortField) queryParams.sortField = params.sortField;
|
|
386
|
+
if (params.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
372
387
|
return apiConfig.httpClient.get(`/v1/businesses/${params.id}/media`, {
|
|
373
388
|
...options,
|
|
374
|
-
params:
|
|
375
|
-
cursor: params.cursor,
|
|
376
|
-
limit: params.limit || 20
|
|
377
|
-
}
|
|
389
|
+
params: queryParams
|
|
378
390
|
});
|
|
379
391
|
},
|
|
380
392
|
async processRefund(params, options) {
|
|
@@ -418,12 +430,22 @@ var createMediaApi = (apiConfig) => {
|
|
|
418
430
|
);
|
|
419
431
|
},
|
|
420
432
|
async getBusinessMedia(params, options) {
|
|
421
|
-
const { cursor
|
|
433
|
+
const { cursor, limit, ids, query, mimeType, sortField, sortDirection } = params;
|
|
422
434
|
const url = `${apiConfig.baseUrl}/v1/businesses/${apiConfig.businessId}/media`;
|
|
423
|
-
const queryParams = { limit };
|
|
435
|
+
const queryParams = { limit: String(limit) };
|
|
424
436
|
if (cursor) queryParams.cursor = cursor;
|
|
437
|
+
if (ids && ids.length > 0) queryParams.ids = ids.join(",");
|
|
438
|
+
if (query) queryParams.query = query;
|
|
439
|
+
if (mimeType) queryParams.mimeType = mimeType;
|
|
440
|
+
if (sortField) queryParams.sortField = sortField;
|
|
441
|
+
if (sortDirection) queryParams.sortDirection = sortDirection;
|
|
425
442
|
const queryString = new URLSearchParams(queryParams).toString();
|
|
426
|
-
const
|
|
443
|
+
const tokens = await apiConfig.getToken();
|
|
444
|
+
const response = await fetch(`${url}?${queryString}`, {
|
|
445
|
+
headers: {
|
|
446
|
+
Authorization: `Bearer ${tokens.accessToken}`
|
|
447
|
+
}
|
|
448
|
+
});
|
|
427
449
|
if (!response.ok) {
|
|
428
450
|
const errorData = await response.json().catch(() => null);
|
|
429
451
|
throw new Error(errorData?.message || "Failed to fetch media");
|
|
@@ -1268,8 +1290,8 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1268
1290
|
*/
|
|
1269
1291
|
async createNewsletter(params, options) {
|
|
1270
1292
|
return apiConfig.httpClient.post(
|
|
1271
|
-
`/v1/newsletters`,
|
|
1272
|
-
|
|
1293
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters`,
|
|
1294
|
+
params,
|
|
1273
1295
|
options
|
|
1274
1296
|
);
|
|
1275
1297
|
},
|
|
@@ -1278,7 +1300,7 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1278
1300
|
*/
|
|
1279
1301
|
async getNewsletter(params, options) {
|
|
1280
1302
|
return apiConfig.httpClient.get(
|
|
1281
|
-
`/v1/newsletters/${params.id}`,
|
|
1303
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${params.id}`,
|
|
1282
1304
|
options
|
|
1283
1305
|
);
|
|
1284
1306
|
},
|
|
@@ -1286,24 +1308,31 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1286
1308
|
* List all newsletters for the business
|
|
1287
1309
|
*/
|
|
1288
1310
|
async getNewsletters(params, options) {
|
|
1289
|
-
return apiConfig.httpClient.get(
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1311
|
+
return apiConfig.httpClient.get(
|
|
1312
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters`,
|
|
1313
|
+
{
|
|
1314
|
+
...options,
|
|
1315
|
+
params
|
|
1316
|
+
}
|
|
1317
|
+
);
|
|
1293
1318
|
},
|
|
1294
1319
|
/**
|
|
1295
1320
|
* Update a newsletter
|
|
1296
1321
|
*/
|
|
1297
1322
|
async updateNewsletter(params, options) {
|
|
1298
1323
|
const { id, ...body } = params;
|
|
1299
|
-
return apiConfig.httpClient.put(
|
|
1324
|
+
return apiConfig.httpClient.put(
|
|
1325
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${id}`,
|
|
1326
|
+
body,
|
|
1327
|
+
options
|
|
1328
|
+
);
|
|
1300
1329
|
},
|
|
1301
1330
|
/**
|
|
1302
1331
|
* Delete a newsletter
|
|
1303
1332
|
*/
|
|
1304
1333
|
async deleteNewsletter(params, options) {
|
|
1305
1334
|
return apiConfig.httpClient.delete(
|
|
1306
|
-
`/v1/newsletters/${params.id}`,
|
|
1335
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${params.id}`,
|
|
1307
1336
|
options
|
|
1308
1337
|
);
|
|
1309
1338
|
},
|
|
@@ -1312,7 +1341,7 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1312
1341
|
*/
|
|
1313
1342
|
async getSubscribers(params, options) {
|
|
1314
1343
|
return apiConfig.httpClient.get(
|
|
1315
|
-
`/v1/newsletters/${params.id}/subscribers`,
|
|
1344
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${params.id}/subscribers`,
|
|
1316
1345
|
options
|
|
1317
1346
|
);
|
|
1318
1347
|
},
|
|
@@ -1323,8 +1352,8 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1323
1352
|
async createPost(params, options) {
|
|
1324
1353
|
const { newsletterId, ...body } = params;
|
|
1325
1354
|
return apiConfig.httpClient.post(
|
|
1326
|
-
`/v1/newsletters/${newsletterId}/posts`,
|
|
1327
|
-
|
|
1355
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${newsletterId}/posts`,
|
|
1356
|
+
body,
|
|
1328
1357
|
options
|
|
1329
1358
|
);
|
|
1330
1359
|
},
|
|
@@ -1333,7 +1362,7 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1333
1362
|
*/
|
|
1334
1363
|
async getPost(params, options) {
|
|
1335
1364
|
return apiConfig.httpClient.get(
|
|
1336
|
-
`/v1/newsletters/${params.newsletterId}/posts/${params.postId}`,
|
|
1365
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${params.newsletterId}/posts/${params.postId}`,
|
|
1337
1366
|
options
|
|
1338
1367
|
);
|
|
1339
1368
|
},
|
|
@@ -1343,10 +1372,10 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1343
1372
|
async getPosts(params, options) {
|
|
1344
1373
|
const { newsletterId, ...queryParams } = params;
|
|
1345
1374
|
return apiConfig.httpClient.get(
|
|
1346
|
-
`/v1/newsletters/${newsletterId}/posts`,
|
|
1375
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${newsletterId}/posts`,
|
|
1347
1376
|
{
|
|
1348
1377
|
...options,
|
|
1349
|
-
params:
|
|
1378
|
+
params: queryParams
|
|
1350
1379
|
}
|
|
1351
1380
|
);
|
|
1352
1381
|
},
|
|
@@ -1356,7 +1385,7 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1356
1385
|
async updatePost(params, options) {
|
|
1357
1386
|
const { newsletterId, postId, ...body } = params;
|
|
1358
1387
|
return apiConfig.httpClient.put(
|
|
1359
|
-
`/v1/newsletters/${newsletterId}/posts/${postId}`,
|
|
1388
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${newsletterId}/posts/${postId}`,
|
|
1360
1389
|
body,
|
|
1361
1390
|
options
|
|
1362
1391
|
);
|
|
@@ -1366,7 +1395,7 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1366
1395
|
*/
|
|
1367
1396
|
async deletePost(params, options) {
|
|
1368
1397
|
return apiConfig.httpClient.delete(
|
|
1369
|
-
`/v1/newsletters/${params.newsletterId}/posts/${params.postId}`,
|
|
1398
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${params.newsletterId}/posts/${params.postId}`,
|
|
1370
1399
|
options
|
|
1371
1400
|
);
|
|
1372
1401
|
},
|
|
@@ -1377,7 +1406,7 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1377
1406
|
async scheduleSend(params, options) {
|
|
1378
1407
|
const { newsletterId, postId, ...body } = params;
|
|
1379
1408
|
return apiConfig.httpClient.post(
|
|
1380
|
-
`/v1/newsletters/${newsletterId}/posts/${postId}/send`,
|
|
1409
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${newsletterId}/posts/${postId}/send`,
|
|
1381
1410
|
body,
|
|
1382
1411
|
options
|
|
1383
1412
|
);
|
|
@@ -1388,7 +1417,7 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1388
1417
|
async cancelSend(params, options) {
|
|
1389
1418
|
const { newsletterId, postId, sendId } = params;
|
|
1390
1419
|
return apiConfig.httpClient.post(
|
|
1391
|
-
`/v1/newsletters/${newsletterId}/posts/${postId}/send/${sendId}/cancel`,
|
|
1420
|
+
`/v1/businesses/${apiConfig.businessId}/newsletters/${newsletterId}/posts/${postId}/send/${sendId}/cancel`,
|
|
1392
1421
|
{},
|
|
1393
1422
|
options
|
|
1394
1423
|
);
|
|
@@ -1426,6 +1455,213 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1426
1455
|
};
|
|
1427
1456
|
};
|
|
1428
1457
|
|
|
1458
|
+
// src/api/emailTemplate.ts
|
|
1459
|
+
var createEmailTemplateApi = (apiConfig) => {
|
|
1460
|
+
return {
|
|
1461
|
+
/**
|
|
1462
|
+
* List all email templates for the business
|
|
1463
|
+
* Returns paginated list of email templates
|
|
1464
|
+
*/
|
|
1465
|
+
async getTemplates(params, options) {
|
|
1466
|
+
const businessId = params?.businessId || apiConfig.businessId;
|
|
1467
|
+
const queryParams = {};
|
|
1468
|
+
if (params?.key) queryParams.key = params.key;
|
|
1469
|
+
if (params?.keys) queryParams.keys = params.keys;
|
|
1470
|
+
if (params?.query) queryParams.query = params.query;
|
|
1471
|
+
if (params?.limit) queryParams.limit = params.limit;
|
|
1472
|
+
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1473
|
+
return apiConfig.httpClient.get(
|
|
1474
|
+
`/v1/businesses/${businessId}/email-templates`,
|
|
1475
|
+
{ ...options, params: queryParams }
|
|
1476
|
+
);
|
|
1477
|
+
},
|
|
1478
|
+
/**
|
|
1479
|
+
* Get a specific email template by ID
|
|
1480
|
+
*/
|
|
1481
|
+
async getTemplate(params, options) {
|
|
1482
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1483
|
+
return apiConfig.httpClient.get(
|
|
1484
|
+
`/v1/businesses/${businessId}/email-templates/${params.id}`,
|
|
1485
|
+
options
|
|
1486
|
+
);
|
|
1487
|
+
},
|
|
1488
|
+
/**
|
|
1489
|
+
* Get a specific email template by key
|
|
1490
|
+
*/
|
|
1491
|
+
async getTemplateByKey(params, options) {
|
|
1492
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1493
|
+
return apiConfig.httpClient.get(
|
|
1494
|
+
`/v1/businesses/${businessId}/email-templates/by-key/${params.key}`,
|
|
1495
|
+
options
|
|
1496
|
+
);
|
|
1497
|
+
},
|
|
1498
|
+
/**
|
|
1499
|
+
* Create a new email template
|
|
1500
|
+
*/
|
|
1501
|
+
async createTemplate(params, options) {
|
|
1502
|
+
const { businessId: paramBusinessId, ...body } = params;
|
|
1503
|
+
const businessId = paramBusinessId || apiConfig.businessId;
|
|
1504
|
+
return apiConfig.httpClient.post(
|
|
1505
|
+
`/v1/businesses/${businessId}/email-templates`,
|
|
1506
|
+
body,
|
|
1507
|
+
options
|
|
1508
|
+
);
|
|
1509
|
+
},
|
|
1510
|
+
/**
|
|
1511
|
+
* Update an existing email template
|
|
1512
|
+
*/
|
|
1513
|
+
async updateTemplate(params, options) {
|
|
1514
|
+
const { id, businessId: paramBusinessId, ...body } = params;
|
|
1515
|
+
const businessId = paramBusinessId || apiConfig.businessId;
|
|
1516
|
+
return apiConfig.httpClient.put(
|
|
1517
|
+
`/v1/businesses/${businessId}/email-templates/${id}`,
|
|
1518
|
+
body,
|
|
1519
|
+
options
|
|
1520
|
+
);
|
|
1521
|
+
},
|
|
1522
|
+
/**
|
|
1523
|
+
* Delete an email template
|
|
1524
|
+
*/
|
|
1525
|
+
async deleteTemplate(params, options) {
|
|
1526
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1527
|
+
return apiConfig.httpClient.delete(
|
|
1528
|
+
`/v1/businesses/${businessId}/email-templates/${params.id}`,
|
|
1529
|
+
options
|
|
1530
|
+
);
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
};
|
|
1534
|
+
|
|
1535
|
+
// src/api/taxonomy.ts
|
|
1536
|
+
var createTaxonomyApi = (apiConfig) => {
|
|
1537
|
+
return {
|
|
1538
|
+
async getTaxonomies(params, options) {
|
|
1539
|
+
return apiConfig.httpClient.get(
|
|
1540
|
+
`/v1/businesses/${apiConfig.businessId}/taxonomies`,
|
|
1541
|
+
{
|
|
1542
|
+
...options,
|
|
1543
|
+
params
|
|
1544
|
+
}
|
|
1545
|
+
);
|
|
1546
|
+
},
|
|
1547
|
+
async getTaxonomy(params, options) {
|
|
1548
|
+
return apiConfig.httpClient.get(
|
|
1549
|
+
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}`,
|
|
1550
|
+
options
|
|
1551
|
+
);
|
|
1552
|
+
},
|
|
1553
|
+
async createTaxonomy(params, options) {
|
|
1554
|
+
return apiConfig.httpClient.post(
|
|
1555
|
+
`/v1/businesses/${apiConfig.businessId}/taxonomies`,
|
|
1556
|
+
params,
|
|
1557
|
+
options
|
|
1558
|
+
);
|
|
1559
|
+
},
|
|
1560
|
+
async updateTaxonomy(params, options) {
|
|
1561
|
+
return apiConfig.httpClient.put(
|
|
1562
|
+
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}`,
|
|
1563
|
+
params,
|
|
1564
|
+
options
|
|
1565
|
+
);
|
|
1566
|
+
},
|
|
1567
|
+
async deleteTaxonomy(params, options) {
|
|
1568
|
+
return apiConfig.httpClient.delete(
|
|
1569
|
+
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}`,
|
|
1570
|
+
options
|
|
1571
|
+
);
|
|
1572
|
+
},
|
|
1573
|
+
async getTaxonomyChildren(params, options) {
|
|
1574
|
+
return apiConfig.httpClient.get(
|
|
1575
|
+
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}/children`,
|
|
1576
|
+
options
|
|
1577
|
+
);
|
|
1578
|
+
},
|
|
1579
|
+
async getRootTaxonomies(scope, options) {
|
|
1580
|
+
const result = await apiConfig.httpClient.get(
|
|
1581
|
+
`/v1/businesses/${apiConfig.businessId}/taxonomies`,
|
|
1582
|
+
{
|
|
1583
|
+
...options,
|
|
1584
|
+
params: { scope, root: true }
|
|
1585
|
+
}
|
|
1586
|
+
);
|
|
1587
|
+
return result.items || [];
|
|
1588
|
+
}
|
|
1589
|
+
};
|
|
1590
|
+
};
|
|
1591
|
+
|
|
1592
|
+
// src/api/form.ts
|
|
1593
|
+
var createFormApi = (apiConfig) => {
|
|
1594
|
+
return {
|
|
1595
|
+
// Form CRUD
|
|
1596
|
+
async getForms(params, options) {
|
|
1597
|
+
return apiConfig.httpClient.get(
|
|
1598
|
+
`/v1/businesses/${apiConfig.businessId}/forms`,
|
|
1599
|
+
{
|
|
1600
|
+
...options,
|
|
1601
|
+
params
|
|
1602
|
+
}
|
|
1603
|
+
);
|
|
1604
|
+
},
|
|
1605
|
+
async getForm(params, options) {
|
|
1606
|
+
return apiConfig.httpClient.get(
|
|
1607
|
+
`/v1/businesses/${apiConfig.businessId}/forms/${params.id}`,
|
|
1608
|
+
options
|
|
1609
|
+
);
|
|
1610
|
+
},
|
|
1611
|
+
async createForm(params, options) {
|
|
1612
|
+
return apiConfig.httpClient.post(
|
|
1613
|
+
`/v1/businesses/${apiConfig.businessId}/forms`,
|
|
1614
|
+
params,
|
|
1615
|
+
options
|
|
1616
|
+
);
|
|
1617
|
+
},
|
|
1618
|
+
async updateForm(params, options) {
|
|
1619
|
+
return apiConfig.httpClient.put(
|
|
1620
|
+
`/v1/businesses/${apiConfig.businessId}/forms/${params.id}`,
|
|
1621
|
+
params,
|
|
1622
|
+
options
|
|
1623
|
+
);
|
|
1624
|
+
},
|
|
1625
|
+
async deleteForm(params, options) {
|
|
1626
|
+
return apiConfig.httpClient.delete(
|
|
1627
|
+
`/v1/businesses/${apiConfig.businessId}/forms/${params.id}`,
|
|
1628
|
+
options
|
|
1629
|
+
);
|
|
1630
|
+
},
|
|
1631
|
+
// Form Entry CRUD
|
|
1632
|
+
async getEntries(params, options) {
|
|
1633
|
+
const { formId, ...queryParams } = params;
|
|
1634
|
+
return apiConfig.httpClient.get(
|
|
1635
|
+
`/v1/businesses/${apiConfig.businessId}/forms/${formId}/entries`,
|
|
1636
|
+
{
|
|
1637
|
+
...options,
|
|
1638
|
+
params: queryParams
|
|
1639
|
+
}
|
|
1640
|
+
);
|
|
1641
|
+
},
|
|
1642
|
+
async createEntry(params, options) {
|
|
1643
|
+
const { formId, ...body } = params;
|
|
1644
|
+
return apiConfig.httpClient.post(
|
|
1645
|
+
`/v1/businesses/${apiConfig.businessId}/forms/${formId}/entries`,
|
|
1646
|
+
body,
|
|
1647
|
+
options
|
|
1648
|
+
);
|
|
1649
|
+
},
|
|
1650
|
+
async getEntry(params, options) {
|
|
1651
|
+
return apiConfig.httpClient.get(
|
|
1652
|
+
`/v1/businesses/${apiConfig.businessId}/forms/${params.formId}/entries/${params.entryId}`,
|
|
1653
|
+
options
|
|
1654
|
+
);
|
|
1655
|
+
},
|
|
1656
|
+
async deleteEntry(params, options) {
|
|
1657
|
+
return apiConfig.httpClient.delete(
|
|
1658
|
+
`/v1/businesses/${apiConfig.businessId}/forms/${params.formId}/entries/${params.entryId}`,
|
|
1659
|
+
options
|
|
1660
|
+
);
|
|
1661
|
+
}
|
|
1662
|
+
};
|
|
1663
|
+
};
|
|
1664
|
+
|
|
1429
1665
|
// src/utils/currency.ts
|
|
1430
1666
|
function getCurrencySymbol(currency) {
|
|
1431
1667
|
const currencySymbols = {
|
|
@@ -1782,6 +2018,35 @@ async function injectSvgIntoElement(mediaObject, targetElement, className) {
|
|
|
1782
2018
|
}
|
|
1783
2019
|
}
|
|
1784
2020
|
|
|
2021
|
+
// src/utils/keyValidation.ts
|
|
2022
|
+
var KEY_PATTERN = /^[a-zA-Z0-9_-]+$/;
|
|
2023
|
+
function isValidKey(key) {
|
|
2024
|
+
if (!key || key.length === 0) return false;
|
|
2025
|
+
return KEY_PATTERN.test(key);
|
|
2026
|
+
}
|
|
2027
|
+
function validateKey(key) {
|
|
2028
|
+
if (!key || key.length === 0) {
|
|
2029
|
+
return { valid: false, error: "Key is required" };
|
|
2030
|
+
}
|
|
2031
|
+
if (key.length > 255) {
|
|
2032
|
+
return { valid: false, error: "Key must be 255 characters or less" };
|
|
2033
|
+
}
|
|
2034
|
+
if (!KEY_PATTERN.test(key)) {
|
|
2035
|
+
return {
|
|
2036
|
+
valid: false,
|
|
2037
|
+
error: "Key can only contain letters, numbers, underscores (_) and hyphens (-)"
|
|
2038
|
+
};
|
|
2039
|
+
}
|
|
2040
|
+
return { valid: true };
|
|
2041
|
+
}
|
|
2042
|
+
function toKey(input) {
|
|
2043
|
+
if (!input) return "";
|
|
2044
|
+
return input.toLowerCase().trim().replace(/\s+/g, "_").replace(/[^a-z0-9_-]/g, "").replace(/^[-_]+|[-_]+$/g, "").replace(/[-_]{2,}/g, "_");
|
|
2045
|
+
}
|
|
2046
|
+
function nameToKey(name) {
|
|
2047
|
+
return toKey(name);
|
|
2048
|
+
}
|
|
2049
|
+
|
|
1785
2050
|
// src/index.ts
|
|
1786
2051
|
var SDK_VERSION = "0.3.88";
|
|
1787
2052
|
var SUPPORTED_FRAMEWORKS = [
|
|
@@ -1835,6 +2100,9 @@ async function createArkySDK(config) {
|
|
|
1835
2100
|
featureFlags: createFeatureFlagsApi(apiConfig),
|
|
1836
2101
|
location: createLocationApi(apiConfig),
|
|
1837
2102
|
newsletter: createNewsletterApi(apiConfig),
|
|
2103
|
+
emailTemplate: createEmailTemplateApi(apiConfig),
|
|
2104
|
+
taxonomy: createTaxonomyApi(apiConfig),
|
|
2105
|
+
form: createFormApi(apiConfig),
|
|
1838
2106
|
setBusinessId: (businessId) => {
|
|
1839
2107
|
apiConfig.businessId = businessId;
|
|
1840
2108
|
},
|
|
@@ -1885,7 +2153,12 @@ async function createArkySDK(config) {
|
|
|
1885
2153
|
// SVG utilities
|
|
1886
2154
|
getSvgContentForAstro,
|
|
1887
2155
|
fetchSvgContent,
|
|
1888
|
-
injectSvgIntoElement
|
|
2156
|
+
injectSvgIntoElement,
|
|
2157
|
+
// Key validation utilities
|
|
2158
|
+
isValidKey,
|
|
2159
|
+
validateKey,
|
|
2160
|
+
toKey,
|
|
2161
|
+
nameToKey
|
|
1889
2162
|
}
|
|
1890
2163
|
};
|
|
1891
2164
|
return sdk;
|
|
@@ -1894,6 +2167,7 @@ async function createArkySDK(config) {
|
|
|
1894
2167
|
exports.PaymentMethodType = PaymentMethodType;
|
|
1895
2168
|
exports.SDK_VERSION = SDK_VERSION;
|
|
1896
2169
|
exports.SUPPORTED_FRAMEWORKS = SUPPORTED_FRAMEWORKS;
|
|
2170
|
+
exports.TaxonomyScope = TaxonomyScope;
|
|
1897
2171
|
exports.createArkySDK = createArkySDK;
|
|
1898
2172
|
//# sourceMappingURL=index.cjs.map
|
|
1899
2173
|
//# sourceMappingURL=index.cjs.map
|