arky-sdk 0.4.40 → 0.4.41
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 +35 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +86 -7
- package/dist/types.d.ts +86 -7
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1373,6 +1373,40 @@ var createPlatformApi = (apiConfig) => {
|
|
|
1373
1373
|
};
|
|
1374
1374
|
};
|
|
1375
1375
|
|
|
1376
|
+
// src/api/shipping.ts
|
|
1377
|
+
var createShippingApi = (apiConfig) => {
|
|
1378
|
+
return {
|
|
1379
|
+
/**
|
|
1380
|
+
* Get available shipping rates for an order
|
|
1381
|
+
*/
|
|
1382
|
+
async getRates(params, options) {
|
|
1383
|
+
return apiConfig.httpClient.post(
|
|
1384
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${params.orderId}/shipping/rates`,
|
|
1385
|
+
{
|
|
1386
|
+
parcel: params.parcel,
|
|
1387
|
+
toAddress: params.toAddress,
|
|
1388
|
+
fromAddress: params.fromAddress
|
|
1389
|
+
},
|
|
1390
|
+
options
|
|
1391
|
+
);
|
|
1392
|
+
},
|
|
1393
|
+
/**
|
|
1394
|
+
* Purchase a shipping label using a selected rate
|
|
1395
|
+
*/
|
|
1396
|
+
async purchaseLabel(params, options) {
|
|
1397
|
+
return apiConfig.httpClient.post(
|
|
1398
|
+
`/v1/businesses/${apiConfig.businessId}/orders/${params.orderId}/shipping/purchase`,
|
|
1399
|
+
{
|
|
1400
|
+
rateId: params.rateId,
|
|
1401
|
+
carrier: params.carrier,
|
|
1402
|
+
service: params.service
|
|
1403
|
+
},
|
|
1404
|
+
options
|
|
1405
|
+
);
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1376
1410
|
// src/utils/price.ts
|
|
1377
1411
|
function formatCurrency(amount, currencyCode, locale = "en") {
|
|
1378
1412
|
return new Intl.NumberFormat(locale, {
|
|
@@ -1693,6 +1727,7 @@ async function createArkySDK(config) {
|
|
|
1693
1727
|
network: createNetworkApi(apiConfig),
|
|
1694
1728
|
workflow: createWorkflowApi(apiConfig),
|
|
1695
1729
|
audience: createAudienceApi(apiConfig),
|
|
1730
|
+
shipping: createShippingApi(apiConfig),
|
|
1696
1731
|
analytics: {
|
|
1697
1732
|
track
|
|
1698
1733
|
},
|