arky-sdk 0.5.25 → 0.5.27
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-BfZKq1T6.d.ts → index-Cjdv3omy.d.cts} +2 -10
- package/dist/{index-Bz8k50In.d.cts → index-UQfW3UpN.d.ts} +2 -10
- package/dist/index.cjs +48 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -5
- package/dist/index.d.ts +12 -5
- package/dist/index.js +48 -26
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +25 -3
- package/dist/types.d.ts +25 -3
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +0 -17
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -16
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Payment, InventoryLevel
|
|
1
|
+
import { Payment, InventoryLevel } from './types.cjs';
|
|
2
2
|
|
|
3
3
|
declare function convertToMajor(minorAmount: number, currency: string): number;
|
|
4
4
|
declare function convertToMinor(majorAmount: number, currency: string): number;
|
|
@@ -40,12 +40,4 @@ declare function getInventoryAt(variant: VariantWithInventory, locationId: strin
|
|
|
40
40
|
*/
|
|
41
41
|
declare function getFirstAvailableFCId(variant: VariantWithInventory, quantity?: number): string | undefined;
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
publishableKey: string;
|
|
45
|
-
currency: string;
|
|
46
|
-
} | null;
|
|
47
|
-
declare function getAnalyticsConfigs(configs: BusinessConfig): {
|
|
48
|
-
measurementId: string;
|
|
49
|
-
}[];
|
|
50
|
-
|
|
51
|
-
export { formatMinor as a, getCurrencyName as b, getAvailableStock as c, getReservedStock as d, getInventoryAt as e, formatPayment as f, getCurrencySymbol as g, hasStock as h, isValidKey as i, getFirstAvailableFCId as j, getPaymentConfig as k, getAnalyticsConfigs as l, convertToMajor as m, nameToKey as n, convertToMinor as o, toKey as t, validateKey as v };
|
|
43
|
+
export { formatMinor as a, getCurrencyName as b, getAvailableStock as c, getReservedStock as d, getInventoryAt as e, formatPayment as f, getCurrencySymbol as g, hasStock as h, isValidKey as i, getFirstAvailableFCId as j, convertToMajor as k, convertToMinor as l, nameToKey as n, toKey as t, validateKey as v };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Payment, InventoryLevel
|
|
1
|
+
import { Payment, InventoryLevel } from './types.js';
|
|
2
2
|
|
|
3
3
|
declare function convertToMajor(minorAmount: number, currency: string): number;
|
|
4
4
|
declare function convertToMinor(majorAmount: number, currency: string): number;
|
|
@@ -40,12 +40,4 @@ declare function getInventoryAt(variant: VariantWithInventory, locationId: strin
|
|
|
40
40
|
*/
|
|
41
41
|
declare function getFirstAvailableFCId(variant: VariantWithInventory, quantity?: number): string | undefined;
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
publishableKey: string;
|
|
45
|
-
currency: string;
|
|
46
|
-
} | null;
|
|
47
|
-
declare function getAnalyticsConfigs(configs: BusinessConfig): {
|
|
48
|
-
measurementId: string;
|
|
49
|
-
}[];
|
|
50
|
-
|
|
51
|
-
export { formatMinor as a, getCurrencyName as b, getAvailableStock as c, getReservedStock as d, getInventoryAt as e, formatPayment as f, getCurrencySymbol as g, hasStock as h, isValidKey as i, getFirstAvailableFCId as j, getPaymentConfig as k, getAnalyticsConfigs as l, convertToMajor as m, nameToKey as n, convertToMinor as o, toKey as t, validateKey as v };
|
|
43
|
+
export { formatMinor as a, getCurrencyName as b, getAvailableStock as c, getReservedStock as d, getInventoryAt as e, formatPayment as f, getCurrencySymbol as g, hasStock as h, isValidKey as i, getFirstAvailableFCId as j, convertToMajor as k, convertToMinor as l, nameToKey as n, toKey as t, validateKey as v };
|
package/dist/index.cjs
CHANGED
|
@@ -405,6 +405,47 @@ var createBusinessApi = (apiConfig) => {
|
|
|
405
405
|
{ provider: params.provider },
|
|
406
406
|
options
|
|
407
407
|
);
|
|
408
|
+
},
|
|
409
|
+
// ── Integration CRUD ──
|
|
410
|
+
async listIntegrations(params, options) {
|
|
411
|
+
return apiConfig.httpClient.get(
|
|
412
|
+
`/v1/businesses/${params.businessId}/integrations`,
|
|
413
|
+
options
|
|
414
|
+
);
|
|
415
|
+
},
|
|
416
|
+
async getIntegration(params, options) {
|
|
417
|
+
return apiConfig.httpClient.get(
|
|
418
|
+
`/v1/businesses/${params.businessId}/integrations/${params.id}`,
|
|
419
|
+
options
|
|
420
|
+
);
|
|
421
|
+
},
|
|
422
|
+
async createIntegration(params, options) {
|
|
423
|
+
const { businessId, ...payload } = params;
|
|
424
|
+
return apiConfig.httpClient.post(
|
|
425
|
+
`/v1/businesses/${businessId}/integrations`,
|
|
426
|
+
payload,
|
|
427
|
+
options
|
|
428
|
+
);
|
|
429
|
+
},
|
|
430
|
+
async updateIntegration(params, options) {
|
|
431
|
+
const { businessId, id, ...payload } = params;
|
|
432
|
+
return apiConfig.httpClient.put(
|
|
433
|
+
`/v1/businesses/${businessId}/integrations/${id}`,
|
|
434
|
+
payload,
|
|
435
|
+
options
|
|
436
|
+
);
|
|
437
|
+
},
|
|
438
|
+
async deleteIntegration(params, options) {
|
|
439
|
+
return apiConfig.httpClient.delete(
|
|
440
|
+
`/v1/businesses/${params.businessId}/integrations/${params.id}`,
|
|
441
|
+
options
|
|
442
|
+
);
|
|
443
|
+
},
|
|
444
|
+
async getIntegrationConfig(params, options) {
|
|
445
|
+
return apiConfig.httpClient.get(
|
|
446
|
+
`/v1/businesses/${params.businessId}/integrations/config/${params.type}`,
|
|
447
|
+
options
|
|
448
|
+
);
|
|
408
449
|
}
|
|
409
450
|
};
|
|
410
451
|
};
|
|
@@ -1676,23 +1717,8 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
1676
1717
|
return inv?.locationId;
|
|
1677
1718
|
}
|
|
1678
1719
|
|
|
1679
|
-
// src/utils/integrations.ts
|
|
1680
|
-
function getPaymentConfig(configs) {
|
|
1681
|
-
const i = configs.integrations?.find((i2) => i2.provider?.type === "stripe" && i2.provider.activeForCardPayments);
|
|
1682
|
-
if (!i || i.provider?.type !== "stripe") return null;
|
|
1683
|
-
return { publishableKey: i.provider.publishableKey, currency: i.provider.currency };
|
|
1684
|
-
}
|
|
1685
|
-
function getAnalyticsConfigs(configs) {
|
|
1686
|
-
return (configs.integrations || []).filter((i) => i.provider?.type === "google_analytics4" && i.provider.activeForTracking).map((i) => {
|
|
1687
|
-
if (i.provider.type === "google_analytics4") {
|
|
1688
|
-
return { measurementId: i.provider.measurementId };
|
|
1689
|
-
}
|
|
1690
|
-
return null;
|
|
1691
|
-
}).filter(Boolean);
|
|
1692
|
-
}
|
|
1693
|
-
|
|
1694
1720
|
// src/index.ts
|
|
1695
|
-
var SDK_VERSION = "0.5.
|
|
1721
|
+
var SDK_VERSION = "0.5.27";
|
|
1696
1722
|
var SUPPORTED_FRAMEWORKS = [
|
|
1697
1723
|
"astro",
|
|
1698
1724
|
"react",
|
|
@@ -1717,13 +1743,11 @@ async function createArkySDK(config) {
|
|
|
1717
1743
|
const businessApi = createBusinessApi(apiConfig);
|
|
1718
1744
|
const platformApi = createPlatformApi(apiConfig);
|
|
1719
1745
|
if (typeof window !== "undefined") {
|
|
1720
|
-
businessApi.
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
injectGA4Script(i.provider.measurementId);
|
|
1726
|
-
}
|
|
1746
|
+
businessApi.getIntegrationConfig({ businessId: apiConfig.businessId, type: "analytics" }).then((configs) => {
|
|
1747
|
+
if (!configs) return;
|
|
1748
|
+
for (const c of Array.isArray(configs) ? configs : [configs]) {
|
|
1749
|
+
if (c.measurementId) {
|
|
1750
|
+
injectGA4Script(c.measurementId);
|
|
1727
1751
|
}
|
|
1728
1752
|
}
|
|
1729
1753
|
}).catch(() => {
|
|
@@ -1801,9 +1825,7 @@ async function createArkySDK(config) {
|
|
|
1801
1825
|
getReservedStock,
|
|
1802
1826
|
hasStock,
|
|
1803
1827
|
getInventoryAt,
|
|
1804
|
-
getFirstAvailableFCId
|
|
1805
|
-
getPaymentConfig,
|
|
1806
|
-
getAnalyticsConfigs
|
|
1828
|
+
getFirstAvailableFCId
|
|
1807
1829
|
}
|
|
1808
1830
|
};
|
|
1809
1831
|
return sdk;
|