@wix/bookings 1.0.1776 → 1.0.1778

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.
Files changed (71) hide show
  1. package/build/cjs/context-booking-checkout.d.ts +243 -108
  2. package/build/cjs/context-booking-checkout.js +177 -183
  3. package/build/cjs/context-booking-checkout.js.map +1 -1
  4. package/build/cjs/context-categories.d.ts +16 -143
  5. package/build/cjs/context-categories.js +412 -412
  6. package/build/cjs/context-categories.js.map +1 -1
  7. package/build/cjs/context-locations.d.ts +16 -287
  8. package/build/cjs/context-locations.js +336 -336
  9. package/build/cjs/context-locations.js.map +1 -1
  10. package/build/cjs/context-service-addons.d.ts +2 -2
  11. package/build/cjs/context-service-addons.js +1 -1
  12. package/build/cjs/context-service-addons.js.map +1 -1
  13. package/build/cjs/context-service.d.ts +71 -33
  14. package/build/cjs/context-service.js +98 -96
  15. package/build/cjs/context-service.js.map +1 -1
  16. package/build/cjs/context-services.js +1 -1
  17. package/build/cjs/context-services.js.map +1 -1
  18. package/build/cjs/context-time-slots.d.ts +10 -0
  19. package/build/cjs/context-time-slots.js +2 -2
  20. package/build/cjs/context-time-slots.js.map +1 -1
  21. package/build/es/context-booking-checkout.d.mts +243 -108
  22. package/build/es/context-booking-checkout.mjs +177 -180
  23. package/build/es/context-booking-checkout.mjs.map +1 -1
  24. package/build/es/context-categories.d.mts +16 -143
  25. package/build/es/context-categories.mjs +412 -412
  26. package/build/es/context-categories.mjs.map +1 -1
  27. package/build/es/context-locations.d.mts +16 -287
  28. package/build/es/context-locations.mjs +336 -336
  29. package/build/es/context-locations.mjs.map +1 -1
  30. package/build/es/context-service-addons.d.mts +2 -2
  31. package/build/es/context-service-addons.mjs +1 -1
  32. package/build/es/context-service-addons.mjs.map +1 -1
  33. package/build/es/context-service.d.mts +71 -33
  34. package/build/es/context-service.mjs +98 -96
  35. package/build/es/context-service.mjs.map +1 -1
  36. package/build/es/context-services.mjs +1 -1
  37. package/build/es/context-services.mjs.map +1 -1
  38. package/build/es/context-time-slots.d.mts +10 -0
  39. package/build/es/context-time-slots.mjs +2 -2
  40. package/build/es/context-time-slots.mjs.map +1 -1
  41. package/build/internal/cjs/context-booking-checkout.d.ts +243 -108
  42. package/build/internal/cjs/context-categories.d.ts +16 -143
  43. package/build/internal/cjs/context-locations.d.ts +16 -287
  44. package/build/internal/cjs/context-service-addons.d.ts +2 -2
  45. package/build/internal/cjs/context-service.d.ts +71 -33
  46. package/build/internal/cjs/context-time-slots.d.ts +10 -0
  47. package/build/internal/es/context-booking-checkout.d.mts +243 -108
  48. package/build/internal/es/context-categories.d.mts +16 -143
  49. package/build/internal/es/context-locations.d.mts +16 -287
  50. package/build/internal/es/context-service-addons.d.mts +2 -2
  51. package/build/internal/es/context-service.d.mts +71 -33
  52. package/build/internal/es/context-time-slots.d.mts +10 -0
  53. package/{_sdk-exports → context-runtime}/context-booking-checkout/runtime.d.ts +243 -108
  54. package/context-runtime/context-booking-checkout/runtime.js +3 -0
  55. package/{_sdk-exports → context-runtime}/context-categories/runtime.d.ts +16 -143
  56. package/context-runtime/context-categories/runtime.js +2 -0
  57. package/context-runtime/context-locations/runtime.d.ts +195 -0
  58. package/context-runtime/context-locations/runtime.js +2 -0
  59. package/{_sdk-exports → context-runtime}/context-service/runtime.d.ts +71 -33
  60. package/{_sdk-exports → context-runtime}/context-service/runtime.js +3 -3
  61. package/{_sdk-exports → context-runtime}/context-service-addons/runtime.d.ts +2 -2
  62. package/{_sdk-exports → context-runtime}/context-time-slots/runtime.d.ts +10 -0
  63. package/{_sdk-exports → context-runtime}/context-time-slots/runtime.js +2 -2
  64. package/package.json +8 -8
  65. package/_sdk-exports/context-booking-checkout/runtime.js +0 -3
  66. package/_sdk-exports/context-categories/runtime.js +0 -2
  67. package/_sdk-exports/context-locations/runtime.d.ts +0 -466
  68. package/_sdk-exports/context-locations/runtime.js +0 -2
  69. /package/{_sdk-exports → context-runtime}/context-service-addons/runtime.js +0 -0
  70. /package/{_sdk-exports → context-runtime}/context-services/runtime.d.ts +0 -0
  71. /package/{_sdk-exports → context-runtime}/context-services/runtime.js +0 -0
@@ -20,17 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // context-booking-checkout.ts
21
21
  var context_booking_checkout_exports = {};
22
22
  __export(context_booking_checkout_exports, {
23
- BOOKING_CHECKOUT_CONTEXT_MISSING_PROVIDER_ERROR: () => Wh,
24
23
  BookingCheckoutContextProvider: () => Kh,
25
- bookingCheckoutContext: () => Uh,
26
- canBookSelection: () => Vh,
27
24
  default: () => Kh,
28
25
  injectAccessTokenGetter: () => qh,
29
26
  useBookingCheckoutContext: () => Gh
30
27
  });
31
28
  module.exports = __toCommonJS(context_booking_checkout_exports);
32
29
 
33
- // _sdk-exports/context-booking-checkout/runtime.js
30
+ // context-runtime/context-booking-checkout/runtime.js
34
31
  var import_react = require("react");
35
32
  var import_services_manager_react = require("@wix/services-manager-react");
