arky-sdk 0.3.78 → 0.3.80

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
@@ -58,7 +58,6 @@ interface ReservationEngineState {
58
58
  service: any | null;
59
59
  providers: ProviderWithTimeline[];
60
60
  selectedProvider: ProviderWithTimeline | null;
61
- selectedMethod: string | null;
62
61
  currentMonth: Date;
63
62
  calendar: CalendarDay[];
64
63
  selectedDate: string | null;
@@ -243,7 +242,6 @@ declare function createArkySDK(config: HttpClientConfig & {
243
242
  loadMonth(): Promise<void>;
244
243
  prevMonth(): void;
245
244
  nextMonth(): void;
246
- selectMethod(method: string): void;
247
245
  selectProvider(provider: ProviderWithTimeline | null): void;
248
246
  selectDate(day: CalendarDay): void;
249
247
  selectSlot(slot: Slot): void;
package/dist/index.d.ts CHANGED
@@ -58,7 +58,6 @@ interface ReservationEngineState {
58
58
  service: any | null;
59
59
  providers: ProviderWithTimeline[];
60
60
  selectedProvider: ProviderWithTimeline | null;
61
- selectedMethod: string | null;
62
61
  currentMonth: Date;
63
62
  calendar: CalendarDay[];
64
63
  selectedDate: string | null;
@@ -243,7 +242,6 @@ declare function createArkySDK(config: HttpClientConfig & {
243
242
  loadMonth(): Promise<void>;
244
243
  prevMonth(): void;
245
244
  nextMonth(): void;
246
- selectMethod(method: string): void;
247
245
  selectProvider(provider: ProviderWithTimeline | null): void;
248
246
  selectDate(day: CalendarDay): void;
249
247
  selectSlot(slot: Slot): void;
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}`, {
@@ -1772,7 +1770,6 @@ var createInitialState = (timezone) => ({
1772
1770
  service: null,
1773
1771
  providers: [],
1774
1772
  selectedProvider: null,
1775
- selectedMethod: null,
1776
1773
  currentMonth: new Date((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), 1),
1777
1774
  calendar: [],
1778
1775
  selectedDate: null,
@@ -1863,7 +1860,6 @@ var createReservationEngine = (api, config = {}) => {
1863
1860
  store.set({
1864
1861
  ...store.get(),
1865
1862
  service,
1866
- selectedMethod: service.reservationMethods?.length === 1 ? service.reservationMethods[0] : null,
1867
1863
  selectedProvider: null,
1868
1864
  providers: [],
1869
1865
  selectedDate: null,
@@ -1907,19 +1903,6 @@ var createReservationEngine = (api, config = {}) => {
1907
1903
  store.setKey("currentMonth", new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1));
1908
1904
  actions.loadMonth();
1909
1905
  },
1910
- selectMethod(method) {
1911
- store.set({
1912
- ...store.get(),
1913
- selectedMethod: method,
1914
- selectedProvider: null,
1915
- selectedDate: null,
1916
- startDate: null,
1917
- endDate: null,
1918
- slots: [],
1919
- selectedSlot: null
1920
- });
1921
- store.setKey("calendar", buildCalendar());
1922
- },
1923
1906
  selectProvider(provider) {
1924
1907
  store.set({
1925
1908
  ...store.get(),
@@ -1980,21 +1963,18 @@ var createReservationEngine = (api, config = {}) => {
1980
1963
  if (!state.cart.length) throw new Error("Cart is empty");
1981
1964
  store.setKey("loading", true);
1982
1965
  try {
1983
- const result = await api.checkout({
1966
+ return api.checkout({
1984
1967
  items: state.cart.map((s) => ({
1985
1968
  serviceId: s.serviceId,
1986
1969
  providerId: s.providerId,
1987
1970
  from: s.from,
1988
1971
  to: s.to,
1989
- blocks: s.serviceBlocks || [],
1990
- reservationMethod: s.reservationMethod || state.selectedMethod || "STANDARD"
1972
+ blocks: s.serviceBlocks || []
1991
1973
  })),
1992
1974
  paymentMethod: options.paymentMethod,
1993
1975
  promoCode: options.promoCode ?? null,
1994
1976
  blocks: options.blocks || []
1995
1977
  });
1996
- store.setKey("cart", []);
1997
- return result;
1998
1978
  } finally {
1999
1979
  store.setKey("loading", false);
2000
1980
  }