arky-sdk 0.5.25 → 0.5.26
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-Bz8k50In.d.cts → index-CKhy7-_4.d.cts} +3 -3
- package/dist/{index-BfZKq1T6.d.ts → index-NTnAG84Y.d.ts} +3 -3
- package/dist/index.cjs +51 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +51 -4
- 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 +4 -4
- 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 +4 -4
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Payment, InventoryLevel,
|
|
1
|
+
import { Payment, InventoryLevel, Integration } 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,11 +40,11 @@ declare function getInventoryAt(variant: VariantWithInventory, locationId: strin
|
|
|
40
40
|
*/
|
|
41
41
|
declare function getFirstAvailableFCId(variant: VariantWithInventory, quantity?: number): string | undefined;
|
|
42
42
|
|
|
43
|
-
declare function getPaymentConfig(
|
|
43
|
+
declare function getPaymentConfig(integrations: Integration[]): {
|
|
44
44
|
publishableKey: string;
|
|
45
45
|
currency: string;
|
|
46
46
|
} | null;
|
|
47
|
-
declare function getAnalyticsConfigs(
|
|
47
|
+
declare function getAnalyticsConfigs(integrations: Integration[]): {
|
|
48
48
|
measurementId: string;
|
|
49
49
|
}[];
|
|
50
50
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Payment, InventoryLevel,
|
|
1
|
+
import { Payment, InventoryLevel, Integration } 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,11 +40,11 @@ declare function getInventoryAt(variant: VariantWithInventory, locationId: strin
|
|
|
40
40
|
*/
|
|
41
41
|
declare function getFirstAvailableFCId(variant: VariantWithInventory, quantity?: number): string | undefined;
|
|
42
42
|
|
|
43
|
-
declare function getPaymentConfig(
|
|
43
|
+
declare function getPaymentConfig(integrations: Integration[]): {
|
|
44
44
|
publishableKey: string;
|
|
45
45
|
currency: string;
|
|
46
46
|
} | null;
|
|
47
|
-
declare function getAnalyticsConfigs(
|
|
47
|
+
declare function getAnalyticsConfigs(integrations: Integration[]): {
|
|
48
48
|
measurementId: string;
|
|
49
49
|
}[];
|
|
50
50
|
|
package/dist/index.cjs
CHANGED
|
@@ -405,6 +405,53 @@ 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 getPaymentConfig(params, options) {
|
|
445
|
+
return apiConfig.httpClient.get(
|
|
446
|
+
`/v1/businesses/${params.businessId}/integrations/payment`,
|
|
447
|
+
options
|
|
448
|
+
);
|
|
449
|
+
},
|
|
450
|
+
async getShippingConfig(params, options) {
|
|
451
|
+
return apiConfig.httpClient.get(
|
|
452
|
+
`/v1/businesses/${params.businessId}/integrations/shipping`,
|
|
453
|
+
options
|
|
454
|
+
);
|
|
408
455
|
}
|
|
409
456
|
};
|
|
410
457
|
};
|
|
@@ -1677,13 +1724,13 @@ function getFirstAvailableFCId(variant, quantity = 1) {
|
|
|
1677
1724
|
}
|
|
1678
1725
|
|
|
1679
1726
|
// src/utils/integrations.ts
|
|
1680
|
-
function getPaymentConfig(
|
|
1681
|
-
const i =
|
|
1727
|
+
function getPaymentConfig(integrations) {
|
|
1728
|
+
const i = integrations?.find((i2) => i2.provider?.type === "stripe" && i2.provider.activeForCardPayments);
|
|
1682
1729
|
if (!i || i.provider?.type !== "stripe") return null;
|
|
1683
1730
|
return { publishableKey: i.provider.publishableKey, currency: i.provider.currency };
|
|
1684
1731
|
}
|
|
1685
|
-
function getAnalyticsConfigs(
|
|
1686
|
-
return (
|
|
1732
|
+
function getAnalyticsConfigs(integrations) {
|
|
1733
|
+
return (integrations || []).filter((i) => i.provider?.type === "google_analytics4" && i.provider.activeForTracking).map((i) => {
|
|
1687
1734
|
if (i.provider.type === "google_analytics4") {
|
|
1688
1735
|
return { measurementId: i.provider.measurementId };
|
|
1689
1736
|
}
|