36
33
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -56,11 +53,11 @@ var h = f(() => {
56
53
  function g(e2, t2 = false, n2 = (e3) => e3) {
57
54
  return () => ({ __type: `event-definition`, type: e2, isDomainEvent: t2, transformations: n2 });
58
55
  }
59
- var ee;
60
- var _ = f(() => {
61
- ee = { ASC: `ASC`, DESC: `DESC` }, { ...ee };
56
+ var _;
57
+ var v = f(() => {
58
+ _ = { ASC: `ASC`, DESC: `DESC` }, { ..._ };
62
59
  });
63
- var v = (e2) => {
60
+ var y = (e2) => {
64
61
  switch (e2) {
65
62
  case `get`:
66
63
  case `GET`:
@@ -87,11 +84,11 @@ var v = (e2) => {
87
84
  throw Error(`Unknown method: ${e2}`);
88
85
  }
89
86
  };
90
- var te = (e2) => (t2) => async (n2) => {
87
+ var ee = (e2) => (t2) => async (n2) => {
91
88
  let r2, i2 = (t3) => {
92
89
  if (r2 = e2(n2)(t3), r2.url === void 0) throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);
93
90
  let { method: i3, url: a2, params: o2 } = r2;
94
- return { ...r2, method: v(i3), url: a2, data: r2.data, params: o2 };
91
+ return { ...r2, method: y(i3), url: a2, data: r2.data, params: o2 };
95
92
  };
96
93
  try {
97
94
  let e3 = await t2.request(i2);
@@ -104,10 +101,10 @@ var te = (e2) => (t2) => async (n2) => {
104
101
  throw typeof e3 == `object` && e3 && `response` in e3 && typeof e3.response == `object` && e3.response !== null && `data` in e3.response ? e3.response.data : e3;
105
102
  }
106
103
  };
107
- var ne = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
108
- var re = `__metadata`;
109
- var ie = `edge.wixapis.com`;
110
- var ae = class extends Error {
104
+ var te = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
105
+ var ne = `__metadata`;
106
+ var re = `edge.wixapis.com`;
107
+ var ie = class extends Error {
111
108
  message;
112
109
  response;
113
110
  constructor(e2, t2) {
@@ -115,25 +112,25 @@ var ae = class extends Error {
115
112
  }
116
113
  async details() {
117
114
  let e2 = await this.response.json();
118
- return oe(this.response.status, e2?.message, e2?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e2 });
115
+ return ae(this.response.status, e2?.message, e2?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e2 });
119
116
  }
120
117
  };
121
- var oe = (e2, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
122
- var se = (e2) => e2?.method && [`post`, `put`, `patch`].includes(e2.method.toLocaleLowerCase()) && e2.body ? { "Content-Type": `application/json` } : {};
123
- var y = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
124
- var ce = (e2) => e2.__type === `host`;
125
- function le(e2, t2) {
118
+ var ae = (e2, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
119
+ var oe = (e2) => e2?.method && [`post`, `put`, `patch`].includes(e2.method.toLocaleLowerCase()) && e2.body ? { "Content-Type": `application/json` } : {};
120
+ var b = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
121
+ var se = (e2) => e2.__type === `host`;
122
+ function ce(e2, t2) {
126
123
  return e2.create(t2);
127
124
  }
128
- var ue = `x-wix-bi-gateway`;
129
- function de(e2, t2, n2) {
130
- return { [ue]: fe({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
125
+ var le = `x-wix-bi-gateway`;
126
+ function ue(e2, t2, n2) {
127
+ return { [le]: de({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
131
128
  }
132
- function fe(e2) {
129
+ function de(e2) {
133
130
  return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
134
131
  }
135
132
  h();
136
- function pe(e2) {
133
+ function fe(e2) {
137
134
  let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
138
135
  globalThis.__wix_context__ = void 0, m.client = void 0, m.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
139
136
  try {
@@ -142,60 +139,60 @@ function pe(e2) {
142
139
  globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
143
140
  }
144
141
  }
145
- var me = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
146
- function b(e2) {
147
- return ve(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
142
+ var pe = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
143
+ function x(e2) {
144
+ return _e(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
148
145
  }
149
- var he = /([\p{Ll}\d])(\p{Lu})/gu;
150
- var ge = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
151
- var _e = `$1\0$2`;
152
- var x = /[^\p{L}\d]+/giu;
153
- function ve(e2) {
146
+ var me = /([\p{Ll}\d])(\p{Lu})/gu;
147
+ var he = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
148
+ var ge = `$1\0$2`;
149
+ var S = /[^\p{L}\d]+/giu;
150
+ function _e(e2) {
154
151
  let t2 = e2.trim();
155
- t2 = t2.replace(he, _e).replace(ge, _e), t2 = t2.replace(x, `\0`);
152
+ t2 = t2.replace(me, ge).replace(he, ge), t2 = t2.replace(S, `\0`);
156
153
  let n2 = 0, r2 = t2.length;
157
154
  for (; t2.charAt(n2) === `\0`; ) n2++;
158
155
  if (n2 === r2) return [];
159
156
  for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
160
157
  return t2.slice(n2, r2).split(/\0/g);
161
158
  }
162
- var ye = (e2) => `validationError` in (e2.response?.data?.details ?? {});
163
- var be = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
164
- var S = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
165
- function xe(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
159
+ var C = (e2) => `validationError` in (e2.response?.data?.details ?? {});
160
+ var ve = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
161
+ var ye = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
162
+ function be(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
166
163
  if (typeof e2 != `object` || !e2) throw e2;
167
- if (ye(e2)) return Se(e2, t2, n2);
168
- if (be(e2)) return we(e2);
169
- if (S(e2)) {
170
- let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: b(n3), data: {} }, requestId: e2.requestId };
171
- return Ce(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
164
+ if (C(e2)) return xe(e2, t2, n2);
165
+ if (ve(e2)) return Ce(e2);
166
+ if (ye(e2)) {
167
+ let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: x(n3), data: {} }, requestId: e2.requestId };
168
+ return Se(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
172
169
  }
173
- return Te(e2);
170
+ return we(e2);
174
171
  }
175
- var Se = (e2, t2, n2) => {
176
- let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = Ee(t2, a2, n2)?.sort((e3, t3) => e3.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e3, description: t3 }) => `"${e3}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
177
- return Ce(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
172
+ var xe = (e2, t2, n2) => {
173
+ let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = Te(t2, a2, n2)?.sort((e3, t3) => e3.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e3, description: t3 }) => `"${e3}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
174
+ return Se(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
178
175
  };
179
- var Ce = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
180
- var we = (e2) => {
181
- let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ?? b(n2), o2 = e2.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e2.requestId };
182
- return Ce(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
176
+ var Se = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
177
+ var Ce = (e2) => {
178
+ let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ?? x(n2), o2 = e2.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e2.requestId };
179
+ return Se(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
183
180
  };
184
- var Te = (e2) => Ce(e2, { message: e2.requestId ? `System error occurred, request-id: ${e2.requestId}` : `System error occurred: ${JSON.stringify(e2)}`, extraProperties: { requestId: e2.requestId, status: e2.response?.status, code: b(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
185
- var Ee = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
181
+ var we = (e2) => Se(e2, { message: e2.requestId ? `System error occurred, request-id: ${e2.requestId}` : `System error occurred: ${JSON.stringify(e2)}`, extraProperties: { requestId: e2.requestId, status: e2.response?.status, code: x(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
182
+ var Te = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
186
183
  let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
187
184
  return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
188
185
  let r3 = t2[e3.field];
189
- if (r3) return { ...e3, field: C(r3, i2) };
186
+ if (r3) return { ...e3, field: Ee(r3, i2) };
190
187
  let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
191
188
  if (s2) {
192
189
  let t3 = a2[s2];
193
- if (t3) return { ...e3, field: e3.field.replace(s2, C(t3, i2)) };
190
+ if (t3) return { ...e3, field: e3.field.replace(s2, Ee(t3, i2)) };
194
191
  }
195
192
  return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
196
193
  });
197
194
  };
198
- var C = (e2, t2) => {
195
+ var Ee = (e2, t2) => {
199
196
  let n2 = De(e2);
200
197
  return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
201
198
  };
@@ -204,20 +201,20 @@ var De = (e2) => {
204
201
  return t2 && t2.groups && Number(t2.groups.argIndex);
205
202
  };
206
203
  function Oe(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
207
- return pe(() => e2({ request: async (e3) => {
204
+ return fe(() => e2({ request: async (e3) => {
208
205
  let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
209
206
  a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
210
- let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? ie : o3}${a3.url}`;
207
+ let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? re : o3}${a3.url}`;
211
208
  a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
212
209
  try {
213
- let e4 = de(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
210
+ let e4 = ue(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
214
211
  if (s3.status !== 200) {
215
212
  let e5 = null;
216
213
  try {
217
214
  e5 = await s3.json();
218
215
  } catch {
219
216
  }
220
- let t3 = Ae(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = xe(t3);
217
+ let t3 = Ae(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = be(t3);
221
218
  throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
222
219
  }
223
220
  let l3 = await s3.json();
@@ -307,7 +304,7 @@ var Le = class {
307
304
  if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
308
305
  r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
309
306
  }, a2 = (e3, t3) => {
310
- let i3 = e3 in me ? me[e3] : void 0;
307
+ let i3 = e3 in pe ? pe[e3] : void 0;
311
308
  if (i3 && i3 in t3) {
312
309
  r2.push(i3), n2 = t3[i3];
313
310
  return;
@@ -384,7 +381,7 @@ function He() {
384
381
  };
385
382
  } };
386
383
  }
387
- _();
384
+ v();
388
385
  var Ue = (e2) => e2.__type === `event-definition`;
389
386
  function We(e2, t2, n2, r2) {
390
387
  let i2;
@@ -479,7 +476,7 @@ function qe(e2) {
479
476
  return s2.transformations.toREST(await c2(s2.transformations.fromREST(e3)));
480
477
  } } };
481
478
  }
482
- h(), _();
479
+ h(), v();
483
480
  var Je = `X-Wix-Consistent`;
484
481
  function Ye(e2) {
485
482
  let t2 = e2.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e3) => Promise.resolve({ headers: {} }) }, r2 = e2.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e2.host), o2 = () => e2.fetch ?? fetch, s2 = async (n3, r3) => {
@@ -502,21 +499,21 @@ function Ye(e2) {
502
499
  throw l3?.handleError(e3, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e3;
503
500
  }
504
501
  }, { client: c2, initModule: l2 } = qe(i2), { client: u2, initModule: d2 } = Ge(i2), f2 = async (n3, r3) => {
505
- let i3 = o2(), s3 = await a2(), c3 = se(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Je]: t2[Je] } : {} } }), u3 = Xe(l3);
502
+ let i3 = o2(), s3 = await a2(), c3 = oe(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [Je]: t2[Je] } : {} } }), u3 = Xe(l3);
506
503
  return u3 && (t2[Je] = u3), l3;
507
504
  }, p2 = (t3, n3) => {
508
505
  if (Ue(t3)) return d2(t3);
509
506
  if (Ke(t3)) return l2(t3);
510
- if (ce(t3) && e2.host) return le(t3, e2.host);
507
+ if (se(t3) && e2.host) return ce(t3, e2.host);
511
508
  if (typeof t3 == `function`) {
512
509
  if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
513
510
  let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
514
- return Oe(pe(() => ne(t3)) ? te(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
511
+ return Oe(fe(() => te(t3)) ? ee(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
515
512
  let n4 = new URL(e3, `https://${r3}`);
516
513
  return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
517
514
  }, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
518
515
  }
519
- return y(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, p2(n4, t3[re])])) : t3;
516
+ return b(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, p2(n4, t3[ne])])) : t3;
520
517
  }, h2 = (e3) => {
521
518
  for (let n3 in e3) t2[n3] = e3[n3];
522
519
  };
@@ -530,7 +527,7 @@ function Ye(e2) {
530
527
  return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
531
528
  }, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
532
529
  let i3 = e2?.host?.apiBaseUrl ?? `www.wixapis.com`, a3 = await f2(`https://${i3}/graphql/${r3.apiVersion}`, { method: `POST`, headers: { "Content-Type": `application/json` }, body: JSON.stringify({ query: t3, variables: n3 }) });
533
- if (a3.status !== 200) throw new ae(`GraphQL request failed with status ${a3.status}`, a3);
530
+ if (a3.status !== 200) throw new ie(`GraphQL request failed with status ${a3.status}`, a3);
534
531
  let { data: o3, errors: s3 } = await a3.json();
535
532
  return { data: o3 ?? {}, errors: s3 };
536
533
  }, webhooks: u2, servicePlugins: c2 };
@@ -2333,82 +2330,82 @@ var yc = function(e2, t2, n2, r2) {
2333
2330
  var r3 = new B(Math.max(t3 * 2, e3));
2334
2331
  r3.set(n2), n2 = r3;
2335
2332
  }
2336
- }, u2 = t2.f || 0, d2 = t2.p || 0, f2 = t2.b || 0, p2 = t2.l, m2 = t2.d, h2 = t2.m, g2 = t2.n, ee2 = i2 * 8;
2333
+ }, u2 = t2.f || 0, d2 = t2.p || 0, f2 = t2.b || 0, p2 = t2.l, m2 = t2.d, h2 = t2.m, g2 = t2.n, _2 = i2 * 8;
2337
2334
  do {
2338
2335
  if (!p2) {
2339
2336
  u2 = H(e2, d2, 1);
2340
- var _2 = H(e2, d2 + 1, 3);
2341
- if (d2 += 3, !_2) {
2342
- var v2 = gc(d2) + 4, te2 = e2[v2 - 4] | e2[v2 - 3] << 8, ne2 = v2 + te2;
2343
- if (ne2 > i2) {
2337
+ var v2 = H(e2, d2 + 1, 3);
2338
+ if (d2 += 3, !v2) {
2339
+ var y2 = gc(d2) + 4, ee2 = e2[y2 - 4] | e2[y2 - 3] << 8, te2 = y2 + ee2;
2340
+ if (te2 > i2) {
2344
2341
  c2 && U(0);
2345
2342
  break;
2346
2343
  }
2347
- s2 && l2(f2 + te2), n2.set(e2.subarray(v2, ne2), f2), t2.b = f2 += te2, t2.p = d2 = ne2 * 8, t2.f = u2;
2344
+ s2 && l2(f2 + ee2), n2.set(e2.subarray(y2, te2), f2), t2.b = f2 += ee2, t2.p = d2 = te2 * 8, t2.f = u2;
2348
2345
  continue;
2349
2346
  }
2350
- if (_2 == 1) p2 = fc, m2 = pc, h2 = 9, g2 = 5;
2351
- else if (_2 == 2) {
2352
- var re2 = H(e2, d2, 31) + 257, ie2 = H(e2, d2 + 10, 15) + 4, ae2 = re2 + H(e2, d2 + 5, 31) + 1;
2347
+ if (v2 == 1) p2 = fc, m2 = pc, h2 = 9, g2 = 5;
2348
+ else if (v2 == 2) {
2349
+ var ne2 = H(e2, d2, 31) + 257, re2 = H(e2, d2 + 10, 15) + 4, ie2 = ne2 + H(e2, d2 + 5, 31) + 1;
2353
2350
  d2 += 14;
2354
- for (var oe2 = new B(ae2), se2 = new B(19), y2 = 0; y2 < ie2; ++y2) se2[ec[y2]] = H(e2, d2 + y2 * 3, 7);
2355
- d2 += ie2 * 3;
2356
- for (var ce2 = mc(se2), le2 = (1 << ce2) - 1, ue2 = lc(se2, ce2, 1), y2 = 0; y2 < ae2; ) {
2357
- var de2 = ue2[H(e2, d2, le2)];
2358
- d2 += de2 & 15;
2359
- var v2 = de2 >> 4;
2360
- if (v2 < 16) oe2[y2++] = v2;
2351
+ for (var ae2 = new B(ie2), oe2 = new B(19), b2 = 0; b2 < re2; ++b2) oe2[ec[b2]] = H(e2, d2 + b2 * 3, 7);
2352
+ d2 += re2 * 3;
2353
+ for (var se2 = mc(oe2), ce2 = (1 << se2) - 1, le2 = lc(oe2, se2, 1), b2 = 0; b2 < ie2; ) {
2354
+ var ue2 = le2[H(e2, d2, ce2)];
2355
+ d2 += ue2 & 15;
2356
+ var y2 = ue2 >> 4;
2357
+ if (y2 < 16) ae2[b2++] = y2;
2361
2358
  else {
2362
- var fe2 = 0, pe2 = 0;
2363
- for (v2 == 16 ? (pe2 = 3 + H(e2, d2, 3), d2 += 2, fe2 = oe2[y2 - 1]) : v2 == 17 ? (pe2 = 3 + H(e2, d2, 7), d2 += 3) : v2 == 18 && (pe2 = 11 + H(e2, d2, 127), d2 += 7); pe2--; ) oe2[y2++] = fe2;
2359
+ var de2 = 0, fe2 = 0;
2360
+ for (y2 == 16 ? (fe2 = 3 + H(e2, d2, 3), d2 += 2, de2 = ae2[b2 - 1]) : y2 == 17 ? (fe2 = 3 + H(e2, d2, 7), d2 += 3) : y2 == 18 && (fe2 = 11 + H(e2, d2, 127), d2 += 7); fe2--; ) ae2[b2++] = de2;
2364
2361
  }
2365
2362
  }
2366
- var me2 = oe2.subarray(0, re2), b2 = oe2.subarray(re2);
2367
- h2 = mc(me2), g2 = mc(b2), p2 = lc(me2, h2, 1), m2 = lc(b2, g2, 1);
2363
+ var pe2 = ae2.subarray(0, ne2), x2 = ae2.subarray(ne2);
2364
+ h2 = mc(pe2), g2 = mc(x2), p2 = lc(pe2, h2, 1), m2 = lc(x2, g2, 1);
2368
2365
  } else U(1);
2369
- if (d2 > ee2) {
2366
+ if (d2 > _2) {
2370
2367
  c2 && U(0);
2371
2368
  break;
2372
2369
  }
2373
2370
  }
2374
2371
  s2 && l2(f2 + 131072);
2375
- for (var he2 = (1 << h2) - 1, ge2 = (1 << g2) - 1, _e2 = d2; ; _e2 = d2) {
2376
- var fe2 = p2[hc(e2, d2) & he2], x2 = fe2 >> 4;
2377
- if (d2 += fe2 & 15, d2 > ee2) {
2372
+ for (var me2 = (1 << h2) - 1, he2 = (1 << g2) - 1, ge2 = d2; ; ge2 = d2) {
2373
+ var de2 = p2[hc(e2, d2) & me2], S2 = de2 >> 4;
2374
+ if (d2 += de2 & 15, d2 > _2) {
2378
2375
  c2 && U(0);
2379
2376
  break;
2380
2377
  }
2381
- if (fe2 || U(2), x2 < 256) n2[f2++] = x2;
2382
- else if (x2 == 256) {
2383
- _e2 = d2, p2 = null;
2378
+ if (de2 || U(2), S2 < 256) n2[f2++] = S2;
2379
+ else if (S2 == 256) {
2380
+ ge2 = d2, p2 = null;
2384
2381
  break;
2385
2382
  } else {
2386
- var ve2 = x2 - 254;
2387
- if (x2 > 264) {
2388
- var y2 = x2 - 257, ye2 = Qs[y2];
2389
- ve2 = H(e2, d2, (1 << ye2) - 1) + rc[y2], d2 += ye2;
2383
+ var _e2 = S2 - 254;
2384
+ if (S2 > 264) {
2385
+ var b2 = S2 - 257, C2 = Qs[b2];
2386
+ _e2 = H(e2, d2, (1 << C2) - 1) + rc[b2], d2 += C2;
2390
2387
  }
2391
- var be2 = m2[hc(e2, d2) & ge2], S2 = be2 >> 4;
2392
- be2 || U(3), d2 += be2 & 15;
2393
- var b2 = oc[S2];
2394
- if (S2 > 3) {
2395
- var ye2 = $s[S2];
2396
- b2 += hc(e2, d2) & (1 << ye2) - 1, d2 += ye2;
2388
+ var ve2 = m2[hc(e2, d2) & he2], ye2 = ve2 >> 4;
2389
+ ve2 || U(3), d2 += ve2 & 15;
2390
+ var x2 = oc[ye2];
2391
+ if (ye2 > 3) {
2392
+ var C2 = $s[ye2];
2393
+ x2 += hc(e2, d2) & (1 << C2) - 1, d2 += C2;
2397
2394
  }
2398
- if (d2 > ee2) {
2395
+ if (d2 > _2) {
2399
2396
  c2 && U(0);
2400
2397
  break;
2401
2398
  }
2402
2399
  s2 && l2(f2 + 131072);
2403
- var xe2 = f2 + ve2;
2404
- if (f2 < b2) {
2405
- var Se2 = a2 - b2, Ce2 = Math.min(b2, xe2);
2406
- for (Se2 + f2 < 0 && U(3); f2 < Ce2; ++f2) n2[f2] = r2[Se2 + f2];
2400
+ var be2 = f2 + _e2;
2401
+ if (f2 < x2) {
2402
+ var xe2 = a2 - x2, Se2 = Math.min(x2, be2);
2403
+ for (xe2 + f2 < 0 && U(3); f2 < Se2; ++f2) n2[f2] = r2[xe2 + f2];
2407
2404
  }
2408
- for (; f2 < xe2; ++f2) n2[f2] = n2[f2 - b2];
2405
+ for (; f2 < be2; ++f2) n2[f2] = n2[f2 - x2];
2409
2406
  }
2410
2407
  }
2411
- t2.l = p2, t2.p = _e2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
2408
+ t2.l = p2, t2.p = ge2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
2412
2409
  } while (!u2);
2413
2410
  return f2 != n2.length && o2 ? _c(n2, 0, f2) : n2.subarray(0, f2);
2414
2411
  };
@@ -2509,8 +2506,8 @@ function Fc(e2) {
2509
2506
  h2 && (n2.durationChoiceId = h2);
2510
2507
  let g2 = Dc(e2.dm);
2511
2508
  g2 !== void 0 && Number.isInteger(g2) && g2 > 0 && (n2.durationInMinutes = g2);
2512
- let ee2 = W(e2.rg);
2513
- return ee2 !== void 0 && Ec.has(ee2) && (n2.requestedGender = ee2), n2;
2509
+ let _2 = W(e2.rg);
2510
+ return _2 !== void 0 && Ec.has(_2) && (n2.requestedGender = _2), n2;
2514
2511
  }
2515
2512
  function Ic(e2) {
2516
2513
  if (!Ac(e2)) return null;
@@ -2541,7 +2538,7 @@ function zc(e2) {
2541
2538
  }
2542
2539
  var Bc = ((e2) => (e2.UNKNOWN = `UNKNOWN`, e2.CUSTOM = `CUSTOM`, e2.STAFF_MEMBER = `STAFF_MEMBER`, e2.DURATION = `DURATION`, e2.DATE_TIME = `DATE_TIME`, e2.NUMBER_OF_PARTICIPANTS = `NUMBER_OF_PARTICIPANTS`, e2.LOCATION = `LOCATION`, e2.DURATION_RANGE = `DURATION_RANGE`, e2))(Bc || {});
2543
2540
  var Vc = p({ Action: () => Fu, Actor: () => xu, AddOnPaymentOptions: () => Ql, AggregationType: () => Mu, BookingStatus: () => _u, ChargeType: () => $l, CloneErrors: () => Lu, CompletionRequirement: () => au, CrudType: () => Bu, DayOfWeek: () => Hu, DurationUnitType: () => hu, Event: () => zu, FirstChargeDateType: () => Zl, FrequencyType: () => Xl, IdentityType: () => Su, Interval: () => ju, InvalidSlugError: () => Iu, LocationType: () => fu, LocationTypeEnumLocationType: () => eu, MissingValues: () => Ou, Mode: () => Nu, MultiServiceBookingType: () => uu, NestedAggregationType: () => Au, PaymentStatus: () => vu, PlacementType: () => Vu, Platform: () => bu, PricingPlanOutcome: () => tu, RankingOrder: () => nu, RateType: () => Yl, RequestedFields: () => Pu, RequestedGender: () => mu, ResolutionMethod: () => Uu, ResourceTransparency: () => du, ScalarType: () => ku, SelectedPaymentOption: () => yu, SelectionMethod: () => pu, ServiceType: () => Jl, SortDirection: () => Du, SortOrder: () => Tu, SortType: () => Eu, SortingMethodType: () => ru, Status: () => Ru, TaxableAddressType: () => lu, TimeBoundariesType: () => su, Timing: () => iu, UnitType: () => ou, V2RequestedFields: () => wu, ValueType: () => gu, WebhookIdentityType: () => Cu, WorkingHoursMode: () => cu, bulkCreateServices: () => sf, bulkDeleteServices: () => pf, bulkDeleteServicesByFilter: () => mf, bulkUpdateServices: () => uf, bulkUpdateServicesByFilter: () => df, cloneService: () => Ef, countServices: () => vf, createAddOnGroup: () => Df, createService: () => of, deleteAddOnGroup: () => Of, deleteService: () => ff, disablePricingPlansForService: () => Cf, enablePricingPlansForService: () => Sf, getService: () => cf, listAddOnGroupsByServiceId: () => Af, onServiceCreated: () => Nf, onServiceDeleted: () => Pf, onServiceUpdated: () => Ff, queryBookingForms: () => _f, queryCategories: () => bf, queryLocations: () => yf, queryPolicies: () => gf, queryServices: () => Mf, searchServices: () => hf, setAddOnsForGroup: () => jf, setCustomSlug: () => wf, setServiceLocations: () => xf, updateAddOnGroup: () => kf, updateService: () => lf, utils: () => td, validateSlug: () => Tf });
2544
- dt(), jn(), Hr(), ni(), ft(), Tt(), _(), Gt(), yr(), En(), kn(), sr(), Er(), ei(), On(), Br();
2541
+ dt(), jn(), Hr(), ni(), ft(), Tt(), v(), Gt(), yr(), En(), kn(), sr(), Er(), ei(), On(), Br();
2545
2542
  var Hc = [{ path: `service.createdDate` }, { path: `service.updatedDate` }, { path: `service.media.items.image.urlExpirationDate` }, { path: `service.media.mainMedia.image.urlExpirationDate` }, { path: `service.media.coverMedia.image.urlExpirationDate` }, { path: `service.payment.subscription.recurringStartDate` }, { path: `service.bookingPolicy.createdDate` }, { path: `service.bookingPolicy.updatedDate` }, { path: `service.schedule.firstSessionStart` }, { path: `service.schedule.lastSessionEnd` }, { path: `service.staffMembers.mainMedia.image.urlExpirationDate` }, { path: `service.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate` }, { path: `service.supportedSlugs.createdDate` }, { path: `service.mainSlug.createdDate` }];
2546
2543
  var G = [{ path: `service.locations.business.address.geocode.latitude` }, { path: `service.locations.business.address.geocode.longitude` }, { path: `service.locations.custom.address.geocode.latitude` }, { path: `service.locations.custom.address.geocode.longitude` }, { path: `service.locations.calculatedAddress.geocode.latitude` }, { path: `service.locations.calculatedAddress.geocode.longitude` }];
2547
2544
  var Uc = [{ path: `services.createdDate` }, { path: `services.updatedDate` }, { path: `services.media.items.image.urlExpirationDate` }, { path: `services.media.mainMedia.image.urlExpirationDate` }, { path: `services.media.coverMedia.image.urlExpirationDate` }, { path: `services.payment.subscription.recurringStartDate` }, { path: `services.bookingPolicy.createdDate` }, { path: `services.bookingPolicy.updatedDate` }, { path: `services.schedule.firstSessionStart` }, { path: `services.schedule.lastSessionEnd` }, { path: `services.staffMembers.mainMedia.image.urlExpirationDate` }, { path: `services.staffMemberDetails.staffMembers.mainMedia.image.urlExpirationDate` }, { path: `services.supportedSlugs.createdDate` }, { path: `services.mainSlug.createdDate` }];
@@ -3882,11 +3879,11 @@ var kh = () => {
3882
3879
  }, [m2, r2]), g2 = (0, import_react.useCallback)((e3, t2) => {
3883
3880
  let n3 = m2(e3, t2);
3884
3881
  n3 && s2(n3);
3885
- }, [m2, s2]), ee2 = (0, import_react.useCallback)(() => f2(Ho.FORM_PAGE) || void 0, [f2]), _2 = (0, import_react.useCallback)((e3) => Object.values(o2(rr).pages).some((t2) => t2.appPageId === e3 && (!t2.appDefinitionId || t2.appDefinitionId === `1380b703-ce81-ff05-f115-39571d94dfcd`)) && n2.appSectionRelativeUrl(`1380b703-ce81-ff05-f115-39571d94dfcd`, e3) || void 0, [n2, o2]);
3886
- return { navigate: s2, navigateToHref: u2, resolvePath: m2, toHref: d2, resolveAbsoluteUrl: h2, navigateTo: g2, getBookingFormPath: ee2, getCartPagePath: (0, import_react.useCallback)(() => _2(zo), [_2]), getThankYouPagePath: (0, import_react.useCallback)((e3) => {
3887
- let t2 = _2(Bo);
3882
+ }, [m2, s2]), _2 = (0, import_react.useCallback)(() => f2(Ho.FORM_PAGE) || void 0, [f2]), v2 = (0, import_react.useCallback)((e3) => Object.values(o2(rr).pages).some((t2) => t2.appPageId === e3 && (!t2.appDefinitionId || t2.appDefinitionId === `1380b703-ce81-ff05-f115-39571d94dfcd`)) && n2.appSectionRelativeUrl(`1380b703-ce81-ff05-f115-39571d94dfcd`, e3) || void 0, [n2, o2]);
3883
+ return { navigate: s2, navigateToHref: u2, resolvePath: m2, toHref: d2, resolveAbsoluteUrl: h2, navigateTo: g2, getBookingFormPath: _2, getCartPagePath: (0, import_react.useCallback)(() => v2(zo), [v2]), getThankYouPagePath: (0, import_react.useCallback)((e3) => {
3884
+ let t2 = v2(Bo);
3888
3885
  return t2 ? `${t2}/${e3}?origin=bookings` : void 0;
3889
- }, [_2]) };
3886
+ }, [v2]) };
3890
3887
  };
3891
3888
  function Ah(e2) {
3892
3889
  (0, import_react.useEffect)(() => {
@@ -3945,105 +3942,105 @@ function Vh(e2) {
3945
3942
  return t2 && !ip(e2).valid ? false : e2.services.every((n2) => n2.serviceType ? ep(n2.serviceType) ? !t2 && !!n2.scheduleId : !cp(n2) || !e2.timezone ? false : t2 ? !!n2.scheduleId : !!(n2.scheduleId || n2.sessionId) : false);
3946
3943
  }
3947
3944
  function Hh() {
3948
- let { search: e2, href: n2, getRelativeUrl: s2 } = Fo(), l2 = (0, import_react.useMemo)(() => zc(new URLSearchParams(e2)), [e2]), u2 = l2 ? JSON.stringify({ timezone: l2.timezone, services: l2.services }) : null, d2 = (0, import_react.useRef)(null), [f2, p2] = (0, import_react.useState)(false), [m2, h2] = (0, import_react.useState)(false), [g2, ee2] = (0, import_react.useState)(null), _2 = (0, import_react.useCallback)((e3, t2) => {
3945
+ let { search: e2, href: n2, getRelativeUrl: s2 } = Fo(), l2 = (0, import_react.useMemo)(() => zc(new URLSearchParams(e2)), [e2]), u2 = l2 ? JSON.stringify({ timezone: l2.timezone, services: l2.services }) : null, d2 = (0, import_react.useRef)(null), [f2, p2] = (0, import_react.useState)(false), [m2, h2] = (0, import_react.useState)(false), [g2, _2] = (0, import_react.useState)(null), v2 = (0, import_react.useCallback)((e3, t2) => {
3949
3946
  let n3 = { selectionKey: u2, options: e3, isPlanAndBookBlocked: t2 };
3950
- return ee2(n3), () => ee2((e4) => e4 === n3 ? null : e4);
3951
- }, [u2]), v2 = (0, import_react.useCallback)((e3) => {
3947
+ return _2(n3), () => _2((e4) => e4 === n3 ? null : e4);
3948
+ }, [u2]), y2 = (0, import_react.useCallback)((e3) => {
3952
3949
  d2.current = e3, p2(e3 !== null), h2(e3?.hasCartConflict === true);
3953
- }, []), te2 = u2 && g2?.selectionKey === u2 ? g2 : null, ne2 = te2?.options ?? null, re2 = te2 !== null && te2.options === null, ie2 = $p(ne2, te2?.isPlanAndBookBlocked ?? false), ae2 = Vh(l2) && f2, [oe2, se2] = (0, import_react.useState)(null), y2 = (0, import_react.useCallback)((e3) => {
3954
- se2((t2) => JSON.stringify(t2) === JSON.stringify(e3) ? t2 : e3);
3955
- }, []), [ce2, le2] = (0, import_react.useState)(false), [ue2, de2] = (0, import_react.useState)(1), fe2 = (0, import_react.useCallback)((e3) => {
3956
- de2(Rh(e3));
3957
- }, []), [pe2, me2] = (0, import_react.useState)(false), [b2, he2] = (0, import_react.useState)(null), [ge2, _e2] = (0, import_react.useState)(null), x2 = JSON.stringify([u2, ue2]), ve2 = (0, import_react.useRef)({ key: x2, count: 0 });
3958
- ve2.current.key !== x2 && (ve2.current = { key: x2, count: ve2.current.count + 1 }), (0, import_react.useEffect)(() => {
3959
- he2(null), _e2(null);
3960
- }, [x2]);
3961
- let [ye2, be2] = (0, import_react.useState)(null), S2 = (0, import_react.useRef)(false), xe2 = (0, import_react.useRef)(/* @__PURE__ */ new Map()), Se2 = (0, import_services_manager_react.useGetService)(), Ce2 = (0, import_react.useCallback)((e3, t2 = []) => Se2(Co).callPublicApi(Ro, e3, t2), [Se2]), we2 = (0, import_react.useCallback)(async () => {
3950
+ }, []), ee2 = u2 && g2?.selectionKey === u2 ? g2 : null, te2 = ee2?.options ?? null, ne2 = ee2 !== null && ee2.options === null, re2 = $p(te2, ee2?.isPlanAndBookBlocked ?? false), ie2 = Vh(l2) && f2, [ae2, oe2] = (0, import_react.useState)(null), b2 = (0, import_react.useCallback)((e3) => {
3951
+ oe2((t2) => JSON.stringify(t2) === JSON.stringify(e3) ? t2 : e3);
3952
+ }, []), [se2, ce2] = (0, import_react.useState)(false), [le2, ue2] = (0, import_react.useState)(1), de2 = (0, import_react.useCallback)((e3) => {
3953
+ ue2(Rh(e3));
3954
+ }, []), [fe2, pe2] = (0, import_react.useState)(false), [x2, me2] = (0, import_react.useState)(null), [he2, ge2] = (0, import_react.useState)(null), S2 = JSON.stringify([u2, le2]), _e2 = (0, import_react.useRef)({ key: S2, count: 0 });
3955
+ _e2.current.key !== S2 && (_e2.current = { key: S2, count: _e2.current.count + 1 }), (0, import_react.useEffect)(() => {
3956
+ me2(null), ge2(null);
3957
+ }, [S2]);
3958
+ let C2 = (0, import_react.useRef)(false), ve2 = (0, import_react.useRef)(/* @__PURE__ */ new Map()), ye2 = (0, import_services_manager_react.useGetService)(), be2 = (0, import_react.useCallback)((e3, t2 = []) => ye2(Co).callPublicApi(Ro, e3, t2), [ye2]), xe2 = (0, import_react.useCallback)(async () => {
3962
3959
  try {
3963
- return await Ce2(`cart.hasSideCart`) ? (await Ce2(`cart.openSideCart`), true) : false;
3960
+ return await be2(`cart.hasSideCart`) ? (await be2(`cart.openSideCart`), true) : false;
3964
3961
  } catch (e3) {
3965
3962
  return ds(e3, { feature: ls.bookingCheckout, action: `openSideCart` }), false;
3966
3963
  }
3967
- }, [Ce2]), Te2 = xo(), Ee2 = Go(Uo.BOOKING_CHECKOUT), C2 = (0, import_react.useCallback)((e3) => {
3964
+ }, [be2]), Se2 = xo(), Ce2 = Go(Uo.BOOKING_CHECKOUT), we2 = (0, import_react.useCallback)((e3) => {
3968
3965
  try {
3969
- Ee2(e3());
3966
+ Ce2(e3());
3970
3967
  } catch {
3971
3968
  }
3972
- }, [Ee2]), { navigate: De2, navigateToHref: Oe2, getCartPagePath: ke2, getBookingFormPath: Ae2, getThankYouPagePath: je2 } = kh(), Me2 = (0, import_react.useCallback)(async () => {
3969
+ }, [Ce2]), { navigate: Te2, navigateToHref: Ee2, getCartPagePath: De2, getBookingFormPath: Oe2, getThankYouPagePath: ke2 } = kh(), Ae2 = (0, import_react.useCallback)(async () => {
3973
3970
  let t2 = d2.current;
3974
- if (S2.current || C2(() => Xn({})), !l2 || !t2 || !ae2 || S2.current) return null;
3975
- let { route: r2 } = ie2;
3976
- S2.current = true;
3977
- let i2 = ve2.current;
3978
- he2(null), _e2(null);
3971
+ if (C2.current || we2(() => Xn({})), !l2 || !t2 || !ie2 || C2.current) return null;
3972
+ let { route: r2 } = re2;
3973
+ C2.current = true;
3974
+ let i2 = _e2.current;
3975
+ me2(null), ge2(null);
3979
3976
  try {
3980
- if (!await t2.validate()) return S2.current = false, null;
3981
- if (me2(true), r2 === Z.PRICING_PLANS) {
3982
- C2(() => zh(t2, Bh[r2]));
3983
- let i4 = new URLSearchParams(e2).get(`referral`) ?? `bookings-form`, a3 = lm(Qp(ne2 ?? []), { href: n2, pathname: s2().slice(1), search: e2, formSectionPath: Ae2() }, i4);
3984
- return a3.page === `plan` ? await Te2.navigateToPlanPage(a3.options) : await Te2.navigateToPricingPage(a3.options), S2.current = false, me2(false), null;
3977
+ if (!await t2.validate()) return C2.current = false, null;
3978
+ if (pe2(true), r2 === Z.PRICING_PLANS) {
3979
+ we2(() => zh(t2, Bh[r2]));
3980
+ let i4 = new URLSearchParams(e2).get(`referral`) ?? `bookings-form`, a3 = lm(Qp(te2 ?? []), { href: n2, pathname: s2().slice(1), search: e2, formSectionPath: Oe2() }, i4);
3981
+ return a3.page === `plan` ? await Se2.navigateToPlanPage(a3.options) : await Se2.navigateToPricingPage(a3.options), C2.current = false, pe2(false), null;
3985
3982
  }
3986
- let i3 = await Lh(t2, l2, ue2);
3987
- fs({ message: `Create booking`, category: `ui.submit`, feature: ls.bookingCheckout, data: { services: l2.services.length } }), C2(() => zh(t2, Bh[r2]));
3988
- let a2 = await Fh(xe2.current, l2, i3, `checkout`), o2 = a2.bookingIds ?? [], c2 = Ih(a2, l2), u3 = { lines: c2, customer: a2.input.contactDetails, businessLocationId: Sp(l2) }, d3 = Zp(a2.input.payments.map(({ purchase: e3 }) => e3));
3989
- r2 === Z.DETAILS_PAGE ? a2.cartId ??= await tm(u3) : r2 === Z.INLINE_CART ? a2.cartId ??= await nm({ ...u3, purchases: d3 }) : a2.cartId ??= await Ip(u3);
3990
- let { cartId: f3 } = a2;
3991
- if (be2({ bookingIds: o2, cartId: f3 }), r2 === Z.DETAILS_PAGE) return window.location.assign(om(d3[0], f3, c2)), null;
3992
- if (r2 === Z.CHECKOUT && (a2.placesOrder ||= await Up(a2.input, Hp(l2.wantsPromoCode, oe2?.payments), () => Lp(f3)), a2.placesOrder && (a2.orderId ??= await zp(f3))), a2.orderId) {
3993
- let e3 = je2(a2.orderId);
3983
+ let i3 = await Lh(t2, l2, le2);
3984
+ fs({ message: `Create booking`, category: `ui.submit`, feature: ls.bookingCheckout, data: { services: l2.services.length } }), we2(() => zh(t2, Bh[r2]));
3985
+ let a2 = await Fh(ve2.current, l2, i3, `checkout`), o2 = Ih(a2, l2), c2 = { lines: o2, customer: a2.input.contactDetails, businessLocationId: Sp(l2) }, u3 = Zp(a2.input.payments.map(({ purchase: e3 }) => e3));
3986
+ r2 === Z.DETAILS_PAGE ? a2.cartId ??= await tm(c2) : r2 === Z.INLINE_CART ? a2.cartId ??= await nm({ ...c2, purchases: u3 }) : a2.cartId ??= await Ip(c2);
3987
+ let { cartId: d3 } = a2;
3988
+ if (r2 === Z.DETAILS_PAGE) return window.location.assign(om(u3[0], d3, o2)), null;
3989
+ if (r2 === Z.CHECKOUT && (a2.placesOrder ||= await Up(a2.input, Hp(l2.wantsPromoCode, ae2?.payments), () => Lp(d3)), a2.placesOrder && (a2.orderId ??= await zp(d3))), a2.orderId) {
3990
+ let e3 = ke2(a2.orderId);
3994
3991
  if (!e3) throw Error(`No eCom Thank You page on the site`);
3995
- await De2(e3);
3996
- } else window.location.assign(await Bp(f3));
3992
+ await Te2(e3);
3993
+ } else window.location.assign(await Bp(d3));
3997
3994
  return null;
3998
3995
  } catch (e3) {
3999
3996
  let t3 = Ph(e3);
4000
- return S2.current = false, me2(false), ds(e3, { feature: ls.bookingCheckout, action: `createBooking` }), C2(() => Qn({ errorReason: Zo(e3) })), ve2.current === i2 ? (he2(t3), { error: t3 }) : null;
3997
+ return C2.current = false, pe2(false), ds(e3, { feature: ls.bookingCheckout, action: `createBooking` }), we2(() => Qn({ errorReason: Zo(e3) })), _e2.current === i2 ? (me2(t3), { error: t3 }) : null;
4001
3998
  }
4002
- }, [l2, ae2, ie2, ne2, oe2, ue2, C2, Te2, De2, je2, e2, n2, s2, Ae2]), [Ne2, Pe2] = (0, import_react.useState)(false);
3999
+ }, [l2, ie2, re2, te2, ae2, le2, we2, Se2, Te2, ke2, e2, n2, s2, Oe2]), [je2, Me2] = (0, import_react.useState)(false);
4003
4000
  Ah((0, import_react.useCallback)(() => {
4004
- S2.current = false, me2(false), Pe2(false);
4001
+ C2.current = false, pe2(false), Me2(false);
4005
4002
  }, []));
4006
- let Fe2 = (0, import_react.useCallback)(async (e3 = `cart`) => {
4003
+ let Ne2 = (0, import_react.useCallback)(async (e3 = `cart`) => {
4007
4004
  let t2 = d2.current;
4008
- if (S2.current || C2(() => Xn({})), !l2 || !t2 || ie2.cta !== Wp.BOOK || t2.hasCartConflict || !ae2 || S2.current) return null;
4009
- S2.current = true;
4010
- let n3 = ve2.current;
4011
- _e2(null), he2(null);
4005
+ if (C2.current || we2(() => Xn({})), !l2 || !t2 || re2.cta !== Wp.BOOK || m2 || !ie2 || C2.current) return null;
4006
+ C2.current = true;
4007
+ let n3 = _e2.current;
4008
+ ge2(null), me2(null);
4012
4009
  try {
4013
- if (!await t2.validate()) return S2.current = false, null;
4014
- Pe2(true);
4015
- let n4 = await Lh(t2, l2, ue2);
4016
- fs({ message: `Add to cart`, category: `ui.submit`, feature: ls.bookingCheckout, data: { services: l2.services.length } }), C2(() => zh(t2, qo.ADD_TO_CART));
4010
+ if (!await t2.validate()) return C2.current = false, null;
4011
+ Me2(true);
4012
+ let n4 = await Lh(t2, l2, le2);
4013
+ fs({ message: `Add to cart`, category: `ui.submit`, feature: ls.bookingCheckout, data: { services: l2.services.length } }), we2(() => zh(t2, qo.ADD_TO_CART));
4017
4014
  let r2 = Sp(l2), i2 = r2 ? await um().catch(() => void 0) : void 0;
4018
4015
  if (i2 && i2 !== r2) throw Object.assign(Error(`The cart is at a different business location`), { details: { applicationError: { code: jh } } });
4019
- let a2 = await Fh(xe2.current, l2, n4, `cart`), o2 = a2.bookingIds ?? [];
4016
+ let a2 = await Fh(ve2.current, l2, n4, `cart`), o2 = a2.bookingIds ?? [];
4020
4017
  if (!a2.addedToCart) {
4021
4018
  let e4 = await dm(Ih(a2, l2));
4022
- a2.addedToCart = true, e4.cartId && be2({ bookingIds: o2, cartId: e4.cartId });
4019
+ a2.addedToCart = true;
4023
4020
  let t3 = r2 && !e4.locationId ? r2 : void 0, n5 = e4.bookingItemIds.length > 0 && e4.lineCount === e4.bookingItemIds.length && e4.bookingItemIds.every((e5) => o2.includes(e5)) ? a2.input.contactDetails : void 0;
4024
4021
  (t3 || n5) && (a2.cartUpdate = fm({ locationId: t3, customer: n5 }).catch((e5) => ds(e5, { feature: ls.bookingCheckout, action: `addToCart` })));
4025
4022
  }
4026
4023
  let s3 = Promise.all([a2.cartUpdate, (async () => {
4027
4024
  try {
4028
- await Ce2(`cart.reloadCart`);
4025
+ await be2(`cart.reloadCart`);
4029
4026
  } catch {
4030
4027
  }
4031
4028
  })()]);
4032
4029
  e3 !== `stay` && await s3;
4033
- let c2 = e3 === `cart` ? ke2() : void 0, u3 = true;
4034
- return c2 ? await De2(c2) : e3 === `cart` ? (u3 = false, await we2() || ds(Error(`The site has no eCom Cart page or side cart`), { feature: ls.bookingCheckout, action: `addToCart` })) : e3 === `home` ? await De2(`/`) : typeof e3 == `object` ? (await Oe2(e3), u3 = !Th(e3)) : u3 = false, u3 || (S2.current = false, Pe2(false)), { bookingIds: o2, leavesPage: u3 };
4030
+ let c2 = e3 === `cart` ? De2() : void 0, u3 = true;
4031
+ return c2 ? await Te2(c2) : e3 === `cart` ? (u3 = false, await xe2() || ds(Error(`The site has no eCom Cart page or side cart`), { feature: ls.bookingCheckout, action: `addToCart` })) : e3 === `home` ? await Te2(`/`) : typeof e3 == `object` ? (await Ee2(e3), u3 = !Th(e3)) : u3 = false, u3 || (C2.current = false, Me2(false)), { bookingIds: o2, leavesPage: u3 };
4035
4032
  } catch (e4) {
4036
4033
  let t3 = Ph(e4);
4037
- return S2.current = false, Pe2(false), ds(e4, { feature: ls.bookingCheckout, action: `addToCart` }), C2(() => Qn({ errorReason: Zo(e4) })), ve2.current === n3 ? (_e2(t3), { error: t3 }) : null;
4034
+ return C2.current = false, Me2(false), ds(e4, { feature: ls.bookingCheckout, action: `addToCart` }), we2(() => Qn({ errorReason: Zo(e4) })), _e2.current === n3 ? (ge2(t3), { error: t3 }) : null;
4038
4035
  }
4039
- }, [l2, ae2, ie2, ue2, De2, Oe2, ke2, we2, Ce2, C2]);
4040
- return (0, import_react.useMemo)(() => ({ selection: l2, canBook: ae2, planAndBookFlow: ie2, selectedPaymentOptions: ne2, isLoadingPaymentOptions: re2, registerPaymentOptions: _2, hasCartConflict: m2, registerForm: v2, formFacts: oe2, publishFormFacts: y2, isFormEmptyState: ce2, publishFormEmptyState: le2, createBooking: Me2, isCreating: pe2, createError: b2, addToCart: Fe2, isAddingToCart: Ne2, addToCartError: ge2, participants: ue2, setParticipants: fe2, lastResult: ye2 }), [l2, ae2, ie2, ne2, re2, _2, m2, v2, oe2, y2, ce2, le2, Me2, pe2, b2, Fe2, Ne2, ge2, ue2, fe2, ye2]);
4036
+ }, [l2, ie2, re2, m2, le2, Te2, Ee2, De2, xe2, be2, we2]);
4037
+ return (0, import_react.useMemo)(() => ({ selection: l2, canBook: ie2, planAndBookFlow: re2, selectedPaymentOptions: te2, isLoadingPaymentOptions: ne2, registerPaymentOptions: v2, hasCartConflict: m2, registerForm: y2, formFacts: ae2, publishFormFacts: b2, isFormEmptyState: se2, publishFormEmptyState: ce2, createBooking: Ae2, isCreating: fe2, createError: x2, addToCart: Ne2, isAddingToCart: je2, addToCartError: he2, participants: le2, setParticipants: de2 }), [l2, ie2, re2, te2, ne2, v2, m2, y2, ae2, b2, se2, ce2, Ae2, fe2, x2, Ne2, je2, he2, le2, de2]);
4041
4038
  }
4042
- var Uh = (0, import_react.createContext)(null);
4043
- var Wh = `useBookingCheckoutContext must be used within BookingCheckoutContextProvider`;
4039
+ var Uh = `useBookingCheckoutContext must be used within BookingCheckoutContextProvider`;
4040
+ var Wh = (0, import_react.createContext)(null);
4044
4041
  function Gh(e2 = false) {
4045
- let t2 = (0, import_react.useContext)(Uh);
4046
- if (!t2 && !e2) throw Error(Wh);
4042
+ let t2 = (0, import_react.useContext)(Wh);
4043
+ if (!t2 && !e2) throw Error(Uh);
4047
4044
  return t2;
4048
4045
  }
4049
4046
  function Kh({ children: e2 }) {
@@ -4052,15 +4049,12 @@ function Kh({ children: e2 }) {
4052
4049
  let n2 = Go(Uo.BOOKING_CHECKOUT), i2 = Vh(t2.selection), o2 = t2.selection?.services.length ?? 0, s2 = (0, import_react.useRef)(false);
4053
4050
  return (0, import_react.useEffect)(() => {
4054
4051
  !s2.current && i2 && (s2.current = true, n2($n({ numberOfServices: o2 })));
4055
- }, [n2, i2, o2]), (0, import_jsx_runtime.jsx)(Uh.Provider, { value: t2, children: e2 });
4052
+ }, [n2, i2, o2]), (0, import_jsx_runtime.jsx)(Wh.Provider, { value: t2, children: e2 });
4056
4053
  }
4057
4054
  var qh = Yn(`216f9b1c-cb6d-4299-b97d-d3c0e2600b88`);
4058
4055
  // Annotate the CommonJS export names for ESM import in node:
4059
4056
  0 && (module.exports = {
4060
- BOOKING_CHECKOUT_CONTEXT_MISSING_PROVIDER_ERROR,
4061
4057
  BookingCheckoutContextProvider,
4062
- bookingCheckoutContext,
4063
- canBookSelection,
4064
4058
  injectAccessTokenGetter,
4065
4059
  useBookingCheckoutContext
4066
4060
  });