@wix/bookings 1.0.1793 → 1.0.1794
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.
|
@@ -11995,121 +11995,126 @@ typeof window < `u` && (window.addEventListener(`beforeunload`, () => {
|
|
|
11995
11995
|
var XA = () => JA || Date.now() - YA <= qA;
|
|
11996
11996
|
var ZA = (e18) => (e18 instanceof TypeError || e18?.name === `AbortError`) && UA(e18);
|
|
11997
11997
|
var QA = (e18) => XA() && ZA(e18);
|
|
11998
|
-
var $A = (e18) =>
|
|
11999
|
-
var ej = (e18) => {
|
|
11998
|
+
var $A = (e18) => e18 instanceof TypeError && UA(e18) && !XA();
|
|
11999
|
+
var ej = (e18) => () => e18().catch((t2) => {
|
|
12000
|
+
if ($A(t2)) return e18();
|
|
12001
|
+
throw t2;
|
|
12002
|
+
});
|
|
12003
|
+
var tj = (e18) => typeof e18.message == `string`;
|
|
12004
|
+
var nj = (e18) => {
|
|
12000
12005
|
try {
|
|
12001
12006
|
let t2 = Xx.getMonitoringClient();
|
|
12002
|
-
return
|
|
12007
|
+
return tj(t2) ? void 0 : t2.startSpanManual({ name: e18, tags: { scope: e18 } });
|
|
12003
12008
|
} catch {
|
|
12004
12009
|
return;
|
|
12005
12010
|
}
|
|
12006
12011
|
};
|
|
12007
|
-
var
|
|
12012
|
+
var rj = (e18) => {
|
|
12008
12013
|
try {
|
|
12009
12014
|
e18();
|
|
12010
12015
|
} catch {
|
|
12011
12016
|
}
|
|
12012
12017
|
};
|
|
12013
|
-
var
|
|
12014
|
-
let
|
|
12018
|
+
var ij = async (e18, t2, { errorCodesMap: n2 = {}, statusCodesMap: r2, serverError: i2, isExpected: a2, isRead: o2 = false } = {}) => {
|
|
12019
|
+
let s2 = nj(e18);
|
|
12015
12020
|
try {
|
|
12016
|
-
let e19 = await qx(t2, n2, { statusCodesOverrides: r2, serverErrorOverride: i2 });
|
|
12021
|
+
let e19 = await qx(o2 ? ej(t2) : t2, n2, { statusCodesOverrides: r2, serverErrorOverride: i2 });
|
|
12017
12022
|
if (e19 instanceof Response && !e19.ok) throw e19;
|
|
12018
|
-
return
|
|
12023
|
+
return rj(() => s2?.end()), e19;
|
|
12019
12024
|
} catch (t3) {
|
|
12020
|
-
throw a2?.(t3) || QA(t3) ?
|
|
12025
|
+
throw a2?.(t3) || QA(t3) ? rj(() => s2?.end()) : s2 ? (console.error(`[${e18}]`, t3), rj(() => s2.fail(GA(t3)))) : KA(t3, e18), t3;
|
|
12021
12026
|
}
|
|
12022
12027
|
};
|
|
12023
|
-
var
|
|
12024
|
-
var
|
|
12025
|
-
var
|
|
12026
|
-
var
|
|
12027
|
-
return
|
|
12028
|
+
var aj = `wix.bookings.v2.bookings`;
|
|
12029
|
+
var oj = (e18) => e18?.details?.applicationError?.code === `BOOKINGS_SETTINGS_NOT_FOUND`;
|
|
12030
|
+
var sj = 1e3;
|
|
12031
|
+
var cj = () => ({ async queryExtendedBookings(e18, t2) {
|
|
12032
|
+
return ij(`myBookings.queryExtendedBookings`, () => Ks(e18, t2), { isRead: true });
|
|
12028
12033
|
}, async queryServicesByIds(e18) {
|
|
12029
|
-
return
|
|
12034
|
+
return ij(`myBookings.queryServices`, () => Xd().in(`_id`, e18).find(), { isRead: true });
|
|
12030
12035
|
}, async queryLocations() {
|
|
12031
|
-
return
|
|
12036
|
+
return ij(`myBookings.queryLocations`, () => Ld(), { isRead: true });
|
|
12032
12037
|
}, async querySubmissionsByBookingIds(e18) {
|
|
12033
|
-
return
|
|
12038
|
+
return ij(`myBookings.querySubmissionsByNamespace`, () => BA({ onlyYourOwn: true }).eq(`namespace`, aj).in(`_id`, e18).find(), { isRead: true });
|
|
12034
12039
|
}, async getForm(e18) {
|
|
12035
|
-
return
|
|
12040
|
+
return ij(`myBookings.getForm`, () => DA(e18), { isRead: true });
|
|
12036
12041
|
}, async getFormattedSubmission(e18) {
|
|
12037
|
-
return
|
|
12042
|
+
return ij(`myBookings.getFormattedSubmission`, () => zA(e18), { isRead: true });
|
|
12038
12043
|
}, async getBookingsSettings() {
|
|
12039
|
-
return
|
|
12044
|
+
return ij(`myBookings.getBookingsSettings`, () => Of(), { isExpected: oj, isRead: true });
|
|
12040
12045
|
}, async listBookingFees(e18) {
|
|
12041
|
-
return
|
|
12046
|
+
return ij(`myBookings.listBookingFeesByBookingIds`, () => Go({ bookingIds: e18 }), { isRead: true });
|
|
12042
12047
|
}, async listOrderTransactions(e18) {
|
|
12043
|
-
return
|
|
12048
|
+
return ij(`myBookings.listTransactionsForMultipleOrders`, () => xA(e18), { isRead: true });
|
|
12044
12049
|
}, async getOrder(e18) {
|
|
12045
|
-
return
|
|
12050
|
+
return ij(`myBookings.getOrder`, () => tk(e18), { isRead: true });
|
|
12046
12051
|
}, async queryBookingById(e18) {
|
|
12047
|
-
return
|
|
12052
|
+
return ij(`myBookings.queryBookingById`, () => Ks({ filter: { _id: e18 } }, {}), { isRead: true });
|
|
12048
12053
|
}, async cancelBooking(e18, t2) {
|
|
12049
|
-
return
|
|
12054
|
+
return ij(`myBookings.cancelBooking`, () => yf(e18, { revision: t2 }));
|
|
12050
12055
|
}, async cancelMultiServiceBooking(e18) {
|
|
12051
|
-
return
|
|
12056
|
+
return ij(`myBookings.cancelMultiServiceBooking`, () => _f(e18, { participantNotification: { notifyParticipants: true } }));
|
|
12052
12057
|
}, async getMultiServiceBookingAllowedActions(e18) {
|
|
12053
|
-
return
|
|
12058
|
+
return ij(`myBookings.bulkGetMultiServiceBookingAllowedActions`, () => vf(e18), { isRead: true });
|
|
12054
12059
|
}, async queryScheduleEvents(e18, t2) {
|
|
12055
|
-
return
|
|
12056
|
-
let n2 = await wD(t2).in(`scheduleId`, e18).limit(
|
|
12060
|
+
return ij(`myBookings.queryEvents`, async () => {
|
|
12061
|
+
let n2 = await wD(t2).in(`scheduleId`, e18).limit(sj).find(), r2 = [...n2.items];
|
|
12057
12062
|
for (; n2.hasNext(); ) n2 = await n2.next(), r2.push(...n2.items);
|
|
12058
12063
|
return r2;
|
|
12059
|
-
});
|
|
12064
|
+
}, { isRead: true });
|
|
12060
12065
|
} });
|
|
12061
|
-
var
|
|
12062
|
-
function
|
|
12066
|
+
var lj = /\.wix(site|studio)\.com$/;
|
|
12067
|
+
function uj(e18) {
|
|
12063
12068
|
try {
|
|
12064
12069
|
return new URL(e18);
|
|
12065
12070
|
} catch {
|
|
12066
12071
|
return null;
|
|
12067
12072
|
}
|
|
12068
12073
|
}
|
|
12069
|
-
function
|
|
12070
|
-
return e18.origin === t2.origin ||
|
|
12074
|
+
function dj(e18, t2) {
|
|
12075
|
+
return e18.origin === t2.origin || lj.test(e18.hostname) && e18.hostname.replace(lj, ``) === t2.hostname.replace(lj, ``);
|
|
12071
12076
|
}
|
|
12072
|
-
function
|
|
12073
|
-
let i2 = t2.replace(/\/$/, ``), a2 =
|
|
12074
|
-
if (!r2 || !a2 || !o2 || !
|
|
12077
|
+
function fj(e18, t2, n2, r2) {
|
|
12078
|
+
let i2 = t2.replace(/\/$/, ``), a2 = uj(i2), o2 = uj(e18);
|
|
12079
|
+
if (!r2 || !a2 || !o2 || !dj(o2, a2)) return e18;
|
|
12075
12080
|
let s2 = `${a2.pathname.replace(/\/$/, ``)}/${r2}/`;
|
|
12076
12081
|
return !o2.pathname.startsWith(s2) || (n2.startsWith(i2) ? n2.slice(i2.length) : ``).split(/[/?#]/)[1] === r2 ? e18 : `${i2}/${o2.pathname.slice(s2.length)}${o2.search}${o2.hash}`;
|
|
12077
12082
|
}
|
|
12078
|
-
function
|
|
12083
|
+
function pj(e18) {
|
|
12079
12084
|
window.location.assign(e18);
|
|
12080
12085
|
}
|
|
12081
|
-
var
|
|
12082
|
-
var
|
|
12083
|
-
function
|
|
12086
|
+
var mj = `https://calendar.google.com/calendar/render`;
|
|
12087
|
+
var hj = (e18) => e18.toISOString().replace(/[-:]/g, ``).replace(/\.\d{3}/, ``);
|
|
12088
|
+
function gj(e18, t2) {
|
|
12084
12089
|
let n2 = new Intl.DateTimeFormat(`en-US`, { timeZone: t2, year: `numeric`, month: `2-digit`, day: `2-digit` }).formatToParts(e18), r2 = (e19) => n2.find((t3) => t3.type === e19)?.value ?? ``;
|
|
12085
12090
|
return `${r2(`year`)}${r2(`month`)}${r2(`day`)}`;
|
|
12086
12091
|
}
|
|
12087
|
-
function
|
|
12092
|
+
function _j(e18) {
|
|
12088
12093
|
return new Date(Date.UTC(Number(e18.slice(0, 4)), Number(e18.slice(4, 6)) - 1, Number(e18.slice(6, 8)) + 1)).toISOString().slice(0, 10).replace(/-/g, ``);
|
|
12089
12094
|
}
|
|
12090
|
-
function
|
|
12095
|
+
function vj(e18) {
|
|
12091
12096
|
let t2 = new Date(e18.startDate), n2 = new Date(e18.endDate);
|
|
12092
|
-
if (!e18.isAllDay) return `${
|
|
12093
|
-
let r2 =
|
|
12094
|
-
return `${
|
|
12097
|
+
if (!e18.isAllDay) return `${hj(t2)}/${hj(n2)}`;
|
|
12098
|
+
let r2 = gj(new Date(n2.getTime() - 1), e18.timeZone);
|
|
12099
|
+
return `${gj(t2, e18.timeZone)}/${_j(r2)}`;
|
|
12095
12100
|
}
|
|
12096
|
-
function
|
|
12097
|
-
let t2 = new URL(
|
|
12098
|
-
return t2.searchParams.set(`action`, `TEMPLATE`), t2.searchParams.set(`text`, e18.title), t2.searchParams.set(`dates`,
|
|
12101
|
+
function yj(e18) {
|
|
12102
|
+
let t2 = new URL(mj);
|
|
12103
|
+
return t2.searchParams.set(`action`, `TEMPLATE`), t2.searchParams.set(`text`, e18.title), t2.searchParams.set(`dates`, vj(e18)), t2.searchParams.set(`ctz`, e18.timeZone), e18.location && t2.searchParams.set(`location`, e18.location), e18.details && t2.searchParams.set(`details`, e18.details), t2.toString();
|
|
12099
12104
|
}
|
|
12100
|
-
function
|
|
12105
|
+
function bj(e18, t2, n2) {
|
|
12101
12106
|
let r2 = e18.isAvailableOnline ? e18.conferencingDetails.guestUrl?.href ?? `` : ``, i2 = r2 ? [Ta(t2, Da.calendar.videoCall, { url: r2 }), ...e18.videoConferencePassword ? [Ta(t2, Da.calendar.videoCallPassword, { password: e18.videoConferencePassword })] : []].join(`
|
|
12102
12107
|
`) : ``;
|
|
12103
|
-
return
|
|
12108
|
+
return yj({ title: new Intl.ListFormat(n2, { type: `conjunction` }).format(e18.serviceNames), startDate: e18.startDate ?? ``, endDate: e18.endDate ?? ``, isAllDay: e18.isAllDay, timeZone: e18.timeZone, location: e18.location, details: i2 });
|
|
12104
12109
|
}
|
|
12105
|
-
var
|
|
12106
|
-
var
|
|
12110
|
+
var xj = cj();
|
|
12111
|
+
var Sj = (e18) => {
|
|
12107
12112
|
let t2 = u(/* @__PURE__ */ new Map());
|
|
12108
12113
|
return c(() => {
|
|
12109
12114
|
for (let n2 of e18) {
|
|
12110
12115
|
let e19 = n2.formSubmissionIds[0];
|
|
12111
12116
|
if (e19 && !n2.isOver && !t2.current.has(e19)) {
|
|
12112
|
-
let n3 =
|
|
12117
|
+
let n3 = xj.getFormattedSubmission(e19);
|
|
12113
12118
|
t2.current.set(e19, n3), n3.catch(() => {
|
|
12114
12119
|
t2.current.delete(e19);
|
|
12115
12120
|
});
|
|
@@ -12117,40 +12122,40 @@ var bj = (e18) => {
|
|
|
12117
12122
|
}
|
|
12118
12123
|
}, [e18]), o((e19) => {
|
|
12119
12124
|
let n2 = t2.current.get(e19);
|
|
12120
|
-
return n2 ? n2.catch(() =>
|
|
12125
|
+
return n2 ? n2.catch(() => xj.getFormattedSubmission(e19)) : xj.getFormattedSubmission(e19);
|
|
12121
12126
|
}, []);
|
|
12122
12127
|
};
|
|
12123
12128
|
var Q = (e18) => `var(--${e18})`;
|
|
12124
12129
|
Q(`wst-paragraph-1-font`), Q(`wst-paragraph-2-font`), Q(`wst-paragraph-3-font`), Q(`wst-heading-2-font`), Q(`wst-heading-3-font`), Q(`wst-heading-5-font`), Q(`wst-heading-6-font`), Q(`wst-links-and-actions-color`), Q(`wst-graphics-1-color`), Q(`wst-heading-3-color`), Q(`wst-heading-5-color`), Q(`wst-heading-6-color`), Q(`wst-paragraph-1-color`), Q(`wst-paragraph-2-color`), Q(`wst-paragraph-3-color`), Q(`wst-primary-background-color`), Q(`wst-secondary-background-color`), Q(`wst-box-primary-border-top-color`), Q(`wst-box-primary-border-bottom-color`), Q(`wst-box-primary-border-left-color`), Q(`wst-box-primary-border-right-color`), Q(`wst-box-primary-border-top-left-radius`), Q(`wst-box-primary-border-top-right-radius`), Q(`wst-box-primary-border-bottom-left-radius`), Q(`wst-box-primary-border-bottom-right-radius`), Q(`wst-box-secondary-background-color`), Q(`wst-box-secondary-box-shadow`), Q(`wst-box-secondary-border-top-color`), Q(`wst-box-secondary-border-right-color`), Q(`wst-box-secondary-border-bottom-color`), Q(`wst-box-secondary-border-left-color`), Q(`wst-box-secondary-border-top-width`), Q(`wst-box-secondary-border-right-width`), Q(`wst-box-secondary-border-bottom-width`), Q(`wst-box-secondary-border-left-width`), Q(`wst-box-secondary-border-top-style`), Q(`wst-box-secondary-border-right-style`), Q(`wst-box-secondary-border-bottom-style`), Q(`wst-box-secondary-border-left-style`), Q(`wst-box-secondary-border-top-left-radius`), Q(`wst-box-secondary-border-top-right-radius`), Q(`wst-box-secondary-border-bottom-left-radius`), Q(`wst-box-secondary-border-bottom-right-radius`), Q(`wst-button-primary-color`), Q(`wst-button-primary-background-color`), Q(`wst-button-primary-font`), Q(`wst-button-primary-border-top-color`), Q(`wst-button-primary-border-top-style`), Q(`wst-button-primary-border-right-color`), Q(`wst-button-primary-border-right-style`), Q(`wst-button-primary-border-bottom-color`), Q(`wst-button-primary-border-bottom-style`), Q(`wst-button-primary-border-left-color`), Q(`wst-button-primary-border-left-style`), Q(`wst-button-primary-border-top-left-radius`), Q(`wst-button-primary-border-top-right-radius`), Q(`wst-button-primary-border-bottom-left-radius`), Q(`wst-button-primary-border-bottom-right-radius`), Q(`wst-button-primary-padding-top`), Q(`wst-button-primary-padding-bottom`), Q(`wst-button-primary-padding-left`), Q(`wst-button-primary-padding-right`), Q(`wst-button-primary-box-shadow`), Q(`wst-button-secondary-color`), Q(`wst-button-secondary-font`), Q(`wst-button-secondary-background-color`), Q(`wst-button-secondary-border-top-color`), Q(`wst-button-secondary-border-top-width`), Q(`wst-button-secondary-border-top-style`), Q(`wst-button-secondary-border-top-left-radius`), Q(`wst-button-tertiary-color`), Q(`wst-button-tertiary-background-color`), Q(`wst-button-tertiary-font`), Q(`wst-system-alert-color`), Q(`wst-system-error-color`), Q(`wst-system-disabled-color`), Q(`wst-system-line-1-color`), Q(`wst-system-line-1-width`), Q(`wst-base-1-color`), Q(`wst-base-2-color`), Q(`wst-shade-1-color`), Q(`wst-shade-2-color`), Q(`wst-shade-3-color`), Q(`wst-accent-1-color`), Q(`wst-accent-3-color`);
|
|
12125
|
-
var
|
|
12126
|
-
function
|
|
12130
|
+
var Cj = `yyyy-MM-dd'T'HH:mm:ss`;
|
|
12131
|
+
function wj(e18) {
|
|
12127
12132
|
if (!e18 || typeof e18 == `string` && !Z.fromISO(e18, { setZone: true }).isValid) return null;
|
|
12128
12133
|
let t2 = new Date(e18);
|
|
12129
12134
|
return Number.isNaN(t2.getTime()) ? null : t2.toISOString();
|
|
12130
12135
|
}
|
|
12131
|
-
function
|
|
12132
|
-
let n2 =
|
|
12136
|
+
function Tj(e18, t2) {
|
|
12137
|
+
let n2 = wj(e18);
|
|
12133
12138
|
if (!n2) return null;
|
|
12134
12139
|
let r2 = Z.fromISO(n2, t2 ? { zone: t2 } : {});
|
|
12135
|
-
return (r2.isValid ? r2 : Z.fromISO(n2)).toFormat(
|
|
12140
|
+
return (r2.isValid ? r2 : Z.fromISO(n2)).toFormat(Cj);
|
|
12136
12141
|
}
|
|
12137
|
-
var
|
|
12138
|
-
var
|
|
12139
|
-
var
|
|
12140
|
-
function
|
|
12141
|
-
if (e18.startsWith(
|
|
12142
|
-
let t2 =
|
|
12143
|
-
return t2 ? `${
|
|
12142
|
+
var Ej = `wix:image://`;
|
|
12143
|
+
var Dj = /^https?:\/\/static\.wixstatic\.com\/media\/([^/?#]+)/;
|
|
12144
|
+
var Oj = /^https?:\/\//;
|
|
12145
|
+
function kj(e18) {
|
|
12146
|
+
if (e18.startsWith(Ej)) return e18;
|
|
12147
|
+
let t2 = Dj.exec(e18);
|
|
12148
|
+
return t2 ? `${Ej}v1/${t2[1]}` : Oj.test(e18) ? `` : `${Ej}v1/${e18}`;
|
|
12144
12149
|
}
|
|
12145
|
-
function
|
|
12146
|
-
return e18.slice(`${
|
|
12150
|
+
function Aj(e18) {
|
|
12151
|
+
return e18.slice(`${Ej}v1/`.length).split(`/`)[0].split(`#`)[0];
|
|
12147
12152
|
}
|
|
12148
|
-
function
|
|
12153
|
+
function jj(e18) {
|
|
12149
12154
|
if (!e18) return null;
|
|
12150
|
-
let t2 =
|
|
12151
|
-
return t2 &&
|
|
12155
|
+
let t2 = kj(e18);
|
|
12156
|
+
return t2 && Aj(t2) || null;
|
|
12152
12157
|
}
|
|
12153
|
-
function
|
|
12158
|
+
function Mj(e18) {
|
|
12154
12159
|
let t2 = e18?.split(`#`)[1];
|
|
12155
12160
|
if (!t2) return {};
|
|
12156
12161
|
let n2 = new URLSearchParams(t2), r2 = (e19) => {
|
|
@@ -12159,300 +12164,300 @@ function Aj(e18) {
|
|
|
12159
12164
|
}, i2 = r2(`originWidth`), a2 = r2(`originHeight`);
|
|
12160
12165
|
return { ...i2 && { width: i2 }, ...a2 && { height: a2 } };
|
|
12161
12166
|
}
|
|
12162
|
-
function
|
|
12167
|
+
function Nj(e18) {
|
|
12163
12168
|
if (!e18) return null;
|
|
12164
|
-
let t2 =
|
|
12169
|
+
let t2 = kj(e18);
|
|
12165
12170
|
if (!t2) return e18;
|
|
12166
|
-
let n2 =
|
|
12171
|
+
let n2 = Aj(t2);
|
|
12167
12172
|
return n2 ? `https://static.wixstatic.com/media/${n2}` : null;
|
|
12168
12173
|
}
|
|
12169
|
-
function
|
|
12174
|
+
function Pj(e18, t2) {
|
|
12170
12175
|
if (!e18) return null;
|
|
12171
|
-
let n2 =
|
|
12176
|
+
let n2 = kj(e18);
|
|
12172
12177
|
if (!n2) return e18;
|
|
12173
|
-
let r2 =
|
|
12178
|
+
let r2 = Aj(n2);
|
|
12174
12179
|
return r2 ? `https://static.wixstatic.com/media/${r2}/v1/fit/w_${t2},h_${t2},q_90,enc_auto/${r2}` : null;
|
|
12175
12180
|
}
|
|
12176
|
-
function
|
|
12181
|
+
function Fj({ amount: e18, currency: t2, language: n2 }) {
|
|
12177
12182
|
return e18 == null ? `` : t2 ? new Intl.NumberFormat(n2, { style: `currency`, currency: t2 }).format(e18) : new Intl.NumberFormat(n2).format(e18);
|
|
12178
12183
|
}
|
|
12179
|
-
var { BookingStatus:
|
|
12180
|
-
var
|
|
12181
|
-
var
|
|
12182
|
-
var
|
|
12183
|
-
var
|
|
12184
|
+
var { BookingStatus: Ij } = Ko;
|
|
12185
|
+
var Lj = { [Ij.CANCELED]: 5, [Ij.DECLINED]: 4, [Ij.PENDING]: 3, [Ij.WAITING_LIST]: 2, [Ij.CONFIRMED]: 1, [Ij.CREATED]: 1 };
|
|
12186
|
+
var Rj = (e18) => e18.reduce((e19, t2) => Lj[t2] > Lj[e19] ? t2 : e19, e18[0] ?? Ij.CONFIRMED);
|
|
12187
|
+
var zj = (e18) => e18 === Ij.CANCELED || e18 === Ij.DECLINED;
|
|
12188
|
+
var Bj = (e18, t2) => zj(e18) || !!t2 && new Date(t2).getTime() < Date.now();
|
|
12184
12189
|
var $ = { FREE: `FREE`, PLAN_PAID: `PLAN_PAID`, PAID_ONLINE: `PAID_ONLINE`, PAID_IN_PERSON: `PAID_IN_PERSON`, PARTIALLY_PAID: `PARTIALLY_PAID`, NOT_PAID: `NOT_PAID` };
|
|
12185
|
-
var
|
|
12190
|
+
var Vj = (e18) => {
|
|
12186
12191
|
let t2 = e18?.amount;
|
|
12187
12192
|
if (t2 === void 0 || !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(t2)) return;
|
|
12188
12193
|
let n2 = Number(t2);
|
|
12189
12194
|
return Number.isFinite(n2) ? n2 : void 0;
|
|
12190
12195
|
};
|
|
12191
|
-
var
|
|
12196
|
+
var Hj = (e18, t2, n2, r2 = 1) => {
|
|
12192
12197
|
let i2 = new Intl.NumberFormat(n2, { style: `currency`, currency: t2 }).resolvedOptions().maximumFractionDigits ?? 2;
|
|
12193
12198
|
return Math.abs(e18) * 2 ** -52 * r2 < 0.5 * 10 ** -i2;
|
|
12194
12199
|
};
|
|
12195
|
-
function
|
|
12200
|
+
function Uj(e18, t2) {
|
|
12196
12201
|
if (e18.price?.formattedAmount) return e18.price.formattedAmount;
|
|
12197
|
-
let n2 =
|
|
12202
|
+
let n2 = Vj(e18.price);
|
|
12198
12203
|
if (n2 !== void 0 && e18.currency) try {
|
|
12199
|
-
return
|
|
12204
|
+
return Hj(n2, e18.currency, t2) ? Fj({ amount: n2, currency: e18.currency, language: t2 }) : e18.fallback ?? ``;
|
|
12200
12205
|
} catch {
|
|
12201
12206
|
return e18.fallback ?? ``;
|
|
12202
12207
|
}
|
|
12203
12208
|
return e18.fallback ?? ``;
|
|
12204
12209
|
}
|
|
12205
|
-
function
|
|
12210
|
+
function Wj(e18, t2) {
|
|
12206
12211
|
if (e18.length === 0) return ``;
|
|
12207
|
-
let n2 = e18.map((e19) =>
|
|
12212
|
+
let n2 = e18.map((e19) => Uj(e19, t2));
|
|
12208
12213
|
if (n2.some((e19) => !e19)) return ``;
|
|
12209
12214
|
if (e18.length === 1) return n2[0];
|
|
12210
|
-
let r2 = e18.map((e19) =>
|
|
12215
|
+
let r2 = e18.map((e19) => Vj(e19.price)), i2 = e18[0].currency;
|
|
12211
12216
|
if (i2 && e18.every((e19) => e19.currency === i2) && r2.every((e19) => e19 !== void 0)) try {
|
|
12212
12217
|
let e19 = r2.reduce((e20, t3) => e20 + t3, 0), n3 = r2.reduce((e20, t3) => e20 + Math.abs(t3), 0);
|
|
12213
|
-
if (r2.every((e20) =>
|
|
12218
|
+
if (r2.every((e20) => Hj(e20, i2, t2)) && Hj(n3, i2, t2, r2.length)) return Fj({ amount: e19, currency: i2, language: t2 });
|
|
12214
12219
|
} catch {
|
|
12215
12220
|
return new Intl.ListFormat(t2).format(n2);
|
|
12216
12221
|
}
|
|
12217
12222
|
return r2.every((e19) => e19 === 0) && n2.every((e19) => e19 === n2[0]) ? n2[0] : new Intl.ListFormat(t2).format(n2);
|
|
12218
12223
|
}
|
|
12219
|
-
var
|
|
12220
|
-
function
|
|
12224
|
+
var Gj = [$.PAID_ONLINE, $.PAID_IN_PERSON];
|
|
12225
|
+
function Kj(e18) {
|
|
12221
12226
|
let t2 = e18.filter((e19) => e19.state !== $.FREE);
|
|
12222
12227
|
if (t2.length === 0) return $.FREE;
|
|
12223
12228
|
let n2 = new Set(t2.map((e19) => e19.state));
|
|
12224
|
-
return n2.size === 1 ? t2[0].state : n2.has(null) || n2.has($.PLAN_PAID) ? null : n2.has($.PARTIALLY_PAID) || n2.has($.NOT_PAID) && t2.some((e19) =>
|
|
12229
|
+
return n2.size === 1 ? t2[0].state : n2.has(null) || n2.has($.PLAN_PAID) ? null : n2.has($.PARTIALLY_PAID) || n2.has($.NOT_PAID) && t2.some((e19) => Gj.includes(e19.state)) ? $.PARTIALLY_PAID : null;
|
|
12225
12230
|
}
|
|
12226
|
-
function
|
|
12231
|
+
function qj(e18, t2, n2) {
|
|
12227
12232
|
if (t2 === $.PLAN_PAID) return { amount: ``, amountPaid: `` };
|
|
12228
|
-
let r2 = e18.filter((e19) => e19.state !== $.FREE), i2 =
|
|
12233
|
+
let r2 = e18.filter((e19) => e19.state !== $.FREE), i2 = Wj((r2.length > 0 ? r2 : e18).filter((e19) => e19.state !== $.FREE || e19.price?.formattedAmount || Vj(e19.price) !== void 0).map((e19) => ({ price: e19.price, currency: e19.currency })), n2);
|
|
12229
12234
|
if (t2 === $.FREE || t2 === null) return { amount: ``, amountPaid: i2 };
|
|
12230
12235
|
if (t2 === $.PARTIALLY_PAID) {
|
|
12231
12236
|
let t3 = /* @__PURE__ */ new Map();
|
|
12232
12237
|
return e18.forEach((e19, n3) => {
|
|
12233
|
-
if (e19.state === $.FREE ||
|
|
12238
|
+
if (e19.state === $.FREE || Gj.includes(e19.state)) return;
|
|
12234
12239
|
let r3 = e19.order?._id ?? `line-${n3}`;
|
|
12235
12240
|
t3.has(r3) || t3.set(r3, e19.state === $.NOT_PAID && !e19.price ? { fallback: e19.amount, currency: e19.currency } : { price: e19.order?.balance, currency: e19.currency });
|
|
12236
|
-
}), { amount:
|
|
12241
|
+
}), { amount: Wj([...t3.values()], n2), amountPaid: i2 };
|
|
12237
12242
|
}
|
|
12238
|
-
return { amount:
|
|
12243
|
+
return { amount: Wj(e18.filter((e19) => e19.state !== $.FREE || Vj(e19.price) !== void 0 && Vj(e19.price) !== 0).map((e19) => ({ price: e19.price, currency: e19.currency, fallback: e19.amount })), n2), amountPaid: i2 };
|
|
12239
12244
|
}
|
|
12240
|
-
var { AttendanceStatus:
|
|
12241
|
-
var { ServiceType:
|
|
12242
|
-
var
|
|
12243
|
-
function
|
|
12245
|
+
var { AttendanceStatus: Jj, BookingStatus: Yj } = Ko;
|
|
12246
|
+
var { ServiceType: Xj } = ic;
|
|
12247
|
+
var Zj = 6e4;
|
|
12248
|
+
function Qj(e18) {
|
|
12244
12249
|
return e18.multiServiceBookingInfo?._id ?? e18._id ?? ``;
|
|
12245
12250
|
}
|
|
12246
|
-
var
|
|
12247
|
-
function
|
|
12248
|
-
let t2 = e18[e18.length - 1]?.booking, n2 = t2 ?
|
|
12251
|
+
var $j = (e18) => e18.multiServiceBookingInfo?._id ?? ``;
|
|
12252
|
+
function eM(e18) {
|
|
12253
|
+
let t2 = e18[e18.length - 1]?.booking, n2 = t2 ? $j(t2) : ``;
|
|
12249
12254
|
if (!n2) return { emitted: e18, deferred: [] };
|
|
12250
12255
|
let r2 = e18.length;
|
|
12251
12256
|
for (; r2 > 0; ) {
|
|
12252
12257
|
let t3 = e18[r2 - 1]?.booking;
|
|
12253
|
-
if (!t3 ||
|
|
12258
|
+
if (!t3 || $j(t3) !== n2) break;
|
|
12254
12259
|
--r2;
|
|
12255
12260
|
}
|
|
12256
12261
|
return { emitted: e18.slice(0, r2), deferred: e18.slice(r2) };
|
|
12257
12262
|
}
|
|
12258
|
-
function
|
|
12263
|
+
function tM(e18) {
|
|
12259
12264
|
let t2 = /* @__PURE__ */ new Map();
|
|
12260
12265
|
for (let n2 of e18) {
|
|
12261
12266
|
if (!n2.booking) continue;
|
|
12262
|
-
let e19 =
|
|
12267
|
+
let e19 = Qj(n2.booking);
|
|
12263
12268
|
if (!e19) continue;
|
|
12264
12269
|
let r2 = t2.get(e19);
|
|
12265
12270
|
r2 ? r2.push(n2) : t2.set(e19, [n2]);
|
|
12266
12271
|
}
|
|
12267
12272
|
return t2;
|
|
12268
12273
|
}
|
|
12269
|
-
function
|
|
12270
|
-
let t2 =
|
|
12274
|
+
function nM(e18) {
|
|
12275
|
+
let t2 = Nj(e18);
|
|
12271
12276
|
if (!t2) return null;
|
|
12272
|
-
let { width: n2, height: r2 } =
|
|
12273
|
-
return { uri:
|
|
12277
|
+
let { width: n2, height: r2 } = Mj(e18);
|
|
12278
|
+
return { uri: jj(e18) ?? void 0, url: t2, ...n2 && { width: n2 }, ...r2 && { height: r2 } };
|
|
12274
12279
|
}
|
|
12275
|
-
var
|
|
12276
|
-
function
|
|
12277
|
-
return e18.reduce((e19, n2) => n2 && (!e19 || t2(
|
|
12280
|
+
var rM = (e18) => new Date(e18).getTime();
|
|
12281
|
+
function iM(e18, t2) {
|
|
12282
|
+
return e18.reduce((e19, n2) => n2 && (!e19 || t2(rM(n2), rM(e19))) ? n2 : e19, null);
|
|
12278
12283
|
}
|
|
12279
|
-
var
|
|
12280
|
-
var
|
|
12281
|
-
function
|
|
12284
|
+
var aM = (e18) => iM(e18, (e19, t2) => e19 < t2);
|
|
12285
|
+
var oM = (e18) => iM(e18, (e19, t2) => e19 > t2);
|
|
12286
|
+
function sM(e18, t2) {
|
|
12282
12287
|
return e18 ? { href: e18, target: t2 } : null;
|
|
12283
12288
|
}
|
|
12284
|
-
function
|
|
12289
|
+
function cM(e18) {
|
|
12285
12290
|
let t2 = e18.name ?? ``, n2 = e18.bookingPolicy?.customPolicyDescription;
|
|
12286
|
-
return { name: t2, image:
|
|
12291
|
+
return { name: t2, image: nM(e18.media?.mainMedia?.image), servicePageUrl: e18.urls?.servicePage ?? ``, bookingPageUrl: e18.urls?.bookingPage ?? ``, calendarPageUrl: e18.urls?.calendarPage ?? ``, isAvailableOnline: e18.onlineBooking?.enabled === true, isCourse: e18.type === Xj.COURSE, serviceType: e18.type ?? null, isHidden: e18.hidden === true, requiresManualApproval: e18.onlineBooking?.requireManualApproval === true, policyDescription: n2?.enabled ? n2.description ?? `` : ``, rateType: e18.payment?.rateType ?? null, customPriceDescription: e18.payment?.custom?.description ?? `` };
|
|
12287
12292
|
}
|
|
12288
|
-
function
|
|
12293
|
+
function lM(e18) {
|
|
12289
12294
|
return (e18.bookedAddOns ?? []).map((e19) => ({ name: e19.nameTranslated ?? e19.name ?? ``, quantity: e19.quantity ?? 1 }));
|
|
12290
12295
|
}
|
|
12291
|
-
function
|
|
12296
|
+
function uM(e18, t2) {
|
|
12292
12297
|
if (!e18 || !t2) return 0;
|
|
12293
12298
|
let n2 = new Date(e18).getTime(), r2 = new Date(t2).getTime();
|
|
12294
|
-
return Number.isFinite(n2) && Number.isFinite(r2) && r2 > n2 ? Math.round((r2 - n2) /
|
|
12299
|
+
return Number.isFinite(n2) && Number.isFinite(r2) && r2 > n2 ? Math.round((r2 - n2) / Zj) : 0;
|
|
12295
12300
|
}
|
|
12296
|
-
function
|
|
12301
|
+
function dM(e18, t2, { services: n2, memberTimeZone: r2 }) {
|
|
12297
12302
|
let i2 = e18.booking ?? {}, a2 = i2.bookedEntity, o2 = a2?.slot?.serviceId ?? a2?.schedule?.serviceId ?? ``, s2 = n2.get(o2);
|
|
12298
|
-
return { bookingId: i2._id ?? ``, serviceId: o2, serviceName: a2?.titleTranslated || a2?.title || s2?.name || ``, serviceImage: s2?.image ?? null, startDate:
|
|
12299
|
-
}
|
|
12300
|
-
function uM(e18) {
|
|
12301
|
-
let t2 = e18.map((e19) => e19.attendance?.status).filter((e19) => !!e19 && e19 !== Kj.NOT_SET);
|
|
12302
|
-
return t2.length === 0 ? null : t2.some((e19) => e19 === Kj.NOT_ATTENDED) ? Kj.NOT_ATTENDED : Kj.ATTENDED;
|
|
12303
|
+
return { bookingId: i2._id ?? ``, serviceId: o2, serviceName: a2?.titleTranslated || a2?.title || s2?.name || ``, serviceImage: s2?.image ?? null, startDate: wj(i2.startDate), endDate: wj(i2.endDate), timeZone: ka(a2, r2), durationMinutes: uM(i2.startDate ?? null, i2.endDate ?? null), staffName: a2?.slot?.resource?.nameTranslated || a2?.slot?.resource?.name || ``, addOns: lM(i2), isAllDay: a2?.slot?.allDay === true, servicePageUrl: s2?.isHidden ? `` : s2?.servicePageUrl ?? ``, canViewServiceDetails: !zj(t2) && !!s2?.servicePageUrl && !s2.isHidden };
|
|
12303
12304
|
}
|
|
12304
|
-
var dM = [`MEMBERSHIP`, `MEMBERSHIP_OFFLINE`];
|
|
12305
12305
|
function fM(e18) {
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
var
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12306
|
+
let t2 = e18.map((e19) => e19.attendance?.status).filter((e19) => !!e19 && e19 !== Jj.NOT_SET);
|
|
12307
|
+
return t2.length === 0 ? null : t2.some((e19) => e19 === Jj.NOT_ATTENDED) ? Jj.NOT_ATTENDED : Jj.ATTENDED;
|
|
12308
|
+
}
|
|
12309
|
+
var pM = [`MEMBERSHIP`, `MEMBERSHIP_OFFLINE`];
|
|
12310
|
+
function mM(e18) {
|
|
12311
|
+
return pM.includes(e18.selectedPaymentOption ?? ``);
|
|
12312
|
+
}
|
|
12313
|
+
var hM = [`FULLY_REFUNDED`, `PARTIALLY_REFUNDED`];
|
|
12314
|
+
var gM = (e18) => !Number(e18?.amount ?? 0);
|
|
12315
|
+
var _M = (e18, t2) => !e18.bookingPrice || e18.bookingPrice.amount !== void 0 && e18.bookingPrice.amount.trim() !== `` && Number(e18.bookingPrice.amount) === 0 && !gM(e18.totalPrice) ? t2?.price : e18.bookingPrice;
|
|
12316
|
+
var vM = (e18, t2) => t2?.rateType === `CUSTOM` && !!e18 && gM(e18.bookingPrice) && gM(e18.totalPrice);
|
|
12317
|
+
function yM(e18, t2, n2) {
|
|
12318
|
+
if (!n2 || t2?.rateType === `CUSTOM` && gM(e18.bookingPrice)) {
|
|
12314
12319
|
let n3 = e18.bookingPriceDescription;
|
|
12315
12320
|
return n3?.translated || n3?.original || t2?.customPriceDescription || ``;
|
|
12316
12321
|
}
|
|
12317
12322
|
return n2.formattedAmount ?? ``;
|
|
12318
12323
|
}
|
|
12319
|
-
function
|
|
12320
|
-
let r2 = t2?.rateType === `CUSTOM` &&
|
|
12324
|
+
function bM(e18, t2, n2) {
|
|
12325
|
+
let r2 = t2?.rateType === `CUSTOM` && gM(e18.bookingPrice) ? void 0 : _M(e18, n2), i2 = yM(e18, t2, r2);
|
|
12321
12326
|
return { state: i2 ? $.NOT_PAID : null, amount: i2, price: r2 };
|
|
12322
12327
|
}
|
|
12323
|
-
function
|
|
12324
|
-
if (t2 &&
|
|
12328
|
+
function xM(e18, t2, n2, r2, i2, a2) {
|
|
12329
|
+
if (t2 && vM(t2, n2)) return bM(t2, n2, a2);
|
|
12325
12330
|
if (n2?.rateType === `NO_FEE` || e18.paymentStatus === `EXEMPT`) return { state: $.FREE, amount: ``, price: t2?.bookingPrice };
|
|
12326
|
-
if (
|
|
12327
|
-
if (t2 &&
|
|
12328
|
-
if (!t2 ||
|
|
12331
|
+
if (mM(e18)) return { state: r2 ? $.PLAN_PAID : null, amount: `` };
|
|
12332
|
+
if (t2 && gM(t2.bookingPrice) && gM(t2.totalPrice)) return { state: $.FREE, amount: ``, price: t2.bookingPrice };
|
|
12333
|
+
if (!t2 || hM.includes(t2.paymentStatus ?? ``)) return { state: null, amount: ``, price: t2?.bookingPrice };
|
|
12329
12334
|
if (t2.paymentStatus === `PAID`) {
|
|
12330
|
-
let r3 = i2.get(t2._id ?? ``) ?? (e18.selectedPaymentOption === `ONLINE` ? `ONLINE` : `IN_PERSON`), o2 =
|
|
12331
|
-
return { state: r3 === `ONLINE` ? $.PAID_ONLINE : $.PAID_IN_PERSON, amount: o2?.formattedAmount ??
|
|
12335
|
+
let r3 = i2.get(t2._id ?? ``) ?? (e18.selectedPaymentOption === `ONLINE` ? `ONLINE` : `IN_PERSON`), o2 = _M(t2, a2);
|
|
12336
|
+
return { state: r3 === `ONLINE` ? $.PAID_ONLINE : $.PAID_IN_PERSON, amount: o2?.formattedAmount ?? yM(t2, n2), price: o2 };
|
|
12332
12337
|
}
|
|
12333
|
-
return t2.paymentStatus === `PARTIALLY_PAID` ? { state: $.PARTIALLY_PAID, amount: t2.balance?.formattedAmount ?? ``, price:
|
|
12338
|
+
return t2.paymentStatus === `PARTIALLY_PAID` ? { state: $.PARTIALLY_PAID, amount: t2.balance?.formattedAmount ?? ``, price: _M(t2, a2) } : bM(t2, n2, a2);
|
|
12334
12339
|
}
|
|
12335
|
-
function
|
|
12340
|
+
function SM(e18, { services: t2, orderPaymentMethods: n2, orderPlanCharges: r2, bookingLinePrices: i2, locale: a2 }) {
|
|
12336
12341
|
let o2 = e18.map((e19) => {
|
|
12337
12342
|
let a3 = e19.booking ?? {}, o3 = a3.bookedEntity?.slot?.serviceId ?? a3.bookedEntity?.schedule?.serviceId ?? ``, s3 = r2.get(e19.order?._id ?? ``);
|
|
12338
|
-
return { order: e19.order, charge: s3, currency: i2.get(a3._id ?? ``)?.currency ?? e19.order?.currency, ...
|
|
12339
|
-
}), s2 =
|
|
12343
|
+
return { order: e19.order, charge: s3, currency: i2.get(a3._id ?? ``)?.currency ?? e19.order?.currency, ...xM(a3, e19.order, t2.get(o3), s3, n2, i2.get(a3._id ?? ``)) };
|
|
12344
|
+
}), s2 = Kj(o2), c2 = o2.find((e19) => e19.state === s2)?.charge, { amount: l2, amountPaid: u2 } = qj(o2, s2, a2), d2 = s2 === $.PLAN_PAID;
|
|
12340
12345
|
return { planName: d2 && (c2?.translated || c2?.original) || ``, amountPaid: d2 ? `` : u2, state: s2 !== $.FREE && !d2 && !l2 ? null : s2, amount: l2 };
|
|
12341
12346
|
}
|
|
12342
|
-
function
|
|
12347
|
+
function CM(e18) {
|
|
12343
12348
|
return (e18.participantsChoices?.serviceChoices ?? []).reduce((e19, t2) => e19 + (t2.numberOfParticipants ?? 0), 0);
|
|
12344
12349
|
}
|
|
12345
|
-
var
|
|
12346
|
-
function
|
|
12350
|
+
var wM = (e18) => !!e18 && new Date(e18).getTime() < Date.now();
|
|
12351
|
+
function TM(e18, t2, n2) {
|
|
12347
12352
|
let r2 = Date.now();
|
|
12348
|
-
return e18.map((e19) => ({ reading: e19, startsAt: e19.startDate ?
|
|
12353
|
+
return e18.map((e19) => ({ reading: e19, startsAt: e19.startDate ? rM(e19.startDate) : NaN })).filter(({ startsAt: e19 }) => e19 > r2).sort((e19, t3) => e19.startsAt - t3.startsAt).map(({ reading: e19 }) => ({ startDate: e19.startDate, endDate: e19.endDate, timeZone: t2, durationMinutes: uM(e19.startDate, e19.endDate), staffName: e19.staffName || n2 }));
|
|
12349
12354
|
}
|
|
12350
|
-
function
|
|
12351
|
-
return (t2 ?? e18.every((e19) => e19.allowedActions?.reschedule === true)) && n2 !==
|
|
12355
|
+
function EM(e18, t2, n2, r2, i2) {
|
|
12356
|
+
return (t2 ?? e18.every((e19) => e19.allowedActions?.reschedule === true)) && n2 !== Yj.PENDING && !!i2 && r2.every((e19) => !!e19 && !e19.isCourse && !e19.isHidden && !e19.requiresManualApproval);
|
|
12352
12357
|
}
|
|
12353
|
-
function
|
|
12354
|
-
return e18 ===
|
|
12358
|
+
function DM(e18) {
|
|
12359
|
+
return e18 === Yj.CONFIRMED || e18 === Yj.CREATED;
|
|
12355
12360
|
}
|
|
12356
|
-
function
|
|
12357
|
-
return
|
|
12361
|
+
function OM(e18, t2) {
|
|
12362
|
+
return DM(e18) && t2.every((e19) => !!e19.startDate && !!e19.endDate) && !Bj(e18, oM(t2.map((e19) => e19.endDate)));
|
|
12358
12363
|
}
|
|
12359
|
-
function
|
|
12360
|
-
return !!r2?.bookingPageUrl && !r2.isHidden && !r2.isCourse && e18.length === 1 &&
|
|
12364
|
+
function kM(e18, t2, n2, r2) {
|
|
12365
|
+
return !!r2?.bookingPageUrl && !r2.isHidden && !r2.isCourse && e18.length === 1 && Bj(t2, n2);
|
|
12361
12366
|
}
|
|
12362
|
-
var
|
|
12367
|
+
var AM = (e18) => {
|
|
12363
12368
|
let t2 = e18.booking?.startDate;
|
|
12364
12369
|
return t2 ? new Date(t2).getTime() : 1 / 0;
|
|
12365
12370
|
};
|
|
12366
|
-
function
|
|
12367
|
-
return [...e18].sort((e19, t2) =>
|
|
12371
|
+
function jM(e18) {
|
|
12372
|
+
return [...e18].sort((e19, t2) => AM(e19) - AM(t2));
|
|
12368
12373
|
}
|
|
12369
|
-
function
|
|
12370
|
-
let n2 =
|
|
12374
|
+
function MM(e18, t2) {
|
|
12375
|
+
let n2 = jM(e18), r2 = n2[0]?.booking;
|
|
12371
12376
|
if (!r2) return null;
|
|
12372
|
-
let i2 =
|
|
12377
|
+
let i2 = Rj(n2.map((e19) => e19.booking?.status).filter((e19) => !!e19)), a2 = n2.map((e19) => dM(e19, i2, t2)), o2 = [...new Set(a2.map((e19) => e19.serviceId).filter(Boolean))], s2 = t2.services.get(a2[0].serviceId), c2 = o2.map((e19) => t2.services.get(e19)), l2 = s2?.calendarPageUrl || s2?.bookingPageUrl || ``, u2 = t2.multiServiceAllowedActions.get($j(r2)), d2 = aM(a2.map((e19) => e19.startDate)), f2 = oM(a2.map((e19) => e19.endDate)), p2 = wM(f2) ? fM(n2) : null, m2 = r2.bookedEntity, h2 = m2?.slot?.location ?? m2?.schedule?.location, g2 = n2.find((e19) => e19.conferencingDetails)?.conferencingDetails, _2 = a2[0].timeZone, v2 = !!g2?.guestUrl && DM(i2), y2 = n2.map((e19) => t2.cancellationFees.get(e19.booking?._id ?? ``)), b2 = y2.reduce((e19, t3) => e19 + (t3?.amount ?? 0), 0), x2 = y2.reduce((e19, t3, n3) => t3?.policyDescription ? [...e19, { description: t3.policyDescription, serviceName: a2[n3].serviceName }] : e19, []), S2 = o2.reduce((e19, n3) => {
|
|
12373
12378
|
let r3 = t2.services.get(n3)?.policyDescription, i3 = a2.find((e20) => e20.serviceId === n3)?.serviceName;
|
|
12374
12379
|
return r3 ? [...e19, { description: r3, serviceName: i3 ?? `` }] : e19;
|
|
12375
12380
|
}, []), C2 = [...new Set(n2.map((e19) => e19.booking?.formSubmissionId ?? ``).filter((e19) => t2.submittedForms.has(e19)))], ee2 = C2.map((e19) => t2.submittedForms.get(e19) ?? ``), w2 = s2?.isCourse ? t2.courseSessions.get(m2?.schedule?.scheduleId ?? ``) ?? [] : [];
|
|
12376
|
-
return { groupId:
|
|
12381
|
+
return { groupId: Qj(r2), bookingIds: n2.map((e19) => e19.booking?._id ?? ``), revision: n2.length === 1 ? r2.revision ?? null : null, bookingPageUrl: s2?.bookingPageUrl ?? ``, calendarPageUrl: s2?.calendarPageUrl ?? ``, contactId: r2.contactDetails?.contactId ?? null, title: a2[0].serviceName || null, serviceNames: a2.map((e19) => e19.serviceName), serviceImage: a2[0].serviceImage, startDate: d2, endDate: f2, timeZone: _2, isAllDay: m2?.slot?.allDay === true, location: (h2?.locationType === `OWNER_BUSINESS` ? `` : h2?.name) || h2?.formattedAddressTranslated || h2?.formattedAddress || t2.businessAddress, durationMinutes: a2.reduce((e19, t3) => e19 + t3.durationMinutes, 0), staffName: a2[0].staffName, participantCount: r2.totalParticipants ?? CM(r2), isCourse: s2?.isCourse === true, courseSessionCount: w2.length, courseSessions: TM(w2, _2, a2[0].staffName), serviceType: s2?.serviceType ?? null, status: i2, isOver: Bj(i2, f2), attendanceStatus: p2, isAvailableOnline: v2, videoConferenceLink: v2 ? sM(g2?.guestUrl ?? ``, `_blank`) : null, conferencingDetails: { guestUrl: v2 ? sM(g2?.guestUrl ?? ``, `_blank`) : null }, videoConferencePassword: v2 ? g2?.password ?? `` : ``, servicePageUrl: s2?.isHidden ? `` : s2?.servicePageUrl ?? ``, multiServiceId: $j(r2) || null, canCancel: u2?.cancel ?? n2.every((e19) => e19.allowedActions?.cancel === true), canStateCancellationFee: n2.every((e19) => !t2.unreadableCancellationFees.has(e19.booking?._id ?? ``)), canReschedule: EM(n2, u2?.reschedule, i2, c2, l2), canBookAgain: kM(n2, i2, f2, s2), canBookAgainOnceCanceled: kM(n2, Yj.CANCELED, f2, s2), canAddToCalendar: OM(i2, a2), canViewServiceDetails: !zj(i2) && !!s2?.servicePageUrl && !s2.isHidden, cancellationFee: b2 ? Fj({ amount: b2, currency: y2.find(Boolean)?.currency, language: t2.locale }) : ``, cancellationPolicies: x2, bookingPolicies: S2, hasBookingPolicy: !zj(i2) && S2.length > 0, payment: SM(n2, t2), hasOrder: n2.some((e19) => e19.order), submittedFormNames: [...new Set(ee2.filter(Boolean))], formSubmissionIds: C2, hasFormSubmission: C2.length > 0, sessions: a2 };
|
|
12377
12382
|
}
|
|
12378
|
-
function
|
|
12379
|
-
return [
|
|
12383
|
+
function NM(e18, t2) {
|
|
12384
|
+
return [...tM(e18).values()].map((e19) => MM(e19, t2)).filter((e19) => e19 !== null);
|
|
12380
12385
|
}
|
|
12381
|
-
function
|
|
12382
|
-
return new Map(
|
|
12386
|
+
function PM(e18, t2) {
|
|
12387
|
+
return new Map(NM(e18, t2).filter((e19) => e19.hasFormSubmission).map(({ groupId: e19, formSubmissionIds: t3, hasFormSubmission: n2, submittedFormNames: r2 }) => [e19, { formSubmissionIds: t3, hasFormSubmission: n2, submittedFormNames: r2 }]));
|
|
12383
12388
|
}
|
|
12384
|
-
function
|
|
12389
|
+
function FM(e18, t2) {
|
|
12385
12390
|
return e18.map((e19) => {
|
|
12386
12391
|
let n2 = t2.get(e19.groupId);
|
|
12387
12392
|
return n2 ? { ...e19, ...n2 } : e19;
|
|
12388
12393
|
});
|
|
12389
12394
|
}
|
|
12390
|
-
function
|
|
12395
|
+
function IM(e18) {
|
|
12391
12396
|
let t2 = e18.map((e19) => {
|
|
12392
12397
|
let t3 = e19.booking?.bookedEntity;
|
|
12393
12398
|
return t3?.slot?.serviceId ?? t3?.schedule?.serviceId ?? ``;
|
|
12394
12399
|
});
|
|
12395
12400
|
return [...new Set(t2.filter(Boolean))];
|
|
12396
12401
|
}
|
|
12397
|
-
function
|
|
12402
|
+
function LM(e18, t2) {
|
|
12398
12403
|
return e18.map((e19) => ({ ...e19, timeZone: e19.sessions[0]?.isAllDay ? e19.timeZone : t2, sessions: e19.sessions.map((e20) => e20.isAllDay ? e20 : { ...e20, timeZone: t2 }), courseSessions: e19.courseSessions.map((e20) => ({ ...e20, timeZone: t2 })) }));
|
|
12399
12404
|
}
|
|
12400
|
-
var
|
|
12401
|
-
function
|
|
12402
|
-
return Object.fromEntries(Object.entries(e18).filter(([e19]) => !(e19 in
|
|
12405
|
+
var RM = { groupId: true, bookingIds: true, revision: true, multiServiceId: true, bookingPageUrl: true, calendarPageUrl: true, contactId: true, formSubmissionIds: true };
|
|
12406
|
+
function zM(e18) {
|
|
12407
|
+
return Object.fromEntries(Object.entries(e18).filter(([e19]) => !(e19 in RM)));
|
|
12403
12408
|
}
|
|
12404
|
-
function
|
|
12405
|
-
return { ...e18, startDate:
|
|
12409
|
+
function BM(e18) {
|
|
12410
|
+
return { ...e18, startDate: Tj(e18.startDate, e18.timeZone), endDate: Tj(e18.endDate, e18.timeZone), sessions: e18.sessions.map((e19) => ({ ...e19, startDate: Tj(e19.startDate, e19.timeZone), endDate: Tj(e19.endDate, e19.timeZone) })), courseSessions: e18.courseSessions.map((e19) => ({ ...e19, startDate: Tj(e19.startDate, e19.timeZone), endDate: Tj(e19.endDate, e19.timeZone) })) };
|
|
12406
12411
|
}
|
|
12407
|
-
var
|
|
12412
|
+
var VM = () => {
|
|
12408
12413
|
let { locale: e18, language: t2 } = f(ua);
|
|
12409
12414
|
return e18 || t2;
|
|
12410
12415
|
};
|
|
12411
|
-
var
|
|
12412
|
-
var
|
|
12413
|
-
var
|
|
12414
|
-
var
|
|
12415
|
-
var
|
|
12416
|
-
var
|
|
12417
|
-
var
|
|
12418
|
-
var
|
|
12419
|
-
var
|
|
12420
|
-
var
|
|
12421
|
-
var
|
|
12422
|
-
var
|
|
12423
|
-
var
|
|
12424
|
-
var
|
|
12416
|
+
var HM = { CREATED: `CONFIRMED`, CONFIRMED: `CONFIRMED`, PENDING: `PENDING`, WAITING_LIST: `WAITLISTED`, CANCELED: `CANCELED`, DECLINED: `DECLINED` };
|
|
12417
|
+
var UM = { ATTENDED: `ATTENDED`, NOT_ATTENDED: `NOT_ATTENDED`, NOT_SET: null };
|
|
12418
|
+
var WM = { CONFIRMED: Da.status.confirmed, PENDING: Da.status.pending, WAITLISTED: Da.status.waitlisted, CANCELED: Da.status.canceled, DECLINED: Da.status.declined, ATTENDED: Da.status.attended, NOT_ATTENDED: Da.status.notAttended };
|
|
12419
|
+
var GM = { "&": `&`, "<": `<`, ">": `>`, '"': `"`, "'": `'` };
|
|
12420
|
+
var KM = (e18) => ({ text: e18, html: `<p>${e18.replace(/[&<>"']/g, (e19) => GM[e19])}</p>`, linkList: [] });
|
|
12421
|
+
var qM = (e18, t2) => t2 ? KM(Ta(e18, WM[t2])) : null;
|
|
12422
|
+
var JM = (e18, t2) => t2 !== null && Object.hasOwn(e18, t2) ? e18[t2] : null;
|
|
12423
|
+
var YM = (e18, t2) => qM(e18, JM(HM, t2));
|
|
12424
|
+
var XM = (e18, t2) => qM(e18, JM(UM, t2));
|
|
12425
|
+
var ZM = (e18) => ({ statusToRichText: (t2) => YM(e18, t2), attendanceStatusToRichText: (t2) => XM(e18, t2) });
|
|
12426
|
+
var QM = cj();
|
|
12427
|
+
var $M = `bookingId`;
|
|
12428
|
+
var eN = `rescheduleRedirectUrl`;
|
|
12429
|
+
var tN = (e18, t2, n2) => {
|
|
12425
12430
|
let r2 = e18.indexOf(`#`), i2 = r2 === -1 ? `` : e18.slice(r2), a2 = r2 === -1 ? e18 : e18.slice(0, r2), o2 = a2.indexOf(`?`), s2 = o2 === -1 ? a2 : a2.slice(0, o2), c2 = new URLSearchParams(o2 === -1 ? `` : a2.slice(o2 + 1));
|
|
12426
|
-
return c2.set(
|
|
12431
|
+
return c2.set($M, t2), n2 && c2.set(eN, n2), `${s2}?${c2.toString()}${i2}`;
|
|
12427
12432
|
};
|
|
12428
|
-
var
|
|
12429
|
-
var
|
|
12433
|
+
var nN = async (e18, t2) => (await QM.queryBookingById(e18.bookingIds[0]).catch(() => void 0))?.extendedBookings?.[0]?.booking?.revision ?? t2 ?? ``;
|
|
12434
|
+
var rN = (e18, t2, n2) => {
|
|
12430
12435
|
let r2 = e18.serviceNames.length;
|
|
12431
12436
|
if (e18.multiServiceId && r2 > 1) return { succeeded: Ea(t2, Da.cancel.succeededGroup, r2, { value: dD(r2, n2) }), failed: Ea(t2, Da.cancel.failedGroup, r2, { value: dD(r2, n2) }) };
|
|
12432
12437
|
if (e18.status === ds.PENDING) return { succeeded: Ta(t2, Da.cancel.succeededPending), failed: Ta(t2, Da.cancel.failedPending) };
|
|
12433
12438
|
let i2 = e18.serviceNames[0] ?? e18.title ?? ``;
|
|
12434
12439
|
return { succeeded: Ta(t2, Da.cancel.succeeded, { service: i2 }), failed: Ta(t2, Da.cancel.failed, { service: i2 }) };
|
|
12435
12440
|
};
|
|
12436
|
-
var
|
|
12437
|
-
let { t: a2 } = sa(), s2 = Lh(), { navigateTo: c2 } = f(da), p2 = f(eo), { siteUrl: m2 } = p2, { language: h2 } = f(ua), g2 =
|
|
12441
|
+
var iN = (e18, t2, n2, r2, i2) => {
|
|
12442
|
+
let { t: a2 } = sa(), s2 = Lh(), { navigateTo: c2 } = f(da), p2 = f(eo), { siteUrl: m2 } = p2, { language: h2 } = f(ua), g2 = VM(), [_2, v2] = d([]), y2 = u(/* @__PURE__ */ new Map()), [b2, x2] = d([]), S2 = u(/* @__PURE__ */ new Set()), C2 = u(/* @__PURE__ */ new Map()), ee2 = Ia(), w2 = o((e19, t3) => {
|
|
12438
12443
|
let o2 = y2.current.get(e19.groupId);
|
|
12439
12444
|
if (o2) return o2;
|
|
12440
12445
|
v2((t4) => [...t4, e19.groupId]), x2((t4) => t4.filter((t5) => t5 !== e19.groupId)), S2.current.delete(e19.groupId);
|
|
12441
|
-
let c3 = Promise.resolve().then(t3).then(() => (n2(e19.groupId), i2(e19))).then(() => (s2.success(
|
|
12446
|
+
let c3 = Promise.resolve().then(t3).then(() => (n2(e19.groupId), i2(e19))).then(() => (s2.success(rN(e19, a2, g2).succeeded), true), () => (r2(e19.groupId), x2((t4) => [...t4, e19.groupId]), s2.error(rN(e19, a2, g2).failed), false)).finally(() => {
|
|
12442
12447
|
y2.current.delete(e19.groupId), v2((t4) => t4.filter((t5) => t5 !== e19.groupId));
|
|
12443
12448
|
});
|
|
12444
12449
|
return y2.current.set(e19.groupId, c3), c3;
|
|
12445
12450
|
}, [n2, r2, i2, a2, s2, g2]), T2 = o((e19) => w2(e19, async () => {
|
|
12446
12451
|
let { multiServiceId: t3 } = e19;
|
|
12447
|
-
if (t3) return
|
|
12448
|
-
let n3 = await
|
|
12452
|
+
if (t3) return QM.cancelMultiServiceBooking(t3);
|
|
12453
|
+
let n3 = await nN(e19, e19.revision);
|
|
12449
12454
|
if (!n3) throw Error(`No revision to cancel booking ${e19.bookingIds[0]} with`);
|
|
12450
|
-
return
|
|
12455
|
+
return QM.cancelBooking(e19.bookingIds[0], n3);
|
|
12451
12456
|
}), [w2]), te2 = o((e19) => {
|
|
12452
12457
|
if (!e19.canAddToCalendar) return;
|
|
12453
|
-
let t3 =
|
|
12458
|
+
let t3 = bj(e19, a2, g2);
|
|
12454
12459
|
window.open(t3, `_blank`, `noopener`);
|
|
12455
|
-
}, [a2, g2]), ne2 =
|
|
12460
|
+
}, [a2, g2]), ne2 = Sj(e18), re2 = o(async (e19) => {
|
|
12456
12461
|
ee2($a(t2));
|
|
12457
12462
|
let n3 = (C2.current.get(e19.groupId) ?? 0) + 1;
|
|
12458
12463
|
C2.current.set(e19.groupId, n3);
|
|
@@ -12465,50 +12470,50 @@ var nN = (e18, t2, n2, r2, i2) => {
|
|
|
12465
12470
|
return C2.current.get(e19.groupId) === n3 && s2.error(t3), { type: `error`, message: t3 };
|
|
12466
12471
|
}
|
|
12467
12472
|
}, [a2, s2, ee2, t2, ne2]), ie2 = (e19) => {
|
|
12468
|
-
let t3 = (e20) =>
|
|
12473
|
+
let t3 = (e20) => fj(e20, m2, p2.currentUrl, h2);
|
|
12469
12474
|
return { ...e19, bookingPageUrl: t3(e19.bookingPageUrl), calendarPageUrl: t3(e19.calendarPageUrl), servicePageUrl: e19.servicePageUrl && t3(e19.servicePageUrl), sessions: e19.sessions.map((e20) => ({ ...e20, servicePageUrl: e20.servicePageUrl && t3(e20.servicePageUrl) })) };
|
|
12470
|
-
}, ae2 = l(() =>
|
|
12471
|
-
return { bookings: l(() => e18.map(ie2).map((e19) => ({ ...
|
|
12472
|
-
e20.canViewServiceDetails && e20.servicePageUrl &&
|
|
12475
|
+
}, ae2 = l(() => ZM(a2), [a2]);
|
|
12476
|
+
return { bookings: l(() => e18.map(ie2).map((e19) => ({ ...zM(BM(e19)), sessions: BM(e19).sessions.map((e20) => ({ ...e20, onViewServiceDetails: () => {
|
|
12477
|
+
e20.canViewServiceDetails && e20.servicePageUrl && pj(e20.servicePageUrl);
|
|
12473
12478
|
} })), _id: e19.groupId, isCancelling: _2.includes(e19.groupId), hasCancelFailed: b2.includes(e19.groupId), cancelFailureDismissals: { isDismissed: () => S2.current.has(e19.groupId), dismiss: () => {
|
|
12474
12479
|
S2.current.add(e19.groupId);
|
|
12475
12480
|
} }, onCancel: () => T2(e19), onAddToCalendar: () => te2(e19), onReschedule: () => {
|
|
12476
12481
|
let n3 = e19.calendarPageUrl || e19.bookingPageUrl;
|
|
12477
|
-
e19.canReschedule && n3 && e19.multiServiceId === null && (ee2(Za(t2, { bookingId: e19.bookingIds[0], serviceId: e19.sessions[0]?.serviceId, contactId: e19.contactId })), c2({ href:
|
|
12482
|
+
e19.canReschedule && n3 && e19.multiServiceId === null && (ee2(Za(t2, { bookingId: e19.bookingIds[0], serviceId: e19.sessions[0]?.serviceId, contactId: e19.contactId })), c2({ href: tN(n3, e19.bookingIds[0], p2.currentUrl) }));
|
|
12478
12483
|
}, onBookAgain: () => {
|
|
12479
12484
|
e19.canBookAgain && (ee2(Ya(t2, e19.serviceType)), ee2(Xa(e19.serviceType, e19.sessions[0]?.serviceId)), c2({ href: e19.bookingPageUrl }));
|
|
12480
12485
|
}, onViewServiceDetails: () => {
|
|
12481
|
-
e19.canViewServiceDetails && e19.servicePageUrl &&
|
|
12486
|
+
e19.canViewServiceDetails && e19.servicePageUrl && pj(e19.servicePageUrl);
|
|
12482
12487
|
}, onJoinVideoCall: () => {
|
|
12483
12488
|
let t3 = e19.isAvailableOnline ? e19.conferencingDetails.guestUrl?.href : ``;
|
|
12484
12489
|
t3 && (ee2(Qa()), window.open(t3, `_blank`, `noopener`));
|
|
12485
12490
|
}, onLoadFormSubmission: () => re2(e19), ...ae2 })), [e18, ae2, _2, b2, T2, te2, c2, p2, m2, h2, re2, ee2, t2]), themeAnchor: s2.themeAnchor };
|
|
12486
12491
|
};
|
|
12487
|
-
var
|
|
12488
|
-
var
|
|
12489
|
-
var
|
|
12490
|
-
let { pages: t2 } = f(
|
|
12491
|
-
return r2 ? `./${(n2.appSectionRelativeUrl(
|
|
12492
|
+
var aN = la(`@wix/site-service-pages`);
|
|
12493
|
+
var oN = `13d21c63-b5ec-5912-8397-c3a5ddb27a97`;
|
|
12494
|
+
var sN = (e18) => {
|
|
12495
|
+
let { pages: t2 } = f(aN), n2 = f(eo), r2 = uD(t2, e18)?.appPageId;
|
|
12496
|
+
return r2 ? `./${(n2.appSectionRelativeUrl(oN, r2) ?? ``).replace(/^\//, ``)}` : null;
|
|
12492
12497
|
};
|
|
12493
|
-
var
|
|
12494
|
-
let { t: e18 } = sa(), t2 =
|
|
12498
|
+
var cN = () => {
|
|
12499
|
+
let { t: e18 } = sa(), t2 = VM(), { language: n2 } = f(ua), r2 = o((e19) => new Intl.NumberFormat(t2).format(e19), [t2]), i2 = o((e19) => fD(e19, n2, { unbreakableParts: true }), [n2]), a2 = o((t3) => t3.join(Ta(e18, Da.forms.separator)), [e18]), s2 = o((t3) => t3.flatMap((e19) => e19.addOns).filter((e19) => e19.name).map((t4) => t4.quantity > 1 ? Ta(e18, Da.addOns.withQuantity, { name: t4.name, quantity: r2(t4.quantity) }) : t4.name).join(Ta(e18, Da.addOns.separator)), [e18, r2]);
|
|
12495
12500
|
return l(() => ({ duration: i2, addOnsSummary: s2, submittedFormsSummary: a2 }), [i2, s2, a2]);
|
|
12496
12501
|
};
|
|
12497
|
-
var
|
|
12498
|
-
let t2 =
|
|
12502
|
+
var lN = (e18) => {
|
|
12503
|
+
let t2 = cN();
|
|
12499
12504
|
return l(() => e18.map(({ durationMinutes: e19, sessions: n2, courseSessions: r2, payment: i2, submittedFormNames: a2, hasOrder: o2, canBookAgainOnceCanceled: s2, ...c2 }) => {
|
|
12500
12505
|
let l2 = t2.addOnsSummary(n2), u2 = !c2.isOver, d2 = i2.state === `PLAN_PAID`, f2 = u2 && i2.state !== null, p2 = u2 && !!c2.location, m2 = t2.submittedFormsSummary(a2), h2 = u2 && !!m2;
|
|
12501
12506
|
return { ...c2, bookedDuration: t2.duration(e19), addOnsSummary: l2, hasBookedAddOns: !!l2, hasLocation: p2, submittedFormsSummary: m2, hasSubmittedForms: h2, hasDetails: p2 || f2 || h2, hasPaymentLink: u2 && (d2 || f2 && o2), isMultiService: c2.multiServiceId !== null, payment: { ...i2, hasPlan: d2, hasSummary: f2 }, sessions: n2.map(({ durationMinutes: e20, ...n3 }) => ({ ...n3, bookedDuration: t2.duration(e20) })), courseSessions: r2.map(({ durationMinutes: e20, ...n3 }) => ({ ...n3, duration: t2.duration(e20) })) };
|
|
12502
12507
|
}), [e18, t2]);
|
|
12503
12508
|
};
|
|
12504
|
-
var
|
|
12505
|
-
var
|
|
12506
|
-
var
|
|
12507
|
-
function
|
|
12509
|
+
var uN = cj();
|
|
12510
|
+
var dN = 19;
|
|
12511
|
+
var fN = `1cd44cf8-756f-41c3-bd90-3e2ffcaf1155`;
|
|
12512
|
+
function pN(e18) {
|
|
12508
12513
|
let t2 = /* @__PURE__ */ new Map();
|
|
12509
12514
|
for (let n2 of e18) {
|
|
12510
|
-
let e19 = n2.booking?.bookedEntity?.schedule, r2 = e19?.scheduleId, i2 = e19?.firstSessionStart?.slice(0,
|
|
12511
|
-
if (!r2 || i2.length !==
|
|
12515
|
+
let e19 = n2.booking?.bookedEntity?.schedule, r2 = e19?.scheduleId, i2 = e19?.firstSessionStart?.slice(0, dN) ?? ``, a2 = e19?.lastSessionEnd?.slice(0, dN) ?? ``;
|
|
12516
|
+
if (!r2 || i2.length !== dN || a2.length !== dN) continue;
|
|
12512
12517
|
let o2 = e19.timezone ?? ``, s2 = t2.get(o2);
|
|
12513
12518
|
if (!s2) {
|
|
12514
12519
|
t2.set(o2, { scheduleIds: [r2], fromLocalDate: i2, toLocalDate: a2 });
|
|
@@ -12518,95 +12523,95 @@ function dN(e18) {
|
|
|
12518
12523
|
}
|
|
12519
12524
|
return t2;
|
|
12520
12525
|
}
|
|
12521
|
-
function
|
|
12522
|
-
let n2 =
|
|
12526
|
+
function mN(e18, t2) {
|
|
12527
|
+
let n2 = wj(e18?.utcDate);
|
|
12523
12528
|
if (n2 || !e18?.localDate || !t2) return n2;
|
|
12524
12529
|
let r2 = Z.fromISO(e18.localDate, { zone: t2 });
|
|
12525
12530
|
return r2.isValid ? r2.toJSDate().toISOString() : null;
|
|
12526
12531
|
}
|
|
12527
|
-
function
|
|
12532
|
+
function hN(e18 = []) {
|
|
12528
12533
|
let t2 = e18.filter((e19) => e19.name);
|
|
12529
|
-
return (t2.find((e19) => e19.type ===
|
|
12534
|
+
return (t2.find((e19) => e19.type === fN) ?? t2[0])?.name ?? ``;
|
|
12530
12535
|
}
|
|
12531
|
-
function
|
|
12536
|
+
function gN(e18, t2) {
|
|
12532
12537
|
let n2 = e18.timeZone || e18.start?.timeZone || t2;
|
|
12533
|
-
return { startDate:
|
|
12538
|
+
return { startDate: mN(e18.start, n2), endDate: mN(e18.end, n2), staffName: hN(e18.resources) };
|
|
12534
12539
|
}
|
|
12535
|
-
async function
|
|
12536
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
12540
|
+
async function _N(e18) {
|
|
12541
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = pN(e18);
|
|
12537
12542
|
if (n2.size === 0) return t2;
|
|
12538
|
-
let r2 = await Promise.all([...n2].map(([e19, { scheduleIds: t3, fromLocalDate: n3, toLocalDate: r3 }]) =>
|
|
12543
|
+
let r2 = await Promise.all([...n2].map(([e19, { scheduleIds: t3, fromLocalDate: n3, toLocalDate: r3 }]) => uN.queryScheduleEvents(t3, { fromLocalDate: n3, toLocalDate: r3, ...e19 ? { timeZone: e19 } : {} }).then((t4) => t4.map((t5) => ({ event: t5, timeZone: e19 }))).catch(() => [])));
|
|
12539
12544
|
for (let { event: e19, timeZone: n3 } of r2.flat()) if (e19.scheduleId && e19.status !== vD.CANCELLED) {
|
|
12540
12545
|
let r3 = t2.get(e19.scheduleId) ?? [];
|
|
12541
|
-
r3.push(
|
|
12546
|
+
r3.push(gN(e19, n3)), t2.set(e19.scheduleId, r3);
|
|
12542
12547
|
}
|
|
12543
12548
|
return t2;
|
|
12544
12549
|
}
|
|
12545
|
-
var
|
|
12546
|
-
var
|
|
12547
|
-
var
|
|
12548
|
-
var
|
|
12549
|
-
var
|
|
12550
|
-
async function
|
|
12551
|
-
let t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Map(), r2 = [...new Set(e18.filter((e19) => e19.order?.paymentStatus === `PAID` || e19.booking &&
|
|
12550
|
+
var vN = cj();
|
|
12551
|
+
var yN = `APPROVED`;
|
|
12552
|
+
var bN = `CHARGED`;
|
|
12553
|
+
var xN = (e18) => e18.giftcardPaymentDetails ? e18.giftcardPaymentDetails.voided !== true : e18.regularPaymentDetails?.status === yN;
|
|
12554
|
+
var SN = (e18) => e18.membershipPaymentDetails?.status === bN && e18.membershipPaymentDetails.voided !== true;
|
|
12555
|
+
async function CN(e18) {
|
|
12556
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Map(), r2 = [...new Set(e18.filter((e19) => e19.order?.paymentStatus === `PAID` || e19.booking && mM(e19.booking)).map((e19) => e19.order?._id ?? ``).filter(Boolean))];
|
|
12552
12557
|
if (r2.length === 0) return { methods: t2, planCharges: n2 };
|
|
12553
|
-
let i2 = await
|
|
12558
|
+
let i2 = await vN.listOrderTransactions(r2).catch(() => void 0);
|
|
12554
12559
|
for (let { orderId: e19, payments: r3 } of i2?.orderTransactions ?? []) {
|
|
12555
12560
|
if (!e19) continue;
|
|
12556
|
-
let i3 = (r3 ?? []).find(
|
|
12561
|
+
let i3 = (r3 ?? []).find(SN)?.membershipPaymentDetails;
|
|
12557
12562
|
i3 && n2.set(e19, i3.name ?? {});
|
|
12558
|
-
let [a2] = (r3 ?? []).filter(
|
|
12563
|
+
let [a2] = (r3 ?? []).filter(xN).sort((e20, t3) => new Date(t3._createdDate ?? 0).getTime() - new Date(e20._createdDate ?? 0).getTime());
|
|
12559
12564
|
a2 && t2.set(e19, a2.regularPaymentDetails && !a2.regularPaymentDetails.offlinePayment ? `ONLINE` : `IN_PERSON`);
|
|
12560
12565
|
}
|
|
12561
12566
|
return { methods: t2, planCharges: n2 };
|
|
12562
12567
|
}
|
|
12563
|
-
var
|
|
12564
|
-
var
|
|
12565
|
-
async function
|
|
12566
|
-
let t2 = e18.filter(({ booking: e19, order: t3 }) => e19?._id && t3?._id && !
|
|
12568
|
+
var wN = cj();
|
|
12569
|
+
var TN = (e18) => !!e18?.amount?.trim() || !!e18?.formattedAmount;
|
|
12570
|
+
async function EN(e18) {
|
|
12571
|
+
let t2 = e18.filter(({ booking: e19, order: t3 }) => e19?._id && t3?._id && !mM(e19) && ![`FULLY_REFUNDED`, `PARTIALLY_REFUNDED`].includes(t3.paymentStatus ?? ``) && (!t3.bookingPrice || t3.bookingPrice.amount !== void 0 && t3.bookingPrice.amount.trim() !== `` && Number(t3.bookingPrice.amount) === 0 && Number(t3.totalPrice?.amount) > 0)), n2 = [...new Set(t2.map(({ order: e19 }) => e19._id))], r2 = /* @__PURE__ */ new Map();
|
|
12567
12572
|
return await Promise.all(n2.map(async (e19) => {
|
|
12568
|
-
let n3 = await
|
|
12573
|
+
let n3 = await wN.getOrder(e19).catch(() => void 0);
|
|
12569
12574
|
if (!(!n3 || n3._id && n3._id !== e19)) for (let i2 of t2.filter((t3) => t3.order?._id === e19)) {
|
|
12570
12575
|
let e20 = (n3.lineItems ?? []).filter((e21) => e21.catalogReference?.appId === cD.WIX_BOOKINGS && e21.catalogReference.catalogItemId === i2.booking?._id);
|
|
12571
12576
|
if (e20.length !== 1 || e20[0].priceUndetermined) continue;
|
|
12572
|
-
let t3 = [e20[0].totalPriceAfterTax, e20[0].lineItemPrice].find(
|
|
12577
|
+
let t3 = [e20[0].totalPriceAfterTax, e20[0].lineItemPrice].find(TN);
|
|
12573
12578
|
t3 && r2.set(i2.booking._id, { price: t3, currency: n3.currency ?? i2.order?.currency });
|
|
12574
12579
|
}
|
|
12575
12580
|
})), r2;
|
|
12576
12581
|
}
|
|
12577
|
-
var
|
|
12578
|
-
async function
|
|
12579
|
-
let t2 = /* @__PURE__ */ new Map(), n2 = [...new Set(e18.map((e19) => e19.booking ?
|
|
12582
|
+
var DN = cj();
|
|
12583
|
+
async function ON(e18) {
|
|
12584
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = [...new Set(e18.map((e19) => e19.booking ? $j(e19.booking) : ``))].filter(Boolean), r2 = [];
|
|
12580
12585
|
for (let e19 = 0; e19 < n2.length; e19 += 50) r2.push(n2.slice(e19, e19 + 50));
|
|
12581
|
-
let i2 = await Promise.all(r2.map((e19) =>
|
|
12586
|
+
let i2 = await Promise.all(r2.map((e19) => DN.getMultiServiceBookingAllowedActions(e19).catch(() => void 0)));
|
|
12582
12587
|
for (let e19 of i2.flatMap((e20) => e20?.results ?? [])) {
|
|
12583
12588
|
let n3 = e19.itemMetadata?._id;
|
|
12584
12589
|
n3 && e19.itemMetadata?.success && e19.item && t2.set(n3, { cancel: e19.item.cancel === true, reschedule: e19.item.reschedule === true });
|
|
12585
12590
|
}
|
|
12586
12591
|
return t2;
|
|
12587
12592
|
}
|
|
12588
|
-
var
|
|
12589
|
-
var
|
|
12590
|
-
var
|
|
12591
|
-
var
|
|
12592
|
-
function
|
|
12593
|
-
return e18 === Oa.ALL ? { filter: { $and: [{ $or: [{ endDate: { $gt: t2 }, status: { $in:
|
|
12594
|
-
}
|
|
12595
|
-
var
|
|
12596
|
-
var
|
|
12597
|
-
async function
|
|
12598
|
-
let r2 =
|
|
12593
|
+
var kN = cj();
|
|
12594
|
+
var AN = [ds.CONFIRMED, ds.PENDING, ds.WAITING_LIST];
|
|
12595
|
+
var jN = [ds.CANCELED, ds.DECLINED];
|
|
12596
|
+
var MN = [{ appId: cD.WIX_BOOKINGS }, { appId: { $exists: false } }];
|
|
12597
|
+
function NN(e18, t2) {
|
|
12598
|
+
return e18 === Oa.ALL ? { filter: { $and: [{ $or: [{ endDate: { $gt: t2 }, status: { $in: AN } }, { endDate: { $lte: t2 } }, { status: { $in: jN } }] }, { $or: MN }] }, sort: [{ fieldName: `startDate`, order: `ASC` }, { fieldName: `id`, order: `ASC` }] } : e18 === Oa.UPCOMING ? { filter: { endDate: { $gt: t2 }, status: { $in: AN }, $or: MN }, sort: [{ fieldName: `startDate`, order: `ASC` }] } : { filter: { $and: [{ $or: [{ endDate: { $lte: t2 } }, { status: { $in: jN } }] }, { $or: MN }] }, sort: [{ fieldName: `startDate`, order: `DESC` }] };
|
|
12599
|
+
}
|
|
12600
|
+
var PN = (e18) => ({ withBookingAllowedActions: true, ...e18 !== Oa.UPCOMING && { withBookingAttendanceInfo: true }, withBookingConferencingDetails: true, withEcomOrder: true });
|
|
12601
|
+
var FN = (e18) => [...new Set(e18.map((e19) => e19.booking ? $j(e19.booking) : ``))].filter(Boolean);
|
|
12602
|
+
async function IN(e18, t2, n2) {
|
|
12603
|
+
let r2 = FN(e18);
|
|
12599
12604
|
if (r2.length === 0) return e18;
|
|
12600
|
-
let i2 = [], a2 =
|
|
12605
|
+
let i2 = [], a2 = NN(t2, n2);
|
|
12601
12606
|
for (let e19 = 0; e19 < r2.length; e19 += 100) {
|
|
12602
12607
|
let n3;
|
|
12603
12608
|
do {
|
|
12604
|
-
let o3 = n3 ? { cursorPaging: { cursor: n3, limit: 100 } } : { ...a2, filter: { $and: [a2.filter, { "multiServiceBookingInfo.id": { $in: r2.slice(e19, e19 + 100) } }] }, cursorPaging: { limit: 100 } }, s3 = await
|
|
12609
|
+
let o3 = n3 ? { cursorPaging: { cursor: n3, limit: 100 } } : { ...a2, filter: { $and: [a2.filter, { "multiServiceBookingInfo.id": { $in: r2.slice(e19, e19 + 100) } }] }, cursorPaging: { limit: 100 } }, s3 = await kN.queryExtendedBookings(o3, PN(t2));
|
|
12605
12610
|
i2.push(...s3.extendedBookings ?? []), n3 = s3.pagingMetadata?.cursors?.next ?? void 0;
|
|
12606
12611
|
} while (n3);
|
|
12607
12612
|
}
|
|
12608
12613
|
let o2 = new Set(i2.map((e19) => e19.booking?._id));
|
|
12609
|
-
if (e18.some((e19) => e19.booking &&
|
|
12614
|
+
if (e18.some((e19) => e19.booking && $j(e19.booking) && !o2.has(e19.booking._id)) || i2.some((e19) => !e19.booking || !r2.includes($j(e19.booking)))) throw Error(`Complete booking groups could not be read`);
|
|
12610
12615
|
let s2 = new Map(e18.map((e19) => [e19.booking?._id, e19]));
|
|
12611
12616
|
for (let e19 of i2) s2.set(e19.booking?._id, e19);
|
|
12612
12617
|
return t2 === Oa.ALL ? [...s2.values()].sort((e19, t3) => {
|
|
@@ -12616,24 +12621,24 @@ async function PN(e18, t2, n2) {
|
|
|
12616
12621
|
return r3 < i3 ? -1 : +(r3 > i3);
|
|
12617
12622
|
}) : [...s2.values()];
|
|
12618
12623
|
}
|
|
12619
|
-
var
|
|
12620
|
-
var
|
|
12621
|
-
var
|
|
12624
|
+
var LN = cj();
|
|
12625
|
+
var RN = 5;
|
|
12626
|
+
var zN = (e18, t2) => {
|
|
12622
12627
|
let n2 = [];
|
|
12623
12628
|
for (let r2 = 0; r2 < e18.length; r2 += t2) n2.push(e18.slice(r2, r2 + t2));
|
|
12624
12629
|
return n2;
|
|
12625
12630
|
};
|
|
12626
|
-
async function
|
|
12631
|
+
async function BN(e18) {
|
|
12627
12632
|
let t2 = /* @__PURE__ */ new Map();
|
|
12628
12633
|
if (e18.length === 0) return t2;
|
|
12629
|
-
let n2 = await
|
|
12630
|
-
for (let e19 of n2?.items ?? []) e19._id && t2.set(e19._id,
|
|
12634
|
+
let n2 = await LN.queryServicesByIds(e18).catch(() => void 0);
|
|
12635
|
+
for (let e19 of n2?.items ?? []) e19._id && t2.set(e19._id, cM(e19));
|
|
12631
12636
|
return t2;
|
|
12632
12637
|
}
|
|
12633
|
-
async function
|
|
12638
|
+
async function VN(e18) {
|
|
12634
12639
|
let t2 = /* @__PURE__ */ new Map(), n2 = /* @__PURE__ */ new Set();
|
|
12635
12640
|
if (e18.length === 0) return { fees: t2, unreadable: n2 };
|
|
12636
|
-
let r2 =
|
|
12641
|
+
let r2 = zN(e18, 5), i2 = await Promise.all(r2.map((e19) => LN.listBookingFees(e19).catch(() => void 0)));
|
|
12637
12642
|
for (let [e19, a2] of i2.entries()) {
|
|
12638
12643
|
if (!a2) {
|
|
12639
12644
|
for (let t3 of r2[e19] ?? []) n2.add(t3);
|
|
@@ -12647,82 +12652,82 @@ async function zN(e18) {
|
|
|
12647
12652
|
}
|
|
12648
12653
|
return { fees: t2, unreadable: n2 };
|
|
12649
12654
|
}
|
|
12650
|
-
async function
|
|
12655
|
+
async function HN(e18) {
|
|
12651
12656
|
let t2 = /* @__PURE__ */ new Map();
|
|
12652
12657
|
if (e18.length === 0) return t2;
|
|
12653
|
-
let n2 = ((await
|
|
12658
|
+
let n2 = ((await LN.querySubmissionsByBookingIds(e18).catch(() => void 0))?.items ?? []).filter((e19) => !!(e19._id && e19.formId));
|
|
12654
12659
|
if (n2.length === 0) return t2;
|
|
12655
|
-
let r2 = [...new Set(n2.map((e19) => e19.formId))], i2 = await Promise.all(r2.map(async (e19) => [e19, await
|
|
12660
|
+
let r2 = [...new Set(n2.map((e19) => e19.formId))], i2 = await Promise.all(r2.map(async (e19) => [e19, await LN.getForm(e19).catch(() => void 0)])), a2 = new Map(i2.map(([e19, t3]) => [e19, t3?.name ?? ``]));
|
|
12656
12661
|
for (let e19 of n2) t2.set(e19._id, a2.get(e19.formId) ?? ``);
|
|
12657
12662
|
return t2;
|
|
12658
12663
|
}
|
|
12659
|
-
async function
|
|
12660
|
-
let n2 = Aa(), r2 = (await
|
|
12664
|
+
async function UN(e18, t2) {
|
|
12665
|
+
let n2 = Aa(), r2 = (await LN.getBookingsSettings().catch(() => void 0))?.displayTimeZone;
|
|
12661
12666
|
return { businessTimeZone: t2, memberTimeZone: n2, canChange: !!t2 && r2?.customerCanChange === true && Pa(t2, e18) !== Pa(n2, e18), initialTimeZone: t2 && r2?.basedOn === Tf.BUSINESS_TIME_ZONE ? t2 : n2 };
|
|
12662
12667
|
}
|
|
12663
|
-
async function
|
|
12668
|
+
async function WN(e18, t2, n2, r2, i2, a2 = [], o2 = [], s2 = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
12664
12669
|
let c2 = [...a2], l2 = i2, u2 = null, d2 = [], f2 = [];
|
|
12665
|
-
for (let t3 = 0; t3 <
|
|
12666
|
-
let t4 = l2 ? { cursorPaging: { cursor: l2, limit: r2 } } : { ...
|
|
12670
|
+
for (let t3 = 0; t3 < RN; t3 += 1) {
|
|
12671
|
+
let t4 = l2 ? { cursorPaging: { cursor: l2, limit: r2 } } : { ...NN(e18, s2), cursorPaging: { limit: r2 } }, n3 = await LN.queryExtendedBookings(t4, PN(e18));
|
|
12667
12672
|
u2 = n3.pagingMetadata?.cursors?.next ?? null;
|
|
12668
12673
|
let i3 = n3.extendedBookings ?? [];
|
|
12669
|
-
if (c2.push(...i3.filter((e19) => !e19.booking || !o2.includes(
|
|
12674
|
+
if (c2.push(...i3.filter((e19) => !e19.booking || !o2.includes(Qj(e19.booking)))), { emitted: d2, deferred: f2 } = u2 && e18 !== Oa.ALL ? eM(c2) : { emitted: c2, deferred: [] }, !u2 || d2.length > 0) break;
|
|
12670
12675
|
l2 = u2;
|
|
12671
12676
|
}
|
|
12672
12677
|
d2.length === 0 && (d2 = c2, f2 = []);
|
|
12673
12678
|
let p2 = [];
|
|
12674
|
-
if (e18 === Oa.ALL && u2) d2 = await
|
|
12679
|
+
if (e18 === Oa.ALL && u2) d2 = await IN(d2, e18, s2);
|
|
12675
12680
|
else if (u2) {
|
|
12676
|
-
let t3 = await
|
|
12677
|
-
t3 && (d2 = t3, p2 =
|
|
12681
|
+
let t3 = await IN(d2, e18, s2).catch(() => void 0);
|
|
12682
|
+
t3 && (d2 = t3, p2 = FN(d2), f2 = f2.filter((e19) => !e19.booking || !p2.includes($j(e19.booking))));
|
|
12678
12683
|
}
|
|
12679
|
-
let { bookings: m2, submittedForms: h2 } = await
|
|
12680
|
-
return { bookings: m2, submittedForms: h2, cursor: u2, pendingEntries: f2, emittedGroupIds: e18 === Oa.ALL ? [.../* @__PURE__ */ new Set([...o2, ...d2.flatMap((e19) => e19.booking ? [
|
|
12684
|
+
let { bookings: m2, submittedForms: h2 } = await GN(d2, e18, t2, n2);
|
|
12685
|
+
return { bookings: m2, submittedForms: h2, cursor: u2, pendingEntries: f2, emittedGroupIds: e18 === Oa.ALL ? [.../* @__PURE__ */ new Set([...o2, ...d2.flatMap((e19) => e19.booking ? [Qj(e19.booking)] : [])])] : [.../* @__PURE__ */ new Set([...o2, ...p2])], cutoff: s2 };
|
|
12681
12686
|
}
|
|
12682
|
-
async function
|
|
12683
|
-
let i2 =
|
|
12684
|
-
return { bookings:
|
|
12687
|
+
async function GN(e18, t2, n2, r2) {
|
|
12688
|
+
let i2 = IM(e18), a2 = [...new Set(e18.map((e19) => e19.booking?.formSubmissionId ?? ``).filter(Boolean))], o2 = BN(i2), s2 = HN(a2), c2 = t2 === Oa.UPCOMING ? e18 : t2 === Oa.ALL ? e18.filter((e19) => e19.booking?.endDate && new Date(e19.booking.endDate).getTime() > Date.now() && AN.includes(e19.booking.status)) : [], l2 = c2.map((e19) => e19.booking?._id ?? ``).filter(Boolean), [u2, d2, f2, p2, m2, h2, g2] = await Promise.all([o2, VN(l2), ON(c2), CN(e18), _N(e18), r2, EN(e18)]), _2 = { services: u2, cancellationFees: d2.fees, unreadableCancellationFees: d2.unreadable, multiServiceAllowedActions: f2, orderPaymentMethods: p2.methods, orderPlanCharges: p2.planCharges, bookingLinePrices: g2, submittedForms: /* @__PURE__ */ new Map(), courseSessions: m2, memberTimeZone: Aa(), locale: n2, businessAddress: h2 };
|
|
12689
|
+
return { bookings: NM(e18, _2), submittedForms: s2.then((t3) => PM(e18, { ..._2, submittedForms: t3 })) };
|
|
12685
12690
|
}
|
|
12686
|
-
async function
|
|
12691
|
+
async function KN(e18, t2, n2) {
|
|
12687
12692
|
let r2 = [];
|
|
12688
|
-
for (let t3 of
|
|
12693
|
+
for (let t3 of zN(e18, 100)) {
|
|
12689
12694
|
let e19;
|
|
12690
12695
|
do {
|
|
12691
|
-
let n3 = await
|
|
12696
|
+
let n3 = await LN.queryExtendedBookings(e19 ? { cursorPaging: { cursor: e19, limit: 100 } } : { filter: { _id: { $in: t3 } }, cursorPaging: { limit: 100 } }, PN(Oa.ALL));
|
|
12692
12697
|
r2.push(...n3.extendedBookings ?? []), e19 = n3.pagingMetadata?.cursors?.next ?? void 0;
|
|
12693
12698
|
} while (e19);
|
|
12694
12699
|
}
|
|
12695
12700
|
if (!e18.every((e19) => r2.some((t3) => t3.booking?._id === e19))) throw Error(`Canceled bookings could not all be read`);
|
|
12696
|
-
let { bookings: i2, submittedForms: a2 } = await
|
|
12697
|
-
return
|
|
12701
|
+
let { bookings: i2, submittedForms: a2 } = await GN(r2, Oa.ALL, t2, n2);
|
|
12702
|
+
return FM(i2, await a2);
|
|
12698
12703
|
}
|
|
12699
|
-
var
|
|
12700
|
-
var
|
|
12701
|
-
var
|
|
12702
|
-
function
|
|
12704
|
+
var qN = 600;
|
|
12705
|
+
var JN = (e18) => Pj(e18?.uri, qN) || e18?.url || null;
|
|
12706
|
+
var YN = 3e3;
|
|
12707
|
+
function XN(e18) {
|
|
12703
12708
|
let t2, n2 = new Promise((e19) => {
|
|
12704
|
-
t2 = setTimeout(e19,
|
|
12709
|
+
t2 = setTimeout(e19, YN);
|
|
12705
12710
|
});
|
|
12706
12711
|
return Promise.race([e18.decode(), n2]).finally(() => clearTimeout(t2));
|
|
12707
12712
|
}
|
|
12708
|
-
async function
|
|
12713
|
+
async function ZN(e18) {
|
|
12709
12714
|
if (typeof window > `u`) return;
|
|
12710
|
-
let t2 = e18.flatMap((e19) => e19.multiServiceId !== null && e19.sessions.length > 1 ? e19.sessions.map((e20) => e20.serviceImage) : [e19.serviceImage]), n2 = new Set(t2.map(
|
|
12715
|
+
let t2 = e18.flatMap((e19) => e19.multiServiceId !== null && e19.sessions.length > 1 ? e19.sessions.map((e20) => e20.serviceImage) : [e19.serviceImage]), n2 = new Set(t2.map(JN).filter((e19) => !!e19));
|
|
12711
12716
|
await Promise.allSettled([...n2].map(async (e19) => {
|
|
12712
12717
|
let t3 = new Image();
|
|
12713
|
-
t3.src = e19, await
|
|
12718
|
+
t3.src = e19, await XN(t3);
|
|
12714
12719
|
}));
|
|
12715
12720
|
}
|
|
12716
|
-
var
|
|
12717
|
-
async function
|
|
12718
|
-
return (await
|
|
12721
|
+
var QN = cj();
|
|
12722
|
+
async function $N() {
|
|
12723
|
+
return (await QN.queryLocations().catch(() => void 0))?.businessLocations?.locations?.find((e18) => e18.business?.default === true)?.business?.address?.formatted?.trim() ?? ``;
|
|
12719
12724
|
}
|
|
12720
|
-
var
|
|
12721
|
-
var
|
|
12725
|
+
var eP = /* @__PURE__ */ ((e18, t2 = e18) => ({ max: e18, defaultValue: t2, resolve: (n2) => typeof n2 == `number` && Number.isFinite(n2) ? Math.min(Math.max(Math.floor(n2), 1), e18) : t2 }))(10);
|
|
12726
|
+
var tP = (e18, t2) => {
|
|
12722
12727
|
let n2 = o((t3) => {
|
|
12723
12728
|
t3.then((t4) => {
|
|
12724
12729
|
t4.size > 0 && a(() => {
|
|
12725
|
-
e18((e19) =>
|
|
12730
|
+
e18((e19) => FM(e19, t4));
|
|
12726
12731
|
});
|
|
12727
12732
|
});
|
|
12728
12733
|
}, [e18]);
|
|
@@ -12730,35 +12735,35 @@ var $N = (e18, t2) => {
|
|
|
12730
12735
|
n2(t2);
|
|
12731
12736
|
}, [t2, n2]), n2;
|
|
12732
12737
|
};
|
|
12733
|
-
function
|
|
12738
|
+
function nP(e18, t2) {
|
|
12734
12739
|
let n2 = new Date(e18.startDate ?? 0).getTime() - new Date(t2.startDate ?? 0).getTime();
|
|
12735
12740
|
if (n2) return n2;
|
|
12736
12741
|
let r2 = e18.bookingIds[0] ?? ``, i2 = t2.bookingIds[0] ?? ``;
|
|
12737
12742
|
return r2 < i2 ? -1 : +(r2 > i2);
|
|
12738
12743
|
}
|
|
12739
|
-
function
|
|
12740
|
-
return [...e18.filter((e19) => e19.groupId !== t2), ...n2].sort(
|
|
12744
|
+
function rP(e18, t2, n2) {
|
|
12745
|
+
return [...e18.filter((e19) => e19.groupId !== t2), ...n2].sort(nP);
|
|
12741
12746
|
}
|
|
12742
|
-
function
|
|
12747
|
+
function iP(e18, t2) {
|
|
12743
12748
|
return e18.map((e19) => e19.groupId === t2 ? { ...e19, status: ds.CANCELED, isOver: true, canBookAgain: e19.canBookAgainOnceCanceled, canCancel: false, canReschedule: false, canAddToCalendar: false, canViewServiceDetails: false, hasBookingPolicy: false, isAvailableOnline: false, videoConferenceLink: null, conferencingDetails: { guestUrl: null }, videoConferencePassword: ``, sessions: e19.sessions.map((e20) => ({ ...e20, canViewServiceDetails: false })) } : e19);
|
|
12744
12749
|
}
|
|
12745
|
-
var
|
|
12746
|
-
var
|
|
12747
|
-
let e18 = s(
|
|
12750
|
+
var aP = r(null);
|
|
12751
|
+
var oP = () => {
|
|
12752
|
+
let e18 = s(aP);
|
|
12748
12753
|
if (!e18) throw Error(`useBookings must be used within MyBookingsContextProvider`);
|
|
12749
12754
|
return e18;
|
|
12750
12755
|
};
|
|
12751
|
-
var
|
|
12752
|
-
var
|
|
12756
|
+
var sP = { businessTimeZone: ``, memberTimeZone: Aa(), canChange: false, initialTimeZone: Aa() };
|
|
12757
|
+
var cP = (e18, t2) => {
|
|
12753
12758
|
let { t: n2 } = sa();
|
|
12754
12759
|
return l(() => e18.canChange ? [e18.businessTimeZone, e18.memberTimeZone].map((e19) => ({ value: e19, label: Ta(n2, Da.timeZoneFilter.option, { zone: Ma(e19, t2), offset: Na(e19, t2) }) })) : [], [e18, t2, n2]);
|
|
12755
12760
|
};
|
|
12756
|
-
var
|
|
12757
|
-
let m2 = jn(e18), h2 = jn(t2), _2 =
|
|
12761
|
+
var lP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2, locale: r2, timeframe: i2 = Oa.UPCOMING, pageSize: s2, children: p2 }) => {
|
|
12762
|
+
let m2 = jn(e18), h2 = jn(t2), _2 = cP(h2, r2), { navigateTo: v2 } = f(da), y2 = Ia(), [b2, x2] = d(i2), [S2, C2] = d(() => m2.bookings), [ee2, w2] = d(() => m2.cursor), [T2, te2] = d(() => m2.pendingEntries), [ne2, re2] = d(() => m2.emittedGroupIds), [ie2, ae2] = d(() => m2.cutoff), [oe2, E2] = d(false), [se2, ce2] = d(false), [le2, ue2] = d([]), [de2, fe2] = d(null), pe2 = u(false), me2 = u(false), he2 = u(0), ge2 = u(0), _e2 = ge2.current, ve2 = lN(l(() => {
|
|
12758
12763
|
let e19 = S2.filter((e20) => !le2.includes(e20.groupId));
|
|
12759
|
-
return de2 ?
|
|
12760
|
-
}, [S2, le2, de2])), ye2 =
|
|
12761
|
-
be2(e19, t3.bookings), await
|
|
12764
|
+
return de2 ? LM(e19, de2) : e19;
|
|
12765
|
+
}, [S2, le2, de2])), ye2 = tP(C2, m2.submittedForms), be2 = io(i2, m2.bookings), xe2 = o((e19) => (pe2.current = true, me2.current = true, he2.current += 1, x2(e19), E2(true), ce2(true), WN(e19, r2, n2, s2).then(async (t3) => {
|
|
12766
|
+
be2(e19, t3.bookings), await ZN(t3.bookings), ge2.current += 1, a(() => {
|
|
12762
12767
|
C2(t3.bookings), w2(t3.cursor), te2(t3.pendingEntries), re2(t3.emittedGroupIds), ae2(t3.cutoff), ue2([]), ce2(false), E2(false);
|
|
12763
12768
|
}), ye2(t3.submittedForms);
|
|
12764
12769
|
}).catch(() => {
|
|
@@ -12775,17 +12780,17 @@ var sP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2
|
|
|
12775
12780
|
b2 !== Oa.ALL && _e2 === ge2.current && ue2((t3) => [...t3, e19]);
|
|
12776
12781
|
}, [b2, _e2]), Te2 = o((e19) => {
|
|
12777
12782
|
ue2((t3) => t3.filter((t4) => t4 !== e19));
|
|
12778
|
-
}, []), { bookings: Ee2, themeAnchor: De2 } =
|
|
12783
|
+
}, []), { bookings: Ee2, themeAnchor: De2 } = iN(ve2, b2, we2, Te2, o(async (e19) => {
|
|
12779
12784
|
if (b2 === Oa.ALL && _e2 === ge2.current) try {
|
|
12780
|
-
let t3 = await
|
|
12781
|
-
if (await
|
|
12785
|
+
let t3 = await KN(e19.bookingIds, r2, n2);
|
|
12786
|
+
if (await ZN(t3), _e2 !== ge2.current) return;
|
|
12782
12787
|
a(() => {
|
|
12783
|
-
C2((n3) =>
|
|
12788
|
+
C2((n3) => rP(n3, e19.groupId, t3)), re2((t4) => [.../* @__PURE__ */ new Set([...t4, ...e19.bookingIds])]), Te2(e19.groupId);
|
|
12784
12789
|
});
|
|
12785
12790
|
} catch {
|
|
12786
12791
|
if (_e2 !== ge2.current) return;
|
|
12787
12792
|
a(() => {
|
|
12788
|
-
C2((t3) =>
|
|
12793
|
+
C2((t3) => iP(t3, e19.groupId)), Te2(e19.groupId);
|
|
12789
12794
|
});
|
|
12790
12795
|
}
|
|
12791
12796
|
}, [b2, r2, n2, Te2, _e2])), Oe2 = u({ cursor: ee2, timeframe: b2, pendingEntries: T2, emittedGroupIds: ne2, cutoff: ie2 });
|
|
@@ -12799,13 +12804,13 @@ var sP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2
|
|
|
12799
12804
|
let t3 = he2.current;
|
|
12800
12805
|
E2(true);
|
|
12801
12806
|
try {
|
|
12802
|
-
let i3 = await
|
|
12803
|
-
if (await
|
|
12807
|
+
let i3 = await WN(e19.timeframe, r2, n2, s2, e19.cursor, e19.pendingEntries, e19.emittedGroupIds, e19.cutoff);
|
|
12808
|
+
if (await ZN(i3.bookings), t3 !== he2.current) return;
|
|
12804
12809
|
await ke2((t4) => {
|
|
12805
12810
|
a(() => {
|
|
12806
12811
|
C2((t5) => {
|
|
12807
12812
|
let n3 = new Set(t5.flatMap((e20) => e20.bookingIds)), r3 = [...t5, ...e19.timeframe === Oa.ALL ? i3.bookings.filter((e20) => !e20.bookingIds.some((e21) => n3.has(e21))) : i3.bookings];
|
|
12808
|
-
return e19.timeframe === Oa.ALL ? r3.sort(
|
|
12813
|
+
return e19.timeframe === Oa.ALL ? r3.sort(nP) : r3;
|
|
12809
12814
|
}), w2(i3.cursor), te2(i3.pendingEntries), re2((e20) => [.../* @__PURE__ */ new Set([...e20, ...i3.emittedGroupIds])]), E2(false), t4();
|
|
12810
12815
|
});
|
|
12811
12816
|
}), ye2(i3.submittedForms);
|
|
@@ -12813,32 +12818,32 @@ var sP = ({ initialPromise: e18, timeZonePromise: t2, businessAddressPromise: n2
|
|
|
12813
12818
|
} finally {
|
|
12814
12819
|
t3 === he2.current && (pe2.current = false, E2(false));
|
|
12815
12820
|
}
|
|
12816
|
-
}, [r2, n2, s2, ke2, ye2]), je2 =
|
|
12821
|
+
}, [r2, n2, s2, ke2, ye2]), je2 = sN(`bookingsServiceList`), Me2 = je2 ?? `./`, Ne2 = je2 !== null, Pe2 = o(() => {
|
|
12817
12822
|
y2(Ja(b2)), v2({ href: Me2 });
|
|
12818
12823
|
}, [v2, Me2, y2, b2]), Fe2 = l(() => ({ bookings: se2 ? [] : Ee2, timeframe: b2, onTimeframeChange: Se2, businessTimeZone: h2.businessTimeZone, timeZone: de2 ?? h2.initialTimeZone, canChangeTimeZone: h2.canChange, timeZoneOptions: _2, onTimeZoneChange: Ce2, hasMore: ee2 !== null, isLoading: oe2, onLoadMore: Ae2, isEmpty: Ee2.length === 0 && !oe2 && ee2 === null, canBrowseServices: Ne2, onBrowseServices: Pe2 }), [Ee2, se2, b2, Se2, h2, de2, _2, Ce2, ee2, oe2, Ae2, Ne2, Pe2]);
|
|
12819
|
-
return g(
|
|
12824
|
+
return g(aP.Provider, { value: Fe2, children: [De2, p2] });
|
|
12820
12825
|
};
|
|
12821
|
-
var
|
|
12826
|
+
var uP = ({ timeframe: e18 = Oa.UPCOMING, children: t2 }) => {
|
|
12822
12827
|
let n2 = l(() => ({ bookings: [], timeframe: e18, onTimeframeChange: () => void 0, businessTimeZone: ``, timeZone: Aa(), canChangeTimeZone: false, timeZoneOptions: [], onTimeZoneChange: () => void 0, hasMore: false, isLoading: true, onLoadMore: () => Promise.resolve(), isEmpty: false, canBrowseServices: false, onBrowseServices: () => void 0 }), [e18]);
|
|
12823
|
-
return h(
|
|
12828
|
+
return h(aP.Provider, { value: n2, children: t2 });
|
|
12824
12829
|
};
|
|
12825
|
-
var
|
|
12826
|
-
let i2 =
|
|
12830
|
+
var dP = ({ timeframe: e18 = Oa.UPCOMING, pageSize: t2, children: r2 }) => {
|
|
12831
|
+
let i2 = eP.resolve(t2), o2 = Ca(), s2 = VM(), { timeZone: l2 } = f(ua);
|
|
12827
12832
|
ro();
|
|
12828
12833
|
let [u2] = d({ timeframe: e18, locale: s2, businessTimeZone: l2, pageSize: i2 }), [p2, m2] = d(null);
|
|
12829
12834
|
return c(() => {
|
|
12830
|
-
let e19 =
|
|
12835
|
+
let e19 = $N(), t3 = WN(u2.timeframe, u2.locale, e19, u2.pageSize).then(async (e20) => (await ZN(e20.bookings), e20)), n2 = UN(u2.locale, u2.businessTimeZone ?? ``).catch(() => sP);
|
|
12831
12836
|
a(() => {
|
|
12832
12837
|
m2({ timeframe: u2.timeframe, locale: u2.locale, initialPromise: t3, businessAddressPromise: e19, timeZonePromise: n2 });
|
|
12833
12838
|
});
|
|
12834
|
-
}, [u2]), h(ca, { i18n: o2, children: h(n, { fallback: h(
|
|
12839
|
+
}, [u2]), h(ca, { i18n: o2, children: h(n, { fallback: h(uP, { timeframe: e18, children: r2 }), children: p2 ? h(lP, { ...p2, pageSize: i2, children: r2 }) : h(uP, { timeframe: e18, children: r2 }) }) });
|
|
12835
12840
|
};
|
|
12836
|
-
var
|
|
12841
|
+
var fP = Dn(`c7590ff8-2e98-4416-9843-8ef7f8951155`);
|
|
12837
12842
|
export {
|
|
12838
|
-
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
+
aP as MyBookingsContext,
|
|
12844
|
+
dP as MyBookingsContextProvider,
|
|
12845
|
+
dP as default,
|
|
12846
|
+
fP as injectAccessTokenGetter,
|
|
12847
|
+
oP as useBookings
|
|
12843
12848
|
};
|
|
12844
12849
|
//# sourceMappingURL=context-my-bookings.mjs.map
|