arky-sdk 0.3.128 → 0.3.130
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 +26 -227
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +117 -253
- package/dist/index.d.ts +117 -253
- package/dist/index.js +27 -227
- package/dist/index.js.map +1 -1
- package/dist/types.cjs +0 -7
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1015 -1065
- package/dist/types.d.ts +1015 -1065
- package/dist/types.js +1 -7
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,12 +7,6 @@ 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 || {});
|
|
16
10
|
|
|
17
11
|
// src/utils/errors.ts
|
|
18
12
|
var convertServerErrorToRequestError = (serverError, renameRules) => {
|
|
@@ -375,12 +369,18 @@ var createBusinessApi = (apiConfig) => {
|
|
|
375
369
|
);
|
|
376
370
|
},
|
|
377
371
|
async getBusinessMedia(params, options) {
|
|
372
|
+
const queryParams = {
|
|
373
|
+
limit: params.limit
|
|
374
|
+
};
|
|
375
|
+
if (params.cursor) queryParams.cursor = params.cursor;
|
|
376
|
+
if (params.ids && params.ids.length > 0) queryParams.ids = params.ids.join(",");
|
|
377
|
+
if (params.query) queryParams.query = params.query;
|
|
378
|
+
if (params.mimeType) queryParams.mimeType = params.mimeType;
|
|
379
|
+
if (params.sortField) queryParams.sortField = params.sortField;
|
|
380
|
+
if (params.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
378
381
|
return apiConfig.httpClient.get(`/v1/businesses/${params.id}/media`, {
|
|
379
382
|
...options,
|
|
380
|
-
params:
|
|
381
|
-
cursor: params.cursor,
|
|
382
|
-
limit: params.limit || 20
|
|
383
|
-
}
|
|
383
|
+
params: queryParams
|
|
384
384
|
});
|
|
385
385
|
},
|
|
386
386
|
async processRefund(params, options) {
|
|
@@ -402,7 +402,7 @@ var createMediaApi = (apiConfig) => {
|
|
|
402
402
|
const url = `${apiConfig.baseUrl}/v1/businesses/${apiConfig.businessId}/media`;
|
|
403
403
|
const formData = new FormData();
|
|
404
404
|
files.forEach((file) => formData.append("files", file));
|
|
405
|
-
urls.forEach((url2) => formData.append("
|
|
405
|
+
urls.forEach((url2) => formData.append("urls", url2));
|
|
406
406
|
const tokens = await apiConfig.getToken();
|
|
407
407
|
const response = await fetch(url, {
|
|
408
408
|
method: "POST",
|
|
@@ -424,12 +424,22 @@ var createMediaApi = (apiConfig) => {
|
|
|
424
424
|
);
|
|
425
425
|
},
|
|
426
426
|
async getBusinessMedia(params, options) {
|
|
427
|
-
const { cursor
|
|
427
|
+
const { cursor, limit, ids, query, mimeType, sortField, sortDirection } = params;
|
|
428
428
|
const url = `${apiConfig.baseUrl}/v1/businesses/${apiConfig.businessId}/media`;
|
|
429
|
-
const queryParams = { limit };
|
|
429
|
+
const queryParams = { limit: String(limit) };
|
|
430
430
|
if (cursor) queryParams.cursor = cursor;
|
|
431
|
+
if (ids && ids.length > 0) queryParams.ids = ids.join(",");
|
|
432
|
+
if (query) queryParams.query = query;
|
|
433
|
+
if (mimeType) queryParams.mimeType = mimeType;
|
|
434
|
+
if (sortField) queryParams.sortField = sortField;
|
|
435
|
+
if (sortDirection) queryParams.sortDirection = sortDirection;
|
|
431
436
|
const queryString = new URLSearchParams(queryParams).toString();
|
|
432
|
-
const
|
|
437
|
+
const tokens = await apiConfig.getToken();
|
|
438
|
+
const response = await fetch(`${url}?${queryString}`, {
|
|
439
|
+
headers: {
|
|
440
|
+
Authorization: `Bearer ${tokens.accessToken}`
|
|
441
|
+
}
|
|
442
|
+
});
|
|
433
443
|
if (!response.ok) {
|
|
434
444
|
const errorData = await response.json().catch(() => null);
|
|
435
445
|
throw new Error(errorData?.message || "Failed to fetch media");
|
|
@@ -673,7 +683,7 @@ function unwrapBlock(block, locale) {
|
|
|
673
683
|
return parsed;
|
|
674
684
|
});
|
|
675
685
|
}
|
|
676
|
-
const isLocalized = block.type === "
|
|
686
|
+
const isLocalized = block.type === "LOCALIZED_TEXT" || block.type === "MARKDOWN";
|
|
677
687
|
const isList = block.properties?.ui === "list" || (block.properties?.maxValues ?? 1) > 1 || block.value.length > 1;
|
|
678
688
|
if (isList) {
|
|
679
689
|
return isLocalized ? block.value.map((v) => v[locale] || v["en"]) : [...block.value];
|
|
@@ -1439,213 +1449,6 @@ var createNewsletterApi = (apiConfig) => {
|
|
|
1439
1449
|
};
|
|
1440
1450
|
};
|
|
1441
1451
|
|
|
1442
|
-
// src/api/emailTemplate.ts
|
|
1443
|
-
var createEmailTemplateApi = (apiConfig) => {
|
|
1444
|
-
return {
|
|
1445
|
-
/**
|
|
1446
|
-
* List all email templates for the business
|
|
1447
|
-
* Returns paginated list of email templates
|
|
1448
|
-
*/
|
|
1449
|
-
async getTemplates(params, options) {
|
|
1450
|
-
const businessId = params?.businessId || apiConfig.businessId;
|
|
1451
|
-
const queryParams = {};
|
|
1452
|
-
if (params?.key) queryParams.key = params.key;
|
|
1453
|
-
if (params?.keys) queryParams.keys = params.keys;
|
|
1454
|
-
if (params?.query) queryParams.query = params.query;
|
|
1455
|
-
if (params?.limit) queryParams.limit = params.limit;
|
|
1456
|
-
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1457
|
-
return apiConfig.httpClient.get(
|
|
1458
|
-
`/v1/businesses/${businessId}/email-templates`,
|
|
1459
|
-
{ ...options, params: queryParams }
|
|
1460
|
-
);
|
|
1461
|
-
},
|
|
1462
|
-
/**
|
|
1463
|
-
* Get a specific email template by ID
|
|
1464
|
-
*/
|
|
1465
|
-
async getTemplate(params, options) {
|
|
1466
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1467
|
-
return apiConfig.httpClient.get(
|
|
1468
|
-
`/v1/businesses/${businessId}/email-templates/${params.id}`,
|
|
1469
|
-
options
|
|
1470
|
-
);
|
|
1471
|
-
},
|
|
1472
|
-
/**
|
|
1473
|
-
* Get a specific email template by key
|
|
1474
|
-
*/
|
|
1475
|
-
async getTemplateByKey(params, options) {
|
|
1476
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1477
|
-
return apiConfig.httpClient.get(
|
|
1478
|
-
`/v1/businesses/${businessId}/email-templates/by-key/${params.key}`,
|
|
1479
|
-
options
|
|
1480
|
-
);
|
|
1481
|
-
},
|
|
1482
|
-
/**
|
|
1483
|
-
* Create a new email template
|
|
1484
|
-
*/
|
|
1485
|
-
async createTemplate(params, options) {
|
|
1486
|
-
const { businessId: paramBusinessId, ...body } = params;
|
|
1487
|
-
const businessId = paramBusinessId || apiConfig.businessId;
|
|
1488
|
-
return apiConfig.httpClient.post(
|
|
1489
|
-
`/v1/businesses/${businessId}/email-templates`,
|
|
1490
|
-
body,
|
|
1491
|
-
options
|
|
1492
|
-
);
|
|
1493
|
-
},
|
|
1494
|
-
/**
|
|
1495
|
-
* Update an existing email template
|
|
1496
|
-
*/
|
|
1497
|
-
async updateTemplate(params, options) {
|
|
1498
|
-
const { id, businessId: paramBusinessId, ...body } = params;
|
|
1499
|
-
const businessId = paramBusinessId || apiConfig.businessId;
|
|
1500
|
-
return apiConfig.httpClient.put(
|
|
1501
|
-
`/v1/businesses/${businessId}/email-templates/${id}`,
|
|
1502
|
-
body,
|
|
1503
|
-
options
|
|
1504
|
-
);
|
|
1505
|
-
},
|
|
1506
|
-
/**
|
|
1507
|
-
* Delete an email template
|
|
1508
|
-
*/
|
|
1509
|
-
async deleteTemplate(params, options) {
|
|
1510
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1511
|
-
return apiConfig.httpClient.delete(
|
|
1512
|
-
`/v1/businesses/${businessId}/email-templates/${params.id}`,
|
|
1513
|
-
options
|
|
1514
|
-
);
|
|
1515
|
-
}
|
|
1516
|
-
};
|
|
1517
|
-
};
|
|
1518
|
-
|
|
1519
|
-
// src/api/taxonomy.ts
|
|
1520
|
-
var createTaxonomyApi = (apiConfig) => {
|
|
1521
|
-
return {
|
|
1522
|
-
async getTaxonomies(params, options) {
|
|
1523
|
-
return apiConfig.httpClient.get(
|
|
1524
|
-
`/v1/businesses/${apiConfig.businessId}/taxonomies`,
|
|
1525
|
-
{
|
|
1526
|
-
...options,
|
|
1527
|
-
params
|
|
1528
|
-
}
|
|
1529
|
-
);
|
|
1530
|
-
},
|
|
1531
|
-
async getTaxonomy(params, options) {
|
|
1532
|
-
return apiConfig.httpClient.get(
|
|
1533
|
-
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}`,
|
|
1534
|
-
options
|
|
1535
|
-
);
|
|
1536
|
-
},
|
|
1537
|
-
async createTaxonomy(params, options) {
|
|
1538
|
-
return apiConfig.httpClient.post(
|
|
1539
|
-
`/v1/businesses/${apiConfig.businessId}/taxonomies`,
|
|
1540
|
-
params,
|
|
1541
|
-
options
|
|
1542
|
-
);
|
|
1543
|
-
},
|
|
1544
|
-
async updateTaxonomy(params, options) {
|
|
1545
|
-
return apiConfig.httpClient.put(
|
|
1546
|
-
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}`,
|
|
1547
|
-
params,
|
|
1548
|
-
options
|
|
1549
|
-
);
|
|
1550
|
-
},
|
|
1551
|
-
async deleteTaxonomy(params, options) {
|
|
1552
|
-
return apiConfig.httpClient.delete(
|
|
1553
|
-
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}`,
|
|
1554
|
-
options
|
|
1555
|
-
);
|
|
1556
|
-
},
|
|
1557
|
-
async getTaxonomyChildren(params, options) {
|
|
1558
|
-
return apiConfig.httpClient.get(
|
|
1559
|
-
`/v1/businesses/${apiConfig.businessId}/taxonomies/${params.id}/children`,
|
|
1560
|
-
options
|
|
1561
|
-
);
|
|
1562
|
-
},
|
|
1563
|
-
async getRootTaxonomies(scope, options) {
|
|
1564
|
-
const result = await apiConfig.httpClient.get(
|
|
1565
|
-
`/v1/businesses/${apiConfig.businessId}/taxonomies`,
|
|
1566
|
-
{
|
|
1567
|
-
...options,
|
|
1568
|
-
params: { scope, root: true }
|
|
1569
|
-
}
|
|
1570
|
-
);
|
|
1571
|
-
return result.items || [];
|
|
1572
|
-
}
|
|
1573
|
-
};
|
|
1574
|
-
};
|
|
1575
|
-
|
|
1576
|
-
// src/api/form.ts
|
|
1577
|
-
var createFormApi = (apiConfig) => {
|
|
1578
|
-
return {
|
|
1579
|
-
// Form CRUD
|
|
1580
|
-
async getForms(params, options) {
|
|
1581
|
-
return apiConfig.httpClient.get(
|
|
1582
|
-
`/v1/businesses/${apiConfig.businessId}/forms`,
|
|
1583
|
-
{
|
|
1584
|
-
...options,
|
|
1585
|
-
params
|
|
1586
|
-
}
|
|
1587
|
-
);
|
|
1588
|
-
},
|
|
1589
|
-
async getForm(params, options) {
|
|
1590
|
-
return apiConfig.httpClient.get(
|
|
1591
|
-
`/v1/businesses/${apiConfig.businessId}/forms/${params.id}`,
|
|
1592
|
-
options
|
|
1593
|
-
);
|
|
1594
|
-
},
|
|
1595
|
-
async createForm(params, options) {
|
|
1596
|
-
return apiConfig.httpClient.post(
|
|
1597
|
-
`/v1/businesses/${apiConfig.businessId}/forms`,
|
|
1598
|
-
params,
|
|
1599
|
-
options
|
|
1600
|
-
);
|
|
1601
|
-
},
|
|
1602
|
-
async updateForm(params, options) {
|
|
1603
|
-
return apiConfig.httpClient.put(
|
|
1604
|
-
`/v1/businesses/${apiConfig.businessId}/forms/${params.id}`,
|
|
1605
|
-
params,
|
|
1606
|
-
options
|
|
1607
|
-
);
|
|
1608
|
-
},
|
|
1609
|
-
async deleteForm(params, options) {
|
|
1610
|
-
return apiConfig.httpClient.delete(
|
|
1611
|
-
`/v1/businesses/${apiConfig.businessId}/forms/${params.id}`,
|
|
1612
|
-
options
|
|
1613
|
-
);
|
|
1614
|
-
},
|
|
1615
|
-
// Form Entry CRUD
|
|
1616
|
-
async getEntries(params, options) {
|
|
1617
|
-
const { formId, ...queryParams } = params;
|
|
1618
|
-
return apiConfig.httpClient.get(
|
|
1619
|
-
`/v1/businesses/${apiConfig.businessId}/forms/${formId}/entries`,
|
|
1620
|
-
{
|
|
1621
|
-
...options,
|
|
1622
|
-
params: queryParams
|
|
1623
|
-
}
|
|
1624
|
-
);
|
|
1625
|
-
},
|
|
1626
|
-
async createEntry(params, options) {
|
|
1627
|
-
const { formId, ...body } = params;
|
|
1628
|
-
return apiConfig.httpClient.post(
|
|
1629
|
-
`/v1/businesses/${apiConfig.businessId}/forms/${formId}/entries`,
|
|
1630
|
-
body,
|
|
1631
|
-
options
|
|
1632
|
-
);
|
|
1633
|
-
},
|
|
1634
|
-
async getEntry(params, options) {
|
|
1635
|
-
return apiConfig.httpClient.get(
|
|
1636
|
-
`/v1/businesses/${apiConfig.businessId}/forms/${params.formId}/entries/${params.entryId}`,
|
|
1637
|
-
options
|
|
1638
|
-
);
|
|
1639
|
-
},
|
|
1640
|
-
async deleteEntry(params, options) {
|
|
1641
|
-
return apiConfig.httpClient.delete(
|
|
1642
|
-
`/v1/businesses/${apiConfig.businessId}/forms/${params.formId}/entries/${params.entryId}`,
|
|
1643
|
-
options
|
|
1644
|
-
);
|
|
1645
|
-
}
|
|
1646
|
-
};
|
|
1647
|
-
};
|
|
1648
|
-
|
|
1649
1452
|
// src/utils/currency.ts
|
|
1650
1453
|
function getCurrencySymbol(currency) {
|
|
1651
1454
|
const currencySymbols = {
|
|
@@ -2032,7 +1835,7 @@ function nameToKey(name) {
|
|
|
2032
1835
|
}
|
|
2033
1836
|
|
|
2034
1837
|
// src/index.ts
|
|
2035
|
-
var SDK_VERSION = "0.3.
|
|
1838
|
+
var SDK_VERSION = "0.3.130";
|
|
2036
1839
|
var SUPPORTED_FRAMEWORKS = [
|
|
2037
1840
|
"astro",
|
|
2038
1841
|
"react",
|
|
@@ -2084,9 +1887,6 @@ async function createArkySDK(config) {
|
|
|
2084
1887
|
featureFlags: createFeatureFlagsApi(apiConfig),
|
|
2085
1888
|
location: createLocationApi(apiConfig),
|
|
2086
1889
|
newsletter: createNewsletterApi(apiConfig),
|
|
2087
|
-
emailTemplate: createEmailTemplateApi(apiConfig),
|
|
2088
|
-
taxonomy: createTaxonomyApi(apiConfig),
|
|
2089
|
-
form: createFormApi(apiConfig),
|
|
2090
1890
|
setBusinessId: (businessId) => {
|
|
2091
1891
|
apiConfig.businessId = businessId;
|
|
2092
1892
|
},
|
|
@@ -2151,7 +1951,6 @@ async function createArkySDK(config) {
|
|
|
2151
1951
|
exports.PaymentMethodType = PaymentMethodType;
|
|
2152
1952
|
exports.SDK_VERSION = SDK_VERSION;
|
|
2153
1953
|
exports.SUPPORTED_FRAMEWORKS = SUPPORTED_FRAMEWORKS;
|
|
2154
|
-
exports.TaxonomyScope = TaxonomyScope;
|
|
2155
1954
|
exports.createArkySDK = createArkySDK;
|
|
2156
1955
|
//# sourceMappingURL=index.cjs.map
|
|
2157
1956
|
//# sourceMappingURL=index.cjs.map
|