arky-sdk 0.5.52 → 0.5.53
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 +208 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -2
- package/dist/index.d.ts +27 -2
- package/dist/index.js +208 -0
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +177 -17
- package/dist/types.d.ts +177 -17
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1444,6 +1444,211 @@ var createAgentApi = (apiConfig) => {
|
|
|
1444
1444
|
};
|
|
1445
1445
|
};
|
|
1446
1446
|
|
|
1447
|
+
// src/api/emailTemplate.ts
|
|
1448
|
+
var createEmailTemplateApi = (apiConfig) => {
|
|
1449
|
+
return {
|
|
1450
|
+
async createEmailTemplate(params, options) {
|
|
1451
|
+
const { businessId, ...payload } = params;
|
|
1452
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1453
|
+
return apiConfig.httpClient.post(
|
|
1454
|
+
`/v1/businesses/${targetBusinessId}/email-templates`,
|
|
1455
|
+
payload,
|
|
1456
|
+
options
|
|
1457
|
+
);
|
|
1458
|
+
},
|
|
1459
|
+
async updateEmailTemplate(params, options) {
|
|
1460
|
+
const { businessId, ...payload } = params;
|
|
1461
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1462
|
+
return apiConfig.httpClient.put(
|
|
1463
|
+
`/v1/businesses/${targetBusinessId}/email-templates/${params.id}`,
|
|
1464
|
+
payload,
|
|
1465
|
+
options
|
|
1466
|
+
);
|
|
1467
|
+
},
|
|
1468
|
+
async deleteEmailTemplate(params, options) {
|
|
1469
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1470
|
+
return apiConfig.httpClient.delete(
|
|
1471
|
+
`/v1/businesses/${targetBusinessId}/email-templates/${params.id}`,
|
|
1472
|
+
options
|
|
1473
|
+
);
|
|
1474
|
+
},
|
|
1475
|
+
async getEmailTemplate(params, options) {
|
|
1476
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1477
|
+
let identifier;
|
|
1478
|
+
if (params.id) {
|
|
1479
|
+
identifier = params.id;
|
|
1480
|
+
} else if (params.key) {
|
|
1481
|
+
identifier = `${targetBusinessId}:${params.key}`;
|
|
1482
|
+
} else {
|
|
1483
|
+
throw new Error("GetEmailTemplateParams requires id or key");
|
|
1484
|
+
}
|
|
1485
|
+
return apiConfig.httpClient.get(
|
|
1486
|
+
`/v1/businesses/${targetBusinessId}/email-templates/${identifier}`,
|
|
1487
|
+
options
|
|
1488
|
+
);
|
|
1489
|
+
},
|
|
1490
|
+
async getEmailTemplates(params, options) {
|
|
1491
|
+
const { businessId, ...queryParams } = params;
|
|
1492
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1493
|
+
return apiConfig.httpClient.get(
|
|
1494
|
+
`/v1/businesses/${targetBusinessId}/email-templates`,
|
|
1495
|
+
{
|
|
1496
|
+
...options,
|
|
1497
|
+
params: queryParams
|
|
1498
|
+
}
|
|
1499
|
+
);
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
};
|
|
1503
|
+
|
|
1504
|
+
// src/api/form.ts
|
|
1505
|
+
var createFormApi = (apiConfig) => {
|
|
1506
|
+
return {
|
|
1507
|
+
async createForm(params, options) {
|
|
1508
|
+
const { businessId, ...payload } = params;
|
|
1509
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1510
|
+
return apiConfig.httpClient.post(
|
|
1511
|
+
`/v1/businesses/${targetBusinessId}/forms`,
|
|
1512
|
+
payload,
|
|
1513
|
+
options
|
|
1514
|
+
);
|
|
1515
|
+
},
|
|
1516
|
+
async updateForm(params, options) {
|
|
1517
|
+
const { businessId, ...payload } = params;
|
|
1518
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1519
|
+
return apiConfig.httpClient.put(
|
|
1520
|
+
`/v1/businesses/${targetBusinessId}/forms/${params.id}`,
|
|
1521
|
+
payload,
|
|
1522
|
+
options
|
|
1523
|
+
);
|
|
1524
|
+
},
|
|
1525
|
+
async deleteForm(params, options) {
|
|
1526
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1527
|
+
return apiConfig.httpClient.delete(
|
|
1528
|
+
`/v1/businesses/${targetBusinessId}/forms/${params.id}`,
|
|
1529
|
+
options
|
|
1530
|
+
);
|
|
1531
|
+
},
|
|
1532
|
+
async getForm(params, options) {
|
|
1533
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1534
|
+
let identifier;
|
|
1535
|
+
if (params.id) {
|
|
1536
|
+
identifier = params.id;
|
|
1537
|
+
} else if (params.key) {
|
|
1538
|
+
identifier = `${targetBusinessId}:${params.key}`;
|
|
1539
|
+
} else {
|
|
1540
|
+
throw new Error("GetFormParams requires id or key");
|
|
1541
|
+
}
|
|
1542
|
+
return apiConfig.httpClient.get(
|
|
1543
|
+
`/v1/businesses/${targetBusinessId}/forms/${identifier}`,
|
|
1544
|
+
options
|
|
1545
|
+
);
|
|
1546
|
+
},
|
|
1547
|
+
async getForms(params, options) {
|
|
1548
|
+
const { businessId, ...queryParams } = params;
|
|
1549
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1550
|
+
return apiConfig.httpClient.get(
|
|
1551
|
+
`/v1/businesses/${targetBusinessId}/forms`,
|
|
1552
|
+
{
|
|
1553
|
+
...options,
|
|
1554
|
+
params: queryParams
|
|
1555
|
+
}
|
|
1556
|
+
);
|
|
1557
|
+
},
|
|
1558
|
+
async submit(params, options) {
|
|
1559
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1560
|
+
return apiConfig.httpClient.post(
|
|
1561
|
+
`/v1/businesses/${targetBusinessId}/forms/${params.formId}/submissions`,
|
|
1562
|
+
{ formId: params.formId, businessId: targetBusinessId, blocks: params.blocks },
|
|
1563
|
+
options
|
|
1564
|
+
);
|
|
1565
|
+
},
|
|
1566
|
+
async getSubmissions(params, options) {
|
|
1567
|
+
const { businessId, formId, ...queryParams } = params;
|
|
1568
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1569
|
+
return apiConfig.httpClient.get(
|
|
1570
|
+
`/v1/businesses/${targetBusinessId}/forms/${formId}/submissions`,
|
|
1571
|
+
{
|
|
1572
|
+
...options,
|
|
1573
|
+
params: { ...queryParams, formId, businessId: targetBusinessId }
|
|
1574
|
+
}
|
|
1575
|
+
);
|
|
1576
|
+
},
|
|
1577
|
+
async getSubmission(params, options) {
|
|
1578
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1579
|
+
return apiConfig.httpClient.get(
|
|
1580
|
+
`/v1/businesses/${targetBusinessId}/forms/${params.formId}/submissions/${params.id}`,
|
|
1581
|
+
options
|
|
1582
|
+
);
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
// src/api/taxonomy.ts
|
|
1588
|
+
var createTaxonomyApi = (apiConfig) => {
|
|
1589
|
+
return {
|
|
1590
|
+
async createTaxonomy(params, options) {
|
|
1591
|
+
const { businessId, ...payload } = params;
|
|
1592
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1593
|
+
return apiConfig.httpClient.post(
|
|
1594
|
+
`/v1/businesses/${targetBusinessId}/taxonomies`,
|
|
1595
|
+
payload,
|
|
1596
|
+
options
|
|
1597
|
+
);
|
|
1598
|
+
},
|
|
1599
|
+
async updateTaxonomy(params, options) {
|
|
1600
|
+
const { businessId, ...payload } = params;
|
|
1601
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1602
|
+
return apiConfig.httpClient.put(
|
|
1603
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${params.id}`,
|
|
1604
|
+
payload,
|
|
1605
|
+
options
|
|
1606
|
+
);
|
|
1607
|
+
},
|
|
1608
|
+
async deleteTaxonomy(params, options) {
|
|
1609
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1610
|
+
return apiConfig.httpClient.delete(
|
|
1611
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${params.id}`,
|
|
1612
|
+
options
|
|
1613
|
+
);
|
|
1614
|
+
},
|
|
1615
|
+
async getTaxonomy(params, options) {
|
|
1616
|
+
const targetBusinessId = params.businessId || apiConfig.businessId;
|
|
1617
|
+
let identifier;
|
|
1618
|
+
if (params.id) {
|
|
1619
|
+
identifier = params.id;
|
|
1620
|
+
} else if (params.key) {
|
|
1621
|
+
identifier = `${targetBusinessId}:${params.key}`;
|
|
1622
|
+
} else {
|
|
1623
|
+
throw new Error("GetTaxonomyParams requires id or key");
|
|
1624
|
+
}
|
|
1625
|
+
return apiConfig.httpClient.get(
|
|
1626
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${identifier}`,
|
|
1627
|
+
options
|
|
1628
|
+
);
|
|
1629
|
+
},
|
|
1630
|
+
async getTaxonomies(params, options) {
|
|
1631
|
+
const { businessId, ...queryParams } = params;
|
|
1632
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1633
|
+
return apiConfig.httpClient.get(
|
|
1634
|
+
`/v1/businesses/${targetBusinessId}/taxonomies`,
|
|
1635
|
+
{
|
|
1636
|
+
...options,
|
|
1637
|
+
params: queryParams
|
|
1638
|
+
}
|
|
1639
|
+
);
|
|
1640
|
+
},
|
|
1641
|
+
async getTaxonomyChildren(params, options) {
|
|
1642
|
+
const { id, businessId } = params;
|
|
1643
|
+
const targetBusinessId = businessId || apiConfig.businessId;
|
|
1644
|
+
return apiConfig.httpClient.get(
|
|
1645
|
+
`/v1/businesses/${targetBusinessId}/taxonomies/${id}/children`,
|
|
1646
|
+
options
|
|
1647
|
+
);
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1447
1652
|
// src/utils/price.ts
|
|
1448
1653
|
function formatCurrency(amount, currencyCode, locale = "en") {
|
|
1449
1654
|
return new Intl.NumberFormat(locale, {
|
|
@@ -1766,6 +1971,9 @@ async function createArkySDK(config) {
|
|
|
1766
1971
|
audience: createAudienceApi(apiConfig),
|
|
1767
1972
|
shipping: createShippingApi(apiConfig),
|
|
1768
1973
|
agent: createAgentApi(apiConfig),
|
|
1974
|
+
emailTemplate: createEmailTemplateApi(apiConfig),
|
|
1975
|
+
form: createFormApi(apiConfig),
|
|
1976
|
+
taxonomy: createTaxonomyApi(apiConfig),
|
|
1769
1977
|
analytics: {
|
|
1770
1978
|
track
|
|
1771
1979
|
},
|