arky-sdk 0.3.133 → 0.3.135
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 +146 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +146 -26
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +37 -14
- package/dist/types.d.ts +37 -14
- package/dist/types.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -22,6 +22,23 @@ interface HttpClientConfig {
|
|
|
22
22
|
isAuthenticated?: () => boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
interface NetworkSearchParams {
|
|
26
|
+
query?: string;
|
|
27
|
+
limit?: number;
|
|
28
|
+
cursor?: string;
|
|
29
|
+
nodeId?: string;
|
|
30
|
+
nodeIds?: string[];
|
|
31
|
+
statuses?: string[];
|
|
32
|
+
blocks?: any[];
|
|
33
|
+
sortField?: string;
|
|
34
|
+
sortDirection?: "asc" | "desc";
|
|
35
|
+
createdAtFrom?: number;
|
|
36
|
+
createdAtTo?: number;
|
|
37
|
+
priceFrom?: number;
|
|
38
|
+
priceTo?: number;
|
|
39
|
+
matchAll?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
25
42
|
interface LocationState {
|
|
26
43
|
code: string;
|
|
27
44
|
name: string;
|
|
@@ -155,7 +172,7 @@ declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
|
|
|
155
172
|
*/
|
|
156
173
|
declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
157
174
|
|
|
158
|
-
declare const SDK_VERSION = "0.3.
|
|
175
|
+
declare const SDK_VERSION = "0.3.135";
|
|
159
176
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
160
177
|
interface ApiConfig {
|
|
161
178
|
httpClient: any;
|
|
@@ -194,7 +211,7 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
194
211
|
updateBusiness(params: UpdateBusinessParams, options?: RequestOptions): Promise<any>;
|
|
195
212
|
deleteBusiness(params: DeleteBusinessParams, options?: RequestOptions): Promise<any>;
|
|
196
213
|
getBusiness(params: GetBusinessParams, options?: RequestOptions): Promise<any>;
|
|
197
|
-
getBusinesses(params
|
|
214
|
+
getBusinesses(params?: GetBusinessesParams, options?: RequestOptions): Promise<any>;
|
|
198
215
|
getBusinessParents(params: GetBusinessParentsParams, options?: RequestOptions): Promise<any>;
|
|
199
216
|
triggerBuilds(params: TriggerBuildsParams, options?: RequestOptions): Promise<any>;
|
|
200
217
|
getSubscriptionPlans(params: GetSubscriptionPlansParams, options?: RequestOptions): Promise<any>;
|
|
@@ -324,6 +341,11 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
324
341
|
getCountries(options?: RequestOptions): Promise<GetCountriesResponse>;
|
|
325
342
|
getCountryStates(countryCode: string, options?: RequestOptions): Promise<LocationCountry>;
|
|
326
343
|
};
|
|
344
|
+
network: {
|
|
345
|
+
searchServices(networkKey: string, params?: NetworkSearchParams, options?: RequestOptions): Promise<any>;
|
|
346
|
+
searchProducts(networkKey: string, params?: NetworkSearchParams, options?: RequestOptions): Promise<any>;
|
|
347
|
+
searchProviders(networkKey: string, params?: NetworkSearchParams, options?: RequestOptions): Promise<any>;
|
|
348
|
+
};
|
|
327
349
|
setBusinessId: (businessId: string) => void;
|
|
328
350
|
getBusinessId: () => string;
|
|
329
351
|
setMarket: (market: string) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,23 @@ interface HttpClientConfig {
|
|
|
22
22
|
isAuthenticated?: () => boolean;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
interface NetworkSearchParams {
|
|
26
|
+
query?: string;
|
|
27
|
+
limit?: number;
|
|
28
|
+
cursor?: string;
|
|
29
|
+
nodeId?: string;
|
|
30
|
+
nodeIds?: string[];
|
|
31
|
+
statuses?: string[];
|
|
32
|
+
blocks?: any[];
|
|
33
|
+
sortField?: string;
|
|
34
|
+
sortDirection?: "asc" | "desc";
|
|
35
|
+
createdAtFrom?: number;
|
|
36
|
+
createdAtTo?: number;
|
|
37
|
+
priceFrom?: number;
|
|
38
|
+
priceTo?: number;
|
|
39
|
+
matchAll?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
25
42
|
interface LocationState {
|
|
26
43
|
code: string;
|
|
27
44
|
name: string;
|
|
@@ -155,7 +172,7 @@ declare function getSvgContentForAstro(mediaObject: any): Promise<string>;
|
|
|
155
172
|
*/
|
|
156
173
|
declare function injectSvgIntoElement(mediaObject: any, targetElement: HTMLElement, className?: string): Promise<void>;
|
|
157
174
|
|
|
158
|
-
declare const SDK_VERSION = "0.3.
|
|
175
|
+
declare const SDK_VERSION = "0.3.135";
|
|
159
176
|
declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
|
|
160
177
|
interface ApiConfig {
|
|
161
178
|
httpClient: any;
|
|
@@ -194,7 +211,7 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
194
211
|
updateBusiness(params: UpdateBusinessParams, options?: RequestOptions): Promise<any>;
|
|
195
212
|
deleteBusiness(params: DeleteBusinessParams, options?: RequestOptions): Promise<any>;
|
|
196
213
|
getBusiness(params: GetBusinessParams, options?: RequestOptions): Promise<any>;
|
|
197
|
-
getBusinesses(params
|
|
214
|
+
getBusinesses(params?: GetBusinessesParams, options?: RequestOptions): Promise<any>;
|
|
198
215
|
getBusinessParents(params: GetBusinessParentsParams, options?: RequestOptions): Promise<any>;
|
|
199
216
|
triggerBuilds(params: TriggerBuildsParams, options?: RequestOptions): Promise<any>;
|
|
200
217
|
getSubscriptionPlans(params: GetSubscriptionPlansParams, options?: RequestOptions): Promise<any>;
|
|
@@ -324,6 +341,11 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
324
341
|
getCountries(options?: RequestOptions): Promise<GetCountriesResponse>;
|
|
325
342
|
getCountryStates(countryCode: string, options?: RequestOptions): Promise<LocationCountry>;
|
|
326
343
|
};
|
|
344
|
+
network: {
|
|
345
|
+
searchServices(networkKey: string, params?: NetworkSearchParams, options?: RequestOptions): Promise<any>;
|
|
346
|
+
searchProducts(networkKey: string, params?: NetworkSearchParams, options?: RequestOptions): Promise<any>;
|
|
347
|
+
searchProviders(networkKey: string, params?: NetworkSearchParams, options?: RequestOptions): Promise<any>;
|
|
348
|
+
};
|
|
327
349
|
setBusinessId: (businessId: string) => void;
|
|
328
350
|
getBusinessId: () => string;
|
|
329
351
|
setMarket: (market: string) => void;
|
package/dist/index.js
CHANGED
|
@@ -307,7 +307,10 @@ var createBusinessApi = (apiConfig) => {
|
|
|
307
307
|
);
|
|
308
308
|
},
|
|
309
309
|
async getBusinesses(params, options) {
|
|
310
|
-
return apiConfig.httpClient.get(`/v1/businesses`,
|
|
310
|
+
return apiConfig.httpClient.get(`/v1/businesses`, {
|
|
311
|
+
...options,
|
|
312
|
+
params
|
|
313
|
+
});
|
|
311
314
|
},
|
|
312
315
|
async getBusinessParents(params, options) {
|
|
313
316
|
return apiConfig.httpClient.get(
|
|
@@ -567,21 +570,6 @@ var createAnalyticsApi = (apiConfig) => {
|
|
|
567
570
|
};
|
|
568
571
|
};
|
|
569
572
|
|
|
570
|
-
// src/utils/slug.ts
|
|
571
|
-
var isUuid = (str) => {
|
|
572
|
-
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
573
|
-
return uuidRegex.test(str);
|
|
574
|
-
};
|
|
575
|
-
var formatIdOrSlug = (id, apiConfig) => {
|
|
576
|
-
if (isUuid(id)) {
|
|
577
|
-
return id;
|
|
578
|
-
}
|
|
579
|
-
if (id.includes(":")) {
|
|
580
|
-
return id;
|
|
581
|
-
}
|
|
582
|
-
return `${apiConfig.businessId}:${apiConfig.locale}:${id}`;
|
|
583
|
-
};
|
|
584
|
-
|
|
585
573
|
// src/utils/blocks.ts
|
|
586
574
|
function getBlockLabel(block, locale = "en") {
|
|
587
575
|
if (!block) return "";
|
|
@@ -704,13 +692,16 @@ var getBlockObjectValues = (entry, blockKey, locale = "en") => {
|
|
|
704
692
|
};
|
|
705
693
|
var getBlockFromArray = (entry, blockKey, locale = "en") => {
|
|
706
694
|
if (!entry) {
|
|
707
|
-
return
|
|
695
|
+
return {};
|
|
708
696
|
}
|
|
709
697
|
const values = getBlockValues(entry, blockKey);
|
|
698
|
+
if (!values || !Array.isArray(values)) {
|
|
699
|
+
return {};
|
|
700
|
+
}
|
|
710
701
|
return values.reduce((acc, current) => {
|
|
711
702
|
acc[current.key] = unwrapBlock(current, locale);
|
|
712
703
|
return acc;
|
|
713
|
-
});
|
|
704
|
+
}, {});
|
|
714
705
|
};
|
|
715
706
|
var getImageUrl = (imageBlock, isBlock = true) => {
|
|
716
707
|
if (!imageBlock) return null;
|
|
@@ -764,9 +755,18 @@ var createCmsApi = (apiConfig) => {
|
|
|
764
755
|
);
|
|
765
756
|
},
|
|
766
757
|
async getNode(params, options) {
|
|
767
|
-
|
|
758
|
+
let identifier;
|
|
759
|
+
if (params.id) {
|
|
760
|
+
identifier = params.id;
|
|
761
|
+
} else if (params.slug) {
|
|
762
|
+
identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
|
|
763
|
+
} else if (params.key) {
|
|
764
|
+
identifier = `${apiConfig.businessId}:${params.key}`;
|
|
765
|
+
} else {
|
|
766
|
+
throw new Error("GetNodeParams requires id, slug, or key");
|
|
767
|
+
}
|
|
768
768
|
const response = await apiConfig.httpClient.get(
|
|
769
|
-
`/v1/businesses/${apiConfig.businessId}/nodes/${
|
|
769
|
+
`/v1/businesses/${apiConfig.businessId}/nodes/${identifier}`,
|
|
770
770
|
options
|
|
771
771
|
);
|
|
772
772
|
return {
|
|
@@ -876,9 +876,16 @@ var createEshopApi = (apiConfig) => {
|
|
|
876
876
|
);
|
|
877
877
|
},
|
|
878
878
|
async getProduct(params, options) {
|
|
879
|
-
|
|
879
|
+
let identifier;
|
|
880
|
+
if (params.id) {
|
|
881
|
+
identifier = params.id;
|
|
882
|
+
} else if (params.slug) {
|
|
883
|
+
identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
|
|
884
|
+
} else {
|
|
885
|
+
throw new Error("GetProductParams requires id or slug");
|
|
886
|
+
}
|
|
880
887
|
return apiConfig.httpClient.get(
|
|
881
|
-
`/v1/businesses/${apiConfig.businessId}/products/${
|
|
888
|
+
`/v1/businesses/${apiConfig.businessId}/products/${identifier}`,
|
|
882
889
|
options
|
|
883
890
|
);
|
|
884
891
|
},
|
|
@@ -1059,9 +1066,16 @@ var createReservationApi = (apiConfig) => {
|
|
|
1059
1066
|
);
|
|
1060
1067
|
},
|
|
1061
1068
|
async getService(params, options) {
|
|
1062
|
-
|
|
1069
|
+
let identifier;
|
|
1070
|
+
if (params.id) {
|
|
1071
|
+
identifier = params.id;
|
|
1072
|
+
} else if (params.slug) {
|
|
1073
|
+
identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
|
|
1074
|
+
} else {
|
|
1075
|
+
throw new Error("GetServiceParams requires id or slug");
|
|
1076
|
+
}
|
|
1063
1077
|
return apiConfig.httpClient.get(
|
|
1064
|
-
`/v1/businesses/${apiConfig.businessId}/services/${
|
|
1078
|
+
`/v1/businesses/${apiConfig.businessId}/services/${identifier}`,
|
|
1065
1079
|
options
|
|
1066
1080
|
);
|
|
1067
1081
|
},
|
|
@@ -1096,8 +1110,16 @@ var createReservationApi = (apiConfig) => {
|
|
|
1096
1110
|
);
|
|
1097
1111
|
},
|
|
1098
1112
|
async getProvider(params, options) {
|
|
1113
|
+
let identifier;
|
|
1114
|
+
if (params.id) {
|
|
1115
|
+
identifier = params.id;
|
|
1116
|
+
} else if (params.slug) {
|
|
1117
|
+
identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
|
|
1118
|
+
} else {
|
|
1119
|
+
throw new Error("GetProviderParams requires id or slug");
|
|
1120
|
+
}
|
|
1099
1121
|
return apiConfig.httpClient.get(
|
|
1100
|
-
`/v1/businesses/${apiConfig.businessId}/providers/${
|
|
1122
|
+
`/v1/businesses/${apiConfig.businessId}/providers/${identifier}`,
|
|
1101
1123
|
options
|
|
1102
1124
|
);
|
|
1103
1125
|
},
|
|
@@ -1306,6 +1328,103 @@ var createLocationApi = (apiConfig) => {
|
|
|
1306
1328
|
};
|
|
1307
1329
|
};
|
|
1308
1330
|
|
|
1331
|
+
// src/api/network.ts
|
|
1332
|
+
var createNetworkApi = (apiConfig) => {
|
|
1333
|
+
return {
|
|
1334
|
+
/**
|
|
1335
|
+
* Search services across all businesses that have opted into a network
|
|
1336
|
+
* @param networkKey - The network key (e.g., "delfin")
|
|
1337
|
+
* @param params - Search parameters
|
|
1338
|
+
*/
|
|
1339
|
+
async searchServices(networkKey, params, options) {
|
|
1340
|
+
const queryParams = {};
|
|
1341
|
+
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1342
|
+
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1343
|
+
if (params?.query) queryParams.query = params.query;
|
|
1344
|
+
if (params?.nodeId) queryParams.nodeId = params.nodeId;
|
|
1345
|
+
if (params?.nodeIds && params.nodeIds.length > 0)
|
|
1346
|
+
queryParams.nodeIds = params.nodeIds.join(",");
|
|
1347
|
+
if (params?.statuses && params.statuses.length > 0)
|
|
1348
|
+
queryParams.statuses = params.statuses.join(",");
|
|
1349
|
+
if (params?.sortField) queryParams.sortField = params.sortField;
|
|
1350
|
+
if (params?.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
1351
|
+
if (params?.createdAtFrom !== void 0)
|
|
1352
|
+
queryParams.createdAtFrom = params.createdAtFrom;
|
|
1353
|
+
if (params?.createdAtTo !== void 0)
|
|
1354
|
+
queryParams.createdAtTo = params.createdAtTo;
|
|
1355
|
+
if (params?.priceFrom !== void 0) queryParams.priceFrom = params.priceFrom;
|
|
1356
|
+
if (params?.priceTo !== void 0) queryParams.priceTo = params.priceTo;
|
|
1357
|
+
if (params?.matchAll !== void 0) queryParams.matchAll = params.matchAll;
|
|
1358
|
+
if (params?.blocks && params.blocks.length > 0)
|
|
1359
|
+
queryParams.blocks = JSON.stringify(params.blocks);
|
|
1360
|
+
return apiConfig.httpClient.get(`/v1/networks/${networkKey}/services`, {
|
|
1361
|
+
...options,
|
|
1362
|
+
params: queryParams
|
|
1363
|
+
});
|
|
1364
|
+
},
|
|
1365
|
+
/**
|
|
1366
|
+
* Search products across all businesses that have opted into a network
|
|
1367
|
+
* @param networkKey - The network key (e.g., "delfin")
|
|
1368
|
+
* @param params - Search parameters
|
|
1369
|
+
*/
|
|
1370
|
+
async searchProducts(networkKey, params, options) {
|
|
1371
|
+
const queryParams = {};
|
|
1372
|
+
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1373
|
+
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1374
|
+
if (params?.query) queryParams.query = params.query;
|
|
1375
|
+
if (params?.nodeId) queryParams.nodeId = params.nodeId;
|
|
1376
|
+
if (params?.nodeIds && params.nodeIds.length > 0)
|
|
1377
|
+
queryParams.nodeIds = params.nodeIds.join(",");
|
|
1378
|
+
if (params?.statuses && params.statuses.length > 0)
|
|
1379
|
+
queryParams.statuses = params.statuses.join(",");
|
|
1380
|
+
if (params?.sortField) queryParams.sortField = params.sortField;
|
|
1381
|
+
if (params?.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
1382
|
+
if (params?.createdAtFrom !== void 0)
|
|
1383
|
+
queryParams.createdAtFrom = params.createdAtFrom;
|
|
1384
|
+
if (params?.createdAtTo !== void 0)
|
|
1385
|
+
queryParams.createdAtTo = params.createdAtTo;
|
|
1386
|
+
if (params?.priceFrom !== void 0) queryParams.priceFrom = params.priceFrom;
|
|
1387
|
+
if (params?.priceTo !== void 0) queryParams.priceTo = params.priceTo;
|
|
1388
|
+
if (params?.matchAll !== void 0) queryParams.matchAll = params.matchAll;
|
|
1389
|
+
if (params?.blocks && params.blocks.length > 0)
|
|
1390
|
+
queryParams.blocks = JSON.stringify(params.blocks);
|
|
1391
|
+
return apiConfig.httpClient.get(`/v1/networks/${networkKey}/products`, {
|
|
1392
|
+
...options,
|
|
1393
|
+
params: queryParams
|
|
1394
|
+
});
|
|
1395
|
+
},
|
|
1396
|
+
/**
|
|
1397
|
+
* Search providers across all businesses that have opted into a network
|
|
1398
|
+
* @param networkKey - The network key (e.g., "delfin")
|
|
1399
|
+
* @param params - Search parameters
|
|
1400
|
+
*/
|
|
1401
|
+
async searchProviders(networkKey, params, options) {
|
|
1402
|
+
const queryParams = {};
|
|
1403
|
+
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1404
|
+
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1405
|
+
if (params?.query) queryParams.query = params.query;
|
|
1406
|
+
if (params?.nodeId) queryParams.nodeId = params.nodeId;
|
|
1407
|
+
if (params?.nodeIds && params.nodeIds.length > 0)
|
|
1408
|
+
queryParams.nodeIds = params.nodeIds.join(",");
|
|
1409
|
+
if (params?.statuses && params.statuses.length > 0)
|
|
1410
|
+
queryParams.statuses = params.statuses.join(",");
|
|
1411
|
+
if (params?.sortField) queryParams.sortField = params.sortField;
|
|
1412
|
+
if (params?.sortDirection) queryParams.sortDirection = params.sortDirection;
|
|
1413
|
+
if (params?.createdAtFrom !== void 0)
|
|
1414
|
+
queryParams.createdAtFrom = params.createdAtFrom;
|
|
1415
|
+
if (params?.createdAtTo !== void 0)
|
|
1416
|
+
queryParams.createdAtTo = params.createdAtTo;
|
|
1417
|
+
if (params?.matchAll !== void 0) queryParams.matchAll = params.matchAll;
|
|
1418
|
+
if (params?.blocks && params.blocks.length > 0)
|
|
1419
|
+
queryParams.blocks = JSON.stringify(params.blocks);
|
|
1420
|
+
return apiConfig.httpClient.get(`/v1/networks/${networkKey}/providers`, {
|
|
1421
|
+
...options,
|
|
1422
|
+
params: queryParams
|
|
1423
|
+
});
|
|
1424
|
+
}
|
|
1425
|
+
};
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1309
1428
|
// src/utils/currency.ts
|
|
1310
1429
|
function getCurrencySymbol(currency) {
|
|
1311
1430
|
const currencySymbols = {
|
|
@@ -1692,7 +1811,7 @@ function nameToKey(name) {
|
|
|
1692
1811
|
}
|
|
1693
1812
|
|
|
1694
1813
|
// src/index.ts
|
|
1695
|
-
var SDK_VERSION = "0.3.
|
|
1814
|
+
var SDK_VERSION = "0.3.135";
|
|
1696
1815
|
var SUPPORTED_FRAMEWORKS = [
|
|
1697
1816
|
"astro",
|
|
1698
1817
|
"react",
|
|
@@ -1743,6 +1862,7 @@ async function createArkySDK(config) {
|
|
|
1743
1862
|
database: createDatabaseApi(apiConfig),
|
|
1744
1863
|
featureFlags: createFeatureFlagsApi(apiConfig),
|
|
1745
1864
|
location: createLocationApi(apiConfig),
|
|
1865
|
+
network: createNetworkApi(apiConfig),
|
|
1746
1866
|
setBusinessId: (businessId) => {
|
|
1747
1867
|
apiConfig.businessId = businessId;
|
|
1748
1868
|
},
|