@wix/bookings 1.0.1796 → 1.0.1798
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/build/cjs/context-booking-checkout.d.ts +3 -37
- package/build/cjs/context-booking-checkout.js +1350 -1340
- package/build/cjs/context-booking-checkout.js.map +1 -1
- package/build/cjs/context-categories.d.ts +1 -3
- package/build/cjs/context-categories.js +20 -43
- package/build/cjs/context-categories.js.map +1 -1
- package/build/cjs/context-locations.d.ts +1 -1
- package/build/cjs/context-locations.js +20 -43
- package/build/cjs/context-locations.js.map +1 -1
- package/build/cjs/context-service-addons.d.ts +1 -15
- package/build/cjs/context-service-addons.js +20 -43
- package/build/cjs/context-service-addons.js.map +1 -1
- package/build/cjs/context-service.d.ts +1 -65
- package/build/cjs/context-service.js +363 -386
- package/build/cjs/context-service.js.map +1 -1
- package/build/cjs/context-services.d.ts +1 -23
- package/build/cjs/context-services.js +542 -566
- package/build/cjs/context-services.js.map +1 -1
- package/build/cjs/context-time-slots.d.ts +1 -21
- package/build/cjs/context-time-slots.js +588 -615
- package/build/cjs/context-time-slots.js.map +1 -1
- package/build/es/context-booking-checkout.d.mts +3 -37
- package/build/es/context-booking-checkout.mjs +1350 -1340
- package/build/es/context-booking-checkout.mjs.map +1 -1
- package/build/es/context-categories.d.mts +1 -3
- package/build/es/context-categories.mjs +20 -43
- package/build/es/context-categories.mjs.map +1 -1
- package/build/es/context-locations.d.mts +1 -1
- package/build/es/context-locations.mjs +20 -43
- package/build/es/context-locations.mjs.map +1 -1
- package/build/es/context-service-addons.d.mts +1 -15
- package/build/es/context-service-addons.mjs +20 -43
- package/build/es/context-service-addons.mjs.map +1 -1
- package/build/es/context-service.d.mts +1 -65
- package/build/es/context-service.mjs +363 -386
- package/build/es/context-service.mjs.map +1 -1
- package/build/es/context-services.d.mts +1 -23
- package/build/es/context-services.mjs +542 -566
- package/build/es/context-services.mjs.map +1 -1
- package/build/es/context-time-slots.d.mts +1 -21
- package/build/es/context-time-slots.mjs +588 -615
- package/build/es/context-time-slots.mjs.map +1 -1
- package/build/internal/cjs/context-booking-checkout.d.ts +3 -37
- package/build/internal/cjs/context-categories.d.ts +1 -3
- package/build/internal/cjs/context-locations.d.ts +1 -1
- package/build/internal/cjs/context-service-addons.d.ts +1 -15
- package/build/internal/cjs/context-service.d.ts +1 -65
- package/build/internal/cjs/context-services.d.ts +1 -23
- package/build/internal/cjs/context-time-slots.d.ts +1 -21
- package/build/internal/es/context-booking-checkout.d.mts +3 -37
- package/build/internal/es/context-categories.d.mts +1 -3
- package/build/internal/es/context-locations.d.mts +1 -1
- package/build/internal/es/context-service-addons.d.mts +1 -15
- package/build/internal/es/context-service.d.mts +1 -65
- package/build/internal/es/context-services.d.mts +1 -23
- package/build/internal/es/context-time-slots.d.mts +1 -21
- package/context-runtime/context-booking-checkout/runtime.d.ts +3 -38
- package/context-runtime/context-booking-checkout/runtime.js +3 -3
- package/context-runtime/context-categories/runtime.d.ts +1 -4
- package/context-runtime/context-categories/runtime.js +2 -2
- package/context-runtime/context-locations/runtime.d.ts +1 -2
- package/context-runtime/context-locations/runtime.js +2 -2
- package/context-runtime/context-service/runtime.d.ts +1 -66
- package/context-runtime/context-service/runtime.js +3 -3
- package/context-runtime/context-service-addons/runtime.d.ts +1 -16
- package/context-runtime/context-service-addons/runtime.js +2 -2
- package/context-runtime/context-services/runtime.d.ts +1 -24
- package/context-runtime/context-services/runtime.js +3 -3
- package/context-runtime/context-time-slots/runtime.d.ts +1 -22
- package/context-runtime/context-time-slots/runtime.js +3 -3
- package/package.json +4 -4
|
@@ -20,13 +20,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// context-service.ts
|
|
21
21
|
var context_service_exports = {};
|
|
22
22
|
__export(context_service_exports, {
|
|
23
|
-
SERVICE_CONTEXT_MISSING_PROVIDER_ERROR: () =>
|
|
24
|
-
ServiceContextProvider: () =>
|
|
25
|
-
default: () =>
|
|
26
|
-
injectAccessTokenGetter: () =>
|
|
27
|
-
resolveServiceTarget: () =>
|
|
28
|
-
serviceContext: () =>
|
|
29
|
-
useServiceContext: () =>
|
|
23
|
+
SERVICE_CONTEXT_MISSING_PROVIDER_ERROR: () => LS,
|
|
24
|
+
ServiceContextProvider: () => fC,
|
|
25
|
+
default: () => fC,
|
|
26
|
+
injectAccessTokenGetter: () => mC,
|
|
27
|
+
resolveServiceTarget: () => zS,
|
|
28
|
+
serviceContext: () => IS,
|
|
29
|
+
useServiceContext: () => RS
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(context_service_exports);
|
|
32
32
|
|
|
@@ -144,12 +144,12 @@ function de(e5) {
|
|
|
144
144
|
}
|
|
145
145
|
var fe = (e5) => `validationError` in (e5.response?.data?.details ?? {});
|
|
146
146
|
var pe = (e5) => `applicationError` in (e5.response?.data?.details ?? {});
|
|
147
|
-
var
|
|
148
|
-
function
|
|
147
|
+
var me = (e5) => (e5.response?.status ?? -1) >= 400 && (e5.response?.status ?? -1) < 500;
|
|
148
|
+
function j(e5, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
149
149
|
if (typeof e5 != `object` || !e5) throw e5;
|
|
150
150
|
if (fe(e5)) return he(e5, t2, n2);
|
|
151
151
|
if (pe(e5)) return _e(e5);
|
|
152
|
-
if (
|
|
152
|
+
if (me(e5)) {
|
|
153
153
|
let t3 = e5.response?.status, n3 = e5.response?.statusText ?? `UNKNOWN`, r2 = e5.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: se(n3), data: {} }, requestId: e5.requestId };
|
|
154
154
|
return ge(e5, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
155
155
|
}
|
|
@@ -200,7 +200,7 @@ function Se(e5, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
|
200
200
|
e8 = await s3.json();
|
|
201
201
|
} catch {
|
|
202
202
|
}
|
|
203
|
-
let t3 =
|
|
203
|
+
let t3 = M(s3.status, e8?.message ?? s3.statusText, e8?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e8 }), n3 = j(t3);
|
|
204
204
|
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
205
205
|
}
|
|
206
206
|
let l3 = await s3.json();
|
|
@@ -217,11 +217,11 @@ var Ce = class extends Error {
|
|
|
217
217
|
super(), this.response = e5.response, this.requestId = e5.requestId;
|
|
218
218
|
}
|
|
219
219
|
};
|
|
220
|
-
var
|
|
221
|
-
var
|
|
222
|
-
function
|
|
220
|
+
var M = (e5, t2, n2, r2) => new Ce({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e5, data: r2 } }, ...n2 }, message: t2 }, status: e5 }, requestId: r2?.requestId });
|
|
221
|
+
var we = `.`;
|
|
222
|
+
function Te(e5, t2, n2) {
|
|
223
223
|
if (e5 == null) throw Error(`Cannot set value on null or undefined`);
|
|
224
|
-
let r2 =
|
|
224
|
+
let r2 = Ee(t2), i2 = e5;
|
|
225
225
|
for (let e6 = 0; e6 < r2.length; e6++) {
|
|
226
226
|
let t3 = r2[e6];
|
|
227
227
|
if (e6 === r2.length - 1) {
|
|
@@ -229,19 +229,19 @@ function Ee(e5, t2, n2) {
|
|
|
229
229
|
break;
|
|
230
230
|
}
|
|
231
231
|
let a2 = r2[e6 + 1];
|
|
232
|
-
|
|
232
|
+
t3 in i2 && i2[t3] != null && typeof i2[t3] == `object` && i2[t3] !== null || (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
|
|
233
233
|
}
|
|
234
234
|
return e5;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return Array.isArray(e5) ? e5 : e5.split(
|
|
236
|
+
function Ee(e5) {
|
|
237
|
+
return Array.isArray(e5) ? e5 : e5.split(we).map((e6) => De(e6) ? Number(e6) : e6);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function De(e5) {
|
|
240
240
|
return /^\d+$/.test(e5);
|
|
241
241
|
}
|
|
242
242
|
function Oe(e5) {
|
|
243
243
|
let t2 = {};
|
|
244
|
-
for (let [n2, r2] of Object.entries(e5)) ke(n2) ||
|
|
244
|
+
for (let [n2, r2] of Object.entries(e5)) ke(n2) || Te(t2, Ee(n2), r2);
|
|
245
245
|
return t2;
|
|
246
246
|
}
|
|
247
247
|
function ke(e5) {
|
|
@@ -296,11 +296,8 @@ var Ae = class {
|
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
298
|
let a3 = Pe(e6);
|
|
299
|
-
if (a3 && a3 in t3)
|
|
300
|
-
|
|
301
|
-
return;
|
|
302
|
-
}
|
|
303
|
-
throw Error(`Cannot find key '${e6}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
299
|
+
if (a3 && a3 in t3) r2.push(a3), n2 = t3[a3];
|
|
300
|
+
else throw Error(`Cannot find key '${e6}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
304
301
|
}, o2 = (e6, t3) => {
|
|
305
302
|
r2.push(e6), n2 = t3[e6];
|
|
306
303
|
};
|
|
@@ -311,11 +308,7 @@ var Ae = class {
|
|
|
311
308
|
}
|
|
312
309
|
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e6}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
|
|
313
310
|
let t3 = n2;
|
|
314
|
-
|
|
315
|
-
o2(e6, t3);
|
|
316
|
-
continue;
|
|
317
|
-
}
|
|
318
|
-
a2(e6, t3);
|
|
311
|
+
e6 in n2 ? o2(e6, t3) : a2(e6, t3);
|
|
319
312
|
}
|
|
320
313
|
return { [this.buildPathString(r2)]: n2 };
|
|
321
314
|
}
|
|
@@ -1690,13 +1683,7 @@ var qa = class {
|
|
|
1690
1683
|
}), this;
|
|
1691
1684
|
}
|
|
1692
1685
|
off(e5, t2) {
|
|
1693
|
-
|
|
1694
|
-
if (!t2) {
|
|
1695
|
-
delete this.observers[e5];
|
|
1696
|
-
return;
|
|
1697
|
-
}
|
|
1698
|
-
this.observers[e5].delete(t2);
|
|
1699
|
-
}
|
|
1686
|
+
this.observers[e5] && (t2 ? this.observers[e5].delete(t2) : delete this.observers[e5]);
|
|
1700
1687
|
}
|
|
1701
1688
|
emit(e5, ...t2) {
|
|
1702
1689
|
this.observers[e5] && Array.from(this.observers[e5].entries()).forEach(([e6, n2]) => {
|
|
@@ -2223,24 +2210,17 @@ var ho = class extends qa {
|
|
|
2223
2210
|
let e6 = this.waitingReads.shift();
|
|
2224
2211
|
this.read(e6.lng, e6.ns, e6.fcName, e6.tried, e6.wait, e6.callback);
|
|
2225
2212
|
}
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
}, i2);
|
|
2230
|
-
return;
|
|
2231
|
-
}
|
|
2232
|
-
a2(o3, s3);
|
|
2213
|
+
o3 && s3 && r2 < this.maxRetries ? setTimeout(() => {
|
|
2214
|
+
this.read.call(this, e5, t2, n2, r2 + 1, i2 * 2, a2);
|
|
2215
|
+
}, i2) : a2(o3, s3);
|
|
2233
2216
|
}, s2 = this.backend[n2].bind(this.backend);
|
|
2234
|
-
if (s2.length === 2) {
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
o2(e6);
|
|
2240
|
-
}
|
|
2241
|
-
return;
|
|
2217
|
+
if (s2.length === 2) try {
|
|
2218
|
+
let n3 = s2(e5, t2);
|
|
2219
|
+
n3 && typeof n3.then == `function` ? n3.then((e6) => o2(null, e6)).catch(o2) : o2(null, n3);
|
|
2220
|
+
} catch (e6) {
|
|
2221
|
+
o2(e6);
|
|
2242
2222
|
}
|
|
2243
|
-
return s2(e5, t2, o2);
|
|
2223
|
+
else return s2(e5, t2, o2);
|
|
2244
2224
|
}
|
|
2245
2225
|
prepareLoading(e5, t2, n2 = {}, r2) {
|
|
2246
2226
|
if (!this.backend) return this.logger.warn(`No backend was added via i18next.use. Will not load resources.`), r2 && r2();
|
|
@@ -2265,11 +2245,8 @@ var ho = class extends qa {
|
|
|
2265
2245
|
}
|
|
2266
2246
|
saveMissing(e5, t2, n2, r2, i2, a2 = {}, o2 = () => {
|
|
2267
2247
|
}) {
|
|
2268
|
-
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t2)) {
|
|
2269
|
-
|
|
2270
|
-
return;
|
|
2271
|
-
}
|
|
2272
|
-
if (n2 != null && n2 !== ``) {
|
|
2248
|
+
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t2)) this.logger.warn(`did not save key "${n2}" as the namespace "${t2}" was not yet loaded`, `This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!`);
|
|
2249
|
+
else if (n2 != null && n2 !== ``) {
|
|
2273
2250
|
if (this.backend?.create) {
|
|
2274
2251
|
let s2 = { ...a2, isUpdate: i2 }, c2 = this.backend.create.bind(this.backend);
|
|
2275
2252
|
if (c2.length < 6) try {
|
|
@@ -2616,7 +2593,7 @@ var Jo = class {
|
|
|
2616
2593
|
};
|
|
2617
2594
|
var Yo = (e5) => new Jo(e5);
|
|
2618
2595
|
var Xo = Ca({ getMonitoringClient: (e5) => () => e5.getMonitoringClient ? e5.getMonitoringClient() : Yo(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
|
|
2619
|
-
var Zo = { service: `service`, services: `services`, categories: `categories`, locations: `locations`, sessions: `sessions`, timeSlots: `time-slots`, serviceAddOns: `service-addons`, bookingsSettings: `bookings-settings`, serviceCta: `service-cta`, preferences: `preferences`, bookingSummary: `booking-summary`, bookingCheckout: `booking-checkout`, formValues: `form-values`, paymentOptions: `payment-options`, seo: `seo`, warmup: `warmup`, reschedule: `reschedule` };
|
|
2596
|
+
var Zo = { service: `service`, services: `services`, categories: `categories`, locations: `locations`, sessions: `sessions`, timeSlots: `time-slots`, serviceAddOns: `service-addons`, bookingsSettings: `bookings-settings`, serviceCta: `service-cta`, preferences: `preferences`, bookingSummary: `booking-summary`, bookingCheckout: `booking-checkout`, formValues: `form-values`, paymentOptions: `payment-options`, seo: `seo`, warmup: `warmup`, reschedule: `reschedule`, intakeForms: `intake-forms` };
|
|
2620
2597
|
function Qo(e5) {
|
|
2621
2598
|
try {
|
|
2622
2599
|
let t2 = Xo.getMonitoringClient?.();
|
|
@@ -4681,8 +4658,8 @@ var fg = function(e5, t2, n2, r2) {
|
|
|
4681
4658
|
s2 && l2(f2 + 131072);
|
|
4682
4659
|
var pe2 = f2 + ue2;
|
|
4683
4660
|
if (f2 < k2) {
|
|
4684
|
-
var
|
|
4685
|
-
for (
|
|
4661
|
+
var me2 = a2 - k2, j2 = Math.min(k2, pe2);
|
|
4662
|
+
for (me2 + f2 < 0 && dg(3); f2 < j2; ++f2) n2[f2] = r2[me2 + f2];
|
|
4686
4663
|
}
|
|
4687
4664
|
for (; f2 < pe2; ++f2) n2[f2] = n2[f2 - k2];
|
|
4688
4665
|
}
|
|
@@ -4822,8 +4799,8 @@ var Cg = function(e5, t2, n2, r2, i2, a2) {
|
|
|
4822
4799
|
if (A2 > ae2) {
|
|
4823
4800
|
if (ae2 = A2, k2 = se2, A2 > ce2) break;
|
|
4824
4801
|
for (var de2 = Math.min(se2, A2 - 2), fe2 = 0, O2 = 0; O2 < de2; ++O2) {
|
|
4825
|
-
var pe2 = C2 - se2 + O2 & 32767,
|
|
4826
|
-
|
|
4802
|
+
var pe2 = C2 - se2 + O2 & 32767, me2 = pe2 - h2[pe2] & 32767;
|
|
4803
|
+
me2 > fe2 && (fe2 = me2, D2 = pe2);
|
|
4827
4804
|
}
|
|
4828
4805
|
}
|
|
4829
4806
|
}
|
|
@@ -4831,8 +4808,8 @@ var Cg = function(e5, t2, n2, r2, i2, a2) {
|
|
|
4831
4808
|
}
|
|
4832
4809
|
if (k2) {
|
|
4833
4810
|
b2[w2++] = 268435456 | Kh[ae2] << 18 | Yh[k2];
|
|
4834
|
-
var
|
|
4835
|
-
S2 += Bh[
|
|
4811
|
+
var j2 = Kh[ae2] & 31, he2 = Yh[k2] & 31;
|
|
4812
|
+
S2 += Bh[j2] + Vh[he2], ++x2[257 + j2], ++ee2[he2], T2 = C2 + ae2, ++te2;
|
|
4836
4813
|
} else b2[w2++] = e5[C2], ++x2[e5[C2]];
|
|
4837
4814
|
}
|
|
4838
4815
|
}
|
|
@@ -5524,21 +5501,21 @@ var Hv = (e5) => {
|
|
|
5524
5501
|
};
|
|
5525
5502
|
Bv([Hv, Vv]);
|
|
5526
5503
|
var Uv = `11062b_7b9f1e3756b64285ad5cf5e244b4ae77~mv2.png`;
|
|
5527
|
-
|
|
5528
|
-
function
|
|
5504
|
+
`${Uv}${Uv}`;
|
|
5505
|
+
function Wv(e5) {
|
|
5529
5506
|
if (!e5) return null;
|
|
5530
5507
|
let t2;
|
|
5531
5508
|
return Hv({ props: {}, setProps: ({ image: e6 }) => {
|
|
5532
5509
|
t2 = e6;
|
|
5533
5510
|
} }).src = e5, t2 ?? null;
|
|
5534
5511
|
}
|
|
5512
|
+
function Gv(e5) {
|
|
5513
|
+
return Wv(e5.media?.mainMedia?.image || `wix:image://v1/11062b_7b9f1e3756b64285ad5cf5e244b4ae77~mv2.png/11062b_7b9f1e3756b64285ad5cf5e244b4ae77~mv2.png#originWidth=460&originHeight=460`);
|
|
5514
|
+
}
|
|
5535
5515
|
function Kv(e5) {
|
|
5536
|
-
return
|
|
5516
|
+
return Wv(e5.media?.coverMedia?.image) ?? void 0;
|
|
5537
5517
|
}
|
|
5538
5518
|
function qv(e5) {
|
|
5539
|
-
return Gv(e5.media?.coverMedia?.image) ?? void 0;
|
|
5540
|
-
}
|
|
5541
|
-
function Jv(e5) {
|
|
5542
5519
|
switch (e5.type) {
|
|
5543
5520
|
case kd.BUSINESS:
|
|
5544
5521
|
return `business`;
|
|
@@ -5550,7 +5527,7 @@ function Jv(e5) {
|
|
|
5550
5527
|
return null;
|
|
5551
5528
|
}
|
|
5552
5529
|
}
|
|
5553
|
-
function
|
|
5530
|
+
function Jv(e5, t2) {
|
|
5554
5531
|
switch (e5.type) {
|
|
5555
5532
|
case kd.BUSINESS:
|
|
5556
5533
|
return e5.business?.name ?? null;
|
|
@@ -5562,69 +5539,69 @@ function Yv(e5, t2) {
|
|
|
5562
5539
|
return null;
|
|
5563
5540
|
}
|
|
5564
5541
|
}
|
|
5565
|
-
function
|
|
5542
|
+
function Yv(e5) {
|
|
5566
5543
|
return (e5?.locations ?? []).flatMap((e6) => {
|
|
5567
|
-
let t2 =
|
|
5544
|
+
let t2 = qv(e6);
|
|
5568
5545
|
if (!t2) return [];
|
|
5569
5546
|
if (t2 === `customer`) return [{ type: t2, text: null }];
|
|
5570
|
-
let n2 =
|
|
5547
|
+
let n2 = Jv(e6, ``);
|
|
5571
5548
|
return n2 ? [{ type: t2, text: n2 }] : [];
|
|
5572
5549
|
});
|
|
5573
5550
|
}
|
|
5574
|
-
var
|
|
5575
|
-
var
|
|
5576
|
-
var
|
|
5577
|
-
var
|
|
5578
|
-
var
|
|
5579
|
-
function
|
|
5580
|
-
let r2 =
|
|
5551
|
+
var Xv = { AVAILABLE: `available`, FULLY_BOOKED: `fullyBooked`, BOOKING_NOT_OPEN_YET: `bookingNotOpenYet`, BOOKING_CLOSED: `bookingClosed`, COURSE_IN_PROGRESS: `courseInProgress`, NO_UPCOMING_SESSIONS: `noUpcomingSessions` };
|
|
5552
|
+
var Zv = 6e4;
|
|
5553
|
+
var Qv = (e5) => e5?.onlineBooking?.enabled === true;
|
|
5554
|
+
var $v = (e5) => e5 ? new Date(e5).getTime() : null;
|
|
5555
|
+
var ey = (e5, t2) => t2 !== void 0 && e5 !== null && e5 <= t2;
|
|
5556
|
+
function ty({ service: e5, courseRemainingCapacity: t2, now: n2 }) {
|
|
5557
|
+
let r2 = Qv(e5), i2 = $v(e5?.schedule?.firstSessionStart), a2 = $v(e5?.schedule?.lastSessionEnd), o2 = i2 !== null;
|
|
5581
5558
|
if (!Um(e5?.type)) {
|
|
5582
|
-
let t3 = !Hm(e5?.type) || o2 && !
|
|
5583
|
-
return { state: r2 && !t3 ?
|
|
5559
|
+
let t3 = !Hm(e5?.type) || o2 && !ey(a2, n2);
|
|
5560
|
+
return { state: r2 && !t3 ? Xv.NO_UPCOMING_SESSIONS : Xv.AVAILABLE, isAvailableForBooking: r2 && t3, bookingOpensAt: null };
|
|
5584
5561
|
}
|
|
5585
|
-
let s2 = e5?.bookingPolicy, c2 = s2?.limitEarlyBookingPolicy?.enabled ? s2.limitEarlyBookingPolicy.earliestBookingInMinutes ?? 0 : 0, l2 = s2?.limitLateBookingPolicy?.enabled ? s2.limitLateBookingPolicy.latestBookingInMinutes ?? 0 : 0, u2 = s2?.bookAfterStartPolicy?.enabled === true, d2 = i2 === null || n2 === void 0 ? null : (i2 - n2) /
|
|
5586
|
-
return r2 && (f2 ? v2 =
|
|
5562
|
+
let s2 = e5?.bookingPolicy, c2 = s2?.limitEarlyBookingPolicy?.enabled ? s2.limitEarlyBookingPolicy.earliestBookingInMinutes ?? 0 : 0, l2 = s2?.limitLateBookingPolicy?.enabled ? s2.limitLateBookingPolicy.latestBookingInMinutes ?? 0 : 0, u2 = s2?.bookAfterStartPolicy?.enabled === true, d2 = i2 === null || n2 === void 0 ? null : (i2 - n2) / Zv, f2 = t2 !== null && t2 <= 0, p2 = d2 !== null && c2 > 0 && d2 >= c2, m2 = d2 !== null && !u2 && d2 <= l2, h2 = o2 && !ey(a2, n2), g2 = ey(i2, n2) && !ey(a2, n2) && u2, _2 = i2 === null ? null : new Date(i2 - c2 * Zv), v2 = Xv.AVAILABLE;
|
|
5563
|
+
return r2 && (f2 ? v2 = Xv.FULLY_BOOKED : p2 ? v2 = Xv.BOOKING_NOT_OPEN_YET : m2 ? v2 = Xv.BOOKING_CLOSED : h2 ? g2 && (v2 = Xv.COURSE_IN_PROGRESS) : v2 = Xv.NO_UPCOMING_SESSIONS), { state: v2, isAvailableForBooking: r2 && !f2 && h2 && !p2 && !m2, bookingOpensAt: _2 };
|
|
5587
5564
|
}
|
|
5588
|
-
function
|
|
5565
|
+
function ny(e5) {
|
|
5589
5566
|
return e5.staffMemberDetails?.staffMembers ?? [];
|
|
5590
5567
|
}
|
|
5591
|
-
function
|
|
5568
|
+
function ry(e5, t2) {
|
|
5592
5569
|
let n2 = e5.workingHoursLocationCoverage;
|
|
5593
5570
|
return { staffMemberId: e5.staffMemberId ?? ``, name: e5.name ?? null, image: null, isSelected: t2 === e5.staffMemberId, ...n2 ? { locationCoverage: { availableAtAllLocations: n2.availableAtAllLocations ?? false, locationIds: n2.locationIds ?? [] } } : {} };
|
|
5594
5571
|
}
|
|
5595
|
-
var
|
|
5596
|
-
var
|
|
5597
|
-
function
|
|
5598
|
-
let t2 = e5.flatMap(
|
|
5599
|
-
return t2.length === 0 ?
|
|
5572
|
+
var iy = [];
|
|
5573
|
+
var ay = (e5) => (e5.recurrenceRule?.days ?? []).map((e6) => ({ day: e6 }));
|
|
5574
|
+
function oy(e5) {
|
|
5575
|
+
let t2 = e5.flatMap(ay);
|
|
5576
|
+
return t2.length === 0 ? iy : t2;
|
|
5600
5577
|
}
|
|
5601
|
-
function
|
|
5578
|
+
function sy(e5, t2) {
|
|
5602
5579
|
return t2 === void 0 ? false : !e5 || new Date(e5).getTime() <= t2;
|
|
5603
5580
|
}
|
|
5604
|
-
function
|
|
5581
|
+
function cy(e5) {
|
|
5605
5582
|
return e5 !== null && e5 <= 0;
|
|
5606
5583
|
}
|
|
5607
|
-
function
|
|
5608
|
-
if (
|
|
5584
|
+
function ly({ lastSessionEnd: e5, masterEvents: t2, now: n2 }) {
|
|
5585
|
+
if (sy(e5, n2)) return null;
|
|
5609
5586
|
let r2 = t2[0];
|
|
5610
5587
|
return r2 ? { totalCapacity: r2.totalCapacity ?? null, remainingCapacity: r2.remainingCapacity ?? null } : null;
|
|
5611
5588
|
}
|
|
5612
|
-
var
|
|
5613
|
-
var
|
|
5614
|
-
function
|
|
5589
|
+
var uy = (e5, t2) => !e5 || new Date(e5).getTime() <= t2;
|
|
5590
|
+
var dy = 6e4;
|
|
5591
|
+
function fy(e5, t2) {
|
|
5615
5592
|
if (t2 === void 0) return false;
|
|
5616
5593
|
let n2 = e5.bookingPolicy?.bookAfterStartPolicy?.enabled, r2 = e5.schedule?.firstSessionStart ?? null, i2 = e5.schedule?.lastSessionEnd ?? null, a2 = false;
|
|
5617
5594
|
if (!n2 && r2 && e5.bookingPolicy?.limitLateBookingPolicy?.enabled) {
|
|
5618
5595
|
let n3 = e5.bookingPolicy.limitLateBookingPolicy.latestBookingInMinutes ?? 0;
|
|
5619
|
-
a2 = t2 >= new Date(r2).getTime() - n3 *
|
|
5596
|
+
a2 = t2 >= new Date(r2).getTime() - n3 * dy;
|
|
5620
5597
|
}
|
|
5621
|
-
let o2 = Um(e5.type) &&
|
|
5598
|
+
let o2 = Um(e5.type) && uy(i2, t2), s2 = uy(r2, t2);
|
|
5622
5599
|
return o2 || s2 && !n2 || a2;
|
|
5623
5600
|
}
|
|
5624
|
-
function
|
|
5601
|
+
function py(e5) {
|
|
5625
5602
|
return Um(e5.serviceType) && (e5.courseFull || e5.tooLateToBook) ? Yc.VIEW_COURSE : e5.requireManualApproval ? Yc.REQUEST_TO_BOOK : Yc.BOOK;
|
|
5626
5603
|
}
|
|
5627
|
-
function
|
|
5604
|
+
function my(e5, t2) {
|
|
5628
5605
|
let n2 = e5?.value, r2 = e5?.currency;
|
|
5629
5606
|
if (n2 == null || !r2) return null;
|
|
5630
5607
|
let i2 = Number(n2);
|
|
@@ -5632,48 +5609,46 @@ function hy(e5, t2) {
|
|
|
5632
5609
|
let a2 = i2 % 1 == 0 ? 0 : 2;
|
|
5633
5610
|
return new Intl.NumberFormat(t2, { style: `currency`, currency: r2, currencyDisplay: `symbol`, maximumFractionDigits: a2, minimumFractionDigits: a2 }).format(i2).replace(/\p{Zs}/gu, `\xA0`);
|
|
5634
5611
|
}
|
|
5635
|
-
function
|
|
5612
|
+
function hy(e5, t2) {
|
|
5636
5613
|
return (t2.getUTCFullYear() - e5.getUTCFullYear()) * 12 + (t2.getUTCMonth() - e5.getUTCMonth());
|
|
5637
5614
|
}
|
|
5638
|
-
function
|
|
5615
|
+
function gy(e5, t2) {
|
|
5639
5616
|
let n2 = e5?.totalPayments;
|
|
5640
5617
|
if (n2 == null) return null;
|
|
5641
5618
|
let r2 = e5?.recurringStartDate;
|
|
5642
5619
|
if (!r2 || t2 === void 0) return n2;
|
|
5643
5620
|
let i2 = new Date(r2), a2 = new Date(t2);
|
|
5644
|
-
return Number.isNaN(i2.getTime()) || a2 < i2 ? n2 : Math.max(1, n2 -
|
|
5621
|
+
return Number.isNaN(i2.getTime()) || a2 < i2 ? n2 : Math.max(1, n2 - hy(i2, a2));
|
|
5645
5622
|
}
|
|
5646
|
-
var { RateType:
|
|
5647
|
-
var
|
|
5648
|
-
function
|
|
5623
|
+
var { RateType: _y, FrequencyType: vy } = fu;
|
|
5624
|
+
var yy = { rateType: null, price: null, priceAfterDiscount: null, discountName: null, calculatedAtCheckout: false, subscriptionFrequency: null, remainingPayments: null, isFree: false };
|
|
5625
|
+
function by(e5) {
|
|
5649
5626
|
if (e5 == null || e5 === ``) return false;
|
|
5650
5627
|
let t2 = Number(e5);
|
|
5651
5628
|
return Number.isFinite(t2) && t2 === 0;
|
|
5652
5629
|
}
|
|
5653
|
-
function
|
|
5630
|
+
function xy(e5, t2, n2 = {}) {
|
|
5654
5631
|
let r2 = e5?.payment;
|
|
5655
|
-
if (!r2) return
|
|
5632
|
+
if (!r2) return yy;
|
|
5656
5633
|
let i2 = r2.rateType ?? null, a2 = null;
|
|
5657
5634
|
switch (i2) {
|
|
5658
|
-
case
|
|
5659
|
-
a2 =
|
|
5635
|
+
case _y.FIXED:
|
|
5636
|
+
a2 = my(r2.fixed?.price, t2);
|
|
5660
5637
|
break;
|
|
5661
|
-
case
|
|
5662
|
-
a2 =
|
|
5638
|
+
case _y.VARIED:
|
|
5639
|
+
a2 = my(r2.varied?.minPrice, t2);
|
|
5663
5640
|
break;
|
|
5664
|
-
case
|
|
5641
|
+
case _y.CUSTOM:
|
|
5665
5642
|
a2 = r2.custom?.description ?? null;
|
|
5666
5643
|
break;
|
|
5667
|
-
case
|
|
5668
|
-
a2 =
|
|
5644
|
+
case _y.SUBSCRIPTION:
|
|
5645
|
+
a2 = my(r2.subscription?.amountPerBillingCycle, t2);
|
|
5669
5646
|
}
|
|
5670
|
-
let o2 = !(r2.pricingPlanIds?.length || r2.options?.pricingPlan) && (i2 ===
|
|
5647
|
+
let o2 = !(r2.pricingPlanIds?.length || r2.options?.pricingPlan) && (i2 === _y.NO_FEE || i2 === _y.FIXED && by(r2.fixed?.price?.value)), s2 = !!n2.subscriptionPayment && i2 === _y.SUBSCRIPTION, c2 = s2 && !n2.monthlyDiscounts ? void 0 : r2.discountInfo ?? void 0, l2 = c2?.discountName ?? null, u2 = l2 && (i2 === _y.FIXED || s2) ? my(c2?.priceAfterDiscount, t2) : null, d2 = s2 && r2.subscription?.frequency === vy.MONTHLY ? gy(r2.subscription, n2.now) : null;
|
|
5671
5648
|
return { rateType: i2, price: a2, priceAfterDiscount: u2, discountName: l2, calculatedAtCheckout: !!l2 && !u2, subscriptionFrequency: r2.subscription?.frequency ?? null, remainingPayments: d2, isFree: o2 };
|
|
5672
5649
|
}
|
|
5673
|
-
var
|
|
5674
|
-
|
|
5675
|
-
return `${e5.getFullYear()}-${t2(e5.getMonth() + 1)}-${t2(e5.getDate())}`;
|
|
5676
|
-
};
|
|
5650
|
+
var Sy = (e5) => e5 < 10 ? `0${e5}` : `${e5}`;
|
|
5651
|
+
var Cy = (e5) => `${e5.getFullYear()}-${Sy(e5.getMonth() + 1)}-${Sy(e5.getDate())}`;
|
|
5677
5652
|
var wy = (e5, t2) => new Intl.DateTimeFormat(`en-CA`, { year: `numeric`, month: `2-digit`, day: `2-digit`, ...t2 ? { timeZone: t2 } : {} }).format(e5);
|
|
5678
5653
|
var Ty = (e5) => `${Cy(e5)}T00:00:00`;
|
|
5679
5654
|
function Ey(e5, t2) {
|
|
@@ -5684,17 +5659,17 @@ function Ey(e5, t2) {
|
|
|
5684
5659
|
return a2 === 0 ? n2.format(i2) : `${n2.format(i2)} ${r2.format(a2)}`;
|
|
5685
5660
|
}
|
|
5686
5661
|
function Dy(e5) {
|
|
5687
|
-
return e5 ?
|
|
5688
|
-
let { staffMemberId: t2, name: n2, image: r2 } =
|
|
5662
|
+
return e5 ? ny(e5).filter((e6) => e6.staffMemberId).map((e6) => {
|
|
5663
|
+
let { staffMemberId: t2, name: n2, image: r2 } = ry(e6, null);
|
|
5689
5664
|
return { staffMemberId: t2, name: n2, image: r2 };
|
|
5690
5665
|
}) : [];
|
|
5691
5666
|
}
|
|
5692
5667
|
function Oy(e5, t2, n2) {
|
|
5693
|
-
return Um(e5?.type) ?
|
|
5668
|
+
return Um(e5?.type) ? ly({ lastSessionEnd: e5?.schedule?.lastSessionEnd, masterEvents: t2, now: n2 }) : null;
|
|
5694
5669
|
}
|
|
5695
5670
|
function ky({ service: e5, masterEvents: t2, locale: n2, timeZone: r2, now: i2, servicePriceOptions: a2 }) {
|
|
5696
|
-
let o2 = Oy(e5, t2, i2), s2 = t2[0]?.timeZone ?? r2 ?? `UTC`, c2 =
|
|
5697
|
-
return { serviceId: e5?._id ?? null, serviceSlug: e5?.mainSlug?.name ?? null, serviceName: e5?.name ?? null, serviceDescription: e5?.description ?? null, serviceTagLine: e5?.tagLine ?? null, serviceType: e5?.type ?? null, serviceDefaultDuration: e5 ? Ey(Qm(e5), n2) : null, serviceImage: e5 ?
|
|
5671
|
+
let o2 = Oy(e5, t2, i2), s2 = t2[0]?.timeZone ?? r2 ?? `UTC`, c2 = ty({ service: e5, courseRemainingCapacity: o2?.remainingCapacity ?? null, now: i2 }), l2 = e5?.bookingPolicy?.customPolicyDescription;
|
|
5672
|
+
return { serviceId: e5?._id ?? null, serviceSlug: e5?.mainSlug?.name ?? null, serviceName: e5?.name ?? null, serviceDescription: e5?.description ?? null, serviceTagLine: e5?.tagLine ?? null, serviceType: e5?.type ?? null, serviceDefaultDuration: e5 ? Ey(Qm(e5), n2) : null, serviceImage: e5 ? Gv(e5) : null, serviceCtaState: py({ serviceType: e5?.type ?? null, requireManualApproval: !!e5?.onlineBooking?.requireManualApproval, courseFull: cy(o2?.remainingCapacity ?? null), tooLateToBook: e5 ? fy(e5, i2) : false }), servicePrice: xy(e5, n2, { ...a2, now: i2 }), isVariedService: e5 ? Wm(e5) : false, hasAddOns: e5 ? Km(e5) : false, isConferenceEnabled: !!e5?.conferencing?.enabled, offeredDays: oy(t2), courseAvailability: o2, courseStartDate: e5?.schedule?.firstSessionStart ? wy(new Date(e5.schedule.firstSessionStart), s2) : null, courseEndDate: e5?.schedule?.lastSessionEnd ? wy(new Date(e5.schedule.lastSessionEnd), s2) : null, staffMembers: Dy(e5), coverImage: e5 ? Kv(e5) : void 0, gallery: rv(e5), serviceLocations: Yv(e5), policyDescription: l2?.enabled ? l2.description ?? null : null, serviceBookability: c2, displayTimeZone: s2 };
|
|
5698
5673
|
}
|
|
5699
5674
|
function Ay({ serviceCtaState: e5, courseAvailability: t2, serviceBookability: n2, servicePrice: r2 }) {
|
|
5700
5675
|
return `${r2.remainingPayments}|${e5}|${t2?.totalCapacity ?? `-`}|${t2?.remainingCapacity ?? `-`}|${t2 === null}|${n2.state}|${n2.isAvailableForBooking}`;
|
|
@@ -5905,7 +5880,7 @@ function jb(e5, { locale: t2, staffMembers: n2 = [], businessLocations: r2 = []
|
|
|
5905
5880
|
if (!i2) return null;
|
|
5906
5881
|
let a2 = Ob(n2), o2 = kb(r2), s2 = (e5?.variants?.values ?? []).map((e6) => {
|
|
5907
5882
|
let n3 = e6.choices?.[0];
|
|
5908
|
-
return { choiceId: n3 ? Eb(n3) : null, label: n3 ? Db(n3, t2, a2, o2) : null, price:
|
|
5883
|
+
return { choiceId: n3 ? Eb(n3) : null, label: n3 ? Db(n3, t2, a2, o2) : null, price: my(e6.price, t2), priceAmount: e6.price?.value ?? null, durationMinutes: n3?.duration?.minutes ?? null, durationName: n3?.duration?.name ?? null, businessLocationId: n3?.businessLocationId ?? null };
|
|
5909
5884
|
});
|
|
5910
5885
|
return { optionId: i2._id ?? null, type: i2.type ?? null, name: i2.customData?.name || i2.durationData?.name || null, choices: s2 };
|
|
5911
5886
|
}
|
|
@@ -6027,7 +6002,7 @@ function ox(e5) {
|
|
|
6027
6002
|
}
|
|
6028
6003
|
function sx() {
|
|
6029
6004
|
let e5 = ox(ax()), t2 = typeof window > `u`;
|
|
6030
|
-
return { scope: e5 ?? void 0, get: async (n2) => {
|
|
6005
|
+
return (0, import_react.useMemo)(() => ({ scope: e5 ?? void 0, get: async (n2) => {
|
|
6031
6006
|
if (t2 || !e5) return null;
|
|
6032
6007
|
try {
|
|
6033
6008
|
return await e5.get(n2);
|
|
@@ -6039,7 +6014,7 @@ function sx() {
|
|
|
6039
6014
|
e5.set(n2, r2);
|
|
6040
6015
|
} catch {
|
|
6041
6016
|
}
|
|
6042
|
-
} };
|
|
6017
|
+
} }), [e5, t2]);
|
|
6043
6018
|
}
|
|
6044
6019
|
var cx = `bookings-uou`;
|
|
6045
6020
|
function lx(e5) {
|
|
@@ -6156,46 +6131,68 @@ function Nx() {
|
|
|
6156
6131
|
function Px(e5) {
|
|
6157
6132
|
return e5 === Ax || e5 === `none` ? null : e5;
|
|
6158
6133
|
}
|
|
6159
|
-
var Fx = {
|
|
6160
|
-
|
|
6134
|
+
var Fx = { bookable: true, staffChoiceRequired: false, rescheduleStaffId: null };
|
|
6135
|
+
var Ix = ({ timezone: e5 }) => e5 === void 0 ? Fx : { ...Fx, timezone: e5 };
|
|
6136
|
+
function Lx(e5) {
|
|
6137
|
+
return { selection: e5, pick: Fx };
|
|
6138
|
+
}
|
|
6139
|
+
function Rx(e5, t2) {
|
|
6140
|
+
return { selection: t2, pick: Ix(e5.pick) };
|
|
6141
|
+
}
|
|
6142
|
+
function zx(e5, t2) {
|
|
6143
|
+
let n2 = t2(e5.selection);
|
|
6144
|
+
return n2 === e5.selection ? e5 : { ...e5, selection: n2 };
|
|
6145
|
+
}
|
|
6146
|
+
function Bx(e5, t2, n2) {
|
|
6147
|
+
let r2 = L_(e5.selection, t2);
|
|
6148
|
+
return { selection: n2?.staffId === void 0 ? r2 : S_(r2, n2.staffId), pick: { timezone: n2?.timezone || e5.pick.timezone, bookable: n2?.bookable ?? true, staffChoiceRequired: n2?.staffChoiceRequired ?? false, rescheduleStaffId: n2?.rescheduleStaffId ?? null } };
|
|
6149
|
+
}
|
|
6150
|
+
function Vx(e5, t2, { staffPriced: n2 }) {
|
|
6151
|
+
let r2 = z_(e5.selection, t2);
|
|
6152
|
+
if (!n2) return { selection: r2, pick: Ix(e5.pick) };
|
|
6153
|
+
let { selectedVariants: i2, durationChoiceId: a2, ...o2 } = r2;
|
|
6154
|
+
return { selection: { ...o2, ...t2.selectedVariants ? { selectedVariants: t2.selectedVariants } : {}, ...t2.durationChoiceId ? { durationChoiceId: t2.durationChoiceId } : {} }, pick: Ix(e5.pick) };
|
|
6155
|
+
}
|
|
6156
|
+
var Hx = { displayTimeZonePolicy: { basedOn: Nm.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
|
|
6157
|
+
async function Ux() {
|
|
6161
6158
|
try {
|
|
6162
6159
|
let e5 = await Im();
|
|
6163
6160
|
return { displayTimeZonePolicy: { basedOn: e5.displayTimeZone?.basedOn ?? Nm.BUSINESS_TIME_ZONE, customerCanChange: e5.displayTimeZone?.customerCanChange ?? false }, multiServiceAppointmentsEnabled: e5.multiServiceAppointments?.enabled ?? false };
|
|
6164
6161
|
} catch (e5) {
|
|
6165
|
-
return $o(e5, { feature: Zo.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }),
|
|
6162
|
+
return $o(e5, { feature: Zo.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), Hx;
|
|
6166
6163
|
}
|
|
6167
6164
|
}
|
|
6168
|
-
var
|
|
6169
|
-
var
|
|
6170
|
-
var
|
|
6171
|
-
function
|
|
6172
|
-
let e5 = (0, import_react.useContext)(
|
|
6173
|
-
if (!e5) throw Error(
|
|
6165
|
+
var Wx = { isLoading: true };
|
|
6166
|
+
var Gx = (0, import_react.createContext)(null);
|
|
6167
|
+
var Kx = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
|
|
6168
|
+
function qx() {
|
|
6169
|
+
let e5 = (0, import_react.useContext)(Gx);
|
|
6170
|
+
if (!e5) throw Error(Kx);
|
|
6174
6171
|
return e5;
|
|
6175
6172
|
}
|
|
6176
|
-
function
|
|
6177
|
-
return
|
|
6173
|
+
function Jx() {
|
|
6174
|
+
return qx().isLoading;
|
|
6178
6175
|
}
|
|
6179
|
-
function
|
|
6180
|
-
return (0, import_jsx_runtime.jsx)(
|
|
6176
|
+
function Yx({ children: e5 }) {
|
|
6177
|
+
return (0, import_jsx_runtime.jsx)(Gx.Provider, { value: Wx, children: e5 });
|
|
6181
6178
|
}
|
|
6182
|
-
function
|
|
6179
|
+
function Xx(e5) {
|
|
6183
6180
|
return e5.basedOn === Nm.CUSTOMER_TIME_ZONE ? Intl.DateTimeFormat().resolvedOptions().timeZone : void 0;
|
|
6184
6181
|
}
|
|
6185
|
-
function
|
|
6186
|
-
let e5 =
|
|
6187
|
-
return e5.isLoading ? void 0 :
|
|
6182
|
+
function Zx() {
|
|
6183
|
+
let e5 = qx();
|
|
6184
|
+
return e5.isLoading ? void 0 : Xx(e5.displayTimeZonePolicy);
|
|
6188
6185
|
}
|
|
6189
|
-
function
|
|
6186
|
+
function Qx({ settingsPromise: e5, children: t2 }) {
|
|
6190
6187
|
let n2 = Os(e5), r2 = (0, import_react.useMemo)(() => ({ isLoading: false, ...n2 }), [n2]);
|
|
6191
|
-
return (0, import_jsx_runtime.jsx)(
|
|
6188
|
+
return (0, import_jsx_runtime.jsx)(Gx.Provider, { value: r2, children: t2 });
|
|
6192
6189
|
}
|
|
6193
|
-
function
|
|
6194
|
-
let r2 = sx(), [i2] = (0, import_react.useState)(() => e5 ? null : Tx({ key: mx(), warmupData: r2, fetchData:
|
|
6195
|
-
return e5 ? (0, import_jsx_runtime.jsx)(
|
|
6190
|
+
function $x({ bookingsSettings: e5, children: n2 }) {
|
|
6191
|
+
let r2 = sx(), [i2] = (0, import_react.useState)(() => e5 ? null : Tx({ key: mx(), warmupData: r2, fetchData: Ux }));
|
|
6192
|
+
return e5 ? (0, import_jsx_runtime.jsx)(Gx.Provider, { value: { isLoading: false, ...e5 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Gx.Provider, { value: Wx, children: n2 }), children: (0, import_jsx_runtime.jsx)(Qx, { settingsPromise: i2, children: n2 }) });
|
|
6196
6193
|
}
|
|
6197
|
-
function
|
|
6198
|
-
let o2 = r2 ? { status: `loading`, booking: null, validUntil: null, planName: null } : null, s2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice:
|
|
6194
|
+
function eS({ isLoading: e5, hasError: t2, bookingsSettingsLoading: n2, rescheduleRequest: r2 = null, editingSurface: i2 = false, children: a2 }) {
|
|
6195
|
+
let o2 = r2 ? { status: `loading`, booking: null, validUntil: null, planName: null } : null, s2 = { service: null, serviceName: null, serviceDescription: null, serviceTagLine: null, serviceDefaultDuration: null, serviceImage: null, serviceSlug: null, servicePageLink: null, serviceId: null, serviceType: null, servicePrice: yy, isVariedService: false, serviceOptionsAndVariants: null, pricingOption: null, isLoadingServiceOptionsAndVariants: e5, hasAddOns: false, isConferenceEnabled: false, offeredDays: [], courseAvailability: null, courseStartDate: null, courseEndDate: null, staffMembers: [], coverImage: void 0, gallery: [], serviceLocations: [], policyDescription: null, serviceBookability: { state: Xv.AVAILABLE, isAvailableForBooking: false, bookingOpensAt: null }, displayTimeZone: `UTC`, isAvailableForBooking: () => false, hasPolicyDescription: () => false, hasCoverImage: () => false, hasGalleryImages: () => false, isVariantDuration: () => false, isLoading: e5, hasError: t2, locale: `en-US`, selectStaffMember: () => {
|
|
6199
6196
|
}, clearSelection: () => {
|
|
6200
6197
|
}, clearStaffMember: () => {
|
|
6201
6198
|
}, selection: u_(``), isSelectionPending: e5, selectionTimezone: void 0, setVariant: () => {
|
|
@@ -6210,90 +6207,90 @@ function qx({ isLoading: e5, hasError: t2, bookingsSettingsLoading: n2, reschedu
|
|
|
6210
6207
|
}, navigateToMultiServiceForm: () => {
|
|
6211
6208
|
}, resolveNextPageHref: () => null, isNavigating: false, isWaitlistSlotSelected: false, siteId: ``, editingSurface: i2, openPreferences: () => Promise.resolve(), multiServiceAppointmentsEnabled: false, isMultiServiceAppointment: false, multiServiceAppointmentServices: [], multiServiceAppointmentSelections: [], multiServiceAppointmentOptionsAndVariants: {}, multiServiceAppointmentVariantsStatus: `ready`, bookingsSettingsLoading: n2, reschedule: o2, rescheduleBooking: async () => ({ outcome: `failed` }), goHomeAfterReschedule: () => {
|
|
6212
6209
|
}, canRescheduleToPick: false };
|
|
6213
|
-
return (0, import_jsx_runtime.jsx)(
|
|
6210
|
+
return (0, import_jsx_runtime.jsx)(IS.Provider, { value: s2, children: a2 });
|
|
6214
6211
|
}
|
|
6215
|
-
function
|
|
6216
|
-
return (0, import_jsx_runtime.jsx)(
|
|
6212
|
+
function tS({ rescheduleRequest: e5, editingSurface: t2, children: n2 }) {
|
|
6213
|
+
return (0, import_jsx_runtime.jsx)(Yx, { children: (0, import_jsx_runtime.jsx)(eS, { isLoading: true, hasError: false, bookingsSettingsLoading: true, rescheduleRequest: e5, editingSurface: t2, children: n2 }) });
|
|
6217
6214
|
}
|
|
6218
|
-
function
|
|
6219
|
-
let r2 =
|
|
6220
|
-
return (0, import_jsx_runtime.jsx)(
|
|
6215
|
+
function nS({ rescheduleRequest: e5, editingSurface: t2, children: n2 }) {
|
|
6216
|
+
let r2 = Jx();
|
|
6217
|
+
return (0, import_jsx_runtime.jsx)(eS, { isLoading: false, hasError: true, bookingsSettingsLoading: r2, rescheduleRequest: e5, editingSurface: t2, children: n2 });
|
|
6221
6218
|
}
|
|
6222
|
-
var { RateType:
|
|
6223
|
-
function
|
|
6219
|
+
var { RateType: rS } = fu;
|
|
6220
|
+
function iS(e5, t2) {
|
|
6224
6221
|
if (e5) return t2 ? nb(e5, t2)?.toISOString() ?? e5 : e5;
|
|
6225
6222
|
}
|
|
6226
|
-
var
|
|
6227
|
-
function
|
|
6228
|
-
return e5 ?
|
|
6223
|
+
var aS = { BUSINESS: `OWNER_BUSINESS`, CUSTOM: `OWNER_CUSTOM`, CUSTOMER: `CUSTOM` };
|
|
6224
|
+
function oS(e5) {
|
|
6225
|
+
return e5 ? aS[e5] : aS.BUSINESS;
|
|
6229
6226
|
}
|
|
6230
|
-
function
|
|
6227
|
+
function sS(e5, t2) {
|
|
6231
6228
|
let n2 = x_(e5), r2 = n2 && !n2.anyResource ? n2.staffMemberId : null;
|
|
6232
|
-
return { serviceId: e5.serviceId, scheduleId: e5.scheduleId, startDate:
|
|
6229
|
+
return { serviceId: e5.serviceId, scheduleId: e5.scheduleId, startDate: iS(e5.slotStart, t2), endDate: iS(e5.slotEnd, t2), timezone: t2, eventId: e5.eventId, sessionId: e5.sessionId, location: e5.locationId || e5.locationType ? { ...e5.locationId ? { _id: e5.locationId } : {}, locationType: oS(e5.locationType) } : void 0, resource: r2 ? { _id: r2 } : void 0, resourceSelections: !r2 && Vm(e5.serviceType) ? [{ resourceTypeId: zs, selectionMethod: `ANY_RESOURCE`, ...n2?.anyResource && e5.requestedGender ? { requestedGender: { gender: e5.requestedGender } } : {} }] : void 0 };
|
|
6233
6230
|
}
|
|
6234
|
-
var
|
|
6235
|
-
function
|
|
6231
|
+
var cS = `manage_booking_standalone_page`;
|
|
6232
|
+
function lS(e5) {
|
|
6236
6233
|
let t2 = e5.get(i_.bookingId) || null, n2 = e5.get(i_.token) || null;
|
|
6237
|
-
return !t2 && !n2 ? null : { bookingId: t2, token: n2, fromManageBookingPage: e5.get(i_.referral) ===
|
|
6234
|
+
return !t2 && !n2 ? null : { bookingId: t2, token: n2, fromManageBookingPage: e5.get(i_.referral) === cS, redirectUrl: e5.get(i_.rescheduleRedirectUrl) || null };
|
|
6238
6235
|
}
|
|
6239
|
-
function
|
|
6236
|
+
function uS(e5, t2, n2, r2 = null) {
|
|
6240
6237
|
if (n2.kind === `class`) return { eventId: e5.eventId };
|
|
6241
|
-
let { serviceId: i2, scheduleId: a2, startDate: o2, endDate: s2, location: c2, resource: l2, resourceSelections: u2 } =
|
|
6238
|
+
let { serviceId: i2, scheduleId: a2, startDate: o2, endDate: s2, location: c2, resource: l2, resourceSelections: u2 } = sS(e5, t2);
|
|
6242
6239
|
return { serviceId: i2, scheduleId: a2, startDate: o2, endDate: s2, timezone: t2, ...c2 ? { location: { ...c2._id ? { _id: c2._id } : {}, locationType: c2.locationType, ...n2.customAddress !== null && c2.locationType === `CUSTOM` ? { formattedAddress: n2.customAddress } : {} } } : {}, ...l2?._id ? { resource: { _id: l2._id } } : r2 ? { resource: { _id: r2 } } : u2 ? { resourceSelections: u2 } : {} };
|
|
6243
6240
|
}
|
|
6244
|
-
var
|
|
6241
|
+
var dS = class extends Error {
|
|
6245
6242
|
reason;
|
|
6246
6243
|
cause;
|
|
6247
6244
|
constructor(e5, t2) {
|
|
6248
6245
|
super(`Booking to reschedule not loaded: ${e5}`), this.reason = e5, this.cause = t2;
|
|
6249
6246
|
}
|
|
6250
6247
|
};
|
|
6251
|
-
var
|
|
6252
|
-
function
|
|
6248
|
+
var fS = (e5) => e5?.status;
|
|
6249
|
+
function pS(e5) {
|
|
6253
6250
|
return e5?.includes(`INDIVIDUAL`) ? `appointment` : e5?.includes(`GROUP`) ? `class` : `other`;
|
|
6254
6251
|
}
|
|
6255
|
-
function
|
|
6252
|
+
function mS({ totalParticipants: e5, participantsChoices: t2 }) {
|
|
6256
6253
|
return e5 || (t2?.serviceChoices ?? []).reduce((e6, t3) => e6 + (t3.numberOfParticipants ?? 1), 0) || 1;
|
|
6257
6254
|
}
|
|
6258
|
-
function
|
|
6255
|
+
function hS(e5) {
|
|
6259
6256
|
if (!e5) return null;
|
|
6260
6257
|
let t2 = new Date(e5);
|
|
6261
6258
|
return Number.isNaN(t2.getTime()) ? null : t2.toISOString();
|
|
6262
6259
|
}
|
|
6263
|
-
function
|
|
6260
|
+
function gS(e5, t2) {
|
|
6264
6261
|
let { slot: n2, schedule: r2, tags: i2 } = e5.bookedEntity ?? {}, a2 = n2?.location;
|
|
6265
|
-
return { bookingId: t2, revision: e5.revision ?? null, serviceId: n2?.serviceId ?? r2?.serviceId ?? null, kind:
|
|
6262
|
+
return { bookingId: t2, revision: e5.revision ?? null, serviceId: n2?.serviceId ?? r2?.serviceId ?? null, kind: pS(i2), startDate: hS(e5.startDate), participants: mS(e5), addOnIds: (e5.bookedAddOns ?? []).flatMap((e6) => e6._id ?? []), locationId: a2?._id ?? null, customAddress: a2?.locationType === `CUSTOM` ? a2.formattedAddress ?? `` : null };
|
|
6266
6263
|
}
|
|
6267
|
-
async function
|
|
6264
|
+
async function _S({ bookingId: e5, token: t2 }) {
|
|
6268
6265
|
let n2;
|
|
6269
6266
|
try {
|
|
6270
6267
|
t2 ? n2 = (await Em(t2)).booking : e5 && (n2 = (await eu({ filter: { _id: e5 }, cursorPaging: { limit: 1 } }, {})).extendedBookings?.[0]?.booking);
|
|
6271
6268
|
} catch (e6) {
|
|
6272
|
-
let t3 =
|
|
6273
|
-
throw t3 === 404 ? new
|
|
6269
|
+
let t3 = fS(e6);
|
|
6270
|
+
throw t3 === 404 ? new dS(`notFound`, e6) : new dS(t3 === 403 ? `accessDenied` : `failed`, e6);
|
|
6274
6271
|
}
|
|
6275
6272
|
let r2 = n2?._id;
|
|
6276
|
-
if (!n2 || !r2) throw new
|
|
6277
|
-
let i2 =
|
|
6273
|
+
if (!n2 || !r2) throw new dS(`notFound`);
|
|
6274
|
+
let i2 = gS(n2, r2);
|
|
6278
6275
|
return t2 ? { ...i2, customAddress: null } : i2;
|
|
6279
6276
|
}
|
|
6280
|
-
function
|
|
6277
|
+
function vS(e5) {
|
|
6281
6278
|
let t2 = e5?.bookedEntity?.slot;
|
|
6282
6279
|
return { staffName: t2?.resource?.name || null, locationName: t2?.location?.name || t2?.location?.formattedAddress || null };
|
|
6283
6280
|
}
|
|
6284
|
-
async function
|
|
6285
|
-
return
|
|
6281
|
+
async function yS({ booking: e5, slot: t2, token: n2 }) {
|
|
6282
|
+
return vS(n2 ? (await Tm(n2, t2, { revision: e5.revision || `1` })).booking : (await Dm(e5.bookingId, t2, { revision: e5.revision ?? `` })).booking);
|
|
6286
6283
|
}
|
|
6287
|
-
var
|
|
6288
|
-
async function
|
|
6284
|
+
var bS = { validUntil: null, planName: null };
|
|
6285
|
+
async function xS(e5) {
|
|
6289
6286
|
try {
|
|
6290
6287
|
let t2 = (await eu({ filter: { _id: e5 }, cursorPaging: { limit: 1 } }, { withEcomTransactions: true })).extendedBookings?.[0]?.transactions?.chargedMembershipPaymentDetails;
|
|
6291
|
-
return t2 ? { validUntil: t2.expirationDate ? new Date(t2.expirationDate).toISOString() : null, planName: t2.name?.translated || t2.name?.original || null } :
|
|
6288
|
+
return t2 ? { validUntil: t2.expirationDate ? new Date(t2.expirationDate).toISOString() : null, planName: t2.name?.translated || t2.name?.original || null } : bS;
|
|
6292
6289
|
} catch (e6) {
|
|
6293
|
-
return $o(e6, { feature: Zo.reschedule, action: `fetch-plan-valid-until`, level: `warning` }),
|
|
6290
|
+
return $o(e6, { feature: Zo.reschedule, action: `fetch-plan-valid-until`, level: `warning` }), bS;
|
|
6294
6291
|
}
|
|
6295
6292
|
}
|
|
6296
|
-
function
|
|
6293
|
+
function SS() {
|
|
6297
6294
|
let e5 = gs();
|
|
6298
6295
|
return (0, import_react.useCallback)(() => {
|
|
6299
6296
|
if (!e5) return null;
|
|
@@ -6304,26 +6301,26 @@ function hS() {
|
|
|
6304
6301
|
}
|
|
6305
6302
|
}, [e5]);
|
|
6306
6303
|
}
|
|
6307
|
-
var
|
|
6308
|
-
function
|
|
6304
|
+
var CS = ns(`@wix/viewer-service-site-members`);
|
|
6305
|
+
function wS() {
|
|
6309
6306
|
try {
|
|
6310
6307
|
return (0, import_services_manager_react.useGetService)();
|
|
6311
6308
|
} catch {
|
|
6312
6309
|
return null;
|
|
6313
6310
|
}
|
|
6314
6311
|
}
|
|
6315
|
-
function
|
|
6312
|
+
function TS(e5) {
|
|
6316
6313
|
try {
|
|
6317
|
-
return e5 ? e5(
|
|
6314
|
+
return e5 ? e5(CS) : null;
|
|
6318
6315
|
} catch {
|
|
6319
6316
|
return null;
|
|
6320
6317
|
}
|
|
6321
6318
|
}
|
|
6322
|
-
function
|
|
6323
|
-
return
|
|
6319
|
+
function ES() {
|
|
6320
|
+
return TS(wS());
|
|
6324
6321
|
}
|
|
6325
|
-
var
|
|
6326
|
-
function
|
|
6322
|
+
var DS = typeof window > `u` ? import_react.useEffect : import_react.useLayoutEffect;
|
|
6323
|
+
function OS(e5) {
|
|
6327
6324
|
if (!e5) return null;
|
|
6328
6325
|
try {
|
|
6329
6326
|
let t2 = new URL(e5);
|
|
@@ -6332,328 +6329,308 @@ function xS(e5) {
|
|
|
6332
6329
|
return null;
|
|
6333
6330
|
}
|
|
6334
6331
|
}
|
|
6335
|
-
function
|
|
6332
|
+
function kS(e5, { bookable: t2, staffChoiceRequired: n2, timezone: r2, validUntil: i2 }) {
|
|
6336
6333
|
if (!I_(e5) || !t2) return false;
|
|
6337
6334
|
let a2 = x_(e5);
|
|
6338
6335
|
if (n2 && (!a2 || a2.anyResource)) return false;
|
|
6339
6336
|
let o2 = e5.slotStart ? nb(e5.slotStart, r2) : null;
|
|
6340
6337
|
return !i2 || !o2 || o2.getTime() <= Date.parse(i2);
|
|
6341
6338
|
}
|
|
6342
|
-
var
|
|
6343
|
-
var
|
|
6344
|
-
async function
|
|
6339
|
+
var AS = { validUntil: null, planName: null };
|
|
6340
|
+
var jS = { status: `loading`, booking: null, ...AS };
|
|
6341
|
+
async function MS(e5) {
|
|
6345
6342
|
return e5.getMemberDetails ? !!await e5.getMemberDetails().catch(() => null) : !!e5.isInitiallyLoggedIn;
|
|
6346
6343
|
}
|
|
6347
|
-
async function
|
|
6344
|
+
async function NS(e5, t2) {
|
|
6348
6345
|
let { bookingId: n2, token: r2 } = e5;
|
|
6349
|
-
if (!r2 && !(t2 && await
|
|
6346
|
+
if (!r2 && !(t2 && await MS(t2)) && !(t2 && await t2.promptLogin({ mode: `login` }).then(() => true, () => false))) return { status: `loginRequired`, booking: null, ...AS };
|
|
6350
6347
|
try {
|
|
6351
|
-
let [t3, i2] = await Promise.all([
|
|
6348
|
+
let [t3, i2] = await Promise.all([_S(e5), n2 && !r2 ? xS(n2) : AS]);
|
|
6352
6349
|
return { status: `ready`, booking: t3, validUntil: i2.validUntil, planName: i2.planName };
|
|
6353
6350
|
} catch (e6) {
|
|
6354
|
-
return $o(e6, { feature: Zo.reschedule, action: `fetch-booking` }), { status: e6 instanceof
|
|
6351
|
+
return $o(e6, { feature: Zo.reschedule, action: `fetch-booking` }), { status: e6 instanceof dS ? e6.reason : `failed`, booking: null, ...AS };
|
|
6355
6352
|
}
|
|
6356
6353
|
}
|
|
6357
|
-
var
|
|
6358
|
-
function
|
|
6359
|
-
let r2 = `${e5.bookingId ?? ``}|${e5.token ?? ``}`, i2 =
|
|
6360
|
-
return i2.users += 1,
|
|
6361
|
-
--i2.users, i2.users === 0 &&
|
|
6354
|
+
var PS = /* @__PURE__ */ new Map();
|
|
6355
|
+
function FS(e5, t2, n2) {
|
|
6356
|
+
let r2 = `${e5.bookingId ?? ``}|${e5.token ?? ``}`, i2 = PS.get(r2) ?? { load: NS(e5, t2), users: 0 };
|
|
6357
|
+
return i2.users += 1, PS.set(r2, i2), i2.load.then(n2), () => {
|
|
6358
|
+
--i2.users, i2.users === 0 && PS.get(r2) === i2 && PS.delete(r2);
|
|
6362
6359
|
};
|
|
6363
6360
|
}
|
|
6364
|
-
var
|
|
6365
|
-
var
|
|
6366
|
-
function
|
|
6367
|
-
let t2 = (0, import_react.useContext)(
|
|
6368
|
-
if (!t2 && !e5) throw Error(
|
|
6361
|
+
var IS = (0, import_react.createContext)(null);
|
|
6362
|
+
var LS = `useServiceContext must be used within ServiceContextProvider`;
|
|
6363
|
+
function RS(e5 = false) {
|
|
6364
|
+
let t2 = (0, import_react.useContext)(IS);
|
|
6365
|
+
if (!t2 && !e5) throw Error(LS);
|
|
6369
6366
|
return t2;
|
|
6370
6367
|
}
|
|
6371
|
-
function
|
|
6368
|
+
function zS(e5, t2, n2) {
|
|
6372
6369
|
if (e5) return { by: `slug`, value: e5 };
|
|
6373
6370
|
let r2 = t2?.services ?? [];
|
|
6374
6371
|
return o_(t2) ? { by: `multi`, serviceIds: r2.map(({ serviceId: e6 }) => e6) } : r2.length === 1 ? { by: `id`, value: r2[0].serviceId } : n2 ? { by: `id`, value: n2 } : { by: `none` };
|
|
6375
6372
|
}
|
|
6376
|
-
var
|
|
6377
|
-
var
|
|
6378
|
-
var
|
|
6379
|
-
var
|
|
6380
|
-
let n2 =
|
|
6373
|
+
var BS = (e5) => void 0;
|
|
6374
|
+
var VS = Symbol(`unseeded`);
|
|
6375
|
+
var HS = (e5, t2) => r_(a_(t2))?.services.find((t3) => t3.serviceId === e5);
|
|
6376
|
+
var US = (e5, t2) => {
|
|
6377
|
+
let n2 = HS(e5, t2) ?? u_(e5), r2 = BS(e5);
|
|
6381
6378
|
return r2 === void 0 ? n2 : S_(n2, r2);
|
|
6382
6379
|
};
|
|
6383
|
-
var
|
|
6384
|
-
let n2 =
|
|
6380
|
+
var WS = (e5, t2) => {
|
|
6381
|
+
let n2 = US(e5, t2), r2 = t2.get(i_.resource), i2 = BS(e5) !== void 0 || !!HS(e5, t2);
|
|
6385
6382
|
return r2 && !i2 ? S_(n2, r2) : n2;
|
|
6386
6383
|
};
|
|
6387
|
-
function
|
|
6384
|
+
function GS(e5, t2) {
|
|
6388
6385
|
return !e5 || !t2 || !e5.services.every(I_) ? null : m_(t2, e5);
|
|
6389
6386
|
}
|
|
6390
|
-
var
|
|
6391
|
-
function
|
|
6387
|
+
var KS = [];
|
|
6388
|
+
function qS(e5) {
|
|
6392
6389
|
return { min: 1, max: e5?.bookingPolicy?.participantsPolicy?.maxParticipantsPerBooking || 1 };
|
|
6393
6390
|
}
|
|
6394
|
-
function
|
|
6391
|
+
function JS(e5, { previous: t2, others: n2 }, { min: r2, max: i2 }) {
|
|
6395
6392
|
let a2 = Math.max(0, Math.floor(e5)), o2 = Math.max(t2, i2 - n2), s2 = Math.min(a2, o2);
|
|
6396
6393
|
return s2 > 0 && n2 + s2 < r2 ? Math.min(r2 - n2, o2) : s2;
|
|
6397
6394
|
}
|
|
6398
|
-
var
|
|
6399
|
-
var
|
|
6400
|
-
var
|
|
6401
|
-
var
|
|
6402
|
-
var
|
|
6403
|
-
var
|
|
6404
|
-
var
|
|
6405
|
-
var
|
|
6406
|
-
var
|
|
6407
|
-
function
|
|
6408
|
-
return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(
|
|
6409
|
-
}
|
|
6410
|
-
var
|
|
6411
|
-
var
|
|
6412
|
-
function
|
|
6395
|
+
var YS = (e5) => ({ service: e5, hasError: false });
|
|
6396
|
+
var XS = () => ({ service: null, hasError: true });
|
|
6397
|
+
var ZS = { service: null, hasError: false };
|
|
6398
|
+
var QS = { ...ZS, awaitsPreferences: true };
|
|
6399
|
+
var $S = (e5) => ({ ...ZS, isMultiServiceAppointment: true, multiServiceAppointmentServices: e5 });
|
|
6400
|
+
var eC = () => ({ ...XS(), isMultiServiceAppointment: true });
|
|
6401
|
+
var tC = [];
|
|
6402
|
+
var nC = [];
|
|
6403
|
+
var rC = {};
|
|
6404
|
+
function iC({ servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2 = null, editingSurface: a2 = false, bookingsSettings: o2, seoPage: s2 = null, children: c2 }) {
|
|
6405
|
+
return (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(tS, { rescheduleRequest: i2, editingSurface: a2, children: c2 }), children: (0, import_jsx_runtime.jsx)($x, { bookingsSettings: o2, children: (0, import_jsx_runtime.jsxs)(ts, { fallback: (0, import_jsx_runtime.jsx)(nS, { rescheduleRequest: i2, editingSurface: a2, children: c2 }), feature: Zo.service, children: [s2 && e5 && (0, import_jsx_runtime.jsx)(pv, { servicePromise: e5, page: s2 }), (0, import_jsx_runtime.jsx)(cC, { servicePromise: e5, refreshSignal: n2, injected: r2, rescheduleRequest: i2, editingSurface: a2, children: c2 })] }) }) });
|
|
6406
|
+
}
|
|
6407
|
+
var aC = (e5) => e5 ?? void 0;
|
|
6408
|
+
var oC = () => void 0;
|
|
6409
|
+
function sC(e5, t2) {
|
|
6413
6410
|
$o(e5, { feature: Zo.service, action: `fetch-service-variants`, level: `warning`, contexts: { service: { serviceId: t2 } } });
|
|
6414
6411
|
}
|
|
6415
|
-
function
|
|
6416
|
-
let f2 = n2 ? null : e5 ? Os(e5) : null, p2 = n2?.service ?? f2?.service ?? null, m2 = f2?.hasError ?? false, g2 = f2?.awaitsPreferences ?? false, _2 = f2?.isMultiServiceAppointment ?? false, v2 = f2?.multiServiceAppointmentServices ??
|
|
6412
|
+
function cC({ servicePromise: e5, refreshSignal: t2 = 0, injected: n2, rescheduleRequest: a2 = null, editingSurface: o2 = false, children: c2 }) {
|
|
6413
|
+
let f2 = n2 ? null : e5 ? Os(e5) : null, p2 = n2?.service ?? f2?.service ?? null, m2 = f2?.hasError ?? false, g2 = f2?.awaitsPreferences ?? false, _2 = f2?.isMultiServiceAppointment ?? false, v2 = f2?.multiServiceAppointmentServices ?? tC, y2 = Jb(), b2 = Xb(), x2 = rx(), { navigate: ee2, navigateToHref: te2, resolvePath: S2, toHref: C2, getBookingFormPath: w2 } = $_(), T2 = SS(), E2 = Xy(Vy.SERVICE), { getParsedUrl: ne2, pushUrl: re2 } = ps(), D2 = (0, import_react.useRef)(ne2);
|
|
6417
6414
|
D2.current = ne2;
|
|
6418
6415
|
let ie2 = (0, import_react.useRef)(re2);
|
|
6419
6416
|
ie2.current = re2;
|
|
6420
6417
|
let O2 = sx(), ae2 = (0, import_react.useRef)(O2);
|
|
6421
6418
|
ae2.current = O2;
|
|
6422
|
-
let [k2, oe2] = (0, import_react.useState)(
|
|
6419
|
+
let [k2, oe2] = (0, import_react.useState)(jS), se2 = ES(), ce2 = (e6, t3) => a2 ? u_(e6) : US(e6, t3), le2 = (0, import_react.useRef)(ce2);
|
|
6423
6420
|
le2.current = ce2;
|
|
6424
|
-
let ue2 = Mx(), A2 = ue2 === Ax, de2 = a2 || A2 ? null : ue2, [fe2, pe2] = (0, import_react.useState)(() => A2 ? u_(p2?._id ?? ``) : ce2(p2?._id ?? ``, ne2().searchParams)),
|
|
6421
|
+
let ue2 = Mx(), A2 = ue2 === Ax, de2 = a2 || A2 ? null : ue2, [fe2, pe2] = (0, import_react.useState)(() => Lx(A2 ? u_(p2?._id ?? ``) : ce2(p2?._id ?? ``, ne2().searchParams))), { selection: me2 } = fe2, j2 = (0, import_react.useRef)(fe2), he2 = (0, import_react.useCallback)((e6) => {
|
|
6422
|
+
j2.current = e6, pe2(e6);
|
|
6423
|
+
}, []), [ge2, _e2] = (0, import_react.useState)(A2 && !a2), ve2 = ab(), [ye2, be2] = (0, import_react.useState)(null), xe2 = (0, import_react.useRef)(ye2), [Se2, Ce2] = (0, import_react.useState)(0), M2 = p2?._id ?? null, we2 = (0, import_react.useMemo)(() => {
|
|
6425
6424
|
if (!a2) return null;
|
|
6426
6425
|
let { booking: e6 } = k2;
|
|
6427
6426
|
if (k2.status !== `ready` || !e6) return { ...k2 };
|
|
6428
6427
|
let t3 = e6.kind === `other` ? `notReschedulable` : e6.serviceId === M2 ? `ready` : `wrongService`;
|
|
6429
6428
|
return { ...k2, status: t3 };
|
|
6430
|
-
}, [a2, k2, M2]),
|
|
6429
|
+
}, [a2, k2, M2]), Te2 = p2?.schedule?._id ?? null, Ee2 = p2?.type ?? null, De2 = (0, import_react.useMemo)(() => {
|
|
6431
6430
|
if (!p2) return null;
|
|
6432
6431
|
let e6 = S2(`servicePage`, { slug: p2.mainSlug?.name ?? null, serviceId: p2._id ?? null });
|
|
6433
6432
|
return e6 ? { href: C2(e6), target: `_self` } : null;
|
|
6434
|
-
}, [p2, S2, C2]), [
|
|
6433
|
+
}, [p2, S2, C2]), [Oe2, ke2] = (0, import_react.useState)(KS), Ae2 = n2 ? n2.masterEvents : Oe2, je2 = Zx(), Me2 = qx(), Ne2 = Me2.isLoading, Pe2 = !Me2.isLoading && Me2.multiServiceAppointmentsEnabled;
|
|
6435
6434
|
(0, import_react.useEffect)(() => {
|
|
6436
|
-
if (!a2 ||
|
|
6437
|
-
let e6 = false, t3 =
|
|
6435
|
+
if (!a2 || Ne2) return;
|
|
6436
|
+
let e6 = false, t3 = FS(a2, se2, (t4) => {
|
|
6438
6437
|
e6 || oe2(t4);
|
|
6439
6438
|
});
|
|
6440
6439
|
return () => {
|
|
6441
6440
|
e6 = true, t3();
|
|
6442
6441
|
};
|
|
6443
|
-
}, [a2,
|
|
6444
|
-
let
|
|
6442
|
+
}, [a2, Ne2, se2]);
|
|
6443
|
+
let Fe2 = !n2 && !!p2 && Wm(p2), Ie2 = Fe2 && M2 ? fx(b2, x2, M2, t2) : null, Le2 = (typeof window > `u` && Ie2 && M2 && O2.scope && !Ne2 ? Os(js(Tx({ key: Ie2, warmupData: O2, fetchData: () => Cb(M2).catch((e6) => (sC(e6, M2), null)) }), aC, oC)) : void 0) ?? (Ie2 ? yx(Ie2) : void 0), [Re2, ze2] = (0, import_react.useState)(() => Le2 ?? null), [Be2, Ve2] = (0, import_react.useState)(() => Le2 ? Ie2 : null), He2 = Ie2 !== null && Be2 !== Ie2, Ue2 = n2 ? n2.serviceOptionsAndVariants : Fe2 ? Re2 : null;
|
|
6445
6444
|
(0, import_react.useEffect)(() => {
|
|
6446
6445
|
if (n2) return;
|
|
6447
|
-
let e6 =
|
|
6448
|
-
if ((!e6 ||
|
|
6449
|
-
let i2 =
|
|
6446
|
+
let e6 = Te2 && !Vm(Ee2) ? Te2 : null;
|
|
6447
|
+
if ((!e6 || Ne2) && ke2((e7) => e7.length === 0 ? e7 : KS), Ne2) return;
|
|
6448
|
+
let i2 = Fe2 ? M2 : null;
|
|
6450
6449
|
if (!e6 && !i2) return;
|
|
6451
|
-
let a3 = false, o3 = e6 ? xb([e6],
|
|
6452
|
-
|
|
6450
|
+
let a3 = false, o3 = e6 ? xb([e6], je2).catch(() => KS) : Promise.resolve(KS), s2 = i2 ? Tx({ key: fx(b2, x2, i2, t2), warmupData: ae2.current, fetchData: () => Cb(i2) }).catch((e7) => {
|
|
6451
|
+
sC(e7, i2);
|
|
6453
6452
|
}) : Promise.resolve(void 0);
|
|
6454
6453
|
return Promise.all([o3, s2]).then(([e7, t3]) => {
|
|
6455
6454
|
a3 || (0, import_react.startTransition)(() => {
|
|
6456
|
-
|
|
6455
|
+
ke2(e7), t3 !== void 0 && ze2(t3), Ve2(Ie2);
|
|
6457
6456
|
});
|
|
6458
6457
|
}), () => {
|
|
6459
6458
|
a3 = true;
|
|
6460
6459
|
};
|
|
6461
|
-
}, [n2,
|
|
6462
|
-
let
|
|
6463
|
-
let e6 = new Set(JSON.parse(
|
|
6460
|
+
}, [n2, Te2, Ee2, je2, Ne2, Fe2, M2, Ie2, b2, x2]);
|
|
6461
|
+
let We2 = ge2 ? null : de2, Ge2 = (0, import_react.useMemo)(() => JSON.stringify([...new Set((r_(We2)?.services ?? []).filter((e6) => T_(e6).length > 0).map((e6) => e6.serviceId))].sort()), [We2]), Ke2 = (0, import_react.useMemo)(() => {
|
|
6462
|
+
let e6 = new Set(JSON.parse(Ge2));
|
|
6464
6463
|
return [...new Set(v2.filter(Wm).flatMap(({ _id: t3 }) => t3 && e6.has(t3) ? [t3] : []))];
|
|
6465
|
-
}, [v2,
|
|
6464
|
+
}, [v2, Ge2]), qe2 = (0, import_react.useMemo)(() => ({ serviceIds: Ke2, refreshSignal: t2, language: b2, currency: x2 }), [Ke2, t2, b2, x2]), [N2, P2] = (0, import_react.useState)(null), F2 = N2?.request === qe2 ? N2 : null, Je2 = F2?.data ?? rC, Ye2 = Ke2.length === 0 ? `ready` : Ne2 || !F2 ? `loading` : F2.data && Ke2.every((e6) => F2.data?.[e6]) ? `ready` : `error`;
|
|
6466
6465
|
(0, import_react.useEffect)(() => {
|
|
6467
|
-
let { serviceIds: e6, refreshSignal: t3, language: n3, currency: i2 } =
|
|
6468
|
-
if (
|
|
6466
|
+
let { serviceIds: e6, refreshSignal: t3, language: n3, currency: i2 } = qe2;
|
|
6467
|
+
if (Ne2 || e6.length === 0) return;
|
|
6469
6468
|
let a3 = false;
|
|
6470
6469
|
return Tx({ key: px(n3, i2, e6, t3), warmupData: ae2.current, fetchData: () => Tb(e6) }).catch((e7) => ($o(e7, { feature: Zo.service, action: `fetch-multi-service-variants`, level: `warning` }), null)).then((e7) => {
|
|
6471
|
-
a3 || (0, import_react.startTransition)(() =>
|
|
6470
|
+
a3 || (0, import_react.startTransition)(() => P2({ request: qe2, data: e7 }));
|
|
6472
6471
|
}), () => {
|
|
6473
6472
|
a3 = true;
|
|
6474
6473
|
};
|
|
6475
|
-
}, [
|
|
6476
|
-
let
|
|
6474
|
+
}, [Ne2, qe2]);
|
|
6475
|
+
let Xe2 = jy({ service: p2, masterEvents: Ae2, locale: y2, timeZone: je2 }), Ze2 = (0, import_react.useRef)(VS);
|
|
6477
6476
|
(0, import_react.useEffect)(() => {
|
|
6478
|
-
if (
|
|
6477
|
+
if (Ze2.current !== VS) {
|
|
6479
6478
|
let e6 = le2.current(p2?._id ?? ``, D2.current().searchParams);
|
|
6480
|
-
j2.current
|
|
6479
|
+
he2(Rx(j2.current, e6));
|
|
6481
6480
|
}
|
|
6482
|
-
|
|
6481
|
+
Ze2.current = M2;
|
|
6483
6482
|
}, [M2]);
|
|
6484
|
-
let
|
|
6485
|
-
|
|
6486
|
-
if (
|
|
6483
|
+
let Qe2 = (0, import_react.useRef)(A2 ? VS : de2), $e2 = (0, import_react.useRef)(null), et2 = (0, import_react.useRef)(false);
|
|
6484
|
+
DS(() => {
|
|
6485
|
+
if (et2.current = true, Qe2.current !== VS) return;
|
|
6487
6486
|
let e6 = le2.current(M2 ?? ``, D2.current().searchParams);
|
|
6488
|
-
j2.current = e6,
|
|
6487
|
+
j2.current = { ...j2.current, selection: e6 }, $e2.current = e6;
|
|
6489
6488
|
}, []), (0, import_react.useEffect)(() => {
|
|
6490
|
-
let e6 =
|
|
6491
|
-
if (!e6 && (A2 || t3 ===
|
|
6492
|
-
let n3 =
|
|
6493
|
-
if (
|
|
6494
|
-
let i2 =
|
|
6495
|
-
if (
|
|
6489
|
+
let e6 = Qe2.current === VS, t3 = e6 ? a2 ? null : a_(D2.current().searchParams) : de2;
|
|
6490
|
+
if (!e6 && (A2 || t3 === Qe2.current)) return;
|
|
6491
|
+
let n3 = Qe2.current;
|
|
6492
|
+
if (Qe2.current = t3, n3 !== VS && v_(n3, t3)) return;
|
|
6493
|
+
let i2 = $e2.current;
|
|
6494
|
+
if ($e2.current = null, e6 && i2 && j2.current.selection !== i2) {
|
|
6496
6495
|
(0, import_react.startTransition)(() => {
|
|
6497
|
-
pe2(j2.current),
|
|
6496
|
+
pe2(j2.current), _e2(false);
|
|
6498
6497
|
});
|
|
6499
6498
|
return;
|
|
6500
6499
|
}
|
|
6501
|
-
let o3 = le2.current(M2 ?? ``, D2.current().searchParams);
|
|
6502
|
-
|
|
6503
|
-
(
|
|
6504
|
-
|
|
6505
|
-
});
|
|
6506
|
-
return;
|
|
6507
|
-
}
|
|
6508
|
-
pe2(o3), Te2.current = null, we2(null), De2((e7) => e7 + 1);
|
|
6500
|
+
let o3 = le2.current(M2 ?? ``, D2.current().searchParams), s2 = Rx(j2.current, o3);
|
|
6501
|
+
j2.current = s2, e6 ? (0, import_react.startTransition)(() => {
|
|
6502
|
+
pe2(s2), _e2(false);
|
|
6503
|
+
}) : (pe2(s2), xe2.current = null, be2(null), Ce2((e7) => e7 + 1));
|
|
6509
6504
|
}, [A2, de2, M2, a2]);
|
|
6510
|
-
let
|
|
6511
|
-
|
|
6512
|
-
let
|
|
6513
|
-
|
|
6514
|
-
let
|
|
6515
|
-
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
let t3 = D2.current(), n3 = e6(IS(M2 ?? ``, t3.searchParams)), r2 = c_(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [b_(n3, L2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
|
|
6520
|
-
nt2.current !== PS && (nt2.current = a_(i2.searchParams)), ie2.current(i2, { disableScrollToTop: true, skipHistory: true });
|
|
6521
|
-
}, [at2, M2]), st2 = r_(N2)?.wantsPromoCode === true, ct2 = (0, import_react.useCallback)((e6) => {
|
|
6505
|
+
let tt2 = (0, import_react.useRef)({});
|
|
6506
|
+
tt2.current = { serviceType: p2?.type ?? void 0, scheduleId: Um(p2?.type) || Hm(p2?.type) ? p2?.schedule?._id ?? void 0 : void 0 };
|
|
6507
|
+
let nt2 = (0, import_react.useRef)(A2 || ge2);
|
|
6508
|
+
nt2.current = A2 || ge2;
|
|
6509
|
+
let rt2 = (0, import_react.useCallback)((e6, t3) => c_(e6, { currentUrl: nt2.current && !et2.current ? pC(D2.current()) : D2.current(), entries: [b_(t3?.staffId === void 0 ? j2.current.selection : S_(j2.current.selection, t3.staffId), tt2.current)], policy: t3?.handoff ? `handoff` : `inPlace`, timezone: j2.current.pick.timezone }), []), I2 = (0, import_react.useCallback)((e6) => he2(zx(j2.current, e6)), [he2]), L2 = (0, import_react.useCallback)((e6) => {
|
|
6510
|
+
I2(e6);
|
|
6511
|
+
let t3 = D2.current(), n3 = e6(US(M2 ?? ``, t3.searchParams)), r2 = c_(`${t3.pathname}${t3.search}${t3.hash}`, { currentUrl: t3, entries: [b_(n3, tt2.current)], policy: `inPlace` }), i2 = new URL(r2, t3);
|
|
6512
|
+
Qe2.current !== VS && (Qe2.current = a_(i2.searchParams)), ie2.current(i2, { disableScrollToTop: true, skipHistory: true });
|
|
6513
|
+
}, [I2, M2]), it2 = r_(We2)?.wantsPromoCode === true, R2 = (0, import_react.useCallback)((e6) => {
|
|
6522
6514
|
let t3 = D2.current(), n3 = r_(a_(t3.searchParams));
|
|
6523
6515
|
if (!n3) return;
|
|
6524
6516
|
let r2 = new URL(m_(`${t3.pathname}${t3.search}${t3.hash}`, __(n3, e6)), t3);
|
|
6525
|
-
|
|
6526
|
-
}, []),
|
|
6527
|
-
let t3 = Object.entries(e6).filter(([e7, t4]) =>
|
|
6517
|
+
Qe2.current !== VS && (Qe2.current = a_(r2.searchParams)), ie2.current(r2, { disableScrollToTop: true, skipHistory: true });
|
|
6518
|
+
}, []), at2 = Ab(Ue2), ot2 = (0, import_react.useCallback)((e6, t3) => at2 ? E_(e6, t3 ? [t3] : []) : e6, [at2]), st2 = (0, import_react.useCallback)((e6) => I2((t3) => ot2(S_(t3, e6), e6)), [I2, ot2]), ct2 = (0, import_react.useCallback)(() => I2((e6) => ot2(w_(e6), null)), [I2, ot2]), lt2 = (0, import_react.useCallback)((e6) => I2((t3) => ot2(C_(t3, e6), null)), [I2, ot2]), ut2 = (0, import_react.useCallback)((e6) => L2((t3) => E_(t3, e6)), [L2]), dt2 = (0, import_react.useMemo)(() => qS(p2), [p2]), ft2 = (0, import_react.useMemo)(() => jb(Ue2, { locale: y2, staffMembers: p2 ? ny(p2) : [], businessLocations: zm(p2) }), [Ue2, y2, p2]), pt2 = (0, import_react.useMemo)(() => new Set(jb(Ue2, { locale: y2 })?.choices.flatMap((e6) => e6.choiceId ? [e6.choiceId] : []) ?? []), [Ue2, y2]), mt2 = (0, import_react.useCallback)((e6) => {
|
|
6519
|
+
let t3 = Object.entries(e6).filter(([e7, t4]) => pt2.has(e7) && Number.isFinite(t4));
|
|
6528
6520
|
if (!t3.length) return;
|
|
6529
6521
|
let n3 = (e7) => {
|
|
6530
|
-
let n4 = A_(e7,
|
|
6522
|
+
let n4 = A_(e7, pt2), r2 = ([e8, t4]) => t4 <= D_(n4, e8), i2 = [...t3.filter(r2), ...t3.filter((e8) => !r2(e8))];
|
|
6531
6523
|
for (let [e8, t4] of i2) {
|
|
6532
|
-
let r3 = D_(n4, e8), i3 =
|
|
6524
|
+
let r3 = D_(n4, e8), i3 = JS(t4, { previous: r3, others: O_(n4) - r3 }, dt2);
|
|
6533
6525
|
i3 !== r3 && (n4 = k_(n4, e8, i3));
|
|
6534
6526
|
}
|
|
6535
6527
|
return n4;
|
|
6536
6528
|
};
|
|
6537
|
-
n3(j2.current) !== j2.current &&
|
|
6538
|
-
}, [
|
|
6539
|
-
t3?.timezone && (ge2.current = t3.timezone), _e2.current = t3?.bookable ?? true, ye2(!_e2.current), xe2.current = t3?.staffChoiceRequired ?? false, Se2.current = t3?.rescheduleStaffId ?? null, at2((n3) => {
|
|
6540
|
-
let r2 = L_(n3, e6);
|
|
6541
|
-
return t3?.staffId === void 0 ? r2 : S_(r2, t3.staffId);
|
|
6542
|
-
});
|
|
6543
|
-
}, [at2]), St2 = (0, import_react.useCallback)(() => {
|
|
6544
|
-
_e2.current = true, ye2(false), xe2.current = false, Se2.current = null;
|
|
6529
|
+
n3(j2.current.selection) !== j2.current.selection && L2(n3);
|
|
6530
|
+
}, [pt2, dt2, L2]), ht2 = (0, import_react.useCallback)((e6) => L2((t3) => N_(t3, e6)), [L2]), gt2 = (0, import_react.useCallback)((e6, t3) => L2((n3) => P_(n3, e6, t3)), [L2]), _t2 = (0, import_react.useCallback)((e6, t3) => he2(Bx(j2.current, e6, t3)), [he2]), vt2 = (0, import_react.useCallback)(() => {
|
|
6545
6531
|
let e6 = le2.current(M2 ?? ``, D2.current().searchParams);
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
}, [
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
Ct2(H_);
|
|
6557
|
-
}, [Ct2]), Et2 = et2.serviceCtaState, Dt2 = (0, import_react.useMemo)(() => _2 ? (Ce2 ?? r_(N2))?.services ?? YS : YS, [_2, Ce2, N2]), Ot2 = (0, import_react.useMemo)(() => _2 ? RS(Ce2 ?? r_(N2), w2()) : null, [_2, Ce2, N2, w2]), kt2 = Es(`serviceCtaFormHrefCarriesSelection`), At2 = (0, import_react.useCallback)((e6) => {
|
|
6558
|
-
if (_2) return Ot2 ? C2(Ot2) : null;
|
|
6559
|
-
let t3 = W_({ actionState: Et2, serviceType: p2?.type ?? null, config: e6 ?? U_ });
|
|
6560
|
-
if (G_(t3, p2?.type ?? null, fe2)) return null;
|
|
6532
|
+
he2(Vx(j2.current, e6, { staffPriced: at2 }));
|
|
6533
|
+
}, [he2, M2, at2]), yt2 = (0, import_react.useCallback)((e6) => {
|
|
6534
|
+
let t3 = xe2.current ?? r_(a_(D2.current().searchParams)), n3 = t3 && e6(t3);
|
|
6535
|
+
return n3 ? (xe2.current = n3, be2(n3), true) : false;
|
|
6536
|
+
}, []), bt2 = (0, import_react.useCallback)((e6, t3) => yt2((n3) => B_(n3, e6, t3, Py())), [yt2]), xt2 = (0, import_react.useCallback)(() => {
|
|
6537
|
+
yt2(H_);
|
|
6538
|
+
}, [yt2]), St2 = Xe2.serviceCtaState, Ct2 = (0, import_react.useMemo)(() => _2 ? (ye2 ?? r_(We2))?.services ?? nC : nC, [_2, ye2, We2]), wt2 = (0, import_react.useMemo)(() => _2 ? GS(ye2 ?? r_(We2), w2()) : null, [_2, ye2, We2, w2]), Tt2 = Es(`serviceCtaFormHrefCarriesSelection`), Et2 = (0, import_react.useCallback)((e6) => {
|
|
6539
|
+
if (_2) return wt2 ? C2(wt2) : null;
|
|
6540
|
+
let t3 = W_({ actionState: St2, serviceType: p2?.type ?? null, config: e6 ?? U_ });
|
|
6541
|
+
if (G_(t3, p2?.type ?? null, me2)) return null;
|
|
6561
6542
|
let n3 = S2(t3, { slug: p2?.mainSlug?.name ?? null, serviceId: p2?._id ?? null });
|
|
6562
|
-
return n3 ? C2(
|
|
6563
|
-
}, [_2,
|
|
6564
|
-
|
|
6543
|
+
return n3 ? C2(Tt2 && t3 === `bookingForm` ? rt2(n3, { handoff: true }) : n3) : null;
|
|
6544
|
+
}, [_2, wt2, St2, p2, me2, S2, C2, Tt2, rt2]), Dt2 = Bb(), [Ot2, kt2] = (0, import_react.useState)(false), At2 = (0, import_react.useRef)(false), jt2 = (0, import_react.useCallback)(() => {
|
|
6545
|
+
At2.current = false, kt2(false);
|
|
6565
6546
|
}, []);
|
|
6566
|
-
Ex(
|
|
6567
|
-
let
|
|
6568
|
-
|
|
6547
|
+
Ex(jt2);
|
|
6548
|
+
let Mt2 = (0, import_react.useCallback)((e6) => {
|
|
6549
|
+
At2.current = true, kt2(true);
|
|
6569
6550
|
let t3 = D2.current(), n3 = new URL(C2(e6), t3).pathname === t3.pathname;
|
|
6570
6551
|
ee2(e6).then(() => {
|
|
6571
|
-
(n3 || D2.current().href !== t3.href) &&
|
|
6552
|
+
(n3 || D2.current().href !== t3.href) && jt2();
|
|
6572
6553
|
}, (e7) => {
|
|
6573
|
-
$o(e7, { feature: Zo.serviceCta, action: `navigateToNextPage` }),
|
|
6554
|
+
$o(e7, { feature: Zo.serviceCta, action: `navigateToNextPage` }), jt2();
|
|
6574
6555
|
});
|
|
6575
|
-
}, [ee2,
|
|
6576
|
-
if (
|
|
6577
|
-
let t3 =
|
|
6556
|
+
}, [ee2, jt2, C2]), Nt2 = (0, import_react.useCallback)(() => Dt2.open(Ib(Ub({ service: p2, pricingOption: ft2 ?? void 0, selection: WS(M2 ?? ``, D2.current().searchParams), multiServiceAppointmentsEnabled: Pe2 }))), [Dt2, p2, ft2, M2, Pe2]), Pt2 = (0, import_react.useCallback)((e6) => {
|
|
6557
|
+
if (At2.current) return;
|
|
6558
|
+
let t3 = xe2.current ?? r_(a_(D2.current().searchParams)), n3 = GS(t3, w2());
|
|
6578
6559
|
if (n3) {
|
|
6579
6560
|
for (let n4 of t3?.services ?? []) e6(rb({ serviceId: n4.serviceId, serviceType: n4.serviceType ?? v2.find(({ _id: e7 }) => e7 === n4.serviceId)?.type ?? void 0, start: n4.slotStart, end: n4.slotEnd, timeZone: t3?.timezone ?? void 0, isEligibleForFlowCompletion: true }));
|
|
6580
|
-
|
|
6561
|
+
Mt2(n3);
|
|
6581
6562
|
}
|
|
6582
|
-
}, [w2, v2,
|
|
6583
|
-
if (
|
|
6563
|
+
}, [w2, v2, Mt2]), Ft2 = (0, import_react.useCallback)((e6, t3 = Uy.WIDGET_BUTTON) => {
|
|
6564
|
+
if (At2.current || a2) return;
|
|
6584
6565
|
if (_2) {
|
|
6585
|
-
|
|
6566
|
+
Pt2(E2);
|
|
6586
6567
|
return;
|
|
6587
6568
|
}
|
|
6588
|
-
let n3 = W_({ actionState:
|
|
6589
|
-
if (G_(n3, p2?.type ?? null, j2.current)) return;
|
|
6569
|
+
let n3 = W_({ actionState: St2, serviceType: p2?.type ?? null, config: e6 ?? U_ });
|
|
6570
|
+
if (G_(n3, p2?.type ?? null, j2.current.selection)) return;
|
|
6590
6571
|
let r2 = n3 === `bookingForm` && !Um(p2?.type ?? null);
|
|
6591
|
-
if (r2 && !
|
|
6572
|
+
if (r2 && !j2.current.pick.bookable) return;
|
|
6592
6573
|
let i2 = S2(n3, { slug: p2?.mainSlug?.name ?? null, serviceId: p2?._id ?? null });
|
|
6593
|
-
if (n3 !== `servicePage` && !r2 && E2(Ry({ bookingsServiceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, isEligibleForFlowCompletion: !!i2 })), r2 && E2(rb({ serviceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, start: j2.current.slotStart, end: j2.current.slotEnd, timeZone:
|
|
6574
|
+
if (n3 !== `servicePage` && !r2 && E2(Ry({ bookingsServiceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, isEligibleForFlowCompletion: !!i2 })), r2 && E2(rb({ serviceId: p2?._id ?? void 0, serviceType: p2?.type ?? void 0, start: j2.current.selection.slotStart, end: j2.current.selection.slotEnd, timeZone: j2.current.pick.timezone ?? r_(We2)?.timezone ?? je2, isEligibleForFlowCompletion: !!i2 })), E2(Iy({ service_id: p2?._id ?? void 0, destination: Wy[n3] })), !i2) return;
|
|
6594
6575
|
E2(Qy({ service_id: p2?._id ?? void 0, type: p2?.type ?? void 0, isPendingApproval: p2 ? Gm(p2) : void 0, referralInfo: t3, actionName: Gy[n3] }));
|
|
6595
6576
|
let o3 = n3 === `bookingForm`;
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
Vt2.current = Bt2;
|
|
6603
|
-
let Ht2 = (0, import_react.useCallback)(async () => {
|
|
6604
|
-
let e6 = Oe2?.status === `ready` ? Oe2.booking : null;
|
|
6605
|
-
if (!Oe2 || !a2 || !e6 || !SS(j2.current, Vt2.current())) return { outcome: `failed` };
|
|
6577
|
+
!o3 && !g_(j2.current.selection) ? Mt2(y_(i2, D2.current())) : Mt2(rt2(i2, { handoff: o3 }));
|
|
6578
|
+
}, [a2, _2, Pt2, We2, St2, p2, je2, S2, Mt2, rt2, E2]), It2 = ({ bookable: e6, staffChoiceRequired: t3, timezone: n3 }) => ({ bookable: e6, staffChoiceRequired: t3, timezone: n3 ?? je2 ?? `UTC`, validUntil: we2?.validUntil ?? null }), Lt2 = (0, import_react.useRef)(It2);
|
|
6579
|
+
Lt2.current = It2;
|
|
6580
|
+
let Rt2 = (0, import_react.useCallback)(async () => {
|
|
6581
|
+
let e6 = we2?.status === `ready` ? we2.booking : null;
|
|
6582
|
+
if (!we2 || !a2 || !e6 || !kS(j2.current.selection, Lt2.current(j2.current.pick))) return { outcome: `failed` };
|
|
6606
6583
|
E2(eb({ component: qy.RESCHEDULE_DIALOG, element: Jy.CONFIRM_BUTTON })), E2(By({ action: Ky, pageName: Jy.CONFIRM_BUTTON, referralInfo: D2.current().searchParams.get(i_.referral) ?? void 0 }));
|
|
6607
|
-
let t3 = b_(j2.current,
|
|
6584
|
+
let t3 = b_(j2.current.selection, tt2.current), n3;
|
|
6608
6585
|
try {
|
|
6609
|
-
n3 = await
|
|
6586
|
+
n3 = await yS({ booking: e6, slot: uS(t3, j2.current.pick.timezone ?? null, e6, j2.current.pick.rescheduleStaffId), token: a2.token });
|
|
6610
6587
|
} catch (e7) {
|
|
6611
6588
|
return $o(e7, { feature: Zo.reschedule, action: `reschedule-booking` }), { outcome: `failed` };
|
|
6612
6589
|
}
|
|
6613
6590
|
E2($y({ bookingId: e6.bookingId }));
|
|
6614
6591
|
let r2 = { outcome: `succeeded`, ...n3 };
|
|
6615
6592
|
if (a2.fromManageBookingPage) return r2;
|
|
6616
|
-
let i2 =
|
|
6593
|
+
let i2 = OS(a2.redirectUrl), o3 = i2 ? null : T2();
|
|
6617
6594
|
if (!i2 && !o3) return r2;
|
|
6618
6595
|
try {
|
|
6619
6596
|
return i2 ? await te2({ href: i2 }) : o3 && await ee2(o3), { outcome: `navigated` };
|
|
6620
6597
|
} catch (e7) {
|
|
6621
6598
|
return $o(e7, { feature: Zo.reschedule, action: `return-after-reschedule` }), r2;
|
|
6622
6599
|
}
|
|
6623
|
-
}, [
|
|
6600
|
+
}, [we2, a2, T2, ee2, te2, E2]), zt2 = kS(me2, It2(fe2.pick)), Bt2 = fe2.pick.timezone ?? je2, Vt2 = !fe2.pick.bookable, Ht2 = (0, import_react.useCallback)(() => {
|
|
6624
6601
|
E2(By({ component: Jy.GO_TO_HOMEPAGE_BUTTON, action: Ky, pageName: Yy })), ee2(`/`).catch((e6) => $o(e6, { feature: Zo.reschedule, action: `go-home` }));
|
|
6625
|
-
}, [ee2, E2]), { serviceBookability:
|
|
6626
|
-
return (0, import_jsx_runtime.jsx)(
|
|
6602
|
+
}, [ee2, E2]), { serviceBookability: Ut2, policyDescription: Wt2, coverImage: Gt2 } = Xe2, Kt2 = (0, import_react.useCallback)(() => Ut2.isAvailableForBooking, [Ut2]), qt2 = (0, import_react.useCallback)(() => !!Wt2, [Wt2]), Jt2 = (0, import_react.useCallback)(() => !!Gt2, [Gt2]), Yt2 = (0, import_react.useCallback)(() => iv(p2), [p2]), Xt2 = (0, import_react.useCallback)(() => !!p2 && Pb(p2), [p2]), Zt2 = (0, import_react.useMemo)(() => ({ ...Xe2, service: p2, servicePageLink: De2, serviceOptionsAndVariants: Ue2, pricingOption: ft2, isLoadingServiceOptionsAndVariants: He2, isAvailableForBooking: Kt2, hasPolicyDescription: qt2, hasCoverImage: Jt2, hasGalleryImages: Yt2, isVariantDuration: Xt2, isLoading: g2, hasError: m2, locale: y2, selectStaffMember: st2, clearSelection: lt2, clearStaffMember: ct2, selection: me2, isSelectionPending: ge2 || me2.serviceId !== (M2 ?? ``), selectionTimezone: Bt2, setVariant: ut2, setVariantCounts: mt2, maxParticipantsPerBooking: dt2.max, toggleAddOn: ht2, setAddOnQuantity: gt2, setSlot: _t2, clearSlot: vt2, setMultiServiceSlot: bt2, clearMultiServiceSlot: xt2, draftRevision: Se2, wantsPromoCode: it2, setWantsPromoCode: R2, withSelectionParam: rt2, navigateToNextPage: Ft2, navigateToMultiServiceForm: Pt2, resolveNextPageHref: Et2, isNavigating: Ot2, isWaitlistSlotSelected: Vt2, siteId: ve2, editingSurface: o2, openPreferences: Nt2, multiServiceAppointmentsEnabled: Pe2, isMultiServiceAppointment: _2, multiServiceAppointmentServices: v2, multiServiceAppointmentSelections: Ct2, multiServiceAppointmentOptionsAndVariants: Je2, multiServiceAppointmentVariantsStatus: Ye2, bookingsSettingsLoading: Ne2, reschedule: we2, rescheduleBooking: Rt2, goHomeAfterReschedule: Ht2, canRescheduleToPick: zt2 }), [Xe2, p2, De2, Ue2, ft2, He2, Kt2, qt2, Jt2, Yt2, Xt2, g2, m2, y2, st2, lt2, ct2, me2, ge2, M2, Bt2, ut2, mt2, dt2.max, ht2, gt2, _t2, vt2, bt2, xt2, Se2, it2, R2, rt2, Ft2, Pt2, Et2, Ot2, Vt2, ve2, o2, Nt2, Pe2, _2, v2, Ct2, Je2, Ye2, Ne2, we2, Rt2, Ht2, zt2]);
|
|
6603
|
+
return (0, import_jsx_runtime.jsx)(IS.Provider, { value: Zt2, children: c2 });
|
|
6627
6604
|
}
|
|
6628
|
-
function
|
|
6629
|
-
let r2 =
|
|
6605
|
+
function lC(e5, t2, n2) {
|
|
6606
|
+
let r2 = zS(e5, Px(t2), n2);
|
|
6630
6607
|
return { target: r2, key: JSON.stringify(r2), awaitsPreferences: t2 === Ax && !e5 };
|
|
6631
6608
|
}
|
|
6632
|
-
function
|
|
6633
|
-
return e5.by === `none` ? ks(t2 ?
|
|
6609
|
+
function uC({ target: e5, awaitsPreferences: t2 }, { refreshSignal: n2, warmupData: r2, language: i2, currency: a2 }) {
|
|
6610
|
+
return e5.by === `none` ? ks(t2 ? QS : ZS) : e5.by === `multi` ? js(Tx({ key: dx(i2, a2, e5.serviceIds), refresh: n2 !== 0, warmupData: r2, fetchData: () => es(`service-context-load-multi-service`, { feature: Zo.service }, Zm(e5.serviceIds)) }), $S, eC) : js(Tx({ key: ux(i2, a2, e5.by, e5.value), refresh: n2 !== 0, warmupData: r2, fetchData: () => es(`service-context-load`, { feature: Zo.service }, e5.by === `slug` ? Ym(e5.value) : Xm(e5.value)) }), YS, XS);
|
|
6634
6611
|
}
|
|
6635
|
-
function
|
|
6612
|
+
function dC({ routerSlug: e5, initialServiceId: t2, refreshSignal: n2, editingSurface: r2, children: i2 }) {
|
|
6636
6613
|
Zy(Vy.SERVICE);
|
|
6637
|
-
let a2 = sx(), o2 = Xb(), { getParsedUrl: s2 } = ps(), c2 = Ss(), u2 = Es(`servicePageSeoTags`) && !r2 && (c2 === `servicePage` || c2 === `calendarPage`) ? c2 : null, [f2] = (0, import_react.useState)(() => r2 ? null :
|
|
6638
|
-
let n3 =
|
|
6639
|
-
return { ...n3, currency: g2, promise:
|
|
6614
|
+
let a2 = sx(), o2 = Xb(), { getParsedUrl: s2 } = ps(), c2 = Ss(), u2 = Es(`servicePageSeoTags`) && !r2 && (c2 === `servicePage` || c2 === `calendarPage`) ? c2 : null, [f2] = (0, import_react.useState)(() => r2 ? null : lS(s2().searchParams)), p2 = Nx(), m2 = f2 ? `none` : p2, g2 = rx(), _2 = { refreshSignal: n2, warmupData: a2, language: o2, currency: g2 }, [v2, y2] = (0, import_react.useState)(() => {
|
|
6615
|
+
let n3 = lC(e5, m2, t2);
|
|
6616
|
+
return { ...n3, currency: g2, promise: uC(n3, _2) };
|
|
6640
6617
|
});
|
|
6641
6618
|
if (v2.awaitsPreferences && m2 !== Ax) {
|
|
6642
|
-
let n3 =
|
|
6643
|
-
y2({ ...n3, currency: g2, promise: r3 ? v2.promise :
|
|
6644
|
-
} else v2.currency !== g2 && y2({ ...v2, currency: g2, promise:
|
|
6619
|
+
let n3 = lC(e5, m2, t2), r3 = n3.key === v2.key && n3.target.by !== `none` && v2.currency === g2;
|
|
6620
|
+
y2({ ...n3, currency: g2, promise: r3 ? v2.promise : uC(n3, _2) });
|
|
6621
|
+
} else v2.currency !== g2 && y2({ ...v2, currency: g2, promise: uC(v2, _2) });
|
|
6645
6622
|
let b2 = v2.promise;
|
|
6646
|
-
return (0, import_react.useMemo)(() => (0, import_jsx_runtime.jsx)(
|
|
6623
|
+
return (0, import_react.useMemo)(() => (0, import_jsx_runtime.jsx)(iC, { servicePromise: b2, refreshSignal: n2, rescheduleRequest: f2, editingSurface: r2, seoPage: u2, children: i2 }), [b2, n2, f2, r2, u2, i2]);
|
|
6647
6624
|
}
|
|
6648
|
-
function
|
|
6649
|
-
let { pathname: a2 } = ps(), o2 = xs(), s2 = Xb(), c2 = t2?.serviceId?.$eq, u2 = e5?.service ?? null, d2 = (0, import_react.useMemo)(() => u2 ? { service: u2, masterEvents: e5?.masterEvents ??
|
|
6650
|
-
return d2 ? (0, import_jsx_runtime.jsx)(
|
|
6625
|
+
function fC({ serviceData: e5, servicePicker: t2, refreshSignal: n2 = 0, editingSurface: r2 = false, children: i2 }) {
|
|
6626
|
+
let { pathname: a2 } = ps(), o2 = xs(), s2 = Xb(), c2 = t2?.serviceId?.$eq, u2 = e5?.service ?? null, d2 = (0, import_react.useMemo)(() => u2 ? { service: u2, masterEvents: e5?.masterEvents ?? KS, serviceOptionsAndVariants: e5?.serviceOptionsAndVariants ?? null, bookingsSettings: e5?.bookingsSettings } : null, [u2, e5?.masterEvents, e5?.serviceOptionsAndVariants, e5?.bookingsSettings]);
|
|
6627
|
+
return d2 ? (0, import_jsx_runtime.jsx)(iC, { injected: d2, bookingsSettings: d2.bookingsSettings, editingSurface: r2, children: i2 }, `injected:${n2}`) : e5 ? (0, import_jsx_runtime.jsx)(iC, { bookingsSettings: e5.bookingsSettings, editingSurface: r2, children: i2 }) : (0, import_jsx_runtime.jsx)(dC, { routerSlug: o2, initialServiceId: c2, refreshSignal: n2, editingSurface: r2, children: i2 }, `fetch:${a2}:${o2 ?? ``}:${c2 ?? ``}:${n2}:${r2}:${s2}`);
|
|
6651
6628
|
}
|
|
6652
|
-
function
|
|
6629
|
+
function pC(e5) {
|
|
6653
6630
|
let t2 = new URL(e5);
|
|
6654
6631
|
return t2.searchParams.delete(i_.blob), t2.searchParams.delete(i_.legacyBlob), t2;
|
|
6655
6632
|
}
|
|
6656
|
-
var
|
|
6633
|
+
var mC = ya(`426941a1-1d08-4cf4-ae61-e433e800cde5`);
|
|
6657
6634
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6658
6635
|
0 && (module.exports = {
|
|
6659
6636
|
SERVICE_CONTEXT_MISSING_PROVIDER_ERROR,
|