arky-sdk 0.3.134 → 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.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.132";
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: GetBusinessesParams, options?: RequestOptions): Promise<any>;
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.132";
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: GetBusinessesParams, options?: RequestOptions): Promise<any>;
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`, options);
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 "";
@@ -767,9 +755,18 @@ var createCmsApi = (apiConfig) => {
767
755
  );
768
756
  },
769
757
  async getNode(params, options) {
770
- const formattedId = formatIdOrSlug(params.id, apiConfig);
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
+ }
771
768
  const response = await apiConfig.httpClient.get(
772
- `/v1/businesses/${apiConfig.businessId}/nodes/${formattedId}`,
769
+ `/v1/businesses/${apiConfig.businessId}/nodes/${identifier}`,
773
770
  options
774
771
  );
775
772
  return {
@@ -879,9 +876,16 @@ var createEshopApi = (apiConfig) => {
879
876
  );
880
877
  },
881
878
  async getProduct(params, options) {
882
- const formattedId = formatIdOrSlug(params.id, apiConfig);
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
+ }
883
887
  return apiConfig.httpClient.get(
884
- `/v1/businesses/${apiConfig.businessId}/products/${formattedId}`,
888
+ `/v1/businesses/${apiConfig.businessId}/products/${identifier}`,
885
889
  options
886
890
  );
887
891
  },
@@ -1062,9 +1066,16 @@ var createReservationApi = (apiConfig) => {
1062
1066
  );
1063
1067
  },
1064
1068
  async getService(params, options) {
1065
- const formattedId = formatIdOrSlug(params.id, apiConfig);
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
+ }
1066
1077
  return apiConfig.httpClient.get(
1067
- `/v1/businesses/${apiConfig.businessId}/services/${formattedId}`,
1078
+ `/v1/businesses/${apiConfig.businessId}/services/${identifier}`,
1068
1079
  options
1069
1080
  );
1070
1081
  },
@@ -1099,8 +1110,16 @@ var createReservationApi = (apiConfig) => {
1099
1110
  );
1100
1111
  },
1101
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
+ }
1102
1121
  return apiConfig.httpClient.get(
1103
- `/v1/businesses/${apiConfig.businessId}/providers/${params.id}`,
1122
+ `/v1/businesses/${apiConfig.businessId}/providers/${identifier}`,
1104
1123
  options
1105
1124
  );
1106
1125
  },
@@ -1309,6 +1328,103 @@ var createLocationApi = (apiConfig) => {
1309
1328
  };
1310
1329
  };
1311
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
+
1312
1428
  // src/utils/currency.ts
1313
1429
  function getCurrencySymbol(currency) {
1314
1430
  const currencySymbols = {
@@ -1695,7 +1811,7 @@ function nameToKey(name) {
1695
1811
  }
1696
1812
 
1697
1813
  // src/index.ts
1698
- var SDK_VERSION = "0.3.132";
1814
+ var SDK_VERSION = "0.3.135";
1699
1815
  var SUPPORTED_FRAMEWORKS = [
1700
1816
  "astro",
1701
1817
  "react",
@@ -1746,6 +1862,7 @@ async function createArkySDK(config) {
1746
1862
  database: createDatabaseApi(apiConfig),
1747
1863
  featureFlags: createFeatureFlagsApi(apiConfig),
1748
1864
  location: createLocationApi(apiConfig),
1865
+ network: createNetworkApi(apiConfig),
1749
1866
  setBusinessId: (businessId) => {
1750
1867
  apiConfig.businessId = businessId;
1751
1868
  },