arky-sdk 0.3.135 → 0.3.137

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 CHANGED
@@ -401,8 +401,9 @@ var createBusinessApi = (apiConfig) => {
401
401
  var createMediaApi = (apiConfig) => {
402
402
  return {
403
403
  async uploadBusinessMedia(params, options) {
404
- const { files = [], urls = [] } = params;
405
- const url = `${apiConfig.baseUrl}/v1/businesses/${apiConfig.businessId}/media`;
404
+ const { businessId, files = [], urls = [] } = params;
405
+ const targetBusinessId = businessId || apiConfig.businessId;
406
+ const url = `${apiConfig.baseUrl}/v1/businesses/${targetBusinessId}/media`;
406
407
  const formData = new FormData();
407
408
  files.forEach((file) => formData.append("files", file));
408
409
  urls.forEach((url2) => formData.append("urls", url2));
@@ -427,8 +428,9 @@ var createMediaApi = (apiConfig) => {
427
428
  );
428
429
  },
429
430
  async getBusinessMedia(params, options) {
430
- const { cursor, limit, ids, query, mimeType, sortField, sortDirection } = params;
431
- const url = `${apiConfig.baseUrl}/v1/businesses/${apiConfig.businessId}/media`;
431
+ const { businessId, cursor, limit, ids, query, mimeType, sortField, sortDirection } = params;
432
+ const targetBusinessId = businessId || apiConfig.businessId;
433
+ const url = `${apiConfig.baseUrl}/v1/businesses/${targetBusinessId}/media`;
432
434
  const queryParams = { limit: String(limit) };
433
435
  if (cursor) queryParams.cursor = cursor;
434
436
  if (ids && ids.length > 0) queryParams.ids = ids.join(",");
@@ -450,9 +452,10 @@ var createMediaApi = (apiConfig) => {
450
452
  return await response.json();
451
453
  },
452
454
  async updateMedia(params, options) {
453
- const { mediaId, ...updateData } = params;
455
+ const { mediaId, businessId, ...updateData } = params;
456
+ const targetBusinessId = businessId || apiConfig.businessId;
454
457
  return apiConfig.httpClient.put(
455
- `/v1/businesses/${apiConfig.businessId}/media/${mediaId}`,
458
+ `/v1/businesses/${targetBusinessId}/media/${mediaId}`,
456
459
  updateData,
457
460
  options
458
461
  );
@@ -737,38 +740,44 @@ var getImageUrl = (imageBlock, isBlock = true) => {
737
740
  var createCmsApi = (apiConfig) => {
738
741
  return {
739
742
  async createNode(params, options) {
743
+ const { businessId, ...payload } = params;
744
+ const targetBusinessId = businessId || apiConfig.businessId;
740
745
  return apiConfig.httpClient.post(
741
- `/v1/businesses/${apiConfig.businessId}/nodes`,
742
- params,
746
+ `/v1/businesses/${targetBusinessId}/nodes`,
747
+ payload,
743
748
  options
744
749
  );
745
750
  },
746
751
  async updateNode(params, options) {
752
+ const { businessId, ...payload } = params;
753
+ const targetBusinessId = businessId || apiConfig.businessId;
747
754
  return apiConfig.httpClient.put(
748
- `/v1/businesses/${apiConfig.businessId}/nodes/${params.id}`,
749
- params,
755
+ `/v1/businesses/${targetBusinessId}/nodes/${params.id}`,
756
+ payload,
750
757
  options
751
758
  );
752
759
  },
753
760
  async deleteNode(params, options) {
761
+ const targetBusinessId = params.businessId || apiConfig.businessId;
754
762
  return apiConfig.httpClient.delete(
755
- `/v1/businesses/${apiConfig.businessId}/nodes/${params.id}`,
763
+ `/v1/businesses/${targetBusinessId}/nodes/${params.id}`,
756
764
  options
757
765
  );
758
766
  },
759
767
  async getNode(params, options) {
768
+ const targetBusinessId = params.businessId || apiConfig.businessId;
760
769
  let identifier;
761
770
  if (params.id) {
762
771
  identifier = params.id;
763
772
  } else if (params.slug) {
764
- identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
773
+ identifier = `${targetBusinessId}:${apiConfig.locale}:${params.slug}`;
765
774
  } else if (params.key) {
766
- identifier = `${apiConfig.businessId}:${params.key}`;
775
+ identifier = `${targetBusinessId}:${params.key}`;
767
776
  } else {
768
777
  throw new Error("GetNodeParams requires id, slug, or key");
769
778
  }
770
779
  const response = await apiConfig.httpClient.get(
771
- `/v1/businesses/${apiConfig.businessId}/nodes/${identifier}`,
780
+ `/v1/businesses/${targetBusinessId}/nodes/${identifier}`,
772
781
  options
773
782
  );
774
783
  return {
@@ -786,18 +795,21 @@ var createCmsApi = (apiConfig) => {
786
795
  };
787
796
  },
788
797
  async getNodes(params, options) {
798
+ const { businessId, ...queryParams } = params;
799
+ const targetBusinessId = businessId || apiConfig.businessId;
789
800
  return apiConfig.httpClient.get(
790
- `/v1/businesses/${apiConfig.businessId}/nodes`,
801
+ `/v1/businesses/${targetBusinessId}/nodes`,
791
802
  {
792
803
  ...options,
793
- params
804
+ params: queryParams
794
805
  }
795
806
  );
796
807
  },
797
808
  async getNodeChildren(params, options) {
798
- const { id, ...queryParams } = params;
809
+ const { id, businessId, ...queryParams } = params;
810
+ const targetBusinessId = businessId || apiConfig.businessId;
799
811
  return apiConfig.httpClient.get(
800
- `/v1/businesses/${apiConfig.businessId}/nodes/${id}/children`,
812
+ `/v1/businesses/${targetBusinessId}/nodes/${id}/children`,
801
813
  {
802
814
  ...options,
803
815
  params: queryParams
@@ -976,12 +988,14 @@ var createReservationApi = (apiConfig) => {
976
988
  },
977
989
  // ===== RESERVATIONS =====
978
990
  async createReservation(params, options) {
991
+ const { businessId, ...rest } = params;
992
+ const targetBusinessId = businessId || apiConfig.businessId;
979
993
  const payload = {
980
994
  market: apiConfig.market,
981
- ...params
995
+ ...rest
982
996
  };
983
997
  return apiConfig.httpClient.post(
984
- `/v1/businesses/${apiConfig.businessId}/reservations`,
998
+ `/v1/businesses/${targetBusinessId}/reservations`,
985
999
  payload,
986
1000
  options
987
1001
  );
@@ -995,7 +1009,9 @@ var createReservationApi = (apiConfig) => {
995
1009
  );
996
1010
  },
997
1011
  async checkout(params, options) {
998
- const items = params?.items || cart.map((s) => ({
1012
+ const { businessId, ...rest } = params || {};
1013
+ const targetBusinessId = businessId || apiConfig.businessId;
1014
+ const items = rest?.items || cart.map((s) => ({
999
1015
  serviceId: s.serviceId,
1000
1016
  providerId: s.providerId,
1001
1017
  from: s.from,
@@ -1003,60 +1019,70 @@ var createReservationApi = (apiConfig) => {
1003
1019
  }));
1004
1020
  const payload = {
1005
1021
  market: apiConfig.market,
1006
- ...params,
1022
+ ...rest,
1007
1023
  items
1008
1024
  };
1009
1025
  return apiConfig.httpClient.post(
1010
- `/v1/businesses/${apiConfig.businessId}/reservations/checkout`,
1026
+ `/v1/businesses/${targetBusinessId}/reservations/checkout`,
1011
1027
  payload,
1012
1028
  options
1013
1029
  );
1014
1030
  },
1015
1031
  async getReservation(params, options) {
1032
+ const targetBusinessId = params.businessId || apiConfig.businessId;
1016
1033
  return apiConfig.httpClient.get(
1017
- `/v1/businesses/${apiConfig.businessId}/reservations/${params.id}`,
1034
+ `/v1/businesses/${targetBusinessId}/reservations/${params.id}`,
1018
1035
  options
1019
1036
  );
1020
1037
  },
1021
1038
  async searchReservations(params, options) {
1039
+ const { businessId, ...queryParams } = params;
1040
+ const targetBusinessId = businessId || apiConfig.businessId;
1022
1041
  return apiConfig.httpClient.get(
1023
- `/v1/businesses/${apiConfig.businessId}/reservations`,
1042
+ `/v1/businesses/${targetBusinessId}/reservations`,
1024
1043
  {
1025
1044
  ...options,
1026
- params
1045
+ params: queryParams
1027
1046
  }
1028
1047
  );
1029
1048
  },
1030
1049
  // ===== QUOTES =====
1031
1050
  async getQuote(params, options) {
1051
+ const { businessId, ...rest } = params;
1052
+ const targetBusinessId = businessId || apiConfig.businessId;
1032
1053
  const payload = {
1033
1054
  market: apiConfig.market,
1034
- ...params
1055
+ ...rest
1035
1056
  };
1036
1057
  return apiConfig.httpClient.post(
1037
- `/v1/businesses/${apiConfig.businessId}/reservations/quote`,
1058
+ `/v1/businesses/${targetBusinessId}/reservations/quote`,
1038
1059
  payload,
1039
1060
  options
1040
1061
  );
1041
1062
  },
1042
1063
  // ===== SERVICES =====
1043
1064
  async createService(params, options) {
1065
+ const { businessId, ...payload } = params;
1066
+ const targetBusinessId = businessId || apiConfig.businessId;
1044
1067
  return apiConfig.httpClient.post(
1045
- `/v1/businesses/${apiConfig.businessId}/services`,
1046
- params,
1068
+ `/v1/businesses/${targetBusinessId}/services`,
1069
+ payload,
1047
1070
  options
1048
1071
  );
1049
1072
  },
1050
1073
  async updateService(params, options) {
1074
+ const { businessId, ...payload } = params;
1075
+ const targetBusinessId = businessId || apiConfig.businessId;
1051
1076
  return apiConfig.httpClient.put(
1052
- `/v1/businesses/${apiConfig.businessId}/services/${params.id}`,
1053
- params,
1077
+ `/v1/businesses/${targetBusinessId}/services/${params.id}`,
1078
+ payload,
1054
1079
  options
1055
1080
  );
1056
1081
  },
1057
1082
  async deleteService(params, options) {
1083
+ const targetBusinessId = params.businessId || apiConfig.businessId;
1058
1084
  return apiConfig.httpClient.delete(
1059
- `/v1/businesses/${apiConfig.businessId}/services/${params.id}`,
1085
+ `/v1/businesses/${targetBusinessId}/services/${params.id}`,
1060
1086
  options
1061
1087
  );
1062
1088
  },
@@ -1068,69 +1094,80 @@ var createReservationApi = (apiConfig) => {
1068
1094
  );
1069
1095
  },
1070
1096
  async getService(params, options) {
1097
+ const businessId = params.businessId || apiConfig.businessId;
1071
1098
  let identifier;
1072
1099
  if (params.id) {
1073
1100
  identifier = params.id;
1074
1101
  } else if (params.slug) {
1075
- identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
1102
+ identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
1076
1103
  } else {
1077
1104
  throw new Error("GetServiceParams requires id or slug");
1078
1105
  }
1079
1106
  return apiConfig.httpClient.get(
1080
- `/v1/businesses/${apiConfig.businessId}/services/${identifier}`,
1107
+ `/v1/businesses/${businessId}/services/${identifier}`,
1081
1108
  options
1082
1109
  );
1083
1110
  },
1084
1111
  async getServices(params, options) {
1112
+ const { businessId, ...queryParams } = params;
1113
+ const targetBusinessId = businessId || apiConfig.businessId;
1085
1114
  return apiConfig.httpClient.get(
1086
- `/v1/businesses/${apiConfig.businessId}/services`,
1115
+ `/v1/businesses/${targetBusinessId}/services`,
1087
1116
  {
1088
1117
  ...options,
1089
- params
1118
+ params: queryParams
1090
1119
  }
1091
1120
  );
1092
1121
  },
1093
1122
  // ===== PROVIDERS =====
1094
1123
  async createProvider(params, options) {
1124
+ const { businessId, ...payload } = params;
1125
+ const targetBusinessId = businessId || apiConfig.businessId;
1095
1126
  return apiConfig.httpClient.post(
1096
- `/v1/businesses/${apiConfig.businessId}/providers`,
1097
- params,
1127
+ `/v1/businesses/${targetBusinessId}/providers`,
1128
+ payload,
1098
1129
  options
1099
1130
  );
1100
1131
  },
1101
1132
  async updateProvider(params, options) {
1133
+ const { businessId, ...payload } = params;
1134
+ const targetBusinessId = businessId || apiConfig.businessId;
1102
1135
  return apiConfig.httpClient.put(
1103
- `/v1/businesses/${apiConfig.businessId}/providers/${params.id}`,
1104
- params,
1136
+ `/v1/businesses/${targetBusinessId}/providers/${params.id}`,
1137
+ payload,
1105
1138
  options
1106
1139
  );
1107
1140
  },
1108
1141
  async deleteProvider(params, options) {
1142
+ const targetBusinessId = params.businessId || apiConfig.businessId;
1109
1143
  return apiConfig.httpClient.delete(
1110
- `/v1/businesses/${apiConfig.businessId}/providers/${params.id}`,
1144
+ `/v1/businesses/${targetBusinessId}/providers/${params.id}`,
1111
1145
  options
1112
1146
  );
1113
1147
  },
1114
1148
  async getProvider(params, options) {
1149
+ const businessId = params.businessId || apiConfig.businessId;
1115
1150
  let identifier;
1116
1151
  if (params.id) {
1117
1152
  identifier = params.id;
1118
1153
  } else if (params.slug) {
1119
- identifier = `${apiConfig.businessId}:${apiConfig.locale}:${params.slug}`;
1154
+ identifier = `${businessId}:${apiConfig.locale}:${params.slug}`;
1120
1155
  } else {
1121
1156
  throw new Error("GetProviderParams requires id or slug");
1122
1157
  }
1123
1158
  return apiConfig.httpClient.get(
1124
- `/v1/businesses/${apiConfig.businessId}/providers/${identifier}`,
1159
+ `/v1/businesses/${businessId}/providers/${identifier}`,
1125
1160
  options
1126
1161
  );
1127
1162
  },
1128
1163
  async getProviders(params, options) {
1164
+ const { businessId, ...queryParams } = params;
1165
+ const targetBusinessId = businessId || apiConfig.businessId;
1129
1166
  return apiConfig.httpClient.get(
1130
- `/v1/businesses/${apiConfig.businessId}/providers`,
1167
+ `/v1/businesses/${targetBusinessId}/providers`,
1131
1168
  {
1132
1169
  ...options,
1133
- params
1170
+ params: queryParams
1134
1171
  }
1135
1172
  );
1136
1173
  },
@@ -1156,7 +1193,8 @@ var createDatabaseApi = (apiConfig) => {
1156
1193
  {
1157
1194
  ...options,
1158
1195
  params: {
1159
- key: params.key
1196
+ key: params.key,
1197
+ limit: params.limit || 200
1160
1198
  }
1161
1199
  }
1162
1200
  );
@@ -1813,7 +1851,7 @@ function nameToKey(name) {
1813
1851
  }
1814
1852
 
1815
1853
  // src/index.ts
1816
- var SDK_VERSION = "0.3.135";
1854
+ var SDK_VERSION = "0.3.136";
1817
1855
  var SUPPORTED_FRAMEWORKS = [
1818
1856
  "astro",
1819
1857
  "react",