@wix/bookings 1.0.1781 → 1.0.1782
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-service-addons.d.ts +54 -3
- package/build/cjs/context-service-addons.js +1065 -578
- package/build/cjs/context-service-addons.js.map +1 -1
- package/build/cjs/context-service.d.ts +17 -0
- package/build/cjs/context-service.js +975 -963
- package/build/cjs/context-service.js.map +1 -1
- package/build/cjs/context-time-slots.d.ts +20 -91
- package/build/cjs/context-time-slots.js +456 -475
- package/build/cjs/context-time-slots.js.map +1 -1
- package/build/es/context-service-addons.d.mts +54 -3
- package/build/es/context-service-addons.mjs +1061 -574
- package/build/es/context-service-addons.mjs.map +1 -1
- package/build/es/context-service.d.mts +17 -0
- package/build/es/context-service.mjs +975 -963
- package/build/es/context-service.mjs.map +1 -1
- package/build/es/context-time-slots.d.mts +20 -91
- package/build/es/context-time-slots.mjs +456 -475
- package/build/es/context-time-slots.mjs.map +1 -1
- package/build/internal/cjs/context-service-addons.d.ts +54 -3
- package/build/internal/cjs/context-service.d.ts +17 -0
- package/build/internal/cjs/context-time-slots.d.ts +20 -91
- package/build/internal/es/context-service-addons.d.mts +54 -3
- package/build/internal/es/context-service.d.mts +17 -0
- package/build/internal/es/context-time-slots.d.mts +20 -91
- package/context-runtime/context-service/runtime.d.ts +17 -0
- package/context-runtime/context-service/runtime.js +3 -3
- package/context-runtime/context-service-addons/runtime.d.ts +54 -3
- package/context-runtime/context-service-addons/runtime.js +2 -2
- package/context-runtime/context-time-slots/runtime.d.ts +20 -91
- package/context-runtime/context-time-slots/runtime.js +3 -3
- package/package.json +2 -2
|
@@ -20,11 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// context-time-slots.ts
|
|
21
21
|
var context_time_slots_exports = {};
|
|
22
22
|
__export(context_time_slots_exports, {
|
|
23
|
-
TimeSlotsContextProvider: () =>
|
|
24
|
-
default: () =>
|
|
25
|
-
injectAccessTokenGetter: () =>
|
|
26
|
-
timeSlotsContext: () =>
|
|
27
|
-
useTimeSlotsContext: () =>
|
|
23
|
+
TimeSlotsContextProvider: () => ql,
|
|
24
|
+
default: () => ql,
|
|
25
|
+
injectAccessTokenGetter: () => Zl,
|
|
26
|
+
timeSlotsContext: () => Hl,
|
|
27
|
+
useTimeSlotsContext: () => Ul
|
|
28
28
|
});
|
|
29
29
|
module.exports = __toCommonJS(context_time_slots_exports);
|
|
30
30
|
|
|
@@ -104,12 +104,12 @@ function ee(e2, t2) {
|
|
|
104
104
|
}
|
|
105
105
|
var E = `x-wix-bi-gateway`;
|
|
106
106
|
function D(e2, t2, n2) {
|
|
107
|
-
return { [E]:
|
|
107
|
+
return { [E]: te({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function te(e2) {
|
|
110
110
|
return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function ne(e2) {
|
|
113
113
|
let t2 = globalThis.__wix_context__, n2 = { client: m.client, elevatedClient: m.elevatedClient }, r2;
|
|
114
114
|
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);
|
|
115
115
|
try {
|
|
@@ -118,32 +118,32 @@ function te(e2) {
|
|
|
118
118
|
globalThis.__wix_context__ = t2, m.client = n2.client, m.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
var
|
|
122
|
-
function
|
|
123
|
-
return
|
|
121
|
+
var O = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
122
|
+
function k(e2) {
|
|
123
|
+
return j(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
124
124
|
}
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
function
|
|
125
|
+
var re = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
126
|
+
var ie = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
127
|
+
var A = `$1\0$2`;
|
|
128
|
+
var ae = /[^\p{L}\d]+/giu;
|
|
129
|
+
function j(e2) {
|
|
130
130
|
let t2 = e2.trim();
|
|
131
|
-
t2 = t2.replace(
|
|
131
|
+
t2 = t2.replace(re, A).replace(ie, A), t2 = t2.replace(ae, `\0`);
|
|
132
132
|
let n2 = 0, r2 = t2.length;
|
|
133
133
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
134
134
|
if (n2 === r2) return [];
|
|
135
135
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
136
136
|
return t2.slice(n2, r2).split(/\0/g);
|
|
137
137
|
}
|
|
138
|
-
var
|
|
139
|
-
var
|
|
138
|
+
var oe = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
139
|
+
var M = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
140
140
|
var se = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
141
141
|
function N(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
142
142
|
if (typeof e2 != `object` || !e2) throw e2;
|
|
143
|
-
if (
|
|
144
|
-
if (
|
|
143
|
+
if (oe(e2)) return ce(e2, t2, n2);
|
|
144
|
+
if (M(e2)) return ue(e2);
|
|
145
145
|
if (se(e2)) {
|
|
146
|
-
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code:
|
|
146
|
+
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: k(n3), data: {} }, requestId: e2.requestId };
|
|
147
147
|
return le(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
148
148
|
}
|
|
149
149
|
return de(e2);
|
|
@@ -154,10 +154,10 @@ var ce = (e2, t2, n2) => {
|
|
|
154
154
|
};
|
|
155
155
|
var le = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
156
156
|
var ue = (e2) => {
|
|
157
|
-
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 ??
|
|
157
|
+
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 ?? k(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 };
|
|
158
158
|
return le(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
159
159
|
};
|
|
160
|
-
var de = (e2) => le(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:
|
|
160
|
+
var de = (e2) => le(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: k(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
|
|
161
161
|
var fe = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
162
162
|
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
163
163
|
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
@@ -180,7 +180,7 @@ var P = (e2) => {
|
|
|
180
180
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
181
181
|
};
|
|
182
182
|
function me(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
183
|
-
return
|
|
183
|
+
return ne(() => e2({ request: async (e3) => {
|
|
184
184
|
let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
185
185
|
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
186
186
|
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? b : o3}${a3.url}`;
|
|
@@ -283,7 +283,7 @@ var Se = class {
|
|
|
283
283
|
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
284
284
|
r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
|
|
285
285
|
}, a2 = (e3, t3) => {
|
|
286
|
-
let i3 = e3 in
|
|
286
|
+
let i3 = e3 in O ? O[e3] : void 0;
|
|
287
287
|
if (i3 && i3 in t3) {
|
|
288
288
|
r2.push(i3), n2 = t3[i3];
|
|
289
289
|
return;
|
|
@@ -485,7 +485,7 @@ function Pe(e2) {
|
|
|
485
485
|
if (typeof t3 == `function`) {
|
|
486
486
|
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
487
487
|
let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
|
|
488
|
-
return me(
|
|
488
|
+
return me(ne(() => v(t3)) ? _(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
|
|
489
489
|
let n4 = new URL(e3, `https://${r3}`);
|
|
490
490
|
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
491
491
|
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
|
|
@@ -854,24 +854,24 @@ function rn() {
|
|
|
854
854
|
let t2 = new URL(e2);
|
|
855
855
|
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
856
856
|
}
|
|
857
|
-
var
|
|
857
|
+
var U = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
858
858
|
if (!e2) throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);
|
|
859
859
|
return e2.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
860
860
|
}, getAccessToken: () => {
|
|
861
861
|
throw Error(`Not implemented`);
|
|
862
862
|
}, observeState: () => ({ disconnect: () => {
|
|
863
863
|
} }) });
|
|
864
|
-
var
|
|
864
|
+
var an = tn({ createHost: function(e2) {
|
|
865
865
|
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e2?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e2 || {};
|
|
866
866
|
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
867
|
-
return { channel:
|
|
867
|
+
return { channel: U({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
868
868
|
} };
|
|
869
869
|
} });
|
|
870
|
-
var
|
|
871
|
-
let n2 =
|
|
870
|
+
var on = (e2, t2) => {
|
|
871
|
+
let n2 = an.host({ applicationId: e2, componentId: t2 }), r2 = an.auth();
|
|
872
872
|
return Pe({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
873
873
|
};
|
|
874
|
-
var sn = (e2) =>
|
|
874
|
+
var sn = (e2) => on(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`, e2);
|
|
875
875
|
var cn = [`ANY_FEMALE`, `ANY_MALE`];
|
|
876
876
|
var ln = `3.7.8`;
|
|
877
877
|
var un = ln;
|
|
@@ -917,7 +917,7 @@ var Dn = dn ? (e2) => Buffer.from(e2, `utf8`).toString(`base64`) : pn ? (e2) =>
|
|
|
917
917
|
var On = (e2, t2 = false) => t2 ? vn(Dn(e2)) : Dn(e2);
|
|
918
918
|
var kn = (e2) => On(e2, true);
|
|
919
919
|
var An = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
|
|
920
|
-
var
|
|
920
|
+
var G = (e2) => {
|
|
921
921
|
switch (e2.length) {
|
|
922
922
|
case 4:
|
|
923
923
|
var t2 = ((7 & e2.charCodeAt(0)) << 18 | (63 & e2.charCodeAt(1)) << 12 | (63 & e2.charCodeAt(2)) << 6 | 63 & e2.charCodeAt(3)) - 65536;
|
|
@@ -928,18 +928,18 @@ var jn = (e2) => {
|
|
|
928
928
|
return W((31 & e2.charCodeAt(0)) << 6 | 63 & e2.charCodeAt(1));
|
|
929
929
|
}
|
|
930
930
|
};
|
|
931
|
-
var
|
|
932
|
-
var
|
|
931
|
+
var jn = (e2) => e2.replace(An, G);
|
|
932
|
+
var Mn = (e2) => {
|
|
933
933
|
if (e2 = e2.replace(/\s+/g, ``), !gn.test(e2)) throw TypeError(`malformed base64.`);
|
|
934
934
|
e2 += `==`.slice(2 - (e2.length & 3));
|
|
935
935
|
let t2, n2, r2, i2 = [];
|
|
936
936
|
for (let a2 = 0; a2 < e2.length; ) t2 = hn[e2.charAt(a2++)] << 18 | hn[e2.charAt(a2++)] << 12 | (n2 = hn[e2.charAt(a2++)]) << 6 | (r2 = hn[e2.charAt(a2++)]), n2 === 64 ? i2.push(W(t2 >> 16 & 255)) : r2 === 64 ? i2.push(W(t2 >> 16 & 255, t2 >> 8 & 255)) : i2.push(W(t2 >> 16 & 255, t2 >> 8 & 255, t2 & 255));
|
|
937
937
|
return i2.join(``);
|
|
938
938
|
};
|
|
939
|
-
var Nn = typeof atob == `function` ? (e2) => atob(yn(e2)) : dn ? (e2) => Buffer.from(e2, `base64`).toString(`binary`) :
|
|
939
|
+
var Nn = typeof atob == `function` ? (e2) => atob(yn(e2)) : dn ? (e2) => Buffer.from(e2, `base64`).toString(`binary`) : Mn;
|
|
940
940
|
var Pn = dn ? (e2) => _n(Buffer.from(e2, `base64`)) : (e2) => _n(Nn(e2).split(``).map((e3) => e3.charCodeAt(0)));
|
|
941
941
|
var Fn = (e2) => Pn(Ln(e2));
|
|
942
|
-
var In = dn ? (e2) => Buffer.from(e2, `base64`).toString(`utf8`) : fn ? (e2) => fn.decode(Pn(e2)) : (e2) =>
|
|
942
|
+
var In = dn ? (e2) => Buffer.from(e2, `base64`).toString(`utf8`) : fn ? (e2) => fn.decode(Pn(e2)) : (e2) => jn(Nn(e2));
|
|
943
943
|
var Ln = (e2) => yn(e2.replace(/[-_]/g, (e3) => e3 == `-` ? `+` : `/`));
|
|
944
944
|
var Rn = (e2) => In(Ln(e2));
|
|
945
945
|
var zn = (e2) => {
|
|
@@ -972,7 +972,7 @@ var Hn = function() {
|
|
|
972
972
|
return Cn(this, true);
|
|
973
973
|
});
|
|
974
974
|
};
|
|
975
|
-
var Un = { version: ln, VERSION: un, atob: Nn, atobPolyfill:
|
|
975
|
+
var Un = { version: ln, VERSION: un, atob: Nn, atobPolyfill: Mn, btoa: xn, btoaPolyfill: bn, fromBase64: Rn, toBase64: On, encode: On, encodeURI: kn, encodeURL: kn, utob: En, btou: jn, decode: Rn, isValid: zn, fromUint8Array: Cn, toUint8Array: Fn, extendString: Vn, extendUint8Array: Hn, extendBuiltins: () => {
|
|
976
976
|
Vn(), Hn();
|
|
977
977
|
} };
|
|
978
978
|
var K = Uint8Array;
|
|
@@ -1081,18 +1081,18 @@ var hr = function(e2, t2, n2, r2) {
|
|
|
1081
1081
|
d2 += 14;
|
|
1082
1082
|
for (var T2 = new K(w2), ee2 = new K(19), E2 = 0; E2 < C2; ++E2) ee2[Jn[E2]] = lr(e2, d2 + E2 * 3, 7);
|
|
1083
1083
|
d2 += C2 * 3;
|
|
1084
|
-
for (var D2 = cr(ee2),
|
|
1085
|
-
var
|
|
1086
|
-
d2 +=
|
|
1087
|
-
var y2 =
|
|
1084
|
+
for (var D2 = cr(ee2), te2 = (1 << D2) - 1, ne2 = rr(ee2, D2, 1), E2 = 0; E2 < w2; ) {
|
|
1085
|
+
var O2 = ne2[lr(e2, d2, te2)];
|
|
1086
|
+
d2 += O2 & 15;
|
|
1087
|
+
var y2 = O2 >> 4;
|
|
1088
1088
|
if (y2 < 16) T2[E2++] = y2;
|
|
1089
1089
|
else {
|
|
1090
|
-
var
|
|
1091
|
-
for (y2 == 16 ? (
|
|
1090
|
+
var k2 = 0, re2 = 0;
|
|
1091
|
+
for (y2 == 16 ? (re2 = 3 + lr(e2, d2, 3), d2 += 2, k2 = T2[E2 - 1]) : y2 == 17 ? (re2 = 3 + lr(e2, d2, 7), d2 += 3) : y2 == 18 && (re2 = 11 + lr(e2, d2, 127), d2 += 7); re2--; ) T2[E2++] = k2;
|
|
1092
1092
|
}
|
|
1093
1093
|
}
|
|
1094
|
-
var
|
|
1095
|
-
h2 = cr(
|
|
1094
|
+
var ie2 = T2.subarray(0, S2), A2 = T2.subarray(S2);
|
|
1095
|
+
h2 = cr(ie2), g2 = cr(A2), p2 = rr(ie2, h2, 1), m2 = rr(A2, g2, 1);
|
|
1096
1096
|
} else mr(1);
|
|
1097
1097
|
if (d2 > _2) {
|
|
1098
1098
|
c2 && mr(0);
|
|
@@ -1100,28 +1100,28 @@ var hr = function(e2, t2, n2, r2) {
|
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
1102
|
s2 && l2(f2 + 131072);
|
|
1103
|
-
for (var
|
|
1104
|
-
var
|
|
1105
|
-
if (d2 +=
|
|
1103
|
+
for (var ae2 = (1 << h2) - 1, j2 = (1 << g2) - 1, oe2 = d2; ; oe2 = d2) {
|
|
1104
|
+
var k2 = p2[ur(e2, d2) & ae2], M2 = k2 >> 4;
|
|
1105
|
+
if (d2 += k2 & 15, d2 > _2) {
|
|
1106
1106
|
c2 && mr(0);
|
|
1107
1107
|
break;
|
|
1108
1108
|
}
|
|
1109
|
-
if (
|
|
1110
|
-
else if (
|
|
1111
|
-
|
|
1109
|
+
if (k2 || mr(2), M2 < 256) n2[f2++] = M2;
|
|
1110
|
+
else if (M2 == 256) {
|
|
1111
|
+
oe2 = d2, p2 = null;
|
|
1112
1112
|
break;
|
|
1113
1113
|
} else {
|
|
1114
|
-
var se2 =
|
|
1115
|
-
if (
|
|
1116
|
-
var E2 =
|
|
1114
|
+
var se2 = M2 - 254;
|
|
1115
|
+
if (M2 > 264) {
|
|
1116
|
+
var E2 = M2 - 257, N2 = Kn[E2];
|
|
1117
1117
|
se2 = lr(e2, d2, (1 << N2) - 1) + Zn[E2], d2 += N2;
|
|
1118
1118
|
}
|
|
1119
|
-
var ce2 = m2[ur(e2, d2) &
|
|
1119
|
+
var ce2 = m2[ur(e2, d2) & j2], le2 = ce2 >> 4;
|
|
1120
1120
|
ce2 || mr(3), d2 += ce2 & 15;
|
|
1121
|
-
var
|
|
1121
|
+
var A2 = er[le2];
|
|
1122
1122
|
if (le2 > 3) {
|
|
1123
1123
|
var N2 = qn[le2];
|
|
1124
|
-
|
|
1124
|
+
A2 += ur(e2, d2) & (1 << N2) - 1, d2 += N2;
|
|
1125
1125
|
}
|
|
1126
1126
|
if (d2 > _2) {
|
|
1127
1127
|
c2 && mr(0);
|
|
@@ -1129,14 +1129,14 @@ var hr = function(e2, t2, n2, r2) {
|
|
|
1129
1129
|
}
|
|
1130
1130
|
s2 && l2(f2 + 131072);
|
|
1131
1131
|
var ue2 = f2 + se2;
|
|
1132
|
-
if (f2 <
|
|
1133
|
-
var de2 = a2 -
|
|
1132
|
+
if (f2 < A2) {
|
|
1133
|
+
var de2 = a2 - A2, fe2 = Math.min(A2, ue2);
|
|
1134
1134
|
for (de2 + f2 < 0 && mr(3); f2 < fe2; ++f2) n2[f2] = r2[de2 + f2];
|
|
1135
1135
|
}
|
|
1136
|
-
for (; f2 < ue2; ++f2) n2[f2] = n2[f2 -
|
|
1136
|
+
for (; f2 < ue2; ++f2) n2[f2] = n2[f2 - A2];
|
|
1137
1137
|
}
|
|
1138
1138
|
}
|
|
1139
|
-
t2.l = p2, t2.p =
|
|
1139
|
+
t2.l = p2, t2.p = oe2, t2.b = f2, t2.f = u2, p2 && (u2 = 1, t2.m = h2, t2.d = m2, t2.n = g2);
|
|
1140
1140
|
} while (!u2);
|
|
1141
1141
|
return f2 != n2.length && o2 ? fr(n2, 0, f2) : n2.subarray(0, f2);
|
|
1142
1142
|
};
|
|
@@ -1915,54 +1915,42 @@ function Vo(e2) {
|
|
|
1915
1915
|
let t2 = ko(e2), n2 = new Date(t2.getFullYear(), t2.getMonth(), 1), r2 = new Date(t2.getFullYear(), t2.getMonth() + 1, 0);
|
|
1916
1916
|
return { startDate: Oo(n2), endDate: Oo(r2) };
|
|
1917
1917
|
}
|
|
1918
|
-
function Ho(e2) {
|
|
1919
|
-
let t2 = Vo(e2.startDate);
|
|
1920
|
-
return t2.startDate === e2.startDate && t2.endDate === e2.endDate;
|
|
1921
|
-
}
|
|
1922
|
-
function Uo(e2, t2) {
|
|
1923
|
-
if (Ho(e2)) {
|
|
1924
|
-
let n3 = ko(e2.startDate);
|
|
1925
|
-
return Vo(Oo(new Date(n3.getFullYear(), n3.getMonth() + t2, 1)));
|
|
1926
|
-
}
|
|
1927
|
-
let n2 = t2 * Bo(e2);
|
|
1928
|
-
return { startDate: zo(e2.startDate, n2), endDate: zo(e2.endDate, n2) };
|
|
1929
|
-
}
|
|
1930
|
-
function Wo(e2, t2) {
|
|
1918
|
+
function Ho(e2, t2) {
|
|
1931
1919
|
return e2 >= t2.startDate && e2 <= t2.endDate;
|
|
1932
1920
|
}
|
|
1933
|
-
function
|
|
1921
|
+
function Uo(e2) {
|
|
1934
1922
|
let t2 = ko(e2), n2 = new Date(t2.getFullYear(), t2.getMonth() + 2, 0).getDate(), r2 = Math.min(t2.getDate(), n2);
|
|
1935
1923
|
return Oo(new Date(t2.getFullYear(), t2.getMonth() + 1, r2));
|
|
1936
1924
|
}
|
|
1937
|
-
function
|
|
1925
|
+
function Wo(e2) {
|
|
1938
1926
|
let t2 = [], n2 = e2.startDate;
|
|
1939
1927
|
for (; n2 <= e2.endDate; ) {
|
|
1940
|
-
let r2 = zo(
|
|
1928
|
+
let r2 = zo(Uo(n2), -1), i2 = r2 < e2.endDate ? r2 : e2.endDate;
|
|
1941
1929
|
t2.push({ startDate: n2, endDate: i2 }), n2 = zo(i2, 1);
|
|
1942
1930
|
}
|
|
1943
1931
|
return t2;
|
|
1944
1932
|
}
|
|
1945
|
-
function
|
|
1933
|
+
function Go({ allowGenderSelection: e2, staffSelectionStrategy: t2 }) {
|
|
1946
1934
|
return e2 && t2 !== `CUSTOMER_CANNOT_CHOOSE`;
|
|
1947
1935
|
}
|
|
1948
|
-
async function
|
|
1936
|
+
async function Ko() {
|
|
1949
1937
|
let e2 = await Ia(Vr);
|
|
1950
1938
|
return { businessTimeZone: e2.timeSlotsConfiguration?.displayTimeZone?.timeZone || null, staffSelectionStrategy: e2.timeSlotsConfiguration?.staffSelection?.strategy ?? null, allowGenderSelection: e2.timeSlotsConfiguration?.staffSelection?.allowGenderSelection ?? false };
|
|
1951
1939
|
}
|
|
1952
|
-
function
|
|
1940
|
+
function qo(e2) {
|
|
1953
1941
|
let t2 = e2.location?._id || (e2.location?.locationType ? `${e2.location.locationType}:${e2.location.formattedAddress ?? ``}` : ``);
|
|
1954
1942
|
return `${e2.localStartDate ?? ``}|${e2.localEndDate ?? ``}|${t2}`;
|
|
1955
1943
|
}
|
|
1956
|
-
function
|
|
1944
|
+
function Jo(e2) {
|
|
1957
1945
|
return e2.availableResources?.[0]?.resources?.[0]?._id ?? null;
|
|
1958
1946
|
}
|
|
1959
|
-
function
|
|
1960
|
-
return `${
|
|
1947
|
+
function Yo(e2) {
|
|
1948
|
+
return `${qo(e2)}|${Jo(e2) ?? ``}`;
|
|
1961
1949
|
}
|
|
1962
|
-
function
|
|
1950
|
+
function Xo(e2) {
|
|
1963
1951
|
let t2 = /* @__PURE__ */ new Map();
|
|
1964
1952
|
for (let n2 of e2) {
|
|
1965
|
-
let e3 =
|
|
1953
|
+
let e3 = qo(n2), r2 = t2.get(e3);
|
|
1966
1954
|
r2 ? r2.push(n2) : t2.set(e3, [n2]);
|
|
1967
1955
|
}
|
|
1968
1956
|
return [...t2.values()].map((e3) => {
|
|
@@ -1971,132 +1959,132 @@ function Qo(e2) {
|
|
|
1971
1959
|
return { ...n2[0], availableResources: n2.flatMap((e4) => e4.availableResources ?? []) };
|
|
1972
1960
|
});
|
|
1973
1961
|
}
|
|
1974
|
-
function
|
|
1962
|
+
function Zo(e2) {
|
|
1975
1963
|
return e2 ? { locations: [{ _id: e2, locationType: `BUSINESS` }] } : {};
|
|
1976
1964
|
}
|
|
1977
|
-
function
|
|
1965
|
+
function Qo(e2) {
|
|
1978
1966
|
return e2 ? { resourceTypes: [{ resourceTypeId: Wr, resourceIds: [e2] }] } : {};
|
|
1979
1967
|
}
|
|
1980
|
-
function
|
|
1968
|
+
function $o(e2) {
|
|
1981
1969
|
let { requestedGender: t2, ...n2 } = e2;
|
|
1982
1970
|
return Object.keys(n2).length ? n2 : void 0;
|
|
1983
1971
|
}
|
|
1984
|
-
function
|
|
1972
|
+
function es(e2, t2) {
|
|
1985
1973
|
if (!e2) return {};
|
|
1986
|
-
let n2 = t2 ?
|
|
1974
|
+
let n2 = t2 ? $o(e2) : e2;
|
|
1987
1975
|
return n2 ? { customerChoices: n2 } : {};
|
|
1988
1976
|
}
|
|
1989
|
-
var
|
|
1990
|
-
function
|
|
1991
|
-
return _o(e2) ===
|
|
1977
|
+
var ts = `REQUESTED_GENDER_NOT_ALLOWED`;
|
|
1978
|
+
function ns(e2) {
|
|
1979
|
+
return _o(e2) === ts;
|
|
1992
1980
|
}
|
|
1993
|
-
var
|
|
1994
|
-
var
|
|
1995
|
-
function
|
|
1996
|
-
return
|
|
1981
|
+
var rs = false;
|
|
1982
|
+
var is = /* @__PURE__ */ new Set();
|
|
1983
|
+
function as() {
|
|
1984
|
+
return rs;
|
|
1997
1985
|
}
|
|
1998
|
-
function
|
|
1999
|
-
return
|
|
1986
|
+
function os(e2) {
|
|
1987
|
+
return is.add(e2), () => is.delete(e2);
|
|
2000
1988
|
}
|
|
2001
|
-
function
|
|
2002
|
-
|
|
1989
|
+
function ss() {
|
|
1990
|
+
rs || (rs = true, is.forEach((e2) => e2()));
|
|
2003
1991
|
}
|
|
2004
|
-
async function
|
|
1992
|
+
async function cs(e2) {
|
|
2005
1993
|
let { customerChoices: t2, ...n2 } = e2, r2 = (e3) => {
|
|
2006
|
-
let t3 =
|
|
1994
|
+
let t3 = $o(e3);
|
|
2007
1995
|
return la({ ...n2, ...t3 ? { customerChoices: t3 } : {} });
|
|
2008
1996
|
};
|
|
2009
|
-
if (
|
|
1997
|
+
if (rs && t2?.requestedGender) return r2(t2);
|
|
2010
1998
|
try {
|
|
2011
1999
|
return await la(e2);
|
|
2012
2000
|
} catch (e3) {
|
|
2013
|
-
if (!t2?.requestedGender || !
|
|
2014
|
-
return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }),
|
|
2001
|
+
if (!t2?.requestedGender || !ns(e3)) throw e3;
|
|
2002
|
+
return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ss(), r2(t2);
|
|
2015
2003
|
}
|
|
2016
2004
|
}
|
|
2017
|
-
function
|
|
2005
|
+
function ls(e2, t2, n2) {
|
|
2018
2006
|
return { ...e2 ? { "location.id": e2 } : {}, ...t2 ? { "resources.id": { $hasSome: [t2] } } : {}, ...n2 ? { remainingCapacity: { $gte: n2 } } : {} };
|
|
2019
2007
|
}
|
|
2020
|
-
async function
|
|
2008
|
+
async function us(e2) {
|
|
2021
2009
|
let t2 = await _a(e2);
|
|
2022
2010
|
return { timeSlots: t2.timeSlots ?? [], timeZone: t2.timeZone ?? null, nextCursor: t2.pagingMetadata?.cursors?.next || null };
|
|
2023
2011
|
}
|
|
2024
|
-
function
|
|
2025
|
-
return Ya(t2) ?
|
|
2012
|
+
function ds({ serviceId: e2, serviceType: t2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2 = false, customerChoices: c2, minRemainingCapacity: l2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) {
|
|
2013
|
+
return Ya(t2) ? fs({ serviceId: e2, fromLocalDate: n2, toLocalDate: r2, timeZone: i2, locationId: a2, staffId: o2, onlyAvailableSlots: s2, customerChoices: c2, timeSlotsPerDay: u2, limit: d2, cursor: f2 }) : us({ serviceIds: [e2], fromLocalDate: n2, ...r2 ? { toLocalDate: r2 } : {}, ...i2 ? { timeZone: i2 } : {}, includeNonBookable: !s2, eventFilter: { type: t2, ...ls(a2, o2, l2) }, cursorPaging: { limit: d2, ...f2 ? { cursor: f2 } : {} } });
|
|
2026
2014
|
}
|
|
2027
|
-
async function
|
|
2028
|
-
let d2 = await
|
|
2015
|
+
async function fs({ serviceId: e2, fromLocalDate: t2, toLocalDate: n2, timeZone: r2, locationId: i2, staffId: a2, onlyAvailableSlots: o2, customerChoices: s2, timeSlotsPerDay: c2, limit: l2, cursor: u2 }) {
|
|
2016
|
+
let d2 = await cs({ serviceId: e2, fromLocalDate: t2, ...n2 ? { toLocalDate: n2 } : {}, ...r2 ? { timeZone: r2 } : {}, ...o2 ? { bookable: true } : {}, ...Zo(i2), ...Qo(a2), ...es(s2, a2), includeResourceTypeIds: [Wr], ...c2 == null ? {} : { timeSlotsPerDay: c2 }, cursorPaging: { limit: l2, ...u2 ? { cursor: u2 } : {} } });
|
|
2029
2017
|
return { timeSlots: d2.timeSlots ?? [], timeZone: d2.timeZone ?? null, nextCursor: d2.cursorPagingMetadata?.cursors?.next || null };
|
|
2030
2018
|
}
|
|
2031
|
-
var
|
|
2032
|
-
var
|
|
2033
|
-
function
|
|
2034
|
-
let t2 = e2 ? ko(e2) : new Date(Date.now()), n2 = new Date(t2.getFullYear(), t2.getMonth() +
|
|
2019
|
+
var ps = 6;
|
|
2020
|
+
var ms = 864e5;
|
|
2021
|
+
function hs(e2) {
|
|
2022
|
+
let t2 = e2 ? ko(e2) : new Date(Date.now()), n2 = new Date(t2.getFullYear(), t2.getMonth() + ps + 1, 1), r2 = new Date(n2.getTime() - ms);
|
|
2035
2023
|
return { fromLocalDate: jo(t2), toLocalDate: Mo(r2) };
|
|
2036
2024
|
}
|
|
2037
|
-
async function
|
|
2038
|
-
let { fromLocalDate: u2, toLocalDate: d2 } =
|
|
2025
|
+
async function gs({ serviceId: e2, serviceType: t2, timeZone: n2, limit: r2, onlyAvailableSlots: i2 = true, fromDate: a2, locationId: o2, staffId: s2, customerChoices: c2, minRemainingCapacity: l2 }) {
|
|
2026
|
+
let { fromLocalDate: u2, toLocalDate: d2 } = hs(a2);
|
|
2039
2027
|
if (Xa(t2) || Za(t2)) {
|
|
2040
|
-
let a3 = { ...Za(t2) ? { type: `COURSE` } : {}, ...
|
|
2028
|
+
let a3 = { ...Za(t2) ? { type: `COURSE` } : {}, ...ls(o2, s2, l2) }, c3 = await us({ serviceIds: [e2], fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, includeNonBookable: !i2, ...Object.keys(a3).length ? { eventFilter: a3 } : {}, ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
|
|
2041
2029
|
return { timeSlots: c3.timeSlots, timeZone: c3.timeZone };
|
|
2042
2030
|
}
|
|
2043
|
-
let f2 = await
|
|
2031
|
+
let f2 = await cs({ serviceId: e2, fromLocalDate: u2, toLocalDate: d2, ...n2 ? { timeZone: n2 } : {}, ...i2 ? { bookable: true } : {}, ...Zo(o2), ...Qo(s2), ...es(c2, s2), includeResourceTypeIds: [Wr], ...r2 == null ? {} : { cursorPaging: { limit: r2 } } });
|
|
2044
2032
|
return { timeSlots: f2.timeSlots ?? [], timeZone: f2.timeZone ?? null };
|
|
2045
2033
|
}
|
|
2046
|
-
var
|
|
2047
|
-
async function
|
|
2034
|
+
var _s = 1e3;
|
|
2035
|
+
async function vs({ serviceId: e2, serviceType: t2, date: n2, timeZone: r2, onlyAvailableSlots: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2, fromLocalDate: l2, toLocalDate: u2 }) {
|
|
2048
2036
|
let d2 = `${n2}T00:00:00`, f2 = `${n2}T23:59:59`, p2 = Za(t2) ? `COURSE` : Xa(t2) ? `CLASS` : `APPOINTMENT`, m2 = [], h2 = null, g2;
|
|
2049
2037
|
do {
|
|
2050
|
-
let t3 = await
|
|
2038
|
+
let t3 = await ds({ serviceId: e2, serviceType: p2, fromLocalDate: l2 && l2 > d2 ? l2 : d2, toLocalDate: u2 && u2 < f2 ? u2 : f2, timeZone: r2, locationId: a2, staffId: o2, onlyAvailableSlots: i2, customerChoices: s2, minRemainingCapacity: c2, limit: _s, cursor: g2 });
|
|
2051
2039
|
m2.push(...t3.timeSlots), h2 = t3.timeZone ?? h2, g2 = t3.nextCursor ?? void 0;
|
|
2052
2040
|
} while (g2);
|
|
2053
2041
|
return { timeSlots: m2, timeZone: h2 };
|
|
2054
2042
|
}
|
|
2055
|
-
function
|
|
2043
|
+
function ys(e2) {
|
|
2056
2044
|
return { slotStart: e2.localStartDate, slotEnd: e2.localEndDate, eventId: e2.eventInfo?.eventId, scheduleId: e2.scheduleId ?? void 0, locationId: e2.location?._id ?? void 0, locationType: e2.location?.locationType ?? void 0 };
|
|
2057
2045
|
}
|
|
2058
|
-
function
|
|
2046
|
+
function bs(e2) {
|
|
2059
2047
|
return e2?.options?.values?.[0]?.type === Ea.STAFF_MEMBER;
|
|
2060
2048
|
}
|
|
2061
|
-
function
|
|
2049
|
+
function xs(e2) {
|
|
2062
2050
|
return e2.staffMemberDetails?.staffMembers ?? [];
|
|
2063
2051
|
}
|
|
2064
|
-
function
|
|
2052
|
+
function Ss(e2, t2) {
|
|
2065
2053
|
let n2 = e2.workingHoursLocationCoverage;
|
|
2066
2054
|
return { staffMemberId: e2.staffMemberId ?? ``, name: e2.name ?? null, image: null, isSelected: t2 === e2.staffMemberId, ...n2 ? { locationCoverage: { availableAtAllLocations: n2.availableAtAllLocations ?? false, locationIds: n2.locationIds ?? [] } } : {} };
|
|
2067
2055
|
}
|
|
2068
|
-
function
|
|
2056
|
+
function Cs(e2, t2) {
|
|
2069
2057
|
let n2 = e2.locationCoverage;
|
|
2070
2058
|
return !n2 || n2.availableAtAllLocations || n2.locationIds.includes(t2);
|
|
2071
2059
|
}
|
|
2072
|
-
function
|
|
2073
|
-
return t2 ? e2.filter((e3) =>
|
|
2060
|
+
function ws(e2, t2) {
|
|
2061
|
+
return t2 ? e2.filter((e3) => Cs(e3, t2)) : e2;
|
|
2074
2062
|
}
|
|
2075
|
-
function
|
|
2063
|
+
function Ts(e2, t2) {
|
|
2076
2064
|
let n2 = new Map(t2.map((e3) => [e3.staffMemberId, e3.locationCoverage]));
|
|
2077
2065
|
return e2.choices.map((e3) => e3.choiceId).filter((e3) => e3 != null).map((e3) => ({ staffMemberId: e3, locationCoverage: n2.get(e3) }));
|
|
2078
2066
|
}
|
|
2079
|
-
function
|
|
2067
|
+
function Es(e2, t2, n2) {
|
|
2080
2068
|
if (e2?.type !== `STAFF_MEMBER` || !n2) return;
|
|
2081
|
-
let r2 =
|
|
2069
|
+
let r2 = ws(Ts(e2, t2), n2);
|
|
2082
2070
|
return r2.length === 1 ? r2[0].staffMemberId : void 0;
|
|
2083
2071
|
}
|
|
2084
|
-
function
|
|
2072
|
+
function Ds(e2, t2) {
|
|
2085
2073
|
if (t2.length === 0) return e2;
|
|
2086
|
-
let n2 = e2.filter((e3) =>
|
|
2074
|
+
let n2 = e2.filter((e3) => ws(t2, e3.id).length > 0);
|
|
2087
2075
|
return n2.length > 0 ? n2 : e2;
|
|
2088
2076
|
}
|
|
2089
|
-
function
|
|
2090
|
-
return
|
|
2077
|
+
function Os(e2) {
|
|
2078
|
+
return xs(e2).map((e3) => Ss(e3, null));
|
|
2091
2079
|
}
|
|
2092
|
-
function
|
|
2093
|
-
let r2 =
|
|
2080
|
+
function ks(e2, t2, n2 = false) {
|
|
2081
|
+
let r2 = As(e2), i2 = r2.length === 1 ? r2[0].id : void 0, a2 = n2 || !i2 || r2.some((e3) => e3.id === t2);
|
|
2094
2082
|
return t2 && a2 ? t2 : i2;
|
|
2095
2083
|
}
|
|
2096
|
-
function
|
|
2097
|
-
return
|
|
2084
|
+
function As(e2) {
|
|
2085
|
+
return Ds(Ja(e2), Os(e2));
|
|
2098
2086
|
}
|
|
2099
|
-
function
|
|
2087
|
+
function js(e2) {
|
|
2100
2088
|
let t2 = e2;
|
|
2101
2089
|
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e3) => {
|
|
2102
2090
|
t2.__state = { status: `fulfilled`, value: e3 };
|
|
@@ -2105,27 +2093,27 @@ function Ns(e2) {
|
|
|
2105
2093
|
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
2106
2094
|
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
2107
2095
|
}
|
|
2108
|
-
function
|
|
2096
|
+
function Ms(e2) {
|
|
2109
2097
|
let t2 = Promise.resolve(e2);
|
|
2110
2098
|
return t2.__state = { status: `fulfilled`, value: e2 }, t2;
|
|
2111
2099
|
}
|
|
2112
|
-
var
|
|
2113
|
-
function
|
|
2100
|
+
var Ns = Fr(`@wix/site-service-warmup-data`);
|
|
2101
|
+
function Ps() {
|
|
2114
2102
|
try {
|
|
2115
2103
|
return (0, import_services_manager_react.useGetService)();
|
|
2116
2104
|
} catch {
|
|
2117
2105
|
return null;
|
|
2118
2106
|
}
|
|
2119
2107
|
}
|
|
2120
|
-
function
|
|
2108
|
+
function Fs(e2) {
|
|
2121
2109
|
try {
|
|
2122
|
-
return e2 ? e2(
|
|
2110
|
+
return e2 ? e2(Ns) : null;
|
|
2123
2111
|
} catch {
|
|
2124
2112
|
return null;
|
|
2125
2113
|
}
|
|
2126
2114
|
}
|
|
2127
|
-
function
|
|
2128
|
-
let e2 =
|
|
2115
|
+
function Is() {
|
|
2116
|
+
let e2 = Fs(Ps()), t2 = typeof window > `u`;
|
|
2129
2117
|
return { scope: e2 ?? void 0, get: async (n2) => {
|
|
2130
2118
|
if (t2 || !e2) return null;
|
|
2131
2119
|
try {
|
|
@@ -2140,57 +2128,57 @@ function Rs() {
|
|
|
2140
2128
|
}
|
|
2141
2129
|
} };
|
|
2142
2130
|
}
|
|
2143
|
-
var
|
|
2144
|
-
function
|
|
2145
|
-
return `${
|
|
2131
|
+
var Ls = `bookings-uou`;
|
|
2132
|
+
function Rs() {
|
|
2133
|
+
return `${Ls}:bookings-settings`;
|
|
2146
2134
|
}
|
|
2147
|
-
function
|
|
2148
|
-
return `${
|
|
2135
|
+
function zs() {
|
|
2136
|
+
return `${Ls}:time-slots-configuration`;
|
|
2149
2137
|
}
|
|
2150
|
-
var
|
|
2151
|
-
var
|
|
2152
|
-
var
|
|
2153
|
-
var
|
|
2154
|
-
function
|
|
2138
|
+
var Bs = 5e3;
|
|
2139
|
+
var Vs = 100;
|
|
2140
|
+
var Hs = `wix-warmup-data`;
|
|
2141
|
+
var Us = null;
|
|
2142
|
+
function Ws(e2) {
|
|
2155
2143
|
if (typeof document < `u`) try {
|
|
2156
|
-
let t2 = document.getElementById(
|
|
2157
|
-
return t2 ? (
|
|
2144
|
+
let t2 = document.getElementById(Hs)?.textContent;
|
|
2145
|
+
return t2 ? (Us?.text !== t2 && (Us = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Us.data[e2] ?? void 0) : void 0;
|
|
2158
2146
|
} catch {
|
|
2159
2147
|
return;
|
|
2160
2148
|
}
|
|
2161
2149
|
}
|
|
2162
|
-
var
|
|
2163
|
-
var
|
|
2164
|
-
var
|
|
2165
|
-
var
|
|
2166
|
-
function
|
|
2167
|
-
if (!e2) return
|
|
2168
|
-
let t2 =
|
|
2169
|
-
return t2 || (t2 =
|
|
2150
|
+
var Gs = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
2151
|
+
var Ks = Gs();
|
|
2152
|
+
var qs = /* @__PURE__ */ new WeakMap();
|
|
2153
|
+
var Js = /* @__PURE__ */ new WeakMap();
|
|
2154
|
+
function Ys(e2) {
|
|
2155
|
+
if (!e2) return Ks;
|
|
2156
|
+
let t2 = qs.get(e2);
|
|
2157
|
+
return t2 || (t2 = Gs(), qs.set(e2, t2)), t2;
|
|
2170
2158
|
}
|
|
2171
|
-
function
|
|
2159
|
+
function Xs({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
2172
2160
|
if (e2 === null) return n2();
|
|
2173
2161
|
if (typeof window > `u`) {
|
|
2174
2162
|
let r3 = () => n2().then((n3) => (t2.set(e2, n3), n3)), { scope: i3 } = t2;
|
|
2175
2163
|
if (!i3) return r3();
|
|
2176
|
-
let a3 =
|
|
2177
|
-
a3 || (a3 = /* @__PURE__ */ new Map(),
|
|
2164
|
+
let a3 = Js.get(i3);
|
|
2165
|
+
a3 || (a3 = /* @__PURE__ */ new Map(), Js.set(i3, a3));
|
|
2178
2166
|
let o3 = a3.get(e2);
|
|
2179
2167
|
if (o3) return o3;
|
|
2180
2168
|
let s3 = r3();
|
|
2181
2169
|
return a3.set(e2, s3), s3.catch(() => a3.delete(e2)), s3;
|
|
2182
2170
|
}
|
|
2183
|
-
let i2 =
|
|
2171
|
+
let i2 = Ys(t2.scope), a2 = Date.now();
|
|
2184
2172
|
for (let [e3, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e3);
|
|
2185
2173
|
let o2 = i2.promises.get(e2);
|
|
2186
2174
|
if (o2 && !r2) return o2.promise;
|
|
2187
2175
|
r2 && i2.invalidatedWarmup.add(e2);
|
|
2188
2176
|
let s2 = !i2.invalidatedWarmup.has(e2);
|
|
2189
2177
|
if (s2) {
|
|
2190
|
-
let t3 =
|
|
2178
|
+
let t3 = Ws(e2);
|
|
2191
2179
|
if (t3 !== void 0) {
|
|
2192
|
-
let n3 =
|
|
2193
|
-
return i2.promises.set(e2, { promise: n3, expiresAt: a2 +
|
|
2180
|
+
let n3 = Ms(t3);
|
|
2181
|
+
return i2.promises.set(e2, { promise: n3, expiresAt: a2 + Bs }), n3;
|
|
2194
2182
|
}
|
|
2195
2183
|
}
|
|
2196
2184
|
let c2 = (async () => {
|
|
@@ -2200,48 +2188,48 @@ function Qs({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
|
2200
2188
|
}
|
|
2201
2189
|
return n2();
|
|
2202
2190
|
})();
|
|
2203
|
-
i2.promises.size >=
|
|
2191
|
+
i2.promises.size >= Vs && i2.promises.delete(i2.promises.keys().next().value);
|
|
2204
2192
|
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
2205
2193
|
return i2.promises.set(e2, l2), c2.then(() => {
|
|
2206
|
-
l2.expiresAt = Date.now() +
|
|
2194
|
+
l2.expiresAt = Date.now() + Bs;
|
|
2207
2195
|
}, () => {
|
|
2208
2196
|
i2.promises.get(e2) === l2 && i2.promises.delete(e2);
|
|
2209
2197
|
}), c2;
|
|
2210
2198
|
}
|
|
2211
|
-
var
|
|
2212
|
-
async function
|
|
2199
|
+
var Zs = { displayTimeZonePolicy: { basedOn: Ha.BUSINESS_TIME_ZONE, customerCanChange: false }, multiServiceAppointmentsEnabled: false };
|
|
2200
|
+
async function Qs() {
|
|
2213
2201
|
try {
|
|
2214
2202
|
let e2 = await Ga();
|
|
2215
2203
|
return { displayTimeZonePolicy: { basedOn: e2.displayTimeZone?.basedOn ?? Ha.BUSINESS_TIME_ZONE, customerCanChange: e2.displayTimeZone?.customerCanChange ?? false }, multiServiceAppointmentsEnabled: e2.multiServiceAppointments?.enabled ?? false };
|
|
2216
2204
|
} catch (e2) {
|
|
2217
|
-
return $(e2, { feature: Q.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }),
|
|
2205
|
+
return $(e2, { feature: Q.bookingsSettings, action: `fetch-bookings-settings`, level: `warning` }), Zs;
|
|
2218
2206
|
}
|
|
2219
2207
|
}
|
|
2220
|
-
var
|
|
2221
|
-
var
|
|
2222
|
-
var
|
|
2223
|
-
function
|
|
2224
|
-
let e2 = (0, import_react.useContext)(
|
|
2225
|
-
if (!e2) throw Error(
|
|
2208
|
+
var $s = { isLoading: true };
|
|
2209
|
+
var ec = (0, import_react.createContext)(null);
|
|
2210
|
+
var tc = `useBookingsSettingsContext must be used within BookingsSettingsProvider`;
|
|
2211
|
+
function nc() {
|
|
2212
|
+
let e2 = (0, import_react.useContext)(ec);
|
|
2213
|
+
if (!e2) throw Error(tc);
|
|
2226
2214
|
return e2;
|
|
2227
2215
|
}
|
|
2228
|
-
function
|
|
2216
|
+
function rc(e2) {
|
|
2229
2217
|
return e2.basedOn === Ha.CUSTOMER_TIME_ZONE ? Intl.DateTimeFormat().resolvedOptions().timeZone : void 0;
|
|
2230
2218
|
}
|
|
2231
|
-
function
|
|
2232
|
-
let e2 =
|
|
2233
|
-
return e2.isLoading ? void 0 :
|
|
2219
|
+
function ic() {
|
|
2220
|
+
let e2 = nc();
|
|
2221
|
+
return e2.isLoading ? void 0 : rc(e2.displayTimeZonePolicy);
|
|
2234
2222
|
}
|
|
2235
|
-
function
|
|
2236
|
-
let n2 =
|
|
2237
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2223
|
+
function ac({ settingsPromise: e2, children: t2 }) {
|
|
2224
|
+
let n2 = js(e2), r2 = (0, import_react.useMemo)(() => ({ isLoading: false, ...n2 }), [n2]);
|
|
2225
|
+
return (0, import_jsx_runtime.jsx)(ec.Provider, { value: r2, children: t2 });
|
|
2238
2226
|
}
|
|
2239
|
-
function
|
|
2240
|
-
let r2 =
|
|
2241
|
-
return e2 ? (0, import_jsx_runtime.jsx)(
|
|
2227
|
+
function oc({ bookingsSettings: e2, children: n2 }) {
|
|
2228
|
+
let r2 = Is(), [i2] = (0, import_react.useState)(() => e2 ? null : Xs({ key: Rs(), warmupData: r2, fetchData: Qs }));
|
|
2229
|
+
return e2 ? (0, import_jsx_runtime.jsx)(ec.Provider, { value: { isLoading: false, ...e2 }, children: n2 }) : (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(ec.Provider, { value: $s, children: n2 }), children: (0, import_jsx_runtime.jsx)(ac, { settingsPromise: i2, children: n2 }) });
|
|
2242
2230
|
}
|
|
2243
|
-
var
|
|
2244
|
-
var
|
|
2231
|
+
var sc = 1e3;
|
|
2232
|
+
var cc = class extends import_react.Component {
|
|
2245
2233
|
state = { hasError: false };
|
|
2246
2234
|
static getDerivedStateFromError() {
|
|
2247
2235
|
return { hasError: true };
|
|
@@ -2253,16 +2241,16 @@ var uc = class extends import_react.Component {
|
|
|
2253
2241
|
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
2254
2242
|
}
|
|
2255
2243
|
};
|
|
2256
|
-
var
|
|
2257
|
-
function
|
|
2258
|
-
let t2 = e2.searchParams.get(
|
|
2244
|
+
var lc = `appSectionParams`;
|
|
2245
|
+
function uc(e2) {
|
|
2246
|
+
let t2 = e2.searchParams.get(lc);
|
|
2259
2247
|
if (t2 === null) return e2;
|
|
2260
2248
|
let n2 = new URL(e2);
|
|
2261
|
-
n2.searchParams.delete(
|
|
2262
|
-
for (let [e3, r2] of Object.entries(
|
|
2249
|
+
n2.searchParams.delete(lc);
|
|
2250
|
+
for (let [e3, r2] of Object.entries(dc(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
|
|
2263
2251
|
return n2;
|
|
2264
2252
|
}
|
|
2265
|
-
function
|
|
2253
|
+
function dc(e2) {
|
|
2266
2254
|
try {
|
|
2267
2255
|
let t2 = JSON.parse(e2);
|
|
2268
2256
|
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
@@ -2270,16 +2258,16 @@ function pc(e2) {
|
|
|
2270
2258
|
return {};
|
|
2271
2259
|
}
|
|
2272
2260
|
}
|
|
2273
|
-
var
|
|
2274
|
-
var
|
|
2261
|
+
var fc = `bookings-uou:url-change`;
|
|
2262
|
+
var pc = (e2) => {
|
|
2275
2263
|
let t2 = new URL(e2);
|
|
2276
2264
|
return t2.searchParams.sort(), t2.href;
|
|
2277
2265
|
};
|
|
2278
|
-
function
|
|
2266
|
+
function mc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
2279
2267
|
let r2 = globalThis.window;
|
|
2280
2268
|
if (!r2?.history) return;
|
|
2281
2269
|
let i2 = new URL(r2.location.href);
|
|
2282
|
-
if (
|
|
2270
|
+
if (pc(i2) === pc(e2)) return;
|
|
2283
2271
|
let a2 = { scrollY: r2.scrollY };
|
|
2284
2272
|
if (n2) r2.history.replaceState(a2, ``, e2.href);
|
|
2285
2273
|
else {
|
|
@@ -2290,111 +2278,109 @@ function gc(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
|
2290
2278
|
return;
|
|
2291
2279
|
}
|
|
2292
2280
|
}
|
|
2293
|
-
r2.dispatchEvent(new Event(
|
|
2281
|
+
r2.dispatchEvent(new Event(fc));
|
|
2294
2282
|
}
|
|
2295
|
-
function
|
|
2283
|
+
function hc(e2) {
|
|
2296
2284
|
let t2 = globalThis.window;
|
|
2297
|
-
return t2 ? (t2.addEventListener(
|
|
2298
|
-
t2.removeEventListener(
|
|
2285
|
+
return t2 ? (t2.addEventListener(fc, e2), t2.addEventListener(`popstate`, e2), () => {
|
|
2286
|
+
t2.removeEventListener(fc, e2), t2.removeEventListener(`popstate`, e2);
|
|
2299
2287
|
}) : () => {
|
|
2300
2288
|
};
|
|
2301
2289
|
}
|
|
2302
|
-
var
|
|
2290
|
+
var gc = (e2) => {
|
|
2303
2291
|
try {
|
|
2304
2292
|
return decodeURIComponent(e2);
|
|
2305
2293
|
} catch {
|
|
2306
2294
|
return e2;
|
|
2307
2295
|
}
|
|
2308
2296
|
};
|
|
2309
|
-
function
|
|
2297
|
+
function _c(e2, t2) {
|
|
2310
2298
|
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
2311
|
-
return `./${
|
|
2299
|
+
return `./${gc(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
2312
2300
|
}
|
|
2313
|
-
function
|
|
2314
|
-
let e2 = (0, import_services_manager_react.useService)(zr), t2 = (0, import_react.useCallback)(() => e2.currentUrl, [e2]), n2 = (0, import_react.useSyncExternalStore)(
|
|
2315
|
-
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () =>
|
|
2301
|
+
function vc() {
|
|
2302
|
+
let e2 = (0, import_services_manager_react.useService)(zr), t2 = (0, import_react.useCallback)(() => e2.currentUrl, [e2]), n2 = (0, import_react.useSyncExternalStore)(hc, t2, t2), i2 = (0, import_react.useMemo)(() => uc(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
|
|
2303
|
+
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => uc(new URL(e2.currentUrl)), getRelativeUrl: () => _c(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: mc };
|
|
2316
2304
|
}
|
|
2317
|
-
var
|
|
2318
|
-
function
|
|
2305
|
+
var yc = Fr(`@wix/site-service-business-logger`);
|
|
2306
|
+
function bc(e2) {
|
|
2319
2307
|
return { evid: 32, src: 16, endpoint: ``, params: e2 };
|
|
2320
2308
|
}
|
|
2321
|
-
function
|
|
2309
|
+
function xc(e2) {
|
|
2322
2310
|
return { evid: 33, src: 16, endpoint: ``, params: e2 };
|
|
2323
2311
|
}
|
|
2324
|
-
function
|
|
2312
|
+
function Sc(e2) {
|
|
2325
2313
|
return { evid: 34, src: 16, endpoint: ``, params: e2 };
|
|
2326
2314
|
}
|
|
2327
|
-
var
|
|
2315
|
+
var Cc = { SERVICES: `services_context`, SERVICE: `service_context`, TIME_SLOTS: `time_slots_context`, BOOKING_CHECKOUT: `booking_checkout_context`, CATEGORIES: `categories_context`, LOCATIONS: `locations_context`, SERVICE_ADD_ONS: `service_addons_context`, PREFERENCES: `preferences_context` };
|
|
2328
2316
|
Gr.BOOK_ONLINE;
|
|
2329
|
-
var
|
|
2330
|
-
var
|
|
2331
|
-
var
|
|
2332
|
-
var
|
|
2333
|
-
var
|
|
2334
|
-
let { reportBi: t2 } = (0, import_services_manager_react.useService)(
|
|
2317
|
+
var wc = `new_bookings_server`;
|
|
2318
|
+
var Tc = { LOAD: `load`, LOCATION_CHOSEN: `location chosen`, STAFF_CHOSEN: `staff chosen`, VARIANT_SELECTED: `variant selected`, ADD_ON_SELECTED: `add on selected`, ADD_ON_UNSELECTED: `add on unselected`, BACK: `back`, CLOSE: `close`, STAY: `stay`, ADD_SERVICE: `add service`, EDIT_BASKET_ITEM: `edit basket item`, EDIT_BASKET_ITEM_FROM_CALENDAR: `edit basket item from calendar`, CHANGE_STAFF_MEMBER: `change staff member`, REMOVE_BASKET_ITEM: `remove basket item`, SELECT_SERVICE: `select service`, SEARCH: `search`, CLEAR_SEARCH: `clear search` };
|
|
2319
|
+
var Ec = { TIMEZONE_PICKER: `timezone_picker`, TIME_PICKER: `time_picker`, BOOKING_DETAILS: `booking_details`, RESCHEDULE_DIALOG: `reschedule_dialog`, JOIN_WAITLIST_DIALOG: `join_waitlist_dialog` };
|
|
2320
|
+
var Dc = { DROPDOWN: `dropdown`, TIME_SLOT: `time_slot`, EXPAND: `expand`, COLLAPSE: `collapse` };
|
|
2321
|
+
var Oc = (e2) => {
|
|
2322
|
+
let { reportBi: t2 } = (0, import_services_manager_react.useService)(yc);
|
|
2335
2323
|
return (0, import_react.useCallback)((n2) => {
|
|
2336
|
-
t2({ widget_name: e2, bookingsPlatform:
|
|
2324
|
+
t2({ widget_name: e2, bookingsPlatform: wc, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
2337
2325
|
}, [t2, e2]);
|
|
2338
2326
|
};
|
|
2339
|
-
var
|
|
2340
|
-
let n2 =
|
|
2327
|
+
var kc = (e2, t2 = true) => {
|
|
2328
|
+
let n2 = Oc(e2), { getParsedUrl: r2 } = vc(), i2 = (0, import_react.useRef)(false);
|
|
2341
2329
|
(0, import_react.useEffect)(() => {
|
|
2342
|
-
t2 && !i2.current && (i2.current = true, n2(
|
|
2330
|
+
t2 && !i2.current && (i2.current = true, n2(bc({ referralInfo: r2().searchParams.get(eo.referral) ?? void 0 })));
|
|
2343
2331
|
}, [t2, n2, r2]);
|
|
2344
2332
|
};
|
|
2345
|
-
function
|
|
2333
|
+
function Ac(e2) {
|
|
2346
2334
|
return { evid: 1177, src: 16, endpoint: `wixboost-ugc`, params: e2 };
|
|
2347
2335
|
}
|
|
2348
|
-
function
|
|
2336
|
+
function jc(e2) {
|
|
2349
2337
|
return { evid: 596, src: 16, endpoint: `wixboost-ugc`, params: e2 };
|
|
2350
2338
|
}
|
|
2351
|
-
function
|
|
2339
|
+
function Mc(e2, t2) {
|
|
2352
2340
|
let n2 = new Intl.DateTimeFormat(`en-US`, { timeZone: t2, hourCycle: `h23`, year: `numeric`, month: `2-digit`, day: `2-digit`, hour: `2-digit`, minute: `2-digit`, second: `2-digit` }).formatToParts(new Date(e2)), r2 = {};
|
|
2353
2341
|
for (let e3 of n2) e3.type !== `literal` && (r2[e3.type] = Number(e3.value));
|
|
2354
2342
|
return Date.UTC(r2.year, r2.month - 1, r2.day, r2.hour, r2.minute, r2.second) - e2;
|
|
2355
2343
|
}
|
|
2356
|
-
function
|
|
2344
|
+
function Nc(e2, t2) {
|
|
2357
2345
|
let n2 = e2.match(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?/);
|
|
2358
2346
|
if (!n2) return null;
|
|
2359
2347
|
let [, r2, i2, a2, o2, s2, c2] = n2, l2 = Date.UTC(Number(r2), Number(i2) - 1, Number(a2), Number(o2), Number(s2), c2 ? Number(c2) : 0);
|
|
2360
2348
|
if (Number.isNaN(l2)) return null;
|
|
2361
2349
|
try {
|
|
2362
|
-
let e3 = l2 -
|
|
2363
|
-
return new Date(l2 -
|
|
2350
|
+
let e3 = l2 - Mc(l2, t2);
|
|
2351
|
+
return new Date(l2 - Mc(e3, t2));
|
|
2364
2352
|
} catch {
|
|
2365
2353
|
return null;
|
|
2366
2354
|
}
|
|
2367
2355
|
}
|
|
2368
|
-
function
|
|
2369
|
-
let i2 = (e3) => e3 && n2 ?
|
|
2370
|
-
return
|
|
2356
|
+
function Pc({ start: e2, end: t2, timeZone: n2, ...r2 }) {
|
|
2357
|
+
let i2 = (e3) => e3 && n2 ? Nc(e3, n2)?.getTime() : void 0;
|
|
2358
|
+
return Sc({ bookingsServiceId: r2.serviceId, serviceType: r2.serviceType, startTime: i2(e2), endTime: i2(t2), isEligibleForFlowCompletion: r2.isEligibleForFlowCompletion });
|
|
2371
2359
|
}
|
|
2372
|
-
function
|
|
2373
|
-
let i2 = n2 ? `loadFailed` : null, a2 = { selectedDate: null, daysAvailabilityRange: null, daysAvailability: [], daysAvailabilityLoading: false, daysAvailabilityHasError: false,
|
|
2360
|
+
function Fc({ nextAvailableSlotsCount: e2, isLoading: t2, hasError: n2, children: r2 }) {
|
|
2361
|
+
let i2 = n2 ? `loadFailed` : null, a2 = { selectedDate: null, daysAvailabilityRange: null, daysAvailability: [], daysAvailabilityLoading: false, daysAvailabilityHasError: false, selectDate: async () => {
|
|
2374
2362
|
}, setDaysAvailabilityRange: async () => {
|
|
2375
|
-
},
|
|
2376
|
-
}, previousDaysAvailabilityRange: async () => {
|
|
2377
|
-
}, goToNextAvailableDate: async () => `cancelled`, canChangeTimeZone: false, isMultiService: false, hasValidSchedulingInput: false, availabilityRequestKey: null, needsServiceChoice: false, isRescheduling: (0, import_service.useServiceContext)(true)?.reschedule != null, rescheduleValidUntil: null, staffFilterOptions: [], locationFilterOptions: [], selectedStaffFilter: null, requestedGender: null, genderSelectionAllowed: false, selectedLocationFilter: null, setStaffFilter: () => {
|
|
2363
|
+
}, goToNextAvailableDate: async () => `cancelled`, canChangeTimeZone: false, isMultiService: false, availabilityRequestKey: null, needsServiceChoice: false, isRescheduling: (0, import_service.useServiceContext)(true)?.reschedule != null, rescheduleValidUntil: null, staffFilterOptions: [], locationFilterOptions: [], selectedStaffFilter: null, requestedGender: null, genderSelectionAllowed: false, selectedLocationFilter: null, setStaffFilter: () => {
|
|
2378
2364
|
}, setLocationFilter: () => {
|
|
2379
|
-
}, isComplete: false,
|
|
2365
|
+
}, isComplete: false, timeSlots: [], isLoading: t2, hasError: n2, errorCode: i2, businessTimeZone: null, setTimeZone: () => {
|
|
2380
2366
|
}, currentTimeSlotsPage: 1, hasNextTimeSlotsPage: false, hasPreviousTimeSlotsPage: false, nextTimeSlotsPage: async () => {
|
|
2381
2367
|
}, loadUpcomingTimeSlots: async () => {
|
|
2382
2368
|
}, upcomingTimeSlotsRequested: false, previousTimeSlotsPage: () => {
|
|
2383
2369
|
}, nextAvailableSlotsCount: e2, timeZone: null, staffFromSlots: [], selectedResourceId: null, setSelectedResource: () => {
|
|
2384
2370
|
}, canAutoAssignStaff: false, selectedTimeSlot: null, selectTimeSlot: () => {
|
|
2385
2371
|
}, navigateToBookingForm: () => {
|
|
2386
|
-
}, timeSlotLimitPerDay: null,
|
|
2372
|
+
}, timeSlotLimitPerDay: null, daysWithMore: /* @__PURE__ */ new Set(), loadingDate: null, loadAllTimeSlotsForDay: async () => {
|
|
2387
2373
|
} };
|
|
2388
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2374
|
+
return (0, import_jsx_runtime.jsx)(Hl.Provider, { value: a2, children: r2 });
|
|
2389
2375
|
}
|
|
2390
|
-
function
|
|
2391
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2376
|
+
function Ic({ nextAvailableSlotsCount: e2, children: t2 }) {
|
|
2377
|
+
return (0, import_jsx_runtime.jsx)(Fc, { nextAvailableSlotsCount: e2, isLoading: true, hasError: false, children: t2 });
|
|
2392
2378
|
}
|
|
2393
|
-
function
|
|
2394
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2379
|
+
function Lc({ nextAvailableSlotsCount: e2, children: t2 }) {
|
|
2380
|
+
return (0, import_jsx_runtime.jsx)(Fc, { nextAvailableSlotsCount: e2, isLoading: false, hasError: true, children: t2 });
|
|
2395
2381
|
}
|
|
2396
|
-
var
|
|
2397
|
-
function
|
|
2382
|
+
var Rc = 1e3;
|
|
2383
|
+
function zc(e2, t2) {
|
|
2398
2384
|
let n2 = /* @__PURE__ */ new Map();
|
|
2399
2385
|
for (let e3 of t2) {
|
|
2400
2386
|
let t3 = e3.localStartDate?.slice(0, 10);
|
|
@@ -2407,68 +2393,68 @@ function Vc(e2, t2) {
|
|
|
2407
2393
|
}
|
|
2408
2394
|
return r2;
|
|
2409
2395
|
}
|
|
2410
|
-
function
|
|
2396
|
+
function Bc(e2, t2) {
|
|
2411
2397
|
return { fromLocalDate: Po(e2.startDate, t2), toLocalDate: Mo(ko(e2.endDate)) };
|
|
2412
2398
|
}
|
|
2413
|
-
async function
|
|
2414
|
-
return (await
|
|
2399
|
+
async function Vc(e2, t2, n2, r2, i2, a2) {
|
|
2400
|
+
return (await cs({ serviceId: e2, ...Bc(n2, t2), timeZone: t2, ...Zo(r2), ...Qo(i2), ...es(a2, i2), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(n2), Rc) } })).timeSlots ?? [];
|
|
2415
2401
|
}
|
|
2416
|
-
async function
|
|
2417
|
-
return (await
|
|
2402
|
+
async function Hc(e2, t2, n2, r2, i2, a2) {
|
|
2403
|
+
return (await us({ serviceIds: [e2], ...Bc(n2, t2), timeZone: t2, includeNonBookable: true, eventFilter: { type: `CLASS`, ...ls(r2, i2, a2) }, maxSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(n2), Rc) } })).timeSlots;
|
|
2418
2404
|
}
|
|
2419
|
-
async function
|
|
2420
|
-
if (Za(t2) || n2.endDate < r2) return
|
|
2421
|
-
let l2 = { startDate: n2.startDate < r2 ? r2 : n2.startDate, endDate: n2.endDate }, u2 = Xa(t2) ?
|
|
2422
|
-
return
|
|
2405
|
+
async function Uc({ serviceId: e2, serviceType: t2, range: n2, fromDate: r2, timeZone: i2, locationId: a2, staffId: o2, customerChoices: s2, minRemainingCapacity: c2 }) {
|
|
2406
|
+
if (Za(t2) || n2.endDate < r2) return zc(n2, []);
|
|
2407
|
+
let l2 = { startDate: n2.startDate < r2 ? r2 : n2.startDate, endDate: n2.endDate }, u2 = Xa(t2) ? Wo(l2) : [l2];
|
|
2408
|
+
return zc(n2, (await Promise.all(u2.map((n3) => Xa(t2) ? Hc(e2, i2, n3, a2, o2, c2) : Vc(e2, i2, n3, a2, o2, s2)))).flat());
|
|
2423
2409
|
}
|
|
2424
|
-
function
|
|
2410
|
+
function Wc({ serviceId: e2, staff: t2, customerChoices: n2 }) {
|
|
2425
2411
|
let r2 = t2 && !t2.anyResource ? t2.staffMemberId : void 0;
|
|
2426
|
-
return { serviceId: e2, ...
|
|
2412
|
+
return { serviceId: e2, ...es(n2, r2), ...t2?.anyResource ? {} : { includeResourceTypeIds: [Wr] }, ...r2 ? { resourceTypes: [{ resourceTypeId: Wr, resourceIds: [r2] }] } : {} };
|
|
2427
2413
|
}
|
|
2428
|
-
function
|
|
2429
|
-
return { services: e2.map(
|
|
2414
|
+
function Gc({ services: e2, locationId: t2, locationType: n2, timeZone: r2 }) {
|
|
2415
|
+
return { services: e2.map(Wc), timeZone: r2, location: { ...t2 ? { _id: t2 } : {}, locationType: n2 } };
|
|
2430
2416
|
}
|
|
2431
|
-
function
|
|
2432
|
-
let { customerChoices: t2, ...n2 } = e2, r2 = t2 ?
|
|
2417
|
+
function Kc(e2) {
|
|
2418
|
+
let { customerChoices: t2, ...n2 } = e2, r2 = t2 ? $o(t2) : void 0;
|
|
2433
2419
|
return r2 ? { ...n2, customerChoices: r2 } : n2;
|
|
2434
2420
|
}
|
|
2435
|
-
async function
|
|
2436
|
-
let t2 = e2.services ?? [], n2 = () => Ta({ ...e2, services: t2.map(
|
|
2437
|
-
if (r2 &&
|
|
2421
|
+
async function qc(e2) {
|
|
2422
|
+
let t2 = e2.services ?? [], n2 = () => Ta({ ...e2, services: t2.map(Kc) }), r2 = t2.some((e3) => e3.customerChoices?.requestedGender);
|
|
2423
|
+
if (r2 && as()) return n2();
|
|
2438
2424
|
try {
|
|
2439
2425
|
return await Ta(e2);
|
|
2440
2426
|
} catch (e3) {
|
|
2441
|
-
if (!r2 || !
|
|
2442
|
-
return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }),
|
|
2427
|
+
if (!r2 || !ns(e3)) throw e3;
|
|
2428
|
+
return $(e3, { feature: Q.timeSlots, action: `requested-gender-rejected`, level: `warning` }), ss(), n2();
|
|
2443
2429
|
}
|
|
2444
2430
|
}
|
|
2445
|
-
var
|
|
2446
|
-
async function
|
|
2447
|
-
if (e2.endDate < t2) return
|
|
2431
|
+
var Jc = 1e3;
|
|
2432
|
+
async function Yc({ range: e2, fromDate: t2, ...n2 }) {
|
|
2433
|
+
if (e2.endDate < t2) return zc(e2, []);
|
|
2448
2434
|
let r2 = { startDate: e2.startDate < t2 ? t2 : e2.startDate, endDate: e2.endDate };
|
|
2449
|
-
return
|
|
2435
|
+
return zc(e2, (await qc({ ...Gc(n2), fromLocalDate: Po(r2.startDate, n2.timeZone), toLocalDate: Mo(ko(r2.endDate)), timeSlotsPerDay: 1, cursorPaging: { limit: Math.min(Bo(r2), Jc) } })).timeSlots ?? []);
|
|
2450
2436
|
}
|
|
2451
|
-
async function
|
|
2437
|
+
async function Xc({ date: e2, onlyAvailableSlots: t2, fromLocalDate: n2, ...r2 }) {
|
|
2452
2438
|
let i2 = `${e2}T00:00:00`, a2 = [], o2 = null, s2;
|
|
2453
2439
|
do {
|
|
2454
|
-
let c2 = await
|
|
2440
|
+
let c2 = await qc({ ...Gc(r2), fromLocalDate: n2 && n2 > i2 ? n2 : i2, toLocalDate: `${e2}T23:59:59`, ...t2 ? { bookable: true } : {}, cursorPaging: { limit: Jc, ...s2 ? { cursor: s2 } : {} } });
|
|
2455
2441
|
a2.push(...c2.timeSlots ?? []), o2 = c2.timeZone ?? o2, s2 = c2.cursorPagingMetadata?.cursors?.next || void 0;
|
|
2456
2442
|
} while (s2);
|
|
2457
2443
|
return { timeSlots: a2, timeZone: o2 };
|
|
2458
2444
|
}
|
|
2459
|
-
async function
|
|
2460
|
-
let n2 = await
|
|
2445
|
+
async function Zc({ fromDate: e2, ...t2 }) {
|
|
2446
|
+
let n2 = await qc({ ...Gc(t2), ...hs(e2), bookable: true, cursorPaging: { limit: 1 } });
|
|
2461
2447
|
return { timeSlots: n2.timeSlots ?? [], timeZone: n2.timeZone ?? null };
|
|
2462
2448
|
}
|
|
2463
|
-
var
|
|
2464
|
-
function
|
|
2465
|
-
let [_2, v2] = (0, import_react.useState)(null), [y2, b2] = (0, import_react.useState)(p2), [x2, S2] = (0, import_react.useState)(
|
|
2449
|
+
var Qc = [];
|
|
2450
|
+
function $c({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: l2, today: u2, locationId: d2, staffId: f2, loadInitially: p2, customerChoices: m2, minRemainingCapacity: h2, onlyAvailableSlots: g2 }) {
|
|
2451
|
+
let [_2, v2] = (0, import_react.useState)(null), [y2, b2] = (0, import_react.useState)(p2), [x2, S2] = (0, import_react.useState)(Qc), [C2, w2] = (0, import_react.useState)(false), [T2, ee2] = (0, import_react.useState)(false), E2 = (0, import_react.useRef)(0);
|
|
2466
2452
|
(0, import_react.useEffect)(() => {
|
|
2467
2453
|
_2 === null && u2 && v2(Vo(u2));
|
|
2468
2454
|
}, [_2, u2]), (0, import_react.useEffect)(() => {
|
|
2469
2455
|
if (!y2 || !e2 || !(t2 || i2) || !l2 || !u2 || !_2 || !i2 && Za(n2)) return;
|
|
2470
2456
|
let r2 = ++E2.current;
|
|
2471
|
-
return w2(true), (i2 ?
|
|
2457
|
+
return w2(true), (i2 ? Yc({ ...i2, range: _2, fromDate: u2, timeZone: l2 }) : Uc({ serviceId: t2, serviceType: n2, range: _2, fromDate: u2, timeZone: l2, locationId: d2 ?? void 0, staffId: f2 ?? void 0, customerChoices: m2, minRemainingCapacity: h2 })).then((e3) => {
|
|
2472
2458
|
r2 === E2.current && (S2(e3), ee2(false), w2(false));
|
|
2473
2459
|
}).catch((e3) => {
|
|
2474
2460
|
r2 === E2.current && ($(e3, { feature: Q.timeSlots, action: `fetch-days-availability`, level: `warning` }), ee2(true), w2(false));
|
|
@@ -2478,26 +2464,22 @@ function tl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
|
|
|
2478
2464
|
}, [y2, e2, t2, n2, i2, l2, u2, _2, d2, f2, m2, h2]);
|
|
2479
2465
|
let D2 = (0, import_react.useCallback)(async (e3) => {
|
|
2480
2466
|
Ro(e3) && (v2(e3), b2(true));
|
|
2481
|
-
}, []), O2 = (0, import_react.useCallback)(async () => {
|
|
2482
|
-
v2((e3) => e3 && Uo(e3, 1)), b2(true);
|
|
2483
|
-
}, []), te2 = (0, import_react.useCallback)(async () => {
|
|
2484
|
-
v2((e3) => e3 && Uo(e3, -1)), b2(true);
|
|
2485
2467
|
}, []);
|
|
2486
|
-
return { range: _2, daysAvailability: (0, import_react.useMemo)(() => g2 ? x2.map((e3) => e3.availability === `unavailable` ? { ...e3, availability: `none` } : e3) : x2, [x2, g2]), isLoading: C2, hasError: T2, setRange: D2
|
|
2468
|
+
return { range: _2, daysAvailability: (0, import_react.useMemo)(() => g2 ? x2.map((e3) => e3.availability === `unavailable` ? { ...e3, availability: `none` } : e3) : x2, [x2, g2]), isLoading: C2, hasError: T2, setRange: D2 };
|
|
2487
2469
|
}
|
|
2488
|
-
function
|
|
2489
|
-
let [g2, _2] = (0, import_react.useState)(null), [v2, y2] = (0, import_react.useState)(0), [b2, x2] = (0, import_react.useState)(null), [S2, C2] = (0, import_react.useState)(null), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(false), D2 = (0, import_react.useRef)(0),
|
|
2490
|
-
|
|
2470
|
+
function el({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest: i2, timeZone: o2, today: l2, locationId: u2, staffId: d2, customerChoices: f2, minRemainingCapacity: p2, onlyAvailableSlots: m2, serviceLoading: h2 }) {
|
|
2471
|
+
let [g2, _2] = (0, import_react.useState)(null), [v2, y2] = (0, import_react.useState)(0), [b2, x2] = (0, import_react.useState)(null), [S2, C2] = (0, import_react.useState)(null), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(false), D2 = (0, import_react.useRef)(0), te2 = (0, import_react.useRef)(0), ne2 = (0, import_react.useRef)(0), O2 = (0, import_react.useCallback)(() => {
|
|
2472
|
+
te2.current += 1, E2(false);
|
|
2491
2473
|
}, []);
|
|
2492
2474
|
(0, import_react.useEffect)(() => {
|
|
2493
|
-
|
|
2494
|
-
}, [e2, t2, n2, i2, o2, u2, d2, f2, p2,
|
|
2495
|
-
let
|
|
2475
|
+
O2();
|
|
2476
|
+
}, [e2, t2, n2, i2, o2, u2, d2, f2, p2, O2]);
|
|
2477
|
+
let k2 = e2 && !h2 && !t2 && !i2;
|
|
2496
2478
|
(0, import_react.useEffect)(() => {
|
|
2497
|
-
|
|
2498
|
-
}, [
|
|
2479
|
+
k2 && (C2(null), T2(null));
|
|
2480
|
+
}, [k2]), (0, import_react.useEffect)(() => {
|
|
2499
2481
|
if (!g2) return;
|
|
2500
|
-
if (
|
|
2482
|
+
if (k2) {
|
|
2501
2483
|
_2(null);
|
|
2502
2484
|
return;
|
|
2503
2485
|
}
|
|
@@ -2513,7 +2495,7 @@ function nl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
|
|
|
2513
2495
|
let r2 = No(new Date(Date.now()), o2), a2 = ++D2.current;
|
|
2514
2496
|
x2(null), C2(null), T2(null);
|
|
2515
2497
|
let s2 = r2.slice(0, 10) === g2.date ? r2 : void 0;
|
|
2516
|
-
return (i2 ?
|
|
2498
|
+
return (i2 ? Xc({ ...i2, date: g2.date, timeZone: o2, onlyAvailableSlots: m2, fromLocalDate: s2 }) : vs({ serviceId: t2, serviceType: n2, date: g2.date, timeZone: o2, onlyAvailableSlots: m2, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2, fromLocalDate: s2 })).then((e3) => {
|
|
2517
2499
|
a2 === D2.current && x2({ timeSlots: e3.timeSlots, timeZone: e3.timeZone ?? o2 });
|
|
2518
2500
|
}).catch((e3) => {
|
|
2519
2501
|
a2 === D2.current && ($(e3, { feature: Q.timeSlots, action: `fetch-day-time-slots`, level: `warning` }), C2(`timeSlotsLoadFailed`));
|
|
@@ -2521,58 +2503,58 @@ function nl({ enabled: e2, serviceId: t2, serviceType: n2, multiServiceRequest:
|
|
|
2521
2503
|
a2 === D2.current && (D2.current += 1);
|
|
2522
2504
|
};
|
|
2523
2505
|
}, [g2, v2, e2, t2, h2, n2, i2, o2, l2, u2, d2, f2, p2, m2]);
|
|
2524
|
-
let
|
|
2525
|
-
!i2 && Za(n2) || !Lo(e3) || l2 && e3 < l2 || (
|
|
2526
|
-
}, [n2, i2, l2,
|
|
2506
|
+
let re2 = (0, import_react.useCallback)(async (e3) => {
|
|
2507
|
+
!i2 && Za(n2) || !Lo(e3) || l2 && e3 < l2 || (O2(), y2((e4) => e4 + 1), _2({ kind: `day`, date: e3 }));
|
|
2508
|
+
}, [n2, i2, l2, O2]), ie2 = g2?.date ?? null, A2 = (0, import_react.useCallback)(async () => {
|
|
2527
2509
|
let r2 = !!(t2 || i2);
|
|
2528
2510
|
if (!i2 && Za(n2) || !e2 || !r2 || !o2) return { outcome: `none` };
|
|
2529
|
-
let a2 = D2.current, s2 = ++
|
|
2511
|
+
let a2 = D2.current, s2 = ++te2.current, c2 = ++ne2.current, m3 = () => a2 === D2.current && s2 === te2.current;
|
|
2530
2512
|
E2(true), T2(null);
|
|
2531
2513
|
try {
|
|
2532
|
-
let e3 =
|
|
2514
|
+
let e3 = ie2 ?? l2 ?? void 0, r3 = i2 ? await Zc({ ...i2, timeZone: o2, fromDate: e3 }) : await gs({ serviceId: t2, serviceType: n2, timeZone: o2, limit: 1, onlyAvailableSlots: true, fromDate: e3, locationId: u2 ?? void 0, staffId: d2 ?? void 0, customerChoices: f2, minRemainingCapacity: p2 });
|
|
2533
2515
|
if (!m3()) return { outcome: `cancelled` };
|
|
2534
2516
|
let a3 = r3.timeSlots[0]?.localStartDate?.slice(0, 10) ?? null;
|
|
2535
2517
|
return a3 ? { outcome: `found`, date: a3 } : { outcome: `none` };
|
|
2536
2518
|
} catch (e3) {
|
|
2537
2519
|
return m3() ? ($(e3, { feature: Q.timeSlots, action: `find-next-available-date`, level: `warning` }), T2(`timeSlotsLoadFailed`), { outcome: `error` }) : { outcome: `cancelled` };
|
|
2538
2520
|
} finally {
|
|
2539
|
-
c2 ===
|
|
2521
|
+
c2 === ne2.current && E2(false);
|
|
2540
2522
|
}
|
|
2541
|
-
}, [e2, t2, n2, i2, o2, l2, u2, d2, f2, p2,
|
|
2542
|
-
return { query: g2, selectedDate:
|
|
2523
|
+
}, [e2, t2, n2, i2, o2, l2, u2, d2, f2, p2, ie2]), ae2 = w2 ?? S2;
|
|
2524
|
+
return { query: g2, selectedDate: ie2, timeSlots: b2?.timeSlots ?? null, timeZone: b2?.timeZone ?? null, isLoading: ee2 || g2 !== null && b2 === null && S2 === null, error: ae2, selectDate: re2, findNextAvailableDate: A2 };
|
|
2543
2525
|
}
|
|
2544
|
-
var
|
|
2545
|
-
function
|
|
2526
|
+
var tl = (e2) => e2?.type === `DATE_TIME`;
|
|
2527
|
+
function nl(e2) {
|
|
2546
2528
|
let t2 = e2.schedule?.availabilityConstraints?.durations;
|
|
2547
2529
|
if (!Ya(e2.type) || !Array.isArray(t2)) return false;
|
|
2548
2530
|
let n2 = t2.map((e3) => typeof e3 == `number` ? e3 : e3?.minutes);
|
|
2549
2531
|
return new Set(n2).size > 1;
|
|
2550
2532
|
}
|
|
2551
|
-
function
|
|
2533
|
+
function rl({ service: e2, multiServiceAppointmentsEnabled: t2, variants: n2, locationId: r2 }) {
|
|
2552
2534
|
if (!Ya(e2.type)) return false;
|
|
2553
|
-
if (t2 ||
|
|
2554
|
-
if (!Qa(e2) ||
|
|
2555
|
-
let i2 =
|
|
2556
|
-
return r2 && i2 !== r2 ? true : !
|
|
2535
|
+
if (t2 || nl(e2) || $a(e2)) return true;
|
|
2536
|
+
if (!Qa(e2) || tl(n2)) return false;
|
|
2537
|
+
let i2 = ks(e2, r2);
|
|
2538
|
+
return r2 && i2 !== r2 ? true : !Es(n2, Os(e2), i2);
|
|
2557
2539
|
}
|
|
2558
|
-
function
|
|
2540
|
+
function il(e2, t2) {
|
|
2559
2541
|
return !!Pr(e2)?.services.some((e3) => e3.serviceId === t2);
|
|
2560
2542
|
}
|
|
2561
|
-
function
|
|
2562
|
-
return !t2.service._id ||
|
|
2543
|
+
function al({ blobParam: e2, ...t2 }) {
|
|
2544
|
+
return !t2.service._id || il(e2, t2.service._id) ? false : rl({ ...t2, multiServiceAppointmentsEnabled: false });
|
|
2563
2545
|
}
|
|
2564
|
-
function
|
|
2546
|
+
function ol(e2) {
|
|
2565
2547
|
return !!e2?._id;
|
|
2566
2548
|
}
|
|
2567
|
-
function
|
|
2549
|
+
function sl() {
|
|
2568
2550
|
try {
|
|
2569
2551
|
return (0, import_services_manager_react.useGetService)();
|
|
2570
2552
|
} catch {
|
|
2571
2553
|
return null;
|
|
2572
2554
|
}
|
|
2573
2555
|
}
|
|
2574
|
-
function
|
|
2575
|
-
let e2 =
|
|
2556
|
+
function cl() {
|
|
2557
|
+
let e2 = sl();
|
|
2576
2558
|
return (0, import_react.useCallback)((t2) => {
|
|
2577
2559
|
if (!e2) return false;
|
|
2578
2560
|
try {
|
|
@@ -2583,70 +2565,70 @@ function ul() {
|
|
|
2583
2565
|
}
|
|
2584
2566
|
}, [e2]);
|
|
2585
2567
|
}
|
|
2586
|
-
function
|
|
2587
|
-
let { service: t2, isLoading: n2, hasError: r2, bookingsSettingsLoading: i2, isLoadingServiceOptionsAndVariants: o2, pricingOption: c2, multiServiceAppointmentsEnabled: l2, isMultiServiceAppointment: d2, reschedule: f2, selection: p2, openPreferences: m2, editingSurface: h2 } = (0, import_service.useServiceContext)(), { searchParams: g2 } =
|
|
2568
|
+
function ll(e2) {
|
|
2569
|
+
let { service: t2, isLoading: n2, hasError: r2, bookingsSettingsLoading: i2, isLoadingServiceOptionsAndVariants: o2, pricingOption: c2, multiServiceAppointmentsEnabled: l2, isMultiServiceAppointment: d2, reschedule: f2, selection: p2, openPreferences: m2, editingSurface: h2 } = (0, import_service.useServiceContext)(), { searchParams: g2 } = vc(), _2 = cl(), v2 = Oc(Cc.PREFERENCES), y2 = (0, import_react.useRef)(false), b2 = e2 && !h2 && !n2 && !r2 && !i2 && !o2 && f2 == null && !d2 && ol(t2), x2 = p2.locationId ?? void 0, S2 = g2.get(eo.blob);
|
|
2588
2570
|
(0, import_react.useEffect)(() => {
|
|
2589
|
-
!y2.current && b2 && (y2.current = true, _2(Gr.CALENDAR_PAGE) &&
|
|
2571
|
+
!y2.current && b2 && (y2.current = true, _2(Gr.CALENDAR_PAGE) && al({ service: t2, multiServiceAppointmentsEnabled: l2, variants: c2, locationId: x2, blobParam: S2 }) && (Do({ message: `Calendar opens the preferences modal`, category: `navigation`, feature: Q.timeSlots, data: { serviceId: t2._id ?? null, serviceType: t2.type ?? null } }), v2(Ac({ action: Tc.EDIT_BASKET_ITEM_FROM_CALENDAR, numberOfServices: 1, isMultiFlow: l2 })), m2().then(() => Eo(`Preferences modal opened`, { feature: Q.timeSlots, action: `auto-open-preferences`, tags: { serviceType: t2.type ?? `unknown` } }), (e3) => $(e3, { feature: Q.timeSlots, action: `open-preferences-lightbox` }))));
|
|
2590
2572
|
}, [b2, t2, l2, c2, x2, S2, _2, v2, m2]);
|
|
2591
2573
|
}
|
|
2592
|
-
function
|
|
2574
|
+
function ul(e2, t2) {
|
|
2593
2575
|
return t2 === void 0 ? false : !e2 || new Date(e2).getTime() <= t2;
|
|
2594
2576
|
}
|
|
2595
|
-
function
|
|
2577
|
+
function dl({ serviceId: e2, serviceType: t2, lastSessionEnd: n2, timeZone: r2, now: i2, onlyAvailableSlots: a2, locationId: o2, staffId: s2, timeSlotLimitPerDay: c2, customerChoices: l2, minRemainingCapacity: u2 }) {
|
|
2596
2578
|
let d2 = { serviceId: e2, onlyAvailableSlots: a2, locationId: o2 ?? void 0, staffId: s2 ?? void 0, timeZone: r2, fromLocalDate: No(new Date(i2), r2) };
|
|
2597
|
-
return Xa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : Za(t2) ? !n2 ||
|
|
2579
|
+
return Xa(t2) ? { ...d2, serviceType: `CLASS`, minRemainingCapacity: u2 } : Za(t2) ? !n2 || ul(n2, i2) ? void 0 : { ...d2, serviceType: `COURSE`, toLocalDate: No(new Date(n2), r2) } : { ...d2, serviceType: `APPOINTMENT`, toLocalDate: hs().toLocalDate, timeSlotsPerDay: c2 + 1, customerChoices: l2 };
|
|
2598
2580
|
}
|
|
2599
|
-
function
|
|
2581
|
+
function fl({ isAppointment: e2, staffOnSlotCount: t2, hasStaffFilter: n2, hasRequestedGender: r2, hasStaffPricedVariants: i2, staffSelectionStrategy: a2 }) {
|
|
2600
2582
|
return e2 && t2 > 1 && !n2 && !i2 && (a2 !== `CUSTOMER_MUST_CHOOSE` || r2);
|
|
2601
2583
|
}
|
|
2602
|
-
function
|
|
2584
|
+
function pl(e2, t2) {
|
|
2603
2585
|
return e2.length ? e2.length === 1 ? { anyResource: false, staffMemberId: e2[0] } : t2 ? { anyResource: true } : null : null;
|
|
2604
2586
|
}
|
|
2605
|
-
function
|
|
2587
|
+
function ml(e2, t2, n2) {
|
|
2606
2588
|
return t2 && !t2.anyResource && e2.includes(t2.staffMemberId) ? { isComplete: true, resourceId: t2.staffMemberId } : t2?.anyResource && n2 ? { isComplete: true, resourceId: void 0 } : e2.length <= 1 ? { isComplete: true, resourceId: e2[0] } : { isComplete: n2, resourceId: void 0 };
|
|
2607
2589
|
}
|
|
2608
|
-
var
|
|
2609
|
-
function
|
|
2610
|
-
if (!e2) return
|
|
2590
|
+
var hl = { staff: null, requestedGender: null, locationId: null };
|
|
2591
|
+
function gl({ entry: e2, appointmentLike: t2, staffChoiceHidden: n2, staffPriced: r2, staffSelectionStrategy: i2, genderAllowed: a2, staffMemberIds: o2, locationIds: s2 }) {
|
|
2592
|
+
if (!e2) return hl;
|
|
2611
2593
|
let c2 = e2.locationId && s2.includes(e2.locationId) ? e2.locationId : null, l2 = t2 && !n2 ? oo(e2) : null;
|
|
2612
|
-
if (!l2) return { ...
|
|
2613
|
-
if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...
|
|
2594
|
+
if (!l2) return { ...hl, locationId: c2 };
|
|
2595
|
+
if (!l2.anyResource) return o2.includes(l2.staffMemberId) ? { staff: l2, requestedGender: null, locationId: c2 } : { ...hl, locationId: c2 };
|
|
2614
2596
|
let u2 = a2 ? e2.requestedGender ?? null : null;
|
|
2615
|
-
return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...
|
|
2597
|
+
return o2.length > 1 && !r2 && (i2 !== `CUSTOMER_MUST_CHOOSE` || u2 !== null) ? { staff: l2, requestedGender: u2, locationId: c2 } : { ...hl, locationId: c2 };
|
|
2616
2598
|
}
|
|
2617
|
-
var
|
|
2618
|
-
function
|
|
2619
|
-
let s2 =
|
|
2620
|
-
return { rows: t2 ? c2 :
|
|
2599
|
+
var _l = [];
|
|
2600
|
+
function vl({ sessions: e2, dayQuery: t2, daySlots: n2, staffFilter: r2, appointmentLike: i2, limitPerDay: a2, expandedDates: o2 }) {
|
|
2601
|
+
let s2 = Dl(Ol(e2, r2)), c2 = n2 ? Ol(i2 ? Xo(n2) : n2, r2) : _l;
|
|
2602
|
+
return { rows: t2 ? c2 : kl(s2, a2, o2), slotIdOf: t2 ? qo : Yo, daysWithMore: El(s2, a2, o2) };
|
|
2621
2603
|
}
|
|
2622
|
-
function
|
|
2623
|
-
return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) =>
|
|
2604
|
+
function yl({ rows: e2, slotIdOf: t2 }, n2) {
|
|
2605
|
+
return [...e2.filter((e3) => t2(e3) === n2)].sort((e3, t3) => Tl(t3) - Tl(e3))[0] ?? null;
|
|
2624
2606
|
}
|
|
2625
|
-
function
|
|
2626
|
-
return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? false, totalCapacity: e2.totalCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, bookableCapacity: e2.bookableCapacity ?? null, eventId: e2.eventInfo?.eventId ?? null, eventTitle: e2.eventInfo?.eventTitle ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, locationId: e2.location?._id ?? null, locationName: e2.location?.name || e2.location?.formattedAddress || null, durationMinutes:
|
|
2607
|
+
function bl(e2, t2, n2, r2) {
|
|
2608
|
+
return { slotId: n2(e2), slotStartTime: e2.localStartDate ?? null, slotEndTime: e2.localEndDate ?? null, bookable: e2.bookable ?? false, tooEarlyToBook: e2.bookingPolicyViolations?.tooEarlyToBook ?? false, tooLateToBook: e2.bookingPolicyViolations?.tooLateToBook ?? false, totalCapacity: e2.totalCapacity ?? null, remainingCapacity: e2.remainingCapacity ?? null, bookableCapacity: e2.bookableCapacity ?? null, eventId: e2.eventInfo?.eventId ?? null, eventTitle: e2.eventInfo?.eventTitle ?? null, waitlistCapacity: e2.eventInfo?.waitingList?.remainingCapacity ?? null, locationId: e2.location?._id ?? null, locationName: e2.location?.name || e2.location?.formattedAddress || null, durationMinutes: wl(e2, t2), isAllDay: e2.allDay ?? false, staff: r2 ? [] : xl(e2) };
|
|
2627
2609
|
}
|
|
2628
|
-
function
|
|
2610
|
+
function xl(e2) {
|
|
2629
2611
|
let t2 = /* @__PURE__ */ new Map();
|
|
2630
2612
|
for (let n2 of e2.availableResources ?? []) if (n2.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`) for (let e3 of n2.resources ?? []) e3._id && !t2.has(e3._id) && t2.set(e3._id, e3.name ?? ``);
|
|
2631
2613
|
return [...t2].map(([e3, t3]) => ({ staffMemberId: e3, name: t3 }));
|
|
2632
2614
|
}
|
|
2633
|
-
function
|
|
2634
|
-
let t2 =
|
|
2615
|
+
function Sl(e2) {
|
|
2616
|
+
let t2 = xl(e2);
|
|
2635
2617
|
if (t2.length) return t2.length === 1 ? t2[0].staffMemberId : null;
|
|
2636
2618
|
}
|
|
2637
|
-
function
|
|
2638
|
-
return
|
|
2619
|
+
function Cl(e2) {
|
|
2620
|
+
return xl(e2).map((e3) => e3.staffMemberId);
|
|
2639
2621
|
}
|
|
2640
|
-
function
|
|
2622
|
+
function wl(e2, t2) {
|
|
2641
2623
|
if (!e2.localStartDate || !e2.localEndDate) return null;
|
|
2642
|
-
let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 =
|
|
2624
|
+
let n2 = e2.allDay ? `UTC` : t2 ?? `UTC`, r2 = Nc(e2.localStartDate, n2), i2 = Nc(e2.localEndDate, n2);
|
|
2643
2625
|
return !r2 || !i2 || i2 < r2 ? null : Math.round((i2.getTime() - r2.getTime()) / 6e4);
|
|
2644
2626
|
}
|
|
2645
|
-
function
|
|
2627
|
+
function Tl(e2) {
|
|
2646
2628
|
let t2 = e2.bookableCapacity ?? e2.remainingCapacity;
|
|
2647
2629
|
return (e2.eventInfo?.waitingList?.remainingCapacity ?? 0) > 0 && (t2 ?? 0) <= 0 ? 1 : e2.bookable ? 2 : 0;
|
|
2648
2630
|
}
|
|
2649
|
-
function
|
|
2631
|
+
function El(e2, t2, n2) {
|
|
2650
2632
|
let r2 = /* @__PURE__ */ new Map();
|
|
2651
2633
|
for (let t3 of e2) {
|
|
2652
2634
|
let e3 = (t3.localStartDate ?? ``).slice(0, 10);
|
|
@@ -2654,16 +2636,16 @@ function Ol(e2, t2, n2) {
|
|
|
2654
2636
|
}
|
|
2655
2637
|
return new Set([...r2].filter(([e3, r3]) => r3 > t2 && !n2.has(e3)).map(([e3]) => e3));
|
|
2656
2638
|
}
|
|
2657
|
-
function
|
|
2639
|
+
function Dl(e2) {
|
|
2658
2640
|
return e2.flatMap((e3) => {
|
|
2659
2641
|
let t2 = e3.availableResources?.find((e4) => e4.resourceTypeId === Wr), n2 = t2?.resources ?? [];
|
|
2660
2642
|
return n2.length <= 1 ? [e3] : n2.map((n3) => ({ ...e3, availableResources: [{ ...t2, resources: [n3] }] }));
|
|
2661
2643
|
});
|
|
2662
2644
|
}
|
|
2663
|
-
function
|
|
2645
|
+
function Ol(e2, t2) {
|
|
2664
2646
|
return t2 ? e2.map((e3) => ({ ...e3, availableResources: e3.availableResources?.map((e4) => e4.resourceTypeId === `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155` ? { ...e4, resources: e4.resources?.filter((e5) => e5._id === t2) } : e4) })) : e2;
|
|
2665
2647
|
}
|
|
2666
|
-
function
|
|
2648
|
+
function kl(e2, t2, n2) {
|
|
2667
2649
|
let r2 = /* @__PURE__ */ new Map();
|
|
2668
2650
|
return e2.filter((e3) => {
|
|
2669
2651
|
let i2 = (e3.localStartDate ?? ``).slice(0, 10);
|
|
@@ -2672,24 +2654,24 @@ function jl(e2, t2, n2) {
|
|
|
2672
2654
|
return r2.set(i2, a2 + 1), a2 < t2;
|
|
2673
2655
|
});
|
|
2674
2656
|
}
|
|
2675
|
-
async function
|
|
2657
|
+
async function Al() {
|
|
2676
2658
|
try {
|
|
2677
|
-
return await
|
|
2659
|
+
return await Ko();
|
|
2678
2660
|
} catch (e2) {
|
|
2679
2661
|
return $(e2, { feature: Q.timeSlots, action: `fetch-business-time-zone`, level: `warning` }), { businessTimeZone: null, staffSelectionStrategy: void 0, allowGenderSelection: false };
|
|
2680
2662
|
}
|
|
2681
2663
|
}
|
|
2682
|
-
function
|
|
2683
|
-
return
|
|
2664
|
+
function jl(e2) {
|
|
2665
|
+
return Xs({ key: zs(), warmupData: e2, fetchData: Al });
|
|
2684
2666
|
}
|
|
2685
|
-
function
|
|
2667
|
+
function Ml(e2) {
|
|
2686
2668
|
return (e2.localStartDate ?? ``).slice(0, 10);
|
|
2687
2669
|
}
|
|
2688
|
-
var
|
|
2689
|
-
function
|
|
2690
|
-
let { serviceId: n2 = ``, serviceType: r2 = `CLASS`, fromLocalDate: i2 = ``, toLocalDate: o2, timeZone: l2, locationId: u2, staffId: d2, onlyAvailableSlots: f2 = false, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2 } = t2 ?? {}, [g2, _2] = (0, import_react.useState)([]), [v2, y2] = (0, import_react.useState)([]), [b2, x2] = (0, import_react.useState)(1), [S2, C2] = (0, import_react.useState)(!!n2), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(null), [D2,
|
|
2670
|
+
var Nl = [];
|
|
2671
|
+
function Pl(e2, t2) {
|
|
2672
|
+
let { serviceId: n2 = ``, serviceType: r2 = `CLASS`, fromLocalDate: i2 = ``, toLocalDate: o2, timeZone: l2, locationId: u2, staffId: d2, onlyAvailableSlots: f2 = false, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2 } = t2 ?? {}, [g2, _2] = (0, import_react.useState)([]), [v2, y2] = (0, import_react.useState)([]), [b2, x2] = (0, import_react.useState)(1), [S2, C2] = (0, import_react.useState)(!!n2), [w2, T2] = (0, import_react.useState)(null), [ee2, E2] = (0, import_react.useState)(null), [D2, te2] = (0, import_react.useState)(/* @__PURE__ */ new Set()), [ne2, O2] = (0, import_react.useState)(null), k2 = (0, import_react.useRef)(null), re2 = (0, import_react.useRef)(null);
|
|
2691
2673
|
(0, import_react.useEffect)(() => {
|
|
2692
|
-
if (_2([]), y2([]), x2(1), E2(null), T2(null),
|
|
2674
|
+
if (_2([]), y2([]), x2(1), E2(null), T2(null), te2(/* @__PURE__ */ new Set()), O2(null), C2(!!n2), !n2) return;
|
|
2693
2675
|
let t3 = false, a2 = false, s2 = [], c2 = [];
|
|
2694
2676
|
async function g3(g4) {
|
|
2695
2677
|
if (t3 || a2) return;
|
|
@@ -2704,7 +2686,7 @@ function Il(e2, t2) {
|
|
|
2704
2686
|
let a3 = [], b3 = null, S3 = v4 ?? void 0, C3 = /* @__PURE__ */ new Set();
|
|
2705
2687
|
do {
|
|
2706
2688
|
S3 && C3.add(S3);
|
|
2707
|
-
let s3 = await
|
|
2689
|
+
let s3 = await ds({ serviceId: n2, serviceType: r2, fromLocalDate: i2, toLocalDate: o2, timeZone: l2, locationId: u2, staffId: d2, onlyAvailableSlots: f2, customerChoices: p2, minRemainingCapacity: m2, timeSlotsPerDay: h2, limit: e2, cursor: S3 });
|
|
2708
2690
|
if (t3) return;
|
|
2709
2691
|
if (a3.push(...s3.timeSlots), b3 = s3.nextCursor, b3 && C3.has(b3)) throw Error(`The session API repeated a page cursor`);
|
|
2710
2692
|
S3 = b3 ?? void 0, E2(s3.timeZone ?? l2 ?? null);
|
|
@@ -2721,200 +2703,199 @@ function Il(e2, t2) {
|
|
|
2721
2703
|
async function v3(e3) {
|
|
2722
2704
|
if (!(t3 || a2)) {
|
|
2723
2705
|
if (h2 == null) {
|
|
2724
|
-
|
|
2706
|
+
te2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
|
|
2725
2707
|
return;
|
|
2726
2708
|
}
|
|
2727
|
-
a2 = true,
|
|
2709
|
+
a2 = true, O2(e3), T2(null);
|
|
2728
2710
|
try {
|
|
2729
|
-
let a3 = await
|
|
2711
|
+
let a3 = await vs({ serviceId: n2, serviceType: r2, date: e3, timeZone: l2, onlyAvailableSlots: f2, locationId: u2, staffId: d2, customerChoices: p2, minRemainingCapacity: m2, fromLocalDate: i2, toLocalDate: o2 });
|
|
2730
2712
|
if (t3) return;
|
|
2731
|
-
let c3 = a3.timeSlots.filter((t4) =>
|
|
2713
|
+
let c3 = a3.timeSlots.filter((t4) => Ml(t4) === e3), h3 = Math.max(0, s2.findIndex((t4) => t4.some((t5) => Ml(t5) === e3)));
|
|
2732
2714
|
s2 = s2.map((t4, n3) => {
|
|
2733
|
-
let r3 = t4.filter((t5) =>
|
|
2715
|
+
let r3 = t4.filter((t5) => Ml(t5) !== e3);
|
|
2734
2716
|
return n3 === h3 ? [...r3, ...c3] : r3;
|
|
2735
|
-
}), _2(s2),
|
|
2717
|
+
}), _2(s2), te2((t4) => /* @__PURE__ */ new Set([...t4, e3]));
|
|
2736
2718
|
} catch (e4) {
|
|
2737
2719
|
if (t3) return;
|
|
2738
2720
|
$(e4, { feature: Q.sessions, action: `fetch-day` }), T2(e4 instanceof Error ? e4.message : `Failed to load sessions`);
|
|
2739
2721
|
} finally {
|
|
2740
|
-
a2 = false, t3 ||
|
|
2722
|
+
a2 = false, t3 || O2(null);
|
|
2741
2723
|
}
|
|
2742
2724
|
}
|
|
2743
2725
|
}
|
|
2744
|
-
return
|
|
2745
|
-
t3 = true,
|
|
2726
|
+
return k2.current = g3, re2.current = v3, g3(1), () => {
|
|
2727
|
+
t3 = true, k2.current = null, re2.current = null;
|
|
2746
2728
|
};
|
|
2747
2729
|
}, [n2, r2, i2, o2, l2, u2, d2, f2, p2, m2, h2, e2]);
|
|
2748
|
-
let
|
|
2749
|
-
async function
|
|
2750
|
-
|
|
2730
|
+
let ie2 = [...g2[b2 - 1] ?? Nl].sort((e3, t3) => (e3.localStartDate ?? ``).localeCompare(t3.localStartDate ?? ``)), A2 = g2[b2], ae2 = A2 ? A2.length > 0 : v2[b2 - 1] != null, j2 = b2 > 1;
|
|
2731
|
+
async function oe2() {
|
|
2732
|
+
ae2 && !S2 && await k2.current?.(b2 + 1);
|
|
2751
2733
|
}
|
|
2752
|
-
function
|
|
2753
|
-
|
|
2734
|
+
function M2() {
|
|
2735
|
+
j2 && !S2 && k2.current?.(b2 - 1);
|
|
2754
2736
|
}
|
|
2755
2737
|
async function se2(e3) {
|
|
2756
|
-
S2 ||
|
|
2738
|
+
S2 || ne2 !== null || D2.has(e3) || await re2.current?.(e3);
|
|
2757
2739
|
}
|
|
2758
|
-
return { isLoadingPage: S2, firstPageSettled: g2.length > 0 || w2 !== null, error: w2, timeZone: ee2, sessions:
|
|
2740
|
+
return { isLoadingPage: S2, firstPageSettled: g2.length > 0 || w2 !== null, error: w2, timeZone: ee2, sessions: ie2, pageSize: e2, currentPage: b2, hasNextPage: ae2, hasPreviousPage: j2, nextPage: oe2, previousPage: M2, expandedDates: D2, loadingDate: ne2, loadAllSessionsForDay: se2 };
|
|
2759
2741
|
}
|
|
2760
|
-
var
|
|
2761
|
-
function
|
|
2742
|
+
var Fl = (e2) => e2?.onlineBooking?.enabled === true;
|
|
2743
|
+
function Il(e2, t2) {
|
|
2762
2744
|
return e2 ? e2.anyResource ? t2 ?? `` : e2.staffMemberId : null;
|
|
2763
2745
|
}
|
|
2764
|
-
var
|
|
2765
|
-
var
|
|
2766
|
-
var
|
|
2767
|
-
var
|
|
2768
|
-
var Ul = () => {
|
|
2746
|
+
var Ll = [];
|
|
2747
|
+
var Rl = [];
|
|
2748
|
+
var zl = cn.map((e2) => ({ id: e2, gender: e2 }));
|
|
2749
|
+
var Bl = () => {
|
|
2769
2750
|
};
|
|
2770
|
-
var
|
|
2751
|
+
var Vl = async () => {
|
|
2771
2752
|
};
|
|
2772
|
-
var
|
|
2773
|
-
function
|
|
2774
|
-
let e2 = (0, import_react.useContext)(
|
|
2753
|
+
var Hl = (0, import_react.createContext)(null);
|
|
2754
|
+
function Ul() {
|
|
2755
|
+
let e2 = (0, import_react.useContext)(Hl);
|
|
2775
2756
|
if (!e2) throw Error(`useTimeSlotsContext must be used within TimeSlotsContextProvider`);
|
|
2776
2757
|
return e2;
|
|
2777
2758
|
}
|
|
2778
|
-
function
|
|
2759
|
+
function Wl(e2, t2, n2) {
|
|
2779
2760
|
e2 ? t2() : n2();
|
|
2780
2761
|
}
|
|
2781
|
-
var
|
|
2782
|
-
function
|
|
2783
|
-
return Math.min(Math.max(e2, 1),
|
|
2762
|
+
var Gl = { loginRequired: `rescheduleLoginRequired`, notFound: `rescheduleNotFound`, accessDenied: `rescheduleAccessDenied`, failed: `rescheduleNotFound`, wrongService: `rescheduleNotFound`, notReschedulable: `rescheduleNotReschedulable` };
|
|
2763
|
+
function Kl(e2 = 3) {
|
|
2764
|
+
return Math.min(Math.max(e2, 1), sc);
|
|
2784
2765
|
}
|
|
2785
|
-
function
|
|
2766
|
+
function ql(e2) {
|
|
2786
2767
|
let { isLoading: n2, bookingsSettingsLoading: r2 } = (0, import_service.useServiceContext)();
|
|
2787
|
-
|
|
2788
|
-
let i2 =
|
|
2789
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2768
|
+
kc(Cc.TIME_SLOTS, !n2 && !r2);
|
|
2769
|
+
let i2 = Is(), [a2] = (0, import_react.useState)(() => jl(i2));
|
|
2770
|
+
return (0, import_jsx_runtime.jsx)(oc, { children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Ic, { nextAvailableSlotsCount: Kl(e2.nextAvailableSlotsCount), children: e2.children }), children: (0, import_jsx_runtime.jsx)(Yl, { ...e2, configurationPromise: a2 }) }) });
|
|
2790
2771
|
}
|
|
2791
|
-
function
|
|
2772
|
+
function Jl(e2) {
|
|
2792
2773
|
let [t2, n2] = (0, import_react.useState)({ serviceId: e2, key: 0 });
|
|
2793
2774
|
return e2 !== t2.serviceId && n2({ serviceId: e2, key: t2.serviceId ? t2.key + 1 : t2.key }), t2.key;
|
|
2794
2775
|
}
|
|
2795
|
-
function
|
|
2796
|
-
let s2 =
|
|
2776
|
+
function Yl({ onlyAvailableSlots: e2 = true, nextAvailableSlotsCount: t2 = 3, loadDaysAvailabilityInitially: n2 = false, timeSlotLimitPerDay: r2 = 100, configurationPromise: i2, children: o2 }) {
|
|
2777
|
+
let s2 = nc().isLoading, { searchParams: d2 } = vc(), { reschedule: f2 } = (0, import_service.useServiceContext)(), [m2] = (0, import_react.useState)(() => ({ locationId: d2.get(eo.location), staffId: d2.get(eo.resource), timeZone: (f2 ? void 0 : Pr(d2.get(eo.blob))?.timezone) ?? d2.get(eo.timezone) })), [h2, g2] = (0, import_react.useState)(m2.timeZone), _2 = Kl(t2), [v2, y2] = (0, import_react.useState)(false);
|
|
2797
2778
|
(0, import_react.useEffect)(() => y2(true), []);
|
|
2798
2779
|
let b2 = v2 && !s2;
|
|
2799
|
-
|
|
2800
|
-
let x2 =
|
|
2801
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2780
|
+
ll(b2);
|
|
2781
|
+
let x2 = js(i2), S2 = (0, import_react.useSyncExternalStore)(os, as, () => false), { serviceId: C2 } = (0, import_service.useServiceContext)(), w2 = Jl(C2), T2 = Number.isFinite(r2) ? Math.max(1, Math.floor(r2)) : 100;
|
|
2782
|
+
return (0, import_jsx_runtime.jsx)(cc, { fallback: (0, import_jsx_runtime.jsx)(Lc, { nextAvailableSlotsCount: _2, children: o2 }), feature: Q.timeSlots, children: (0, import_jsx_runtime.jsx)(Xl, { onlyAvailableSlots: e2, selectedTimeZone: h2, setSelectedTimeZone: g2, enabled: b2, nextAvailableSlotsCount: _2, loadDaysAvailabilityInitially: n2, timeSlotLimitPerDay: T2, landingLocationId: m2.locationId, landingStaffId: m2.staffId, businessTimeZone: x2.businessTimeZone, staffSelectionStrategy: x2.staffSelectionStrategy, allowGenderSelection: x2.allowGenderSelection, requestedGenderRejected: S2, children: o2 }) }, w2);
|
|
2802
2783
|
}
|
|
2803
|
-
function
|
|
2804
|
-
let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: ee2, clearMultiServiceSlot: E2, draftRevision: D2, navigateToMultiServiceForm:
|
|
2784
|
+
function Xl({ onlyAvailableSlots: e2, selectedTimeZone: t2, setSelectedTimeZone: n2, enabled: i2, nextAvailableSlotsCount: l2, loadDaysAvailabilityInitially: d2, timeSlotLimitPerDay: f2, landingLocationId: m2, landingStaffId: h2, businessTimeZone: g2, staffSelectionStrategy: _2, allowGenderSelection: v2, requestedGenderRejected: y2, children: b2 }) {
|
|
2785
|
+
let { service: x2, serviceId: S2, serviceType: C2, setSlot: w2, clearSlot: T2, setMultiServiceSlot: ee2, clearMultiServiceSlot: E2, draftRevision: D2, navigateToMultiServiceForm: te2, selection: ne2, selectStaffMember: O2, clearSelection: k2, clearStaffMember: re2, withSelectionParam: ie2, staffMembers: A2, serviceOptionsAndVariants: ae2, isLoading: j2, hasError: oe2, multiServiceAppointmentServices: M2 = Rl, reschedule: se2 } = (0, import_service.useServiceContext)(), N2 = se2 != null, ce2 = N2 && se2.status !== `ready`, le2 = N2 && se2.status === `loading`, ue2 = N2 ? Gl[se2.status] : void 0, de2 = ce2 ? null : se2?.booking ?? null, fe2 = de2 ? se2.validUntil : null, pe2 = ol(x2) && !Fl(x2), P2 = pe2 || ce2 ? null : S2, me2 = vc(), he2 = N2 ? null : me2.searchParams.get(eo.blob), ge2 = (0, import_react.useMemo)(() => io(Pr(he2)), [he2]), F2 = !S2 && !j2 && !oe2 && (ge2.valid || ge2.reason !== `too-few-services`), _e2 = F2 && ge2.valid && M2.some((e3) => !Fl(e3) && ge2.services.some((t3) => t3.serviceId === e3._id)), ve2 = pe2 || _e2, ye2 = F2 && ge2.valid && !_e2 ? ge2.requestKey : null, be2 = (0, import_react.useMemo)(() => ye2 && ge2.valid ? { services: ge2.services, locationId: ge2.locationId, locationType: ge2.locationType } : null, [ye2]), xe2 = !!P2 || be2 !== null, Se2 = P2 || ye2, Ce2 = i2 && !j2 && !oe2 && !xe2 && !le2, we2 = ic(), Te2 = nc(), { navigate: Ee2, resolvePath: De2 } = go(), [Oe2, ke2] = (0, import_react.useState)(null), [Ae2, je2] = (0, import_react.useState)(false), Me2 = (0, import_react.useRef)([]), Ne2 = (0, import_react.useRef)(false), Pe2 = (0, import_react.useCallback)(() => (je2(true), Ne2.current ? Promise.resolve() : new Promise((e3) => {
|
|
2805
2786
|
Me2.current.push(e3);
|
|
2806
|
-
})), []), Fe2 = i2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Ie2 = Ja(x2), Le2 = (0, import_react.useRef)(null), Re2 = oo(
|
|
2787
|
+
})), []), Fe2 = i2 ? Intl.DateTimeFormat().resolvedOptions().timeZone : null, Ie2 = Ja(x2), Le2 = (0, import_react.useRef)(null), Re2 = oo(ne2), ze2 = (0, import_react.useRef)(Re2);
|
|
2807
2788
|
ze2.current = Re2;
|
|
2808
|
-
let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 =
|
|
2789
|
+
let Be2 = Re2 && !Re2.anyResource ? Re2.staffMemberId : null, Ve2 = ne2.requestedGender ?? null, I2 = !Xa(C2) && !Za(C2), He2 = I2 && !F2 && bs(ae2), L2 = F2 || I2 && _2 === `CUSTOMER_CANNOT_CHOOSE`, Ue2 = _2 !== void 0, We2 = Go({ allowGenderSelection: v2, staffSelectionStrategy: _2 ?? null }) && I2 && !F2 && !He2, Ge2 = We2 && !y2, Ke2 = (0, import_react.useMemo)(() => P2 ? Pr(he2)?.services.find((e3) => e3.serviceId === P2) ?? null : null, [he2, P2]), qe2 = (A2 ?? []).map((e3) => e3.staffMemberId).join(`,`), Je2 = Ie2.map((e3) => e3.id).join(`,`), Ye2 = (0, import_react.useMemo)(() => gl({ entry: Ke2, appointmentLike: I2, staffChoiceHidden: L2, staffPriced: He2, staffSelectionStrategy: _2, genderAllowed: Ge2, staffMemberIds: qe2.split(`,`), locationIds: Je2.split(`,`) }), [Ke2, I2, L2, He2, _2, Ge2, qe2, Je2]), R2 = Ye2.staff, Xe2 = Ye2.locationId, Ze2 = L2 || R2 !== null, [Qe2, $e2] = (0, import_react.useState)(null), [et2, tt2] = (0, import_react.useState)(m2 !== null || N2), z2 = (0, import_react.useMemo)(() => x2 ? Os(x2) : [], [x2]), nt2 = R2 && !R2.anyResource ? R2.staffMemberId : null, rt2 = (0, import_react.useMemo)(() => {
|
|
2809
2790
|
if (!nt2) return z2;
|
|
2810
2791
|
let e3 = z2.find((e4) => e4.staffMemberId === nt2);
|
|
2811
2792
|
return e3 ? [e3] : z2;
|
|
2812
2793
|
}, [z2, nt2]), it2 = de2?.locationId ?? null, at2 = (0, import_react.useMemo)(() => {
|
|
2813
|
-
let e3 =
|
|
2794
|
+
let e3 = Ds(Ie2, rt2);
|
|
2814
2795
|
return !it2 || e3.some((e4) => e4.id === it2) ? e3 : Ie2.filter((t3) => t3.id === it2 || e3.some((e4) => e4.id === t3.id));
|
|
2815
|
-
}, [x2, rt2, it2]), ot2 = (e3) => !!e3 && at2.some((t3) => t3.id === e3), st2 = Qe2 ?? (et2 ? ot2(it2) ? it2 : m2 : null), ct2 = Ie2.length > 1 && at2.length === 1 ? at2[0].id : null, B2 = Xe2 ?? (ot2(st2) ? st2 : ct2), lt2 = (0, import_react.useMemo)(() => Xe2 ? [] : at2.map((e3) => ({ id: e3.id, name: e3.label })), [at2, Xe2]), ut2 = (0, import_react.useMemo)(() => new Map(z2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [z2]), dt2 = (0, import_react.useCallback)((e3, t3) =>
|
|
2796
|
+
}, [x2, rt2, it2]), ot2 = (e3) => !!e3 && at2.some((t3) => t3.id === e3), st2 = Qe2 ?? (et2 ? ot2(it2) ? it2 : m2 : null), ct2 = Ie2.length > 1 && at2.length === 1 ? at2[0].id : null, B2 = Xe2 ?? (ot2(st2) ? st2 : ct2), lt2 = (0, import_react.useMemo)(() => Xe2 ? [] : at2.map((e3) => ({ id: e3.id, name: e3.label })), [at2, Xe2]), ut2 = (0, import_react.useMemo)(() => new Map(z2.map((e3) => [e3.staffMemberId, e3.locationCoverage])), [z2]), dt2 = (0, import_react.useCallback)((e3, t3) => ws([{ staffMemberId: e3, locationCoverage: ut2.get(e3) }], t3).length === 1, [ut2]), ft2 = (0, import_react.useMemo)(() => Ze2 ? [] : (A2 ?? []).filter((e3) => e3.name).map((e3) => ({ id: e3.staffMemberId, name: e3.name ?? ``, gender: null })), [A2, Ze2]), pt2 = (0, import_react.useMemo)(() => B2 ? ft2.filter((e3) => dt2(e3.id, B2)) : ft2, [ft2, B2, dt2]), mt2 = I2 && !Ue2 ? Ll : pt2, ht2 = I2 && !Ue2 ? 0 : ft2.length, gt2 = Ge2 && ht2 > 1, _t2 = (0, import_react.useMemo)(() => gt2 ? [...zl, ...mt2] : mt2, [gt2, mt2]), [vt2, yt2] = (0, import_react.useState)(null), [bt2, xt2] = (0, import_react.useState)(h2 !== null);
|
|
2816
2797
|
bt2 && h2 !== null && B2 !== null && !dt2(h2, B2) && xt2(false);
|
|
2817
2798
|
let St2 = vt2 ?? (bt2 ? h2 : null), V2 = R2 ? R2.anyResource ? null : R2.staffMemberId : St2 !== null && pt2.some((e3) => e3.id === St2) ? St2 : null, Ct2 = Re2?.anyResource ? Ve2 : null, [wt2, Tt2] = (0, import_react.useState)(Ct2), [Et2, Dt2] = (0, import_react.useState)(Ct2);
|
|
2818
2799
|
!y2 && Re2?.anyResource && Ve2 !== Et2 && (Dt2(Ve2), Tt2(Ve2));
|
|
2819
2800
|
let Ot2 = R2 ? Ye2.requestedGender : We2 && ht2 > 1 && V2 === null ? wt2 : null, kt2 = y2 ? null : Ot2, At2 = (0, import_react.useCallback)((e3) => {
|
|
2820
|
-
ze2.current = e3, e3 ? e3.anyResource ?
|
|
2821
|
-
}, [
|
|
2801
|
+
ze2.current = e3, e3 ? e3.anyResource ? k2(kt2 ?? void 0) : O2(e3.staffMemberId) : re2();
|
|
2802
|
+
}, [re2, k2, O2, kt2]), jt2 = (0, import_react.useCallback)((e3) => At2(e3 ? { anyResource: false, staffMemberId: e3 } : { anyResource: true }), [At2]), Mt2 = (de2?.addOnIds ?? []).filter((e3) => x2?.addOnGroups?.some((t3) => t3.addOnIds?.includes(e3))), Nt2 = de2 && Xa(C2) ? de2.participants : null, Pt2 = I2 ? to(ne2) : null, { addOnIds: Ft2, ...It2 } = Pt2 ?? {}, Lt2 = I2 && de2 ? Mt2.length ? { ...It2, addOnIds: Mt2 } : It2 : Pt2, Rt2 = Lt2 ? $o(Lt2) : void 0, zt2 = JSON.stringify(Ot2 ? { ...Rt2, requestedGender: { gender: Ot2 } } : Rt2 ?? null), Bt2 = (0, import_react.useMemo)(() => JSON.parse(zt2), [zt2]), Vt2 = R2?.anyResource === true, Ht2 = (0, import_react.useCallback)((e3) => Vt2 || _2 !== void 0 && fl({ isAppointment: I2, staffOnSlotCount: e3, hasStaffFilter: V2 !== null, hasRequestedGender: kt2 !== null, hasStaffPricedVariants: He2, staffSelectionStrategy: _2 }), [Vt2, I2, _2, V2, kt2, He2]), Ut2 = (0, import_react.useCallback)((e3) => R2 ?? (L2 ? null : e3), [R2, L2]), Wt2 = (0, import_react.useCallback)((e3) => {
|
|
2822
2803
|
let t3 = e3 === null ? null : _t2.find((t4) => t4.id === e3);
|
|
2823
2804
|
t3 !== void 0 && (xt2(false), yt2(t3 && !t3.gender ? t3.id : null), Tt2(t3?.gender ?? null));
|
|
2824
2805
|
}, [_t2]), Gt2 = (0, import_react.useCallback)((e3) => {
|
|
2825
2806
|
(e3 === null || at2.some((t3) => t3.id === e3)) && (tt2(false), $e2(e3), St2 !== null && e3 !== null && !dt2(St2, e3) && (yt2(null), xt2(false)));
|
|
2826
2807
|
}, [at2, St2, dt2]), Kt2 = !!(i2 && !Te2.isLoading && Te2.displayTimeZonePolicy.customerCanChange && g2 && Fe2 && g2 !== Fe2), H2 = i2 ? Kt2 && t2 && (t2 === g2 || t2 === Fe2) ? t2 : we2 ?? g2 ?? Fe2 : null, qt2 = (0, import_react.useCallback)((e3) => {
|
|
2827
2808
|
Kt2 && (e3 === g2 || e3 === Fe2) && n2(e3);
|
|
2828
|
-
}, [Kt2, g2, Fe2, n2]), Jt2 = (0, import_react.useMemo)(() => i2 && !
|
|
2809
|
+
}, [Kt2, g2, Fe2, n2]), Jt2 = (0, import_react.useMemo)(() => i2 && !j2 && xe2 ? Date.now() : void 0, [i2, j2, P2, be2, H2]), Yt2 = Jt2 !== void 0 && H2 ? Ao(new Date(Jt2), H2) : null, { range: Xt2, daysAvailability: Zt2, isLoading: Qt2, hasError: $t2, setRange: en2 } = $c({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: H2, today: Yt2, locationId: B2, staffId: V2, customerChoices: Bt2, minRemainingCapacity: Nt2, loadInitially: d2, onlyAvailableSlots: e2 }), tn2 = fe2?.slice(0, 10) ?? null, nn2 = (0, import_react.useMemo)(() => tn2 ? Zt2.map((e3) => e3.date > tn2 ? { ...e3, availability: `none` } : e3) : Zt2, [Zt2, tn2]), rn2 = fe2 && H2 ? No(new Date(fe2), H2) : null, { query: U2, selectedDate: an2, timeSlots: on2, isLoading: sn2, error: cn2, selectDate: ln2, findNextAvailableDate: un2 } = el({ enabled: i2, serviceId: P2, serviceType: C2, multiServiceRequest: be2, timeZone: H2, today: Yt2, locationId: B2, staffId: V2, customerChoices: Bt2, minRemainingCapacity: Nt2, onlyAvailableSlots: e2, serviceLoading: j2 || le2 }), dn2 = (0, import_react.useRef)(true), fn2 = (0, import_react.useRef)(null);
|
|
2829
2810
|
(0, import_react.useEffect)(() => {
|
|
2830
|
-
if (
|
|
2831
|
-
|
|
2811
|
+
if (dn2.current) {
|
|
2812
|
+
dn2.current = false;
|
|
2832
2813
|
return;
|
|
2833
2814
|
}
|
|
2834
|
-
ke2(null), Le2.current &&
|
|
2815
|
+
ke2(null), Le2.current && Wl(P2, T2, E2), Le2.current = null, fn2.current = null;
|
|
2835
2816
|
}, [U2, be2, H2, B2, V2, Bt2, Nt2, e2, l2, f2, D2]);
|
|
2836
|
-
let
|
|
2837
|
-
let e3 = await
|
|
2838
|
-
return e3.outcome === `found` ?
|
|
2839
|
-
}, [
|
|
2840
|
-
|
|
2841
|
-
let e3 =
|
|
2842
|
-
return
|
|
2843
|
-
}, []),
|
|
2844
|
-
|
|
2845
|
-
}, [
|
|
2846
|
-
let t3 =
|
|
2847
|
-
|
|
2848
|
-
|
|
2817
|
+
let pn2 = (0, import_react.useCallback)(async () => {
|
|
2818
|
+
let e3 = await un2();
|
|
2819
|
+
return e3.outcome === `found` ? tn2 && e3.date > tn2 ? `none` : (await Promise.all([ln2(e3.date), Xt2 && Ho(e3.date, Xt2) ? Promise.resolve() : en2(Vo(e3.date))]), `found`) : e3.outcome;
|
|
2820
|
+
}, [un2, tn2, ln2, Xt2, en2]), mn2 = !!(i2 && !j2 && xe2 && H2 && Yt2), hn2 = i2 && !j2 && !le2 && !xe2, [gn2, W2] = (0, import_react.useState)(false), [_n2, vn2] = (0, import_react.useState)(0), yn2 = (0, import_react.useRef)(false), bn2 = (0, import_react.useRef)([]), xn2 = (0, import_react.useRef)(0), Sn2 = (0, import_react.useCallback)(() => {
|
|
2821
|
+
W2(false);
|
|
2822
|
+
let e3 = bn2.current;
|
|
2823
|
+
return bn2.current = [], e3;
|
|
2824
|
+
}, []), Cn2 = (0, import_react.useCallback)(() => {
|
|
2825
|
+
xn2.current += 1, Sn2().forEach((e3) => e3(`cancelled`));
|
|
2826
|
+
}, [Sn2]), wn2 = (0, import_react.useCallback)((e3) => (Cn2(), ln2(e3)), [Cn2, ln2]), Tn2 = (0, import_react.useCallback)((e3) => {
|
|
2827
|
+
let t3 = xn2.current;
|
|
2828
|
+
yn2.current = true, pn2().then((n3) => {
|
|
2829
|
+
yn2.current = false, n3 === `cancelled` && t3 === xn2.current ? (bn2.current.unshift(...e3), W2(true)) : e3.forEach((e4) => e4(n3)), vn2((e4) => e4 + 1);
|
|
2849
2830
|
});
|
|
2850
|
-
}, [
|
|
2851
|
-
if (
|
|
2852
|
-
|
|
2831
|
+
}, [pn2]), En2 = (0, import_react.useCallback)(() => hn2 ? Promise.resolve(`none`) : new Promise((e3) => {
|
|
2832
|
+
if (mn2 && !yn2.current) {
|
|
2833
|
+
Tn2([...Sn2(), e3]);
|
|
2853
2834
|
return;
|
|
2854
2835
|
}
|
|
2855
|
-
|
|
2856
|
-
}), [
|
|
2836
|
+
bn2.current.push(e3), W2(true);
|
|
2837
|
+
}), [hn2, mn2, Tn2, Sn2]);
|
|
2857
2838
|
(0, import_react.useEffect)(() => {
|
|
2858
|
-
if (
|
|
2859
|
-
if (
|
|
2860
|
-
|
|
2839
|
+
if (gn2 && !yn2.current) {
|
|
2840
|
+
if (hn2) {
|
|
2841
|
+
Sn2().forEach((e3) => e3(`none`));
|
|
2861
2842
|
return;
|
|
2862
2843
|
}
|
|
2863
|
-
|
|
2844
|
+
mn2 && Tn2(Sn2());
|
|
2864
2845
|
}
|
|
2865
|
-
}, [
|
|
2866
|
-
let
|
|
2867
|
-
Ne2.current =
|
|
2868
|
-
if (!
|
|
2846
|
+
}, [gn2, _n2, mn2, hn2, Tn2, Sn2]);
|
|
2847
|
+
let Dn2 = x2?.schedule?.lastSessionEnd, On2 = I2 || Xa(C2) || Za(C2) && !ul(Dn2, Jt2), kn2 = !!(Ae2 && i2 && !j2 && P2 && H2 && Jt2 !== void 0), An2 = kn2 && P2 && H2 && Jt2 !== void 0 ? dl({ serviceId: P2, serviceType: C2, lastSessionEnd: Dn2, timeZone: H2, now: Jt2, onlyAvailableSlots: e2, locationId: B2, staffId: V2, timeSlotLimitPerDay: f2, customerChoices: Bt2, minRemainingCapacity: Nt2 }) : void 0, G2 = Pl(l2, An2), jn2 = Ae2 && P2 && On2 && !(Ae2 && P2 && On2 && (!i2 || j2)) && !H2, Mn2 = ve2 ? `onlineBookingOff` : ue2 ?? (G2.error === null ? jn2 ? `timeZoneMissing` : null : `upcomingSlotsLoadFailed`), Nn2 = U2 !== null, Pn2 = (0, import_react.useMemo)(() => vl({ sessions: G2.sessions, dayQuery: Nn2, daySlots: on2, staffFilter: V2, appointmentLike: I2, limitPerDay: f2, expandedDates: G2.expandedDates }), [G2.sessions, Nn2, on2, V2, I2, f2, G2.expandedDates]), { slotIdOf: Fn2 } = Pn2, In2 = Ae2 && (An2 ? G2.firstPageSettled : kn2 || i2 && !j2 && !P2 || jn2);
|
|
2848
|
+
Ne2.current = In2, (0, import_react.useEffect)(() => {
|
|
2849
|
+
if (!In2) return;
|
|
2869
2850
|
let e3 = Me2.current;
|
|
2870
2851
|
Me2.current = [], e3.forEach((e4) => e4());
|
|
2871
|
-
}, [
|
|
2872
|
-
let
|
|
2852
|
+
}, [In2]);
|
|
2853
|
+
let Ln2 = Ae2 && !In2 || G2.isLoadingPage, Rn2 = Mn2 !== null, zn2 = U2 ? sn2 : Ln2 || sn2 || !i2 || xe2 && !H2 || gn2 || le2, Bn2 = U2 ? cn2 : cn2 ?? Mn2, Vn2 = U2 ? cn2 !== null : Rn2 || cn2 !== null, Hn2 = Oc(Cc.TIME_SLOTS), Un2 = (0, import_react.useRef)(false), K2 = (0, import_react.useCallback)((e3, t3) => {
|
|
2873
2854
|
if (!t3.bookable) {
|
|
2874
|
-
|
|
2855
|
+
fn2.current = null;
|
|
2875
2856
|
return;
|
|
2876
2857
|
}
|
|
2877
|
-
if (e3 ===
|
|
2878
|
-
|
|
2879
|
-
let n3 = P2 ?? t3.serviceId ?? t3.nestedTimeSlots?.[0]?.serviceId ?? void 0, r2 = C2 ??
|
|
2880
|
-
!
|
|
2881
|
-
}, [
|
|
2858
|
+
if (e3 === fn2.current) return;
|
|
2859
|
+
fn2.current = e3;
|
|
2860
|
+
let n3 = P2 ?? t3.serviceId ?? t3.nestedTimeSlots?.[0]?.serviceId ?? void 0, r2 = C2 ?? M2.find((e4) => e4._id === n3)?.type ?? void 0;
|
|
2861
|
+
!Un2.current && !N2 && Hn2(xc({ bookingsServiceId: n3, serviceType: r2, isEligibleForFlowCompletion: true })), Un2.current = true, Hn2(jc({ component: Ec.TIME_PICKER, element: Dc.TIME_SLOT, properties: JSON.stringify({ selectedTime: t3.localStartDate }) }));
|
|
2862
|
+
}, [Hn2, P2, C2, M2, N2]), Wn2 = (0, import_react.useCallback)((e3) => {
|
|
2882
2863
|
if (e3 === null) {
|
|
2883
2864
|
let e4 = Le2.current !== null;
|
|
2884
|
-
Le2.current = null,
|
|
2865
|
+
Le2.current = null, fn2.current = null, ke2(null), e4 && Wl(P2, T2, E2);
|
|
2885
2866
|
return;
|
|
2886
2867
|
}
|
|
2887
|
-
let t3 =
|
|
2868
|
+
let t3 = yl(Pn2, e3);
|
|
2888
2869
|
if (!t3) return;
|
|
2889
2870
|
if (F2) {
|
|
2890
2871
|
if (!ee2(t3.nestedTimeSlots ?? [], H2 ?? void 0)) return;
|
|
2891
|
-
Le2.current = t3, ke2(t3),
|
|
2872
|
+
Le2.current = t3, ke2(t3), K2(e3, t3);
|
|
2892
2873
|
return;
|
|
2893
2874
|
}
|
|
2894
|
-
Le2.current = t3, ke2(t3),
|
|
2895
|
-
let n3 =
|
|
2896
|
-
if (w2(
|
|
2875
|
+
Le2.current = t3, ke2(t3), K2(e3, t3);
|
|
2876
|
+
let n3 = Cl(t3);
|
|
2877
|
+
if (w2(ys(t3), { staffId: I2 ? void 0 : Sl(t3), timezone: H2 ?? void 0, bookable: t3.bookable, staffChoiceRequired: I2 && Ue2 && !L2 && n3.length > 1 && !Ht2(n3.length), rescheduleStaffId: I2 && (_2 !== `CUSTOMER_MAY_CHOOSE` || !Ht2(n3.length)) ? n3[0] : void 0 }), !I2) return;
|
|
2897
2878
|
let r2 = ze2.current, i3;
|
|
2898
|
-
i3 = R2 || (V2 && n3.includes(V2) ? { anyResource: false, staffMemberId: V2 } : kt2 !== null && Ht2(n3.length) ? { anyResource: true } :
|
|
2899
|
-
}, [F2, P2, T2, E2, ee2, w2,
|
|
2879
|
+
i3 = R2 || (V2 && n3.includes(V2) ? { anyResource: false, staffMemberId: V2 } : kt2 !== null && Ht2(n3.length) ? { anyResource: true } : pl(n3, Ue2 && Ht2(n3.length))), Il(i3, kt2) !== Il(r2, Ve2) && At2(i3);
|
|
2880
|
+
}, [F2, P2, T2, E2, ee2, w2, Pn2, K2, H2, I2, Ue2, _2, Ht2, R2, V2, kt2, Ve2, At2]), Gn2 = (0, import_react.useCallback)(() => {
|
|
2900
2881
|
let e3 = Le2.current;
|
|
2901
|
-
if (!e3 || N2) return;
|
|
2882
|
+
if (!e3 || N2 || !e3.bookable) return;
|
|
2902
2883
|
if (F2) {
|
|
2903
|
-
|
|
2884
|
+
te2(Hn2);
|
|
2904
2885
|
return;
|
|
2905
2886
|
}
|
|
2906
2887
|
if (!P2) return;
|
|
2907
2888
|
let t3;
|
|
2908
2889
|
if (I2) {
|
|
2909
|
-
let n4 =
|
|
2890
|
+
let n4 = Cl(e3), r2 = ml(n4, Ut2(ze2.current), Ht2(n4.length));
|
|
2910
2891
|
t3 = (r2.isComplete ? r2.resourceId : n4[0]) ?? (n4.length ? null : void 0);
|
|
2911
2892
|
}
|
|
2912
2893
|
let n3 = De2(`bookingForm`, { slug: x2?.mainSlug?.name ?? null, serviceId: P2 });
|
|
2913
|
-
|
|
2914
|
-
}, [
|
|
2915
|
-
return (0, import_jsx_runtime.jsx)(
|
|
2894
|
+
Hn2(Pc({ serviceId: P2, serviceType: C2 ?? void 0, start: e3.localStartDate, end: e3.localEndDate, timeZone: H2 ?? void 0, isEligibleForFlowCompletion: !!n3 })), n3 && Ee2(ie2(n3, { handoff: true, staffId: t3 }));
|
|
2895
|
+
}, [Hn2, F2, te2, H2, P2, C2, x2, I2, Ut2, Ht2, Ee2, De2, ie2, N2]), Kn2 = Oe2 ? Cl(Oe2) : null, qn2 = Kn2 ? F2 || !I2 || ml(Kn2, Ut2(Re2), Ht2(Kn2.length)).isComplete : false, Jn2 = Kn2 ? Ht2(Kn2.length) : false, Yn2 = (0, import_react.useMemo)(() => !Oe2 || Ze2 ? [] : xl(Oe2).map((e3) => ({ staffMemberId: e3.staffMemberId, name: e3.name || null, image: null, isSelected: e3.staffMemberId === Be2 })), [Oe2, Ze2, Be2]), Xn2 = (0, import_react.useMemo)(() => ({ isMultiService: F2, availabilityRequestKey: Se2, needsServiceChoice: Ce2, isRescheduling: N2, rescheduleValidUntil: rn2, businessTimeZone: g2, canChangeTimeZone: Kt2, setTimeZone: qt2, locationFilterOptions: lt2, selectedLocationFilter: B2, setLocationFilter: Gt2, staffFilterOptions: _t2, selectedStaffFilter: V2, setStaffFilter: Wt2, requestedGender: kt2, genderSelectionAllowed: Ge2, currentTimeSlotsPage: U2 ? 1 : G2.currentPage, hasNextTimeSlotsPage: !U2 && G2.hasNextPage, hasPreviousTimeSlotsPage: !U2 && G2.hasPreviousPage, nextTimeSlotsPage: U2 ? Vl : G2.nextPage, loadUpcomingTimeSlots: Pe2, upcomingTimeSlotsRequested: Ae2, previousTimeSlotsPage: U2 ? Bl : G2.previousPage, timeSlots: Pn2.rows.map((e3) => bl(e3, H2, Fn2, L2)), isLoading: zn2, hasError: Vn2, errorCode: Bn2, selectedDate: an2, daysAvailabilityRange: Xt2, daysAvailability: nn2, daysAvailabilityLoading: Qt2, daysAvailabilityHasError: $t2, selectDate: wn2, setDaysAvailabilityRange: en2, goToNextAvailableDate: En2, nextAvailableSlotsCount: l2, timeZone: H2, staffFromSlots: Yn2, selectedResourceId: Be2, setSelectedResource: jt2, canAutoAssignStaff: Jn2, isComplete: qn2, selectedTimeSlot: Oe2 ? bl(Oe2, H2, Fn2, L2) : null, selectTimeSlot: Wn2, navigateToBookingForm: Gn2, timeSlotLimitPerDay: f2, daysWithMore: Pn2.daysWithMore, loadingDate: G2.loadingDate, loadAllTimeSlotsForDay: G2.loadAllSessionsForDay }), [F2, Se2, Ce2, N2, rn2, g2, H2, Kt2, qt2, G2, Pe2, Ae2, lt2, B2, Gt2, _t2, V2, Wt2, kt2, Ge2, U2, zn2, Bn2, Vn2, Pn2, an2, Xt2, nn2, Qt2, $t2, wn2, en2, En2, l2, Yn2, Be2, jt2, Jn2, qn2, Oe2, Wn2, Gn2, f2, Fn2, L2]);
|
|
2896
|
+
return (0, import_jsx_runtime.jsx)(Hl.Provider, { value: Xn2, children: b2 });
|
|
2916
2897
|
}
|
|
2917
|
-
var
|
|
2898
|
+
var Zl = sn(`4936242d-905c-48bf-80ce-5f56d075de4f`);
|
|
2918
2899
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2919
2900
|
0 && (module.exports = {
|
|
2920
2901
|
TimeSlotsContextProvider,
|