your-ai-workflow-firebase-os 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccessNotice-BZ5Gt1nP.js +40 -0
- package/dist/AccessNotice-CN7kc70o.cjs +1 -0
- package/dist/{AddressField-R-HvndkG.js → AddressField-9Sqn8TvC.js} +3 -3
- package/dist/{AddressField-BkzFOo2t.cjs → AddressField-B7wtV8yA.cjs} +1 -1
- package/dist/Assets-DBMwZ3bN.cjs +1 -0
- package/dist/Assets-DT-NU_WO.js +296 -0
- package/dist/Attachments-Bl9_dfsu.js +46 -0
- package/dist/Attachments-UVK9SRXf.cjs +1 -0
- package/dist/Billing-0RIHayHy.cjs +1 -0
- package/dist/Billing-FNE2r3_d.js +379 -0
- package/dist/BookingCalendar-BP5kiv3d.cjs +1 -0
- package/dist/BookingCalendar-DZ2fEFja.js +309 -0
- package/dist/Button-4lzOE31p.js +48 -0
- package/dist/Button-5DlB2MCi.cjs +1 -0
- package/dist/CalendarView-BimoXy_k.cjs +1 -0
- package/dist/CalendarView-D-ykjpvI.js +664 -0
- package/dist/ConfirmModal-Di9GR-vV.cjs +1 -0
- package/dist/ConfirmModal-gKQEpd4d.js +113 -0
- package/dist/ContactPopup-BXnHrRwl.js +1114 -0
- package/dist/ContactPopup-lxmRMoIa.cjs +1 -0
- package/dist/CopyLink-BpEQWmfI.cjs +1 -0
- package/dist/CopyLink-CBAVfcm1.js +43 -0
- package/dist/DashboardNav-CXa_ci-_.cjs +1 -0
- package/dist/DashboardNav-Dmn7PVSp.js +886 -0
- package/dist/EmailAdmin-CjN_rvxT.js +318 -0
- package/dist/EmailAdmin-lAEBdY1s.cjs +1 -0
- package/dist/EventCard-46EquygT.cjs +1 -0
- package/dist/EventCard-B6xD-mk3.js +97 -0
- package/dist/FileViewerPopup-CX-J75TM.js +1283 -0
- package/dist/FileViewerPopup-D8-MmIoS.cjs +3 -0
- package/dist/FormNote-BivRNA3J.js +50 -0
- package/dist/FormNote-BtdTGpml.cjs +1 -0
- package/dist/FormsAdmin-B5PBCG2W.js +812 -0
- package/dist/FormsAdmin-BQCULvi5.cjs +1 -0
- package/dist/Inbox-BPk2ZkE5.js +779 -0
- package/dist/Inbox-DNrcBx0o.cjs +3 -0
- package/dist/Loader-Bu89fsbB.cjs +1 -0
- package/dist/Loader-D4gwgBOq.js +32 -0
- package/dist/ManagePlanButton-B0dwqZBd.cjs +1 -0
- package/dist/ManagePlanButton-BSrOHYze.js +29 -0
- package/dist/MyBookings-6qr0GgzO.cjs +1 -0
- package/dist/MyBookings-BQjGM2LQ.js +113 -0
- package/dist/PageTitle-CZhgmmDT.cjs +3 -0
- package/dist/PageTitle-D93YCiN8.js +1606 -0
- package/dist/PagesAdmin-BcHIcqM5.cjs +34 -0
- package/dist/PagesAdmin-D69P9nRb.js +5802 -0
- package/dist/PagesAdmin-DNwZOKjA.cjs +1 -0
- package/dist/PagesAdmin-HUITEcHx.js +3 -0
- package/dist/PaymentsAdmin-C2iCI9qC.js +1291 -0
- package/dist/PaymentsAdmin-CoXi2vCm.cjs +2 -0
- package/dist/{PhoneInputField-B3P_vUDW.cjs → PhoneInputField-BEwYZMB7.cjs} +1 -1
- package/dist/{PhoneInputField-BlYHb5e0.js → PhoneInputField-BG0L2djE.js} +2 -2
- package/dist/PhoneInputField-DfOtCIH_.js +2 -0
- package/dist/{PhoneInputField-CdNTvWXQ.cjs → PhoneInputField-jhWvto8C.cjs} +1 -1
- package/dist/Popup-DHYGFl2-.cjs +1 -0
- package/dist/Popup-xROLytgr.js +142 -0
- package/dist/ProviderMark-BBfaM5Yl.js +52 -0
- package/dist/ProviderMark-xLkUN3Fx.cjs +1 -0
- package/dist/PublishApp-Bm-6r3Td.js +595 -0
- package/dist/PublishApp-D4XJUkJa.cjs +2 -0
- package/dist/Said-CoC15awL.js +94 -0
- package/dist/Said-IqCNofdh.cjs +1 -0
- package/dist/ScheduleAdmin-BKfQkrR8.js +1853 -0
- package/dist/ScheduleAdmin-DwK36GAZ.cjs +1 -0
- package/dist/SchedulePicker--urIH2Eb.js +112 -0
- package/dist/SchedulePicker-nmqzUnUH.cjs +1 -0
- package/dist/Setup-CHLgd-ag.js +849 -0
- package/dist/Setup-CaDranTm.cjs +1374 -0
- package/dist/SetupPayments-CVIwh1eQ.js +411 -0
- package/dist/SetupPayments-HNXWA25X.cjs +1 -0
- package/dist/SignInAdmin-C94-A-0w.cjs +4 -0
- package/dist/SignInAdmin-Yxgv_8U4.js +766 -0
- package/dist/SupportBar-CDT0HwdP.cjs +1 -0
- package/dist/SupportBar-CN_JGC-9.js +117 -0
- package/dist/SystemTabContent-L3vGGF3P.cjs +1 -0
- package/dist/SystemTabContent-QdxxLILE.js +35 -0
- package/dist/TemplateDrive-DV8zNjYe.cjs +1 -0
- package/dist/TemplateDrive-NJY_AAvV.js +1197 -0
- package/dist/ThemeAdmin-BzFjJkLg.js +269 -0
- package/dist/ThemeAdmin-DVnPNxe7.cjs +1 -0
- package/dist/ThemeAdmin-DY7Vc4Sj.cjs +3 -0
- package/dist/ThemeAdmin-DnC-D2N3.js +2 -0
- package/dist/{ContactPopup-9J_YeJrb.js → TimeZoneField-DkI1Bkcz.js} +3382 -5513
- package/dist/TimeZoneField-qs7NPR30.cjs +12 -0
- package/dist/TransactionsAdmin-BsZ-oQWi.js +582 -0
- package/dist/TransactionsAdmin-CTSTiPld.cjs +1 -0
- package/dist/Trouble-9es_AI4F.cjs +1 -0
- package/dist/Trouble-oWt9fMsm.js +164 -0
- package/dist/Users-CTitWXyd.cjs +1 -0
- package/dist/Users-DJjQTWJF.js +1207 -0
- package/dist/aiModels-DIP9fn8T.cjs +1 -0
- package/dist/{aiModels-BHlEfuRJ.js → aiModels-DnDhNGup.js} +29 -61
- package/dist/arrivalRoads-BJ-35vkk.js +228 -0
- package/dist/arrivalRoads-qoU-B4jt.cjs +4 -0
- package/dist/{bake-D0gLVNTL.cjs → bake-n2wyFw0B.cjs} +1 -1
- package/dist/{bake-OErV2MLy.js → bake-naZeMu98.js} +14 -14
- package/dist/bookingPages-C7a3srPG.js +102 -0
- package/dist/bookingPages-DvbFbD9X.cjs +1 -0
- package/dist/components/CustomSelect.d.ts +7 -1
- package/dist/components/RegistrationFields.d.ts +6 -1
- package/dist/components/Reveal.d.ts +12 -0
- package/dist/components/ScrollToTop.d.ts +4 -0
- package/dist/contentFallback-C9MZjdq7.cjs +1 -0
- package/dist/contentFallback-CEDY0Pwp.js +96 -0
- package/dist/contentKey-Bwry4lDa.js +13 -0
- package/dist/contentKey-DJGYYnAE.cjs +1 -0
- package/dist/{dist-_zWHDDrc.js → dist-DUPvBnOA.js} +1 -1
- package/dist/email-BfnZnMwD.cjs +1 -0
- package/dist/email-Ddj8Dlu6.js +58 -0
- package/dist/{fileBytes-B0qxHYQL.cjs → fileBytes-BJPaiX9Y.cjs} +1 -1
- package/dist/{fileBytes-uhq3pGCS.js → fileBytes-bjgvCfWu.js} +2 -2
- package/dist/forms-Bvx9HTM6.js +75 -0
- package/dist/forms-CmNeTETW.cjs +1 -0
- package/dist/lib/ThemeContext.d.ts +0 -14
- package/dist/lib/bareImgWatch.d.ts +6 -1
- package/dist/lib/localEdits.d.ts +2 -0
- package/dist/lib/pageDesignLines.d.ts +1 -1
- package/dist/lib/paymentProducts.d.ts +8 -0
- package/dist/lib/payments.d.ts +11 -1
- package/dist/lib/people.d.ts +9 -0
- package/dist/lib/recordsKey.d.ts +24 -0
- package/dist/{lucide-react-DiyP8FA_.js → lucide-react-CA7GD7Nv.js} +8 -8
- package/dist/notices-B7iIrIEg.js +29 -0
- package/dist/notices-upMg8UVh.cjs +1 -0
- package/dist/openOnArrival-Buwqb86D.cjs +1 -0
- package/dist/openOnArrival-S2K6v-lB.js +35 -0
- package/dist/pageFiles--Ih60ITP.js +45 -0
- package/dist/pageFiles-UtBmlOcD.cjs +1 -0
- package/dist/pages/PagesAdmin.d.ts +69 -7
- package/dist/{pdf-DLuvpvHg.js → pdf-DRXcPGkr.js} +1 -1
- package/dist/{pdf.worker.min-C0gkd2Ec.js → pdf.worker.min-CfKZezeM.js} +1 -1
- package/dist/people-2jZE_pdI.js +102 -0
- package/dist/people-BpVvIr9-.cjs +1 -0
- package/dist/personName-CFw3pxuu.js +18 -0
- package/dist/personName-CbzN_i57.cjs +1 -0
- package/dist/publishSteps-C1cDFzzB.js +88 -0
- package/dist/publishSteps-SSm8afDw.cjs +1 -0
- package/dist/recordLock-DHVvI9bP.js +61 -0
- package/dist/recordLock-DWeIxiwh.cjs +1 -0
- package/dist/recordsKey-B7QrxdeU.cjs +1 -0
- package/dist/recordsKey-D5-wC0Aw.js +141 -0
- package/dist/registrationFields-CLeR2lQJ.js +181 -0
- package/dist/registrationFields-v4pOoRdn.cjs +1 -0
- package/dist/renderer.cjs.js +1 -1
- package/dist/renderer.es.js +1 -1
- package/dist/roles-D6VaHWfV.js +147 -0
- package/dist/roles-DQUFFBQe.cjs +1 -0
- package/dist/scheduleData-ATN8w5hI.js +727 -0
- package/dist/scheduleData-Cltj0ABZ.cjs +1 -0
- package/dist/server.cjs.js +6 -6
- package/dist/server.es.js +716 -715
- package/dist/serviceStatus-TQyZO_Y_.cjs +1 -0
- package/dist/serviceStatus-vS8AI7SZ.js +125 -0
- package/dist/tabAudience-BqpN6dsR.cjs +1 -0
- package/dist/tabAudience-CRyMvv0v.js +34 -0
- package/dist/transactions-BqMQDRx3.js +343 -0
- package/dist/transactions-CufFrdAM.cjs +1 -0
- package/dist/useIsPhone-BVGx_X3e.js +13 -0
- package/dist/useIsPhone-o63tNneA.cjs +1 -0
- package/dist/{validate-DzSJWuyL.js → validate-CmC_tLK-.js} +433 -351
- package/dist/validate-DZMwqSrb.cjs +103 -0
- package/dist/vite/validate.d.ts +14 -0
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +1 -1
- package/dist/your-ai-workflow-firebase-os.cjs.js +15 -1431
- package/dist/your-ai-workflow-firebase-os.css +1 -1
- package/dist/your-ai-workflow-firebase-os.es.js +11695 -35911
- package/package.json +1 -1
- package/src/index.css +122 -2
- package/dist/ContactPopup-DF8qQCoY.cjs +0 -12
- package/dist/PhoneInputField-Btx07xvM.js +0 -2
- package/dist/aiModels-BIhoTNH0.cjs +0 -1
- package/dist/validate-e48WXJdP.cjs +0 -103
- /package/dist/{address-DI1YaCI4.cjs → address-Bsb8COq2.cjs} +0 -0
- /package/dist/{address-Ca1h_UZX.js → address-C2bHNxJU.js} +0 -0
- /package/dist/{dist-BLGlDv1e.cjs → dist-E4jTFPs7.cjs} +0 -0
- /package/dist/{lucide-react-BYniZ3lQ.cjs → lucide-react-BwV6L6Is.cjs} +0 -0
- /package/dist/{mediaKind-dk396a03.cjs → mediaKind-D0MWyv6b.cjs} +0 -0
- /package/dist/{mediaKind-De2Cx_kB.js → mediaKind-DmKMsjeY.js} +0 -0
- /package/dist/{pdf-CC5g01eC.cjs → pdf-jLjjhvjp.cjs} +0 -0
- /package/dist/{pdf.worker.min-pI_P-OCl.cjs → pdf.worker.min-bLgNWd7w.cjs} +0 -0
- /package/dist/{verifiedAccount-C1iCxopN.js → verifiedAccount-DRbRFJ6H.js} +0 -0
- /package/dist/{verifiedAccount-D3OeaOBo.cjs → verifiedAccount-DScyKk96.cjs} +0 -0
|
@@ -0,0 +1,727 @@
|
|
|
1
|
+
import { Et as e, J as t, Lt as n, Oa as r, Ut as i, Y as a, an as o, ct as s, dr as c, en as l, gn as u, hn as d, k as f, ka as p, nt as ee, on as m, ot as te, q as h, un as ne, vn as g, ya as _, yn as re } from "./TimeZoneField-DkI1Bkcz.js";
|
|
2
|
+
import { useEffect as v, useMemo as y, useState as b } from "react";
|
|
3
|
+
import { collection as x, deleteDoc as S, doc as C, getDoc as w, getDocs as ie, onSnapshot as T, query as E, runTransaction as ae, setDoc as D, where as O } from "firebase/firestore";
|
|
4
|
+
//#region src/lib/bookingLinks.ts
|
|
5
|
+
var k = (e) => e?.kind === "link" ? "link" : "schedule", oe = (e) => e?.kind !== "schedule" && e?.kind !== "link", se = () => `l_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`, A = () => `s_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 6)}`, j = (t, n) => ({
|
|
6
|
+
id: t,
|
|
7
|
+
scheduleId: n.id,
|
|
8
|
+
memberId: n.memberId,
|
|
9
|
+
memberName: n.memberName,
|
|
10
|
+
name: "",
|
|
11
|
+
description: "",
|
|
12
|
+
slotMinutes: 30,
|
|
13
|
+
horizonDays: 30,
|
|
14
|
+
noticeHours: 12,
|
|
15
|
+
questions: e(),
|
|
16
|
+
paymentId: "",
|
|
17
|
+
notifyOwner: !0,
|
|
18
|
+
confirmBooker: !0,
|
|
19
|
+
enabled: !0
|
|
20
|
+
}), M = (e, t, n) => {
|
|
21
|
+
let r = typeof e == "number" ? e : Number(e);
|
|
22
|
+
return !Number.isFinite(r) || r < 0 || n && !n.includes(r) ? t : r;
|
|
23
|
+
}, N = (e, n) => ({
|
|
24
|
+
id: e,
|
|
25
|
+
scheduleId: String(n?.scheduleId || ""),
|
|
26
|
+
memberId: String(n?.memberId || ""),
|
|
27
|
+
memberName: String(n?.memberName || ""),
|
|
28
|
+
name: String(n?.name || ""),
|
|
29
|
+
description: String(n?.description || ""),
|
|
30
|
+
slotMinutes: M(n?.slotMinutes, 30, t.map((e) => Number(e.value))),
|
|
31
|
+
horizonDays: M(n?.horizonDays, 30),
|
|
32
|
+
noticeHours: M(n?.noticeHours, 12),
|
|
33
|
+
questions: o(n?.questions),
|
|
34
|
+
paymentId: String(n?.paymentId || ""),
|
|
35
|
+
notifyOwner: n?.notifyOwner !== !1,
|
|
36
|
+
confirmBooker: n?.confirmBooker !== !1,
|
|
37
|
+
enabled: n?.enabled === !0,
|
|
38
|
+
createdAt: typeof n?.createdAt == "number" ? n.createdAt : void 0,
|
|
39
|
+
updatedAt: typeof n?.updatedAt == "number" ? n.updatedAt : void 0
|
|
40
|
+
});
|
|
41
|
+
function P(e, t) {
|
|
42
|
+
return t ? {
|
|
43
|
+
...t,
|
|
44
|
+
id: e.id,
|
|
45
|
+
scheduleId: t.id,
|
|
46
|
+
memberId: t.memberId,
|
|
47
|
+
memberName: e.memberName || t.memberName,
|
|
48
|
+
name: e.name,
|
|
49
|
+
description: e.description,
|
|
50
|
+
slotMinutes: e.slotMinutes,
|
|
51
|
+
horizonDays: e.horizonDays,
|
|
52
|
+
noticeHours: e.noticeHours,
|
|
53
|
+
questions: e.questions,
|
|
54
|
+
paymentId: e.paymentId,
|
|
55
|
+
notifyOwner: e.notifyOwner,
|
|
56
|
+
confirmBooker: e.confirmBooker,
|
|
57
|
+
enabled: e.enabled,
|
|
58
|
+
createdAt: e.createdAt,
|
|
59
|
+
updatedAt: e.updatedAt,
|
|
60
|
+
joined: !0
|
|
61
|
+
} : null;
|
|
62
|
+
}
|
|
63
|
+
function F(e) {
|
|
64
|
+
let t = new Map(e.schedules.map((e) => [e.id, e])), n = new Set(e.legacyIds), r = e.schedules.filter((e) => n.has(e.id));
|
|
65
|
+
for (let n of e.links) {
|
|
66
|
+
let e = P(n, t.get(n.scheduleId));
|
|
67
|
+
e && r.push(e);
|
|
68
|
+
}
|
|
69
|
+
return r.sort((e, t) => (e.createdAt || 0) - (t.createdAt || 0) || e.id.localeCompare(t.id));
|
|
70
|
+
}
|
|
71
|
+
var I = (e) => e.name.trim() || ee(e), ce = (e, t) => t ? `${I(e)} — ${re(e.slotMinutes)} · ${n(t)}` : `${I(e)} — the hours it was booked in are gone`, le = (e, t) => {
|
|
72
|
+
let n = t ? P(e, t) : null;
|
|
73
|
+
return n && s(n) ? {
|
|
74
|
+
state: "saved",
|
|
75
|
+
label: "Bookable"
|
|
76
|
+
} : {
|
|
77
|
+
state: "off",
|
|
78
|
+
label: e.enabled ? "In progress" : "Turned off"
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
function ue(e, t) {
|
|
82
|
+
if (!t) return "The hours this link was booked in are gone — pick another set.";
|
|
83
|
+
let n = P(e, t);
|
|
84
|
+
return n ? ne({
|
|
85
|
+
...n,
|
|
86
|
+
enabled: !0
|
|
87
|
+
}) : "The hours this link was booked in are gone — pick another set.";
|
|
88
|
+
}
|
|
89
|
+
function de(e, t = "Working hours") {
|
|
90
|
+
let n = [], r = [], i = /* @__PURE__ */ new Map();
|
|
91
|
+
for (let a of e) {
|
|
92
|
+
let e = [
|
|
93
|
+
a.memberId,
|
|
94
|
+
a.timeZone,
|
|
95
|
+
JSON.stringify(a.days),
|
|
96
|
+
JSON.stringify(a.blocked)
|
|
97
|
+
].join("|"), o = i.get(e);
|
|
98
|
+
o || (o = {
|
|
99
|
+
...te(A(), a.memberId, a.memberName, a.timeZone),
|
|
100
|
+
name: t,
|
|
101
|
+
days: a.days,
|
|
102
|
+
blocked: a.blocked,
|
|
103
|
+
enabled: !0,
|
|
104
|
+
createdAt: a.createdAt
|
|
105
|
+
}, i.set(e, o), n.push(o)), r.push({
|
|
106
|
+
...j(a.id, o),
|
|
107
|
+
memberName: a.memberName,
|
|
108
|
+
name: a.name,
|
|
109
|
+
description: a.description,
|
|
110
|
+
slotMinutes: a.slotMinutes,
|
|
111
|
+
horizonDays: a.horizonDays,
|
|
112
|
+
noticeHours: a.noticeHours,
|
|
113
|
+
questions: a.questions,
|
|
114
|
+
paymentId: a.paymentId,
|
|
115
|
+
notifyOwner: a.notifyOwner,
|
|
116
|
+
confirmBooker: a.confirmBooker,
|
|
117
|
+
enabled: a.enabled,
|
|
118
|
+
createdAt: a.createdAt
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
schedules: n,
|
|
123
|
+
links: r
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
var L = (e) => {
|
|
127
|
+
let { id: t, ...n } = e;
|
|
128
|
+
return {
|
|
129
|
+
...n,
|
|
130
|
+
kind: "link"
|
|
131
|
+
};
|
|
132
|
+
}, R = (e) => ({
|
|
133
|
+
kind: "schedule",
|
|
134
|
+
memberId: e.memberId,
|
|
135
|
+
memberName: e.memberName,
|
|
136
|
+
name: e.name,
|
|
137
|
+
timeZone: e.timeZone,
|
|
138
|
+
days: e.days,
|
|
139
|
+
blocked: e.blocked,
|
|
140
|
+
enabled: !0,
|
|
141
|
+
createdAt: e.createdAt || Date.now()
|
|
142
|
+
}), z = (e) => e.entryId ? `${e.entryId}__${e.start}` : e.id;
|
|
143
|
+
function B(e) {
|
|
144
|
+
let t = e.filter((e) => !e.cancelled), n = t.length ? t : e;
|
|
145
|
+
return {
|
|
146
|
+
copyIds: e.map((e) => e.id),
|
|
147
|
+
pending: n.some((e) => e.pending),
|
|
148
|
+
partySize: n.length,
|
|
149
|
+
partyAccepted: n.filter((e) => !e.pending).length
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function fe(e) {
|
|
153
|
+
let t = /* @__PURE__ */ new Map();
|
|
154
|
+
for (let n of e) {
|
|
155
|
+
if (n.own) continue;
|
|
156
|
+
let e = z(n), r = t.get(e);
|
|
157
|
+
r ? r.push(n) : t.set(e, [n]);
|
|
158
|
+
}
|
|
159
|
+
let n = /* @__PURE__ */ new Map();
|
|
160
|
+
for (let e of t.values()) {
|
|
161
|
+
let t = B(e);
|
|
162
|
+
for (let r of e) n.set(r.id, t);
|
|
163
|
+
}
|
|
164
|
+
return n;
|
|
165
|
+
}
|
|
166
|
+
var pe = 5 * 6e4;
|
|
167
|
+
function me(e, t, n) {
|
|
168
|
+
let r = new Set(t.map((e) => e.id));
|
|
169
|
+
return e.filter((e) => r.has(g(e.memberId, e.start)) ? !1 : (e.createdAt || 0) < n - pe);
|
|
170
|
+
}
|
|
171
|
+
var he = (e, t = "") => ({
|
|
172
|
+
id: g(e.memberId, e.start),
|
|
173
|
+
memberId: e.memberId,
|
|
174
|
+
memberName: t,
|
|
175
|
+
scheduleId: "",
|
|
176
|
+
scheduleName: "",
|
|
177
|
+
own: !1,
|
|
178
|
+
title: "",
|
|
179
|
+
color: "",
|
|
180
|
+
paymentId: "",
|
|
181
|
+
paymentSession: "",
|
|
182
|
+
cancelled: !1,
|
|
183
|
+
cancelledAt: 0,
|
|
184
|
+
cancelReason: "",
|
|
185
|
+
cancelledBy: "",
|
|
186
|
+
cancelledSide: "",
|
|
187
|
+
cancelledByUid: "",
|
|
188
|
+
pending: !1,
|
|
189
|
+
acceptedAt: 0,
|
|
190
|
+
heldOnly: !0,
|
|
191
|
+
copyIds: [],
|
|
192
|
+
partySize: 0,
|
|
193
|
+
partyAccepted: 0,
|
|
194
|
+
start: e.start,
|
|
195
|
+
end: e.end,
|
|
196
|
+
timeZone: "",
|
|
197
|
+
name: "",
|
|
198
|
+
email: "",
|
|
199
|
+
answers: {},
|
|
200
|
+
formId: "",
|
|
201
|
+
entryId: "",
|
|
202
|
+
uid: "",
|
|
203
|
+
createdAt: e.createdAt || 0
|
|
204
|
+
}), V = (e, t) => (e.createdAt || 0) - (t.createdAt || 0) || e.id.localeCompare(t.id), H = {
|
|
205
|
+
schedules: [],
|
|
206
|
+
links: [],
|
|
207
|
+
legacyIds: []
|
|
208
|
+
};
|
|
209
|
+
function U() {
|
|
210
|
+
let [e, t] = b({
|
|
211
|
+
loading: !0,
|
|
212
|
+
docs: H
|
|
213
|
+
});
|
|
214
|
+
return v(() => {
|
|
215
|
+
let e = _(h, () => x(p, h), (e) => {
|
|
216
|
+
let n = [], r = [], i = [];
|
|
217
|
+
e.forEach((e) => {
|
|
218
|
+
let t = e.data();
|
|
219
|
+
if (k(t) === "link") {
|
|
220
|
+
r.push(N(e.id, t));
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
let a = m(e.id, t);
|
|
224
|
+
if (oe(t)) {
|
|
225
|
+
n.push(a), i.push(e.id);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
n.push({
|
|
229
|
+
...a,
|
|
230
|
+
enabled: !0
|
|
231
|
+
});
|
|
232
|
+
}), n.sort(V), r.sort(V);
|
|
233
|
+
let a = {
|
|
234
|
+
schedules: n,
|
|
235
|
+
links: r,
|
|
236
|
+
legacyIds: i
|
|
237
|
+
};
|
|
238
|
+
d(F(a)), u(n), t({
|
|
239
|
+
loading: !1,
|
|
240
|
+
docs: a
|
|
241
|
+
});
|
|
242
|
+
}, () => t({
|
|
243
|
+
loading: !1,
|
|
244
|
+
docs: H
|
|
245
|
+
}));
|
|
246
|
+
return () => e();
|
|
247
|
+
}, []), e;
|
|
248
|
+
}
|
|
249
|
+
function ge() {
|
|
250
|
+
let { loading: e, docs: t } = U();
|
|
251
|
+
return {
|
|
252
|
+
loading: e,
|
|
253
|
+
schedules: y(() => F(t), [t])
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function _e() {
|
|
257
|
+
let { loading: e, docs: t } = U();
|
|
258
|
+
return {
|
|
259
|
+
loading: e,
|
|
260
|
+
schedules: t.schedules
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function ve() {
|
|
264
|
+
let { loading: e, docs: t } = U();
|
|
265
|
+
return {
|
|
266
|
+
loading: e,
|
|
267
|
+
schedules: y(() => {
|
|
268
|
+
let e = F(t), n = new Set(e.map((e) => e.id));
|
|
269
|
+
return [...e, ...t.schedules.filter((e) => !n.has(e.id) && s(e))];
|
|
270
|
+
}, [t])
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function ye(e) {
|
|
274
|
+
let [t, n] = b({
|
|
275
|
+
id: "",
|
|
276
|
+
schedule: null
|
|
277
|
+
});
|
|
278
|
+
return v(() => {
|
|
279
|
+
if (!e) return;
|
|
280
|
+
let t = !1;
|
|
281
|
+
return be(e).then((r) => {
|
|
282
|
+
t || n({
|
|
283
|
+
id: e,
|
|
284
|
+
schedule: r
|
|
285
|
+
});
|
|
286
|
+
}).catch(() => {
|
|
287
|
+
t || n({
|
|
288
|
+
id: e,
|
|
289
|
+
schedule: null
|
|
290
|
+
});
|
|
291
|
+
}), () => {
|
|
292
|
+
t = !0;
|
|
293
|
+
};
|
|
294
|
+
}, [e]), e ? t.id === e ? {
|
|
295
|
+
loading: !1,
|
|
296
|
+
schedule: t.schedule
|
|
297
|
+
} : {
|
|
298
|
+
loading: !0,
|
|
299
|
+
schedule: null
|
|
300
|
+
} : {
|
|
301
|
+
loading: !1,
|
|
302
|
+
schedule: null
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
async function be(e) {
|
|
306
|
+
let t = await w(C(p, h, e));
|
|
307
|
+
if (!t.exists()) return null;
|
|
308
|
+
let n = t.data();
|
|
309
|
+
if (k(n) !== "link") {
|
|
310
|
+
let e = m(t.id, n);
|
|
311
|
+
return oe(n) ? e : {
|
|
312
|
+
...e,
|
|
313
|
+
name: ""
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
let r = N(t.id, n);
|
|
317
|
+
if (!r.scheduleId) return null;
|
|
318
|
+
let i = await w(C(p, h, r.scheduleId));
|
|
319
|
+
return i.exists() ? P(r, m(i.id, i.data())) : null;
|
|
320
|
+
}
|
|
321
|
+
async function xe(e) {
|
|
322
|
+
if (e.joined) return console.error("Refused to save a joined bookable as one schedule", e.id), "That meeting is a booking link on a schedule — change the link or the schedule, not the two at once.";
|
|
323
|
+
try {
|
|
324
|
+
return await D(C(p, h, e.id), {
|
|
325
|
+
...R(e),
|
|
326
|
+
updatedAt: Date.now()
|
|
327
|
+
}), null;
|
|
328
|
+
} catch (e) {
|
|
329
|
+
return console.error("Could not save the schedule", e), "The hours could not be saved — make sure you are signed in and that this schedule is yours, then try again.";
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function Se(e) {
|
|
333
|
+
try {
|
|
334
|
+
return await D(C(p, h, e.id), {
|
|
335
|
+
...L(e),
|
|
336
|
+
updatedAt: Date.now()
|
|
337
|
+
}), null;
|
|
338
|
+
} catch (e) {
|
|
339
|
+
return console.error("Could not save the booking link", e), "The link could not be saved — make sure you are signed in and that this schedule is yours, then try again.";
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
async function Ce(e) {
|
|
343
|
+
try {
|
|
344
|
+
return await S(C(p, h, e)), null;
|
|
345
|
+
} catch (e) {
|
|
346
|
+
return console.error("Could not remove the booking link", e), "It could not be removed — make sure you are signed in and that this link is yours, then try again.";
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
async function we(e) {
|
|
350
|
+
if (!e.length) return null;
|
|
351
|
+
let { schedules: t, links: n } = de(e);
|
|
352
|
+
try {
|
|
353
|
+
let e = Date.now();
|
|
354
|
+
for (let n of t) await D(C(p, h, n.id), {
|
|
355
|
+
...R(n),
|
|
356
|
+
updatedAt: e
|
|
357
|
+
});
|
|
358
|
+
for (let t of n) await D(C(p, h, t.id), {
|
|
359
|
+
...L(t),
|
|
360
|
+
updatedAt: e
|
|
361
|
+
});
|
|
362
|
+
return null;
|
|
363
|
+
} catch (e) {
|
|
364
|
+
return console.error("Could not split the older schedules into hours and links", e), "Your older schedules could not be tidied into hours and booking links — make sure you are signed in, then reload the screen.";
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
async function Te(e) {
|
|
368
|
+
try {
|
|
369
|
+
return await S(C(p, h, e)), null;
|
|
370
|
+
} catch (e) {
|
|
371
|
+
return console.error("Could not remove the schedule", e), "It could not be removed — make sure you are signed in and that this schedule is yours, then try again.";
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
var Ee = (e) => e.name.trim() || e.email.split("@")[0] || "";
|
|
375
|
+
function De() {
|
|
376
|
+
let [e, t] = b({
|
|
377
|
+
loading: !0,
|
|
378
|
+
members: []
|
|
379
|
+
});
|
|
380
|
+
return v(() => {
|
|
381
|
+
let e = _("user_profiles/team", () => E(x(p, "user_profiles"), O("role", "in", ["internal", "admin"])), (e) => {
|
|
382
|
+
let n = [];
|
|
383
|
+
e.forEach((e) => {
|
|
384
|
+
let t = e.data() || {}, r = t.role === "admin" || t.role === "internal" ? t.role : null;
|
|
385
|
+
!r || t.inactive === !0 || n.push({
|
|
386
|
+
id: e.id,
|
|
387
|
+
name: String(t.displayName || ""),
|
|
388
|
+
email: String(t.email || ""),
|
|
389
|
+
role: r
|
|
390
|
+
});
|
|
391
|
+
}), n.sort((e, t) => (e.name || e.email).localeCompare(t.name || t.email)), t({
|
|
392
|
+
loading: !1,
|
|
393
|
+
members: n
|
|
394
|
+
});
|
|
395
|
+
}, () => t({
|
|
396
|
+
loading: !1,
|
|
397
|
+
members: []
|
|
398
|
+
}));
|
|
399
|
+
return () => e();
|
|
400
|
+
}, []), e;
|
|
401
|
+
}
|
|
402
|
+
function Oe(e, t) {
|
|
403
|
+
let [n, r] = b([]), i = (e || []).slice().sort().join(","), [o] = b(() => Date.now()), s = t instanceof Date && !Number.isNaN(t.getTime()) ? t.getTime() : o, c = (/* @__PURE__ */ new Date(Math.floor(s / 6e4) * 6e4)).toISOString();
|
|
404
|
+
return v(() => {
|
|
405
|
+
if (!i) return;
|
|
406
|
+
let e = new Set(i.split(",")), t = new Date(Date.parse(c) - K).toISOString(), n = T(E(x(p, a), O("start", ">=", t)), (t) => {
|
|
407
|
+
let n = [];
|
|
408
|
+
t.forEach((t) => {
|
|
409
|
+
let r = t.data() || {}, i = String(r.memberId || "");
|
|
410
|
+
if (!e.has(i)) return;
|
|
411
|
+
let a = {
|
|
412
|
+
memberId: i,
|
|
413
|
+
start: String(r.start || ""),
|
|
414
|
+
end: String(r.end || ""),
|
|
415
|
+
createdAt: typeof r.createdAt == "number" ? r.createdAt : 0
|
|
416
|
+
};
|
|
417
|
+
G(a) && a.end >= c && n.push(a);
|
|
418
|
+
}), r(n);
|
|
419
|
+
}, () => r([]));
|
|
420
|
+
return () => n();
|
|
421
|
+
}, [i, c]), i ? n : ke;
|
|
422
|
+
}
|
|
423
|
+
var ke = [], W = /^\d{4}-\d{2}-\d{2}T/, G = (e) => W.test(e.start) && W.test(e.end) && !Number.isNaN(Date.parse(e.start)) && !Number.isNaN(Date.parse(e.end)), K = 4 * 36e5, q = 15 * 6e4, J = "taken", Ae = "That time was just taken — pick another.";
|
|
424
|
+
function je(e) {
|
|
425
|
+
let t = Date.parse(e.start), n = Date.parse(e.end), r = Math.ceil((t - K) / q) * q, i = [];
|
|
426
|
+
for (let t = r; t < n; t += q) i.push(g(e.memberId, new Date(t).toISOString()));
|
|
427
|
+
return i;
|
|
428
|
+
}
|
|
429
|
+
async function Y(e) {
|
|
430
|
+
let t = g(e.memberId, e.start);
|
|
431
|
+
try {
|
|
432
|
+
return await ae(p, async (n) => {
|
|
433
|
+
let r = C(p, a, t), i = je(e).filter((e) => e !== t), [o, ...s] = await Promise.all([n.get(r), ...i.map((e) => n.get(C(p, a, e)))]);
|
|
434
|
+
if (o.exists()) throw Error(J);
|
|
435
|
+
for (let t of s) {
|
|
436
|
+
if (!t.exists()) continue;
|
|
437
|
+
let n = t.data() || {};
|
|
438
|
+
if (l({
|
|
439
|
+
start: String(n.start || ""),
|
|
440
|
+
end: String(n.end || "")
|
|
441
|
+
}, e)) throw Error(J);
|
|
442
|
+
}
|
|
443
|
+
n.set(r, {
|
|
444
|
+
memberId: e.memberId,
|
|
445
|
+
start: e.start,
|
|
446
|
+
end: e.end,
|
|
447
|
+
createdAt: Date.now()
|
|
448
|
+
});
|
|
449
|
+
}), null;
|
|
450
|
+
} catch (e) {
|
|
451
|
+
return e?.message === J ? Ae : (console.error("Could not claim the time", e), "The time could not be saved — check your connection and try again.");
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
async function X(e) {
|
|
455
|
+
try {
|
|
456
|
+
await S(C(p, a, g(e.memberId, e.start)));
|
|
457
|
+
} catch {}
|
|
458
|
+
}
|
|
459
|
+
async function Me(e, t) {
|
|
460
|
+
try {
|
|
461
|
+
return await D(C(p, f, g(e.memberId, e.start)), {
|
|
462
|
+
memberId: e.memberId,
|
|
463
|
+
memberName: t.memberName,
|
|
464
|
+
scheduleId: t.scheduleId,
|
|
465
|
+
scheduleName: t.scheduleName,
|
|
466
|
+
paymentId: t.paymentId || "",
|
|
467
|
+
paymentSession: t.paymentSession || "",
|
|
468
|
+
start: e.start,
|
|
469
|
+
end: e.end,
|
|
470
|
+
timeZone: t.timeZone,
|
|
471
|
+
name: t.name,
|
|
472
|
+
email: t.email.trim().toLowerCase(),
|
|
473
|
+
answers: t.answers,
|
|
474
|
+
formId: t.formId,
|
|
475
|
+
entryId: t.entryId,
|
|
476
|
+
uid: r.currentUser?.uid || "guest",
|
|
477
|
+
createdAt: Date.now(),
|
|
478
|
+
pending: !0
|
|
479
|
+
}), null;
|
|
480
|
+
} catch (e) {
|
|
481
|
+
return console.error("Could not write the booking", e), "The booking could not be saved — check your connection and try again.";
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
var Z = (e, t) => ({
|
|
485
|
+
id: e,
|
|
486
|
+
memberId: String(t?.memberId || ""),
|
|
487
|
+
scheduleId: String(t?.scheduleId || ""),
|
|
488
|
+
scheduleName: String(t?.scheduleName || ""),
|
|
489
|
+
own: t?.own === !0,
|
|
490
|
+
title: String(t?.title || ""),
|
|
491
|
+
color: String(t?.color || ""),
|
|
492
|
+
paymentId: String(t?.paymentId || ""),
|
|
493
|
+
paymentSession: String(t?.paymentSession || ""),
|
|
494
|
+
cancelled: t?.cancelled === !0,
|
|
495
|
+
cancelledAt: typeof t?.cancelledAt == "number" ? t.cancelledAt : 0,
|
|
496
|
+
cancelReason: String(t?.cancelReason || ""),
|
|
497
|
+
cancelledBy: String(t?.cancelledBy || ""),
|
|
498
|
+
cancelledSide: t?.cancelledSide === "host" || t?.cancelledSide === "booker" ? t.cancelledSide : "",
|
|
499
|
+
cancelledByUid: String(t?.cancelledByUid || ""),
|
|
500
|
+
pending: t?.pending === !0,
|
|
501
|
+
acceptedAt: typeof t?.acceptedAt == "number" ? t.acceptedAt : 0,
|
|
502
|
+
heldOnly: !1,
|
|
503
|
+
copyIds: [e],
|
|
504
|
+
partySize: 1,
|
|
505
|
+
partyAccepted: t?.pending === !0 ? 0 : 1,
|
|
506
|
+
start: String(t?.start || ""),
|
|
507
|
+
end: String(t?.end || ""),
|
|
508
|
+
memberName: String(t?.memberName || ""),
|
|
509
|
+
timeZone: i(t?.timeZone) ? String(t.timeZone) : "",
|
|
510
|
+
name: String(t?.name || ""),
|
|
511
|
+
email: String(t?.email || ""),
|
|
512
|
+
answers: t?.answers && typeof t.answers == "object" ? Object.fromEntries(Object.entries(t.answers).map(([e, t]) => [e, String(t ?? "")])) : {},
|
|
513
|
+
formId: String(t?.formId || ""),
|
|
514
|
+
entryId: String(t?.entryId || ""),
|
|
515
|
+
uid: String(t?.uid || ""),
|
|
516
|
+
createdAt: typeof t?.createdAt == "number" ? t.createdAt : 0
|
|
517
|
+
});
|
|
518
|
+
function Ne(e = {}) {
|
|
519
|
+
let [t, n] = b({
|
|
520
|
+
loading: !0,
|
|
521
|
+
bookings: [],
|
|
522
|
+
error: null
|
|
523
|
+
}), r = (e.members || []).slice().sort().join(","), i = !!e.includePast, a = e.now;
|
|
524
|
+
return v(() => {
|
|
525
|
+
let e = r ? new Set(r.split(",")) : null, t = (a ? a() : /* @__PURE__ */ new Date()).toISOString(), o = T(i ? x(p, f) : E(x(p, f), O("end", ">=", t)), (t) => {
|
|
526
|
+
let r = (a ? a() : /* @__PURE__ */ new Date()).toISOString(), o = [];
|
|
527
|
+
t.forEach((t) => {
|
|
528
|
+
let n = Z(t.id, t.data());
|
|
529
|
+
e && !e.has(n.memberId) || G(n) && o.push(n);
|
|
530
|
+
});
|
|
531
|
+
let s = o.filter((e) => e.end >= r).sort((e, t) => e.start.localeCompare(t.start)), c = i ? o.filter((e) => e.end < r).sort((e, t) => t.start.localeCompare(e.start)) : [];
|
|
532
|
+
n({
|
|
533
|
+
loading: !1,
|
|
534
|
+
bookings: [...s, ...c],
|
|
535
|
+
error: null
|
|
536
|
+
});
|
|
537
|
+
}, (e) => {
|
|
538
|
+
n({
|
|
539
|
+
loading: !1,
|
|
540
|
+
bookings: [],
|
|
541
|
+
error: String(e?.code || "").includes("permission") ? "This is for the team — sign in as a team member or admin to see the bookings." : "The bookings could not be loaded."
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
return () => o();
|
|
545
|
+
}, [
|
|
546
|
+
r,
|
|
547
|
+
i,
|
|
548
|
+
a
|
|
549
|
+
]), t;
|
|
550
|
+
}
|
|
551
|
+
function Q(e, t, n) {
|
|
552
|
+
return _(`${f}/uid=${e}`, () => E(x(p, f), O("uid", "==", e)), (e) => t(e.docs), n);
|
|
553
|
+
}
|
|
554
|
+
function Pe(e, t, n) {
|
|
555
|
+
return _(`${f}/email=${e}`, () => E(x(p, f), O("email", "==", e)), (e) => t(e.docs), n);
|
|
556
|
+
}
|
|
557
|
+
function Fe(e, t) {
|
|
558
|
+
let { user: n } = c(), r = e === void 0 && t === void 0, i = r ? n?.uid || "" : e || "", a = (r ? n?.email || "" : t || "").trim().toLowerCase(), [o, s] = b(Ie), [l, u] = b(Ie);
|
|
559
|
+
v(() => {
|
|
560
|
+
if (i) return Q(i, (e) => s({
|
|
561
|
+
done: !0,
|
|
562
|
+
list: e.map((e) => Z(e.id, e.data())).filter(G),
|
|
563
|
+
error: null
|
|
564
|
+
}), (e) => s({
|
|
565
|
+
done: !0,
|
|
566
|
+
list: [],
|
|
567
|
+
error: $(e)
|
|
568
|
+
}));
|
|
569
|
+
}, [i]), v(() => {
|
|
570
|
+
if (a) return Pe(a, (e) => u({
|
|
571
|
+
done: !0,
|
|
572
|
+
list: e.map((e) => Z(e.id, e.data())).filter(G),
|
|
573
|
+
error: null
|
|
574
|
+
}), (e) => u({
|
|
575
|
+
done: !0,
|
|
576
|
+
list: [],
|
|
577
|
+
error: $(e)
|
|
578
|
+
}));
|
|
579
|
+
}, [a]);
|
|
580
|
+
let d = i ? o : Le, f = a ? l : Le;
|
|
581
|
+
return {
|
|
582
|
+
loading: !d.done || !f.done,
|
|
583
|
+
bookings: y(() => Ve(Be(d.list, f.list)), [d.list, f.list]),
|
|
584
|
+
error: d.error && f.error ? d.error : null
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
var Ie = {
|
|
588
|
+
done: !1,
|
|
589
|
+
list: [],
|
|
590
|
+
error: null
|
|
591
|
+
}, Le = {
|
|
592
|
+
done: !0,
|
|
593
|
+
list: [],
|
|
594
|
+
error: null
|
|
595
|
+
}, $ = (e) => String(e?.code || "").includes("permission") ? "These are not readable from this account." : "The bookings could not be loaded.", Re = (e) => {
|
|
596
|
+
let t = new Set(e.legacyIds);
|
|
597
|
+
return new Set(e.schedules.filter((e) => !t.has(e.id)).map((e) => e.id));
|
|
598
|
+
}, ze = (e, t) => e.map((e) => e.scheduleId && t.has(e.scheduleId) ? {
|
|
599
|
+
...e,
|
|
600
|
+
scheduleName: ""
|
|
601
|
+
} : e);
|
|
602
|
+
function Be(...e) {
|
|
603
|
+
let t = /* @__PURE__ */ new Map();
|
|
604
|
+
for (let n of e) for (let e of n) e.own || t.set(e.id, e);
|
|
605
|
+
return [...t.values()].sort((e, t) => e.start.localeCompare(t.start));
|
|
606
|
+
}
|
|
607
|
+
function Ve(e) {
|
|
608
|
+
let t = /* @__PURE__ */ new Map();
|
|
609
|
+
for (let n of e) {
|
|
610
|
+
let e = z(n), r = t.get(e);
|
|
611
|
+
r ? r.push(n) : t.set(e, [n]);
|
|
612
|
+
}
|
|
613
|
+
return [...t.values()].map((e) => {
|
|
614
|
+
let t = B(e);
|
|
615
|
+
if (e.length === 1) return {
|
|
616
|
+
...e[0],
|
|
617
|
+
...t
|
|
618
|
+
};
|
|
619
|
+
let n = e.map((e) => e.memberName.trim()).filter(Boolean), r = n.length <= 1 ? n.join("") : `${n.slice(0, -1).join(", ")} and ${n[n.length - 1]}`, i = e.find((e) => e.cancelled && (e.cancelReason || e.cancelledBy));
|
|
620
|
+
return {
|
|
621
|
+
...e[0],
|
|
622
|
+
...t,
|
|
623
|
+
memberName: r,
|
|
624
|
+
cancelled: e.every((e) => e.cancelled),
|
|
625
|
+
cancelReason: i?.cancelReason || e[0].cancelReason,
|
|
626
|
+
cancelledBy: i?.cancelledBy || e[0].cancelledBy,
|
|
627
|
+
cancelledSide: i?.cancelledSide || e[0].cancelledSide
|
|
628
|
+
};
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
async function He(e, t) {
|
|
632
|
+
try {
|
|
633
|
+
return await D(C(p, f, e), { color: t }, { merge: !0 }), null;
|
|
634
|
+
} catch (e) {
|
|
635
|
+
return console.error("Could not colour the booking", e), "The colour could not be saved — make sure you are signed in as a team member and try again.";
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
async function Ue(e) {
|
|
639
|
+
let t = {
|
|
640
|
+
memberId: e.memberId,
|
|
641
|
+
scheduleId: "",
|
|
642
|
+
start: e.start,
|
|
643
|
+
end: e.end
|
|
644
|
+
}, n = await Y(t);
|
|
645
|
+
if (n) return n === "That time was just taken — pick another." ? "Something is already booked at that time — pick another." : n;
|
|
646
|
+
try {
|
|
647
|
+
return await D(C(p, f, g(e.memberId, e.start)), {
|
|
648
|
+
memberId: e.memberId,
|
|
649
|
+
memberName: e.memberName,
|
|
650
|
+
scheduleId: "",
|
|
651
|
+
scheduleName: "",
|
|
652
|
+
paymentId: "",
|
|
653
|
+
paymentSession: "",
|
|
654
|
+
own: !0,
|
|
655
|
+
title: e.title,
|
|
656
|
+
color: e.color,
|
|
657
|
+
start: e.start,
|
|
658
|
+
end: e.end,
|
|
659
|
+
timeZone: e.timeZone,
|
|
660
|
+
name: "",
|
|
661
|
+
email: "",
|
|
662
|
+
answers: e.note ? { note: e.note } : {},
|
|
663
|
+
formId: "",
|
|
664
|
+
entryId: "",
|
|
665
|
+
uid: r.currentUser?.uid || "",
|
|
666
|
+
createdAt: Date.now()
|
|
667
|
+
}), null;
|
|
668
|
+
} catch (e) {
|
|
669
|
+
return console.error("Could not save the event", e), await X(t), "The event could not be saved — make sure you are signed in as a team member and try again.";
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
async function We(e) {
|
|
673
|
+
try {
|
|
674
|
+
return await D(C(p, f, e), {
|
|
675
|
+
pending: !1,
|
|
676
|
+
acceptedAt: Date.now()
|
|
677
|
+
}, { merge: !0 }), null;
|
|
678
|
+
} catch (e) {
|
|
679
|
+
return console.error("Could not accept the booking", e), "It could not be accepted — make sure you are signed in as a team member and try again.";
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
async function Ge(e, t = {}) {
|
|
683
|
+
try {
|
|
684
|
+
let n = t.ids?.length ? t.ids : await Ke(e), r = {
|
|
685
|
+
cancelled: !0,
|
|
686
|
+
cancelledAt: Date.now(),
|
|
687
|
+
cancelReason: (t.reason || "").trim(),
|
|
688
|
+
cancelledBy: (t.by || "").trim(),
|
|
689
|
+
cancelledSide: t.side || "",
|
|
690
|
+
...t.byUid && t.side !== "booker" ? { cancelledByUid: t.byUid } : {}
|
|
691
|
+
};
|
|
692
|
+
for (let e of n) await D(C(p, f, e), r, { merge: !0 }), await S(C(p, a, e));
|
|
693
|
+
return null;
|
|
694
|
+
} catch (e) {
|
|
695
|
+
return console.error("Could not cancel the booking", e), t.side === "booker" ? "It could not be cancelled — check your connection and try again." : "It could not be cancelled — make sure you are signed in as a team member and try again.";
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
async function Ke(e) {
|
|
699
|
+
try {
|
|
700
|
+
let t = await w(C(p, f, e)), n = t.exists() && t.data() || {}, r = String(n.entryId || ""), i = String(n.start || "");
|
|
701
|
+
if (!r || !i) return [e];
|
|
702
|
+
let a = await ie(E(x(p, f), O("entryId", "==", r))), o = new Set([e]);
|
|
703
|
+
return a.forEach((e) => {
|
|
704
|
+
String(e.data()?.start || "") === i && o.add(e.id);
|
|
705
|
+
}), [...o];
|
|
706
|
+
} catch {
|
|
707
|
+
return [e];
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
async function qe(e, t) {
|
|
711
|
+
try {
|
|
712
|
+
let n = t?.length ? t : await Ke(e);
|
|
713
|
+
for (let e of n) await S(C(p, f, e)), await S(C(p, a, e));
|
|
714
|
+
return null;
|
|
715
|
+
} catch (e) {
|
|
716
|
+
return console.error("Could not remove the booking", e), "It could not be removed — make sure you are signed in as a team member and try again.";
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
async function Je(e, t) {
|
|
720
|
+
try {
|
|
721
|
+
return await S(C(p, a, g(e, t))), null;
|
|
722
|
+
} catch (e) {
|
|
723
|
+
return console.error("Could not free the held time", e), "The time could not be freed — make sure you are signed in as a team member and try again.";
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
//#endregion
|
|
727
|
+
export { fe as A, De as C, ze as D, Re as E, ue as F, ce as I, I as L, j as M, P as N, Me as O, le as P, se as R, _e as S, Q as T, ge as _, qe as a, U as b, Ce as c, xe as d, He as f, Ne as g, ve as h, Y as i, me as j, he as k, Te as l, Ee as m, Ue as n, Je as o, we as p, Ge as r, X as s, We as t, Se as u, Fe as v, Pe as w, Oe as x, ye as y, A as z };
|