@msm-platform/customer-react 0.4.3 → 0.4.4
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/CHANGELOG.md +7 -0
- package/README.md +7 -2
- package/dist/account.d.ts +3 -0
- package/dist/booking-flow.d.ts +3 -0
- package/dist/booking.d.ts +3 -13
- package/dist/formats.d.ts +17 -0
- package/dist/i18n.d.ts +61 -22
- package/dist/i18n.is.d.ts +2 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +2115 -1462
- package/dist/pay.d.ts +125 -0
- package/dist/portal.d.ts +2 -0
- package/dist/refusals.d.ts +14 -0
- package/dist/screens/business.d.ts +36 -1
- package/dist/sign-in-standalone.d.ts +3 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,497 +4,1150 @@ import { createCustomerClient as l, isCustomerApiError as u } from "@msm-platfor
|
|
|
4
4
|
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
5
5
|
import { Metadata as m, getCountries as h, getCountryCallingCode as g, parsePhoneNumberFromString as _, validatePhoneNumberLength as v } from "libphonenumber-js";
|
|
6
6
|
import y from "libphonenumber-js/min/metadata";
|
|
7
|
-
// src/
|
|
8
|
-
var b =
|
|
9
|
-
function
|
|
7
|
+
// src/context.ts
|
|
8
|
+
var b = e(null);
|
|
9
|
+
function x() {
|
|
10
|
+
let e = n(b);
|
|
11
|
+
if (!e) throw Error("usePortal needs a customer screen component.");
|
|
12
|
+
return e;
|
|
13
|
+
}
|
|
14
|
+
// src/formats.ts
|
|
15
|
+
var S = (e) => new Intl.NumberFormat("en", {
|
|
16
|
+
style: "currency",
|
|
17
|
+
currency: e
|
|
18
|
+
}).resolvedOptions().maximumFractionDigits ?? 0, C = (e) => e && { timeZone: e }, w = {
|
|
19
|
+
number: (e) => new Intl.NumberFormat("en-GB").format(e),
|
|
20
|
+
money: (e, t) => new Intl.NumberFormat("en-GB", {
|
|
21
|
+
style: "currency",
|
|
22
|
+
currency: t
|
|
23
|
+
}).format(e / 10 ** S(t)),
|
|
24
|
+
dateTime: (e, t) => new Intl.DateTimeFormat("en-GB", {
|
|
25
|
+
dateStyle: "medium",
|
|
26
|
+
timeStyle: "short",
|
|
27
|
+
...C(t)
|
|
28
|
+
}).format(new Date(e)),
|
|
29
|
+
time: (e, t) => new Intl.DateTimeFormat("en-GB", {
|
|
30
|
+
timeStyle: "short",
|
|
31
|
+
...C(t)
|
|
32
|
+
}).format(new Date(e)),
|
|
33
|
+
date: (e, t) => new Intl.DateTimeFormat("en-GB", {
|
|
34
|
+
dateStyle: "medium",
|
|
35
|
+
...C(t)
|
|
36
|
+
}).format(new Date(e)),
|
|
37
|
+
day: (e, t) => new Intl.DateTimeFormat("en-GB", {
|
|
38
|
+
weekday: "long",
|
|
39
|
+
day: "numeric",
|
|
40
|
+
month: "long",
|
|
41
|
+
...C(t)
|
|
42
|
+
}).format(new Date(e))
|
|
43
|
+
}, T = [
|
|
44
|
+
"janúar",
|
|
45
|
+
"febrúar",
|
|
46
|
+
"mars",
|
|
47
|
+
"apríl",
|
|
48
|
+
"maí",
|
|
49
|
+
"júní",
|
|
50
|
+
"júlí",
|
|
51
|
+
"ágúst",
|
|
52
|
+
"september",
|
|
53
|
+
"október",
|
|
54
|
+
"nóvember",
|
|
55
|
+
"desember"
|
|
56
|
+
], E = [
|
|
57
|
+
"jan.",
|
|
58
|
+
"feb.",
|
|
59
|
+
"mar.",
|
|
60
|
+
"apr.",
|
|
61
|
+
"maí",
|
|
62
|
+
"jún.",
|
|
63
|
+
"júl.",
|
|
64
|
+
"ágú.",
|
|
65
|
+
"sep.",
|
|
66
|
+
"okt.",
|
|
67
|
+
"nóv.",
|
|
68
|
+
"des."
|
|
69
|
+
], D = [
|
|
70
|
+
"sunnudagur",
|
|
71
|
+
"mánudagur",
|
|
72
|
+
"þriðjudagur",
|
|
73
|
+
"miðvikudagur",
|
|
74
|
+
"fimmtudagur",
|
|
75
|
+
"föstudagur",
|
|
76
|
+
"laugardagur"
|
|
77
|
+
];
|
|
78
|
+
function O(e, t) {
|
|
79
|
+
let n = new Intl.DateTimeFormat("en-GB", {
|
|
80
|
+
year: "numeric",
|
|
81
|
+
month: "numeric",
|
|
82
|
+
day: "numeric",
|
|
83
|
+
hour: "2-digit",
|
|
84
|
+
minute: "2-digit",
|
|
85
|
+
hourCycle: "h23",
|
|
86
|
+
...C(t)
|
|
87
|
+
}).formatToParts(new Date(e)), r = (e) => Number(n.find((t) => t.type === e)?.value), i = r("year"), a = r("month"), o = r("day");
|
|
88
|
+
return {
|
|
89
|
+
year: i,
|
|
90
|
+
month: a,
|
|
91
|
+
day: o,
|
|
92
|
+
weekday: new Date(Date.UTC(i, a - 1, o)).getUTCDay(),
|
|
93
|
+
time: `${String(r("hour")).padStart(2, "0")}:${String(r("minute")).padStart(2, "0")}`
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
var k = new Intl.NumberFormat("de-DE"), A = {
|
|
97
|
+
number: (e) => k.format(e),
|
|
98
|
+
money: (e, t) => {
|
|
99
|
+
let n = S(t);
|
|
100
|
+
return `${new Intl.NumberFormat("de-DE", {
|
|
101
|
+
minimumFractionDigits: n,
|
|
102
|
+
maximumFractionDigits: n
|
|
103
|
+
}).format(e / 10 ** n)}\u00a0${t === "ISK" ? "kr." : t}`;
|
|
104
|
+
},
|
|
105
|
+
dateTime: (e, t) => `${A.date(e, t)}, ${A.time(e, t)}`,
|
|
106
|
+
time: (e, t) => O(e, t).time,
|
|
107
|
+
date: (e, t) => {
|
|
108
|
+
let { year: n, month: r, day: i } = O(e, t);
|
|
109
|
+
return `${i}. ${E[r - 1]} ${n}`;
|
|
110
|
+
},
|
|
111
|
+
day: (e, t) => {
|
|
112
|
+
let { month: n, day: r, weekday: i } = O(e, t), a = D[i] ?? "";
|
|
113
|
+
return `${a.charAt(0).toUpperCase()}${a.slice(1)}, ${r}. ${T[n - 1]}`;
|
|
114
|
+
}
|
|
115
|
+
}, j = {
|
|
116
|
+
en: {
|
|
117
|
+
plural: "en-GB",
|
|
118
|
+
messages: {
|
|
119
|
+
"app.loading": "Loading…",
|
|
120
|
+
"app.loadFailed": "Something went wrong loading this page. Try again.",
|
|
121
|
+
"app.retry": "Try again",
|
|
122
|
+
"app.signedOut": "You were signed out because your session ended. Sign in again.",
|
|
123
|
+
"app.signedOutEverywhere": "You were signed out on every device.",
|
|
124
|
+
"image.logo": "{name} logo",
|
|
125
|
+
"nav.label": "Booking and my account",
|
|
126
|
+
"nav.book": "Book",
|
|
127
|
+
"nav.signIn": "Sign in",
|
|
128
|
+
"nav.bookings": "Bookings",
|
|
129
|
+
"nav.passes": "Passes",
|
|
130
|
+
"nav.details": "My details",
|
|
131
|
+
"nav.signOut": "Sign out",
|
|
132
|
+
"signIn.heading": "Sign in",
|
|
133
|
+
"signIn.intro": "We'll text a one-time code to your phone.",
|
|
134
|
+
"register.intro": "One more step: what's your name?",
|
|
135
|
+
"register.name": "Your name",
|
|
136
|
+
"signIn.phone": "Phone number",
|
|
137
|
+
"signIn.codeSent": "Enter the code we sent to {phone}.",
|
|
138
|
+
"signIn.code": "Verification code",
|
|
139
|
+
"signIn.sendCode": "Send code",
|
|
140
|
+
"signIn.submit": "Sign in",
|
|
141
|
+
"register.submit": "Create account",
|
|
142
|
+
"signIn.wait": "Please wait…",
|
|
143
|
+
"signIn.differentNumber": "Use a different number",
|
|
144
|
+
"signIn.cancel": "Cancel",
|
|
145
|
+
"signIn.error.tooMany": "Too many codes requested. Try again in about {wait}.",
|
|
146
|
+
"signIn.error.tooManyLater": "Too many codes requested. Try again later.",
|
|
147
|
+
"signIn.error.paused": "Sign-in codes are paused for now. Try again in about {wait}.",
|
|
148
|
+
"signIn.error.pausedLater": "Sign-in codes are paused for now. Try again later.",
|
|
149
|
+
"signIn.error.destination": "This number can't receive sign-in codes.",
|
|
150
|
+
"signIn.error.badCode": "That code is incorrect or has expired.",
|
|
151
|
+
"register.error.expired": "That took too long. Request a new code.",
|
|
152
|
+
"register.error.name": "Check your name and try again.",
|
|
153
|
+
"signIn.error.invalid": "Check the phone number and try again.",
|
|
154
|
+
"signIn.error.refused": "This number can't sign in here.",
|
|
155
|
+
"signIn.error.unreachable": "The sign-in service is unreachable. Try again shortly.",
|
|
156
|
+
"signIn.error.failed": "Sign-in failed. Try again shortly.",
|
|
157
|
+
"signIn.error.botCheck": "We couldn't confirm you're a person. Complete the check and try again.",
|
|
158
|
+
"signIn.error.botCheckUnavailable": "The security check is unavailable. Try again shortly.",
|
|
159
|
+
"signIn.error.notConfigured": "Sign-in isn't set up on this site yet.",
|
|
160
|
+
"wait.seconds.one": "{count} second",
|
|
161
|
+
"wait.seconds.other": "{count} seconds",
|
|
162
|
+
"wait.minutes.one": "{count} minute",
|
|
163
|
+
"wait.minutes.other": "{count} minutes",
|
|
164
|
+
"wait.hours.one": "{count} hour",
|
|
165
|
+
"wait.hours.other": "{count} hours",
|
|
166
|
+
"bookings.heading": "Bookings",
|
|
167
|
+
"bookings.period": "Which bookings",
|
|
168
|
+
"bookings.upcoming": "Upcoming",
|
|
169
|
+
"bookings.past": "Past",
|
|
170
|
+
"bookings.emptyUpcoming": "You have no upcoming bookings.",
|
|
171
|
+
"bookings.emptyPast": "You have no past bookings.",
|
|
172
|
+
"bookings.more": "Show more",
|
|
173
|
+
"bookings.when": "{start} – {end}",
|
|
174
|
+
"bookings.cancelled": "Cancelled",
|
|
175
|
+
"bookings.cancelledLate": "Cancelled late",
|
|
176
|
+
"bookings.attended": "Attended",
|
|
177
|
+
"bookings.noShow": "Missed",
|
|
178
|
+
"bookings.lateFrom": "Late cancellation from {time}",
|
|
179
|
+
"bookings.started": "This booking can no longer be cancelled because the event has started.",
|
|
180
|
+
"bookings.cancel": "Cancel booking",
|
|
181
|
+
"bookings.confirmHeading": "Cancel this booking?",
|
|
182
|
+
"bookings.confirmLate": "This is a late cancellation: the cancellation window has closed.",
|
|
183
|
+
"bookings.confirmCredit": "The pass credit you used for this booking stays spent.",
|
|
184
|
+
"bookings.confirm": "Yes, cancel",
|
|
185
|
+
"bookings.keep": "Keep booking",
|
|
186
|
+
"bookings.cancelling": "Cancelling…",
|
|
187
|
+
"bookings.doneOnTime": "Your booking is cancelled.",
|
|
188
|
+
"bookings.doneLate": "Your booking is cancelled. It counts as a late cancellation.",
|
|
189
|
+
"bookings.cancelFailed": "The booking could not be cancelled. Try again.",
|
|
190
|
+
"bookings.gone": "This booking no longer exists.",
|
|
191
|
+
"businesses.heading": "Book",
|
|
192
|
+
"businesses.intro": "Choose where you'd like to book.",
|
|
193
|
+
"businesses.empty": "No businesses take bookings here yet.",
|
|
194
|
+
"businesses.open": "See times",
|
|
195
|
+
"business.all": "All businesses",
|
|
196
|
+
"business.notFound": "This business isn't taking bookings here.",
|
|
197
|
+
"business.types": "Services",
|
|
198
|
+
"business.allTypes": "Everything",
|
|
199
|
+
"business.resources": "With",
|
|
200
|
+
"business.anyResource": "Anyone",
|
|
201
|
+
"business.typeMissing": "This service can't be booked here.",
|
|
202
|
+
"business.minutes": "{minutes} min",
|
|
203
|
+
"business.week": "Which week",
|
|
204
|
+
"business.previousWeek": "Previous week",
|
|
205
|
+
"business.nextWeek": "Next week",
|
|
206
|
+
"business.weekOf": "{from} – {to}",
|
|
207
|
+
"business.empty": "Nothing is open in these days.",
|
|
208
|
+
"business.seatsLeft.one": "{count} seat left",
|
|
209
|
+
"business.seatsLeft.other": "{count} seats left",
|
|
210
|
+
"business.full": "Full",
|
|
211
|
+
"business.openTime": "Open time",
|
|
212
|
+
"business.with": "With {resource}",
|
|
213
|
+
"business.book": "Book",
|
|
214
|
+
"book.heading": "Your booking",
|
|
215
|
+
"book.signInFirst": "Sign in with your phone to book this time.",
|
|
216
|
+
"book.back": "Choose another time",
|
|
217
|
+
"book.reserving": "Holding this time for you…",
|
|
218
|
+
"book.heldUntil": "We're holding this time for you until {time}.",
|
|
219
|
+
"book.confirm": "Confirm booking",
|
|
220
|
+
"book.confirming": "Confirming…",
|
|
221
|
+
"book.booked": "You're booked.",
|
|
222
|
+
"book.toBookings": "See all my bookings",
|
|
223
|
+
"book.done": "Done",
|
|
224
|
+
"book.close": "Close",
|
|
225
|
+
"book.chooseType": "What would you like to book?",
|
|
226
|
+
"book.noTypes": "There is nothing to book here yet.",
|
|
227
|
+
"book.seeAll": "See all times",
|
|
228
|
+
"book.chooseResource": "Who would you like to book with?",
|
|
229
|
+
"book.anyResource": "Anyone",
|
|
230
|
+
"book.anyResourceHint": "The first free times with anyone who offers it",
|
|
231
|
+
"book.toTypes": "Back to services",
|
|
232
|
+
"book.toStep": "Back",
|
|
233
|
+
"book.otherResource": "Choose someone else",
|
|
234
|
+
"book.reserveAgain": "Hold this time again",
|
|
235
|
+
"book.full": "This class is full now. Choose another time.",
|
|
236
|
+
"book.slotTaken": "Someone has just taken this time. Choose another.",
|
|
237
|
+
"book.limit": "You already hold the most unconfirmed bookings allowed. Confirm one, or wait a few minutes for an unconfirmed one to lapse, then try again.",
|
|
238
|
+
"book.expired": "We held this time for as long as we could, and it has lapsed. Hold it again if it's still free.",
|
|
239
|
+
"book.notAllowed": "Booking this needs a membership or pass that covers it. Ask the business.",
|
|
240
|
+
"book.unavailable": "This time can no longer be booked. Choose another.",
|
|
241
|
+
"book.banned": "You can't book online until {date} because of bookings you didn't show up to. Contact the business if you think this is a mistake.",
|
|
242
|
+
"book.banned.undated": "You can't book online right now because of bookings you didn't show up to. Contact the business if you think this is a mistake.",
|
|
243
|
+
"book.refused": "This business can't take your booking. Contact them.",
|
|
244
|
+
"book.failed": "The booking could not be made. Try again.",
|
|
245
|
+
"pay.price": "Price: {price}",
|
|
246
|
+
"pay.advance": "Pay {advance} now to book. The rest, {rest}, is paid later.",
|
|
247
|
+
"pay.whole": "Pay {advance} now to book.",
|
|
248
|
+
"pay.later": "Nothing to pay now; you pay {price} later.",
|
|
249
|
+
"pay.with": "Pay with {provider}",
|
|
250
|
+
"pay.none": "This business doesn't take payments online yet. Contact them to book.",
|
|
251
|
+
"pay.redirecting": "Taking you to the payment page…",
|
|
252
|
+
"pay.checking": "Checking your payment…",
|
|
253
|
+
"pay.away": "Finish paying in the new tab. You'll see your booking here as soon as the payment arrives.",
|
|
254
|
+
"pay.awayBlocked": "Open the payment page to pay. You'll see the result here as soon as the payment arrives.",
|
|
255
|
+
"pay.open": "Open the payment page",
|
|
256
|
+
"pay.tabDone": "You can close this tab. The page you came from shows whether your payment went through.",
|
|
257
|
+
"pay.notFinished": "You haven't finished paying. We're holding this time for you until {time}.",
|
|
258
|
+
"pay.again": "Go back to payment",
|
|
259
|
+
"pay.released": "Your payment didn't go through, so the time was released. Hold it again if it's still free.",
|
|
260
|
+
"pay.paidUnbooked": "We received your payment, but the time was taken before it arrived, so you're not booked. The business will contact you about your payment.",
|
|
261
|
+
"pay.slow": "Your payment is still being confirmed. Check your bookings in a few minutes.",
|
|
262
|
+
"pay.unavailable": "The payment page couldn't be opened. Try again in a moment.",
|
|
263
|
+
"pay.notOffered": "This way of paying isn't available. Choose another.",
|
|
264
|
+
"passes.heading": "Memberships and passes",
|
|
265
|
+
"passes.empty": "You have no memberships or passes.",
|
|
266
|
+
"passes.unlimited": "Unlimited",
|
|
267
|
+
"passes.credits": "Credits left: {remaining} of {total}",
|
|
268
|
+
"passes.validFrom": "Valid from {date}",
|
|
269
|
+
"passes.validRange": "Valid {from} – {until}",
|
|
270
|
+
"passes.expired": "Expired",
|
|
271
|
+
"shop.heading": "Buy a membership or pass",
|
|
272
|
+
"shop.buy": "Buy with {provider}",
|
|
273
|
+
"shop.paid": "Thank you, your payment is received. The receipt comes from the payment provider, and your purchase shows here once it's ready.",
|
|
274
|
+
"shop.notPaid": "Your payment didn't go through, so nothing was bought.",
|
|
275
|
+
"shop.notFinished": "You haven't finished paying, so nothing was bought yet.",
|
|
276
|
+
"shop.away": "Finish paying in the new tab. You'll see here as soon as the payment arrives.",
|
|
277
|
+
"shop.slow": "Your payment is still being confirmed. Check back here in a few minutes.",
|
|
278
|
+
"shop.outside": "You can buy from {business} online once you're its customer. Book with them first, or ask them.",
|
|
279
|
+
"shop.gone": "This is no longer sold. Choose something else.",
|
|
280
|
+
"details.heading": "My details",
|
|
281
|
+
"details.name": "Name",
|
|
282
|
+
"details.phone": "Phone",
|
|
283
|
+
"details.email": "Email",
|
|
284
|
+
"details.none": "Not set",
|
|
285
|
+
"details.readOnly": "Ask the business to change your phone or email.",
|
|
286
|
+
"details.save": "Save",
|
|
287
|
+
"details.saving": "Saving…",
|
|
288
|
+
"details.saved": "Your name is saved.",
|
|
289
|
+
"details.saveFailed": "Your name could not be saved. Try again.",
|
|
290
|
+
"details.signOutEverywhere": "Sign out everywhere",
|
|
291
|
+
"details.signOutEverywhereHint": "Ends your sessions on every phone and computer, including this one.",
|
|
292
|
+
"details.signOutEverywhereFailed": "Could not sign out everywhere. Try again."
|
|
293
|
+
},
|
|
294
|
+
formats: w
|
|
295
|
+
},
|
|
296
|
+
is: {
|
|
297
|
+
plural: "is",
|
|
298
|
+
messages: {
|
|
299
|
+
"app.loading": "Hleður…",
|
|
300
|
+
"app.loadFailed": "Eitthvað fór úrskeiðis við að hlaða síðunni. Reyndu aftur.",
|
|
301
|
+
"app.retry": "Reyna aftur",
|
|
302
|
+
"app.signedOut": "Innskráningin þín rann út. Skráðu þig inn aftur.",
|
|
303
|
+
"app.signedOutEverywhere": "Útskráning tókst á öllum tækjum.",
|
|
304
|
+
"image.logo": "Merki {name}",
|
|
305
|
+
"nav.label": "Bókanir og mínar síður",
|
|
306
|
+
"nav.book": "Bóka",
|
|
307
|
+
"nav.signIn": "Innskráning",
|
|
308
|
+
"nav.bookings": "Bókanir",
|
|
309
|
+
"nav.passes": "Kort",
|
|
310
|
+
"nav.details": "Mínar upplýsingar",
|
|
311
|
+
"nav.signOut": "Skrá út",
|
|
312
|
+
"signIn.heading": "Innskráning",
|
|
313
|
+
"signIn.intro": "Við sendum þér einnota kóða í SMS.",
|
|
314
|
+
"register.intro": "Eitt skref enn: hvað heitir þú?",
|
|
315
|
+
"register.name": "Nafn",
|
|
316
|
+
"signIn.phone": "Símanúmer",
|
|
317
|
+
"signIn.codeSent": "Sláðu inn kóðann sem við sendum á {phone}.",
|
|
318
|
+
"signIn.code": "Staðfestingarkóði",
|
|
319
|
+
"signIn.sendCode": "Senda kóða",
|
|
320
|
+
"signIn.submit": "Skrá inn",
|
|
321
|
+
"register.submit": "Stofna aðgang",
|
|
322
|
+
"signIn.wait": "Augnablik…",
|
|
323
|
+
"signIn.differentNumber": "Nota annað númer",
|
|
324
|
+
"signIn.cancel": "Hætta við",
|
|
325
|
+
"signIn.error.tooMany": "Of margir kóðar hafa verið sendir. Reyndu aftur eftir um {wait}.",
|
|
326
|
+
"signIn.error.tooManyLater": "Of margir kóðar hafa verið sendir. Reyndu aftur síðar.",
|
|
327
|
+
"signIn.error.paused": "Ekki er hægt að senda kóða í bili. Reyndu aftur eftir um {wait}.",
|
|
328
|
+
"signIn.error.pausedLater": "Ekki er hægt að senda kóða í bili. Reyndu aftur síðar.",
|
|
329
|
+
"signIn.error.destination": "Ekki er hægt að senda kóða í þetta númer.",
|
|
330
|
+
"signIn.error.badCode": "Kóðinn er rangur eða útrunninn.",
|
|
331
|
+
"register.error.expired": "Þetta tók of langan tíma. Biddu um nýjan kóða.",
|
|
332
|
+
"register.error.name": "Athugaðu nafnið og reyndu aftur.",
|
|
333
|
+
"signIn.error.invalid": "Athugaðu símanúmerið og reyndu aftur.",
|
|
334
|
+
"signIn.error.refused": "Ekki er hægt að skrá sig inn hér með þessu númeri.",
|
|
335
|
+
"signIn.error.unreachable": "Ekki næst samband við innskráningarþjónustuna. Reyndu aftur eftir smástund.",
|
|
336
|
+
"signIn.error.failed": "Innskráning mistókst. Reyndu aftur eftir smástund.",
|
|
337
|
+
"signIn.error.botCheck": "Við gátum ekki staðfest að þú sért manneskja. Kláraðu prófið og reyndu aftur.",
|
|
338
|
+
"signIn.error.botCheckUnavailable": "Öryggisprófið liggur niðri. Reyndu aftur eftir smástund.",
|
|
339
|
+
"signIn.error.notConfigured": "Innskráning hefur ekki verið sett upp á þessum vef.",
|
|
340
|
+
"wait.seconds.one": "{count} sekúndu",
|
|
341
|
+
"wait.seconds.other": "{count} sekúndur",
|
|
342
|
+
"wait.minutes.one": "{count} mínútu",
|
|
343
|
+
"wait.minutes.other": "{count} mínútur",
|
|
344
|
+
"wait.hours.one": "{count} klukkustund",
|
|
345
|
+
"wait.hours.other": "{count} klukkustundir",
|
|
346
|
+
"bookings.heading": "Bókanir",
|
|
347
|
+
"bookings.period": "Hvaða bókanir",
|
|
348
|
+
"bookings.upcoming": "Á döfinni",
|
|
349
|
+
"bookings.past": "Liðnar",
|
|
350
|
+
"bookings.emptyUpcoming": "Þú átt engar bókanir fram undan.",
|
|
351
|
+
"bookings.emptyPast": "Þú átt engar liðnar bókanir.",
|
|
352
|
+
"bookings.more": "Sýna fleiri",
|
|
353
|
+
"bookings.when": "{start} – {end}",
|
|
354
|
+
"bookings.cancelled": "Afbókað",
|
|
355
|
+
"bookings.cancelledLate": "Afbókað of seint",
|
|
356
|
+
"bookings.attended": "Mætt",
|
|
357
|
+
"bookings.noShow": "Mætti ekki",
|
|
358
|
+
"bookings.lateFrom": "Afbókun telst of sein frá {time}",
|
|
359
|
+
"bookings.started": "Ekki er lengur hægt að afbóka því að viðburðurinn er hafinn.",
|
|
360
|
+
"bookings.cancel": "Afbóka",
|
|
361
|
+
"bookings.confirmHeading": "Afbóka þessa bókun?",
|
|
362
|
+
"bookings.confirmLate": "Þetta er sein afbókun: fresturinn til að afbóka er liðinn.",
|
|
363
|
+
"bookings.confirmCredit": "Skiptið sem þú notaðir af kortinu fyrir þessa bókun fæst ekki til baka.",
|
|
364
|
+
"bookings.confirm": "Já, afbóka",
|
|
365
|
+
"bookings.keep": "Halda bókuninni",
|
|
366
|
+
"bookings.cancelling": "Afbókar…",
|
|
367
|
+
"bookings.doneOnTime": "Bókunin þín hefur verið afbókuð.",
|
|
368
|
+
"bookings.doneLate": "Bókunin þín hefur verið afbókuð. Hún telst sein afbókun.",
|
|
369
|
+
"bookings.cancelFailed": "Ekki tókst að afbóka. Reyndu aftur.",
|
|
370
|
+
"bookings.gone": "Þessi bókun er ekki lengur til.",
|
|
371
|
+
"businesses.heading": "Bóka",
|
|
372
|
+
"businesses.intro": "Veldu hvar þú vilt bóka.",
|
|
373
|
+
"businesses.empty": "Enginn staður tekur við bókunum hér enn.",
|
|
374
|
+
"businesses.open": "Sjá lausa tíma",
|
|
375
|
+
"business.all": "Allir staðir",
|
|
376
|
+
"business.notFound": "Þessi staður tekur ekki við bókunum hér.",
|
|
377
|
+
"business.types": "Þjónusta",
|
|
378
|
+
"business.allTypes": "Allt",
|
|
379
|
+
"business.resources": "Hjá",
|
|
380
|
+
"business.anyResource": "Hverjum sem er",
|
|
381
|
+
"business.typeMissing": "Ekki er hægt að bóka þessa þjónustu hér.",
|
|
382
|
+
"business.minutes": "{minutes} mín.",
|
|
383
|
+
"business.week": "Hvaða vika",
|
|
384
|
+
"business.previousWeek": "Fyrri vika",
|
|
385
|
+
"business.nextWeek": "Næsta vika",
|
|
386
|
+
"business.weekOf": "{from} – {to}",
|
|
387
|
+
"business.empty": "Ekkert er opið þessa daga.",
|
|
388
|
+
"business.seatsLeft.one": "{count} sæti laust",
|
|
389
|
+
"business.seatsLeft.other": "{count} sæti laus",
|
|
390
|
+
"business.full": "Fullbókað",
|
|
391
|
+
"business.openTime": "Laus tími",
|
|
392
|
+
"business.with": "Hjá {resource}",
|
|
393
|
+
"business.book": "Bóka",
|
|
394
|
+
"book.heading": "Bókunin þín",
|
|
395
|
+
"book.signInFirst": "Skráðu þig inn með símanúmeri til að bóka þennan tíma.",
|
|
396
|
+
"book.back": "Velja annan tíma",
|
|
397
|
+
"book.reserving": "Tökum tímann frá fyrir þig…",
|
|
398
|
+
"book.heldUntil": "Við höldum þessum tíma fyrir þig til kl. {time}.",
|
|
399
|
+
"book.confirm": "Staðfesta bókun",
|
|
400
|
+
"book.confirming": "Staðfestir…",
|
|
401
|
+
"book.booked": "Bókunin er staðfest.",
|
|
402
|
+
"book.toBookings": "Sjá allar bókanir mínar",
|
|
403
|
+
"book.done": "Lokið",
|
|
404
|
+
"book.close": "Loka",
|
|
405
|
+
"book.chooseType": "Hvað viltu bóka?",
|
|
406
|
+
"book.noTypes": "Ekkert er hægt að bóka hér enn.",
|
|
407
|
+
"book.seeAll": "Sjá alla tíma",
|
|
408
|
+
"book.chooseResource": "Hjá hverjum viltu bóka?",
|
|
409
|
+
"book.anyResource": "Hverjum sem er",
|
|
410
|
+
"book.anyResourceHint": "Fyrstu lausu tímarnir hjá öllum sem bjóða þetta",
|
|
411
|
+
"book.toTypes": "Aftur í þjónustu",
|
|
412
|
+
"book.toStep": "Til baka",
|
|
413
|
+
"book.otherResource": "Velja einhvern annan",
|
|
414
|
+
"book.reserveAgain": "Taka tímann frá aftur",
|
|
415
|
+
"book.full": "Þessi tími er orðinn fullur. Veldu annan tíma.",
|
|
416
|
+
"book.slotTaken": "Einhver var að taka þennan tíma. Veldu annan.",
|
|
417
|
+
"book.limit": "Þú ert þegar með eins margar óstaðfestar bókanir og leyfilegt er. Staðfestu eina, eða bíddu í nokkrar mínútur þar til óstaðfest bókun fellur niður, og reyndu svo aftur.",
|
|
418
|
+
"book.expired": "Við héldum tímanum eins lengi og við gátum og nú er hann fallinn niður. Taktu hann frá aftur ef hann er enn laus.",
|
|
419
|
+
"book.notAllowed": "Til að bóka þetta þarftu áskrift eða kort sem gildir fyrir það. Hafðu samband við staðinn.",
|
|
420
|
+
"book.unavailable": "Ekki er lengur hægt að bóka þennan tíma. Veldu annan.",
|
|
421
|
+
"book.banned": "Þú getur ekki bókað á netinu fyrr en {date} vegna bókana sem þú mættir ekki í. Hafðu samband við staðinn ef þú telur þetta vera mistök.",
|
|
422
|
+
"book.banned.undated": "Þú getur ekki bókað á netinu í bili vegna bókana sem þú mættir ekki í. Hafðu samband við staðinn ef þú telur þetta vera mistök.",
|
|
423
|
+
"book.refused": "Þessi staður getur ekki tekið við bókuninni þinni. Hafðu samband við hann.",
|
|
424
|
+
"book.failed": "Ekki tókst að bóka. Reyndu aftur.",
|
|
425
|
+
"pay.price": "Verð: {price}",
|
|
426
|
+
"pay.advance": "Greiddu {advance} núna til að bóka. Afganginn, {rest}, greiðir þú síðar.",
|
|
427
|
+
"pay.whole": "Greiddu {advance} núna til að bóka.",
|
|
428
|
+
"pay.later": "Ekkert að greiða núna; þú greiðir {price} síðar.",
|
|
429
|
+
"pay.with": "Greiða með {provider}",
|
|
430
|
+
"pay.none": "Þessi staður tekur ekki enn við greiðslum á netinu. Hafðu samband við hann til að bóka.",
|
|
431
|
+
"pay.redirecting": "Opnar greiðslusíðuna…",
|
|
432
|
+
"pay.checking": "Athugar greiðsluna…",
|
|
433
|
+
"pay.away": "Kláraðu greiðsluna í nýja flipanum. Bókunin birtist hér um leið og greiðslan berst.",
|
|
434
|
+
"pay.awayBlocked": "Opnaðu greiðslusíðuna til að greiða. Niðurstaðan birtist hér um leið og greiðslan berst.",
|
|
435
|
+
"pay.open": "Opna greiðslusíðuna",
|
|
436
|
+
"pay.tabDone": "Þú mátt loka þessum flipa. Síðan sem þú komst frá sýnir hvort greiðslan gekk í gegn.",
|
|
437
|
+
"pay.notFinished": "Þú hefur ekki klárað að greiða. Við höldum þessum tíma fyrir þig til kl. {time}.",
|
|
438
|
+
"pay.again": "Aftur í greiðslu",
|
|
439
|
+
"pay.released": "Greiðslan gekk ekki í gegn og því var tímanum sleppt. Taktu hann frá aftur ef hann er enn laus.",
|
|
440
|
+
"pay.paidUnbooked": "Við fengum greiðsluna en tíminn var tekinn áður en hún barst, svo ekkert var bókað. Staðurinn hefur samband við þig vegna greiðslunnar.",
|
|
441
|
+
"pay.slow": "Enn er verið að staðfesta greiðsluna. Kíktu á bókanirnar þínar eftir nokkrar mínútur.",
|
|
442
|
+
"pay.unavailable": "Ekki tókst að opna greiðslusíðuna. Reyndu aftur eftir smástund.",
|
|
443
|
+
"pay.notOffered": "Þessi greiðsluleið er ekki í boði. Veldu aðra.",
|
|
444
|
+
"passes.heading": "Áskriftir og kort",
|
|
445
|
+
"passes.empty": "Þú átt engar áskriftir eða kort.",
|
|
446
|
+
"passes.unlimited": "Ótakmarkað",
|
|
447
|
+
"passes.credits": "Skipti eftir: {remaining} af {total}",
|
|
448
|
+
"passes.validFrom": "Gildir frá {date}",
|
|
449
|
+
"passes.validRange": "Gildir {from} – {until}",
|
|
450
|
+
"passes.expired": "Ekki lengur í gildi",
|
|
451
|
+
"shop.heading": "Kaupa áskrift eða kort",
|
|
452
|
+
"shop.buy": "Kaupa með {provider}",
|
|
453
|
+
"shop.paid": "Takk fyrir, greiðslan er móttekin. Kvittunin kemur frá greiðsluþjónustunni og kaupin birtast hér þegar þau eru tilbúin.",
|
|
454
|
+
"shop.notPaid": "Greiðslan gekk ekki í gegn, svo ekkert var keypt.",
|
|
455
|
+
"shop.notFinished": "Þú hefur ekki klárað að greiða, svo ekkert hefur verið keypt.",
|
|
456
|
+
"shop.away": "Kláraðu greiðsluna í nýja flipanum. Kaupin birtast hér um leið og greiðslan berst.",
|
|
457
|
+
"shop.slow": "Enn er verið að staðfesta greiðsluna. Kíktu aftur hingað eftir nokkrar mínútur.",
|
|
458
|
+
"shop.outside": "Þú getur keypt hjá {business} á netinu eftir að þú hefur átt viðskipti þar. Bókaðu fyrst þar eða hafðu samband.",
|
|
459
|
+
"shop.gone": "Þetta er ekki lengur til sölu. Veldu eitthvað annað.",
|
|
460
|
+
"details.heading": "Mínar upplýsingar",
|
|
461
|
+
"details.name": "Nafn",
|
|
462
|
+
"details.phone": "Sími",
|
|
463
|
+
"details.email": "Netfang",
|
|
464
|
+
"details.none": "Ekki skráð",
|
|
465
|
+
"details.readOnly": "Hafðu samband við staðinn til að breyta símanúmeri eða netfangi.",
|
|
466
|
+
"details.save": "Vista",
|
|
467
|
+
"details.saving": "Vistar…",
|
|
468
|
+
"details.saved": "Nafnið þitt hefur verið vistað.",
|
|
469
|
+
"details.saveFailed": "Ekki tókst að vista nafnið. Reyndu aftur.",
|
|
470
|
+
"details.signOutEverywhere": "Skrá út alls staðar",
|
|
471
|
+
"details.signOutEverywhereHint": "Skráir þig út í öllum símum og tölvum, líka þessari.",
|
|
472
|
+
"details.signOutEverywhereFailed": "Ekki tókst að skrá út alls staðar. Reyndu aftur."
|
|
473
|
+
},
|
|
474
|
+
formats: A
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
function M(e) {
|
|
478
|
+
let { plural: t, messages: n, formats: r } = j[e], i = new Intl.PluralRules(t), a = r.number, o = (e, t = {}) => n[e].replace(/\{(\w+)\}/g, (e, n) => {
|
|
479
|
+
let r = t[n];
|
|
480
|
+
return r === void 0 ? e : typeof r == "number" ? a(r) : r;
|
|
481
|
+
}), s = (e, t, r = {}) => {
|
|
482
|
+
let a = `${e}.${i.select(t)}`, s = a in n ? a : `${e}.other`;
|
|
483
|
+
return o(s, {
|
|
484
|
+
count: t,
|
|
485
|
+
...r
|
|
486
|
+
});
|
|
487
|
+
}, { money: c, dateTime: l, time: u, date: d, day: f } = r;
|
|
488
|
+
return {
|
|
489
|
+
locale: e,
|
|
490
|
+
t: o,
|
|
491
|
+
tp: s,
|
|
492
|
+
formatMoney: c,
|
|
493
|
+
formatNumber: a,
|
|
494
|
+
formatDateTime: l,
|
|
495
|
+
formatTime: u,
|
|
496
|
+
formatDate: d,
|
|
497
|
+
formatDay: f,
|
|
498
|
+
formatRange: (e, t, n) => {
|
|
499
|
+
let r = d(e, n) === d(t, n);
|
|
500
|
+
return o("bookings.when", {
|
|
501
|
+
start: l(e, n),
|
|
502
|
+
end: r ? u(t, n) : l(t, n)
|
|
503
|
+
});
|
|
504
|
+
},
|
|
505
|
+
formatWait: (e) => {
|
|
506
|
+
if (e < 60) return s("wait.seconds", e);
|
|
507
|
+
let t = Math.round(e / 60);
|
|
508
|
+
return t < 60 ? s("wait.minutes", t) : s("wait.hours", Math.round(e / 3600));
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
var N = {
|
|
513
|
+
en: M("en"),
|
|
514
|
+
is: M("is")
|
|
515
|
+
}, P = (e) => e === "is" ? N.is : N.en, F = e(N.en), I = () => n(F), ee = "en-GB", { t: te, formatDate: ne, formatDateTime: re, formatNumber: ie } = N.en, ae = ["x-msm-session", "x-msm-registration"], L = /* @__PURE__ */ new Map();
|
|
516
|
+
function oe(e, t) {
|
|
10
517
|
t.headers.set("X-MSM-BFF", "1");
|
|
11
|
-
for (let [n, r] of
|
|
518
|
+
for (let [n, r] of L.get(e) ?? []) t.headers.set(n, r);
|
|
12
519
|
return t;
|
|
13
520
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
521
|
+
function se(e) {
|
|
522
|
+
return L.get(e)?.has("x-msm-session") ?? !1;
|
|
16
523
|
}
|
|
17
|
-
function
|
|
18
|
-
for (let n of
|
|
524
|
+
function ce(e, t) {
|
|
525
|
+
for (let n of ae) {
|
|
19
526
|
let r = t.headers.get(n);
|
|
20
527
|
if (r === null) continue;
|
|
21
|
-
let i =
|
|
22
|
-
|
|
528
|
+
let i = L.get(e) ?? /* @__PURE__ */ new Map();
|
|
529
|
+
L.set(e, i), r ? i.set(n, r) : i.delete(n);
|
|
23
530
|
}
|
|
24
531
|
}
|
|
25
|
-
async function
|
|
26
|
-
let r = await fetch(
|
|
27
|
-
return
|
|
532
|
+
async function le(e, t, n) {
|
|
533
|
+
let r = await fetch(oe(e, new Request(`${e}${t}`, n)));
|
|
534
|
+
return ce(e, r), r;
|
|
28
535
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
536
|
+
function R(e, t, n) {
|
|
537
|
+
return le(e, t, {
|
|
31
538
|
method: "POST",
|
|
32
539
|
headers: { "content-type": "application/json" },
|
|
33
540
|
body: JSON.stringify(n ?? {})
|
|
34
541
|
});
|
|
35
542
|
}
|
|
36
|
-
function
|
|
543
|
+
function ue(e, t) {
|
|
37
544
|
let n = l({ baseUrl: `${e}/engine` });
|
|
38
545
|
return n.use({
|
|
39
546
|
onRequest({ request: t }) {
|
|
40
|
-
return
|
|
547
|
+
return oe(e, t);
|
|
41
548
|
},
|
|
42
549
|
onResponse({ response: n }) {
|
|
43
|
-
|
|
550
|
+
ce(e, n), n.status === 401 && t();
|
|
44
551
|
}
|
|
45
552
|
}), n;
|
|
46
553
|
}
|
|
47
|
-
// src/
|
|
48
|
-
var
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
if (!e) throw Error("usePortal needs a customer screen component.");
|
|
52
|
-
return e;
|
|
554
|
+
// src/payment-tab.ts
|
|
555
|
+
var de = "msmTab";
|
|
556
|
+
function fe(e) {
|
|
557
|
+
if (se(e)) return { window: window.open("", "_blank") };
|
|
53
558
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"app.signedOutEverywhere": "You were signed out on every device.",
|
|
61
|
-
"image.logo": "{name} logo",
|
|
62
|
-
"nav.label": "Booking and my account",
|
|
63
|
-
"nav.book": "Book",
|
|
64
|
-
"nav.signIn": "Sign in",
|
|
65
|
-
"nav.bookings": "Bookings",
|
|
66
|
-
"nav.passes": "Passes",
|
|
67
|
-
"nav.details": "My details",
|
|
68
|
-
"nav.signOut": "Sign out",
|
|
69
|
-
"signIn.heading": "Sign in",
|
|
70
|
-
"signIn.intro": "We'll text a one-time code to your phone.",
|
|
71
|
-
"register.intro": "One more step: what's your name?",
|
|
72
|
-
"register.name": "Your name",
|
|
73
|
-
"signIn.phone": "Phone number",
|
|
74
|
-
"signIn.codeSent": "Enter the code we sent to {phone}.",
|
|
75
|
-
"signIn.code": "Verification code",
|
|
76
|
-
"signIn.sendCode": "Send code",
|
|
77
|
-
"signIn.submit": "Sign in",
|
|
78
|
-
"register.submit": "Create account",
|
|
79
|
-
"signIn.wait": "Please wait…",
|
|
80
|
-
"signIn.differentNumber": "Use a different number",
|
|
81
|
-
"signIn.cancel": "Cancel",
|
|
82
|
-
"signIn.error.tooMany": "Too many codes requested. Try again in about {wait}.",
|
|
83
|
-
"signIn.error.tooManyLater": "Too many codes requested. Try again later.",
|
|
84
|
-
"signIn.error.paused": "Sign-in codes are paused for now. Try again in about {wait}.",
|
|
85
|
-
"signIn.error.pausedLater": "Sign-in codes are paused for now. Try again later.",
|
|
86
|
-
"signIn.error.destination": "This number can't receive sign-in codes.",
|
|
87
|
-
"signIn.error.badCode": "That code is incorrect or has expired.",
|
|
88
|
-
"register.error.expired": "That took too long. Request a new code.",
|
|
89
|
-
"register.error.name": "Check your name and try again.",
|
|
90
|
-
"signIn.error.invalid": "Check the phone number and try again.",
|
|
91
|
-
"signIn.error.refused": "This number can't sign in here.",
|
|
92
|
-
"signIn.error.unreachable": "The sign-in service is unreachable. Try again shortly.",
|
|
93
|
-
"signIn.error.failed": "Sign-in failed. Try again shortly.",
|
|
94
|
-
"signIn.error.botCheck": "We couldn't confirm you're a person. Complete the check and try again.",
|
|
95
|
-
"signIn.error.botCheckUnavailable": "The security check is unavailable. Try again shortly.",
|
|
96
|
-
"signIn.error.notConfigured": "Sign-in isn't set up on this site yet.",
|
|
97
|
-
"wait.seconds.one": "{count} second",
|
|
98
|
-
"wait.seconds.other": "{count} seconds",
|
|
99
|
-
"wait.minutes.one": "{count} minute",
|
|
100
|
-
"wait.minutes.other": "{count} minutes",
|
|
101
|
-
"wait.hours.one": "{count} hour",
|
|
102
|
-
"wait.hours.other": "{count} hours",
|
|
103
|
-
"bookings.heading": "Bookings",
|
|
104
|
-
"bookings.period": "Which bookings",
|
|
105
|
-
"bookings.upcoming": "Upcoming",
|
|
106
|
-
"bookings.past": "Past",
|
|
107
|
-
"bookings.emptyUpcoming": "You have no upcoming bookings.",
|
|
108
|
-
"bookings.emptyPast": "You have no past bookings.",
|
|
109
|
-
"bookings.more": "Show more",
|
|
110
|
-
"bookings.when": "{start} – {end}",
|
|
111
|
-
"bookings.cancelled": "Cancelled",
|
|
112
|
-
"bookings.cancelledLate": "Cancelled late",
|
|
113
|
-
"bookings.attended": "Attended",
|
|
114
|
-
"bookings.noShow": "Missed",
|
|
115
|
-
"bookings.lateFrom": "Late cancellation from {time}",
|
|
116
|
-
"bookings.started": "This booking can no longer be cancelled because the event has started.",
|
|
117
|
-
"bookings.cancel": "Cancel booking",
|
|
118
|
-
"bookings.confirmHeading": "Cancel this booking?",
|
|
119
|
-
"bookings.confirmLate": "This is a late cancellation: the cancellation window has closed.",
|
|
120
|
-
"bookings.confirmCredit": "The pass credit you used for this booking stays spent.",
|
|
121
|
-
"bookings.confirm": "Yes, cancel",
|
|
122
|
-
"bookings.keep": "Keep booking",
|
|
123
|
-
"bookings.cancelling": "Cancelling…",
|
|
124
|
-
"bookings.doneOnTime": "Your booking is cancelled.",
|
|
125
|
-
"bookings.doneLate": "Your booking is cancelled. It counts as a late cancellation.",
|
|
126
|
-
"bookings.cancelFailed": "The booking could not be cancelled. Try again.",
|
|
127
|
-
"bookings.gone": "This booking no longer exists.",
|
|
128
|
-
"businesses.heading": "Book",
|
|
129
|
-
"businesses.intro": "Choose where you'd like to book.",
|
|
130
|
-
"businesses.empty": "No businesses take bookings here yet.",
|
|
131
|
-
"businesses.open": "See times",
|
|
132
|
-
"business.all": "All businesses",
|
|
133
|
-
"business.notFound": "This business isn't taking bookings here.",
|
|
134
|
-
"business.types": "Services",
|
|
135
|
-
"business.allTypes": "Everything",
|
|
136
|
-
"business.resources": "With",
|
|
137
|
-
"business.anyResource": "Anyone",
|
|
138
|
-
"business.typeMissing": "This service can't be booked here.",
|
|
139
|
-
"business.minutes": "{minutes} min",
|
|
140
|
-
"business.week": "Which week",
|
|
141
|
-
"business.previousWeek": "Previous week",
|
|
142
|
-
"business.nextWeek": "Next week",
|
|
143
|
-
"business.weekOf": "{from} – {to}",
|
|
144
|
-
"business.empty": "Nothing is open in these days.",
|
|
145
|
-
"business.seatsLeft.one": "{count} seat left",
|
|
146
|
-
"business.seatsLeft.other": "{count} seats left",
|
|
147
|
-
"business.full": "Full",
|
|
148
|
-
"business.openTime": "Open time",
|
|
149
|
-
"business.with": "With {resource}",
|
|
150
|
-
"business.book": "Book",
|
|
151
|
-
"book.heading": "Your booking",
|
|
152
|
-
"book.signInFirst": "Sign in with your phone to book this time.",
|
|
153
|
-
"book.back": "Choose another time",
|
|
154
|
-
"book.reserving": "Holding this time for you…",
|
|
155
|
-
"book.heldUntil": "We're holding this time for you until {time}.",
|
|
156
|
-
"book.confirm": "Confirm booking",
|
|
157
|
-
"book.confirming": "Confirming…",
|
|
158
|
-
"book.booked": "You're booked.",
|
|
159
|
-
"book.toBookings": "See all my bookings",
|
|
160
|
-
"book.done": "Done",
|
|
161
|
-
"book.close": "Close",
|
|
162
|
-
"book.chooseType": "What would you like to book?",
|
|
163
|
-
"book.noTypes": "There is nothing to book here yet.",
|
|
164
|
-
"book.seeAll": "See all times",
|
|
165
|
-
"book.chooseResource": "Who would you like to book with?",
|
|
166
|
-
"book.anyResource": "Anyone",
|
|
167
|
-
"book.anyResourceHint": "The first free times with anyone who offers it",
|
|
168
|
-
"book.toTypes": "Back to services",
|
|
169
|
-
"book.toStep": "Back",
|
|
170
|
-
"book.otherResource": "Choose someone else",
|
|
171
|
-
"book.reserveAgain": "Hold this time again",
|
|
172
|
-
"book.full": "This class is full now. Choose another time.",
|
|
173
|
-
"book.slotTaken": "Someone has just taken this time. Choose another.",
|
|
174
|
-
"book.limit": "You already hold the most unconfirmed bookings allowed. Confirm one, or wait a few minutes for an unconfirmed one to lapse, then try again.",
|
|
175
|
-
"book.expired": "We held this time for as long as we could, and it has lapsed. Hold it again if it's still free.",
|
|
176
|
-
"book.notAllowed": "Booking this needs a membership or pass that covers it. Ask the business.",
|
|
177
|
-
"book.unavailable": "This time can no longer be booked. Choose another.",
|
|
178
|
-
"book.banned": "You can't book online until {date} because of bookings you didn't show up to. Contact the business if you think this is a mistake.",
|
|
179
|
-
"book.banned.undated": "You can't book online right now because of bookings you didn't show up to. Contact the business if you think this is a mistake.",
|
|
180
|
-
"book.refused": "This business can't take your booking. Contact them.",
|
|
181
|
-
"book.failed": "The booking could not be made. Try again.",
|
|
182
|
-
"pay.price": "Price: {price}",
|
|
183
|
-
"pay.advance": "Pay {advance} now to book. The rest, {rest}, is paid later.",
|
|
184
|
-
"pay.whole": "Pay {advance} now to book.",
|
|
185
|
-
"pay.later": "Nothing to pay now; you pay {price} later.",
|
|
186
|
-
"pay.with": "Pay with {provider}",
|
|
187
|
-
"pay.none": "This business doesn't take payments online yet. Contact them to book.",
|
|
188
|
-
"pay.redirecting": "Taking you to the payment page…",
|
|
189
|
-
"pay.checking": "Checking your payment…",
|
|
190
|
-
"pay.away": "Finish paying in the new tab. You'll see your booking here as soon as the payment arrives.",
|
|
191
|
-
"pay.awayBlocked": "Open the payment page to pay. You'll see the result here as soon as the payment arrives.",
|
|
192
|
-
"pay.open": "Open the payment page",
|
|
193
|
-
"pay.tabDone": "You can close this tab. The page you came from shows whether your payment went through.",
|
|
194
|
-
"pay.notFinished": "You haven't finished paying. We're holding this time for you until {time}.",
|
|
195
|
-
"pay.again": "Go back to payment",
|
|
196
|
-
"pay.released": "Your payment didn't go through, so the time was released. Hold it again if it's still free.",
|
|
197
|
-
"pay.paidUnbooked": "We received your payment, but the time was taken before it arrived, so you're not booked. The business will contact you about your payment.",
|
|
198
|
-
"pay.slow": "Your payment is still being confirmed. Check your bookings in a few minutes.",
|
|
199
|
-
"pay.unavailable": "The payment page couldn't be opened. Try again in a moment.",
|
|
200
|
-
"pay.notOffered": "This way of paying isn't available. Choose another.",
|
|
201
|
-
"passes.heading": "Memberships and passes",
|
|
202
|
-
"passes.empty": "You have no memberships or passes.",
|
|
203
|
-
"passes.unlimited": "Unlimited",
|
|
204
|
-
"passes.credits": "Credits left: {remaining} of {total}",
|
|
205
|
-
"passes.validFrom": "Valid from {date}",
|
|
206
|
-
"passes.validRange": "Valid {from} – {until}",
|
|
207
|
-
"passes.expired": "Expired",
|
|
208
|
-
"shop.heading": "Buy a membership or pass",
|
|
209
|
-
"shop.buy": "Buy with {provider}",
|
|
210
|
-
"shop.paid": "Thank you, your payment is received. The receipt comes from the payment provider, and your purchase shows here once it's ready.",
|
|
211
|
-
"shop.notPaid": "Your payment didn't go through, so nothing was bought.",
|
|
212
|
-
"shop.notFinished": "You haven't finished paying, so nothing was bought yet.",
|
|
213
|
-
"shop.away": "Finish paying in the new tab. You'll see here as soon as the payment arrives.",
|
|
214
|
-
"shop.slow": "Your payment is still being confirmed. Check back here in a few minutes.",
|
|
215
|
-
"shop.outside": "You can buy from {business} online once you're its customer. Book with them first, or ask them.",
|
|
216
|
-
"shop.gone": "This is no longer sold. Choose something else.",
|
|
217
|
-
"details.heading": "My details",
|
|
218
|
-
"details.name": "Name",
|
|
219
|
-
"details.phone": "Phone",
|
|
220
|
-
"details.email": "Email",
|
|
221
|
-
"details.none": "Not set",
|
|
222
|
-
"details.readOnly": "Ask the business to change your phone or email.",
|
|
223
|
-
"details.save": "Save",
|
|
224
|
-
"details.saving": "Saving…",
|
|
225
|
-
"details.saved": "Your name is saved.",
|
|
226
|
-
"details.saveFailed": "Your name could not be saved. Try again.",
|
|
227
|
-
"details.signOutEverywhere": "Sign out everywhere",
|
|
228
|
-
"details.signOutEverywhereHint": "Ends your sessions on every phone and computer, including this one.",
|
|
229
|
-
"details.signOutEverywhereFailed": "Could not sign out everywhere. Try again."
|
|
230
|
-
}, j = "en-GB", M = A;
|
|
231
|
-
function N(e, t = {}) {
|
|
232
|
-
return M[e].replace(/\{(\w+)\}/g, (e, n) => {
|
|
233
|
-
let r = t[n];
|
|
234
|
-
return r === void 0 ? e : typeof r == "number" ? ee(r) : r;
|
|
235
|
-
});
|
|
559
|
+
function pe(e, t) {
|
|
560
|
+
if (!e) return window.location.assign(t);
|
|
561
|
+
e.window && (e.window.opener = null, e.window.location.replace(t));
|
|
562
|
+
}
|
|
563
|
+
function z(e) {
|
|
564
|
+
e?.window?.close();
|
|
236
565
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
566
|
+
function B(e, t, n) {
|
|
567
|
+
let r = new URL(window.location.href);
|
|
568
|
+
return r.searchParams.set(e, t), n && r.searchParams.set(de, ""), r.toString();
|
|
569
|
+
}
|
|
570
|
+
function me() {
|
|
571
|
+
return new URL(window.location.href).searchParams.has(de);
|
|
572
|
+
}
|
|
573
|
+
function he(e) {
|
|
574
|
+
return new Promise((t) => {
|
|
575
|
+
let n = () => {
|
|
576
|
+
clearTimeout(r), document.removeEventListener("visibilitychange", n), t();
|
|
577
|
+
}, r = setTimeout(n, e);
|
|
578
|
+
document.addEventListener("visibilitychange", n);
|
|
243
579
|
});
|
|
244
580
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
581
|
+
// src/session.ts
|
|
582
|
+
var ge = /* @__PURE__ */ new Map();
|
|
583
|
+
function _e(e) {
|
|
584
|
+
let t = ge.get(e);
|
|
585
|
+
return t || (t = {
|
|
586
|
+
value: void 0,
|
|
587
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
588
|
+
generation: 0
|
|
589
|
+
}, ge.set(e, t)), t;
|
|
251
590
|
}
|
|
252
|
-
function
|
|
253
|
-
|
|
591
|
+
function V(e, t) {
|
|
592
|
+
let n = _e(e);
|
|
593
|
+
if (n.value !== t) {
|
|
594
|
+
n.value = t;
|
|
595
|
+
for (let e of n.listeners) e();
|
|
596
|
+
}
|
|
254
597
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}).format(new Date(e));
|
|
598
|
+
function ve(e, t) {
|
|
599
|
+
let { generation: n } = t, r = (r) => {
|
|
600
|
+
t.generation === n && t.value === void 0 && V(e, r);
|
|
601
|
+
};
|
|
602
|
+
le(e, "/auth/session").then(async (e) => r(e.ok ? (await e.json()).sessionKey : null)).catch(() => r(null));
|
|
261
603
|
}
|
|
262
|
-
function
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
604
|
+
function ye(e, t) {
|
|
605
|
+
let n = _e(e);
|
|
606
|
+
return n.listeners.size === 0 && n.value === void 0 && ve(e, n), n.listeners.add(t), () => {
|
|
607
|
+
n.listeners.delete(t), n.listeners.size === 0 && queueMicrotask(() => {
|
|
608
|
+
n.listeners.size > 0 || (n.value = void 0, n.generation++);
|
|
609
|
+
});
|
|
610
|
+
};
|
|
267
611
|
}
|
|
268
|
-
function
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
612
|
+
function be(e, t) {
|
|
613
|
+
let n = c((t) => ye(e, t), () => _e(e).value, () => void 0), i = o(void 0), a = o(t);
|
|
614
|
+
return a.current = t, r(() => {
|
|
615
|
+
if (n === void 0) return;
|
|
616
|
+
let e = n !== null;
|
|
617
|
+
i.current !== void 0 && i.current !== e && a.current?.(e), i.current = e;
|
|
618
|
+
}, [n]), n;
|
|
273
619
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
})
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
620
|
+
// src/portal.tsx
|
|
621
|
+
function H(e) {
|
|
622
|
+
let { navigate: n, accountNavigation: i } = e, c = e.basePath.replace(/\/$/, ""), l = be(c, e.onSessionChange), u = o(!1);
|
|
623
|
+
u.current = !!l;
|
|
624
|
+
let [d, f] = s(), [p, m] = s(/* @__PURE__ */ new Map()), [h, g] = s("loading"), _ = a(() => ue(c, () => {
|
|
625
|
+
u.current && f("app.signedOut"), V(c, null);
|
|
626
|
+
}), [c]), v = t(async () => {
|
|
627
|
+
g("loading");
|
|
628
|
+
try {
|
|
629
|
+
let e = /* @__PURE__ */ new Map(), t;
|
|
630
|
+
do {
|
|
631
|
+
let { data: n } = await _.GET("/web/businesses", { params: { query: {
|
|
632
|
+
limit: 100,
|
|
633
|
+
...t && { cursor: t }
|
|
634
|
+
} } });
|
|
635
|
+
for (let t of n?.items ?? []) e.set(t.id, t);
|
|
636
|
+
t = n?.nextCursor ?? void 0;
|
|
637
|
+
} while (t);
|
|
638
|
+
m(e), g("ready");
|
|
639
|
+
} catch {
|
|
640
|
+
g("failed");
|
|
641
|
+
}
|
|
642
|
+
}, [_]);
|
|
643
|
+
return r(() => {
|
|
644
|
+
v();
|
|
645
|
+
}, [v]), {
|
|
646
|
+
basePath: c,
|
|
647
|
+
sessionKey: l,
|
|
648
|
+
notice: d,
|
|
649
|
+
portal: a(() => ({
|
|
650
|
+
client: _,
|
|
651
|
+
basePath: c,
|
|
652
|
+
businesses: p,
|
|
653
|
+
businessesStatus: h,
|
|
654
|
+
reloadBusinesses: () => void v(),
|
|
655
|
+
navigate: n,
|
|
656
|
+
accountNavigation: i,
|
|
657
|
+
signOut: async (e) => {
|
|
658
|
+
await R(c, "/auth/logout").catch(() => {}), f(e), V(c, null);
|
|
659
|
+
}
|
|
660
|
+
}), [
|
|
661
|
+
_,
|
|
662
|
+
p,
|
|
663
|
+
h,
|
|
664
|
+
v,
|
|
665
|
+
n,
|
|
666
|
+
i,
|
|
667
|
+
c
|
|
668
|
+
]),
|
|
669
|
+
signedInAs: t((e) => {
|
|
670
|
+
f(void 0), V(c, e);
|
|
671
|
+
}, [c])
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
function U(e) {
|
|
675
|
+
let t = P(e.locale), { t: n } = t, [i, a] = s(!1);
|
|
676
|
+
return r(() => {
|
|
677
|
+
me() && (a(!0), window.close());
|
|
678
|
+
}, []), /* @__PURE__ */ f(F.Provider, {
|
|
679
|
+
value: t,
|
|
680
|
+
children: /* @__PURE__ */ f("div", {
|
|
681
|
+
className: "msm-customer",
|
|
682
|
+
lang: t.locale,
|
|
683
|
+
children: i ? /* @__PURE__ */ f("p", {
|
|
684
|
+
className: "cp-status",
|
|
685
|
+
role: "status",
|
|
686
|
+
children: n("pay.tabDone")
|
|
687
|
+
}) : e.loading ? /* @__PURE__ */ f("p", {
|
|
688
|
+
className: "cp-status",
|
|
689
|
+
role: "status",
|
|
690
|
+
children: n("app.loading")
|
|
691
|
+
}) : /* @__PURE__ */ f(b.Provider, {
|
|
692
|
+
value: e.portal,
|
|
693
|
+
children: e.children
|
|
694
|
+
})
|
|
695
|
+
})
|
|
287
696
|
});
|
|
288
697
|
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
698
|
+
// src/refusals.ts
|
|
699
|
+
function xe(e, t) {
|
|
700
|
+
if (e?.code !== "BookingBanned") return { message: t(e?.code) };
|
|
701
|
+
let { bannedUntil: n } = e.body ?? {};
|
|
702
|
+
return n ? {
|
|
703
|
+
message: "book.banned",
|
|
704
|
+
until: n
|
|
705
|
+
} : { message: "book.banned.undated" };
|
|
293
706
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
707
|
+
function Se(e) {
|
|
708
|
+
switch (e) {
|
|
709
|
+
case "NotAuthorized": return "book.notAllowed";
|
|
710
|
+
case "EventStarted":
|
|
711
|
+
case "EventNotBookable":
|
|
712
|
+
case "BusinessNotFound": return "book.unavailable";
|
|
713
|
+
case "CustomerOutsideBusiness": return "book.refused";
|
|
714
|
+
default: return "book.failed";
|
|
715
|
+
}
|
|
298
716
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
717
|
+
// src/pay.tsx
|
|
718
|
+
var W = "/web/businesses/{businessId}/reservations/{reservationId}/checkout", G = "msmCheckout", K = null;
|
|
719
|
+
function Ce() {
|
|
720
|
+
let e = new URL(window.location.href), t = e.searchParams.get(G);
|
|
721
|
+
(t === "paid" || t === "back") && (e.searchParams.delete(G), window.history.replaceState(window.history.state, "", e.toString()), K = t);
|
|
302
722
|
}
|
|
303
|
-
function
|
|
304
|
-
|
|
723
|
+
function we() {
|
|
724
|
+
return Ce(), K !== null;
|
|
305
725
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
726
|
+
var Te = (e, t) => `msm-pay:${e}|${t}`;
|
|
727
|
+
function Ee(e, t) {
|
|
728
|
+
try {
|
|
729
|
+
t ? window.sessionStorage.setItem(e, "1") : window.sessionStorage.removeItem(e);
|
|
730
|
+
} catch {}
|
|
309
731
|
}
|
|
310
|
-
function
|
|
311
|
-
|
|
732
|
+
function De(e) {
|
|
733
|
+
try {
|
|
734
|
+
return window.sessionStorage.getItem(e) !== null;
|
|
735
|
+
} catch {
|
|
736
|
+
return !1;
|
|
737
|
+
}
|
|
312
738
|
}
|
|
313
|
-
function
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
739
|
+
function Oe(e) {
|
|
740
|
+
let { businessId: t, reservationId: i } = e, c = e.basePath.replace(/\/$/, ""), l = n(b)?.client, d = a(() => l ?? ue(c, () => V(c, null)), [l, c]), [f, p] = s({ phase: "loading" }), m = o(e);
|
|
741
|
+
m.current = e;
|
|
742
|
+
let h = Te(t, i), g = o(null), _ = () => g.current === h, v = {
|
|
743
|
+
businessId: t,
|
|
744
|
+
reservationId: i
|
|
745
|
+
};
|
|
746
|
+
function y(e, t) {
|
|
747
|
+
Ee(h, !1), p({
|
|
748
|
+
phase: "done",
|
|
749
|
+
result: e,
|
|
750
|
+
message: t
|
|
751
|
+
}), m.current.onResult(e);
|
|
752
|
+
}
|
|
753
|
+
async function x(e, t) {
|
|
754
|
+
p(t ? {
|
|
755
|
+
phase: "away",
|
|
756
|
+
...t
|
|
757
|
+
} : { phase: "checking" });
|
|
758
|
+
let n = t && Date.parse(t.holdUntil) + 3e5;
|
|
759
|
+
for (let r = 0; _(); r++) {
|
|
760
|
+
let i = await d.GET(W, { params: { path: v } }).then(({ data: e }) => e, (e) => u(e, "get", W) && (e.code === "CheckoutNotFound" || e.code === "ReservationNotFound") ? null : void 0);
|
|
761
|
+
if (!_()) return;
|
|
762
|
+
if (i === null && !(n !== void 0 && Date.now() <= n)) return y({ status: "released" }, "book.expired");
|
|
763
|
+
if (i?.status === "confirmed" && i.bookingId) return y({
|
|
764
|
+
status: "confirmed",
|
|
765
|
+
bookingId: i.bookingId
|
|
766
|
+
}, "book.booked");
|
|
767
|
+
let a = e && i?.status === "released" && (i.payment?.status === "PENDING" || i.payment?.status === "SUCCEEDED");
|
|
768
|
+
if (i && !a && i.status === "released") return y({ status: "released" }, "pay.released");
|
|
769
|
+
if (i && i.status === "unconfirmed_paid") return y({ status: "unconfirmed_paid" }, "pay.paidUnbooked");
|
|
770
|
+
if (i && !a && (!e || i.payment?.status === "FAILED")) return p({
|
|
771
|
+
phase: "unfinished",
|
|
772
|
+
holdUntil: i.holdUntil,
|
|
773
|
+
redirectUrl: i.payment?.redirectUrl ?? null,
|
|
774
|
+
newTab: se(c)
|
|
775
|
+
});
|
|
776
|
+
if (n ? Date.now() > n : r >= 15) return p({
|
|
777
|
+
phase: "refused",
|
|
778
|
+
message: "pay.slow"
|
|
779
|
+
});
|
|
780
|
+
await he(t ? 3e3 : 2e3);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
let S = o(null);
|
|
784
|
+
r(() => {
|
|
785
|
+
if (g.current = h, S.current !== h) {
|
|
786
|
+
if (S.current = h, me()) p({ phase: "tab" });
|
|
787
|
+
else if (De(h)) {
|
|
788
|
+
Ce();
|
|
789
|
+
let e = K === "paid";
|
|
790
|
+
K = null, x(e);
|
|
791
|
+
} else Ce(), p({ phase: "loading" }), d.GET("/web/businesses/{businessId}/payment-methods", { params: { path: { businessId: t } } }).then(({ data: e }) => e?.items ?? [], () => []).then((e) => {
|
|
792
|
+
_() && p({
|
|
793
|
+
phase: "choose",
|
|
794
|
+
methods: e,
|
|
795
|
+
paying: !1
|
|
796
|
+
});
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
return () => {
|
|
800
|
+
g.current = null;
|
|
801
|
+
};
|
|
802
|
+
}, [h]);
|
|
803
|
+
async function C(e) {
|
|
804
|
+
let t = (e) => p((t) => t.phase === "choose" ? {
|
|
805
|
+
...t,
|
|
806
|
+
paying: e === void 0,
|
|
807
|
+
notice: e
|
|
808
|
+
} : t), n = e ? fe(c) : void 0;
|
|
809
|
+
t();
|
|
810
|
+
try {
|
|
811
|
+
let { data: r } = await d.POST(W, {
|
|
812
|
+
params: { path: v },
|
|
813
|
+
body: {
|
|
814
|
+
...e && { paymentMethodId: e.id },
|
|
815
|
+
successUrl: B(G, "paid", n),
|
|
816
|
+
cancelUrl: B(G, "back", n)
|
|
817
|
+
}
|
|
818
|
+
}), i = r?.payment?.redirectUrl;
|
|
819
|
+
if (r?.status === "pending" && i && _() || z(n), !r || !_()) return;
|
|
820
|
+
if (r.status === "confirmed" && r.bookingId) return y({
|
|
821
|
+
status: "confirmed",
|
|
822
|
+
bookingId: r.bookingId
|
|
823
|
+
}, "book.booked");
|
|
824
|
+
if (r.status !== "pending" || !i) return t("pay.unavailable");
|
|
825
|
+
n || (Ee(h, !0), m.current.onLeave?.()), pe(n, i), n && x(!0, {
|
|
826
|
+
holdUntil: r.holdUntil,
|
|
827
|
+
redirectUrl: i,
|
|
828
|
+
opened: !!n.window
|
|
829
|
+
});
|
|
830
|
+
} catch (e) {
|
|
831
|
+
if (z(n), !_()) return;
|
|
832
|
+
let r = u(e, "post", W) ? e : void 0;
|
|
833
|
+
if (r?.code === "ReservationExpired") return y({ status: "released" }, "book.expired");
|
|
834
|
+
if (r?.code === "PaymentProviderNotOffered" || r?.code === "PaymentProviderNotConnected") return t("pay.notOffered");
|
|
835
|
+
if (r?.code === "PaymentProviderUnavailable" || r?.code === "PaymentProviderRejected" || r?.code === "PaymentCredentialsUnavailable") return t("pay.unavailable");
|
|
836
|
+
p({
|
|
837
|
+
phase: "refused",
|
|
838
|
+
...xe(r, Se)
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
function w() {
|
|
843
|
+
f.phase === "unfinished" && f.redirectUrl && (f.newTab ? x(!0, {
|
|
844
|
+
holdUntil: f.holdUntil,
|
|
845
|
+
redirectUrl: f.redirectUrl,
|
|
846
|
+
opened: !0
|
|
847
|
+
}) : (Ee(h, !0), m.current.onLeave?.()));
|
|
848
|
+
}
|
|
849
|
+
return {
|
|
850
|
+
state: f,
|
|
851
|
+
pay: (e) => void C(e),
|
|
852
|
+
payAgain: w
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function ke(e) {
|
|
856
|
+
let { t, formatDate: n, formatTime: r } = I(), { basePath: i, businesses: a } = x(), { state: o, pay: s, payAgain: c } = Oe({
|
|
857
|
+
basePath: i,
|
|
858
|
+
businessId: e.businessId,
|
|
859
|
+
reservationId: e.reservationId,
|
|
860
|
+
onResult: e.onResult,
|
|
861
|
+
onLeave: e.onLeave
|
|
862
|
+
}), l = e.timeZone ?? a.get(e.businessId)?.timezone, u = (t) => (t || e.actions) && /* @__PURE__ */ p("div", {
|
|
863
|
+
className: "cp-actions",
|
|
864
|
+
children: [t, e.actions]
|
|
865
|
+
});
|
|
866
|
+
switch (o.phase) {
|
|
867
|
+
case "tab": return /* @__PURE__ */ f("p", {
|
|
868
|
+
role: "status",
|
|
869
|
+
children: t("pay.tabDone")
|
|
870
|
+
});
|
|
871
|
+
case "loading": return /* @__PURE__ */ f("p", {
|
|
872
|
+
role: "status",
|
|
873
|
+
children: t("app.loading")
|
|
874
|
+
});
|
|
875
|
+
case "checking": return /* @__PURE__ */ f("p", {
|
|
876
|
+
role: "status",
|
|
877
|
+
children: t("pay.checking")
|
|
878
|
+
});
|
|
879
|
+
case "choose": return /* @__PURE__ */ p(d, { children: [
|
|
880
|
+
e.terms,
|
|
881
|
+
o.notice && /* @__PURE__ */ f("p", {
|
|
882
|
+
role: "alert",
|
|
883
|
+
children: t(o.notice)
|
|
884
|
+
}),
|
|
885
|
+
o.paying && /* @__PURE__ */ f("p", {
|
|
886
|
+
role: "status",
|
|
887
|
+
children: t("pay.redirecting")
|
|
888
|
+
}),
|
|
889
|
+
!e.free && o.methods.length === 0 && /* @__PURE__ */ f("p", {
|
|
890
|
+
role: "alert",
|
|
891
|
+
children: t("pay.none")
|
|
892
|
+
}),
|
|
893
|
+
u(e.free ? /* @__PURE__ */ f("button", {
|
|
894
|
+
type: "button",
|
|
895
|
+
disabled: o.paying,
|
|
896
|
+
onClick: () => s(),
|
|
897
|
+
children: t("book.confirm")
|
|
898
|
+
}) : o.methods.map((e) => /* @__PURE__ */ f("button", {
|
|
899
|
+
type: "button",
|
|
900
|
+
disabled: o.paying,
|
|
901
|
+
onClick: () => s(e),
|
|
902
|
+
children: t("pay.with", { provider: e.label })
|
|
903
|
+
}, e.id)))
|
|
904
|
+
] });
|
|
905
|
+
case "away": return /* @__PURE__ */ p(d, { children: [
|
|
906
|
+
/* @__PURE__ */ f("p", {
|
|
907
|
+
role: "status",
|
|
908
|
+
className: "cp-notice",
|
|
909
|
+
children: t(o.opened ? "pay.away" : "pay.awayBlocked")
|
|
910
|
+
}),
|
|
911
|
+
/* @__PURE__ */ f("p", {
|
|
912
|
+
className: "cp-hint",
|
|
913
|
+
children: t("book.heldUntil", { time: r(o.holdUntil, l) })
|
|
914
|
+
}),
|
|
915
|
+
u(/* @__PURE__ */ f("a", {
|
|
916
|
+
className: "cp-button",
|
|
917
|
+
href: o.redirectUrl,
|
|
918
|
+
target: "_blank",
|
|
919
|
+
rel: "noopener",
|
|
920
|
+
children: t("pay.open")
|
|
921
|
+
}))
|
|
922
|
+
] });
|
|
923
|
+
case "unfinished": return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
924
|
+
className: "cp-hint",
|
|
925
|
+
children: t("pay.notFinished", { time: r(o.holdUntil, l) })
|
|
926
|
+
}), u(o.redirectUrl && /* @__PURE__ */ f("a", {
|
|
927
|
+
className: "cp-button",
|
|
928
|
+
href: o.redirectUrl,
|
|
929
|
+
...o.newTab && {
|
|
930
|
+
target: "_blank",
|
|
931
|
+
rel: "noopener"
|
|
932
|
+
},
|
|
933
|
+
onClick: c,
|
|
934
|
+
children: t("pay.again")
|
|
935
|
+
}))] });
|
|
936
|
+
case "refused": return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
937
|
+
role: "alert",
|
|
938
|
+
children: t(o.message, o.until ? { date: n(o.until, l) } : {})
|
|
939
|
+
}), u()] });
|
|
940
|
+
case "done": return o.result.status === "confirmed" ? /* @__PURE__ */ f("p", {
|
|
941
|
+
role: "status",
|
|
942
|
+
className: "cp-notice",
|
|
943
|
+
children: t(o.message)
|
|
944
|
+
}) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
945
|
+
role: "alert",
|
|
946
|
+
children: t(o.message)
|
|
947
|
+
}), u()] });
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
var Ae = () => {};
|
|
951
|
+
function je(e) {
|
|
952
|
+
let { sessionKey: t, portal: n } = H({
|
|
953
|
+
basePath: e.basePath,
|
|
954
|
+
navigate: Ae,
|
|
955
|
+
accountNavigation: !1,
|
|
956
|
+
onSessionChange: void 0
|
|
957
|
+
});
|
|
958
|
+
return /* @__PURE__ */ f(U, {
|
|
959
|
+
portal: n,
|
|
960
|
+
loading: t === void 0,
|
|
961
|
+
locale: e.locale,
|
|
962
|
+
children: /* @__PURE__ */ f("div", {
|
|
963
|
+
className: "cp-screen",
|
|
964
|
+
children: /* @__PURE__ */ f(ke, {
|
|
965
|
+
businessId: e.businessId,
|
|
966
|
+
reservationId: e.reservationId,
|
|
967
|
+
onResult: e.onResult,
|
|
968
|
+
onLeave: e.onLeave
|
|
969
|
+
})
|
|
970
|
+
})
|
|
319
971
|
});
|
|
320
972
|
}
|
|
321
973
|
// src/cancellation.ts
|
|
322
|
-
function
|
|
974
|
+
function Me(e, t) {
|
|
323
975
|
if (e.status === "cancelled") return "cancelled";
|
|
324
976
|
let n = t.getTime();
|
|
325
977
|
return !e.cancellableUntil || n >= Date.parse(e.cancellableUntil) ? "closed" : e.lateCancellationFrom && n >= Date.parse(e.lateCancellationFrom) ? "late" : "open";
|
|
326
978
|
}
|
|
327
979
|
// src/screens/bookings.tsx
|
|
328
|
-
var
|
|
329
|
-
function
|
|
330
|
-
let {
|
|
331
|
-
|
|
980
|
+
var Ne = "/web/businesses/{businessId}/bookings/{bookingId}/cancel";
|
|
981
|
+
function Pe() {
|
|
982
|
+
let { t: e } = I(), { client: n } = x(), [i, a] = s("upcoming"), [o, c] = s(), [l, u] = s(null), [d, m] = s(!1), [h, g] = s(), _ = t(async (e) => {
|
|
983
|
+
m(!1);
|
|
332
984
|
try {
|
|
333
|
-
let { data:
|
|
334
|
-
period:
|
|
335
|
-
...
|
|
985
|
+
let { data: t } = await n.GET("/web/me/bookings", { params: { query: {
|
|
986
|
+
period: i,
|
|
987
|
+
...e && { cursor: e }
|
|
336
988
|
} } });
|
|
337
|
-
if (!
|
|
338
|
-
|
|
989
|
+
if (!t) return;
|
|
990
|
+
c((n) => e ? [...n ?? [], ...t.items] : t.items), u(t.nextCursor);
|
|
339
991
|
} catch {
|
|
340
|
-
|
|
992
|
+
m(!0);
|
|
341
993
|
}
|
|
342
|
-
}, [
|
|
994
|
+
}, [n, i]);
|
|
343
995
|
return r(() => {
|
|
344
|
-
|
|
345
|
-
}, [
|
|
996
|
+
c(void 0), g(void 0), _();
|
|
997
|
+
}, [_]), /* @__PURE__ */ p("section", {
|
|
346
998
|
className: "cp-screen",
|
|
347
999
|
children: [
|
|
348
|
-
/* @__PURE__ */ f("h1", { children:
|
|
1000
|
+
/* @__PURE__ */ f("h1", { children: e("bookings.heading") }),
|
|
349
1001
|
/* @__PURE__ */ f("fieldset", {
|
|
350
1002
|
className: "cp-tabs",
|
|
351
|
-
"aria-label":
|
|
352
|
-
children: ["upcoming", "past"].map((
|
|
1003
|
+
"aria-label": e("bookings.period"),
|
|
1004
|
+
children: ["upcoming", "past"].map((t) => /* @__PURE__ */ f("button", {
|
|
353
1005
|
type: "button",
|
|
354
|
-
"aria-pressed":
|
|
355
|
-
onClick: () =>
|
|
356
|
-
children:
|
|
357
|
-
},
|
|
1006
|
+
"aria-pressed": i === t,
|
|
1007
|
+
onClick: () => a(t),
|
|
1008
|
+
children: e(t === "upcoming" ? "bookings.upcoming" : "bookings.past")
|
|
1009
|
+
}, t))
|
|
358
1010
|
}),
|
|
359
|
-
|
|
1011
|
+
h && /* @__PURE__ */ f("p", {
|
|
360
1012
|
role: "status",
|
|
361
1013
|
className: "cp-notice",
|
|
362
|
-
children:
|
|
1014
|
+
children: e(h)
|
|
363
1015
|
}),
|
|
364
|
-
|
|
1016
|
+
d ? /* @__PURE__ */ f(q, { onRetry: () => _() }) : o ? o.length === 0 ? /* @__PURE__ */ f("p", {
|
|
365
1017
|
className: "cp-empty",
|
|
366
|
-
children:
|
|
1018
|
+
children: e(i === "upcoming" ? "bookings.emptyUpcoming" : "bookings.emptyPast")
|
|
367
1019
|
}) : /* @__PURE__ */ f("ul", {
|
|
368
1020
|
className: "cp-list",
|
|
369
|
-
children:
|
|
1021
|
+
children: o.map((e) => /* @__PURE__ */ f(Fe, {
|
|
370
1022
|
booking: e,
|
|
371
1023
|
onCancelled: (e, t) => {
|
|
372
|
-
|
|
1024
|
+
c((t) => t?.map((t) => t.id === e.id ? e : t)), g(t ? "bookings.doneLate" : "bookings.doneOnTime");
|
|
373
1025
|
}
|
|
374
1026
|
}, e.id))
|
|
375
1027
|
}) : /* @__PURE__ */ f("p", {
|
|
376
1028
|
role: "status",
|
|
377
|
-
children:
|
|
1029
|
+
children: e("app.loading")
|
|
378
1030
|
}),
|
|
379
|
-
|
|
1031
|
+
o && l && !d && /* @__PURE__ */ f("button", {
|
|
380
1032
|
type: "button",
|
|
381
1033
|
className: "cp-secondary",
|
|
382
|
-
onClick: () =>
|
|
383
|
-
children:
|
|
1034
|
+
onClick: () => _(l),
|
|
1035
|
+
children: e("bookings.more")
|
|
384
1036
|
})
|
|
385
1037
|
]
|
|
386
1038
|
});
|
|
387
1039
|
}
|
|
388
|
-
function
|
|
1040
|
+
function q({ onRetry: e }) {
|
|
1041
|
+
let { t } = I();
|
|
389
1042
|
return /* @__PURE__ */ p("div", {
|
|
390
1043
|
role: "alert",
|
|
391
1044
|
className: "cp-error",
|
|
392
|
-
children: [/* @__PURE__ */ f("p", { children:
|
|
1045
|
+
children: [/* @__PURE__ */ f("p", { children: t("app.loadFailed") }), /* @__PURE__ */ f("button", {
|
|
393
1046
|
type: "button",
|
|
394
1047
|
className: "cp-secondary",
|
|
395
1048
|
onClick: e,
|
|
396
|
-
children:
|
|
1049
|
+
children: t("app.retry")
|
|
397
1050
|
})]
|
|
398
1051
|
});
|
|
399
1052
|
}
|
|
400
|
-
function
|
|
401
|
-
let { client:
|
|
402
|
-
async function
|
|
403
|
-
|
|
1053
|
+
function Fe(e) {
|
|
1054
|
+
let { t, formatDateTime: n, formatRange: r } = I(), { client: i, businesses: a } = x(), { booking: o } = e, c = a.get(o.businessId)?.timezone, [l, d] = s(!1), [m, h] = s(!1), [g, _] = s(), [v, y] = s(!1), b = v ? "closed" : Me(o, /* @__PURE__ */ new Date()), S = o.creditMembershipId !== null && o.creditRestoredAt === null;
|
|
1055
|
+
async function C() {
|
|
1056
|
+
h(!0), _(void 0);
|
|
404
1057
|
try {
|
|
405
|
-
let { data:
|
|
406
|
-
businessId:
|
|
407
|
-
bookingId:
|
|
1058
|
+
let { data: t } = await i.POST(Ne, { params: { path: {
|
|
1059
|
+
businessId: o.businessId,
|
|
1060
|
+
bookingId: o.id
|
|
408
1061
|
} } });
|
|
409
|
-
|
|
410
|
-
...
|
|
411
|
-
...
|
|
1062
|
+
t && (d(!1), e.onCancelled({
|
|
1063
|
+
...o,
|
|
1064
|
+
...t,
|
|
412
1065
|
cancellableUntil: null,
|
|
413
1066
|
lateCancellationFrom: null
|
|
414
|
-
},
|
|
1067
|
+
}, t.cancelledLate === !0));
|
|
415
1068
|
} catch (e) {
|
|
416
|
-
if (u(e, "post",
|
|
1069
|
+
if (u(e, "post", Ne)) {
|
|
417
1070
|
if (e.code === "EventStarted") {
|
|
418
|
-
|
|
1071
|
+
y(!0), d(!1);
|
|
419
1072
|
return;
|
|
420
1073
|
}
|
|
421
1074
|
if (e.code === "BookingNotFound") {
|
|
422
|
-
|
|
1075
|
+
_("bookings.gone");
|
|
423
1076
|
return;
|
|
424
1077
|
}
|
|
425
1078
|
}
|
|
426
|
-
|
|
1079
|
+
_("bookings.cancelFailed");
|
|
427
1080
|
} finally {
|
|
428
|
-
|
|
1081
|
+
h(!1);
|
|
429
1082
|
}
|
|
430
1083
|
}
|
|
431
1084
|
return /* @__PURE__ */ p("li", {
|
|
432
1085
|
className: "cp-card",
|
|
433
|
-
"data-state":
|
|
1086
|
+
"data-state": b,
|
|
434
1087
|
children: [
|
|
435
1088
|
/* @__PURE__ */ p("div", {
|
|
436
1089
|
className: "cp-card-head",
|
|
437
|
-
children: [/* @__PURE__ */ f("h2", { children:
|
|
1090
|
+
children: [/* @__PURE__ */ f("h2", { children: o.event.eventTypeName }), o.status === "cancelled" ? /* @__PURE__ */ f("span", {
|
|
438
1091
|
className: "cp-badge",
|
|
439
|
-
children:
|
|
440
|
-
}) :
|
|
1092
|
+
children: t(o.cancelledLate ? "bookings.cancelledLate" : "bookings.cancelled")
|
|
1093
|
+
}) : o.attendance ? /* @__PURE__ */ f("span", {
|
|
441
1094
|
className: "cp-badge",
|
|
442
|
-
children:
|
|
1095
|
+
children: t(o.attendance === "attended" ? "bookings.attended" : "bookings.noShow")
|
|
443
1096
|
}) : null]
|
|
444
1097
|
}),
|
|
445
|
-
/* @__PURE__ */ f("p", { children:
|
|
446
|
-
/* @__PURE__ */ f("p", { children:
|
|
447
|
-
(
|
|
1098
|
+
/* @__PURE__ */ f("p", { children: o.businessName }),
|
|
1099
|
+
/* @__PURE__ */ f("p", { children: r(o.event.startsAt, o.event.endsAt, c) }),
|
|
1100
|
+
(b === "open" || b === "late") && o.lateCancellationFrom && /* @__PURE__ */ f("p", {
|
|
448
1101
|
className: "cp-hint",
|
|
449
|
-
children:
|
|
1102
|
+
children: t("bookings.lateFrom", { time: n(o.lateCancellationFrom, c) })
|
|
450
1103
|
}),
|
|
451
|
-
|
|
1104
|
+
b === "closed" && o.status === "confirmed" && !o.attendance && /* @__PURE__ */ f("p", {
|
|
452
1105
|
className: "cp-hint",
|
|
453
|
-
children:
|
|
1106
|
+
children: t("bookings.started")
|
|
454
1107
|
}),
|
|
455
|
-
|
|
1108
|
+
g && /* @__PURE__ */ f("p", {
|
|
456
1109
|
role: "alert",
|
|
457
|
-
children:
|
|
1110
|
+
children: t(g)
|
|
458
1111
|
}),
|
|
459
|
-
(
|
|
1112
|
+
(b === "open" || b === "late") && (l ? /* @__PURE__ */ p("fieldset", {
|
|
460
1113
|
className: "cp-confirm",
|
|
461
1114
|
children: [
|
|
462
|
-
/* @__PURE__ */ f("legend", { children:
|
|
463
|
-
|
|
1115
|
+
/* @__PURE__ */ f("legend", { children: t("bookings.confirmHeading") }),
|
|
1116
|
+
b === "late" && /* @__PURE__ */ f("p", {
|
|
464
1117
|
className: "cp-warning",
|
|
465
|
-
children:
|
|
1118
|
+
children: t("bookings.confirmLate")
|
|
466
1119
|
}),
|
|
467
|
-
|
|
1120
|
+
b === "late" && S && /* @__PURE__ */ f("p", {
|
|
468
1121
|
className: "cp-warning",
|
|
469
|
-
children:
|
|
1122
|
+
children: t("bookings.confirmCredit")
|
|
470
1123
|
}),
|
|
471
1124
|
/* @__PURE__ */ p("div", {
|
|
472
1125
|
className: "cp-actions",
|
|
473
1126
|
children: [/* @__PURE__ */ f("button", {
|
|
474
1127
|
type: "button",
|
|
475
|
-
disabled:
|
|
476
|
-
onClick:
|
|
477
|
-
children:
|
|
1128
|
+
disabled: m,
|
|
1129
|
+
onClick: C,
|
|
1130
|
+
children: t(m ? "bookings.cancelling" : "bookings.confirm")
|
|
478
1131
|
}), /* @__PURE__ */ f("button", {
|
|
479
1132
|
type: "button",
|
|
480
1133
|
className: "cp-secondary",
|
|
481
|
-
disabled:
|
|
482
|
-
onClick: () =>
|
|
483
|
-
children:
|
|
1134
|
+
disabled: m,
|
|
1135
|
+
onClick: () => d(!1),
|
|
1136
|
+
children: t("bookings.keep")
|
|
484
1137
|
})]
|
|
485
1138
|
})
|
|
486
1139
|
]
|
|
487
1140
|
}) : /* @__PURE__ */ f("button", {
|
|
488
1141
|
type: "button",
|
|
489
1142
|
className: "cp-secondary",
|
|
490
|
-
onClick: () =>
|
|
491
|
-
children:
|
|
1143
|
+
onClick: () => d(!0),
|
|
1144
|
+
children: t("bookings.cancel")
|
|
492
1145
|
}))
|
|
493
1146
|
]
|
|
494
1147
|
});
|
|
495
1148
|
}
|
|
496
1149
|
// src/image.tsx
|
|
497
|
-
function
|
|
1150
|
+
function J(e) {
|
|
498
1151
|
let { image: t, alt: n, className: r } = e;
|
|
499
1152
|
if (!t) return null;
|
|
500
1153
|
let { small: i } = t;
|
|
@@ -527,12 +1180,12 @@ function W(e) {
|
|
|
527
1180
|
});
|
|
528
1181
|
}
|
|
529
1182
|
// src/screens/business.tsx
|
|
530
|
-
var
|
|
1183
|
+
var Ie = "/web/businesses/{businessId}", Le = /* @__PURE__ */ new Set([
|
|
531
1184
|
"BusinessNotFound",
|
|
532
1185
|
"OutsideClientScope",
|
|
533
1186
|
"ValidationFailed"
|
|
534
|
-
]),
|
|
535
|
-
function
|
|
1187
|
+
]), Re = 7;
|
|
1188
|
+
function ze(e, t = /* @__PURE__ */ new Date()) {
|
|
536
1189
|
return new Intl.DateTimeFormat("en-CA", {
|
|
537
1190
|
timeZone: e,
|
|
538
1191
|
year: "numeric",
|
|
@@ -540,18 +1193,18 @@ function he(e, t = /* @__PURE__ */ new Date()) {
|
|
|
540
1193
|
day: "2-digit"
|
|
541
1194
|
}).format(t);
|
|
542
1195
|
}
|
|
543
|
-
function
|
|
1196
|
+
function Y(e, t) {
|
|
544
1197
|
let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
545
1198
|
return n.setUTCDate(n.getUTCDate() + t), n.toISOString().slice(0, 10);
|
|
546
1199
|
}
|
|
547
|
-
function
|
|
548
|
-
let { client: n } =
|
|
1200
|
+
function Be(e) {
|
|
1201
|
+
let { client: n } = x(), [i, a] = s(), [o, c] = s(), [l, d] = s(!1), f = t(async () => {
|
|
549
1202
|
d(!1), a(void 0);
|
|
550
1203
|
try {
|
|
551
|
-
let [t, r] = await Promise.all([n.GET(
|
|
1204
|
+
let [t, r] = await Promise.all([n.GET(Ie, { params: { path: { businessId: e } } }), n.GET("/web/businesses/{businessId}/event-types", { params: { path: { businessId: e } } })]);
|
|
552
1205
|
a(t.data ?? null), c(r.data?.items ?? []);
|
|
553
1206
|
} catch (e) {
|
|
554
|
-
u(e) &&
|
|
1207
|
+
u(e) && Le.has(e.code ?? "") ? a(null) : d(!0);
|
|
555
1208
|
}
|
|
556
1209
|
}, [n, e]);
|
|
557
1210
|
return r(() => {
|
|
@@ -563,109 +1216,110 @@ function ge(e) {
|
|
|
563
1216
|
reload: f
|
|
564
1217
|
};
|
|
565
1218
|
}
|
|
566
|
-
function
|
|
1219
|
+
function Ve(e, t, n) {
|
|
567
1220
|
if (e.failed) return /* @__PURE__ */ p("section", {
|
|
568
1221
|
className: "cp-screen",
|
|
569
|
-
children: [t, /* @__PURE__ */ f(
|
|
1222
|
+
children: [t, /* @__PURE__ */ f(q, { onRetry: e.reload })]
|
|
570
1223
|
});
|
|
571
1224
|
if (e.business === null) return /* @__PURE__ */ p("section", {
|
|
572
1225
|
className: "cp-screen",
|
|
573
1226
|
children: [t, /* @__PURE__ */ f("p", {
|
|
574
1227
|
className: "cp-empty",
|
|
575
|
-
children:
|
|
1228
|
+
children: n("business.notFound")
|
|
576
1229
|
})]
|
|
577
1230
|
});
|
|
578
1231
|
if (e.business === void 0 || !e.types) return /* @__PURE__ */ p("section", {
|
|
579
1232
|
className: "cp-screen",
|
|
580
1233
|
children: [t, /* @__PURE__ */ f("p", {
|
|
581
1234
|
role: "status",
|
|
582
|
-
children:
|
|
1235
|
+
children: n("app.loading")
|
|
583
1236
|
})]
|
|
584
1237
|
});
|
|
585
1238
|
}
|
|
586
|
-
function
|
|
1239
|
+
function He(e) {
|
|
587
1240
|
let t = /* @__PURE__ */ new Map();
|
|
588
1241
|
for (let n of e) for (let e of n.resources) t.has(e.id) || t.set(e.id, e);
|
|
589
1242
|
return [...t.values()];
|
|
590
1243
|
}
|
|
591
|
-
function
|
|
592
|
-
let { navigate:
|
|
1244
|
+
function Ue(e) {
|
|
1245
|
+
let { t } = I(), { navigate: n, accountNavigation: r } = x(), { businessId: i, eventTypeId: a, onFilter: o } = e, s = Be(i), c = r && /* @__PURE__ */ f("button", {
|
|
593
1246
|
type: "button",
|
|
594
1247
|
className: "cp-link cp-back",
|
|
595
|
-
onClick: () =>
|
|
596
|
-
children:
|
|
597
|
-
}),
|
|
598
|
-
if (
|
|
599
|
-
let
|
|
600
|
-
if (!
|
|
601
|
-
businessId:
|
|
1248
|
+
onClick: () => n("businesses"),
|
|
1249
|
+
children: t("business.all")
|
|
1250
|
+
}), l = Ve(s, c, t), { business: u, types: m } = s;
|
|
1251
|
+
if (l || !u || !m) return l;
|
|
1252
|
+
let h = m.find((e) => e.id === a), g = o ? He(h ? [h] : m) : [], _ = g.some((t) => t.id === e.resourceId) ? e.resourceId : void 0, v = (e) => {
|
|
1253
|
+
if (!o) return n(e ? {
|
|
1254
|
+
businessId: i,
|
|
602
1255
|
eventTypeId: e
|
|
603
|
-
} : { businessId:
|
|
604
|
-
let
|
|
605
|
-
|
|
1256
|
+
} : { businessId: i });
|
|
1257
|
+
let t = m.find((t) => t.id === e), r = _ && He(t ? [t] : m).some((e) => e.id === _);
|
|
1258
|
+
o({
|
|
606
1259
|
...e && { eventTypeId: e },
|
|
607
|
-
...
|
|
1260
|
+
...r && { resourceId: _ }
|
|
608
1261
|
});
|
|
609
1262
|
};
|
|
610
1263
|
return /* @__PURE__ */ p("section", {
|
|
611
1264
|
className: "cp-screen",
|
|
612
1265
|
children: [
|
|
613
|
-
|
|
614
|
-
/* @__PURE__ */ f(
|
|
615
|
-
|
|
1266
|
+
c,
|
|
1267
|
+
/* @__PURE__ */ f(We, { business: u }),
|
|
1268
|
+
m.length > 0 && /* @__PURE__ */ p("fieldset", {
|
|
616
1269
|
className: "cp-chips",
|
|
617
|
-
"aria-label":
|
|
1270
|
+
"aria-label": t("business.types"),
|
|
618
1271
|
children: [/* @__PURE__ */ f("button", {
|
|
619
1272
|
type: "button",
|
|
620
|
-
"aria-pressed": !
|
|
621
|
-
onClick: () =>
|
|
622
|
-
children:
|
|
623
|
-
}),
|
|
1273
|
+
"aria-pressed": !a,
|
|
1274
|
+
onClick: () => v(void 0),
|
|
1275
|
+
children: t("business.allTypes")
|
|
1276
|
+
}), m.map((e) => /* @__PURE__ */ f("button", {
|
|
624
1277
|
type: "button",
|
|
625
|
-
"aria-pressed": e.id ===
|
|
626
|
-
onClick: () =>
|
|
1278
|
+
"aria-pressed": e.id === a,
|
|
1279
|
+
onClick: () => v(e.id),
|
|
627
1280
|
children: e.displayName
|
|
628
1281
|
}, e.id))]
|
|
629
1282
|
}),
|
|
630
|
-
|
|
1283
|
+
o && g.length > 1 && /* @__PURE__ */ p("fieldset", {
|
|
631
1284
|
className: "cp-chips",
|
|
632
1285
|
children: [
|
|
633
|
-
/* @__PURE__ */ f("legend", { children:
|
|
1286
|
+
/* @__PURE__ */ f("legend", { children: t("business.resources") }),
|
|
634
1287
|
/* @__PURE__ */ f("button", {
|
|
635
1288
|
type: "button",
|
|
636
|
-
"aria-pressed": !
|
|
637
|
-
onClick: () =>
|
|
638
|
-
children:
|
|
1289
|
+
"aria-pressed": !_,
|
|
1290
|
+
onClick: () => o({ ...a && { eventTypeId: a } }),
|
|
1291
|
+
children: t("business.anyResource")
|
|
639
1292
|
}),
|
|
640
|
-
|
|
1293
|
+
g.map((e) => /* @__PURE__ */ f("button", {
|
|
641
1294
|
type: "button",
|
|
642
|
-
"aria-pressed": e.id ===
|
|
643
|
-
onClick: () =>
|
|
644
|
-
...
|
|
1295
|
+
"aria-pressed": e.id === _,
|
|
1296
|
+
onClick: () => o({
|
|
1297
|
+
...a && { eventTypeId: a },
|
|
645
1298
|
resourceId: e.id
|
|
646
1299
|
}),
|
|
647
1300
|
children: e.displayName
|
|
648
1301
|
}, e.id))
|
|
649
1302
|
]
|
|
650
1303
|
}),
|
|
651
|
-
|
|
1304
|
+
a && !h ? /* @__PURE__ */ f("p", {
|
|
652
1305
|
className: "cp-empty",
|
|
653
|
-
children:
|
|
654
|
-
}) : /* @__PURE__ */ p(d, { children: [
|
|
655
|
-
business:
|
|
656
|
-
eventTypeId:
|
|
657
|
-
resourceId:
|
|
658
|
-
onChoose: (t) => e.onChoose(
|
|
1306
|
+
children: t("business.typeMissing")
|
|
1307
|
+
}) : /* @__PURE__ */ p(d, { children: [h && /* @__PURE__ */ f(Ge, { type: h }), /* @__PURE__ */ f(Ke, {
|
|
1308
|
+
business: u,
|
|
1309
|
+
eventTypeId: a,
|
|
1310
|
+
resourceId: _,
|
|
1311
|
+
onChoose: (t) => e.onChoose(u, t)
|
|
659
1312
|
})] })
|
|
660
1313
|
]
|
|
661
1314
|
});
|
|
662
1315
|
}
|
|
663
|
-
function
|
|
1316
|
+
function We({ business: e }) {
|
|
1317
|
+
let { t } = I();
|
|
664
1318
|
return /* @__PURE__ */ p("header", {
|
|
665
1319
|
className: "cp-business-head",
|
|
666
|
-
children: [/* @__PURE__ */ f(
|
|
1320
|
+
children: [/* @__PURE__ */ f(J, {
|
|
667
1321
|
image: e.logo,
|
|
668
|
-
alt:
|
|
1322
|
+
alt: t("image.logo", { name: e.displayName }),
|
|
669
1323
|
size: "small",
|
|
670
1324
|
className: "cp-logo"
|
|
671
1325
|
}), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", { children: e.displayName }), e.address && /* @__PURE__ */ f("p", {
|
|
@@ -674,11 +1328,12 @@ function be({ business: e }) {
|
|
|
674
1328
|
})] })]
|
|
675
1329
|
});
|
|
676
1330
|
}
|
|
677
|
-
function
|
|
1331
|
+
function Ge({ type: e }) {
|
|
1332
|
+
let { t } = I();
|
|
678
1333
|
return /* @__PURE__ */ p("div", {
|
|
679
1334
|
className: "cp-type",
|
|
680
1335
|
children: [
|
|
681
|
-
/* @__PURE__ */ f(
|
|
1336
|
+
/* @__PURE__ */ f(J, {
|
|
682
1337
|
image: e.image,
|
|
683
1338
|
alt: e.displayName,
|
|
684
1339
|
size: "full",
|
|
@@ -688,400 +1343,288 @@ function xe({ type: e }) {
|
|
|
688
1343
|
e.description && /* @__PURE__ */ f("p", { children: e.description }),
|
|
689
1344
|
/* @__PURE__ */ f("p", {
|
|
690
1345
|
className: "cp-hint",
|
|
691
|
-
children:
|
|
1346
|
+
children: t("business.minutes", { minutes: e.durationMinutes })
|
|
692
1347
|
})
|
|
693
1348
|
]
|
|
694
1349
|
});
|
|
695
1350
|
}
|
|
696
|
-
function
|
|
697
|
-
let {
|
|
698
|
-
|
|
1351
|
+
function Ke(e) {
|
|
1352
|
+
let { t: n, formatDate: i, formatDay: a } = I(), { client: o } = x(), { business: c, eventTypeId: l, resourceId: u } = e, m = c.timezone, [h, g] = s(0), [_, v] = s(), [y, b] = s(!1), S = Y(ze(m), h * Re), C = Y(S, Re), w = t(async () => {
|
|
1353
|
+
b(!1), v(void 0);
|
|
699
1354
|
try {
|
|
700
|
-
let { data: e } = await
|
|
701
|
-
path: { businessId:
|
|
1355
|
+
let { data: e } = await o.GET("/web/businesses/{businessId}/availability", { params: {
|
|
1356
|
+
path: { businessId: c.id },
|
|
702
1357
|
query: {
|
|
703
|
-
from: `${
|
|
704
|
-
to: `${
|
|
705
|
-
...
|
|
706
|
-
...
|
|
1358
|
+
from: `${S}T00:00`,
|
|
1359
|
+
to: `${C}T00:00`,
|
|
1360
|
+
...l && { eventTypeId: l },
|
|
1361
|
+
...u && { resourceId: u }
|
|
707
1362
|
}
|
|
708
1363
|
} });
|
|
709
|
-
|
|
1364
|
+
v(e?.items ?? []);
|
|
710
1365
|
} catch {
|
|
711
|
-
|
|
1366
|
+
b(!0);
|
|
712
1367
|
}
|
|
713
1368
|
}, [
|
|
714
|
-
n,
|
|
715
|
-
i.id,
|
|
716
|
-
a,
|
|
717
1369
|
o,
|
|
718
|
-
|
|
719
|
-
|
|
1370
|
+
c.id,
|
|
1371
|
+
l,
|
|
1372
|
+
u,
|
|
1373
|
+
S,
|
|
1374
|
+
C
|
|
720
1375
|
]);
|
|
721
1376
|
r(() => {
|
|
722
|
-
|
|
723
|
-
}, [
|
|
724
|
-
let
|
|
725
|
-
for (let e of
|
|
726
|
-
if (Date.parse(e.startsAt) <=
|
|
727
|
-
let t =
|
|
728
|
-
|
|
1377
|
+
w();
|
|
1378
|
+
}, [w]);
|
|
1379
|
+
let T = Date.now(), E = /* @__PURE__ */ new Map();
|
|
1380
|
+
for (let e of _ ?? []) {
|
|
1381
|
+
if (Date.parse(e.startsAt) <= T) continue;
|
|
1382
|
+
let t = ze(e.timezone, new Date(e.startsAt)), n = E.get(t) ?? {
|
|
1383
|
+
heading: a(e.startsAt, e.timezone),
|
|
1384
|
+
candidates: []
|
|
1385
|
+
};
|
|
1386
|
+
n.candidates.push(e), E.set(t, n);
|
|
729
1387
|
}
|
|
730
|
-
let
|
|
731
|
-
from:
|
|
732
|
-
to:
|
|
1388
|
+
let D = n("business.weekOf", {
|
|
1389
|
+
from: i(`${S}T12:00:00Z`, "UTC"),
|
|
1390
|
+
to: i(`${Y(C, -1)}T12:00:00Z`, "UTC")
|
|
733
1391
|
});
|
|
734
1392
|
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("fieldset", {
|
|
735
1393
|
className: "cp-week",
|
|
736
|
-
"aria-label":
|
|
1394
|
+
"aria-label": n("business.week"),
|
|
737
1395
|
children: [
|
|
738
1396
|
/* @__PURE__ */ f("button", {
|
|
739
1397
|
type: "button",
|
|
740
1398
|
className: "cp-secondary",
|
|
741
|
-
disabled:
|
|
742
|
-
onClick: () =>
|
|
743
|
-
"aria-label":
|
|
1399
|
+
disabled: h === 0,
|
|
1400
|
+
onClick: () => g((e) => e - 1),
|
|
1401
|
+
"aria-label": n("business.previousWeek"),
|
|
744
1402
|
children: "‹"
|
|
745
1403
|
}),
|
|
746
|
-
/* @__PURE__ */ f("span", { children:
|
|
1404
|
+
/* @__PURE__ */ f("span", { children: D }),
|
|
747
1405
|
/* @__PURE__ */ f("button", {
|
|
748
1406
|
type: "button",
|
|
749
1407
|
className: "cp-secondary",
|
|
750
|
-
onClick: () =>
|
|
751
|
-
"aria-label":
|
|
1408
|
+
onClick: () => g((e) => e + 1),
|
|
1409
|
+
"aria-label": n("business.nextWeek"),
|
|
752
1410
|
children: "›"
|
|
753
1411
|
})
|
|
754
1412
|
]
|
|
755
|
-
}),
|
|
1413
|
+
}), y ? /* @__PURE__ */ f(q, { onRetry: w }) : _ ? E.size === 0 ? /* @__PURE__ */ f("p", {
|
|
756
1414
|
className: "cp-empty",
|
|
757
|
-
children:
|
|
758
|
-
}) : [...
|
|
1415
|
+
children: n("business.empty")
|
|
1416
|
+
}) : [...E].map(([t, { heading: n, candidates: r }]) => /* @__PURE__ */ p("div", {
|
|
759
1417
|
className: "cp-day",
|
|
760
|
-
children: [/* @__PURE__ */ f("h2", { children:
|
|
1418
|
+
children: [/* @__PURE__ */ f("h2", { children: n }), /* @__PURE__ */ f("ul", {
|
|
761
1419
|
className: "cp-list",
|
|
762
|
-
children:
|
|
1420
|
+
children: r.map((t) => /* @__PURE__ */ f(Je, {
|
|
763
1421
|
candidate: t,
|
|
764
1422
|
onChoose: () => e.onChoose(t)
|
|
765
1423
|
}, `${t.eventId ?? t.eventTypeId}-${t.resource?.id ?? ""}-${t.startsAt}`))
|
|
766
1424
|
})]
|
|
767
1425
|
}, t)) : /* @__PURE__ */ f("p", {
|
|
768
1426
|
role: "status",
|
|
769
|
-
children:
|
|
1427
|
+
children: n("app.loading")
|
|
770
1428
|
})] });
|
|
771
1429
|
}
|
|
772
|
-
function
|
|
1430
|
+
function qe({ candidate: e }) {
|
|
1431
|
+
let { t } = I();
|
|
773
1432
|
if (e.kind === "slot") return e.resource ? /* @__PURE__ */ f("p", {
|
|
774
1433
|
className: "cp-hint",
|
|
775
|
-
children:
|
|
1434
|
+
children: t("business.with", { resource: e.resources?.[0]?.presentedAs?.name ?? e.resource.displayName })
|
|
776
1435
|
}) : null;
|
|
777
|
-
let
|
|
778
|
-
for (let
|
|
779
|
-
let { label: e, name: r } =
|
|
1436
|
+
let n = [];
|
|
1437
|
+
for (let t of e.resources ?? []) {
|
|
1438
|
+
let { label: e, name: r } = t.presentedAs ?? {
|
|
780
1439
|
label: null,
|
|
781
|
-
name:
|
|
782
|
-
}, i =
|
|
783
|
-
i && e !== null && i.label === e ? i.names.push(r) :
|
|
1440
|
+
name: t.displayName
|
|
1441
|
+
}, i = n.at(-1);
|
|
1442
|
+
i && e !== null && i.label === e ? i.names.push(r) : n.push({
|
|
784
1443
|
label: e,
|
|
785
1444
|
names: [r]
|
|
786
1445
|
});
|
|
787
1446
|
}
|
|
788
|
-
let
|
|
789
|
-
return
|
|
1447
|
+
let r = n.map(({ label: e, names: t }) => e === null ? t.join(", ") : `${e}: ${t.join(", ")}`);
|
|
1448
|
+
return r.length > 0 ? /* @__PURE__ */ f("p", {
|
|
790
1449
|
className: "cp-hint cp-resources",
|
|
791
|
-
children:
|
|
1450
|
+
children: r.join(" · ")
|
|
792
1451
|
}) : null;
|
|
793
1452
|
}
|
|
794
|
-
function
|
|
795
|
-
let { candidate:
|
|
1453
|
+
function Je(e) {
|
|
1454
|
+
let { t, tp: n, formatTime: r } = I(), { candidate: i } = e, a = i.kind === "slot";
|
|
796
1455
|
return /* @__PURE__ */ p("li", {
|
|
797
1456
|
className: "cp-card cp-candidate",
|
|
798
|
-
"data-kind":
|
|
1457
|
+
"data-kind": i.kind,
|
|
799
1458
|
children: [
|
|
800
1459
|
/* @__PURE__ */ p("p", {
|
|
801
1460
|
className: "cp-time",
|
|
802
1461
|
children: [
|
|
803
|
-
|
|
1462
|
+
r(i.startsAt, i.timezone),
|
|
804
1463
|
" – ",
|
|
805
|
-
|
|
1464
|
+
r(i.endsAt, i.timezone)
|
|
806
1465
|
]
|
|
807
1466
|
}),
|
|
808
1467
|
/* @__PURE__ */ p("div", {
|
|
809
1468
|
className: "cp-candidate-body",
|
|
810
1469
|
children: [
|
|
811
|
-
/* @__PURE__ */ f("h3", { children:
|
|
812
|
-
/* @__PURE__ */ f(
|
|
1470
|
+
/* @__PURE__ */ f("h3", { children: i.title }),
|
|
1471
|
+
/* @__PURE__ */ f(qe, { candidate: i }),
|
|
813
1472
|
/* @__PURE__ */ f("p", {
|
|
814
1473
|
className: "cp-hint",
|
|
815
|
-
children:
|
|
1474
|
+
children: a ? t("business.openTime") : i.full ? t("business.full") : n("business.seatsLeft", i.seatsLeft)
|
|
816
1475
|
})
|
|
817
1476
|
]
|
|
818
1477
|
}),
|
|
819
|
-
!
|
|
1478
|
+
!i.full && /* @__PURE__ */ f("button", {
|
|
820
1479
|
type: "button",
|
|
821
1480
|
onClick: e.onChoose,
|
|
822
|
-
children:
|
|
1481
|
+
children: t("business.book")
|
|
823
1482
|
})
|
|
824
1483
|
]
|
|
825
1484
|
});
|
|
826
1485
|
}
|
|
827
1486
|
// src/booking.tsx
|
|
828
|
-
var
|
|
829
|
-
function
|
|
1487
|
+
var Ye = "/web/businesses/{businessId}/reservations", Xe = "/web/businesses/{businessId}/reservations/{reservationId}/confirm", Ze = (e) => `msm-checkout:${e.business.id}|${e.candidate.eventId ?? e.candidate.eventTypeId}|${Date.parse(e.candidate.startsAt)}`;
|
|
1488
|
+
function Qe(e) {
|
|
830
1489
|
try {
|
|
831
|
-
return window.sessionStorage.getItem(
|
|
1490
|
+
return window.sessionStorage.getItem(Ze(e));
|
|
832
1491
|
} catch {
|
|
833
1492
|
return null;
|
|
834
1493
|
}
|
|
835
1494
|
}
|
|
836
|
-
function
|
|
1495
|
+
function $e(e, t) {
|
|
837
1496
|
try {
|
|
838
|
-
t ? window.sessionStorage.setItem(
|
|
1497
|
+
t ? window.sessionStorage.setItem(Ze(e), t) : window.sessionStorage.removeItem(Ze(e));
|
|
839
1498
|
} catch {}
|
|
840
1499
|
}
|
|
841
|
-
var
|
|
842
|
-
function
|
|
1500
|
+
var et = "msm-checkout-selection";
|
|
1501
|
+
function tt(e) {
|
|
843
1502
|
try {
|
|
844
|
-
window.sessionStorage.setItem(
|
|
1503
|
+
window.sessionStorage.setItem(et, JSON.stringify(e));
|
|
845
1504
|
} catch {}
|
|
846
1505
|
}
|
|
847
|
-
function
|
|
848
|
-
|
|
849
|
-
if (t !== "paid" && t !== "back") return null;
|
|
850
|
-
e.searchParams.delete(K), window.history.replaceState(window.history.state, "", e.toString());
|
|
851
|
-
let n = null;
|
|
1506
|
+
function nt() {
|
|
1507
|
+
if (!we()) return null;
|
|
852
1508
|
try {
|
|
853
|
-
let e = window.sessionStorage.getItem(
|
|
854
|
-
window.sessionStorage.removeItem(
|
|
1509
|
+
let e = window.sessionStorage.getItem(et);
|
|
1510
|
+
return window.sessionStorage.removeItem(et), e ? JSON.parse(e) : null;
|
|
855
1511
|
} catch {
|
|
856
|
-
|
|
1512
|
+
return null;
|
|
857
1513
|
}
|
|
858
|
-
return {
|
|
859
|
-
outcome: t,
|
|
860
|
-
selection: n
|
|
861
|
-
};
|
|
862
1514
|
}
|
|
863
|
-
function
|
|
864
|
-
let {
|
|
1515
|
+
function X({ choice: e }) {
|
|
1516
|
+
let { formatRange: t } = I(), { business: n, candidate: r } = e;
|
|
865
1517
|
return /* @__PURE__ */ p("div", {
|
|
866
1518
|
className: "cp-summary",
|
|
867
1519
|
children: [
|
|
868
|
-
/* @__PURE__ */ f("h2", { children:
|
|
869
|
-
/* @__PURE__ */ f("p", { children:
|
|
870
|
-
/* @__PURE__ */ f("p", { children:
|
|
871
|
-
/* @__PURE__ */ f(
|
|
1520
|
+
/* @__PURE__ */ f("h2", { children: r.title }),
|
|
1521
|
+
/* @__PURE__ */ f("p", { children: n.displayName }),
|
|
1522
|
+
/* @__PURE__ */ f("p", { children: t(r.startsAt, r.endsAt, r.timezone) }),
|
|
1523
|
+
/* @__PURE__ */ f(qe, { candidate: r })
|
|
872
1524
|
]
|
|
873
1525
|
});
|
|
874
1526
|
}
|
|
875
|
-
function
|
|
876
|
-
let {
|
|
877
|
-
|
|
1527
|
+
function rt(e) {
|
|
1528
|
+
let { t: n, formatDate: i, formatTime: a } = I(), { client: c, navigate: l, accountNavigation: m } = x(), { business: h, candidate: g } = e.choice, [_, v] = s({ step: "reserving" }), [y, b] = s(), S = t(async () => {
|
|
1529
|
+
v({ step: "reserving" });
|
|
878
1530
|
try {
|
|
879
|
-
let { data: e } = await
|
|
880
|
-
params: { path: { businessId:
|
|
881
|
-
body:
|
|
882
|
-
eventTypeId:
|
|
883
|
-
startsAt:
|
|
884
|
-
...
|
|
1531
|
+
let { data: e } = await c.POST(Ye, {
|
|
1532
|
+
params: { path: { businessId: h.id } },
|
|
1533
|
+
body: g.eventId ? { eventId: g.eventId } : {
|
|
1534
|
+
eventTypeId: g.eventTypeId,
|
|
1535
|
+
startsAt: g.startsAt,
|
|
1536
|
+
...g.resource && { resourceId: g.resource.id }
|
|
885
1537
|
}
|
|
886
1538
|
});
|
|
887
1539
|
if (!e) return;
|
|
888
|
-
let t = (await
|
|
1540
|
+
let t = (await c.GET("/web/businesses/{businessId}/event-types", { params: { path: { businessId: h.id } } }).then(({ data: e }) => e?.items ?? []).catch(() => [])).find((e) => e.id === g.eventTypeId)?.price;
|
|
889
1541
|
if (!t) {
|
|
890
|
-
|
|
1542
|
+
v({
|
|
891
1543
|
step: "held",
|
|
892
1544
|
reservationId: e.id,
|
|
893
1545
|
expiresAt: e.expiresAt
|
|
894
1546
|
});
|
|
895
1547
|
return;
|
|
896
1548
|
}
|
|
897
|
-
|
|
898
|
-
g({
|
|
1549
|
+
v({
|
|
899
1550
|
step: "pay",
|
|
900
1551
|
reservationId: e.id,
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
1552
|
+
held: {
|
|
1553
|
+
expiresAt: e.expiresAt,
|
|
1554
|
+
price: t
|
|
1555
|
+
}
|
|
904
1556
|
});
|
|
905
1557
|
} catch (e) {
|
|
906
|
-
let t = u(e, "post",
|
|
907
|
-
|
|
1558
|
+
let t = u(e, "post", Ye) ? e : void 0;
|
|
1559
|
+
v({
|
|
908
1560
|
step: "refused",
|
|
909
|
-
...
|
|
1561
|
+
...xe(t, it),
|
|
910
1562
|
again: !1
|
|
911
1563
|
});
|
|
912
1564
|
}
|
|
913
1565
|
}, [
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
]),
|
|
918
|
-
let
|
|
919
|
-
businessId:
|
|
1566
|
+
c,
|
|
1567
|
+
h.id,
|
|
1568
|
+
g
|
|
1569
|
+
]), C = t(async (t) => {
|
|
1570
|
+
let n = await c.GET("/web/businesses/{businessId}/bookings/{bookingId}", { params: { path: {
|
|
1571
|
+
businessId: h.id,
|
|
920
1572
|
bookingId: t
|
|
921
1573
|
} } }).then(({ data: e }) => e ?? null).catch(() => null);
|
|
922
|
-
|
|
1574
|
+
n && e.onBooked?.(n), v({
|
|
923
1575
|
step: "booked",
|
|
924
|
-
booking:
|
|
1576
|
+
booking: n
|
|
925
1577
|
});
|
|
926
1578
|
}, [
|
|
927
|
-
|
|
928
|
-
|
|
1579
|
+
c,
|
|
1580
|
+
h.id,
|
|
929
1581
|
e.onBooked
|
|
930
|
-
]), x = o(!0);
|
|
931
|
-
r(() => (x.current = !0, () => {
|
|
932
|
-
x.current = !1;
|
|
933
|
-
}), []);
|
|
934
|
-
let S = t(async (t, r, i) => {
|
|
935
|
-
g(i ? {
|
|
936
|
-
step: "away",
|
|
937
|
-
reservationId: t,
|
|
938
|
-
...i
|
|
939
|
-
} : {
|
|
940
|
-
step: "checking",
|
|
941
|
-
reservationId: t
|
|
942
|
-
});
|
|
943
|
-
let a = i && Date.parse(i.expiresAt) + 3e5;
|
|
944
|
-
for (let o = 0; x.current; o++) {
|
|
945
|
-
let s = await n.GET(De, { params: { path: {
|
|
946
|
-
businessId: l.id,
|
|
947
|
-
reservationId: t
|
|
948
|
-
} } }).then(({ data: e }) => e).catch(() => void 0);
|
|
949
|
-
if (!x.current) return;
|
|
950
|
-
if (!s && a && Date.now() <= a) {
|
|
951
|
-
await H(3e3);
|
|
952
|
-
continue;
|
|
953
|
-
}
|
|
954
|
-
if (!s) {
|
|
955
|
-
q(e.choice, null), y();
|
|
956
|
-
return;
|
|
957
|
-
}
|
|
958
|
-
if (s.status === "confirmed" && s.bookingId) {
|
|
959
|
-
q(e.choice, null), b(s.bookingId);
|
|
960
|
-
return;
|
|
961
|
-
}
|
|
962
|
-
let c = r && s.status === "released" && (s.payment?.status === "PENDING" || s.payment?.status === "SUCCEEDED");
|
|
963
|
-
if (!c && (s.status === "released" || s.status === "unconfirmed_paid")) return q(e.choice, null), g({
|
|
964
|
-
step: "refused",
|
|
965
|
-
message: s.status === "released" ? "pay.released" : "pay.paidUnbooked",
|
|
966
|
-
again: s.status === "released"
|
|
967
|
-
});
|
|
968
|
-
if (!c && (!r || s.payment?.status === "FAILED")) return g({
|
|
969
|
-
step: "unfinished",
|
|
970
|
-
reservationId: t,
|
|
971
|
-
expiresAt: s.holdUntil,
|
|
972
|
-
redirectUrl: s.payment?.redirectUrl ?? null
|
|
973
|
-
});
|
|
974
|
-
if (a ? Date.now() > a : o >= 15) return g({
|
|
975
|
-
step: "refused",
|
|
976
|
-
message: "pay.slow",
|
|
977
|
-
again: !1
|
|
978
|
-
});
|
|
979
|
-
await H(i ? 3e3 : 2e3);
|
|
980
|
-
}
|
|
981
|
-
}, [
|
|
982
|
-
n,
|
|
983
|
-
l.id,
|
|
984
|
-
e.choice,
|
|
985
|
-
y,
|
|
986
|
-
b
|
|
987
1582
|
]), w = o(!1);
|
|
988
1583
|
r(() => {
|
|
989
1584
|
if (w.current) return;
|
|
990
1585
|
w.current = !0;
|
|
991
|
-
let t =
|
|
992
|
-
t ?
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
S
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
...t,
|
|
1003
|
-
paying: !0,
|
|
1004
|
-
notice: void 0
|
|
1005
|
-
});
|
|
1006
|
-
try {
|
|
1007
|
-
let { data: i } = await n.POST(De, {
|
|
1008
|
-
params: { path: {
|
|
1009
|
-
businessId: l.id,
|
|
1010
|
-
reservationId: t.reservationId
|
|
1011
|
-
} },
|
|
1012
|
-
body: {
|
|
1013
|
-
...r && { paymentMethodId: r.id },
|
|
1014
|
-
successUrl: V(K, "paid", a),
|
|
1015
|
-
cancelUrl: V(K, "back", a)
|
|
1016
|
-
}
|
|
1017
|
-
}), o = i?.payment?.redirectUrl;
|
|
1018
|
-
if (i?.status === "pending" && o || B(a), !i) return;
|
|
1019
|
-
if (i.status === "confirmed" && i.bookingId) return void b(i.bookingId);
|
|
1020
|
-
if (i.status !== "pending" || !o) return g({
|
|
1021
|
-
...t,
|
|
1022
|
-
paying: !1,
|
|
1023
|
-
notice: "pay.unavailable"
|
|
1024
|
-
});
|
|
1025
|
-
a || (q(e.choice, t.reservationId), e.onLeave?.()), oe(a, o), a && S(t.reservationId, !0, {
|
|
1026
|
-
expiresAt: t.expiresAt,
|
|
1027
|
-
redirectUrl: o,
|
|
1028
|
-
opened: !!a.window
|
|
1029
|
-
});
|
|
1030
|
-
} catch (e) {
|
|
1031
|
-
B(a);
|
|
1032
|
-
let n = u(e, "post", De) ? e : void 0;
|
|
1033
|
-
if (n?.code === "ReservationExpired") return g({
|
|
1034
|
-
step: "refused",
|
|
1035
|
-
message: "book.expired",
|
|
1036
|
-
again: !0
|
|
1037
|
-
});
|
|
1038
|
-
if (n?.code === "PaymentProviderNotOffered" || n?.code === "PaymentProviderNotConnected") return g({
|
|
1039
|
-
...t,
|
|
1040
|
-
paying: !1,
|
|
1041
|
-
notice: "pay.notOffered"
|
|
1042
|
-
});
|
|
1043
|
-
if (n?.code === "PaymentProviderUnavailable" || n?.code === "PaymentProviderRejected" || n?.code === "PaymentCredentialsUnavailable") return g({
|
|
1044
|
-
...t,
|
|
1045
|
-
paying: !1,
|
|
1046
|
-
notice: "pay.unavailable"
|
|
1047
|
-
});
|
|
1048
|
-
g({
|
|
1049
|
-
step: "refused",
|
|
1050
|
-
...Pe(n, Ie, m.timezone),
|
|
1051
|
-
again: !1
|
|
1052
|
-
});
|
|
1053
|
-
}
|
|
1586
|
+
let t = Qe(e.choice);
|
|
1587
|
+
t ? v({
|
|
1588
|
+
step: "pay",
|
|
1589
|
+
reservationId: t
|
|
1590
|
+
}) : S();
|
|
1591
|
+
}, [S, e.choice]);
|
|
1592
|
+
function T(t) {
|
|
1593
|
+
$e(e.choice, null), t.status === "confirmed" ? C(t.bookingId) : t.status === "released" && v((e) => e.step === "pay" ? {
|
|
1594
|
+
...e,
|
|
1595
|
+
released: !0
|
|
1596
|
+
} : e);
|
|
1054
1597
|
}
|
|
1055
|
-
async function E(t,
|
|
1056
|
-
|
|
1598
|
+
async function E(t, n) {
|
|
1599
|
+
v({
|
|
1057
1600
|
step: "confirming",
|
|
1058
1601
|
reservationId: t,
|
|
1059
|
-
expiresAt:
|
|
1602
|
+
expiresAt: n
|
|
1060
1603
|
});
|
|
1061
1604
|
try {
|
|
1062
|
-
let { data:
|
|
1063
|
-
businessId:
|
|
1605
|
+
let { data: n } = await c.POST(Xe, { params: { path: {
|
|
1606
|
+
businessId: h.id,
|
|
1064
1607
|
reservationId: t
|
|
1065
1608
|
} } });
|
|
1066
|
-
if (!
|
|
1067
|
-
e.onBooked?.(
|
|
1068
|
-
let
|
|
1069
|
-
businessId:
|
|
1070
|
-
bookingId:
|
|
1609
|
+
if (!n) return;
|
|
1610
|
+
e.onBooked?.(n);
|
|
1611
|
+
let r = await c.GET("/web/businesses/{businessId}/bookings/{bookingId}", { params: { path: {
|
|
1612
|
+
businessId: h.id,
|
|
1613
|
+
bookingId: n.id
|
|
1071
1614
|
} } }).then(({ data: e }) => e ?? null).catch(() => null);
|
|
1072
|
-
|
|
1615
|
+
v({
|
|
1073
1616
|
step: "booked",
|
|
1074
|
-
booking:
|
|
1617
|
+
booking: r
|
|
1075
1618
|
});
|
|
1076
1619
|
} catch (e) {
|
|
1077
|
-
let t = u(e, "post",
|
|
1078
|
-
t?.code === "ReservationExpired" || t?.code === "ReservationNotFound" ?
|
|
1620
|
+
let t = u(e, "post", Xe) ? e : void 0;
|
|
1621
|
+
t?.code === "ReservationExpired" || t?.code === "ReservationNotFound" ? v({
|
|
1079
1622
|
step: "refused",
|
|
1080
1623
|
message: "book.expired",
|
|
1081
1624
|
again: !0
|
|
1082
|
-
}) :
|
|
1625
|
+
}) : v({
|
|
1083
1626
|
step: "refused",
|
|
1084
|
-
...
|
|
1627
|
+
...xe(t, Se),
|
|
1085
1628
|
again: !1
|
|
1086
1629
|
});
|
|
1087
1630
|
}
|
|
@@ -1090,131 +1633,91 @@ function Ne(e) {
|
|
|
1090
1633
|
type: "button",
|
|
1091
1634
|
className: "cp-secondary",
|
|
1092
1635
|
onClick: e.onBack,
|
|
1093
|
-
children:
|
|
1636
|
+
children: n("book.back")
|
|
1094
1637
|
});
|
|
1095
1638
|
return /* @__PURE__ */ p("section", {
|
|
1096
1639
|
className: "cp-screen",
|
|
1097
|
-
children: [/* @__PURE__ */ f("h1", { children:
|
|
1640
|
+
children: [/* @__PURE__ */ f("h1", { children: n("book.heading") }), _.step === "booked" ? /* @__PURE__ */ p(d, { children: [
|
|
1098
1641
|
/* @__PURE__ */ f("p", {
|
|
1099
1642
|
role: "status",
|
|
1100
1643
|
className: "cp-notice",
|
|
1101
|
-
children:
|
|
1644
|
+
children: n(y ?? "book.booked")
|
|
1102
1645
|
}),
|
|
1103
|
-
|
|
1646
|
+
_.booking ? /* @__PURE__ */ f("ul", {
|
|
1104
1647
|
className: "cp-list",
|
|
1105
|
-
children: /* @__PURE__ */ f(
|
|
1106
|
-
booking:
|
|
1648
|
+
children: /* @__PURE__ */ f(Fe, {
|
|
1649
|
+
booking: _.booking,
|
|
1107
1650
|
onCancelled: (e, t) => {
|
|
1108
|
-
|
|
1651
|
+
v({
|
|
1109
1652
|
step: "booked",
|
|
1110
1653
|
booking: e
|
|
1111
|
-
}),
|
|
1654
|
+
}), b(t ? "bookings.doneLate" : "bookings.doneOnTime");
|
|
1112
1655
|
}
|
|
1113
1656
|
})
|
|
1114
|
-
}) : /* @__PURE__ */ f(
|
|
1115
|
-
|
|
1657
|
+
}) : /* @__PURE__ */ f(X, { choice: e.choice }),
|
|
1658
|
+
m ? /* @__PURE__ */ f("button", {
|
|
1116
1659
|
type: "button",
|
|
1117
1660
|
className: "cp-secondary",
|
|
1118
|
-
onClick: () =>
|
|
1119
|
-
children:
|
|
1661
|
+
onClick: () => l("bookings"),
|
|
1662
|
+
children: n("book.toBookings")
|
|
1120
1663
|
}) : e.onDone && /* @__PURE__ */ f("button", {
|
|
1121
1664
|
type: "button",
|
|
1122
1665
|
className: "cp-secondary",
|
|
1123
1666
|
onClick: e.onDone,
|
|
1124
|
-
children:
|
|
1667
|
+
children: n("book.done")
|
|
1125
1668
|
})
|
|
1126
1669
|
] }) : /* @__PURE__ */ p(d, { children: [
|
|
1127
|
-
/* @__PURE__ */ f(
|
|
1128
|
-
|
|
1670
|
+
/* @__PURE__ */ f(X, { choice: e.choice }),
|
|
1671
|
+
_.step === "reserving" && /* @__PURE__ */ f("p", {
|
|
1129
1672
|
role: "status",
|
|
1130
|
-
children:
|
|
1673
|
+
children: n("book.reserving")
|
|
1131
1674
|
}),
|
|
1132
|
-
(
|
|
1675
|
+
(_.step === "held" || _.step === "confirming") && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
1133
1676
|
className: "cp-hint",
|
|
1134
|
-
children:
|
|
1677
|
+
children: n("book.heldUntil", { time: a(_.expiresAt, g.timezone) })
|
|
1135
1678
|
}), /* @__PURE__ */ p("div", {
|
|
1136
1679
|
className: "cp-actions",
|
|
1137
1680
|
children: [/* @__PURE__ */ f("button", {
|
|
1138
1681
|
type: "button",
|
|
1139
|
-
disabled:
|
|
1140
|
-
onClick: () => E(
|
|
1141
|
-
children:
|
|
1682
|
+
disabled: _.step === "confirming",
|
|
1683
|
+
onClick: () => E(_.reservationId, _.expiresAt),
|
|
1684
|
+
children: _.step === "confirming" ? n("book.confirming") : n("book.confirm")
|
|
1142
1685
|
}), D]
|
|
1143
1686
|
})] }),
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
children: N("pay.checking")
|
|
1153
|
-
}),
|
|
1154
|
-
h.step === "away" && /* @__PURE__ */ p(d, { children: [
|
|
1155
|
-
/* @__PURE__ */ f("p", {
|
|
1156
|
-
role: "status",
|
|
1157
|
-
className: "cp-notice",
|
|
1158
|
-
children: N(h.opened ? "pay.away" : "pay.awayBlocked")
|
|
1687
|
+
_.step === "pay" && /* @__PURE__ */ f(ke, {
|
|
1688
|
+
businessId: h.id,
|
|
1689
|
+
reservationId: _.reservationId,
|
|
1690
|
+
timeZone: g.timezone,
|
|
1691
|
+
free: _.held?.price.advanceAmount === 0,
|
|
1692
|
+
terms: _.held && /* @__PURE__ */ f(at, {
|
|
1693
|
+
..._.held,
|
|
1694
|
+
timeZone: g.timezone
|
|
1159
1695
|
}),
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1164
|
-
/* @__PURE__ */ p("
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
children: N("pay.open")
|
|
1172
|
-
}), D]
|
|
1173
|
-
})
|
|
1174
|
-
] }),
|
|
1175
|
-
h.step === "unfinished" && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
1176
|
-
className: "cp-hint",
|
|
1177
|
-
children: N("pay.notFinished", { time: R(h.expiresAt, m.timezone) })
|
|
1178
|
-
}), /* @__PURE__ */ p("div", {
|
|
1179
|
-
className: "cp-actions",
|
|
1180
|
-
children: [h.redirectUrl && /* @__PURE__ */ f("a", {
|
|
1181
|
-
className: "cp-button",
|
|
1182
|
-
href: h.redirectUrl,
|
|
1183
|
-
...C(i) ? {
|
|
1184
|
-
target: "_blank",
|
|
1185
|
-
rel: "noopener",
|
|
1186
|
-
onClick: () => void S(h.reservationId, !0, {
|
|
1187
|
-
expiresAt: h.expiresAt,
|
|
1188
|
-
redirectUrl: h.redirectUrl,
|
|
1189
|
-
opened: !0
|
|
1190
|
-
})
|
|
1191
|
-
} : { onClick: e.onLeave },
|
|
1192
|
-
children: N("pay.again")
|
|
1193
|
-
}), D]
|
|
1194
|
-
})] }),
|
|
1195
|
-
h.step === "refused" && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
1696
|
+
onResult: T,
|
|
1697
|
+
onLeave: () => {
|
|
1698
|
+
$e(e.choice, _.reservationId), e.onLeave?.();
|
|
1699
|
+
},
|
|
1700
|
+
actions: /* @__PURE__ */ p(d, { children: [_.released && /* @__PURE__ */ f("button", {
|
|
1701
|
+
type: "button",
|
|
1702
|
+
onClick: S,
|
|
1703
|
+
children: n("book.reserveAgain")
|
|
1704
|
+
}), D] })
|
|
1705
|
+
}, _.reservationId),
|
|
1706
|
+
_.step === "refused" && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
1196
1707
|
role: "alert",
|
|
1197
|
-
children:
|
|
1708
|
+
children: n(_.message, _.until ? { date: i(_.until, g.timezone) } : {})
|
|
1198
1709
|
}), /* @__PURE__ */ p("div", {
|
|
1199
1710
|
className: "cp-actions",
|
|
1200
|
-
children: [
|
|
1711
|
+
children: [_.again && /* @__PURE__ */ f("button", {
|
|
1201
1712
|
type: "button",
|
|
1202
|
-
onClick:
|
|
1203
|
-
children:
|
|
1713
|
+
onClick: S,
|
|
1714
|
+
children: n("book.reserveAgain")
|
|
1204
1715
|
}), D]
|
|
1205
1716
|
})] })
|
|
1206
1717
|
] })]
|
|
1207
1718
|
});
|
|
1208
1719
|
}
|
|
1209
|
-
function
|
|
1210
|
-
if (e?.code !== "BookingBanned") return { message: t(e?.code) };
|
|
1211
|
-
let { bannedUntil: r } = e.body ?? {};
|
|
1212
|
-
return r ? {
|
|
1213
|
-
message: "book.banned",
|
|
1214
|
-
date: z(r, n)
|
|
1215
|
-
} : { message: "book.banned.undated" };
|
|
1216
|
-
}
|
|
1217
|
-
function Fe(e) {
|
|
1720
|
+
function it(e) {
|
|
1218
1721
|
switch (e) {
|
|
1219
1722
|
case "EventFull": return "book.full";
|
|
1220
1723
|
case "SlotTaken": return "book.slotTaken";
|
|
@@ -1229,64 +1732,28 @@ function Fe(e) {
|
|
|
1229
1732
|
default: return "book.failed";
|
|
1230
1733
|
}
|
|
1231
1734
|
}
|
|
1232
|
-
function
|
|
1233
|
-
|
|
1234
|
-
case "NotAuthorized": return "book.notAllowed";
|
|
1235
|
-
case "EventStarted":
|
|
1236
|
-
case "EventNotBookable":
|
|
1237
|
-
case "BusinessNotFound": return "book.unavailable";
|
|
1238
|
-
case "CustomerOutsideBusiness": return "book.refused";
|
|
1239
|
-
default: return "book.failed";
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
function Le(e) {
|
|
1243
|
-
let { price: t, methods: n, paying: r, notice: i, expiresAt: a } = e.state, o = (e) => I(e, t.currency), s = t.advanceAmount;
|
|
1735
|
+
function at(e) {
|
|
1736
|
+
let { t, formatMoney: n, formatTime: r } = I(), { price: i, expiresAt: a } = e, o = (e) => n(e, i.currency), s = i.advanceAmount;
|
|
1244
1737
|
return /* @__PURE__ */ p(d, { children: [
|
|
1245
1738
|
/* @__PURE__ */ f("p", {
|
|
1246
1739
|
className: "cp-price",
|
|
1247
|
-
children:
|
|
1740
|
+
children: t("pay.price", { price: o(i.amount) })
|
|
1248
1741
|
}),
|
|
1249
1742
|
/* @__PURE__ */ f("p", {
|
|
1250
1743
|
className: "cp-hint",
|
|
1251
|
-
children: s === 0 ?
|
|
1744
|
+
children: s === 0 ? t("pay.later", { price: o(i.amount) }) : s === i.amount ? t("pay.whole", { advance: o(s) }) : t("pay.advance", {
|
|
1252
1745
|
advance: o(s),
|
|
1253
|
-
rest: o(
|
|
1746
|
+
rest: o(i.amount - s)
|
|
1254
1747
|
})
|
|
1255
1748
|
}),
|
|
1256
1749
|
/* @__PURE__ */ f("p", {
|
|
1257
1750
|
className: "cp-hint",
|
|
1258
|
-
children:
|
|
1259
|
-
}),
|
|
1260
|
-
i && /* @__PURE__ */ f("p", {
|
|
1261
|
-
role: "alert",
|
|
1262
|
-
children: N(i)
|
|
1263
|
-
}),
|
|
1264
|
-
r && /* @__PURE__ */ f("p", {
|
|
1265
|
-
role: "status",
|
|
1266
|
-
children: N("pay.redirecting")
|
|
1267
|
-
}),
|
|
1268
|
-
s > 0 && n.length === 0 && /* @__PURE__ */ f("p", {
|
|
1269
|
-
role: "alert",
|
|
1270
|
-
children: N("pay.none")
|
|
1271
|
-
}),
|
|
1272
|
-
/* @__PURE__ */ p("div", {
|
|
1273
|
-
className: "cp-actions",
|
|
1274
|
-
children: [s === 0 ? /* @__PURE__ */ f("button", {
|
|
1275
|
-
type: "button",
|
|
1276
|
-
disabled: r,
|
|
1277
|
-
onClick: () => e.onPay(void 0),
|
|
1278
|
-
children: N("book.confirm")
|
|
1279
|
-
}) : n.map((t) => /* @__PURE__ */ f("button", {
|
|
1280
|
-
type: "button",
|
|
1281
|
-
disabled: r,
|
|
1282
|
-
onClick: () => e.onPay(t),
|
|
1283
|
-
children: N("pay.with", { provider: t.label })
|
|
1284
|
-
}, t.id)), e.back]
|
|
1751
|
+
children: t("book.heldUntil", { time: r(a, e.timeZone) })
|
|
1285
1752
|
})
|
|
1286
1753
|
] });
|
|
1287
1754
|
}
|
|
1288
1755
|
// src/layout.tsx
|
|
1289
|
-
function
|
|
1756
|
+
function ot({ brand: e }) {
|
|
1290
1757
|
return e ? /* @__PURE__ */ p("div", {
|
|
1291
1758
|
className: "cp-brand",
|
|
1292
1759
|
children: [e.logo && /* @__PURE__ */ f("img", {
|
|
@@ -1295,39 +1762,39 @@ function Re({ brand: e }) {
|
|
|
1295
1762
|
}), /* @__PURE__ */ f("span", { children: e.name })]
|
|
1296
1763
|
}) : null;
|
|
1297
1764
|
}
|
|
1298
|
-
var
|
|
1765
|
+
var st = [["businesses", "nav.book"]], ct = [
|
|
1299
1766
|
["bookings", "nav.bookings"],
|
|
1300
1767
|
["passes", "nav.passes"],
|
|
1301
1768
|
["details", "nav.details"]
|
|
1302
|
-
],
|
|
1303
|
-
function
|
|
1304
|
-
let t = typeof e.screen == "string" ? e.screen : "businesses";
|
|
1769
|
+
], lt = [...st, ...ct];
|
|
1770
|
+
function ut(e) {
|
|
1771
|
+
let { t } = I(), n = typeof e.screen == "string" ? e.screen : "businesses";
|
|
1305
1772
|
return /* @__PURE__ */ p("div", {
|
|
1306
1773
|
className: "cp-shell",
|
|
1307
1774
|
children: [
|
|
1308
1775
|
/* @__PURE__ */ p("header", {
|
|
1309
1776
|
className: "cp-header",
|
|
1310
|
-
children: [/* @__PURE__ */ f(
|
|
1777
|
+
children: [/* @__PURE__ */ f(ot, { brand: e.brand }), e.signedIn ? /* @__PURE__ */ f("button", {
|
|
1311
1778
|
type: "button",
|
|
1312
1779
|
className: "cp-link",
|
|
1313
1780
|
onClick: e.onSignOut,
|
|
1314
|
-
children:
|
|
1781
|
+
children: t("nav.signOut")
|
|
1315
1782
|
}) : !e.signingIn && /* @__PURE__ */ f("button", {
|
|
1316
1783
|
type: "button",
|
|
1317
1784
|
className: "cp-link",
|
|
1318
1785
|
onClick: () => e.onNavigate("bookings"),
|
|
1319
|
-
children:
|
|
1786
|
+
children: t("nav.signIn")
|
|
1320
1787
|
})]
|
|
1321
1788
|
}),
|
|
1322
1789
|
/* @__PURE__ */ f("nav", {
|
|
1323
1790
|
className: "cp-nav",
|
|
1324
|
-
"aria-label":
|
|
1325
|
-
children: e.tabs.map(([
|
|
1791
|
+
"aria-label": t("nav.label"),
|
|
1792
|
+
children: e.tabs.map(([r, i]) => /* @__PURE__ */ f("button", {
|
|
1326
1793
|
type: "button",
|
|
1327
|
-
"aria-current":
|
|
1328
|
-
onClick: () => e.onNavigate(
|
|
1329
|
-
children:
|
|
1330
|
-
},
|
|
1794
|
+
"aria-current": n === r ? "page" : void 0,
|
|
1795
|
+
onClick: () => e.onNavigate(r),
|
|
1796
|
+
children: t(i)
|
|
1797
|
+
}, r))
|
|
1331
1798
|
}),
|
|
1332
1799
|
/* @__PURE__ */ f("main", {
|
|
1333
1800
|
className: "cp-main",
|
|
@@ -1336,261 +1803,148 @@ function He(e) {
|
|
|
1336
1803
|
]
|
|
1337
1804
|
});
|
|
1338
1805
|
}
|
|
1339
|
-
// src/session.ts
|
|
1340
|
-
var Ue = /* @__PURE__ */ new Map();
|
|
1341
|
-
function We(e) {
|
|
1342
|
-
let t = Ue.get(e);
|
|
1343
|
-
return t || (t = {
|
|
1344
|
-
value: void 0,
|
|
1345
|
-
listeners: /* @__PURE__ */ new Set(),
|
|
1346
|
-
generation: 0
|
|
1347
|
-
}, Ue.set(e, t)), t;
|
|
1348
|
-
}
|
|
1349
|
-
function Y(e, t) {
|
|
1350
|
-
let n = We(e);
|
|
1351
|
-
if (n.value !== t) {
|
|
1352
|
-
n.value = t;
|
|
1353
|
-
for (let e of n.listeners) e();
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
function Ge(e, t) {
|
|
1357
|
-
let { generation: n } = t, r = (r) => {
|
|
1358
|
-
t.generation === n && t.value === void 0 && Y(e, r);
|
|
1359
|
-
};
|
|
1360
|
-
T(e, "/auth/session").then(async (e) => r(e.ok ? (await e.json()).sessionKey : null)).catch(() => r(null));
|
|
1361
|
-
}
|
|
1362
|
-
function Ke(e, t) {
|
|
1363
|
-
let n = We(e);
|
|
1364
|
-
return n.listeners.size === 0 && n.value === void 0 && Ge(e, n), n.listeners.add(t), () => {
|
|
1365
|
-
n.listeners.delete(t), n.listeners.size === 0 && queueMicrotask(() => {
|
|
1366
|
-
n.listeners.size > 0 || (n.value = void 0, n.generation++);
|
|
1367
|
-
});
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
function qe(e, t) {
|
|
1371
|
-
let n = c((t) => Ke(e, t), () => We(e).value, () => void 0), i = o(void 0), a = o(t);
|
|
1372
|
-
return a.current = t, r(() => {
|
|
1373
|
-
if (n === void 0) return;
|
|
1374
|
-
let e = n !== null;
|
|
1375
|
-
i.current !== void 0 && i.current !== e && a.current?.(e), i.current = e;
|
|
1376
|
-
}, [n]), n;
|
|
1377
|
-
}
|
|
1378
|
-
// src/portal.tsx
|
|
1379
|
-
function Je(e) {
|
|
1380
|
-
let { navigate: n, accountNavigation: i } = e, c = e.basePath.replace(/\/$/, ""), l = qe(c, e.onSessionChange), u = o(!1);
|
|
1381
|
-
u.current = !!l;
|
|
1382
|
-
let [d, f] = s(), [p, m] = s(/* @__PURE__ */ new Map()), [h, g] = s("loading"), _ = a(() => D(c, () => {
|
|
1383
|
-
u.current && f("app.signedOut"), Y(c, null);
|
|
1384
|
-
}), [c]), v = t(async () => {
|
|
1385
|
-
g("loading");
|
|
1386
|
-
try {
|
|
1387
|
-
let e = /* @__PURE__ */ new Map(), t;
|
|
1388
|
-
do {
|
|
1389
|
-
let { data: n } = await _.GET("/web/businesses", { params: { query: {
|
|
1390
|
-
limit: 100,
|
|
1391
|
-
...t && { cursor: t }
|
|
1392
|
-
} } });
|
|
1393
|
-
for (let t of n?.items ?? []) e.set(t.id, t);
|
|
1394
|
-
t = n?.nextCursor ?? void 0;
|
|
1395
|
-
} while (t);
|
|
1396
|
-
m(e), g("ready");
|
|
1397
|
-
} catch {
|
|
1398
|
-
g("failed");
|
|
1399
|
-
}
|
|
1400
|
-
}, [_]);
|
|
1401
|
-
return r(() => {
|
|
1402
|
-
v();
|
|
1403
|
-
}, [v]), {
|
|
1404
|
-
basePath: c,
|
|
1405
|
-
sessionKey: l,
|
|
1406
|
-
notice: d,
|
|
1407
|
-
portal: a(() => ({
|
|
1408
|
-
client: _,
|
|
1409
|
-
basePath: c,
|
|
1410
|
-
businesses: p,
|
|
1411
|
-
businessesStatus: h,
|
|
1412
|
-
reloadBusinesses: () => void v(),
|
|
1413
|
-
navigate: n,
|
|
1414
|
-
accountNavigation: i,
|
|
1415
|
-
signOut: async (e) => {
|
|
1416
|
-
await E(c, "/auth/logout").catch(() => {}), f(e), Y(c, null);
|
|
1417
|
-
}
|
|
1418
|
-
}), [
|
|
1419
|
-
_,
|
|
1420
|
-
p,
|
|
1421
|
-
h,
|
|
1422
|
-
v,
|
|
1423
|
-
n,
|
|
1424
|
-
i,
|
|
1425
|
-
c
|
|
1426
|
-
]),
|
|
1427
|
-
signedInAs: t((e) => {
|
|
1428
|
-
f(void 0), Y(c, e);
|
|
1429
|
-
}, [c])
|
|
1430
|
-
};
|
|
1431
|
-
}
|
|
1432
|
-
function Ye(e) {
|
|
1433
|
-
let [t, n] = s(!1);
|
|
1434
|
-
return r(() => {
|
|
1435
|
-
se() && (n(!0), window.close());
|
|
1436
|
-
}, []), /* @__PURE__ */ f("div", {
|
|
1437
|
-
className: "msm-customer",
|
|
1438
|
-
children: t ? /* @__PURE__ */ f("p", {
|
|
1439
|
-
className: "cp-status",
|
|
1440
|
-
role: "status",
|
|
1441
|
-
children: N("pay.tabDone")
|
|
1442
|
-
}) : e.loading ? /* @__PURE__ */ f("p", {
|
|
1443
|
-
className: "cp-status",
|
|
1444
|
-
role: "status",
|
|
1445
|
-
children: N("app.loading")
|
|
1446
|
-
}) : /* @__PURE__ */ f(O.Provider, {
|
|
1447
|
-
value: e.portal,
|
|
1448
|
-
children: e.children
|
|
1449
|
-
})
|
|
1450
|
-
});
|
|
1451
|
-
}
|
|
1452
1806
|
// src/screens/businesses.tsx
|
|
1453
|
-
function
|
|
1454
|
-
let {
|
|
1807
|
+
function dt() {
|
|
1808
|
+
let { t: e } = I(), { businesses: t, businessesStatus: n, reloadBusinesses: r, navigate: i } = x(), a = [...t.values()];
|
|
1455
1809
|
return /* @__PURE__ */ p("section", {
|
|
1456
1810
|
className: "cp-screen",
|
|
1457
|
-
children: [/* @__PURE__ */ f("h1", { children:
|
|
1811
|
+
children: [/* @__PURE__ */ f("h1", { children: e("businesses.heading") }), n === "failed" ? /* @__PURE__ */ f(q, { onRetry: r }) : n === "loading" ? /* @__PURE__ */ f("p", {
|
|
1458
1812
|
role: "status",
|
|
1459
|
-
children:
|
|
1460
|
-
}) :
|
|
1813
|
+
children: e("app.loading")
|
|
1814
|
+
}) : a.length === 0 ? /* @__PURE__ */ f("p", {
|
|
1461
1815
|
className: "cp-empty",
|
|
1462
|
-
children:
|
|
1816
|
+
children: e("businesses.empty")
|
|
1463
1817
|
}) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
1464
1818
|
className: "cp-hint",
|
|
1465
|
-
children:
|
|
1819
|
+
children: e("businesses.intro")
|
|
1466
1820
|
}), /* @__PURE__ */ f("ul", {
|
|
1467
1821
|
className: "cp-list",
|
|
1468
|
-
children:
|
|
1822
|
+
children: a.map((t) => /* @__PURE__ */ p("li", {
|
|
1469
1823
|
className: "cp-card cp-business",
|
|
1470
1824
|
children: [
|
|
1471
|
-
/* @__PURE__ */ f(
|
|
1472
|
-
image:
|
|
1825
|
+
/* @__PURE__ */ f(J, {
|
|
1826
|
+
image: t.logo,
|
|
1473
1827
|
alt: "",
|
|
1474
1828
|
size: "small",
|
|
1475
1829
|
className: "cp-logo"
|
|
1476
1830
|
}),
|
|
1477
|
-
/* @__PURE__ */ f("h2", { children:
|
|
1478
|
-
|
|
1831
|
+
/* @__PURE__ */ f("h2", { children: t.displayName }),
|
|
1832
|
+
t.address && /* @__PURE__ */ f("p", { children: t.address }),
|
|
1479
1833
|
/* @__PURE__ */ f("button", {
|
|
1480
1834
|
type: "button",
|
|
1481
|
-
onClick: () =>
|
|
1482
|
-
children:
|
|
1835
|
+
onClick: () => i({ businessId: t.id }),
|
|
1836
|
+
children: e("businesses.open")
|
|
1483
1837
|
})
|
|
1484
1838
|
]
|
|
1485
|
-
},
|
|
1839
|
+
}, t.id))
|
|
1486
1840
|
})] })]
|
|
1487
1841
|
});
|
|
1488
1842
|
}
|
|
1489
1843
|
// src/screens/details.tsx
|
|
1490
|
-
function
|
|
1491
|
-
let {
|
|
1492
|
-
|
|
1844
|
+
function ft() {
|
|
1845
|
+
let { t: e } = I(), { client: n, signOut: i } = x(), [a, o] = s(), [c, l] = s(""), [u, m] = s(!1), [h, g] = s(!1), [_, v] = s(), y = t(async () => {
|
|
1846
|
+
m(!1);
|
|
1493
1847
|
try {
|
|
1494
|
-
let { data:
|
|
1495
|
-
|
|
1848
|
+
let { data: e } = await n.GET("/web/me");
|
|
1849
|
+
e && (o(e), l(e.name));
|
|
1496
1850
|
} catch {
|
|
1497
|
-
|
|
1851
|
+
m(!0);
|
|
1498
1852
|
}
|
|
1499
|
-
}, [
|
|
1853
|
+
}, [n]);
|
|
1500
1854
|
r(() => {
|
|
1501
|
-
|
|
1502
|
-
}, [
|
|
1503
|
-
async function
|
|
1504
|
-
|
|
1855
|
+
y();
|
|
1856
|
+
}, [y]);
|
|
1857
|
+
async function b(e) {
|
|
1858
|
+
e.preventDefault(), g(!0), v(void 0);
|
|
1505
1859
|
try {
|
|
1506
|
-
await
|
|
1860
|
+
await n.PATCH("/web/me", { body: { name: c.trim() } }), o((e) => e && {
|
|
1507
1861
|
...e,
|
|
1508
|
-
name:
|
|
1509
|
-
}), c
|
|
1862
|
+
name: c.trim()
|
|
1863
|
+
}), l(c.trim()), v({
|
|
1510
1864
|
key: "details.saved",
|
|
1511
1865
|
alert: !1
|
|
1512
1866
|
});
|
|
1513
1867
|
} catch {
|
|
1514
|
-
|
|
1868
|
+
v({
|
|
1515
1869
|
key: "details.saveFailed",
|
|
1516
1870
|
alert: !0
|
|
1517
1871
|
});
|
|
1518
1872
|
} finally {
|
|
1519
|
-
|
|
1873
|
+
g(!1);
|
|
1520
1874
|
}
|
|
1521
1875
|
}
|
|
1522
|
-
async function
|
|
1523
|
-
|
|
1876
|
+
async function S() {
|
|
1877
|
+
g(!0), v(void 0);
|
|
1524
1878
|
try {
|
|
1525
|
-
await
|
|
1879
|
+
await n.DELETE("/web/me/sessions"), await i("app.signedOutEverywhere");
|
|
1526
1880
|
} catch {
|
|
1527
|
-
|
|
1881
|
+
v({
|
|
1528
1882
|
key: "details.signOutEverywhereFailed",
|
|
1529
1883
|
alert: !0
|
|
1530
|
-
}),
|
|
1884
|
+
}), g(!1);
|
|
1531
1885
|
}
|
|
1532
1886
|
}
|
|
1533
1887
|
return /* @__PURE__ */ p("section", {
|
|
1534
1888
|
className: "cp-screen",
|
|
1535
|
-
children: [/* @__PURE__ */ f("h1", { children:
|
|
1889
|
+
children: [/* @__PURE__ */ f("h1", { children: e("details.heading") }), u ? /* @__PURE__ */ f(q, { onRetry: y }) : a ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("form", {
|
|
1536
1890
|
className: "cp-card cp-form",
|
|
1537
|
-
onSubmit:
|
|
1538
|
-
"aria-busy":
|
|
1891
|
+
onSubmit: b,
|
|
1892
|
+
"aria-busy": h,
|
|
1539
1893
|
children: [
|
|
1540
|
-
/* @__PURE__ */ p("label", { children: [
|
|
1541
|
-
value:
|
|
1542
|
-
onChange: (e) =>
|
|
1894
|
+
/* @__PURE__ */ p("label", { children: [e("details.name"), /* @__PURE__ */ f("input", {
|
|
1895
|
+
value: c,
|
|
1896
|
+
onChange: (e) => l(e.target.value),
|
|
1543
1897
|
autoComplete: "name",
|
|
1544
1898
|
maxLength: 200,
|
|
1545
1899
|
required: !0
|
|
1546
1900
|
})] }),
|
|
1547
1901
|
/* @__PURE__ */ p("dl", { children: [
|
|
1548
|
-
/* @__PURE__ */ f("dt", { children:
|
|
1549
|
-
/* @__PURE__ */ f("dd", { children:
|
|
1550
|
-
/* @__PURE__ */ f("dt", { children:
|
|
1551
|
-
/* @__PURE__ */ f("dd", { children:
|
|
1902
|
+
/* @__PURE__ */ f("dt", { children: e("details.phone") }),
|
|
1903
|
+
/* @__PURE__ */ f("dd", { children: a.phone ?? e("details.none") }),
|
|
1904
|
+
/* @__PURE__ */ f("dt", { children: e("details.email") }),
|
|
1905
|
+
/* @__PURE__ */ f("dd", { children: a.email ?? e("details.none") })
|
|
1552
1906
|
] }),
|
|
1553
1907
|
/* @__PURE__ */ f("p", {
|
|
1554
1908
|
className: "cp-hint",
|
|
1555
|
-
children:
|
|
1909
|
+
children: e("details.readOnly")
|
|
1556
1910
|
}),
|
|
1557
|
-
|
|
1558
|
-
role:
|
|
1559
|
-
children:
|
|
1911
|
+
_ && /* @__PURE__ */ f("p", {
|
|
1912
|
+
role: _.alert ? "alert" : "status",
|
|
1913
|
+
children: e(_.key)
|
|
1560
1914
|
}),
|
|
1561
1915
|
/* @__PURE__ */ f("button", {
|
|
1562
1916
|
type: "submit",
|
|
1563
|
-
disabled:
|
|
1564
|
-
children:
|
|
1917
|
+
disabled: h || !c.trim() || c.trim() === a.name,
|
|
1918
|
+
children: e(h ? "details.saving" : "details.save")
|
|
1565
1919
|
})
|
|
1566
1920
|
]
|
|
1567
1921
|
}), /* @__PURE__ */ p("div", {
|
|
1568
1922
|
className: "cp-card cp-form",
|
|
1569
1923
|
children: [/* @__PURE__ */ f("p", {
|
|
1570
1924
|
className: "cp-hint",
|
|
1571
|
-
children:
|
|
1925
|
+
children: e("details.signOutEverywhereHint")
|
|
1572
1926
|
}), /* @__PURE__ */ f("button", {
|
|
1573
1927
|
type: "button",
|
|
1574
1928
|
className: "cp-secondary",
|
|
1575
|
-
disabled:
|
|
1576
|
-
onClick:
|
|
1577
|
-
children:
|
|
1929
|
+
disabled: h,
|
|
1930
|
+
onClick: S,
|
|
1931
|
+
children: e("details.signOutEverywhere")
|
|
1578
1932
|
})]
|
|
1579
1933
|
})] }) : /* @__PURE__ */ f("p", {
|
|
1580
1934
|
role: "status",
|
|
1581
|
-
children:
|
|
1935
|
+
children: e("app.loading")
|
|
1582
1936
|
})]
|
|
1583
1937
|
});
|
|
1584
1938
|
}
|
|
1585
1939
|
// src/screens/shop.tsx
|
|
1586
|
-
var
|
|
1587
|
-
function
|
|
1588
|
-
let e = new URL(window.location.href), t = e.searchParams.get(
|
|
1940
|
+
var pt = "/web/businesses/{businessId}/products/{productId}/checkout", Z = "msmPurchase", mt = "msm-purchase";
|
|
1941
|
+
function ht() {
|
|
1942
|
+
let e = new URL(window.location.href), t = e.searchParams.get(Z);
|
|
1589
1943
|
if (t !== "paid" && t !== "back") return null;
|
|
1590
|
-
e.searchParams.delete(
|
|
1944
|
+
e.searchParams.delete(Z), window.history.replaceState(window.history.state, "", e.toString());
|
|
1591
1945
|
try {
|
|
1592
|
-
let e = window.sessionStorage.getItem(
|
|
1593
|
-
return window.sessionStorage.removeItem(
|
|
1946
|
+
let e = window.sessionStorage.getItem(mt);
|
|
1947
|
+
return window.sessionStorage.removeItem(mt), e ? {
|
|
1594
1948
|
outcome: t,
|
|
1595
1949
|
purchase: JSON.parse(e)
|
|
1596
1950
|
} : null;
|
|
@@ -1598,111 +1952,111 @@ function et() {
|
|
|
1598
1952
|
return null;
|
|
1599
1953
|
}
|
|
1600
1954
|
}
|
|
1601
|
-
function
|
|
1955
|
+
function gt(e, t) {
|
|
1602
1956
|
let n = o(!1);
|
|
1603
1957
|
r(() => {
|
|
1604
|
-
n.current || (n.current = !0, e !== "passes" && !
|
|
1958
|
+
n.current || (n.current = !0, e !== "passes" && !me() && new URL(window.location.href).searchParams.has(Z) && t("passes"));
|
|
1605
1959
|
}, [e, t]);
|
|
1606
1960
|
}
|
|
1607
|
-
function
|
|
1608
|
-
let {
|
|
1961
|
+
function _t() {
|
|
1962
|
+
let { t: e, formatMoney: n } = I(), { client: i, basePath: a, businesses: c, businessesStatus: l } = x(), [m, h] = s([]), [g, _] = s(!1), [v, y] = s();
|
|
1609
1963
|
r(() => {
|
|
1610
|
-
if (
|
|
1611
|
-
let
|
|
1612
|
-
return Promise.all([...
|
|
1613
|
-
let
|
|
1614
|
-
return a.length ? (
|
|
1615
|
-
business:
|
|
1616
|
-
product:
|
|
1964
|
+
if (l !== "ready") return;
|
|
1965
|
+
let e = !0;
|
|
1966
|
+
return Promise.all([...c.values()].map(async (e) => {
|
|
1967
|
+
let t = { params: { path: { businessId: e.id } } }, [n, r] = await Promise.all([i.GET("/web/businesses/{businessId}/products", t), i.GET("/web/businesses/{businessId}/payment-methods", t)]).catch(() => [void 0, void 0]), a = r?.data?.items ?? [];
|
|
1968
|
+
return a.length ? (n?.data?.items ?? []).map((t) => ({
|
|
1969
|
+
business: e,
|
|
1970
|
+
product: t,
|
|
1617
1971
|
methods: a
|
|
1618
1972
|
})) : [];
|
|
1619
|
-
})).then((
|
|
1620
|
-
|
|
1973
|
+
})).then((t) => {
|
|
1974
|
+
e && h(t.flat());
|
|
1621
1975
|
}), () => {
|
|
1622
|
-
|
|
1976
|
+
e = !1;
|
|
1623
1977
|
};
|
|
1624
1978
|
}, [
|
|
1625
|
-
e,
|
|
1626
1979
|
i,
|
|
1627
|
-
|
|
1980
|
+
c,
|
|
1981
|
+
l
|
|
1628
1982
|
]);
|
|
1629
|
-
let
|
|
1630
|
-
r(() => (
|
|
1631
|
-
|
|
1983
|
+
let b = o(!0), S = o(0);
|
|
1984
|
+
r(() => (b.current = !0, () => {
|
|
1985
|
+
b.current = !1;
|
|
1632
1986
|
}), []);
|
|
1633
|
-
let
|
|
1634
|
-
|
|
1635
|
-
message:
|
|
1636
|
-
link:
|
|
1987
|
+
let C = t(async (e, t, n) => {
|
|
1988
|
+
y(n ? {
|
|
1989
|
+
message: n.opened ? "shop.away" : "pay.awayBlocked",
|
|
1990
|
+
link: n.redirectUrl
|
|
1637
1991
|
} : { message: "pay.checking" });
|
|
1638
|
-
let
|
|
1992
|
+
let r = n && Date.now() + 9e5, a = ++S.current, o = () => b.current && S.current === a;
|
|
1639
1993
|
for (let a = 0; o(); a++) {
|
|
1640
|
-
let { data: s } = await
|
|
1994
|
+
let { data: s } = await i.GET(pt, { params: { path: t } }).catch(() => ({ data: void 0 }));
|
|
1641
1995
|
if (!o()) return;
|
|
1642
|
-
if (!s &&
|
|
1643
|
-
await
|
|
1996
|
+
if (!s && r && Date.now() <= r) {
|
|
1997
|
+
await he(3e3);
|
|
1644
1998
|
continue;
|
|
1645
1999
|
}
|
|
1646
|
-
if (s?.status === "paid") return
|
|
2000
|
+
if (s?.status === "paid") return y({ message: "shop.paid" });
|
|
1647
2001
|
let c = s?.payment?.status === "FAILED" || s?.payment?.status === "EXPIRED";
|
|
1648
|
-
if (!s || c) return
|
|
2002
|
+
if (!s || c) return y({
|
|
1649
2003
|
message: "shop.notPaid",
|
|
1650
2004
|
alert: !0
|
|
1651
2005
|
});
|
|
1652
|
-
if (
|
|
1653
|
-
if (
|
|
1654
|
-
await
|
|
2006
|
+
if (e === "back") return y({ message: "shop.notFinished" });
|
|
2007
|
+
if (r ? Date.now() > r : a >= 15) return y({ message: "shop.slow" });
|
|
2008
|
+
await he(n ? 3e3 : 2e3);
|
|
1655
2009
|
}
|
|
1656
|
-
}, [
|
|
2010
|
+
}, [i]), w = o(!1);
|
|
1657
2011
|
r(() => {
|
|
1658
|
-
if (
|
|
1659
|
-
|
|
1660
|
-
let e =
|
|
1661
|
-
e &&
|
|
1662
|
-
}, [
|
|
1663
|
-
async function
|
|
1664
|
-
let
|
|
1665
|
-
|
|
1666
|
-
let
|
|
1667
|
-
businessId:
|
|
1668
|
-
productId:
|
|
2012
|
+
if (w.current) return;
|
|
2013
|
+
w.current = !0;
|
|
2014
|
+
let e = ht();
|
|
2015
|
+
e && C(e.outcome, e.purchase);
|
|
2016
|
+
}, [C]);
|
|
2017
|
+
async function T(e, t) {
|
|
2018
|
+
let n = fe(a);
|
|
2019
|
+
S.current++, _(!0), y(void 0);
|
|
2020
|
+
let r = {
|
|
2021
|
+
businessId: e.business.id,
|
|
2022
|
+
productId: e.product.id
|
|
1669
2023
|
};
|
|
1670
2024
|
try {
|
|
1671
|
-
let { data:
|
|
1672
|
-
params: { path:
|
|
2025
|
+
let { data: e } = await i.POST(pt, {
|
|
2026
|
+
params: { path: r },
|
|
1673
2027
|
body: {
|
|
1674
|
-
paymentMethodId:
|
|
1675
|
-
successUrl:
|
|
1676
|
-
cancelUrl:
|
|
2028
|
+
paymentMethodId: t.id,
|
|
2029
|
+
successUrl: B(Z, "paid", n),
|
|
2030
|
+
cancelUrl: B(Z, "back", n)
|
|
1677
2031
|
}
|
|
1678
|
-
}),
|
|
1679
|
-
if (
|
|
1680
|
-
if (!
|
|
2032
|
+
}), a = e?.payment?.redirectUrl;
|
|
2033
|
+
if (e?.status !== "paid" && a || z(n), e?.status === "paid") return y({ message: "shop.paid" });
|
|
2034
|
+
if (!a) return y({
|
|
1681
2035
|
message: "pay.unavailable",
|
|
1682
2036
|
alert: !0
|
|
1683
2037
|
});
|
|
1684
|
-
if (
|
|
1685
|
-
|
|
1686
|
-
redirectUrl:
|
|
1687
|
-
opened: !!
|
|
2038
|
+
if (n) {
|
|
2039
|
+
pe(n, a), C("paid", r, {
|
|
2040
|
+
redirectUrl: a,
|
|
2041
|
+
opened: !!n.window
|
|
1688
2042
|
});
|
|
1689
2043
|
return;
|
|
1690
2044
|
}
|
|
1691
2045
|
try {
|
|
1692
|
-
window.sessionStorage.setItem(
|
|
2046
|
+
window.sessionStorage.setItem(mt, JSON.stringify(r));
|
|
1693
2047
|
} catch {}
|
|
1694
|
-
|
|
1695
|
-
} catch (
|
|
1696
|
-
|
|
1697
|
-
let
|
|
1698
|
-
|
|
2048
|
+
y({ message: "pay.redirecting" }), pe(n, a);
|
|
2049
|
+
} catch (t) {
|
|
2050
|
+
z(n);
|
|
2051
|
+
let r = u(t, "post", pt) ? t.code : void 0;
|
|
2052
|
+
y(r === "CustomerOutsideBusiness" ? {
|
|
1699
2053
|
message: "shop.outside",
|
|
1700
|
-
business:
|
|
2054
|
+
business: e.business.displayName,
|
|
1701
2055
|
alert: !0
|
|
1702
|
-
} :
|
|
2056
|
+
} : r === "ProductInactive" || r === "ProductNotFound" ? {
|
|
1703
2057
|
message: "shop.gone",
|
|
1704
2058
|
alert: !0
|
|
1705
|
-
} :
|
|
2059
|
+
} : r === "PaymentProviderNotOffered" || r === "PaymentProviderNotConnected" ? {
|
|
1706
2060
|
message: "pay.notOffered",
|
|
1707
2061
|
alert: !0
|
|
1708
2062
|
} : {
|
|
@@ -1710,129 +2064,389 @@ function nt() {
|
|
|
1710
2064
|
alert: !0
|
|
1711
2065
|
});
|
|
1712
2066
|
} finally {
|
|
1713
|
-
|
|
2067
|
+
_(!1);
|
|
1714
2068
|
}
|
|
1715
2069
|
}
|
|
1716
|
-
return !
|
|
2070
|
+
return !m.length && !v ? null : /* @__PURE__ */ p(d, { children: [
|
|
1717
2071
|
/* @__PURE__ */ f("h2", {
|
|
1718
2072
|
className: "cp-section",
|
|
1719
|
-
children:
|
|
2073
|
+
children: e("shop.heading")
|
|
1720
2074
|
}),
|
|
1721
|
-
|
|
1722
|
-
role:
|
|
1723
|
-
className:
|
|
1724
|
-
children:
|
|
2075
|
+
v && /* @__PURE__ */ f("p", {
|
|
2076
|
+
role: v.alert ? "alert" : "status",
|
|
2077
|
+
className: v.alert ? void 0 : "cp-notice",
|
|
2078
|
+
children: e(v.message, { business: v.business ?? "" })
|
|
1725
2079
|
}),
|
|
1726
|
-
|
|
2080
|
+
v?.link && /* @__PURE__ */ f("div", {
|
|
1727
2081
|
className: "cp-actions",
|
|
1728
2082
|
children: /* @__PURE__ */ f("a", {
|
|
1729
2083
|
className: "cp-button",
|
|
1730
|
-
href:
|
|
2084
|
+
href: v.link,
|
|
1731
2085
|
target: "_blank",
|
|
1732
2086
|
rel: "noopener",
|
|
1733
|
-
children:
|
|
2087
|
+
children: e("pay.open")
|
|
1734
2088
|
})
|
|
1735
2089
|
}),
|
|
1736
2090
|
/* @__PURE__ */ f("ul", {
|
|
1737
2091
|
className: "cp-list",
|
|
1738
|
-
children:
|
|
2092
|
+
children: m.map((t) => /* @__PURE__ */ p("li", {
|
|
1739
2093
|
className: "cp-card",
|
|
1740
2094
|
children: [
|
|
1741
2095
|
/* @__PURE__ */ p("div", {
|
|
1742
2096
|
className: "cp-card-head",
|
|
1743
|
-
children: [/* @__PURE__ */ f("h2", { children:
|
|
2097
|
+
children: [/* @__PURE__ */ f("h2", { children: t.product.title }), /* @__PURE__ */ f("span", {
|
|
1744
2098
|
className: "cp-price",
|
|
1745
|
-
children:
|
|
2099
|
+
children: n(t.product.price, t.product.currency)
|
|
1746
2100
|
})]
|
|
1747
2101
|
}),
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
2102
|
+
c.size > 1 && /* @__PURE__ */ f("p", { children: t.business.displayName }),
|
|
2103
|
+
t.product.description && /* @__PURE__ */ f("p", { children: t.product.description }),
|
|
2104
|
+
t.product.terms && /* @__PURE__ */ f("p", {
|
|
1751
2105
|
className: "cp-hint",
|
|
1752
|
-
children:
|
|
2106
|
+
children: t.product.terms
|
|
1753
2107
|
}),
|
|
1754
2108
|
/* @__PURE__ */ f("div", {
|
|
1755
2109
|
className: "cp-actions",
|
|
1756
|
-
children:
|
|
2110
|
+
children: t.methods.map((n) => /* @__PURE__ */ f("button", {
|
|
1757
2111
|
type: "button",
|
|
1758
|
-
disabled:
|
|
1759
|
-
onClick: () =>
|
|
1760
|
-
children:
|
|
1761
|
-
},
|
|
2112
|
+
disabled: g,
|
|
2113
|
+
onClick: () => T(t, n),
|
|
2114
|
+
children: e("shop.buy", { provider: n.label })
|
|
2115
|
+
}, n.id))
|
|
1762
2116
|
})
|
|
1763
2117
|
]
|
|
1764
|
-
},
|
|
2118
|
+
}, t.product.id))
|
|
1765
2119
|
})
|
|
1766
2120
|
] });
|
|
1767
2121
|
}
|
|
1768
2122
|
// src/screens/passes.tsx
|
|
1769
|
-
function
|
|
1770
|
-
let {
|
|
1771
|
-
|
|
2123
|
+
function vt() {
|
|
2124
|
+
let { t: e, formatDate: n } = I(), { client: i, businesses: a } = x(), [o, c] = s(), [l, u] = s(!1), d = t(async () => {
|
|
2125
|
+
u(!1);
|
|
1772
2126
|
try {
|
|
1773
|
-
let { data:
|
|
1774
|
-
|
|
2127
|
+
let { data: e } = await i.GET("/web/me/memberships");
|
|
2128
|
+
e && c(e);
|
|
1775
2129
|
} catch {
|
|
1776
|
-
|
|
2130
|
+
u(!0);
|
|
1777
2131
|
}
|
|
1778
|
-
}, [
|
|
2132
|
+
}, [i]);
|
|
1779
2133
|
return r(() => {
|
|
1780
|
-
|
|
1781
|
-
}, [
|
|
2134
|
+
d();
|
|
2135
|
+
}, [d]), /* @__PURE__ */ p("section", {
|
|
1782
2136
|
className: "cp-screen",
|
|
1783
2137
|
children: [
|
|
1784
|
-
/* @__PURE__ */ f("h1", { children:
|
|
1785
|
-
|
|
2138
|
+
/* @__PURE__ */ f("h1", { children: e("passes.heading") }),
|
|
2139
|
+
l ? /* @__PURE__ */ f(q, { onRetry: d }) : o ? o.length === 0 ? /* @__PURE__ */ f("p", {
|
|
1786
2140
|
className: "cp-empty",
|
|
1787
|
-
children:
|
|
2141
|
+
children: e("passes.empty")
|
|
1788
2142
|
}) : /* @__PURE__ */ f("ul", {
|
|
1789
2143
|
className: "cp-list",
|
|
1790
|
-
children:
|
|
1791
|
-
let
|
|
2144
|
+
children: o.map((t) => {
|
|
2145
|
+
let r = a.get(t.businessId), i = r?.timezone, o = t.validUntil !== null && Date.parse(t.validUntil) <= Date.now();
|
|
1792
2146
|
return /* @__PURE__ */ p("li", {
|
|
1793
2147
|
className: "cp-card",
|
|
1794
2148
|
children: [
|
|
1795
2149
|
/* @__PURE__ */ p("div", {
|
|
1796
2150
|
className: "cp-card-head",
|
|
1797
|
-
children: [/* @__PURE__ */ f("h2", { children:
|
|
2151
|
+
children: [/* @__PURE__ */ f("h2", { children: t.displayName }), o && /* @__PURE__ */ f("span", {
|
|
1798
2152
|
className: "cp-badge",
|
|
1799
|
-
children:
|
|
2153
|
+
children: e("passes.expired")
|
|
1800
2154
|
})]
|
|
1801
2155
|
}),
|
|
1802
|
-
|
|
2156
|
+
r && /* @__PURE__ */ f("p", { children: r.displayName }),
|
|
1803
2157
|
/* @__PURE__ */ f("p", {
|
|
1804
2158
|
className: "cp-credits",
|
|
1805
|
-
children:
|
|
1806
|
-
remaining:
|
|
1807
|
-
total:
|
|
2159
|
+
children: t.creditsRemaining === null || t.creditsTotal === null ? e("passes.unlimited") : e("passes.credits", {
|
|
2160
|
+
remaining: t.creditsRemaining,
|
|
2161
|
+
total: t.creditsTotal
|
|
1808
2162
|
})
|
|
1809
2163
|
}),
|
|
1810
2164
|
/* @__PURE__ */ f("p", {
|
|
1811
2165
|
className: "cp-hint",
|
|
1812
|
-
children:
|
|
1813
|
-
from:
|
|
1814
|
-
until:
|
|
1815
|
-
}) :
|
|
2166
|
+
children: t.validUntil ? e("passes.validRange", {
|
|
2167
|
+
from: n(t.validFrom, i),
|
|
2168
|
+
until: n(t.validUntil, i)
|
|
2169
|
+
}) : e("passes.validFrom", { date: n(t.validFrom, i) })
|
|
1816
2170
|
})
|
|
1817
2171
|
]
|
|
1818
|
-
},
|
|
2172
|
+
}, t.id);
|
|
1819
2173
|
})
|
|
1820
2174
|
}) : /* @__PURE__ */ f("p", {
|
|
1821
2175
|
role: "status",
|
|
1822
|
-
children:
|
|
2176
|
+
children: e("app.loading")
|
|
1823
2177
|
}),
|
|
1824
|
-
/* @__PURE__ */ f(
|
|
2178
|
+
/* @__PURE__ */ f(_t, {})
|
|
1825
2179
|
]
|
|
1826
2180
|
});
|
|
1827
2181
|
}
|
|
1828
2182
|
// ../ui/dist/index.js
|
|
1829
|
-
var
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
2183
|
+
var yt = {
|
|
2184
|
+
AC: "Ascension-eyja",
|
|
2185
|
+
AD: "Andorra",
|
|
2186
|
+
AE: "Sameinuðu arabísku furstadæmin",
|
|
2187
|
+
AF: "Afganistan",
|
|
2188
|
+
AG: "Antígva og Barbúda",
|
|
2189
|
+
AI: "Angvilla",
|
|
2190
|
+
AL: "Albanía",
|
|
2191
|
+
AM: "Armenía",
|
|
2192
|
+
AO: "Angóla",
|
|
2193
|
+
AR: "Argentína",
|
|
2194
|
+
AS: "Bandaríska Samóa",
|
|
2195
|
+
AT: "Austurríki",
|
|
2196
|
+
AU: "Ástralía",
|
|
2197
|
+
AW: "Arúba",
|
|
2198
|
+
AX: "Álandseyjar",
|
|
2199
|
+
AZ: "Aserbaídsjan",
|
|
2200
|
+
BA: "Bosnía og Hersegóvína",
|
|
2201
|
+
BB: "Barbados",
|
|
2202
|
+
BD: "Bangladess",
|
|
2203
|
+
BE: "Belgía",
|
|
2204
|
+
BF: "Búrkína Fasó",
|
|
2205
|
+
BG: "Búlgaría",
|
|
2206
|
+
BH: "Barein",
|
|
2207
|
+
BI: "Búrúndí",
|
|
2208
|
+
BJ: "Benín",
|
|
2209
|
+
BL: "Sankti Bartólómeusareyjar",
|
|
2210
|
+
BM: "Bermúdaeyjar",
|
|
2211
|
+
BN: "Brúnei",
|
|
2212
|
+
BO: "Bólivía",
|
|
2213
|
+
BQ: "Karíbahafshluti Hollands",
|
|
2214
|
+
BR: "Brasilía",
|
|
2215
|
+
BS: "Bahamaeyjar",
|
|
2216
|
+
BT: "Bútan",
|
|
2217
|
+
BW: "Botsvana",
|
|
2218
|
+
BY: "Hvíta-Rússland",
|
|
2219
|
+
BZ: "Belís",
|
|
2220
|
+
CA: "Kanada",
|
|
2221
|
+
CC: "Kókoseyjar (Keeling)",
|
|
2222
|
+
CD: "Kongó-Kinshasa",
|
|
2223
|
+
CF: "Mið-Afríkulýðveldið",
|
|
2224
|
+
CG: "Kongó-Brazzaville",
|
|
2225
|
+
CH: "Sviss",
|
|
2226
|
+
CI: "Fílabeinsströndin",
|
|
2227
|
+
CK: "Cooks-eyjar",
|
|
2228
|
+
CL: "Síle",
|
|
2229
|
+
CM: "Kamerún",
|
|
2230
|
+
CN: "Kína",
|
|
2231
|
+
CO: "Kólumbía",
|
|
2232
|
+
CR: "Kostaríka",
|
|
2233
|
+
CU: "Kúba",
|
|
2234
|
+
CV: "Grænhöfðaeyjar",
|
|
2235
|
+
CW: "Curacao",
|
|
2236
|
+
CX: "Jólaey",
|
|
2237
|
+
CY: "Kýpur",
|
|
2238
|
+
CZ: "Tékkland",
|
|
2239
|
+
DE: "Þýskaland",
|
|
2240
|
+
DJ: "Djíbútí",
|
|
2241
|
+
DK: "Danmörk",
|
|
2242
|
+
DM: "Dóminíka",
|
|
2243
|
+
DO: "Dóminíska lýðveldið",
|
|
2244
|
+
DZ: "Alsír",
|
|
2245
|
+
EC: "Ekvador",
|
|
2246
|
+
EE: "Eistland",
|
|
2247
|
+
EG: "Egyptaland",
|
|
2248
|
+
EH: "Vestur-Sahara",
|
|
2249
|
+
ER: "Erítrea",
|
|
2250
|
+
ES: "Spánn",
|
|
2251
|
+
ET: "Eþíópía",
|
|
2252
|
+
FI: "Finnland",
|
|
2253
|
+
FJ: "Fídjíeyjar",
|
|
2254
|
+
FK: "Falklandseyjar",
|
|
2255
|
+
FM: "Míkrónesía",
|
|
2256
|
+
FO: "Færeyjar",
|
|
2257
|
+
FR: "Frakkland",
|
|
2258
|
+
GA: "Gabon",
|
|
2259
|
+
GB: "Bretland",
|
|
2260
|
+
GD: "Grenada",
|
|
2261
|
+
GE: "Georgía",
|
|
2262
|
+
GF: "Franska Gvæjana",
|
|
2263
|
+
GG: "Guernsey",
|
|
2264
|
+
GH: "Gana",
|
|
2265
|
+
GI: "Gíbraltar",
|
|
2266
|
+
GL: "Grænland",
|
|
2267
|
+
GM: "Gambía",
|
|
2268
|
+
GN: "Gínea",
|
|
2269
|
+
GP: "Gvadelúpeyjar",
|
|
2270
|
+
GQ: "Miðbaugs-Gínea",
|
|
2271
|
+
GR: "Grikkland",
|
|
2272
|
+
GT: "Gvatemala",
|
|
2273
|
+
GU: "Gvam",
|
|
2274
|
+
GW: "Gínea-Bissá",
|
|
2275
|
+
GY: "Gvæjana",
|
|
2276
|
+
HK: "Hong Kong",
|
|
2277
|
+
HN: "Hondúras",
|
|
2278
|
+
HR: "Króatía",
|
|
2279
|
+
HT: "Haítí",
|
|
2280
|
+
HU: "Ungverjaland",
|
|
2281
|
+
ID: "Indónesía",
|
|
2282
|
+
IE: "Írland",
|
|
2283
|
+
IL: "Ísrael",
|
|
2284
|
+
IM: "Mön",
|
|
2285
|
+
IN: "Indland",
|
|
2286
|
+
IO: "Bresku Indlandshafseyjar",
|
|
2287
|
+
IQ: "Írak",
|
|
2288
|
+
IR: "Íran",
|
|
2289
|
+
IS: "Ísland",
|
|
2290
|
+
IT: "Ítalía",
|
|
2291
|
+
JE: "Jersey",
|
|
2292
|
+
JM: "Jamaíka",
|
|
2293
|
+
JO: "Jórdanía",
|
|
2294
|
+
JP: "Japan",
|
|
2295
|
+
KE: "Kenía",
|
|
2296
|
+
KG: "Kirgistan",
|
|
2297
|
+
KH: "Kambódía",
|
|
2298
|
+
KI: "Kíribatí",
|
|
2299
|
+
KM: "Kómoreyjar",
|
|
2300
|
+
KN: "Sankti Kitts og Nevis",
|
|
2301
|
+
KP: "Norður-Kórea",
|
|
2302
|
+
KR: "Suður-Kórea",
|
|
2303
|
+
KW: "Kúveit",
|
|
2304
|
+
KY: "Caymaneyjar",
|
|
2305
|
+
KZ: "Kasakstan",
|
|
2306
|
+
LA: "Laos",
|
|
2307
|
+
LB: "Líbanon",
|
|
2308
|
+
LC: "Sankti Lúsía",
|
|
2309
|
+
LI: "Liechtenstein",
|
|
2310
|
+
LK: "Srí Lanka",
|
|
2311
|
+
LR: "Líbería",
|
|
2312
|
+
LS: "Lesótó",
|
|
2313
|
+
LT: "Litháen",
|
|
2314
|
+
LU: "Lúxemborg",
|
|
2315
|
+
LV: "Lettland",
|
|
2316
|
+
LY: "Líbía",
|
|
2317
|
+
MA: "Marokkó",
|
|
2318
|
+
MC: "Mónakó",
|
|
2319
|
+
MD: "Moldóva",
|
|
2320
|
+
ME: "Svartfjallaland",
|
|
2321
|
+
MF: "Saint-Martin",
|
|
2322
|
+
MG: "Madagaskar",
|
|
2323
|
+
MH: "Marshalleyjar",
|
|
2324
|
+
MK: "Norður-Makedónía",
|
|
2325
|
+
ML: "Malí",
|
|
2326
|
+
MM: "Mjanmar (Búrma)",
|
|
2327
|
+
MN: "Mongólía",
|
|
2328
|
+
MO: "Makaó",
|
|
2329
|
+
MP: "Norður-Maríanaeyjar",
|
|
2330
|
+
MQ: "Martiník",
|
|
2331
|
+
MR: "Máritanía",
|
|
2332
|
+
MS: "Montserrat",
|
|
2333
|
+
MT: "Malta",
|
|
2334
|
+
MU: "Máritíus",
|
|
2335
|
+
MV: "Maldíveyjar",
|
|
2336
|
+
MW: "Malaví",
|
|
2337
|
+
MX: "Mexíkó",
|
|
2338
|
+
MY: "Malasía",
|
|
2339
|
+
MZ: "Mósambík",
|
|
2340
|
+
NA: "Namibía",
|
|
2341
|
+
NC: "Nýja-Kaledónía",
|
|
2342
|
+
NE: "Níger",
|
|
2343
|
+
NF: "Norfolkeyja",
|
|
2344
|
+
NG: "Nígería",
|
|
2345
|
+
NI: "Níkaragva",
|
|
2346
|
+
NL: "Holland",
|
|
2347
|
+
NO: "Noregur",
|
|
2348
|
+
NP: "Nepal",
|
|
2349
|
+
NR: "Nárú",
|
|
2350
|
+
NU: "Niue",
|
|
2351
|
+
NZ: "Nýja-Sjáland",
|
|
2352
|
+
OM: "Óman",
|
|
2353
|
+
PA: "Panama",
|
|
2354
|
+
PE: "Perú",
|
|
2355
|
+
PF: "Franska Pólýnesía",
|
|
2356
|
+
PG: "Papúa Nýja-Gínea",
|
|
2357
|
+
PH: "Filippseyjar",
|
|
2358
|
+
PK: "Pakistan",
|
|
2359
|
+
PL: "Pólland",
|
|
2360
|
+
PM: "Sankti Pierre og Miquelon",
|
|
2361
|
+
PR: "Púertó Ríkó",
|
|
2362
|
+
PS: "Heimastjórnarsvæði Palestínumanna",
|
|
2363
|
+
PT: "Portúgal",
|
|
2364
|
+
PW: "Palá",
|
|
2365
|
+
PY: "Paragvæ",
|
|
2366
|
+
QA: "Katar",
|
|
2367
|
+
RE: "Réunion",
|
|
2368
|
+
RO: "Rúmenía",
|
|
2369
|
+
RS: "Serbía",
|
|
2370
|
+
RU: "Rússland",
|
|
2371
|
+
RW: "Rúanda",
|
|
2372
|
+
SA: "Sádi-Arabía",
|
|
2373
|
+
SB: "Salómonseyjar",
|
|
2374
|
+
SC: "Seychelles-eyjar",
|
|
2375
|
+
SD: "Súdan",
|
|
2376
|
+
SE: "Svíþjóð",
|
|
2377
|
+
SG: "Singapúr",
|
|
2378
|
+
SH: "Sankti Helena",
|
|
2379
|
+
SI: "Slóvenía",
|
|
2380
|
+
SJ: "Svalbarði og Jan Mayen",
|
|
2381
|
+
SK: "Slóvakía",
|
|
2382
|
+
SL: "Síerra Leóne",
|
|
2383
|
+
SM: "San Marínó",
|
|
2384
|
+
SN: "Senegal",
|
|
2385
|
+
SO: "Sómalía",
|
|
2386
|
+
SR: "Súrínam",
|
|
2387
|
+
SS: "Suður-Súdan",
|
|
2388
|
+
ST: "Saó Tóme og Prinsípe",
|
|
2389
|
+
SV: "El Salvador",
|
|
2390
|
+
SX: "Sint Maarten",
|
|
2391
|
+
SY: "Sýrland",
|
|
2392
|
+
SZ: "Esvatíní",
|
|
2393
|
+
TA: "Tristan da Cunha",
|
|
2394
|
+
TC: "Turks- og Caicoseyjar",
|
|
2395
|
+
TD: "Tsjad",
|
|
2396
|
+
TG: "Tógó",
|
|
2397
|
+
TH: "Taíland",
|
|
2398
|
+
TJ: "Tadsíkistan",
|
|
2399
|
+
TK: "Tókelá",
|
|
2400
|
+
TL: "Tímor-Leste",
|
|
2401
|
+
TM: "Túrkmenistan",
|
|
2402
|
+
TN: "Túnis",
|
|
2403
|
+
TO: "Tonga",
|
|
2404
|
+
TR: "Tyrkland",
|
|
2405
|
+
TT: "Trínidad og Tóbagó",
|
|
2406
|
+
TV: "Túvalú",
|
|
2407
|
+
TW: "Taívan",
|
|
2408
|
+
TZ: "Tansanía",
|
|
2409
|
+
UA: "Úkraína",
|
|
2410
|
+
UG: "Úganda",
|
|
2411
|
+
US: "Bandaríkin",
|
|
2412
|
+
UY: "Úrúgvæ",
|
|
2413
|
+
UZ: "Úsbekistan",
|
|
2414
|
+
VA: "Vatíkanið",
|
|
2415
|
+
VC: "Sankti Vinsent og Grenadíneyjar",
|
|
2416
|
+
VE: "Venesúela",
|
|
2417
|
+
VG: "Bresku Jómfrúaeyjar",
|
|
2418
|
+
VI: "Bandarísku Jómfrúaeyjar",
|
|
2419
|
+
VN: "Víetnam",
|
|
2420
|
+
VU: "Vanúatú",
|
|
2421
|
+
WF: "Wallis- og Fútúnaeyjar",
|
|
2422
|
+
WS: "Samóa",
|
|
2423
|
+
XK: "Kósóvó",
|
|
2424
|
+
YE: "Jemen",
|
|
2425
|
+
YT: "Mayotte",
|
|
2426
|
+
ZA: "Suður-Afríka",
|
|
2427
|
+
ZM: "Sambía",
|
|
2428
|
+
ZW: "Simbabve"
|
|
2429
|
+
}, bt = (e) => e.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().trim();
|
|
2430
|
+
function xt(e) {
|
|
2431
|
+
let t = new Intl.DisplayNames(["en"], { type: "region" }), n = (n) => (e === "is" ? yt[n] : void 0) ?? t.of(n) ?? n;
|
|
2432
|
+
return h().map((e) => ({
|
|
2433
|
+
code: e,
|
|
2434
|
+
name: n(e),
|
|
2435
|
+
callingCode: g(e),
|
|
2436
|
+
flag: String.fromCodePoint(...[...e].map((e) => 127397 + e.charCodeAt(0)))
|
|
2437
|
+
})).sort(e === "is" ? (e, t) => St(Ct(e.name), Ct(t.name)) : (e, t) => e.name.localeCompare(t.name, "en"));
|
|
2438
|
+
}
|
|
2439
|
+
var St = (e, t) => e < t ? -1 : +(e > t);
|
|
2440
|
+
function Ct(e) {
|
|
2441
|
+
return e.toLowerCase().replace(/[áðéíóúý]/g, (e) => `${"adeiouy"["áðéíóúý".indexOf(e)]}~`).replace(/[þæö]/g, (e) => "{|}".charAt("þæö".indexOf(e))).normalize("NFD").replace(/\p{M}/gu, "");
|
|
2442
|
+
}
|
|
2443
|
+
var wt = xt("en"), Tt = /* @__PURE__ */ new Map([["en", wt]]);
|
|
2444
|
+
function Et(e) {
|
|
2445
|
+
let t = Tt.get(e);
|
|
2446
|
+
return t || (t = xt(e), Tt.set(e, t)), t;
|
|
2447
|
+
}
|
|
2448
|
+
var Dt = new Map(wt.map((e) => [e.code, e])), Ot = (e) => Dt.get(e);
|
|
2449
|
+
function kt(e) {
|
|
1836
2450
|
let t = i(), n = o(null), a = o(null), c = o(null), [l, u] = s(""), d = e.search(l), m = () => n.current?.close(), h = (t) => {
|
|
1837
2451
|
m(), e.onPick(t);
|
|
1838
2452
|
};
|
|
@@ -1855,7 +2469,7 @@ function ct(e) {
|
|
|
1855
2469
|
}), /* @__PURE__ */ f("button", {
|
|
1856
2470
|
type: "button",
|
|
1857
2471
|
onClick: m,
|
|
1858
|
-
children: "Close"
|
|
2472
|
+
children: e.closeLabel ?? "Close"
|
|
1859
2473
|
})]
|
|
1860
2474
|
}),
|
|
1861
2475
|
/* @__PURE__ */ f("input", {
|
|
@@ -1906,10 +2520,37 @@ function ct(e) {
|
|
|
1906
2520
|
]
|
|
1907
2521
|
});
|
|
1908
2522
|
}
|
|
1909
|
-
var
|
|
1910
|
-
|
|
2523
|
+
var At = {
|
|
2524
|
+
en: {
|
|
2525
|
+
required: "Enter a phone number.",
|
|
2526
|
+
unknownCode: "Unknown country code. Choose the country from the list.",
|
|
2527
|
+
digits: (e, t) => `Enter a ${t}-digit number for ${e}.`,
|
|
2528
|
+
digitRange: (e, t, n) => `Enter ${t} to ${n} digits for ${e}.`,
|
|
2529
|
+
digitList: (e, t, n) => `Enter ${t.join(", ")} or ${n} digits for ${e}.`,
|
|
2530
|
+
invalid: (e) => `This is not a valid number for ${e}.`,
|
|
2531
|
+
countryCode: "Country code",
|
|
2532
|
+
search: "Search by country or code",
|
|
2533
|
+
countries: "Countries",
|
|
2534
|
+
empty: (e) => `No country matches “${e}”.`,
|
|
2535
|
+
close: "Close"
|
|
2536
|
+
},
|
|
2537
|
+
is: {
|
|
2538
|
+
required: "Sláðu inn símanúmer.",
|
|
2539
|
+
unknownCode: "Óþekkt landsnúmer. Veldu landið af listanum.",
|
|
2540
|
+
digits: (e, t) => `${e}: sláðu inn ${t} stafa númer.`,
|
|
2541
|
+
digitRange: (e, t, n) => `${e}: sláðu inn ${t} til ${n} stafa númer.`,
|
|
2542
|
+
digitList: (e, t, n) => `${e}: sláðu inn ${t.join(", ")} eða ${n} stafa númer.`,
|
|
2543
|
+
invalid: (e) => `${e}: þetta er ekki gilt símanúmer.`,
|
|
2544
|
+
countryCode: "Landsnúmer",
|
|
2545
|
+
search: "Leita eftir landi eða landsnúmeri",
|
|
2546
|
+
countries: "Lönd",
|
|
2547
|
+
empty: (e) => `Ekkert land passar við „${e}“.`,
|
|
2548
|
+
close: "Loka"
|
|
2549
|
+
}
|
|
2550
|
+
}, jt = (e, t) => (Et(t).find((t) => t.code === e) ?? Nt(e)).name, Mt = new m(), Nt = (e) => Ot(e);
|
|
2551
|
+
function Pt(e) {
|
|
1911
2552
|
for (let t = 1; t <= 3 && t <= e.length; t++) {
|
|
1912
|
-
let n = e.slice(0, t), r = (y.country_calling_codes[n] ?? []).filter((e) =>
|
|
2553
|
+
let n = e.slice(0, t), r = (y.country_calling_codes[n] ?? []).filter((e) => Ot(e) !== void 0), [i] = r;
|
|
1913
2554
|
if (i) return {
|
|
1914
2555
|
code: n,
|
|
1915
2556
|
first: i,
|
|
@@ -1918,10 +2559,10 @@ function dt(e) {
|
|
|
1918
2559
|
}
|
|
1919
2560
|
return null;
|
|
1920
2561
|
}
|
|
1921
|
-
function
|
|
2562
|
+
function Ft(e, t) {
|
|
1922
2563
|
let n = /^\s*(\+|00)/.exec(e);
|
|
1923
2564
|
if (!n) return null;
|
|
1924
|
-
let r = e.slice(n[0].length), i = r.replace(/\D/g, ""), a =
|
|
2565
|
+
let r = e.slice(n[0].length), i = r.replace(/\D/g, ""), a = Pt(i);
|
|
1925
2566
|
if (!a) return null;
|
|
1926
2567
|
let o = _(`+${i}`), s = a.countries.includes(t) ? t : o?.country ?? a.first, c = 0;
|
|
1927
2568
|
for (let e = 0; e < a.code.length; c++) /\d/.test(r.charAt(c)) && e++;
|
|
@@ -1930,45 +2571,46 @@ function ft(e, t) {
|
|
|
1930
2571
|
text: o?.isValid() ? o.formatNational() : r.slice(c).replace(/^[\s\-().]+/, "")
|
|
1931
2572
|
};
|
|
1932
2573
|
}
|
|
1933
|
-
function
|
|
2574
|
+
function It(e, t) {
|
|
1934
2575
|
let n = t.replace(/\D/g, "");
|
|
1935
|
-
return n === "" ? "" : t.trim().startsWith("+") ? `+${n}` : _(t, e)?.number ?? `+${
|
|
1936
|
-
}
|
|
1937
|
-
function
|
|
1938
|
-
return
|
|
1939
|
-
}
|
|
1940
|
-
function
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
2576
|
+
return n === "" ? "" : t.trim().startsWith("+") ? `+${n}` : _(t, e)?.number ?? `+${Nt(e).callingCode}${n}`;
|
|
2577
|
+
}
|
|
2578
|
+
function Lt(e) {
|
|
2579
|
+
return Mt.selectNumberingPlan(e), Mt.numberingPlan?.possibleLengths() ?? [];
|
|
2580
|
+
}
|
|
2581
|
+
function Rt(e, t, n, r) {
|
|
2582
|
+
let i = At[n];
|
|
2583
|
+
if (e === "") return t ? i.required : "";
|
|
2584
|
+
let a = _(e);
|
|
2585
|
+
if (a?.isValid()) return "";
|
|
2586
|
+
let o = e.replace(/\D/g, ""), s = Pt(o);
|
|
2587
|
+
if (!s) return i.unknownCode;
|
|
2588
|
+
let c = r && s.countries.includes(r) ? r : a?.country ?? s.first, l = jt(c, n), u = v(o.slice(s.code.length), c);
|
|
2589
|
+
if (u && u !== "NOT_A_NUMBER") {
|
|
2590
|
+
let e = Lt(c), t = e[0] ?? 0, n = e[e.length - 1] ?? 0;
|
|
2591
|
+
return e.length === 1 ? i.digits(l, t) : e.length > 2 && n - t === e.length - 1 ? i.digitRange(l, t, n) : i.digitList(l, e.slice(0, -1), n);
|
|
1950
2592
|
}
|
|
1951
|
-
return
|
|
2593
|
+
return i.invalid(l);
|
|
1952
2594
|
}
|
|
1953
|
-
function
|
|
1954
|
-
return
|
|
2595
|
+
function zt(e, t = !1, n = "en") {
|
|
2596
|
+
return Rt(e, t, n);
|
|
1955
2597
|
}
|
|
1956
|
-
function
|
|
1957
|
-
return
|
|
2598
|
+
function Bt(e, t) {
|
|
2599
|
+
return Ft(e, t) ?? {
|
|
1958
2600
|
country: t,
|
|
1959
2601
|
text: e
|
|
1960
2602
|
};
|
|
1961
2603
|
}
|
|
1962
|
-
function
|
|
2604
|
+
function Vt(e) {
|
|
1963
2605
|
let t = i(), n = o(null), [a, c] = s(() => ({
|
|
1964
2606
|
value: e.value,
|
|
1965
|
-
...
|
|
2607
|
+
...Bt(e.value, "IS")
|
|
1966
2608
|
})), l = a;
|
|
1967
2609
|
e.value !== a.value && (l = {
|
|
1968
2610
|
value: e.value,
|
|
1969
|
-
...
|
|
2611
|
+
...Bt(e.value, a.country)
|
|
1970
2612
|
}, c(l));
|
|
1971
|
-
let [u, d] = s(!1), [m, h] = s(!1), g =
|
|
2613
|
+
let [u, d] = s(!1), [m, h] = s(!1), g = e.locale ?? "en", _ = At[g], v = Nt(l.country), y = Rt(l.value, e.required ?? !1, g, l.country), b = u && y !== "" ? y : e.error ?? "", x = b !== "";
|
|
1972
2614
|
r(() => {
|
|
1973
2615
|
let e = n.current?.form;
|
|
1974
2616
|
if (!e) return;
|
|
@@ -1977,8 +2619,8 @@ function vt(e) {
|
|
|
1977
2619
|
};
|
|
1978
2620
|
return e.addEventListener("submit", t), () => e.removeEventListener("submit", t);
|
|
1979
2621
|
}, []);
|
|
1980
|
-
let
|
|
1981
|
-
let r =
|
|
2622
|
+
let S = (t, n) => {
|
|
2623
|
+
let r = It(t, n);
|
|
1982
2624
|
c({
|
|
1983
2625
|
value: r,
|
|
1984
2626
|
country: t,
|
|
@@ -1997,16 +2639,16 @@ function vt(e) {
|
|
|
1997
2639
|
children: [/* @__PURE__ */ p("button", {
|
|
1998
2640
|
type: "button",
|
|
1999
2641
|
className: "msm-phone-country",
|
|
2000
|
-
"aria-label":
|
|
2642
|
+
"aria-label": `${_.countryCode}: ${jt(v.code, g)} +${v.callingCode}`,
|
|
2001
2643
|
"aria-haspopup": "dialog",
|
|
2002
2644
|
onClick: () => h(!0),
|
|
2003
2645
|
children: [
|
|
2004
2646
|
/* @__PURE__ */ f("span", {
|
|
2005
2647
|
"aria-hidden": "true",
|
|
2006
|
-
children:
|
|
2648
|
+
children: v.flag
|
|
2007
2649
|
}),
|
|
2008
2650
|
"+",
|
|
2009
|
-
|
|
2651
|
+
v.callingCode
|
|
2010
2652
|
]
|
|
2011
2653
|
}), /* @__PURE__ */ f("input", {
|
|
2012
2654
|
ref: n,
|
|
@@ -2017,49 +2659,50 @@ function vt(e) {
|
|
|
2017
2659
|
autoComplete: e.autoComplete ?? "tel",
|
|
2018
2660
|
value: l.text,
|
|
2019
2661
|
"aria-required": e.required,
|
|
2020
|
-
"data-msm-phone-problem":
|
|
2021
|
-
"aria-invalid":
|
|
2022
|
-
"aria-describedby":
|
|
2662
|
+
"data-msm-phone-problem": y === "" ? void 0 : "",
|
|
2663
|
+
"aria-invalid": x || void 0,
|
|
2664
|
+
"aria-describedby": x ? `${t}-problem` : void 0,
|
|
2023
2665
|
onChange: (e) => {
|
|
2024
|
-
let t = e.target.value.replace(/[^\d\s\-().+]/g, ""), n =
|
|
2025
|
-
|
|
2666
|
+
let t = e.target.value.replace(/[^\d\s\-().+]/g, ""), n = Ft(t, l.country);
|
|
2667
|
+
S(n?.country ?? l.country, n?.text ?? t);
|
|
2026
2668
|
},
|
|
2027
2669
|
onBlur: () => {
|
|
2028
2670
|
l.text.trim() !== "" && d(!0);
|
|
2029
2671
|
}
|
|
2030
2672
|
})]
|
|
2031
2673
|
}),
|
|
2032
|
-
|
|
2674
|
+
x && /* @__PURE__ */ f("p", {
|
|
2033
2675
|
id: `${t}-problem`,
|
|
2034
2676
|
className: "msm-phone-problem",
|
|
2035
2677
|
role: "alert",
|
|
2036
|
-
children:
|
|
2678
|
+
children: b
|
|
2037
2679
|
}),
|
|
2038
|
-
m && /* @__PURE__ */ f(
|
|
2039
|
-
title:
|
|
2040
|
-
searchLabel:
|
|
2041
|
-
listLabel:
|
|
2042
|
-
empty:
|
|
2043
|
-
|
|
2680
|
+
m && /* @__PURE__ */ f(kt, {
|
|
2681
|
+
title: _.countryCode,
|
|
2682
|
+
searchLabel: _.search,
|
|
2683
|
+
listLabel: _.countries,
|
|
2684
|
+
empty: _.empty,
|
|
2685
|
+
closeLabel: _.close,
|
|
2686
|
+
search: (e) => Ht(e, g),
|
|
2044
2687
|
selected: l.country,
|
|
2045
2688
|
onClose: () => h(!1),
|
|
2046
2689
|
onPick: (e) => {
|
|
2047
|
-
h(!1),
|
|
2690
|
+
h(!1), S(e, l.text), n.current?.focus();
|
|
2048
2691
|
}
|
|
2049
2692
|
})
|
|
2050
2693
|
]
|
|
2051
2694
|
});
|
|
2052
2695
|
}
|
|
2053
|
-
function
|
|
2054
|
-
let t =
|
|
2055
|
-
return (
|
|
2696
|
+
function Ht(e, t) {
|
|
2697
|
+
let n = Et(t), r = bt(e).replace(/^(\+|00)/, "");
|
|
2698
|
+
return (r === "" ? n : /^\d+$/.test(r) ? n.filter((e) => e.callingCode.startsWith(r)) : n.filter((e) => bt(e.name).includes(r) || e.code.toLowerCase() === r)).map((e) => ({
|
|
2056
2699
|
value: e.code,
|
|
2057
2700
|
label: e.name,
|
|
2058
2701
|
hint: `+${e.callingCode}`,
|
|
2059
2702
|
flag: e.flag
|
|
2060
2703
|
}));
|
|
2061
2704
|
}
|
|
2062
|
-
var
|
|
2705
|
+
var Ut = {
|
|
2063
2706
|
red: {
|
|
2064
2707
|
light: "#d14b4b",
|
|
2065
2708
|
dark: "#f07a7a"
|
|
@@ -2109,36 +2752,36 @@ var bt = {
|
|
|
2109
2752
|
dark: "#9aa5b5"
|
|
2110
2753
|
}
|
|
2111
2754
|
};
|
|
2112
|
-
function
|
|
2113
|
-
let { light: t, dark: n } =
|
|
2755
|
+
function Wt(e) {
|
|
2756
|
+
let { light: t, dark: n } = Ut[e in Ut ? e : "slate"];
|
|
2114
2757
|
return `light-dark(${t}, ${n})`;
|
|
2115
2758
|
}
|
|
2116
2759
|
// src/bot-check.tsx
|
|
2117
|
-
var
|
|
2118
|
-
function
|
|
2119
|
-
let e =
|
|
2120
|
-
return e ? Promise.resolve(e) : (
|
|
2760
|
+
var Gt = () => window.turnstile, Kt = "https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit", qt;
|
|
2761
|
+
function Jt() {
|
|
2762
|
+
let e = Gt();
|
|
2763
|
+
return e ? Promise.resolve(e) : (qt ??= new Promise((e, t) => {
|
|
2121
2764
|
let n = document.createElement("script");
|
|
2122
|
-
n.src =
|
|
2765
|
+
n.src = Kt, n.async = !0;
|
|
2123
2766
|
let r = () => {
|
|
2124
|
-
|
|
2767
|
+
qt = void 0, n.remove(), t(/* @__PURE__ */ Error("Turnstile did not load."));
|
|
2125
2768
|
};
|
|
2126
2769
|
n.onload = () => {
|
|
2127
|
-
let t =
|
|
2770
|
+
let t = Gt();
|
|
2128
2771
|
t ? e(t) : r();
|
|
2129
2772
|
}, n.onerror = r, document.head.append(n);
|
|
2130
|
-
}),
|
|
2773
|
+
}), qt);
|
|
2131
2774
|
}
|
|
2132
|
-
function
|
|
2775
|
+
function Yt(e) {
|
|
2133
2776
|
return e?.provider === "turnstile" && typeof e.siteKey == "string" && e.siteKey.trim() !== "";
|
|
2134
2777
|
}
|
|
2135
|
-
function
|
|
2778
|
+
function Xt(e) {
|
|
2136
2779
|
let t = o(null), n = o(void 0), i = o(e);
|
|
2137
2780
|
i.current = e;
|
|
2138
2781
|
let { siteKey: a } = e.botCheck;
|
|
2139
2782
|
r(() => {
|
|
2140
2783
|
let e = !0;
|
|
2141
|
-
return
|
|
2784
|
+
return Jt().then((r) => {
|
|
2142
2785
|
let o = t.current;
|
|
2143
2786
|
if (!e || !o) return;
|
|
2144
2787
|
let s = r.render(o, {
|
|
@@ -2171,162 +2814,170 @@ function Dt(e) {
|
|
|
2171
2814
|
}
|
|
2172
2815
|
// src/sign-in.tsx
|
|
2173
2816
|
function Q(e) {
|
|
2174
|
-
let t = o(null),
|
|
2817
|
+
let { t, formatWait: n, locale: i } = I(), a = o(null), c = e.autoFocus;
|
|
2175
2818
|
r(() => {
|
|
2176
|
-
|
|
2177
|
-
}, [
|
|
2178
|
-
let [
|
|
2819
|
+
c && a.current?.querySelector("input")?.focus();
|
|
2820
|
+
}, [c]);
|
|
2821
|
+
let [l, u] = s("phone"), [m, h] = s(""), [g, _] = s(""), [v, y] = s(""), [b, x] = s(), [S, C] = s(), [w, T] = s(!1), [E, D] = s(), [O, k] = s(0), A = Yt(e.botCheck) ? e.botCheck : void 0, [j, M] = s();
|
|
2179
2822
|
r(() => {
|
|
2180
|
-
if (!
|
|
2823
|
+
if (!j) return;
|
|
2181
2824
|
let e = setTimeout(() => {
|
|
2182
|
-
|
|
2183
|
-
},
|
|
2825
|
+
M(void 0), C((e) => e === j.message ? void 0 : e);
|
|
2826
|
+
}, j.seconds * 1e3);
|
|
2184
2827
|
return () => clearTimeout(e);
|
|
2185
|
-
}, [
|
|
2186
|
-
function
|
|
2187
|
-
|
|
2828
|
+
}, [j]);
|
|
2829
|
+
function N(e) {
|
|
2830
|
+
u("phone"), x(void 0), y(""), h(""), C(e);
|
|
2188
2831
|
}
|
|
2189
|
-
async function
|
|
2190
|
-
if (t.preventDefault(), (
|
|
2191
|
-
|
|
2832
|
+
async function P(t) {
|
|
2833
|
+
if (t.preventDefault(), (l !== "phone" || !zt(g, !0) && A && E) && (l !== "name" || m.trim())) {
|
|
2834
|
+
T(!0), C(void 0);
|
|
2192
2835
|
try {
|
|
2193
|
-
let t =
|
|
2194
|
-
phone:
|
|
2195
|
-
botCheckToken:
|
|
2196
|
-
}) :
|
|
2197
|
-
challenge:
|
|
2198
|
-
code:
|
|
2199
|
-
}) : await
|
|
2836
|
+
let t = l === "phone" ? await R(e.basePath, "/auth/initiate", {
|
|
2837
|
+
phone: g,
|
|
2838
|
+
botCheckToken: E
|
|
2839
|
+
}) : l === "code" ? await R(e.basePath, "/auth/login", {
|
|
2840
|
+
challenge: b,
|
|
2841
|
+
code: v
|
|
2842
|
+
}) : await R(e.basePath, "/auth/register", { name: m.trim() });
|
|
2200
2843
|
if (t.ok) {
|
|
2201
2844
|
let n = await t.json();
|
|
2202
|
-
|
|
2845
|
+
l === "phone" ? (x(n.challenge), u("code")) : n.result === "nameRequired" ? u("name") : e.onSignedIn(n.sessionKey);
|
|
2203
2846
|
return;
|
|
2204
2847
|
}
|
|
2205
2848
|
let n = await t.json().catch(() => void 0);
|
|
2206
|
-
if (
|
|
2207
|
-
|
|
2849
|
+
if (l === "name" && t.status === 401) {
|
|
2850
|
+
N({ key: "register.error.expired" });
|
|
2208
2851
|
return;
|
|
2209
2852
|
}
|
|
2210
|
-
let r = Number(t.headers.get("retry-after")),
|
|
2211
|
-
t.status === 429 &&
|
|
2212
|
-
phone:
|
|
2213
|
-
seconds:
|
|
2214
|
-
message:
|
|
2215
|
-
}),
|
|
2853
|
+
let r = Number(t.headers.get("retry-after")), i = Number.isInteger(r) && r > 0 ? r : void 0, a = Zt(t.status, n?.code, i, l);
|
|
2854
|
+
t.status === 429 && i && l === "phone" && M({
|
|
2855
|
+
phone: g,
|
|
2856
|
+
seconds: i,
|
|
2857
|
+
message: a
|
|
2858
|
+
}), C(a);
|
|
2216
2859
|
} catch {
|
|
2217
|
-
|
|
2860
|
+
C({ key: "signIn.error.unreachable" });
|
|
2218
2861
|
} finally {
|
|
2219
|
-
|
|
2862
|
+
T(!1), l === "phone" && k((e) => e + 1);
|
|
2220
2863
|
}
|
|
2221
2864
|
}
|
|
2222
2865
|
}
|
|
2223
2866
|
return /* @__PURE__ */ f("div", {
|
|
2224
2867
|
className: "cp-sign-in",
|
|
2225
2868
|
children: /* @__PURE__ */ p("form", {
|
|
2226
|
-
ref:
|
|
2227
|
-
onSubmit:
|
|
2228
|
-
"aria-busy":
|
|
2869
|
+
ref: a,
|
|
2870
|
+
onSubmit: P,
|
|
2871
|
+
"aria-busy": w,
|
|
2229
2872
|
children: [
|
|
2230
|
-
/* @__PURE__ */ f(
|
|
2231
|
-
/* @__PURE__ */ f("h1", { children:
|
|
2873
|
+
/* @__PURE__ */ f(ot, { brand: e.brand }),
|
|
2874
|
+
/* @__PURE__ */ f("h1", { children: t("signIn.heading") }),
|
|
2232
2875
|
e.children,
|
|
2233
|
-
e.notice &&
|
|
2876
|
+
e.notice && l === "phone" && /* @__PURE__ */ f("p", {
|
|
2234
2877
|
role: "status",
|
|
2235
2878
|
className: "cp-notice",
|
|
2236
|
-
children:
|
|
2879
|
+
children: t(e.notice)
|
|
2237
2880
|
}),
|
|
2238
|
-
|
|
2239
|
-
value:
|
|
2240
|
-
onChange: (e) =>
|
|
2881
|
+
l === "name" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", { children: t("register.intro") }), /* @__PURE__ */ p("label", { children: [t("register.name"), /* @__PURE__ */ f("input", {
|
|
2882
|
+
value: m,
|
|
2883
|
+
onChange: (e) => h(e.target.value),
|
|
2241
2884
|
autoComplete: "name",
|
|
2242
2885
|
maxLength: 200,
|
|
2243
2886
|
required: !0,
|
|
2244
2887
|
autoFocus: !0
|
|
2245
|
-
})] })] }) :
|
|
2246
|
-
value:
|
|
2247
|
-
onChange: (e) =>
|
|
2888
|
+
})] })] }) : l === "code" ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", { children: t("signIn.codeSent", { phone: g }) }), /* @__PURE__ */ p("label", { children: [t("signIn.code"), /* @__PURE__ */ f("input", {
|
|
2889
|
+
value: v,
|
|
2890
|
+
onChange: (e) => y(e.target.value),
|
|
2248
2891
|
inputMode: "numeric",
|
|
2249
2892
|
autoComplete: "one-time-code",
|
|
2250
2893
|
required: !0,
|
|
2251
2894
|
autoFocus: !0
|
|
2252
2895
|
})] })] }) : /* @__PURE__ */ p(d, { children: [
|
|
2253
|
-
/* @__PURE__ */ f("p", { children:
|
|
2254
|
-
/* @__PURE__ */ f(
|
|
2255
|
-
label:
|
|
2256
|
-
value:
|
|
2257
|
-
onChange:
|
|
2258
|
-
required: !0
|
|
2896
|
+
/* @__PURE__ */ f("p", { children: t("signIn.intro") }),
|
|
2897
|
+
/* @__PURE__ */ f(Vt, {
|
|
2898
|
+
label: t("signIn.phone"),
|
|
2899
|
+
value: g,
|
|
2900
|
+
onChange: _,
|
|
2901
|
+
required: !0,
|
|
2902
|
+
locale: i
|
|
2259
2903
|
}),
|
|
2260
|
-
|
|
2261
|
-
botCheck:
|
|
2262
|
-
attempt:
|
|
2263
|
-
onToken:
|
|
2264
|
-
onUnavailable: () =>
|
|
2904
|
+
A && /* @__PURE__ */ f(Xt, {
|
|
2905
|
+
botCheck: A,
|
|
2906
|
+
attempt: O,
|
|
2907
|
+
onToken: D,
|
|
2908
|
+
onUnavailable: () => C({ key: "signIn.error.botCheckUnavailable" })
|
|
2265
2909
|
})
|
|
2266
2910
|
] }),
|
|
2267
|
-
|
|
2911
|
+
l === "phone" && !A && /* @__PURE__ */ f("p", {
|
|
2268
2912
|
role: "alert",
|
|
2269
|
-
children:
|
|
2913
|
+
children: t("signIn.error.notConfigured")
|
|
2270
2914
|
}),
|
|
2271
|
-
|
|
2915
|
+
S && /* @__PURE__ */ f("p", {
|
|
2272
2916
|
role: "alert",
|
|
2273
|
-
children:
|
|
2917
|
+
children: t(S.key, S.wait ? { wait: n(S.wait) } : {})
|
|
2274
2918
|
}),
|
|
2275
2919
|
/* @__PURE__ */ f("button", {
|
|
2276
2920
|
type: "submit",
|
|
2277
|
-
disabled:
|
|
2278
|
-
children:
|
|
2921
|
+
disabled: w || l === "phone" && (!A || !E || j?.phone === g),
|
|
2922
|
+
children: t(w ? "signIn.wait" : l === "phone" ? "signIn.sendCode" : l === "code" ? "signIn.submit" : "register.submit")
|
|
2279
2923
|
}),
|
|
2280
|
-
|
|
2924
|
+
l !== "phone" && /* @__PURE__ */ f("button", {
|
|
2281
2925
|
type: "button",
|
|
2282
2926
|
className: "cp-secondary",
|
|
2283
|
-
onClick: () =>
|
|
2284
|
-
children:
|
|
2927
|
+
onClick: () => N(),
|
|
2928
|
+
children: t("signIn.differentNumber")
|
|
2285
2929
|
}),
|
|
2286
2930
|
e.onCancel && /* @__PURE__ */ f("button", {
|
|
2287
2931
|
type: "button",
|
|
2288
2932
|
className: "cp-secondary",
|
|
2289
2933
|
onClick: e.onCancel,
|
|
2290
|
-
children:
|
|
2934
|
+
children: t("signIn.cancel")
|
|
2291
2935
|
})
|
|
2292
2936
|
]
|
|
2293
2937
|
})
|
|
2294
2938
|
});
|
|
2295
2939
|
}
|
|
2296
|
-
function
|
|
2297
|
-
if (e === 429) return n ?
|
|
2298
|
-
|
|
2940
|
+
function Zt(e, t, n, r) {
|
|
2941
|
+
if (e === 429) return n ? {
|
|
2942
|
+
key: "signIn.error.tooMany",
|
|
2943
|
+
wait: n
|
|
2944
|
+
} : { key: "signIn.error.tooManyLater" };
|
|
2945
|
+
if (r === "name" && (e === 400 || e === 422)) return { key: "register.error.name" };
|
|
2299
2946
|
let i = r === "phone";
|
|
2300
|
-
return i && e === 403 && t === "BotCheckFailed" ?
|
|
2947
|
+
return i && e === 403 && t === "BotCheckFailed" ? { key: "signIn.error.botCheck" } : i && e === 503 && t === "BotCheckUnavailable" ? { key: "signIn.error.botCheckUnavailable" } : i && e === 503 && (t === "LimiterUnavailable" || t === "ClientIpUnavailable") ? { key: "signIn.error.failed" } : i && e === 503 ? n ? {
|
|
2948
|
+
key: "signIn.error.paused",
|
|
2949
|
+
wait: n
|
|
2950
|
+
} : { key: "signIn.error.pausedLater" } : i && e === 422 && t === "PhoneDestinationNotAllowed" ? { key: "signIn.error.destination" } : r === "code" && [
|
|
2301
2951
|
400,
|
|
2302
2952
|
401,
|
|
2303
2953
|
403,
|
|
2304
2954
|
404,
|
|
2305
2955
|
409
|
|
2306
|
-
].includes(e) ?
|
|
2956
|
+
].includes(e) ? { key: "signIn.error.badCode" } : e === 400 ? { key: "signIn.error.invalid" } : e === 403 ? { key: "signIn.error.refused" } : { key: "signIn.error.failed" };
|
|
2307
2957
|
}
|
|
2308
2958
|
// src/account.tsx
|
|
2309
|
-
function
|
|
2959
|
+
function Qt(e) {
|
|
2310
2960
|
let [n, r] = s("bookings"), i = e.screen ?? n, a = e.onNavigate ?? r, o = t((e) => {
|
|
2311
2961
|
(e === "bookings" || e === "passes" || e === "details") && a(e);
|
|
2312
|
-
}, [a]), { basePath: c, sessionKey: l, notice: u, portal: d, signedInAs: p } =
|
|
2962
|
+
}, [a]), { basePath: c, sessionKey: l, notice: u, portal: d, signedInAs: p } = H({
|
|
2313
2963
|
basePath: e.basePath,
|
|
2314
2964
|
navigate: o,
|
|
2315
2965
|
accountNavigation: !0,
|
|
2316
2966
|
onSessionChange: e.onSessionChange
|
|
2317
2967
|
});
|
|
2318
|
-
return
|
|
2968
|
+
return gt(i, o), /* @__PURE__ */ f(U, {
|
|
2319
2969
|
portal: d,
|
|
2320
2970
|
loading: l === void 0,
|
|
2321
|
-
|
|
2971
|
+
locale: e.locale,
|
|
2972
|
+
children: /* @__PURE__ */ f(ut, {
|
|
2322
2973
|
brand: e.brand,
|
|
2323
|
-
tabs:
|
|
2974
|
+
tabs: ct,
|
|
2324
2975
|
screen: i,
|
|
2325
2976
|
signedIn: !!l,
|
|
2326
2977
|
signingIn: !l,
|
|
2327
2978
|
onNavigate: o,
|
|
2328
2979
|
onSignOut: () => d.signOut(),
|
|
2329
|
-
children: l ? f(i === "passes" ?
|
|
2980
|
+
children: l ? f(i === "passes" ? vt : i === "details" ? ft : Pe, {}) : /* @__PURE__ */ f(Q, {
|
|
2330
2981
|
basePath: c,
|
|
2331
2982
|
brand: void 0,
|
|
2332
2983
|
botCheck: e.botCheck,
|
|
@@ -2338,7 +2989,7 @@ function kt(e) {
|
|
|
2338
2989
|
});
|
|
2339
2990
|
}
|
|
2340
2991
|
// src/booking-flow.tsx
|
|
2341
|
-
function
|
|
2992
|
+
function $t(e) {
|
|
2342
2993
|
return {
|
|
2343
2994
|
startsAt: e.startsAt,
|
|
2344
2995
|
eventTypeId: e.eventTypeId,
|
|
@@ -2354,121 +3005,121 @@ function $(e) {
|
|
|
2354
3005
|
e.resourceId ?? ""
|
|
2355
3006
|
].join("|") : "";
|
|
2356
3007
|
}
|
|
2357
|
-
function
|
|
3008
|
+
function en(e, t) {
|
|
2358
3009
|
return t.eventId ? e.eventId === t.eventId : e.eventTypeId === t.eventTypeId && Date.parse(e.startsAt) === Date.parse(t.startsAt) && (!t.resourceId || e.resource?.id === t.resourceId);
|
|
2359
3010
|
}
|
|
2360
|
-
function
|
|
2361
|
-
let n = e.onChange !== void 0,
|
|
3011
|
+
function tn(e) {
|
|
3012
|
+
let { t: n } = P(e.locale), i = e.onChange !== void 0, a = {
|
|
2362
3013
|
businessId: e.businessId,
|
|
2363
3014
|
...e.eventTypeId && { eventTypeId: e.eventTypeId },
|
|
2364
3015
|
...e.resourceId && { resourceId: e.resourceId },
|
|
2365
3016
|
...e.all && { all: !0 },
|
|
2366
3017
|
...e.all && e.allFrom && { allFrom: e.allFrom },
|
|
2367
3018
|
...e.time && { time: e.time }
|
|
2368
|
-
},
|
|
3019
|
+
}, o = [
|
|
2369
3020
|
e.businessId,
|
|
2370
3021
|
e.eventTypeId ?? "",
|
|
2371
3022
|
e.resourceId ?? "",
|
|
2372
3023
|
e.all ? "all" : "",
|
|
2373
3024
|
e.allFrom ? `${e.allFrom.eventTypeId}~${e.allFrom.resourceId ?? ""}` : "",
|
|
2374
3025
|
$(e.time)
|
|
2375
|
-
].join("/"), [
|
|
2376
|
-
!
|
|
2377
|
-
let
|
|
2378
|
-
typeof e == "object" &&
|
|
3026
|
+
].join("/"), [c, l] = s(a), [u, m] = s(o);
|
|
3027
|
+
!i && u !== o && (m(o), l(a));
|
|
3028
|
+
let h = i ? a : c, g = e.onChange, _ = t((e) => (g ?? l)(e), [g]), v = t((e) => {
|
|
3029
|
+
typeof e == "object" && _({
|
|
2379
3030
|
businessId: e.businessId,
|
|
2380
3031
|
...e.eventTypeId && { eventTypeId: e.eventTypeId }
|
|
2381
3032
|
});
|
|
2382
|
-
}, [
|
|
3033
|
+
}, [_]), { basePath: y, sessionKey: b, notice: x, portal: S, signedInAs: C } = H({
|
|
2383
3034
|
basePath: e.basePath,
|
|
2384
|
-
navigate:
|
|
3035
|
+
navigate: v,
|
|
2385
3036
|
accountNavigation: !1,
|
|
2386
3037
|
onSessionChange: e.onSessionChange
|
|
2387
|
-
})
|
|
3038
|
+
});
|
|
2388
3039
|
r(() => {
|
|
2389
|
-
let t =
|
|
2390
|
-
t
|
|
2391
|
-
}, [
|
|
2392
|
-
let [
|
|
2393
|
-
|
|
2394
|
-
let { time: e, ...t } =
|
|
2395
|
-
|
|
2396
|
-
},
|
|
2397
|
-
|
|
3040
|
+
let t = nt();
|
|
3041
|
+
t?.businessId === e.businessId && t.time && _(t);
|
|
3042
|
+
}, [_, e.businessId]);
|
|
3043
|
+
let [w, T] = s(), [E, D] = s(), O = h.time, k = $(O), A = w && O && w.business.id === h.businessId && $($t(w.candidate)) === k ? w : void 0, j = () => {
|
|
3044
|
+
T(void 0);
|
|
3045
|
+
let { time: e, ...t } = h;
|
|
3046
|
+
_(t);
|
|
3047
|
+
}, M = (e, t) => {
|
|
3048
|
+
T({
|
|
2398
3049
|
business: e,
|
|
2399
3050
|
candidate: t
|
|
2400
|
-
}),
|
|
2401
|
-
...
|
|
2402
|
-
time:
|
|
3051
|
+
}), _({
|
|
3052
|
+
...h,
|
|
3053
|
+
time: $t(t)
|
|
2403
3054
|
});
|
|
2404
|
-
},
|
|
2405
|
-
|
|
2406
|
-
choice:
|
|
2407
|
-
onBack:
|
|
3055
|
+
}, N;
|
|
3056
|
+
N = A ? b ? /* @__PURE__ */ f(rt, {
|
|
3057
|
+
choice: A,
|
|
3058
|
+
onBack: j,
|
|
2408
3059
|
onBooked: e.onBooked,
|
|
2409
3060
|
onDone: e.onClose,
|
|
2410
|
-
onLeave: () =>
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
basePath: v,
|
|
3061
|
+
onLeave: () => tt(h)
|
|
3062
|
+
}, `${A.candidate.startsAt}-${A.candidate.eventId ?? A.candidate.eventTypeId}`) : /* @__PURE__ */ p(Q, {
|
|
3063
|
+
basePath: y,
|
|
2414
3064
|
brand: e.brand,
|
|
2415
3065
|
botCheck: e.botCheck,
|
|
2416
|
-
notice:
|
|
2417
|
-
onSignedIn:
|
|
3066
|
+
notice: x,
|
|
3067
|
+
onSignedIn: C,
|
|
2418
3068
|
autoFocus: e.autoFocus !== !1,
|
|
2419
3069
|
children: [
|
|
2420
|
-
/* @__PURE__ */ f("p", { children:
|
|
2421
|
-
/* @__PURE__ */ f(
|
|
3070
|
+
/* @__PURE__ */ f("p", { children: n("book.signInFirst") }),
|
|
3071
|
+
/* @__PURE__ */ f(X, { choice: A }),
|
|
2422
3072
|
/* @__PURE__ */ f("button", {
|
|
2423
3073
|
type: "button",
|
|
2424
3074
|
className: "cp-link",
|
|
2425
|
-
onClick:
|
|
2426
|
-
children:
|
|
3075
|
+
onClick: j,
|
|
3076
|
+
children: n("book.back")
|
|
2427
3077
|
})
|
|
2428
3078
|
]
|
|
2429
|
-
}) :
|
|
2430
|
-
businessId:
|
|
2431
|
-
time:
|
|
2432
|
-
onFound:
|
|
2433
|
-
onMissing: () =>
|
|
2434
|
-
}) :
|
|
3079
|
+
}) : O && E !== k ? /* @__PURE__ */ f(rn, {
|
|
3080
|
+
businessId: h.businessId,
|
|
3081
|
+
time: O,
|
|
3082
|
+
onFound: T,
|
|
3083
|
+
onMissing: () => D(k)
|
|
3084
|
+
}) : h.all ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("button", {
|
|
2435
3085
|
type: "button",
|
|
2436
3086
|
className: "cp-link cp-back",
|
|
2437
|
-
onClick: () =>
|
|
2438
|
-
businessId:
|
|
2439
|
-
...
|
|
2440
|
-
eventTypeId:
|
|
2441
|
-
...
|
|
3087
|
+
onClick: () => _({
|
|
3088
|
+
businessId: h.businessId,
|
|
3089
|
+
...h.allFrom && {
|
|
3090
|
+
eventTypeId: h.allFrom.eventTypeId,
|
|
3091
|
+
...h.allFrom.resourceId && { resourceId: h.allFrom.resourceId }
|
|
2442
3092
|
}
|
|
2443
3093
|
}),
|
|
2444
|
-
children:
|
|
2445
|
-
}), /* @__PURE__ */ f(
|
|
2446
|
-
businessId:
|
|
2447
|
-
eventTypeId:
|
|
2448
|
-
resourceId:
|
|
2449
|
-
onFilter: (e) =>
|
|
2450
|
-
businessId:
|
|
3094
|
+
children: n(h.allFrom ? "book.toStep" : "book.toTypes")
|
|
3095
|
+
}), /* @__PURE__ */ f(Ue, {
|
|
3096
|
+
businessId: h.businessId,
|
|
3097
|
+
eventTypeId: h.eventTypeId,
|
|
3098
|
+
resourceId: h.resourceId,
|
|
3099
|
+
onFilter: (e) => _({
|
|
3100
|
+
businessId: h.businessId,
|
|
2451
3101
|
all: !0,
|
|
2452
|
-
...
|
|
3102
|
+
...h.allFrom && { allFrom: h.allFrom },
|
|
2453
3103
|
...e
|
|
2454
3104
|
}),
|
|
2455
|
-
onChoose:
|
|
2456
|
-
})] }) : /* @__PURE__ */ f(
|
|
2457
|
-
selection:
|
|
2458
|
-
change:
|
|
2459
|
-
onChoose:
|
|
3105
|
+
onChoose: M
|
|
3106
|
+
})] }) : /* @__PURE__ */ f(nn, {
|
|
3107
|
+
selection: h,
|
|
3108
|
+
change: _,
|
|
3109
|
+
onChoose: M
|
|
2460
3110
|
});
|
|
2461
|
-
let
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
3111
|
+
let F = A ? b ? "booking" : "sign-in" : [
|
|
3112
|
+
h.all ? "all" : "",
|
|
3113
|
+
h.eventTypeId ?? "",
|
|
3114
|
+
h.resourceId ?? "",
|
|
3115
|
+
O && E !== k ? "time" : ""
|
|
2466
3116
|
].join("/");
|
|
2467
|
-
return /* @__PURE__ */ f(
|
|
2468
|
-
portal:
|
|
2469
|
-
loading:
|
|
2470
|
-
|
|
2471
|
-
|
|
3117
|
+
return /* @__PURE__ */ f(U, {
|
|
3118
|
+
portal: S,
|
|
3119
|
+
loading: b === void 0,
|
|
3120
|
+
locale: e.locale,
|
|
3121
|
+
children: /* @__PURE__ */ p(on, {
|
|
3122
|
+
step: F,
|
|
2472
3123
|
initial: e.autoFocus !== !1,
|
|
2473
3124
|
children: [
|
|
2474
3125
|
e.onClose && /* @__PURE__ */ f("div", {
|
|
@@ -2477,51 +3128,51 @@ function Mt(e) {
|
|
|
2477
3128
|
type: "button",
|
|
2478
3129
|
className: "cp-secondary",
|
|
2479
3130
|
onClick: e.onClose,
|
|
2480
|
-
children:
|
|
3131
|
+
children: n("book.close")
|
|
2481
3132
|
})
|
|
2482
3133
|
}),
|
|
2483
|
-
|
|
3134
|
+
O && E === k && /* @__PURE__ */ f("p", {
|
|
2484
3135
|
role: "alert",
|
|
2485
3136
|
className: "cp-notice",
|
|
2486
|
-
children:
|
|
3137
|
+
children: n("book.unavailable")
|
|
2487
3138
|
}),
|
|
2488
|
-
|
|
3139
|
+
N
|
|
2489
3140
|
]
|
|
2490
3141
|
})
|
|
2491
3142
|
});
|
|
2492
3143
|
}
|
|
2493
|
-
function
|
|
2494
|
-
let { selection:
|
|
2495
|
-
if (
|
|
2496
|
-
let
|
|
3144
|
+
function nn(e) {
|
|
3145
|
+
let { t } = I(), { selection: n, change: r } = e, { businessId: i, eventTypeId: a } = n, o = Be(i), s = Ve(o, null, t), { business: c, types: l } = o;
|
|
3146
|
+
if (s || !c || !l) return s;
|
|
3147
|
+
let u = /* @__PURE__ */ f(We, { business: c }), d = /* @__PURE__ */ f("button", {
|
|
2497
3148
|
type: "button",
|
|
2498
3149
|
className: "cp-link cp-back",
|
|
2499
|
-
onClick: () =>
|
|
2500
|
-
children:
|
|
2501
|
-
}),
|
|
2502
|
-
if (!
|
|
3150
|
+
onClick: () => r({ businessId: i }),
|
|
3151
|
+
children: t("book.toTypes")
|
|
3152
|
+
}), m = l.find((e) => e.id === a);
|
|
3153
|
+
if (!m) return /* @__PURE__ */ p("section", {
|
|
2503
3154
|
className: "cp-screen",
|
|
2504
3155
|
children: [
|
|
2505
|
-
|
|
2506
|
-
|
|
3156
|
+
u,
|
|
3157
|
+
a && /* @__PURE__ */ f("p", {
|
|
2507
3158
|
className: "cp-empty",
|
|
2508
|
-
children:
|
|
3159
|
+
children: t("business.typeMissing")
|
|
2509
3160
|
}),
|
|
2510
|
-
/* @__PURE__ */ f("h2", { children:
|
|
2511
|
-
|
|
3161
|
+
/* @__PURE__ */ f("h2", { children: t("book.chooseType") }),
|
|
3162
|
+
l.length === 0 ? /* @__PURE__ */ f("p", {
|
|
2512
3163
|
className: "cp-empty",
|
|
2513
|
-
children:
|
|
3164
|
+
children: t("book.noTypes")
|
|
2514
3165
|
}) : /* @__PURE__ */ f("ul", {
|
|
2515
3166
|
className: "cp-list",
|
|
2516
|
-
children:
|
|
3167
|
+
children: l.map((e) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ p("button", {
|
|
2517
3168
|
type: "button",
|
|
2518
3169
|
className: "cp-option",
|
|
2519
|
-
onClick: () =>
|
|
2520
|
-
businessId:
|
|
3170
|
+
onClick: () => r({
|
|
3171
|
+
businessId: i,
|
|
2521
3172
|
eventTypeId: e.id
|
|
2522
3173
|
}),
|
|
2523
3174
|
children: [
|
|
2524
|
-
/* @__PURE__ */ f(
|
|
3175
|
+
/* @__PURE__ */ f(J, {
|
|
2525
3176
|
image: e.image,
|
|
2526
3177
|
alt: "",
|
|
2527
3178
|
size: "small",
|
|
@@ -2529,12 +3180,12 @@ function Nt(e) {
|
|
|
2529
3180
|
}),
|
|
2530
3181
|
/* @__PURE__ */ f("strong", { children: e.displayName }),
|
|
2531
3182
|
e.description && /* @__PURE__ */ f("span", { children: e.description }),
|
|
2532
|
-
/* @__PURE__ */ f("span", { children:
|
|
3183
|
+
/* @__PURE__ */ f("span", { children: t("business.minutes", { minutes: e.durationMinutes }) }),
|
|
2533
3184
|
e.tags.length > 0 && /* @__PURE__ */ f("span", {
|
|
2534
3185
|
className: "cp-tags",
|
|
2535
3186
|
children: e.tags.slice(0, 3).map((e) => /* @__PURE__ */ f("span", {
|
|
2536
3187
|
className: "cp-tag",
|
|
2537
|
-
style: { "--cp-tag":
|
|
3188
|
+
style: { "--cp-tag": Wt(e.colour) },
|
|
2538
3189
|
children: e.name
|
|
2539
3190
|
}, e.id))
|
|
2540
3191
|
})
|
|
@@ -2544,39 +3195,39 @@ function Nt(e) {
|
|
|
2544
3195
|
/* @__PURE__ */ f("button", {
|
|
2545
3196
|
type: "button",
|
|
2546
3197
|
className: "cp-secondary",
|
|
2547
|
-
onClick: () =>
|
|
2548
|
-
businessId:
|
|
3198
|
+
onClick: () => r({
|
|
3199
|
+
businessId: i,
|
|
2549
3200
|
all: !0
|
|
2550
3201
|
}),
|
|
2551
|
-
children:
|
|
3202
|
+
children: t("book.seeAll")
|
|
2552
3203
|
})
|
|
2553
3204
|
]
|
|
2554
3205
|
});
|
|
2555
|
-
let
|
|
2556
|
-
return
|
|
3206
|
+
let h = m.resources.length > 1, g = m.resources.find((e) => e.id === n.resourceId);
|
|
3207
|
+
return h && !g && n.resourceId !== "any" ? /* @__PURE__ */ p("section", {
|
|
2557
3208
|
className: "cp-screen",
|
|
2558
3209
|
children: [
|
|
3210
|
+
d,
|
|
2559
3211
|
u,
|
|
2560
|
-
|
|
2561
|
-
/* @__PURE__ */ f(
|
|
2562
|
-
/* @__PURE__ */ f("h2", { children: N("book.chooseResource") }),
|
|
3212
|
+
/* @__PURE__ */ f(Ge, { type: m }),
|
|
3213
|
+
/* @__PURE__ */ f("h2", { children: t("book.chooseResource") }),
|
|
2563
3214
|
/* @__PURE__ */ f("ul", {
|
|
2564
3215
|
className: "cp-list",
|
|
2565
3216
|
children: [{
|
|
2566
3217
|
id: "any",
|
|
2567
|
-
displayName:
|
|
2568
|
-
description:
|
|
3218
|
+
displayName: t("book.anyResource"),
|
|
3219
|
+
description: t("book.anyResourceHint"),
|
|
2569
3220
|
image: null
|
|
2570
|
-
}, ...
|
|
3221
|
+
}, ...m.resources].map((e) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ p("button", {
|
|
2571
3222
|
type: "button",
|
|
2572
3223
|
className: "cp-option",
|
|
2573
|
-
onClick: () =>
|
|
2574
|
-
businessId:
|
|
2575
|
-
eventTypeId:
|
|
3224
|
+
onClick: () => r({
|
|
3225
|
+
businessId: i,
|
|
3226
|
+
eventTypeId: m.id,
|
|
2576
3227
|
resourceId: e.id
|
|
2577
3228
|
}),
|
|
2578
3229
|
children: [
|
|
2579
|
-
/* @__PURE__ */ f(
|
|
3230
|
+
/* @__PURE__ */ f(J, {
|
|
2580
3231
|
image: e.image,
|
|
2581
3232
|
alt: "",
|
|
2582
3233
|
size: "small",
|
|
@@ -2590,98 +3241,98 @@ function Nt(e) {
|
|
|
2590
3241
|
/* @__PURE__ */ f("button", {
|
|
2591
3242
|
type: "button",
|
|
2592
3243
|
className: "cp-secondary",
|
|
2593
|
-
onClick: () =>
|
|
2594
|
-
businessId:
|
|
3244
|
+
onClick: () => r({
|
|
3245
|
+
businessId: i,
|
|
2595
3246
|
all: !0,
|
|
2596
|
-
eventTypeId:
|
|
2597
|
-
allFrom: { eventTypeId:
|
|
3247
|
+
eventTypeId: m.id,
|
|
3248
|
+
allFrom: { eventTypeId: m.id }
|
|
2598
3249
|
}),
|
|
2599
|
-
children:
|
|
3250
|
+
children: t("book.seeAll")
|
|
2600
3251
|
})
|
|
2601
3252
|
]
|
|
2602
3253
|
}) : /* @__PURE__ */ p("section", {
|
|
2603
3254
|
className: "cp-screen",
|
|
2604
3255
|
children: [
|
|
2605
|
-
|
|
3256
|
+
h ? /* @__PURE__ */ f("button", {
|
|
2606
3257
|
type: "button",
|
|
2607
3258
|
className: "cp-link cp-back",
|
|
2608
|
-
onClick: () =>
|
|
2609
|
-
businessId:
|
|
2610
|
-
eventTypeId:
|
|
3259
|
+
onClick: () => r({
|
|
3260
|
+
businessId: i,
|
|
3261
|
+
eventTypeId: m.id
|
|
2611
3262
|
}),
|
|
2612
|
-
children:
|
|
2613
|
-
}) :
|
|
2614
|
-
|
|
2615
|
-
/* @__PURE__ */ f(
|
|
2616
|
-
|
|
3263
|
+
children: t("book.otherResource")
|
|
3264
|
+
}) : d,
|
|
3265
|
+
u,
|
|
3266
|
+
/* @__PURE__ */ f(Ge, { type: m }),
|
|
3267
|
+
h && g && /* @__PURE__ */ f("p", {
|
|
2617
3268
|
className: "cp-hint",
|
|
2618
|
-
children:
|
|
3269
|
+
children: t("business.with", { resource: g.displayName })
|
|
2619
3270
|
}),
|
|
2620
|
-
/* @__PURE__ */ f(
|
|
2621
|
-
business:
|
|
2622
|
-
eventTypeId:
|
|
2623
|
-
resourceId:
|
|
2624
|
-
onChoose: (t) => e.onChoose(
|
|
3271
|
+
/* @__PURE__ */ f(Ke, {
|
|
3272
|
+
business: c,
|
|
3273
|
+
eventTypeId: m.id,
|
|
3274
|
+
resourceId: h ? g?.id : void 0,
|
|
3275
|
+
onChoose: (t) => e.onChoose(c, t)
|
|
2625
3276
|
}),
|
|
2626
3277
|
/* @__PURE__ */ f("button", {
|
|
2627
3278
|
type: "button",
|
|
2628
3279
|
className: "cp-secondary",
|
|
2629
|
-
onClick: () =>
|
|
2630
|
-
businessId:
|
|
3280
|
+
onClick: () => r({
|
|
3281
|
+
businessId: i,
|
|
2631
3282
|
all: !0,
|
|
2632
|
-
eventTypeId:
|
|
2633
|
-
...
|
|
3283
|
+
eventTypeId: m.id,
|
|
3284
|
+
...h && g && { resourceId: g.id },
|
|
2634
3285
|
allFrom: {
|
|
2635
|
-
eventTypeId:
|
|
2636
|
-
...
|
|
3286
|
+
eventTypeId: m.id,
|
|
3287
|
+
...h && n.resourceId ? { resourceId: n.resourceId } : {}
|
|
2637
3288
|
}
|
|
2638
3289
|
}),
|
|
2639
|
-
children:
|
|
3290
|
+
children: t("book.seeAll")
|
|
2640
3291
|
})
|
|
2641
3292
|
]
|
|
2642
3293
|
});
|
|
2643
3294
|
}
|
|
2644
|
-
function
|
|
2645
|
-
let { client:
|
|
2646
|
-
|
|
2647
|
-
let
|
|
3295
|
+
function rn(e) {
|
|
3296
|
+
let { t } = I(), { client: n } = x(), { businessId: i, time: a } = e, s = o(e);
|
|
3297
|
+
s.current = e;
|
|
3298
|
+
let c = $(a);
|
|
2648
3299
|
return r(() => {
|
|
2649
3300
|
let e = !0;
|
|
2650
3301
|
return (async () => {
|
|
2651
|
-
let { data:
|
|
2652
|
-
if (!
|
|
2653
|
-
let
|
|
2654
|
-
path: { businessId:
|
|
3302
|
+
let { data: t } = await n.GET("/web/businesses/{businessId}", { params: { path: { businessId: i } } });
|
|
3303
|
+
if (!t) throw Error("no business");
|
|
3304
|
+
let r = ze(t.timezone, new Date(a.startsAt)), { data: o } = await n.GET("/web/businesses/{businessId}/availability", { params: {
|
|
3305
|
+
path: { businessId: i },
|
|
2655
3306
|
query: {
|
|
2656
|
-
from: `${
|
|
2657
|
-
to: `${
|
|
2658
|
-
eventTypeId:
|
|
2659
|
-
...!
|
|
3307
|
+
from: `${r}T00:00`,
|
|
3308
|
+
to: `${Y(r, 1)}T00:00`,
|
|
3309
|
+
eventTypeId: a.eventTypeId,
|
|
3310
|
+
...!a.eventId && a.resourceId && { resourceId: a.resourceId }
|
|
2660
3311
|
}
|
|
2661
|
-
} }), c =
|
|
2662
|
-
e && (c ?
|
|
2663
|
-
business:
|
|
3312
|
+
} }), c = o?.items.find((e) => en(e, a));
|
|
3313
|
+
e && (c ? s.current.onFound({
|
|
3314
|
+
business: t,
|
|
2664
3315
|
candidate: c
|
|
2665
|
-
}) :
|
|
3316
|
+
}) : s.current.onMissing());
|
|
2666
3317
|
})().catch(() => {
|
|
2667
|
-
e &&
|
|
3318
|
+
e && s.current.onMissing();
|
|
2668
3319
|
}), () => {
|
|
2669
3320
|
e = !1;
|
|
2670
3321
|
};
|
|
2671
3322
|
}, [
|
|
2672
|
-
t,
|
|
2673
3323
|
n,
|
|
2674
|
-
|
|
3324
|
+
i,
|
|
3325
|
+
c
|
|
2675
3326
|
]), /* @__PURE__ */ f("section", {
|
|
2676
3327
|
className: "cp-screen",
|
|
2677
3328
|
children: /* @__PURE__ */ f("p", {
|
|
2678
3329
|
role: "status",
|
|
2679
|
-
children:
|
|
3330
|
+
children: t("app.loading")
|
|
2680
3331
|
})
|
|
2681
3332
|
});
|
|
2682
3333
|
}
|
|
2683
|
-
var
|
|
2684
|
-
function
|
|
3334
|
+
var an = "input, .cp-option, .cp-chips button, .cp-candidate button, .cp-actions button:not(:disabled)";
|
|
3335
|
+
function on(e) {
|
|
2685
3336
|
let t = o(null), n = o(!1), { step: i } = e;
|
|
2686
3337
|
return r(() => {
|
|
2687
3338
|
let r = t.current;
|
|
@@ -2689,7 +3340,7 @@ function It(e) {
|
|
|
2689
3340
|
let i = n.current;
|
|
2690
3341
|
if (n.current = !0, i ? r.contains(document.activeElement) : !e.initial) return;
|
|
2691
3342
|
let a = () => {
|
|
2692
|
-
let e = r.querySelector(
|
|
3343
|
+
let e = r.querySelector(an);
|
|
2693
3344
|
return e?.focus(), !!e;
|
|
2694
3345
|
};
|
|
2695
3346
|
if (a()) return;
|
|
@@ -2711,87 +3362,89 @@ function It(e) {
|
|
|
2711
3362
|
});
|
|
2712
3363
|
}
|
|
2713
3364
|
// src/sign-in-standalone.tsx
|
|
2714
|
-
function
|
|
2715
|
-
let t = e.basePath.replace(/\/$/, ""),
|
|
2716
|
-
|
|
2717
|
-
let
|
|
3365
|
+
function sn(e) {
|
|
3366
|
+
let t = P(e.locale), n = e.basePath.replace(/\/$/, ""), i = be(n, e.onSessionChange), a = o(e.onSignedIn);
|
|
3367
|
+
a.current = e.onSignedIn;
|
|
3368
|
+
let s = o(!1);
|
|
2718
3369
|
return r(() => {
|
|
2719
|
-
|
|
2720
|
-
}, [
|
|
2721
|
-
|
|
2722
|
-
children:
|
|
2723
|
-
className: "
|
|
2724
|
-
|
|
2725
|
-
children:
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
3370
|
+
i ? s.current || (s.current = !0, a.current?.()) : s.current = !1;
|
|
3371
|
+
}, [i]), /* @__PURE__ */ f(F.Provider, {
|
|
3372
|
+
value: t,
|
|
3373
|
+
children: /* @__PURE__ */ f("div", {
|
|
3374
|
+
className: "msm-customer",
|
|
3375
|
+
lang: t.locale,
|
|
3376
|
+
children: i === void 0 ? /* @__PURE__ */ f("p", {
|
|
3377
|
+
className: "cp-status",
|
|
3378
|
+
role: "status",
|
|
3379
|
+
children: t.t("app.loading")
|
|
3380
|
+
}) : i === null && /* @__PURE__ */ f(Q, {
|
|
3381
|
+
basePath: n,
|
|
3382
|
+
brand: e.brand,
|
|
3383
|
+
botCheck: e.botCheck,
|
|
3384
|
+
notice: void 0,
|
|
3385
|
+
onSignedIn: (e) => V(n, e),
|
|
3386
|
+
onCancel: e.onCancel,
|
|
3387
|
+
autoFocus: !0
|
|
3388
|
+
})
|
|
2734
3389
|
})
|
|
2735
3390
|
});
|
|
2736
3391
|
}
|
|
2737
3392
|
// src/index.tsx
|
|
2738
|
-
function
|
|
2739
|
-
let
|
|
3393
|
+
function cn(e) {
|
|
3394
|
+
let { t } = P(e.locale), [n, i] = s("businesses"), a = e.screen ?? n, o = e.onNavigate ?? i, { basePath: c, sessionKey: l, notice: u, portal: m, signedInAs: h } = H({
|
|
2740
3395
|
basePath: e.basePath,
|
|
2741
|
-
navigate:
|
|
3396
|
+
navigate: o,
|
|
2742
3397
|
accountNavigation: !0,
|
|
2743
3398
|
onSessionChange: void 0
|
|
2744
3399
|
});
|
|
2745
|
-
|
|
2746
|
-
let [
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
let e = Me();
|
|
2751
|
-
e && (x(e.outcome), e.selection?.business && e.selection.candidate && g(e.selection));
|
|
3400
|
+
gt(a, o);
|
|
3401
|
+
let [g, _] = s(), v = typeof a == "string" ? a : `${a.businessId}/${a.eventTypeId ?? ""}`, [y, b] = s(v);
|
|
3402
|
+
y !== v && (b(v), _(void 0)), r(() => {
|
|
3403
|
+
let e = nt();
|
|
3404
|
+
e?.business && e.candidate && _(e);
|
|
2752
3405
|
}, []);
|
|
2753
|
-
let
|
|
2754
|
-
basePath:
|
|
3406
|
+
let x = (t) => /* @__PURE__ */ f(Q, {
|
|
3407
|
+
basePath: c,
|
|
2755
3408
|
brand: void 0,
|
|
2756
3409
|
botCheck: e.botCheck,
|
|
2757
|
-
notice:
|
|
2758
|
-
onSignedIn:
|
|
3410
|
+
notice: u,
|
|
3411
|
+
onSignedIn: h,
|
|
2759
3412
|
children: t
|
|
2760
3413
|
});
|
|
2761
|
-
return /* @__PURE__ */ f(
|
|
2762
|
-
portal:
|
|
2763
|
-
loading:
|
|
2764
|
-
|
|
3414
|
+
return /* @__PURE__ */ f(U, {
|
|
3415
|
+
portal: m,
|
|
3416
|
+
loading: l === void 0,
|
|
3417
|
+
locale: e.locale,
|
|
3418
|
+
children: /* @__PURE__ */ f(ut, {
|
|
2765
3419
|
brand: e.brand,
|
|
2766
|
-
tabs:
|
|
2767
|
-
screen:
|
|
2768
|
-
signedIn: !!
|
|
2769
|
-
signingIn: !
|
|
2770
|
-
onNavigate:
|
|
2771
|
-
onSignOut: () =>
|
|
2772
|
-
children:
|
|
2773
|
-
choice:
|
|
2774
|
-
onBack: () =>
|
|
2775
|
-
onLeave: () =>
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
/* @__PURE__ */ f(
|
|
2779
|
-
/* @__PURE__ */ f(J, { choice: h }),
|
|
3420
|
+
tabs: lt,
|
|
3421
|
+
screen: a,
|
|
3422
|
+
signedIn: !!l,
|
|
3423
|
+
signingIn: !l && (!!g || typeof a == "string" && a !== "businesses"),
|
|
3424
|
+
onNavigate: o,
|
|
3425
|
+
onSignOut: () => m.signOut(),
|
|
3426
|
+
children: g ? l ? /* @__PURE__ */ f(rt, {
|
|
3427
|
+
choice: g,
|
|
3428
|
+
onBack: () => _(void 0),
|
|
3429
|
+
onLeave: () => tt(g)
|
|
3430
|
+
}, `${g.candidate.startsAt}-${g.candidate.eventId ?? g.candidate.eventTypeId}`) : x(/* @__PURE__ */ p(d, { children: [
|
|
3431
|
+
/* @__PURE__ */ f("p", { children: t("book.signInFirst") }),
|
|
3432
|
+
/* @__PURE__ */ f(X, { choice: g }),
|
|
2780
3433
|
/* @__PURE__ */ f("button", {
|
|
2781
3434
|
type: "button",
|
|
2782
3435
|
className: "cp-link",
|
|
2783
|
-
onClick: () =>
|
|
2784
|
-
children:
|
|
3436
|
+
onClick: () => _(void 0),
|
|
3437
|
+
children: t("book.back")
|
|
2785
3438
|
})
|
|
2786
|
-
] })) : typeof
|
|
2787
|
-
businessId:
|
|
2788
|
-
eventTypeId:
|
|
2789
|
-
onChoose: (e, t) =>
|
|
3439
|
+
] })) : typeof a == "object" ? /* @__PURE__ */ f(Ue, {
|
|
3440
|
+
businessId: a.businessId,
|
|
3441
|
+
eventTypeId: a.eventTypeId,
|
|
3442
|
+
onChoose: (e, t) => _({
|
|
2790
3443
|
business: e,
|
|
2791
3444
|
candidate: t
|
|
2792
3445
|
})
|
|
2793
|
-
}) :
|
|
3446
|
+
}) : a === "businesses" ? /* @__PURE__ */ f(dt, {}) : l ? f(a === "passes" ? vt : a === "details" ? ft : Pe, {}) : x()
|
|
2794
3447
|
})
|
|
2795
3448
|
});
|
|
2796
3449
|
}
|
|
2797
|
-
export {
|
|
3450
|
+
export { Qt as MsmAccount, tn as MsmBooking, cn as MsmCustomer, je as MsmPayButtons, sn as MsmSignIn, Me as cancellationState, ne as formatDate, re as formatDateTime, ie as formatNumber, ee as locale, te as t, Oe as useMsmPayment };
|