arky-sdk 0.3.79 → 0.3.81

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
@@ -23,6 +23,20 @@ interface HttpClientConfig {
23
23
  isAuthenticated?: () => boolean;
24
24
  }
25
25
 
26
+ interface LocationState {
27
+ code: string;
28
+ name: string;
29
+ }
30
+ interface LocationCountry {
31
+ code: string;
32
+ name: string;
33
+ states: LocationState[];
34
+ }
35
+ interface GetCountriesResponse {
36
+ items: LocationCountry[];
37
+ cursor: string | null;
38
+ }
39
+
26
40
  interface ScanDataParams {
27
41
  key: string;
28
42
  }
@@ -73,7 +87,7 @@ interface ReservationEngineConfig {
73
87
  timezone?: string;
74
88
  }
75
89
 
76
- declare const SDK_VERSION = "0.3.78";
90
+ declare const SDK_VERSION = "0.3.81";
77
91
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
78
92
  interface ApiConfig {
79
93
  httpClient: any;
@@ -236,6 +250,10 @@ declare function createArkySDK(config: HttpClientConfig & {
236
250
  activateFlag(id: string): Promise<FeatureFlag>;
237
251
  archiveFlag(id: string): Promise<FeatureFlag>;
238
252
  };
253
+ location: {
254
+ getCountries(options?: RequestOptions): Promise<GetCountriesResponse>;
255
+ getCountryStates(countryCode: string, options?: RequestOptions): Promise<LocationCountry>;
256
+ };
239
257
  reservationEngine: (engineConfig?: ReservationEngineConfig) => {
240
258
  setTimezone(tz: string): void;
241
259
  setService(serviceId: string): Promise<void>;
@@ -308,4 +326,4 @@ declare function createArkySDK(config: HttpClientConfig & {
308
326
  };
309
327
  }>;
310
328
 
311
- export { type ApiConfig, type CalendarDay, type HttpClientConfig, ProviderWithTimeline, type ReservationEngineConfig, type ReservationEngineState, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK };
329
+ export { type ApiConfig, type CalendarDay, type GetCountriesResponse, type HttpClientConfig, type LocationCountry, type LocationState, ProviderWithTimeline, type ReservationEngineConfig, type ReservationEngineState, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK };
package/dist/index.d.ts CHANGED
@@ -23,6 +23,20 @@ interface HttpClientConfig {
23
23
  isAuthenticated?: () => boolean;
24
24
  }
25
25
 
26
+ interface LocationState {
27
+ code: string;
28
+ name: string;
29
+ }
30
+ interface LocationCountry {
31
+ code: string;
32
+ name: string;
33
+ states: LocationState[];
34
+ }
35
+ interface GetCountriesResponse {
36
+ items: LocationCountry[];
37
+ cursor: string | null;
38
+ }
39
+
26
40
  interface ScanDataParams {
27
41
  key: string;
28
42
  }
@@ -73,7 +87,7 @@ interface ReservationEngineConfig {
73
87
  timezone?: string;
74
88
  }
75
89
 
76
- declare const SDK_VERSION = "0.3.78";
90
+ declare const SDK_VERSION = "0.3.81";
77
91
  declare const SUPPORTED_FRAMEWORKS: readonly ["astro", "react", "vue", "svelte", "vanilla"];
78
92
  interface ApiConfig {
79
93
  httpClient: any;
@@ -236,6 +250,10 @@ declare function createArkySDK(config: HttpClientConfig & {
236
250
  activateFlag(id: string): Promise<FeatureFlag>;
237
251
  archiveFlag(id: string): Promise<FeatureFlag>;
238
252
  };
253
+ location: {
254
+ getCountries(options?: RequestOptions): Promise<GetCountriesResponse>;
255
+ getCountryStates(countryCode: string, options?: RequestOptions): Promise<LocationCountry>;
256
+ };
239
257
  reservationEngine: (engineConfig?: ReservationEngineConfig) => {
240
258
  setTimezone(tz: string): void;
241
259
  setService(serviceId: string): Promise<void>;
@@ -308,4 +326,4 @@ declare function createArkySDK(config: HttpClientConfig & {
308
326
  };
309
327
  }>;
310
328
 
311
- export { type ApiConfig, type CalendarDay, type HttpClientConfig, ProviderWithTimeline, type ReservationEngineConfig, type ReservationEngineState, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK };
329
+ export { type ApiConfig, type CalendarDay, type GetCountriesResponse, type HttpClientConfig, type LocationCountry, type LocationState, ProviderWithTimeline, type ReservationEngineConfig, type ReservationEngineState, SDK_VERSION, SUPPORTED_FRAMEWORKS, Slot, createArkySDK };
package/dist/index.js CHANGED
@@ -1025,13 +1025,11 @@ var createReservationApi = (apiConfig) => {
1025
1025
  ...params,
1026
1026
  items
1027
1027
  };
1028
- const result = await apiConfig.httpClient.post(
1028
+ return apiConfig.httpClient.post(
1029
1029
  `/v1/reservations/checkout`,
1030
1030
  payload,
1031
1031
  options
1032
1032
  );
1033
- cart = [];
1034
- return result;
1035
1033
  },
1036
1034
  async getReservation(params, options) {
1037
1035
  return apiConfig.httpClient.get(`/v1/reservations/${params.id}`, {
@@ -1345,6 +1343,21 @@ var createFeatureFlagsApi = (apiConfig) => {
1345
1343
  };
1346
1344
  };
1347
1345
 
1346
+ // src/api/location.ts
1347
+ var createLocationApi = (apiConfig) => {
1348
+ return {
1349
+ async getCountries(options) {
1350
+ return apiConfig.httpClient.get(`/v1/operations/location/countries`, options);
1351
+ },
1352
+ async getCountryStates(countryCode, options) {
1353
+ return apiConfig.httpClient.get(
1354
+ `/v1/operations/location/countries/${countryCode}/states`,
1355
+ options
1356
+ );
1357
+ }
1358
+ };
1359
+ };
1360
+
1348
1361
  // src/utils/currency.ts
1349
1362
  function getCurrencySymbol(currency) {
1350
1363
  const currencySymbols = {
@@ -1965,7 +1978,7 @@ var createReservationEngine = (api, config = {}) => {
1965
1978
  if (!state.cart.length) throw new Error("Cart is empty");
1966
1979
  store.setKey("loading", true);
1967
1980
  try {
1968
- const result = await api.checkout({
1981
+ return api.checkout({
1969
1982
  items: state.cart.map((s) => ({
1970
1983
  serviceId: s.serviceId,
1971
1984
  providerId: s.providerId,
@@ -1977,8 +1990,6 @@ var createReservationEngine = (api, config = {}) => {
1977
1990
  promoCode: options.promoCode ?? null,
1978
1991
  blocks: options.blocks || []
1979
1992
  });
1980
- store.setKey("cart", []);
1981
- return result;
1982
1993
  } finally {
1983
1994
  store.setKey("loading", false);
1984
1995
  }
@@ -2003,7 +2014,7 @@ var createReservationEngine = (api, config = {}) => {
2003
2014
  };
2004
2015
 
2005
2016
  // src/index.ts
2006
- var SDK_VERSION = "0.3.78";
2017
+ var SDK_VERSION = "0.3.81";
2007
2018
  var SUPPORTED_FRAMEWORKS = [
2008
2019
  "astro",
2009
2020
  "react",
@@ -2053,6 +2064,7 @@ async function createArkySDK(config) {
2053
2064
  reservation: createReservationApi(apiConfig),
2054
2065
  database: createDatabaseApi(apiConfig),
2055
2066
  featureFlags: createFeatureFlagsApi(apiConfig),
2067
+ location: createLocationApi(apiConfig),
2056
2068
  // High-level reservation engine
2057
2069
  reservationEngine: (engineConfig) => {
2058
2070
  const reservationApi = createReservationApi(apiConfig);