@msm-platform/customer-react 0.4.2 → 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 +26 -0
- package/README.md +32 -20
- package/dist/account.d.ts +3 -0
- package/dist/booking-flow.d.ts +20 -0
- package/dist/booking.d.ts +9 -0
- package/dist/client.d.ts +7 -3
- package/dist/context.d.ts +2 -0
- package/dist/formats.d.ts +17 -0
- package/dist/i18n.d.ts +90 -20
- package/dist/i18n.is.d.ts +2 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +2337 -1079
- package/dist/pay.d.ts +125 -0
- package/dist/payment-tab.d.ts +22 -0
- package/dist/portal.d.ts +8 -2
- package/dist/refusals.d.ts +14 -0
- package/dist/screens/business.d.ts +48 -1
- package/dist/screens/shop.d.ts +14 -0
- package/dist/server/index.d.ts +15 -0
- package/dist/server/session.d.ts +24 -0
- package/dist/server.js +139 -106
- package/dist/sign-in-standalone.d.ts +3 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11,387 +11,1143 @@ function x() {
|
|
|
11
11
|
if (!e) throw Error("usePortal needs a customer screen component.");
|
|
12
12
|
return e;
|
|
13
13
|
}
|
|
14
|
-
// src/
|
|
15
|
-
var S = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
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) => {
|
|
164
479
|
let r = t[n];
|
|
165
|
-
return r === void 0 ? e : typeof r == "number" ?
|
|
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) {
|
|
517
|
+
t.headers.set("X-MSM-BFF", "1");
|
|
518
|
+
for (let [n, r] of L.get(e) ?? []) t.headers.set(n, r);
|
|
519
|
+
return t;
|
|
520
|
+
}
|
|
521
|
+
function se(e) {
|
|
522
|
+
return L.get(e)?.has("x-msm-session") ?? !1;
|
|
523
|
+
}
|
|
524
|
+
function ce(e, t) {
|
|
525
|
+
for (let n of ae) {
|
|
526
|
+
let r = t.headers.get(n);
|
|
527
|
+
if (r === null) continue;
|
|
528
|
+
let i = L.get(e) ?? /* @__PURE__ */ new Map();
|
|
529
|
+
L.set(e, i), r ? i.set(n, r) : i.delete(n);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
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;
|
|
535
|
+
}
|
|
536
|
+
function R(e, t, n) {
|
|
537
|
+
return le(e, t, {
|
|
538
|
+
method: "POST",
|
|
539
|
+
headers: { "content-type": "application/json" },
|
|
540
|
+
body: JSON.stringify(n ?? {})
|
|
166
541
|
});
|
|
167
542
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
543
|
+
function ue(e, t) {
|
|
544
|
+
let n = l({ baseUrl: `${e}/engine` });
|
|
545
|
+
return n.use({
|
|
546
|
+
onRequest({ request: t }) {
|
|
547
|
+
return oe(e, t);
|
|
548
|
+
},
|
|
549
|
+
onResponse({ response: n }) {
|
|
550
|
+
ce(e, n), n.status === 401 && t();
|
|
551
|
+
}
|
|
552
|
+
}), n;
|
|
553
|
+
}
|
|
554
|
+
// src/payment-tab.ts
|
|
555
|
+
var de = "msmTab";
|
|
556
|
+
function fe(e) {
|
|
557
|
+
if (se(e)) return { window: window.open("", "_blank") };
|
|
558
|
+
}
|
|
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();
|
|
565
|
+
}
|
|
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);
|
|
174
579
|
});
|
|
175
580
|
}
|
|
176
|
-
|
|
177
|
-
|
|
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;
|
|
178
590
|
}
|
|
179
|
-
function
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
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
|
+
}
|
|
185
597
|
}
|
|
186
|
-
function
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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));
|
|
191
603
|
}
|
|
192
|
-
function
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
+
};
|
|
197
611
|
}
|
|
198
|
-
function
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
})
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
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;
|
|
619
|
+
}
|
|
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
|
+
})
|
|
696
|
+
});
|
|
697
|
+
}
|
|
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" };
|
|
706
|
+
}
|
|
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
|
+
}
|
|
716
|
+
}
|
|
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);
|
|
722
|
+
}
|
|
723
|
+
function we() {
|
|
724
|
+
return Ce(), K !== null;
|
|
725
|
+
}
|
|
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 {}
|
|
731
|
+
}
|
|
732
|
+
function De(e) {
|
|
733
|
+
try {
|
|
734
|
+
return window.sessionStorage.getItem(e) !== null;
|
|
735
|
+
} catch {
|
|
736
|
+
return !1;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
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]
|
|
211
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
|
+
}
|
|
212
949
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
let t =
|
|
216
|
-
|
|
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
|
+
})
|
|
971
|
+
});
|
|
217
972
|
}
|
|
218
973
|
// src/cancellation.ts
|
|
219
|
-
function
|
|
974
|
+
function Me(e, t) {
|
|
220
975
|
if (e.status === "cancelled") return "cancelled";
|
|
221
976
|
let n = t.getTime();
|
|
222
977
|
return !e.cancellableUntil || n >= Date.parse(e.cancellableUntil) ? "closed" : e.lateCancellationFrom && n >= Date.parse(e.lateCancellationFrom) ? "late" : "open";
|
|
223
978
|
}
|
|
224
979
|
// src/screens/bookings.tsx
|
|
225
|
-
var
|
|
226
|
-
function
|
|
227
|
-
let {
|
|
228
|
-
|
|
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);
|
|
229
984
|
try {
|
|
230
|
-
let { data:
|
|
231
|
-
period:
|
|
232
|
-
...
|
|
985
|
+
let { data: t } = await n.GET("/web/me/bookings", { params: { query: {
|
|
986
|
+
period: i,
|
|
987
|
+
...e && { cursor: e }
|
|
233
988
|
} } });
|
|
234
|
-
if (!
|
|
235
|
-
|
|
989
|
+
if (!t) return;
|
|
990
|
+
c((n) => e ? [...n ?? [], ...t.items] : t.items), u(t.nextCursor);
|
|
236
991
|
} catch {
|
|
237
|
-
|
|
992
|
+
m(!0);
|
|
238
993
|
}
|
|
239
|
-
}, [
|
|
994
|
+
}, [n, i]);
|
|
240
995
|
return r(() => {
|
|
241
|
-
|
|
242
|
-
}, [
|
|
996
|
+
c(void 0), g(void 0), _();
|
|
997
|
+
}, [_]), /* @__PURE__ */ p("section", {
|
|
243
998
|
className: "cp-screen",
|
|
244
999
|
children: [
|
|
245
|
-
/* @__PURE__ */ f("h1", { children:
|
|
1000
|
+
/* @__PURE__ */ f("h1", { children: e("bookings.heading") }),
|
|
246
1001
|
/* @__PURE__ */ f("fieldset", {
|
|
247
1002
|
className: "cp-tabs",
|
|
248
|
-
"aria-label":
|
|
249
|
-
children: ["upcoming", "past"].map((
|
|
1003
|
+
"aria-label": e("bookings.period"),
|
|
1004
|
+
children: ["upcoming", "past"].map((t) => /* @__PURE__ */ f("button", {
|
|
250
1005
|
type: "button",
|
|
251
|
-
"aria-pressed":
|
|
252
|
-
onClick: () =>
|
|
253
|
-
children:
|
|
254
|
-
},
|
|
1006
|
+
"aria-pressed": i === t,
|
|
1007
|
+
onClick: () => a(t),
|
|
1008
|
+
children: e(t === "upcoming" ? "bookings.upcoming" : "bookings.past")
|
|
1009
|
+
}, t))
|
|
255
1010
|
}),
|
|
256
|
-
|
|
1011
|
+
h && /* @__PURE__ */ f("p", {
|
|
257
1012
|
role: "status",
|
|
258
1013
|
className: "cp-notice",
|
|
259
|
-
children:
|
|
1014
|
+
children: e(h)
|
|
260
1015
|
}),
|
|
261
|
-
|
|
1016
|
+
d ? /* @__PURE__ */ f(q, { onRetry: () => _() }) : o ? o.length === 0 ? /* @__PURE__ */ f("p", {
|
|
262
1017
|
className: "cp-empty",
|
|
263
|
-
children:
|
|
1018
|
+
children: e(i === "upcoming" ? "bookings.emptyUpcoming" : "bookings.emptyPast")
|
|
264
1019
|
}) : /* @__PURE__ */ f("ul", {
|
|
265
1020
|
className: "cp-list",
|
|
266
|
-
children:
|
|
1021
|
+
children: o.map((e) => /* @__PURE__ */ f(Fe, {
|
|
267
1022
|
booking: e,
|
|
268
1023
|
onCancelled: (e, t) => {
|
|
269
|
-
|
|
1024
|
+
c((t) => t?.map((t) => t.id === e.id ? e : t)), g(t ? "bookings.doneLate" : "bookings.doneOnTime");
|
|
270
1025
|
}
|
|
271
1026
|
}, e.id))
|
|
272
1027
|
}) : /* @__PURE__ */ f("p", {
|
|
273
1028
|
role: "status",
|
|
274
|
-
children:
|
|
1029
|
+
children: e("app.loading")
|
|
275
1030
|
}),
|
|
276
|
-
|
|
1031
|
+
o && l && !d && /* @__PURE__ */ f("button", {
|
|
277
1032
|
type: "button",
|
|
278
1033
|
className: "cp-secondary",
|
|
279
|
-
onClick: () =>
|
|
280
|
-
children:
|
|
1034
|
+
onClick: () => _(l),
|
|
1035
|
+
children: e("bookings.more")
|
|
281
1036
|
})
|
|
282
1037
|
]
|
|
283
1038
|
});
|
|
284
1039
|
}
|
|
285
|
-
function
|
|
1040
|
+
function q({ onRetry: e }) {
|
|
1041
|
+
let { t } = I();
|
|
286
1042
|
return /* @__PURE__ */ p("div", {
|
|
287
1043
|
role: "alert",
|
|
288
1044
|
className: "cp-error",
|
|
289
|
-
children: [/* @__PURE__ */ f("p", { children:
|
|
1045
|
+
children: [/* @__PURE__ */ f("p", { children: t("app.loadFailed") }), /* @__PURE__ */ f("button", {
|
|
290
1046
|
type: "button",
|
|
291
1047
|
className: "cp-secondary",
|
|
292
1048
|
onClick: e,
|
|
293
|
-
children:
|
|
1049
|
+
children: t("app.retry")
|
|
294
1050
|
})]
|
|
295
1051
|
});
|
|
296
1052
|
}
|
|
297
|
-
function
|
|
298
|
-
let { client:
|
|
299
|
-
async function
|
|
300
|
-
|
|
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);
|
|
301
1057
|
try {
|
|
302
|
-
let { data:
|
|
303
|
-
businessId:
|
|
304
|
-
bookingId:
|
|
1058
|
+
let { data: t } = await i.POST(Ne, { params: { path: {
|
|
1059
|
+
businessId: o.businessId,
|
|
1060
|
+
bookingId: o.id
|
|
305
1061
|
} } });
|
|
306
|
-
|
|
307
|
-
...
|
|
308
|
-
...
|
|
1062
|
+
t && (d(!1), e.onCancelled({
|
|
1063
|
+
...o,
|
|
1064
|
+
...t,
|
|
309
1065
|
cancellableUntil: null,
|
|
310
1066
|
lateCancellationFrom: null
|
|
311
|
-
},
|
|
1067
|
+
}, t.cancelledLate === !0));
|
|
312
1068
|
} catch (e) {
|
|
313
|
-
if (u(e, "post",
|
|
1069
|
+
if (u(e, "post", Ne)) {
|
|
314
1070
|
if (e.code === "EventStarted") {
|
|
315
|
-
|
|
1071
|
+
y(!0), d(!1);
|
|
316
1072
|
return;
|
|
317
1073
|
}
|
|
318
1074
|
if (e.code === "BookingNotFound") {
|
|
319
|
-
|
|
1075
|
+
_("bookings.gone");
|
|
320
1076
|
return;
|
|
321
1077
|
}
|
|
322
1078
|
}
|
|
323
|
-
|
|
1079
|
+
_("bookings.cancelFailed");
|
|
324
1080
|
} finally {
|
|
325
|
-
|
|
1081
|
+
h(!1);
|
|
326
1082
|
}
|
|
327
1083
|
}
|
|
328
1084
|
return /* @__PURE__ */ p("li", {
|
|
329
1085
|
className: "cp-card",
|
|
330
|
-
"data-state":
|
|
1086
|
+
"data-state": b,
|
|
331
1087
|
children: [
|
|
332
1088
|
/* @__PURE__ */ p("div", {
|
|
333
1089
|
className: "cp-card-head",
|
|
334
|
-
children: [/* @__PURE__ */ f("h2", { children:
|
|
1090
|
+
children: [/* @__PURE__ */ f("h2", { children: o.event.eventTypeName }), o.status === "cancelled" ? /* @__PURE__ */ f("span", {
|
|
335
1091
|
className: "cp-badge",
|
|
336
|
-
children:
|
|
337
|
-
}) :
|
|
1092
|
+
children: t(o.cancelledLate ? "bookings.cancelledLate" : "bookings.cancelled")
|
|
1093
|
+
}) : o.attendance ? /* @__PURE__ */ f("span", {
|
|
338
1094
|
className: "cp-badge",
|
|
339
|
-
children:
|
|
1095
|
+
children: t(o.attendance === "attended" ? "bookings.attended" : "bookings.noShow")
|
|
340
1096
|
}) : null]
|
|
341
1097
|
}),
|
|
342
|
-
/* @__PURE__ */ f("p", { children:
|
|
343
|
-
/* @__PURE__ */ f("p", { children:
|
|
344
|
-
(
|
|
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", {
|
|
345
1101
|
className: "cp-hint",
|
|
346
|
-
children:
|
|
1102
|
+
children: t("bookings.lateFrom", { time: n(o.lateCancellationFrom, c) })
|
|
347
1103
|
}),
|
|
348
|
-
|
|
1104
|
+
b === "closed" && o.status === "confirmed" && !o.attendance && /* @__PURE__ */ f("p", {
|
|
349
1105
|
className: "cp-hint",
|
|
350
|
-
children:
|
|
1106
|
+
children: t("bookings.started")
|
|
351
1107
|
}),
|
|
352
|
-
|
|
1108
|
+
g && /* @__PURE__ */ f("p", {
|
|
353
1109
|
role: "alert",
|
|
354
|
-
children:
|
|
1110
|
+
children: t(g)
|
|
355
1111
|
}),
|
|
356
|
-
(
|
|
1112
|
+
(b === "open" || b === "late") && (l ? /* @__PURE__ */ p("fieldset", {
|
|
357
1113
|
className: "cp-confirm",
|
|
358
1114
|
children: [
|
|
359
|
-
/* @__PURE__ */ f("legend", { children:
|
|
360
|
-
|
|
1115
|
+
/* @__PURE__ */ f("legend", { children: t("bookings.confirmHeading") }),
|
|
1116
|
+
b === "late" && /* @__PURE__ */ f("p", {
|
|
361
1117
|
className: "cp-warning",
|
|
362
|
-
children:
|
|
1118
|
+
children: t("bookings.confirmLate")
|
|
363
1119
|
}),
|
|
364
|
-
|
|
1120
|
+
b === "late" && S && /* @__PURE__ */ f("p", {
|
|
365
1121
|
className: "cp-warning",
|
|
366
|
-
children:
|
|
1122
|
+
children: t("bookings.confirmCredit")
|
|
367
1123
|
}),
|
|
368
1124
|
/* @__PURE__ */ p("div", {
|
|
369
1125
|
className: "cp-actions",
|
|
370
1126
|
children: [/* @__PURE__ */ f("button", {
|
|
371
1127
|
type: "button",
|
|
372
|
-
disabled:
|
|
373
|
-
onClick:
|
|
374
|
-
children:
|
|
1128
|
+
disabled: m,
|
|
1129
|
+
onClick: C,
|
|
1130
|
+
children: t(m ? "bookings.cancelling" : "bookings.confirm")
|
|
375
1131
|
}), /* @__PURE__ */ f("button", {
|
|
376
1132
|
type: "button",
|
|
377
1133
|
className: "cp-secondary",
|
|
378
|
-
disabled:
|
|
379
|
-
onClick: () =>
|
|
380
|
-
children:
|
|
1134
|
+
disabled: m,
|
|
1135
|
+
onClick: () => d(!1),
|
|
1136
|
+
children: t("bookings.keep")
|
|
381
1137
|
})]
|
|
382
1138
|
})
|
|
383
1139
|
]
|
|
384
1140
|
}) : /* @__PURE__ */ f("button", {
|
|
385
1141
|
type: "button",
|
|
386
1142
|
className: "cp-secondary",
|
|
387
|
-
onClick: () =>
|
|
388
|
-
children:
|
|
1143
|
+
onClick: () => d(!0),
|
|
1144
|
+
children: t("bookings.cancel")
|
|
389
1145
|
}))
|
|
390
1146
|
]
|
|
391
1147
|
});
|
|
392
1148
|
}
|
|
393
1149
|
// src/image.tsx
|
|
394
|
-
function
|
|
1150
|
+
function J(e) {
|
|
395
1151
|
let { image: t, alt: n, className: r } = e;
|
|
396
1152
|
if (!t) return null;
|
|
397
1153
|
let { small: i } = t;
|
|
@@ -424,12 +1180,12 @@ function I(e) {
|
|
|
424
1180
|
});
|
|
425
1181
|
}
|
|
426
1182
|
// src/screens/business.tsx
|
|
427
|
-
var
|
|
1183
|
+
var Ie = "/web/businesses/{businessId}", Le = /* @__PURE__ */ new Set([
|
|
428
1184
|
"BusinessNotFound",
|
|
429
1185
|
"OutsideClientScope",
|
|
430
1186
|
"ValidationFailed"
|
|
431
|
-
]),
|
|
432
|
-
function
|
|
1187
|
+
]), Re = 7;
|
|
1188
|
+
function ze(e, t = /* @__PURE__ */ new Date()) {
|
|
433
1189
|
return new Intl.DateTimeFormat("en-CA", {
|
|
434
1190
|
timeZone: e,
|
|
435
1191
|
year: "numeric",
|
|
@@ -437,18 +1193,18 @@ function se(e, t = /* @__PURE__ */ new Date()) {
|
|
|
437
1193
|
day: "2-digit"
|
|
438
1194
|
}).format(t);
|
|
439
1195
|
}
|
|
440
|
-
function
|
|
1196
|
+
function Y(e, t) {
|
|
441
1197
|
let n = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
442
1198
|
return n.setUTCDate(n.getUTCDate() + t), n.toISOString().slice(0, 10);
|
|
443
1199
|
}
|
|
444
|
-
function
|
|
1200
|
+
function Be(e) {
|
|
445
1201
|
let { client: n } = x(), [i, a] = s(), [o, c] = s(), [l, d] = s(!1), f = t(async () => {
|
|
446
1202
|
d(!1), a(void 0);
|
|
447
1203
|
try {
|
|
448
|
-
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 } } })]);
|
|
449
1205
|
a(t.data ?? null), c(r.data?.items ?? []);
|
|
450
1206
|
} catch (e) {
|
|
451
|
-
u(e) &&
|
|
1207
|
+
u(e) && Le.has(e.code ?? "") ? a(null) : d(!0);
|
|
452
1208
|
}
|
|
453
1209
|
}, [n, e]);
|
|
454
1210
|
return r(() => {
|
|
@@ -460,109 +1216,110 @@ function ce(e) {
|
|
|
460
1216
|
reload: f
|
|
461
1217
|
};
|
|
462
1218
|
}
|
|
463
|
-
function
|
|
1219
|
+
function Ve(e, t, n) {
|
|
464
1220
|
if (e.failed) return /* @__PURE__ */ p("section", {
|
|
465
1221
|
className: "cp-screen",
|
|
466
|
-
children: [t, /* @__PURE__ */ f(
|
|
1222
|
+
children: [t, /* @__PURE__ */ f(q, { onRetry: e.reload })]
|
|
467
1223
|
});
|
|
468
1224
|
if (e.business === null) return /* @__PURE__ */ p("section", {
|
|
469
1225
|
className: "cp-screen",
|
|
470
1226
|
children: [t, /* @__PURE__ */ f("p", {
|
|
471
1227
|
className: "cp-empty",
|
|
472
|
-
children:
|
|
1228
|
+
children: n("business.notFound")
|
|
473
1229
|
})]
|
|
474
1230
|
});
|
|
475
1231
|
if (e.business === void 0 || !e.types) return /* @__PURE__ */ p("section", {
|
|
476
1232
|
className: "cp-screen",
|
|
477
1233
|
children: [t, /* @__PURE__ */ f("p", {
|
|
478
1234
|
role: "status",
|
|
479
|
-
children:
|
|
1235
|
+
children: n("app.loading")
|
|
480
1236
|
})]
|
|
481
1237
|
});
|
|
482
1238
|
}
|
|
483
|
-
function
|
|
1239
|
+
function He(e) {
|
|
484
1240
|
let t = /* @__PURE__ */ new Map();
|
|
485
1241
|
for (let n of e) for (let e of n.resources) t.has(e.id) || t.set(e.id, e);
|
|
486
1242
|
return [...t.values()];
|
|
487
1243
|
}
|
|
488
|
-
function
|
|
489
|
-
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", {
|
|
490
1246
|
type: "button",
|
|
491
1247
|
className: "cp-link cp-back",
|
|
492
|
-
onClick: () =>
|
|
493
|
-
children:
|
|
494
|
-
}),
|
|
495
|
-
if (
|
|
496
|
-
let
|
|
497
|
-
if (!
|
|
498
|
-
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,
|
|
499
1255
|
eventTypeId: e
|
|
500
|
-
} : { businessId:
|
|
501
|
-
let
|
|
502
|
-
|
|
1256
|
+
} : { businessId: i });
|
|
1257
|
+
let t = m.find((t) => t.id === e), r = _ && He(t ? [t] : m).some((e) => e.id === _);
|
|
1258
|
+
o({
|
|
503
1259
|
...e && { eventTypeId: e },
|
|
504
|
-
...
|
|
1260
|
+
...r && { resourceId: _ }
|
|
505
1261
|
});
|
|
506
1262
|
};
|
|
507
1263
|
return /* @__PURE__ */ p("section", {
|
|
508
1264
|
className: "cp-screen",
|
|
509
1265
|
children: [
|
|
510
|
-
|
|
511
|
-
/* @__PURE__ */ f(
|
|
512
|
-
|
|
1266
|
+
c,
|
|
1267
|
+
/* @__PURE__ */ f(We, { business: u }),
|
|
1268
|
+
m.length > 0 && /* @__PURE__ */ p("fieldset", {
|
|
513
1269
|
className: "cp-chips",
|
|
514
|
-
"aria-label":
|
|
1270
|
+
"aria-label": t("business.types"),
|
|
515
1271
|
children: [/* @__PURE__ */ f("button", {
|
|
516
1272
|
type: "button",
|
|
517
|
-
"aria-pressed": !
|
|
518
|
-
onClick: () =>
|
|
519
|
-
children:
|
|
520
|
-
}),
|
|
1273
|
+
"aria-pressed": !a,
|
|
1274
|
+
onClick: () => v(void 0),
|
|
1275
|
+
children: t("business.allTypes")
|
|
1276
|
+
}), m.map((e) => /* @__PURE__ */ f("button", {
|
|
521
1277
|
type: "button",
|
|
522
|
-
"aria-pressed": e.id ===
|
|
523
|
-
onClick: () =>
|
|
1278
|
+
"aria-pressed": e.id === a,
|
|
1279
|
+
onClick: () => v(e.id),
|
|
524
1280
|
children: e.displayName
|
|
525
1281
|
}, e.id))]
|
|
526
1282
|
}),
|
|
527
|
-
|
|
1283
|
+
o && g.length > 1 && /* @__PURE__ */ p("fieldset", {
|
|
528
1284
|
className: "cp-chips",
|
|
529
1285
|
children: [
|
|
530
|
-
/* @__PURE__ */ f("legend", { children:
|
|
1286
|
+
/* @__PURE__ */ f("legend", { children: t("business.resources") }),
|
|
531
1287
|
/* @__PURE__ */ f("button", {
|
|
532
1288
|
type: "button",
|
|
533
|
-
"aria-pressed": !
|
|
534
|
-
onClick: () =>
|
|
535
|
-
children:
|
|
1289
|
+
"aria-pressed": !_,
|
|
1290
|
+
onClick: () => o({ ...a && { eventTypeId: a } }),
|
|
1291
|
+
children: t("business.anyResource")
|
|
536
1292
|
}),
|
|
537
|
-
|
|
1293
|
+
g.map((e) => /* @__PURE__ */ f("button", {
|
|
538
1294
|
type: "button",
|
|
539
|
-
"aria-pressed": e.id ===
|
|
540
|
-
onClick: () =>
|
|
541
|
-
...
|
|
1295
|
+
"aria-pressed": e.id === _,
|
|
1296
|
+
onClick: () => o({
|
|
1297
|
+
...a && { eventTypeId: a },
|
|
542
1298
|
resourceId: e.id
|
|
543
1299
|
}),
|
|
544
1300
|
children: e.displayName
|
|
545
1301
|
}, e.id))
|
|
546
1302
|
]
|
|
547
1303
|
}),
|
|
548
|
-
|
|
1304
|
+
a && !h ? /* @__PURE__ */ f("p", {
|
|
549
1305
|
className: "cp-empty",
|
|
550
|
-
children:
|
|
551
|
-
}) : /* @__PURE__ */ p(d, { children: [
|
|
552
|
-
business:
|
|
553
|
-
eventTypeId:
|
|
554
|
-
resourceId:
|
|
555
|
-
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)
|
|
556
1312
|
})] })
|
|
557
1313
|
]
|
|
558
1314
|
});
|
|
559
1315
|
}
|
|
560
|
-
function
|
|
1316
|
+
function We({ business: e }) {
|
|
1317
|
+
let { t } = I();
|
|
561
1318
|
return /* @__PURE__ */ p("header", {
|
|
562
1319
|
className: "cp-business-head",
|
|
563
|
-
children: [/* @__PURE__ */ f(
|
|
1320
|
+
children: [/* @__PURE__ */ f(J, {
|
|
564
1321
|
image: e.logo,
|
|
565
|
-
alt:
|
|
1322
|
+
alt: t("image.logo", { name: e.displayName }),
|
|
566
1323
|
size: "small",
|
|
567
1324
|
className: "cp-logo"
|
|
568
1325
|
}), /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f("h1", { children: e.displayName }), e.address && /* @__PURE__ */ f("p", {
|
|
@@ -571,11 +1328,12 @@ function fe({ business: e }) {
|
|
|
571
1328
|
})] })]
|
|
572
1329
|
});
|
|
573
1330
|
}
|
|
574
|
-
function
|
|
1331
|
+
function Ge({ type: e }) {
|
|
1332
|
+
let { t } = I();
|
|
575
1333
|
return /* @__PURE__ */ p("div", {
|
|
576
1334
|
className: "cp-type",
|
|
577
1335
|
children: [
|
|
578
|
-
/* @__PURE__ */ f(
|
|
1336
|
+
/* @__PURE__ */ f(J, {
|
|
579
1337
|
image: e.image,
|
|
580
1338
|
alt: e.displayName,
|
|
581
1339
|
size: "full",
|
|
@@ -585,301 +1343,381 @@ function R({ type: e }) {
|
|
|
585
1343
|
e.description && /* @__PURE__ */ f("p", { children: e.description }),
|
|
586
1344
|
/* @__PURE__ */ f("p", {
|
|
587
1345
|
className: "cp-hint",
|
|
588
|
-
children:
|
|
1346
|
+
children: t("business.minutes", { minutes: e.durationMinutes })
|
|
589
1347
|
})
|
|
590
1348
|
]
|
|
591
1349
|
});
|
|
592
1350
|
}
|
|
593
|
-
function
|
|
594
|
-
let {
|
|
595
|
-
|
|
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);
|
|
596
1354
|
try {
|
|
597
|
-
let { data: e } = await
|
|
598
|
-
path: { businessId:
|
|
1355
|
+
let { data: e } = await o.GET("/web/businesses/{businessId}/availability", { params: {
|
|
1356
|
+
path: { businessId: c.id },
|
|
599
1357
|
query: {
|
|
600
|
-
from: `${
|
|
601
|
-
to: `${
|
|
602
|
-
...
|
|
603
|
-
...
|
|
1358
|
+
from: `${S}T00:00`,
|
|
1359
|
+
to: `${C}T00:00`,
|
|
1360
|
+
...l && { eventTypeId: l },
|
|
1361
|
+
...u && { resourceId: u }
|
|
604
1362
|
}
|
|
605
1363
|
} });
|
|
606
|
-
|
|
1364
|
+
v(e?.items ?? []);
|
|
607
1365
|
} catch {
|
|
608
|
-
|
|
1366
|
+
b(!0);
|
|
609
1367
|
}
|
|
610
1368
|
}, [
|
|
611
|
-
n,
|
|
612
|
-
i.id,
|
|
613
|
-
a,
|
|
614
1369
|
o,
|
|
615
|
-
|
|
616
|
-
|
|
1370
|
+
c.id,
|
|
1371
|
+
l,
|
|
1372
|
+
u,
|
|
1373
|
+
S,
|
|
1374
|
+
C
|
|
617
1375
|
]);
|
|
618
1376
|
r(() => {
|
|
619
|
-
|
|
620
|
-
}, [
|
|
621
|
-
let
|
|
622
|
-
for (let e of
|
|
623
|
-
if (Date.parse(e.startsAt) <=
|
|
624
|
-
let t =
|
|
625
|
-
|
|
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);
|
|
626
1387
|
}
|
|
627
|
-
let
|
|
628
|
-
from:
|
|
629
|
-
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")
|
|
630
1391
|
});
|
|
631
1392
|
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p("fieldset", {
|
|
632
1393
|
className: "cp-week",
|
|
633
|
-
"aria-label":
|
|
1394
|
+
"aria-label": n("business.week"),
|
|
634
1395
|
children: [
|
|
635
1396
|
/* @__PURE__ */ f("button", {
|
|
636
1397
|
type: "button",
|
|
637
1398
|
className: "cp-secondary",
|
|
638
|
-
disabled:
|
|
639
|
-
onClick: () =>
|
|
640
|
-
"aria-label":
|
|
1399
|
+
disabled: h === 0,
|
|
1400
|
+
onClick: () => g((e) => e - 1),
|
|
1401
|
+
"aria-label": n("business.previousWeek"),
|
|
641
1402
|
children: "‹"
|
|
642
1403
|
}),
|
|
643
|
-
/* @__PURE__ */ f("span", { children:
|
|
1404
|
+
/* @__PURE__ */ f("span", { children: D }),
|
|
644
1405
|
/* @__PURE__ */ f("button", {
|
|
645
1406
|
type: "button",
|
|
646
1407
|
className: "cp-secondary",
|
|
647
|
-
onClick: () =>
|
|
648
|
-
"aria-label":
|
|
1408
|
+
onClick: () => g((e) => e + 1),
|
|
1409
|
+
"aria-label": n("business.nextWeek"),
|
|
649
1410
|
children: "›"
|
|
650
1411
|
})
|
|
651
1412
|
]
|
|
652
|
-
}),
|
|
1413
|
+
}), y ? /* @__PURE__ */ f(q, { onRetry: w }) : _ ? E.size === 0 ? /* @__PURE__ */ f("p", {
|
|
653
1414
|
className: "cp-empty",
|
|
654
|
-
children:
|
|
655
|
-
}) : [...
|
|
1415
|
+
children: n("business.empty")
|
|
1416
|
+
}) : [...E].map(([t, { heading: n, candidates: r }]) => /* @__PURE__ */ p("div", {
|
|
656
1417
|
className: "cp-day",
|
|
657
|
-
children: [/* @__PURE__ */ f("h2", { children:
|
|
1418
|
+
children: [/* @__PURE__ */ f("h2", { children: n }), /* @__PURE__ */ f("ul", {
|
|
658
1419
|
className: "cp-list",
|
|
659
|
-
children:
|
|
1420
|
+
children: r.map((t) => /* @__PURE__ */ f(Je, {
|
|
660
1421
|
candidate: t,
|
|
661
1422
|
onChoose: () => e.onChoose(t)
|
|
662
1423
|
}, `${t.eventId ?? t.eventTypeId}-${t.resource?.id ?? ""}-${t.startsAt}`))
|
|
663
1424
|
})]
|
|
664
1425
|
}, t)) : /* @__PURE__ */ f("p", {
|
|
665
1426
|
role: "status",
|
|
666
|
-
children:
|
|
1427
|
+
children: n("app.loading")
|
|
667
1428
|
})] });
|
|
668
1429
|
}
|
|
669
|
-
function
|
|
1430
|
+
function qe({ candidate: e }) {
|
|
1431
|
+
let { t } = I();
|
|
670
1432
|
if (e.kind === "slot") return e.resource ? /* @__PURE__ */ f("p", {
|
|
671
1433
|
className: "cp-hint",
|
|
672
|
-
children:
|
|
1434
|
+
children: t("business.with", { resource: e.resources?.[0]?.presentedAs?.name ?? e.resource.displayName })
|
|
673
1435
|
}) : null;
|
|
674
|
-
let
|
|
675
|
-
for (let
|
|
676
|
-
let { label: e, name: r } =
|
|
1436
|
+
let n = [];
|
|
1437
|
+
for (let t of e.resources ?? []) {
|
|
1438
|
+
let { label: e, name: r } = t.presentedAs ?? {
|
|
677
1439
|
label: null,
|
|
678
|
-
name:
|
|
679
|
-
}, i =
|
|
680
|
-
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({
|
|
681
1443
|
label: e,
|
|
682
1444
|
names: [r]
|
|
683
1445
|
});
|
|
684
1446
|
}
|
|
685
|
-
let
|
|
686
|
-
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", {
|
|
687
1449
|
className: "cp-hint cp-resources",
|
|
688
|
-
children:
|
|
1450
|
+
children: r.join(" · ")
|
|
689
1451
|
}) : null;
|
|
690
1452
|
}
|
|
691
|
-
function
|
|
692
|
-
let { candidate:
|
|
1453
|
+
function Je(e) {
|
|
1454
|
+
let { t, tp: n, formatTime: r } = I(), { candidate: i } = e, a = i.kind === "slot";
|
|
693
1455
|
return /* @__PURE__ */ p("li", {
|
|
694
1456
|
className: "cp-card cp-candidate",
|
|
695
|
-
"data-kind":
|
|
1457
|
+
"data-kind": i.kind,
|
|
696
1458
|
children: [
|
|
697
1459
|
/* @__PURE__ */ p("p", {
|
|
698
1460
|
className: "cp-time",
|
|
699
1461
|
children: [
|
|
700
|
-
|
|
1462
|
+
r(i.startsAt, i.timezone),
|
|
701
1463
|
" – ",
|
|
702
|
-
|
|
1464
|
+
r(i.endsAt, i.timezone)
|
|
703
1465
|
]
|
|
704
1466
|
}),
|
|
705
1467
|
/* @__PURE__ */ p("div", {
|
|
706
1468
|
className: "cp-candidate-body",
|
|
707
1469
|
children: [
|
|
708
|
-
/* @__PURE__ */ f("h3", { children:
|
|
709
|
-
/* @__PURE__ */ f(
|
|
1470
|
+
/* @__PURE__ */ f("h3", { children: i.title }),
|
|
1471
|
+
/* @__PURE__ */ f(qe, { candidate: i }),
|
|
710
1472
|
/* @__PURE__ */ f("p", {
|
|
711
1473
|
className: "cp-hint",
|
|
712
|
-
children:
|
|
1474
|
+
children: a ? t("business.openTime") : i.full ? t("business.full") : n("business.seatsLeft", i.seatsLeft)
|
|
713
1475
|
})
|
|
714
1476
|
]
|
|
715
1477
|
}),
|
|
716
|
-
!
|
|
1478
|
+
!i.full && /* @__PURE__ */ f("button", {
|
|
717
1479
|
type: "button",
|
|
718
1480
|
onClick: e.onChoose,
|
|
719
|
-
children:
|
|
1481
|
+
children: t("business.book")
|
|
720
1482
|
})
|
|
721
1483
|
]
|
|
722
1484
|
});
|
|
723
1485
|
}
|
|
724
1486
|
// src/booking.tsx
|
|
725
|
-
var
|
|
726
|
-
function
|
|
727
|
-
|
|
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) {
|
|
1489
|
+
try {
|
|
1490
|
+
return window.sessionStorage.getItem(Ze(e));
|
|
1491
|
+
} catch {
|
|
1492
|
+
return null;
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
function $e(e, t) {
|
|
1496
|
+
try {
|
|
1497
|
+
t ? window.sessionStorage.setItem(Ze(e), t) : window.sessionStorage.removeItem(Ze(e));
|
|
1498
|
+
} catch {}
|
|
1499
|
+
}
|
|
1500
|
+
var et = "msm-checkout-selection";
|
|
1501
|
+
function tt(e) {
|
|
1502
|
+
try {
|
|
1503
|
+
window.sessionStorage.setItem(et, JSON.stringify(e));
|
|
1504
|
+
} catch {}
|
|
1505
|
+
}
|
|
1506
|
+
function nt() {
|
|
1507
|
+
if (!we()) return null;
|
|
1508
|
+
try {
|
|
1509
|
+
let e = window.sessionStorage.getItem(et);
|
|
1510
|
+
return window.sessionStorage.removeItem(et), e ? JSON.parse(e) : null;
|
|
1511
|
+
} catch {
|
|
1512
|
+
return null;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
function X({ choice: e }) {
|
|
1516
|
+
let { formatRange: t } = I(), { business: n, candidate: r } = e;
|
|
728
1517
|
return /* @__PURE__ */ p("div", {
|
|
729
1518
|
className: "cp-summary",
|
|
730
1519
|
children: [
|
|
731
|
-
/* @__PURE__ */ f("h2", { children:
|
|
732
|
-
/* @__PURE__ */ f("p", { children:
|
|
733
|
-
/* @__PURE__ */ f("p", { children:
|
|
734
|
-
/* @__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 })
|
|
735
1524
|
]
|
|
736
1525
|
});
|
|
737
1526
|
}
|
|
738
|
-
function
|
|
739
|
-
let {
|
|
740
|
-
|
|
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" });
|
|
741
1530
|
try {
|
|
742
|
-
let { data: e } = await
|
|
743
|
-
params: { path: { businessId:
|
|
744
|
-
body:
|
|
745
|
-
eventTypeId:
|
|
746
|
-
startsAt:
|
|
747
|
-
...
|
|
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 }
|
|
748
1537
|
}
|
|
749
1538
|
});
|
|
750
|
-
e
|
|
751
|
-
|
|
1539
|
+
if (!e) return;
|
|
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;
|
|
1541
|
+
if (!t) {
|
|
1542
|
+
v({
|
|
1543
|
+
step: "held",
|
|
1544
|
+
reservationId: e.id,
|
|
1545
|
+
expiresAt: e.expiresAt
|
|
1546
|
+
});
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
v({
|
|
1550
|
+
step: "pay",
|
|
752
1551
|
reservationId: e.id,
|
|
753
|
-
|
|
1552
|
+
held: {
|
|
1553
|
+
expiresAt: e.expiresAt,
|
|
1554
|
+
price: t
|
|
1555
|
+
}
|
|
754
1556
|
});
|
|
755
1557
|
} catch (e) {
|
|
756
|
-
let t = u(e, "post",
|
|
757
|
-
|
|
1558
|
+
let t = u(e, "post", Ye) ? e : void 0;
|
|
1559
|
+
v({
|
|
758
1560
|
step: "refused",
|
|
759
|
-
...
|
|
1561
|
+
...xe(t, it),
|
|
760
1562
|
again: !1
|
|
761
1563
|
});
|
|
762
1564
|
}
|
|
763
1565
|
}, [
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
]),
|
|
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,
|
|
1572
|
+
bookingId: t
|
|
1573
|
+
} } }).then(({ data: e }) => e ?? null).catch(() => null);
|
|
1574
|
+
n && e.onBooked?.(n), v({
|
|
1575
|
+
step: "booked",
|
|
1576
|
+
booking: n
|
|
1577
|
+
});
|
|
1578
|
+
}, [
|
|
1579
|
+
c,
|
|
1580
|
+
h.id,
|
|
1581
|
+
e.onBooked
|
|
1582
|
+
]), w = o(!1);
|
|
768
1583
|
r(() => {
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
1584
|
+
if (w.current) return;
|
|
1585
|
+
w.current = !0;
|
|
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);
|
|
1597
|
+
}
|
|
1598
|
+
async function E(t, n) {
|
|
1599
|
+
v({
|
|
773
1600
|
step: "confirming",
|
|
774
1601
|
reservationId: t,
|
|
775
|
-
expiresAt:
|
|
1602
|
+
expiresAt: n
|
|
776
1603
|
});
|
|
777
1604
|
try {
|
|
778
|
-
let { data:
|
|
779
|
-
businessId:
|
|
1605
|
+
let { data: n } = await c.POST(Xe, { params: { path: {
|
|
1606
|
+
businessId: h.id,
|
|
780
1607
|
reservationId: t
|
|
781
1608
|
} } });
|
|
782
|
-
if (!
|
|
783
|
-
e.onBooked?.(
|
|
784
|
-
let
|
|
785
|
-
businessId:
|
|
786
|
-
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
|
|
787
1614
|
} } }).then(({ data: e }) => e ?? null).catch(() => null);
|
|
788
|
-
|
|
1615
|
+
v({
|
|
789
1616
|
step: "booked",
|
|
790
|
-
booking:
|
|
1617
|
+
booking: r
|
|
791
1618
|
});
|
|
792
1619
|
} catch (e) {
|
|
793
|
-
let t = u(e, "post",
|
|
794
|
-
t?.code === "ReservationExpired" || t?.code === "ReservationNotFound" ?
|
|
1620
|
+
let t = u(e, "post", Xe) ? e : void 0;
|
|
1621
|
+
t?.code === "ReservationExpired" || t?.code === "ReservationNotFound" ? v({
|
|
795
1622
|
step: "refused",
|
|
796
1623
|
message: "book.expired",
|
|
797
1624
|
again: !0
|
|
798
|
-
}) :
|
|
1625
|
+
}) : v({
|
|
799
1626
|
step: "refused",
|
|
800
|
-
...
|
|
1627
|
+
...xe(t, Se),
|
|
801
1628
|
again: !1
|
|
802
1629
|
});
|
|
803
1630
|
}
|
|
804
1631
|
}
|
|
805
|
-
let
|
|
1632
|
+
let D = /* @__PURE__ */ f("button", {
|
|
806
1633
|
type: "button",
|
|
807
1634
|
className: "cp-secondary",
|
|
808
1635
|
onClick: e.onBack,
|
|
809
|
-
children:
|
|
1636
|
+
children: n("book.back")
|
|
810
1637
|
});
|
|
811
1638
|
return /* @__PURE__ */ p("section", {
|
|
812
1639
|
className: "cp-screen",
|
|
813
|
-
children: [/* @__PURE__ */ f("h1", { children:
|
|
1640
|
+
children: [/* @__PURE__ */ f("h1", { children: n("book.heading") }), _.step === "booked" ? /* @__PURE__ */ p(d, { children: [
|
|
814
1641
|
/* @__PURE__ */ f("p", {
|
|
815
1642
|
role: "status",
|
|
816
1643
|
className: "cp-notice",
|
|
817
|
-
children:
|
|
1644
|
+
children: n(y ?? "book.booked")
|
|
818
1645
|
}),
|
|
819
|
-
|
|
1646
|
+
_.booking ? /* @__PURE__ */ f("ul", {
|
|
820
1647
|
className: "cp-list",
|
|
821
|
-
children: /* @__PURE__ */ f(
|
|
822
|
-
booking:
|
|
1648
|
+
children: /* @__PURE__ */ f(Fe, {
|
|
1649
|
+
booking: _.booking,
|
|
823
1650
|
onCancelled: (e, t) => {
|
|
824
|
-
|
|
1651
|
+
v({
|
|
825
1652
|
step: "booked",
|
|
826
1653
|
booking: e
|
|
827
|
-
}),
|
|
1654
|
+
}), b(t ? "bookings.doneLate" : "bookings.doneOnTime");
|
|
828
1655
|
}
|
|
829
1656
|
})
|
|
830
|
-
}) : /* @__PURE__ */ f(
|
|
831
|
-
|
|
1657
|
+
}) : /* @__PURE__ */ f(X, { choice: e.choice }),
|
|
1658
|
+
m ? /* @__PURE__ */ f("button", {
|
|
832
1659
|
type: "button",
|
|
833
1660
|
className: "cp-secondary",
|
|
834
|
-
onClick: () =>
|
|
835
|
-
children:
|
|
1661
|
+
onClick: () => l("bookings"),
|
|
1662
|
+
children: n("book.toBookings")
|
|
836
1663
|
}) : e.onDone && /* @__PURE__ */ f("button", {
|
|
837
1664
|
type: "button",
|
|
838
1665
|
className: "cp-secondary",
|
|
839
1666
|
onClick: e.onDone,
|
|
840
|
-
children:
|
|
1667
|
+
children: n("book.done")
|
|
841
1668
|
})
|
|
842
1669
|
] }) : /* @__PURE__ */ p(d, { children: [
|
|
843
|
-
/* @__PURE__ */ f(
|
|
844
|
-
|
|
1670
|
+
/* @__PURE__ */ f(X, { choice: e.choice }),
|
|
1671
|
+
_.step === "reserving" && /* @__PURE__ */ f("p", {
|
|
845
1672
|
role: "status",
|
|
846
|
-
children:
|
|
1673
|
+
children: n("book.reserving")
|
|
847
1674
|
}),
|
|
848
|
-
(
|
|
1675
|
+
(_.step === "held" || _.step === "confirming") && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
849
1676
|
className: "cp-hint",
|
|
850
|
-
children:
|
|
1677
|
+
children: n("book.heldUntil", { time: a(_.expiresAt, g.timezone) })
|
|
851
1678
|
}), /* @__PURE__ */ p("div", {
|
|
852
1679
|
className: "cp-actions",
|
|
853
1680
|
children: [/* @__PURE__ */ f("button", {
|
|
854
1681
|
type: "button",
|
|
855
|
-
disabled:
|
|
856
|
-
onClick: () =>
|
|
857
|
-
children:
|
|
858
|
-
}),
|
|
1682
|
+
disabled: _.step === "confirming",
|
|
1683
|
+
onClick: () => E(_.reservationId, _.expiresAt),
|
|
1684
|
+
children: _.step === "confirming" ? n("book.confirming") : n("book.confirm")
|
|
1685
|
+
}), D]
|
|
859
1686
|
})] }),
|
|
860
|
-
|
|
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
|
|
1695
|
+
}),
|
|
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", {
|
|
861
1707
|
role: "alert",
|
|
862
|
-
children:
|
|
1708
|
+
children: n(_.message, _.until ? { date: i(_.until, g.timezone) } : {})
|
|
863
1709
|
}), /* @__PURE__ */ p("div", {
|
|
864
1710
|
className: "cp-actions",
|
|
865
|
-
children: [
|
|
1711
|
+
children: [_.again && /* @__PURE__ */ f("button", {
|
|
866
1712
|
type: "button",
|
|
867
|
-
onClick:
|
|
868
|
-
children:
|
|
869
|
-
}),
|
|
1713
|
+
onClick: S,
|
|
1714
|
+
children: n("book.reserveAgain")
|
|
1715
|
+
}), D]
|
|
870
1716
|
})] })
|
|
871
1717
|
] })]
|
|
872
1718
|
});
|
|
873
1719
|
}
|
|
874
|
-
function
|
|
875
|
-
if (e?.code !== "BookingBanned") return { message: t(e?.code) };
|
|
876
|
-
let { bannedUntil: r } = e.body ?? {};
|
|
877
|
-
return r ? {
|
|
878
|
-
message: "book.banned",
|
|
879
|
-
date: j(r, n)
|
|
880
|
-
} : { message: "book.banned.undated" };
|
|
881
|
-
}
|
|
882
|
-
function _e(e) {
|
|
1720
|
+
function it(e) {
|
|
883
1721
|
switch (e) {
|
|
884
1722
|
case "EventFull": return "book.full";
|
|
885
1723
|
case "SlotTaken": return "book.slotTaken";
|
|
@@ -894,18 +1732,28 @@ function _e(e) {
|
|
|
894
1732
|
default: return "book.failed";
|
|
895
1733
|
}
|
|
896
1734
|
}
|
|
897
|
-
function
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
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;
|
|
1737
|
+
return /* @__PURE__ */ p(d, { children: [
|
|
1738
|
+
/* @__PURE__ */ f("p", {
|
|
1739
|
+
className: "cp-price",
|
|
1740
|
+
children: t("pay.price", { price: o(i.amount) })
|
|
1741
|
+
}),
|
|
1742
|
+
/* @__PURE__ */ f("p", {
|
|
1743
|
+
className: "cp-hint",
|
|
1744
|
+
children: s === 0 ? t("pay.later", { price: o(i.amount) }) : s === i.amount ? t("pay.whole", { advance: o(s) }) : t("pay.advance", {
|
|
1745
|
+
advance: o(s),
|
|
1746
|
+
rest: o(i.amount - s)
|
|
1747
|
+
})
|
|
1748
|
+
}),
|
|
1749
|
+
/* @__PURE__ */ f("p", {
|
|
1750
|
+
className: "cp-hint",
|
|
1751
|
+
children: t("book.heldUntil", { time: r(a, e.timeZone) })
|
|
1752
|
+
})
|
|
1753
|
+
] });
|
|
906
1754
|
}
|
|
907
1755
|
// src/layout.tsx
|
|
908
|
-
function
|
|
1756
|
+
function ot({ brand: e }) {
|
|
909
1757
|
return e ? /* @__PURE__ */ p("div", {
|
|
910
1758
|
className: "cp-brand",
|
|
911
1759
|
children: [e.logo && /* @__PURE__ */ f("img", {
|
|
@@ -914,39 +1762,39 @@ function ye({ brand: e }) {
|
|
|
914
1762
|
}), /* @__PURE__ */ f("span", { children: e.name })]
|
|
915
1763
|
}) : null;
|
|
916
1764
|
}
|
|
917
|
-
var
|
|
1765
|
+
var st = [["businesses", "nav.book"]], ct = [
|
|
918
1766
|
["bookings", "nav.bookings"],
|
|
919
1767
|
["passes", "nav.passes"],
|
|
920
1768
|
["details", "nav.details"]
|
|
921
|
-
],
|
|
922
|
-
function
|
|
923
|
-
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";
|
|
924
1772
|
return /* @__PURE__ */ p("div", {
|
|
925
1773
|
className: "cp-shell",
|
|
926
1774
|
children: [
|
|
927
1775
|
/* @__PURE__ */ p("header", {
|
|
928
1776
|
className: "cp-header",
|
|
929
|
-
children: [/* @__PURE__ */ f(
|
|
1777
|
+
children: [/* @__PURE__ */ f(ot, { brand: e.brand }), e.signedIn ? /* @__PURE__ */ f("button", {
|
|
930
1778
|
type: "button",
|
|
931
1779
|
className: "cp-link",
|
|
932
1780
|
onClick: e.onSignOut,
|
|
933
|
-
children:
|
|
1781
|
+
children: t("nav.signOut")
|
|
934
1782
|
}) : !e.signingIn && /* @__PURE__ */ f("button", {
|
|
935
1783
|
type: "button",
|
|
936
1784
|
className: "cp-link",
|
|
937
1785
|
onClick: () => e.onNavigate("bookings"),
|
|
938
|
-
children:
|
|
1786
|
+
children: t("nav.signIn")
|
|
939
1787
|
})]
|
|
940
1788
|
}),
|
|
941
1789
|
/* @__PURE__ */ f("nav", {
|
|
942
1790
|
className: "cp-nav",
|
|
943
|
-
"aria-label":
|
|
944
|
-
children: e.tabs.map(([
|
|
1791
|
+
"aria-label": t("nav.label"),
|
|
1792
|
+
children: e.tabs.map(([r, i]) => /* @__PURE__ */ f("button", {
|
|
945
1793
|
type: "button",
|
|
946
|
-
"aria-current":
|
|
947
|
-
onClick: () => e.onNavigate(
|
|
948
|
-
children:
|
|
949
|
-
},
|
|
1794
|
+
"aria-current": n === r ? "page" : void 0,
|
|
1795
|
+
onClick: () => e.onNavigate(r),
|
|
1796
|
+
children: t(i)
|
|
1797
|
+
}, r))
|
|
950
1798
|
}),
|
|
951
1799
|
/* @__PURE__ */ f("main", {
|
|
952
1800
|
className: "cp-main",
|
|
@@ -955,331 +1803,650 @@ function Ce(e) {
|
|
|
955
1803
|
]
|
|
956
1804
|
});
|
|
957
1805
|
}
|
|
958
|
-
// src/client.ts
|
|
959
|
-
var we = (e, t) => {
|
|
960
|
-
let n = new Request(e, t);
|
|
961
|
-
return n.headers.set("X-MSM-BFF", "1"), fetch(n);
|
|
962
|
-
};
|
|
963
|
-
function U(e, t, n) {
|
|
964
|
-
return we(`${e}${t}`, {
|
|
965
|
-
method: "POST",
|
|
966
|
-
headers: { "content-type": "application/json" },
|
|
967
|
-
body: JSON.stringify(n ?? {})
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
function Te(e, t) {
|
|
971
|
-
let n = l({ baseUrl: `${e}/engine` });
|
|
972
|
-
return n.use({
|
|
973
|
-
onRequest({ request: e }) {
|
|
974
|
-
return e.headers.set("X-MSM-BFF", "1"), e;
|
|
975
|
-
},
|
|
976
|
-
onResponse({ response: e }) {
|
|
977
|
-
e.status === 401 && t();
|
|
978
|
-
}
|
|
979
|
-
}), n;
|
|
980
|
-
}
|
|
981
|
-
// src/session.ts
|
|
982
|
-
var Ee = /* @__PURE__ */ new Map();
|
|
983
|
-
function W(e) {
|
|
984
|
-
let t = Ee.get(e);
|
|
985
|
-
return t || (t = {
|
|
986
|
-
value: void 0,
|
|
987
|
-
listeners: /* @__PURE__ */ new Set(),
|
|
988
|
-
generation: 0
|
|
989
|
-
}, Ee.set(e, t)), t;
|
|
990
|
-
}
|
|
991
|
-
function G(e, t) {
|
|
992
|
-
let n = W(e);
|
|
993
|
-
if (n.value !== t) {
|
|
994
|
-
n.value = t;
|
|
995
|
-
for (let e of n.listeners) e();
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
function De(e, t) {
|
|
999
|
-
let { generation: n } = t, r = (r) => {
|
|
1000
|
-
t.generation === n && t.value === void 0 && G(e, r);
|
|
1001
|
-
};
|
|
1002
|
-
we(`${e}/auth/session`).then(async (e) => r(e.ok ? (await e.json()).sessionKey : null)).catch(() => r(null));
|
|
1003
|
-
}
|
|
1004
|
-
function Oe(e, t) {
|
|
1005
|
-
let n = W(e);
|
|
1006
|
-
return n.listeners.size === 0 && n.value === void 0 && De(e, n), n.listeners.add(t), () => {
|
|
1007
|
-
n.listeners.delete(t), n.listeners.size === 0 && queueMicrotask(() => {
|
|
1008
|
-
n.listeners.size > 0 || (n.value = void 0, n.generation++);
|
|
1009
|
-
});
|
|
1010
|
-
};
|
|
1011
|
-
}
|
|
1012
|
-
function ke(e, t) {
|
|
1013
|
-
let n = c((t) => Oe(e, t), () => W(e).value, () => void 0), i = o(void 0), a = o(t);
|
|
1014
|
-
return a.current = t, r(() => {
|
|
1015
|
-
if (n === void 0) return;
|
|
1016
|
-
let e = n !== null;
|
|
1017
|
-
i.current !== void 0 && i.current !== e && a.current?.(e), i.current = e;
|
|
1018
|
-
}, [n]), n;
|
|
1019
|
-
}
|
|
1020
|
-
// src/portal.tsx
|
|
1021
|
-
function K(e) {
|
|
1022
|
-
let { navigate: n, accountNavigation: i } = e, c = e.basePath.replace(/\/$/, ""), l = ke(c, e.onSessionChange), u = o(!1);
|
|
1023
|
-
u.current = !!l;
|
|
1024
|
-
let [d, f] = s(), [p, m] = s(/* @__PURE__ */ new Map()), [h, g] = s("loading"), _ = a(() => Te(c, () => {
|
|
1025
|
-
u.current && f("app.signedOut"), G(c, null);
|
|
1026
|
-
}), [c]), v = t(async () => {
|
|
1027
|
-
g("loading");
|
|
1028
|
-
try {
|
|
1029
|
-
let e = /* @__PURE__ */ new Map(), t;
|
|
1030
|
-
do {
|
|
1031
|
-
let { data: n } = await _.GET("/web/businesses", { params: { query: {
|
|
1032
|
-
limit: 100,
|
|
1033
|
-
...t && { cursor: t }
|
|
1034
|
-
} } });
|
|
1035
|
-
for (let t of n?.items ?? []) e.set(t.id, t);
|
|
1036
|
-
t = n?.nextCursor ?? void 0;
|
|
1037
|
-
} while (t);
|
|
1038
|
-
m(e), g("ready");
|
|
1039
|
-
} catch {
|
|
1040
|
-
g("failed");
|
|
1041
|
-
}
|
|
1042
|
-
}, [_]);
|
|
1043
|
-
return r(() => {
|
|
1044
|
-
v();
|
|
1045
|
-
}, [v]), {
|
|
1046
|
-
basePath: c,
|
|
1047
|
-
sessionKey: l,
|
|
1048
|
-
notice: d,
|
|
1049
|
-
portal: a(() => ({
|
|
1050
|
-
client: _,
|
|
1051
|
-
businesses: p,
|
|
1052
|
-
businessesStatus: h,
|
|
1053
|
-
reloadBusinesses: () => void v(),
|
|
1054
|
-
navigate: n,
|
|
1055
|
-
accountNavigation: i,
|
|
1056
|
-
signOut: async (e) => {
|
|
1057
|
-
await U(c, "/auth/logout").catch(() => {}), f(e), G(c, null);
|
|
1058
|
-
}
|
|
1059
|
-
}), [
|
|
1060
|
-
_,
|
|
1061
|
-
p,
|
|
1062
|
-
h,
|
|
1063
|
-
v,
|
|
1064
|
-
n,
|
|
1065
|
-
i,
|
|
1066
|
-
c
|
|
1067
|
-
]),
|
|
1068
|
-
signedInAs: t((e) => {
|
|
1069
|
-
f(void 0), G(c, e);
|
|
1070
|
-
}, [c])
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
function q(e) {
|
|
1074
|
-
return /* @__PURE__ */ f("div", {
|
|
1075
|
-
className: "msm-customer",
|
|
1076
|
-
children: e.loading ? /* @__PURE__ */ f("p", {
|
|
1077
|
-
className: "cp-status",
|
|
1078
|
-
role: "status",
|
|
1079
|
-
children: T("app.loading")
|
|
1080
|
-
}) : /* @__PURE__ */ f(b.Provider, {
|
|
1081
|
-
value: e.portal,
|
|
1082
|
-
children: e.children
|
|
1083
|
-
})
|
|
1084
|
-
});
|
|
1085
|
-
}
|
|
1086
1806
|
// src/screens/businesses.tsx
|
|
1087
|
-
function
|
|
1088
|
-
let {
|
|
1807
|
+
function dt() {
|
|
1808
|
+
let { t: e } = I(), { businesses: t, businessesStatus: n, reloadBusinesses: r, navigate: i } = x(), a = [...t.values()];
|
|
1089
1809
|
return /* @__PURE__ */ p("section", {
|
|
1090
1810
|
className: "cp-screen",
|
|
1091
|
-
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", {
|
|
1092
1812
|
role: "status",
|
|
1093
|
-
children:
|
|
1094
|
-
}) :
|
|
1813
|
+
children: e("app.loading")
|
|
1814
|
+
}) : a.length === 0 ? /* @__PURE__ */ f("p", {
|
|
1095
1815
|
className: "cp-empty",
|
|
1096
|
-
children:
|
|
1816
|
+
children: e("businesses.empty")
|
|
1097
1817
|
}) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("p", {
|
|
1098
1818
|
className: "cp-hint",
|
|
1099
|
-
children:
|
|
1819
|
+
children: e("businesses.intro")
|
|
1100
1820
|
}), /* @__PURE__ */ f("ul", {
|
|
1101
1821
|
className: "cp-list",
|
|
1102
|
-
children:
|
|
1822
|
+
children: a.map((t) => /* @__PURE__ */ p("li", {
|
|
1103
1823
|
className: "cp-card cp-business",
|
|
1104
1824
|
children: [
|
|
1105
|
-
/* @__PURE__ */ f(
|
|
1106
|
-
image:
|
|
1825
|
+
/* @__PURE__ */ f(J, {
|
|
1826
|
+
image: t.logo,
|
|
1107
1827
|
alt: "",
|
|
1108
1828
|
size: "small",
|
|
1109
1829
|
className: "cp-logo"
|
|
1110
1830
|
}),
|
|
1111
|
-
/* @__PURE__ */ f("h2", { children:
|
|
1112
|
-
|
|
1831
|
+
/* @__PURE__ */ f("h2", { children: t.displayName }),
|
|
1832
|
+
t.address && /* @__PURE__ */ f("p", { children: t.address }),
|
|
1113
1833
|
/* @__PURE__ */ f("button", {
|
|
1114
1834
|
type: "button",
|
|
1115
|
-
onClick: () =>
|
|
1116
|
-
children:
|
|
1835
|
+
onClick: () => i({ businessId: t.id }),
|
|
1836
|
+
children: e("businesses.open")
|
|
1117
1837
|
})
|
|
1118
1838
|
]
|
|
1119
|
-
},
|
|
1839
|
+
}, t.id))
|
|
1120
1840
|
})] })]
|
|
1121
1841
|
});
|
|
1122
1842
|
}
|
|
1123
1843
|
// src/screens/details.tsx
|
|
1124
|
-
function
|
|
1125
|
-
let {
|
|
1126
|
-
|
|
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);
|
|
1127
1847
|
try {
|
|
1128
|
-
let { data:
|
|
1129
|
-
|
|
1848
|
+
let { data: e } = await n.GET("/web/me");
|
|
1849
|
+
e && (o(e), l(e.name));
|
|
1130
1850
|
} catch {
|
|
1131
|
-
|
|
1851
|
+
m(!0);
|
|
1132
1852
|
}
|
|
1133
|
-
}, [
|
|
1853
|
+
}, [n]);
|
|
1134
1854
|
r(() => {
|
|
1135
|
-
|
|
1136
|
-
}, [
|
|
1137
|
-
async function
|
|
1138
|
-
|
|
1855
|
+
y();
|
|
1856
|
+
}, [y]);
|
|
1857
|
+
async function b(e) {
|
|
1858
|
+
e.preventDefault(), g(!0), v(void 0);
|
|
1139
1859
|
try {
|
|
1140
|
-
await
|
|
1860
|
+
await n.PATCH("/web/me", { body: { name: c.trim() } }), o((e) => e && {
|
|
1141
1861
|
...e,
|
|
1142
|
-
name:
|
|
1143
|
-
}), c
|
|
1862
|
+
name: c.trim()
|
|
1863
|
+
}), l(c.trim()), v({
|
|
1144
1864
|
key: "details.saved",
|
|
1145
1865
|
alert: !1
|
|
1146
1866
|
});
|
|
1147
1867
|
} catch {
|
|
1148
|
-
|
|
1868
|
+
v({
|
|
1149
1869
|
key: "details.saveFailed",
|
|
1150
1870
|
alert: !0
|
|
1151
1871
|
});
|
|
1152
1872
|
} finally {
|
|
1153
|
-
|
|
1873
|
+
g(!1);
|
|
1154
1874
|
}
|
|
1155
1875
|
}
|
|
1156
|
-
async function
|
|
1157
|
-
|
|
1876
|
+
async function S() {
|
|
1877
|
+
g(!0), v(void 0);
|
|
1158
1878
|
try {
|
|
1159
|
-
await
|
|
1879
|
+
await n.DELETE("/web/me/sessions"), await i("app.signedOutEverywhere");
|
|
1160
1880
|
} catch {
|
|
1161
|
-
|
|
1881
|
+
v({
|
|
1162
1882
|
key: "details.signOutEverywhereFailed",
|
|
1163
1883
|
alert: !0
|
|
1164
|
-
}),
|
|
1884
|
+
}), g(!1);
|
|
1165
1885
|
}
|
|
1166
1886
|
}
|
|
1167
1887
|
return /* @__PURE__ */ p("section", {
|
|
1168
1888
|
className: "cp-screen",
|
|
1169
|
-
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", {
|
|
1170
1890
|
className: "cp-card cp-form",
|
|
1171
|
-
onSubmit:
|
|
1172
|
-
"aria-busy":
|
|
1891
|
+
onSubmit: b,
|
|
1892
|
+
"aria-busy": h,
|
|
1173
1893
|
children: [
|
|
1174
|
-
/* @__PURE__ */ p("label", { children: [
|
|
1175
|
-
value:
|
|
1176
|
-
onChange: (e) =>
|
|
1894
|
+
/* @__PURE__ */ p("label", { children: [e("details.name"), /* @__PURE__ */ f("input", {
|
|
1895
|
+
value: c,
|
|
1896
|
+
onChange: (e) => l(e.target.value),
|
|
1177
1897
|
autoComplete: "name",
|
|
1178
1898
|
maxLength: 200,
|
|
1179
1899
|
required: !0
|
|
1180
1900
|
})] }),
|
|
1181
1901
|
/* @__PURE__ */ p("dl", { children: [
|
|
1182
|
-
/* @__PURE__ */ f("dt", { children:
|
|
1183
|
-
/* @__PURE__ */ f("dd", { children:
|
|
1184
|
-
/* @__PURE__ */ f("dt", { children:
|
|
1185
|
-
/* @__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") })
|
|
1186
1906
|
] }),
|
|
1187
1907
|
/* @__PURE__ */ f("p", {
|
|
1188
1908
|
className: "cp-hint",
|
|
1189
|
-
children:
|
|
1909
|
+
children: e("details.readOnly")
|
|
1190
1910
|
}),
|
|
1191
|
-
|
|
1192
|
-
role:
|
|
1193
|
-
children:
|
|
1911
|
+
_ && /* @__PURE__ */ f("p", {
|
|
1912
|
+
role: _.alert ? "alert" : "status",
|
|
1913
|
+
children: e(_.key)
|
|
1194
1914
|
}),
|
|
1195
1915
|
/* @__PURE__ */ f("button", {
|
|
1196
1916
|
type: "submit",
|
|
1197
|
-
disabled:
|
|
1198
|
-
children:
|
|
1917
|
+
disabled: h || !c.trim() || c.trim() === a.name,
|
|
1918
|
+
children: e(h ? "details.saving" : "details.save")
|
|
1199
1919
|
})
|
|
1200
1920
|
]
|
|
1201
1921
|
}), /* @__PURE__ */ p("div", {
|
|
1202
1922
|
className: "cp-card cp-form",
|
|
1203
1923
|
children: [/* @__PURE__ */ f("p", {
|
|
1204
1924
|
className: "cp-hint",
|
|
1205
|
-
children:
|
|
1925
|
+
children: e("details.signOutEverywhereHint")
|
|
1206
1926
|
}), /* @__PURE__ */ f("button", {
|
|
1207
1927
|
type: "button",
|
|
1208
1928
|
className: "cp-secondary",
|
|
1209
|
-
disabled:
|
|
1210
|
-
onClick:
|
|
1211
|
-
children:
|
|
1929
|
+
disabled: h,
|
|
1930
|
+
onClick: S,
|
|
1931
|
+
children: e("details.signOutEverywhere")
|
|
1212
1932
|
})]
|
|
1213
1933
|
})] }) : /* @__PURE__ */ f("p", {
|
|
1214
1934
|
role: "status",
|
|
1215
|
-
children:
|
|
1935
|
+
children: e("app.loading")
|
|
1216
1936
|
})]
|
|
1217
1937
|
});
|
|
1218
1938
|
}
|
|
1939
|
+
// src/screens/shop.tsx
|
|
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);
|
|
1943
|
+
if (t !== "paid" && t !== "back") return null;
|
|
1944
|
+
e.searchParams.delete(Z), window.history.replaceState(window.history.state, "", e.toString());
|
|
1945
|
+
try {
|
|
1946
|
+
let e = window.sessionStorage.getItem(mt);
|
|
1947
|
+
return window.sessionStorage.removeItem(mt), e ? {
|
|
1948
|
+
outcome: t,
|
|
1949
|
+
purchase: JSON.parse(e)
|
|
1950
|
+
} : null;
|
|
1951
|
+
} catch {
|
|
1952
|
+
return null;
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
function gt(e, t) {
|
|
1956
|
+
let n = o(!1);
|
|
1957
|
+
r(() => {
|
|
1958
|
+
n.current || (n.current = !0, e !== "passes" && !me() && new URL(window.location.href).searchParams.has(Z) && t("passes"));
|
|
1959
|
+
}, [e, t]);
|
|
1960
|
+
}
|
|
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();
|
|
1963
|
+
r(() => {
|
|
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,
|
|
1971
|
+
methods: a
|
|
1972
|
+
})) : [];
|
|
1973
|
+
})).then((t) => {
|
|
1974
|
+
e && h(t.flat());
|
|
1975
|
+
}), () => {
|
|
1976
|
+
e = !1;
|
|
1977
|
+
};
|
|
1978
|
+
}, [
|
|
1979
|
+
i,
|
|
1980
|
+
c,
|
|
1981
|
+
l
|
|
1982
|
+
]);
|
|
1983
|
+
let b = o(!0), S = o(0);
|
|
1984
|
+
r(() => (b.current = !0, () => {
|
|
1985
|
+
b.current = !1;
|
|
1986
|
+
}), []);
|
|
1987
|
+
let C = t(async (e, t, n) => {
|
|
1988
|
+
y(n ? {
|
|
1989
|
+
message: n.opened ? "shop.away" : "pay.awayBlocked",
|
|
1990
|
+
link: n.redirectUrl
|
|
1991
|
+
} : { message: "pay.checking" });
|
|
1992
|
+
let r = n && Date.now() + 9e5, a = ++S.current, o = () => b.current && S.current === a;
|
|
1993
|
+
for (let a = 0; o(); a++) {
|
|
1994
|
+
let { data: s } = await i.GET(pt, { params: { path: t } }).catch(() => ({ data: void 0 }));
|
|
1995
|
+
if (!o()) return;
|
|
1996
|
+
if (!s && r && Date.now() <= r) {
|
|
1997
|
+
await he(3e3);
|
|
1998
|
+
continue;
|
|
1999
|
+
}
|
|
2000
|
+
if (s?.status === "paid") return y({ message: "shop.paid" });
|
|
2001
|
+
let c = s?.payment?.status === "FAILED" || s?.payment?.status === "EXPIRED";
|
|
2002
|
+
if (!s || c) return y({
|
|
2003
|
+
message: "shop.notPaid",
|
|
2004
|
+
alert: !0
|
|
2005
|
+
});
|
|
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);
|
|
2009
|
+
}
|
|
2010
|
+
}, [i]), w = o(!1);
|
|
2011
|
+
r(() => {
|
|
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
|
|
2023
|
+
};
|
|
2024
|
+
try {
|
|
2025
|
+
let { data: e } = await i.POST(pt, {
|
|
2026
|
+
params: { path: r },
|
|
2027
|
+
body: {
|
|
2028
|
+
paymentMethodId: t.id,
|
|
2029
|
+
successUrl: B(Z, "paid", n),
|
|
2030
|
+
cancelUrl: B(Z, "back", n)
|
|
2031
|
+
}
|
|
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({
|
|
2035
|
+
message: "pay.unavailable",
|
|
2036
|
+
alert: !0
|
|
2037
|
+
});
|
|
2038
|
+
if (n) {
|
|
2039
|
+
pe(n, a), C("paid", r, {
|
|
2040
|
+
redirectUrl: a,
|
|
2041
|
+
opened: !!n.window
|
|
2042
|
+
});
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
try {
|
|
2046
|
+
window.sessionStorage.setItem(mt, JSON.stringify(r));
|
|
2047
|
+
} catch {}
|
|
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" ? {
|
|
2053
|
+
message: "shop.outside",
|
|
2054
|
+
business: e.business.displayName,
|
|
2055
|
+
alert: !0
|
|
2056
|
+
} : r === "ProductInactive" || r === "ProductNotFound" ? {
|
|
2057
|
+
message: "shop.gone",
|
|
2058
|
+
alert: !0
|
|
2059
|
+
} : r === "PaymentProviderNotOffered" || r === "PaymentProviderNotConnected" ? {
|
|
2060
|
+
message: "pay.notOffered",
|
|
2061
|
+
alert: !0
|
|
2062
|
+
} : {
|
|
2063
|
+
message: "pay.unavailable",
|
|
2064
|
+
alert: !0
|
|
2065
|
+
});
|
|
2066
|
+
} finally {
|
|
2067
|
+
_(!1);
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
return !m.length && !v ? null : /* @__PURE__ */ p(d, { children: [
|
|
2071
|
+
/* @__PURE__ */ f("h2", {
|
|
2072
|
+
className: "cp-section",
|
|
2073
|
+
children: e("shop.heading")
|
|
2074
|
+
}),
|
|
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 ?? "" })
|
|
2079
|
+
}),
|
|
2080
|
+
v?.link && /* @__PURE__ */ f("div", {
|
|
2081
|
+
className: "cp-actions",
|
|
2082
|
+
children: /* @__PURE__ */ f("a", {
|
|
2083
|
+
className: "cp-button",
|
|
2084
|
+
href: v.link,
|
|
2085
|
+
target: "_blank",
|
|
2086
|
+
rel: "noopener",
|
|
2087
|
+
children: e("pay.open")
|
|
2088
|
+
})
|
|
2089
|
+
}),
|
|
2090
|
+
/* @__PURE__ */ f("ul", {
|
|
2091
|
+
className: "cp-list",
|
|
2092
|
+
children: m.map((t) => /* @__PURE__ */ p("li", {
|
|
2093
|
+
className: "cp-card",
|
|
2094
|
+
children: [
|
|
2095
|
+
/* @__PURE__ */ p("div", {
|
|
2096
|
+
className: "cp-card-head",
|
|
2097
|
+
children: [/* @__PURE__ */ f("h2", { children: t.product.title }), /* @__PURE__ */ f("span", {
|
|
2098
|
+
className: "cp-price",
|
|
2099
|
+
children: n(t.product.price, t.product.currency)
|
|
2100
|
+
})]
|
|
2101
|
+
}),
|
|
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", {
|
|
2105
|
+
className: "cp-hint",
|
|
2106
|
+
children: t.product.terms
|
|
2107
|
+
}),
|
|
2108
|
+
/* @__PURE__ */ f("div", {
|
|
2109
|
+
className: "cp-actions",
|
|
2110
|
+
children: t.methods.map((n) => /* @__PURE__ */ f("button", {
|
|
2111
|
+
type: "button",
|
|
2112
|
+
disabled: g,
|
|
2113
|
+
onClick: () => T(t, n),
|
|
2114
|
+
children: e("shop.buy", { provider: n.label })
|
|
2115
|
+
}, n.id))
|
|
2116
|
+
})
|
|
2117
|
+
]
|
|
2118
|
+
}, t.product.id))
|
|
2119
|
+
})
|
|
2120
|
+
] });
|
|
2121
|
+
}
|
|
1219
2122
|
// src/screens/passes.tsx
|
|
1220
|
-
function
|
|
1221
|
-
let {
|
|
1222
|
-
|
|
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);
|
|
1223
2126
|
try {
|
|
1224
|
-
let { data:
|
|
1225
|
-
|
|
2127
|
+
let { data: e } = await i.GET("/web/me/memberships");
|
|
2128
|
+
e && c(e);
|
|
1226
2129
|
} catch {
|
|
1227
|
-
|
|
2130
|
+
u(!0);
|
|
1228
2131
|
}
|
|
1229
|
-
}, [
|
|
2132
|
+
}, [i]);
|
|
1230
2133
|
return r(() => {
|
|
1231
|
-
|
|
1232
|
-
}, [
|
|
2134
|
+
d();
|
|
2135
|
+
}, [d]), /* @__PURE__ */ p("section", {
|
|
1233
2136
|
className: "cp-screen",
|
|
1234
|
-
children: [
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
className: "cp-
|
|
1248
|
-
children:
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
2137
|
+
children: [
|
|
2138
|
+
/* @__PURE__ */ f("h1", { children: e("passes.heading") }),
|
|
2139
|
+
l ? /* @__PURE__ */ f(q, { onRetry: d }) : o ? o.length === 0 ? /* @__PURE__ */ f("p", {
|
|
2140
|
+
className: "cp-empty",
|
|
2141
|
+
children: e("passes.empty")
|
|
2142
|
+
}) : /* @__PURE__ */ f("ul", {
|
|
2143
|
+
className: "cp-list",
|
|
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();
|
|
2146
|
+
return /* @__PURE__ */ p("li", {
|
|
2147
|
+
className: "cp-card",
|
|
2148
|
+
children: [
|
|
2149
|
+
/* @__PURE__ */ p("div", {
|
|
2150
|
+
className: "cp-card-head",
|
|
2151
|
+
children: [/* @__PURE__ */ f("h2", { children: t.displayName }), o && /* @__PURE__ */ f("span", {
|
|
2152
|
+
className: "cp-badge",
|
|
2153
|
+
children: e("passes.expired")
|
|
2154
|
+
})]
|
|
2155
|
+
}),
|
|
2156
|
+
r && /* @__PURE__ */ f("p", { children: r.displayName }),
|
|
2157
|
+
/* @__PURE__ */ f("p", {
|
|
2158
|
+
className: "cp-credits",
|
|
2159
|
+
children: t.creditsRemaining === null || t.creditsTotal === null ? e("passes.unlimited") : e("passes.credits", {
|
|
2160
|
+
remaining: t.creditsRemaining,
|
|
2161
|
+
total: t.creditsTotal
|
|
2162
|
+
})
|
|
2163
|
+
}),
|
|
2164
|
+
/* @__PURE__ */ f("p", {
|
|
2165
|
+
className: "cp-hint",
|
|
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) })
|
|
1257
2170
|
})
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
}, e.id);
|
|
1268
|
-
})
|
|
1269
|
-
}) : /* @__PURE__ */ f("p", {
|
|
1270
|
-
role: "status",
|
|
1271
|
-
children: T("app.loading")
|
|
1272
|
-
})]
|
|
2171
|
+
]
|
|
2172
|
+
}, t.id);
|
|
2173
|
+
})
|
|
2174
|
+
}) : /* @__PURE__ */ f("p", {
|
|
2175
|
+
role: "status",
|
|
2176
|
+
children: e("app.loading")
|
|
2177
|
+
}),
|
|
2178
|
+
/* @__PURE__ */ f(_t, {})
|
|
2179
|
+
]
|
|
1273
2180
|
});
|
|
1274
2181
|
}
|
|
1275
2182
|
// ../ui/dist/index.js
|
|
1276
|
-
var
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
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) {
|
|
1283
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) => {
|
|
1284
2451
|
m(), e.onPick(t);
|
|
1285
2452
|
};
|
|
@@ -1302,7 +2469,7 @@ function Le(e) {
|
|
|
1302
2469
|
}), /* @__PURE__ */ f("button", {
|
|
1303
2470
|
type: "button",
|
|
1304
2471
|
onClick: m,
|
|
1305
|
-
children: "Close"
|
|
2472
|
+
children: e.closeLabel ?? "Close"
|
|
1306
2473
|
})]
|
|
1307
2474
|
}),
|
|
1308
2475
|
/* @__PURE__ */ f("input", {
|
|
@@ -1353,10 +2520,37 @@ function Le(e) {
|
|
|
1353
2520
|
]
|
|
1354
2521
|
});
|
|
1355
2522
|
}
|
|
1356
|
-
var
|
|
1357
|
-
|
|
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) {
|
|
1358
2552
|
for (let t = 1; t <= 3 && t <= e.length; t++) {
|
|
1359
|
-
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;
|
|
1360
2554
|
if (i) return {
|
|
1361
2555
|
code: n,
|
|
1362
2556
|
first: i,
|
|
@@ -1365,10 +2559,10 @@ function ze(e) {
|
|
|
1365
2559
|
}
|
|
1366
2560
|
return null;
|
|
1367
2561
|
}
|
|
1368
|
-
function
|
|
2562
|
+
function Ft(e, t) {
|
|
1369
2563
|
let n = /^\s*(\+|00)/.exec(e);
|
|
1370
2564
|
if (!n) return null;
|
|
1371
|
-
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);
|
|
1372
2566
|
if (!a) return null;
|
|
1373
2567
|
let o = _(`+${i}`), s = a.countries.includes(t) ? t : o?.country ?? a.first, c = 0;
|
|
1374
2568
|
for (let e = 0; e < a.code.length; c++) /\d/.test(r.charAt(c)) && e++;
|
|
@@ -1377,45 +2571,46 @@ function Be(e, t) {
|
|
|
1377
2571
|
text: o?.isValid() ? o.formatNational() : r.slice(c).replace(/^[\s\-().]+/, "")
|
|
1378
2572
|
};
|
|
1379
2573
|
}
|
|
1380
|
-
function
|
|
2574
|
+
function It(e, t) {
|
|
1381
2575
|
let n = t.replace(/\D/g, "");
|
|
1382
|
-
return n === "" ? "" : t.trim().startsWith("+") ? `+${n}` : _(t, e)?.number ?? `+${
|
|
1383
|
-
}
|
|
1384
|
-
function
|
|
1385
|
-
return
|
|
1386
|
-
}
|
|
1387
|
-
function
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
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);
|
|
1397
2592
|
}
|
|
1398
|
-
return
|
|
2593
|
+
return i.invalid(l);
|
|
1399
2594
|
}
|
|
1400
|
-
function
|
|
1401
|
-
return
|
|
2595
|
+
function zt(e, t = !1, n = "en") {
|
|
2596
|
+
return Rt(e, t, n);
|
|
1402
2597
|
}
|
|
1403
|
-
function
|
|
1404
|
-
return
|
|
2598
|
+
function Bt(e, t) {
|
|
2599
|
+
return Ft(e, t) ?? {
|
|
1405
2600
|
country: t,
|
|
1406
2601
|
text: e
|
|
1407
2602
|
};
|
|
1408
2603
|
}
|
|
1409
|
-
function
|
|
2604
|
+
function Vt(e) {
|
|
1410
2605
|
let t = i(), n = o(null), [a, c] = s(() => ({
|
|
1411
2606
|
value: e.value,
|
|
1412
|
-
...
|
|
2607
|
+
...Bt(e.value, "IS")
|
|
1413
2608
|
})), l = a;
|
|
1414
2609
|
e.value !== a.value && (l = {
|
|
1415
2610
|
value: e.value,
|
|
1416
|
-
...
|
|
2611
|
+
...Bt(e.value, a.country)
|
|
1417
2612
|
}, c(l));
|
|
1418
|
-
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 !== "";
|
|
1419
2614
|
r(() => {
|
|
1420
2615
|
let e = n.current?.form;
|
|
1421
2616
|
if (!e) return;
|
|
@@ -1424,8 +2619,8 @@ function Ke(e) {
|
|
|
1424
2619
|
};
|
|
1425
2620
|
return e.addEventListener("submit", t), () => e.removeEventListener("submit", t);
|
|
1426
2621
|
}, []);
|
|
1427
|
-
let
|
|
1428
|
-
let r =
|
|
2622
|
+
let S = (t, n) => {
|
|
2623
|
+
let r = It(t, n);
|
|
1429
2624
|
c({
|
|
1430
2625
|
value: r,
|
|
1431
2626
|
country: t,
|
|
@@ -1444,16 +2639,16 @@ function Ke(e) {
|
|
|
1444
2639
|
children: [/* @__PURE__ */ p("button", {
|
|
1445
2640
|
type: "button",
|
|
1446
2641
|
className: "msm-phone-country",
|
|
1447
|
-
"aria-label":
|
|
2642
|
+
"aria-label": `${_.countryCode}: ${jt(v.code, g)} +${v.callingCode}`,
|
|
1448
2643
|
"aria-haspopup": "dialog",
|
|
1449
2644
|
onClick: () => h(!0),
|
|
1450
2645
|
children: [
|
|
1451
2646
|
/* @__PURE__ */ f("span", {
|
|
1452
2647
|
"aria-hidden": "true",
|
|
1453
|
-
children:
|
|
2648
|
+
children: v.flag
|
|
1454
2649
|
}),
|
|
1455
2650
|
"+",
|
|
1456
|
-
|
|
2651
|
+
v.callingCode
|
|
1457
2652
|
]
|
|
1458
2653
|
}), /* @__PURE__ */ f("input", {
|
|
1459
2654
|
ref: n,
|
|
@@ -1464,49 +2659,50 @@ function Ke(e) {
|
|
|
1464
2659
|
autoComplete: e.autoComplete ?? "tel",
|
|
1465
2660
|
value: l.text,
|
|
1466
2661
|
"aria-required": e.required,
|
|
1467
|
-
"data-msm-phone-problem":
|
|
1468
|
-
"aria-invalid":
|
|
1469
|
-
"aria-describedby":
|
|
2662
|
+
"data-msm-phone-problem": y === "" ? void 0 : "",
|
|
2663
|
+
"aria-invalid": x || void 0,
|
|
2664
|
+
"aria-describedby": x ? `${t}-problem` : void 0,
|
|
1470
2665
|
onChange: (e) => {
|
|
1471
|
-
let t = e.target.value.replace(/[^\d\s\-().+]/g, ""), n =
|
|
1472
|
-
|
|
2666
|
+
let t = e.target.value.replace(/[^\d\s\-().+]/g, ""), n = Ft(t, l.country);
|
|
2667
|
+
S(n?.country ?? l.country, n?.text ?? t);
|
|
1473
2668
|
},
|
|
1474
2669
|
onBlur: () => {
|
|
1475
2670
|
l.text.trim() !== "" && d(!0);
|
|
1476
2671
|
}
|
|
1477
2672
|
})]
|
|
1478
2673
|
}),
|
|
1479
|
-
|
|
2674
|
+
x && /* @__PURE__ */ f("p", {
|
|
1480
2675
|
id: `${t}-problem`,
|
|
1481
2676
|
className: "msm-phone-problem",
|
|
1482
2677
|
role: "alert",
|
|
1483
|
-
children:
|
|
2678
|
+
children: b
|
|
1484
2679
|
}),
|
|
1485
|
-
m && /* @__PURE__ */ f(
|
|
1486
|
-
title:
|
|
1487
|
-
searchLabel:
|
|
1488
|
-
listLabel:
|
|
1489
|
-
empty:
|
|
1490
|
-
|
|
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),
|
|
1491
2687
|
selected: l.country,
|
|
1492
2688
|
onClose: () => h(!1),
|
|
1493
2689
|
onPick: (e) => {
|
|
1494
|
-
h(!1),
|
|
2690
|
+
h(!1), S(e, l.text), n.current?.focus();
|
|
1495
2691
|
}
|
|
1496
2692
|
})
|
|
1497
2693
|
]
|
|
1498
2694
|
});
|
|
1499
2695
|
}
|
|
1500
|
-
function
|
|
1501
|
-
let t =
|
|
1502
|
-
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) => ({
|
|
1503
2699
|
value: e.code,
|
|
1504
2700
|
label: e.name,
|
|
1505
2701
|
hint: `+${e.callingCode}`,
|
|
1506
2702
|
flag: e.flag
|
|
1507
2703
|
}));
|
|
1508
2704
|
}
|
|
1509
|
-
var
|
|
2705
|
+
var Ut = {
|
|
1510
2706
|
red: {
|
|
1511
2707
|
light: "#d14b4b",
|
|
1512
2708
|
dark: "#f07a7a"
|
|
@@ -1556,36 +2752,36 @@ var X = {
|
|
|
1556
2752
|
dark: "#9aa5b5"
|
|
1557
2753
|
}
|
|
1558
2754
|
};
|
|
1559
|
-
function
|
|
1560
|
-
let { light: t, dark: n } =
|
|
2755
|
+
function Wt(e) {
|
|
2756
|
+
let { light: t, dark: n } = Ut[e in Ut ? e : "slate"];
|
|
1561
2757
|
return `light-dark(${t}, ${n})`;
|
|
1562
2758
|
}
|
|
1563
2759
|
// src/bot-check.tsx
|
|
1564
|
-
var
|
|
1565
|
-
function
|
|
1566
|
-
let e =
|
|
1567
|
-
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) => {
|
|
1568
2764
|
let n = document.createElement("script");
|
|
1569
|
-
n.src =
|
|
2765
|
+
n.src = Kt, n.async = !0;
|
|
1570
2766
|
let r = () => {
|
|
1571
|
-
|
|
2767
|
+
qt = void 0, n.remove(), t(/* @__PURE__ */ Error("Turnstile did not load."));
|
|
1572
2768
|
};
|
|
1573
2769
|
n.onload = () => {
|
|
1574
|
-
let t =
|
|
2770
|
+
let t = Gt();
|
|
1575
2771
|
t ? e(t) : r();
|
|
1576
2772
|
}, n.onerror = r, document.head.append(n);
|
|
1577
|
-
}),
|
|
2773
|
+
}), qt);
|
|
1578
2774
|
}
|
|
1579
|
-
function
|
|
2775
|
+
function Yt(e) {
|
|
1580
2776
|
return e?.provider === "turnstile" && typeof e.siteKey == "string" && e.siteKey.trim() !== "";
|
|
1581
2777
|
}
|
|
1582
|
-
function
|
|
2778
|
+
function Xt(e) {
|
|
1583
2779
|
let t = o(null), n = o(void 0), i = o(e);
|
|
1584
2780
|
i.current = e;
|
|
1585
2781
|
let { siteKey: a } = e.botCheck;
|
|
1586
2782
|
r(() => {
|
|
1587
2783
|
let e = !0;
|
|
1588
|
-
return
|
|
2784
|
+
return Jt().then((r) => {
|
|
1589
2785
|
let o = t.current;
|
|
1590
2786
|
if (!e || !o) return;
|
|
1591
2787
|
let s = r.render(o, {
|
|
@@ -1618,162 +2814,170 @@ function $e(e) {
|
|
|
1618
2814
|
}
|
|
1619
2815
|
// src/sign-in.tsx
|
|
1620
2816
|
function Q(e) {
|
|
1621
|
-
let t = o(null),
|
|
2817
|
+
let { t, formatWait: n, locale: i } = I(), a = o(null), c = e.autoFocus;
|
|
1622
2818
|
r(() => {
|
|
1623
|
-
|
|
1624
|
-
}, [
|
|
1625
|
-
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();
|
|
1626
2822
|
r(() => {
|
|
1627
|
-
if (!
|
|
2823
|
+
if (!j) return;
|
|
1628
2824
|
let e = setTimeout(() => {
|
|
1629
|
-
|
|
1630
|
-
},
|
|
2825
|
+
M(void 0), C((e) => e === j.message ? void 0 : e);
|
|
2826
|
+
}, j.seconds * 1e3);
|
|
1631
2827
|
return () => clearTimeout(e);
|
|
1632
|
-
}, [
|
|
1633
|
-
function
|
|
1634
|
-
|
|
2828
|
+
}, [j]);
|
|
2829
|
+
function N(e) {
|
|
2830
|
+
u("phone"), x(void 0), y(""), h(""), C(e);
|
|
1635
2831
|
}
|
|
1636
|
-
async function
|
|
1637
|
-
if (t.preventDefault(), (
|
|
1638
|
-
|
|
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);
|
|
1639
2835
|
try {
|
|
1640
|
-
let t =
|
|
1641
|
-
phone:
|
|
1642
|
-
botCheckToken:
|
|
1643
|
-
}) :
|
|
1644
|
-
challenge:
|
|
1645
|
-
code:
|
|
1646
|
-
}) : 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() });
|
|
1647
2843
|
if (t.ok) {
|
|
1648
2844
|
let n = await t.json();
|
|
1649
|
-
|
|
2845
|
+
l === "phone" ? (x(n.challenge), u("code")) : n.result === "nameRequired" ? u("name") : e.onSignedIn(n.sessionKey);
|
|
1650
2846
|
return;
|
|
1651
2847
|
}
|
|
1652
2848
|
let n = await t.json().catch(() => void 0);
|
|
1653
|
-
if (
|
|
1654
|
-
|
|
2849
|
+
if (l === "name" && t.status === 401) {
|
|
2850
|
+
N({ key: "register.error.expired" });
|
|
1655
2851
|
return;
|
|
1656
2852
|
}
|
|
1657
|
-
let r = Number(t.headers.get("retry-after")),
|
|
1658
|
-
t.status === 429 &&
|
|
1659
|
-
phone:
|
|
1660
|
-
seconds:
|
|
1661
|
-
message:
|
|
1662
|
-
}),
|
|
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);
|
|
1663
2859
|
} catch {
|
|
1664
|
-
|
|
2860
|
+
C({ key: "signIn.error.unreachable" });
|
|
1665
2861
|
} finally {
|
|
1666
|
-
|
|
2862
|
+
T(!1), l === "phone" && k((e) => e + 1);
|
|
1667
2863
|
}
|
|
1668
2864
|
}
|
|
1669
2865
|
}
|
|
1670
2866
|
return /* @__PURE__ */ f("div", {
|
|
1671
2867
|
className: "cp-sign-in",
|
|
1672
2868
|
children: /* @__PURE__ */ p("form", {
|
|
1673
|
-
ref:
|
|
1674
|
-
onSubmit:
|
|
1675
|
-
"aria-busy":
|
|
2869
|
+
ref: a,
|
|
2870
|
+
onSubmit: P,
|
|
2871
|
+
"aria-busy": w,
|
|
1676
2872
|
children: [
|
|
1677
|
-
/* @__PURE__ */ f(
|
|
1678
|
-
/* @__PURE__ */ f("h1", { children:
|
|
2873
|
+
/* @__PURE__ */ f(ot, { brand: e.brand }),
|
|
2874
|
+
/* @__PURE__ */ f("h1", { children: t("signIn.heading") }),
|
|
1679
2875
|
e.children,
|
|
1680
|
-
e.notice &&
|
|
2876
|
+
e.notice && l === "phone" && /* @__PURE__ */ f("p", {
|
|
1681
2877
|
role: "status",
|
|
1682
2878
|
className: "cp-notice",
|
|
1683
|
-
children:
|
|
2879
|
+
children: t(e.notice)
|
|
1684
2880
|
}),
|
|
1685
|
-
|
|
1686
|
-
value:
|
|
1687
|
-
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),
|
|
1688
2884
|
autoComplete: "name",
|
|
1689
2885
|
maxLength: 200,
|
|
1690
2886
|
required: !0,
|
|
1691
2887
|
autoFocus: !0
|
|
1692
|
-
})] })] }) :
|
|
1693
|
-
value:
|
|
1694
|
-
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),
|
|
1695
2891
|
inputMode: "numeric",
|
|
1696
2892
|
autoComplete: "one-time-code",
|
|
1697
2893
|
required: !0,
|
|
1698
2894
|
autoFocus: !0
|
|
1699
2895
|
})] })] }) : /* @__PURE__ */ p(d, { children: [
|
|
1700
|
-
/* @__PURE__ */ f("p", { children:
|
|
1701
|
-
/* @__PURE__ */ f(
|
|
1702
|
-
label:
|
|
1703
|
-
value:
|
|
1704
|
-
onChange:
|
|
1705
|
-
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
|
|
1706
2903
|
}),
|
|
1707
|
-
|
|
1708
|
-
botCheck:
|
|
1709
|
-
attempt:
|
|
1710
|
-
onToken:
|
|
1711
|
-
onUnavailable: () =>
|
|
2904
|
+
A && /* @__PURE__ */ f(Xt, {
|
|
2905
|
+
botCheck: A,
|
|
2906
|
+
attempt: O,
|
|
2907
|
+
onToken: D,
|
|
2908
|
+
onUnavailable: () => C({ key: "signIn.error.botCheckUnavailable" })
|
|
1712
2909
|
})
|
|
1713
2910
|
] }),
|
|
1714
|
-
|
|
2911
|
+
l === "phone" && !A && /* @__PURE__ */ f("p", {
|
|
1715
2912
|
role: "alert",
|
|
1716
|
-
children:
|
|
2913
|
+
children: t("signIn.error.notConfigured")
|
|
1717
2914
|
}),
|
|
1718
|
-
|
|
2915
|
+
S && /* @__PURE__ */ f("p", {
|
|
1719
2916
|
role: "alert",
|
|
1720
|
-
children:
|
|
2917
|
+
children: t(S.key, S.wait ? { wait: n(S.wait) } : {})
|
|
1721
2918
|
}),
|
|
1722
2919
|
/* @__PURE__ */ f("button", {
|
|
1723
2920
|
type: "submit",
|
|
1724
|
-
disabled:
|
|
1725
|
-
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")
|
|
1726
2923
|
}),
|
|
1727
|
-
|
|
2924
|
+
l !== "phone" && /* @__PURE__ */ f("button", {
|
|
1728
2925
|
type: "button",
|
|
1729
2926
|
className: "cp-secondary",
|
|
1730
|
-
onClick: () =>
|
|
1731
|
-
children:
|
|
2927
|
+
onClick: () => N(),
|
|
2928
|
+
children: t("signIn.differentNumber")
|
|
1732
2929
|
}),
|
|
1733
2930
|
e.onCancel && /* @__PURE__ */ f("button", {
|
|
1734
2931
|
type: "button",
|
|
1735
2932
|
className: "cp-secondary",
|
|
1736
2933
|
onClick: e.onCancel,
|
|
1737
|
-
children:
|
|
2934
|
+
children: t("signIn.cancel")
|
|
1738
2935
|
})
|
|
1739
2936
|
]
|
|
1740
2937
|
})
|
|
1741
2938
|
});
|
|
1742
2939
|
}
|
|
1743
|
-
function
|
|
1744
|
-
if (e === 429) return n ?
|
|
1745
|
-
|
|
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" };
|
|
1746
2946
|
let i = r === "phone";
|
|
1747
|
-
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" && [
|
|
1748
2951
|
400,
|
|
1749
2952
|
401,
|
|
1750
2953
|
403,
|
|
1751
2954
|
404,
|
|
1752
2955
|
409
|
|
1753
|
-
].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" };
|
|
1754
2957
|
}
|
|
1755
2958
|
// src/account.tsx
|
|
1756
|
-
function
|
|
2959
|
+
function Qt(e) {
|
|
1757
2960
|
let [n, r] = s("bookings"), i = e.screen ?? n, a = e.onNavigate ?? r, o = t((e) => {
|
|
1758
2961
|
(e === "bookings" || e === "passes" || e === "details") && a(e);
|
|
1759
|
-
}, [a]), { basePath: c, sessionKey: l, notice: u, portal: d, signedInAs: p } =
|
|
2962
|
+
}, [a]), { basePath: c, sessionKey: l, notice: u, portal: d, signedInAs: p } = H({
|
|
1760
2963
|
basePath: e.basePath,
|
|
1761
2964
|
navigate: o,
|
|
1762
2965
|
accountNavigation: !0,
|
|
1763
2966
|
onSessionChange: e.onSessionChange
|
|
1764
2967
|
});
|
|
1765
|
-
return /* @__PURE__ */ f(
|
|
2968
|
+
return gt(i, o), /* @__PURE__ */ f(U, {
|
|
1766
2969
|
portal: d,
|
|
1767
2970
|
loading: l === void 0,
|
|
1768
|
-
|
|
2971
|
+
locale: e.locale,
|
|
2972
|
+
children: /* @__PURE__ */ f(ut, {
|
|
1769
2973
|
brand: e.brand,
|
|
1770
|
-
tabs:
|
|
2974
|
+
tabs: ct,
|
|
1771
2975
|
screen: i,
|
|
1772
2976
|
signedIn: !!l,
|
|
1773
2977
|
signingIn: !l,
|
|
1774
2978
|
onNavigate: o,
|
|
1775
2979
|
onSignOut: () => d.signOut(),
|
|
1776
|
-
children: l ? f(i === "passes" ?
|
|
2980
|
+
children: l ? f(i === "passes" ? vt : i === "details" ? ft : Pe, {}) : /* @__PURE__ */ f(Q, {
|
|
1777
2981
|
basePath: c,
|
|
1778
2982
|
brand: void 0,
|
|
1779
2983
|
botCheck: e.botCheck,
|
|
@@ -1785,7 +2989,7 @@ function tt(e) {
|
|
|
1785
2989
|
});
|
|
1786
2990
|
}
|
|
1787
2991
|
// src/booking-flow.tsx
|
|
1788
|
-
function
|
|
2992
|
+
function $t(e) {
|
|
1789
2993
|
return {
|
|
1790
2994
|
startsAt: e.startsAt,
|
|
1791
2995
|
eventTypeId: e.eventTypeId,
|
|
@@ -1801,105 +3005,122 @@ function $(e) {
|
|
|
1801
3005
|
e.resourceId ?? ""
|
|
1802
3006
|
].join("|") : "";
|
|
1803
3007
|
}
|
|
1804
|
-
function
|
|
3008
|
+
function en(e, t) {
|
|
1805
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);
|
|
1806
3010
|
}
|
|
1807
|
-
function
|
|
1808
|
-
let n = e.onChange !== void 0,
|
|
3011
|
+
function tn(e) {
|
|
3012
|
+
let { t: n } = P(e.locale), i = e.onChange !== void 0, a = {
|
|
1809
3013
|
businessId: e.businessId,
|
|
1810
3014
|
...e.eventTypeId && { eventTypeId: e.eventTypeId },
|
|
1811
3015
|
...e.resourceId && { resourceId: e.resourceId },
|
|
1812
3016
|
...e.all && { all: !0 },
|
|
3017
|
+
...e.all && e.allFrom && { allFrom: e.allFrom },
|
|
1813
3018
|
...e.time && { time: e.time }
|
|
1814
|
-
},
|
|
3019
|
+
}, o = [
|
|
1815
3020
|
e.businessId,
|
|
1816
3021
|
e.eventTypeId ?? "",
|
|
1817
3022
|
e.resourceId ?? "",
|
|
1818
3023
|
e.all ? "all" : "",
|
|
3024
|
+
e.allFrom ? `${e.allFrom.eventTypeId}~${e.allFrom.resourceId ?? ""}` : "",
|
|
1819
3025
|
$(e.time)
|
|
1820
|
-
].join("/"), [
|
|
1821
|
-
!
|
|
1822
|
-
let
|
|
1823
|
-
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" && _({
|
|
1824
3030
|
businessId: e.businessId,
|
|
1825
3031
|
...e.eventTypeId && { eventTypeId: e.eventTypeId }
|
|
1826
3032
|
});
|
|
1827
|
-
}, [
|
|
3033
|
+
}, [_]), { basePath: y, sessionKey: b, notice: x, portal: S, signedInAs: C } = H({
|
|
1828
3034
|
basePath: e.basePath,
|
|
1829
|
-
navigate:
|
|
3035
|
+
navigate: v,
|
|
1830
3036
|
accountNavigation: !1,
|
|
1831
3037
|
onSessionChange: e.onSessionChange
|
|
1832
|
-
})
|
|
1833
|
-
|
|
1834
|
-
let
|
|
1835
|
-
|
|
1836
|
-
},
|
|
1837
|
-
|
|
3038
|
+
});
|
|
3039
|
+
r(() => {
|
|
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({
|
|
1838
3049
|
business: e,
|
|
1839
3050
|
candidate: t
|
|
1840
|
-
}),
|
|
1841
|
-
...
|
|
1842
|
-
time:
|
|
3051
|
+
}), _({
|
|
3052
|
+
...h,
|
|
3053
|
+
time: $t(t)
|
|
1843
3054
|
});
|
|
1844
|
-
},
|
|
1845
|
-
|
|
1846
|
-
choice:
|
|
1847
|
-
onBack:
|
|
3055
|
+
}, N;
|
|
3056
|
+
N = A ? b ? /* @__PURE__ */ f(rt, {
|
|
3057
|
+
choice: A,
|
|
3058
|
+
onBack: j,
|
|
1848
3059
|
onBooked: e.onBooked,
|
|
1849
|
-
onDone: e.onClose
|
|
1850
|
-
|
|
1851
|
-
|
|
3060
|
+
onDone: e.onClose,
|
|
3061
|
+
onLeave: () => tt(h)
|
|
3062
|
+
}, `${A.candidate.startsAt}-${A.candidate.eventId ?? A.candidate.eventTypeId}`) : /* @__PURE__ */ p(Q, {
|
|
3063
|
+
basePath: y,
|
|
1852
3064
|
brand: e.brand,
|
|
1853
3065
|
botCheck: e.botCheck,
|
|
1854
|
-
notice:
|
|
1855
|
-
onSignedIn:
|
|
1856
|
-
autoFocus: !
|
|
3066
|
+
notice: x,
|
|
3067
|
+
onSignedIn: C,
|
|
3068
|
+
autoFocus: e.autoFocus !== !1,
|
|
1857
3069
|
children: [
|
|
1858
|
-
/* @__PURE__ */ f("p", { children:
|
|
1859
|
-
/* @__PURE__ */ f(
|
|
3070
|
+
/* @__PURE__ */ f("p", { children: n("book.signInFirst") }),
|
|
3071
|
+
/* @__PURE__ */ f(X, { choice: A }),
|
|
1860
3072
|
/* @__PURE__ */ f("button", {
|
|
1861
3073
|
type: "button",
|
|
1862
3074
|
className: "cp-link",
|
|
1863
|
-
onClick:
|
|
1864
|
-
children:
|
|
3075
|
+
onClick: j,
|
|
3076
|
+
children: n("book.back")
|
|
1865
3077
|
})
|
|
1866
3078
|
]
|
|
1867
|
-
}) :
|
|
1868
|
-
businessId:
|
|
1869
|
-
time:
|
|
1870
|
-
onFound:
|
|
1871
|
-
onMissing: () =>
|
|
1872
|
-
}) :
|
|
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", {
|
|
1873
3085
|
type: "button",
|
|
1874
3086
|
className: "cp-link cp-back",
|
|
1875
|
-
onClick: () =>
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
3087
|
+
onClick: () => _({
|
|
3088
|
+
businessId: h.businessId,
|
|
3089
|
+
...h.allFrom && {
|
|
3090
|
+
eventTypeId: h.allFrom.eventTypeId,
|
|
3091
|
+
...h.allFrom.resourceId && { resourceId: h.allFrom.resourceId }
|
|
3092
|
+
}
|
|
3093
|
+
}),
|
|
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,
|
|
1883
3101
|
all: !0,
|
|
3102
|
+
...h.allFrom && { allFrom: h.allFrom },
|
|
1884
3103
|
...e
|
|
1885
3104
|
}),
|
|
1886
|
-
onChoose:
|
|
1887
|
-
})] }) : /* @__PURE__ */ f(
|
|
1888
|
-
selection:
|
|
1889
|
-
change:
|
|
1890
|
-
onChoose:
|
|
3105
|
+
onChoose: M
|
|
3106
|
+
})] }) : /* @__PURE__ */ f(nn, {
|
|
3107
|
+
selection: h,
|
|
3108
|
+
change: _,
|
|
3109
|
+
onChoose: M
|
|
1891
3110
|
});
|
|
1892
|
-
let
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
3111
|
+
let F = A ? b ? "booking" : "sign-in" : [
|
|
3112
|
+
h.all ? "all" : "",
|
|
3113
|
+
h.eventTypeId ?? "",
|
|
3114
|
+
h.resourceId ?? "",
|
|
3115
|
+
O && E !== k ? "time" : ""
|
|
1897
3116
|
].join("/");
|
|
1898
|
-
return /* @__PURE__ */ f(
|
|
1899
|
-
portal:
|
|
1900
|
-
loading:
|
|
1901
|
-
|
|
1902
|
-
|
|
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,
|
|
3123
|
+
initial: e.autoFocus !== !1,
|
|
1903
3124
|
children: [
|
|
1904
3125
|
e.onClose && /* @__PURE__ */ f("div", {
|
|
1905
3126
|
className: "cp-flow-head",
|
|
@@ -1907,51 +3128,51 @@ function it(e) {
|
|
|
1907
3128
|
type: "button",
|
|
1908
3129
|
className: "cp-secondary",
|
|
1909
3130
|
onClick: e.onClose,
|
|
1910
|
-
children:
|
|
3131
|
+
children: n("book.close")
|
|
1911
3132
|
})
|
|
1912
3133
|
}),
|
|
1913
|
-
|
|
3134
|
+
O && E === k && /* @__PURE__ */ f("p", {
|
|
1914
3135
|
role: "alert",
|
|
1915
3136
|
className: "cp-notice",
|
|
1916
|
-
children:
|
|
3137
|
+
children: n("book.unavailable")
|
|
1917
3138
|
}),
|
|
1918
|
-
|
|
3139
|
+
N
|
|
1919
3140
|
]
|
|
1920
3141
|
})
|
|
1921
3142
|
});
|
|
1922
3143
|
}
|
|
1923
|
-
function
|
|
1924
|
-
let { selection:
|
|
1925
|
-
if (
|
|
1926
|
-
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", {
|
|
1927
3148
|
type: "button",
|
|
1928
3149
|
className: "cp-link cp-back",
|
|
1929
|
-
onClick: () =>
|
|
1930
|
-
children:
|
|
1931
|
-
}),
|
|
1932
|
-
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", {
|
|
1933
3154
|
className: "cp-screen",
|
|
1934
3155
|
children: [
|
|
1935
|
-
|
|
1936
|
-
|
|
3156
|
+
u,
|
|
3157
|
+
a && /* @__PURE__ */ f("p", {
|
|
1937
3158
|
className: "cp-empty",
|
|
1938
|
-
children:
|
|
3159
|
+
children: t("business.typeMissing")
|
|
1939
3160
|
}),
|
|
1940
|
-
/* @__PURE__ */ f("h2", { children:
|
|
1941
|
-
|
|
3161
|
+
/* @__PURE__ */ f("h2", { children: t("book.chooseType") }),
|
|
3162
|
+
l.length === 0 ? /* @__PURE__ */ f("p", {
|
|
1942
3163
|
className: "cp-empty",
|
|
1943
|
-
children:
|
|
3164
|
+
children: t("book.noTypes")
|
|
1944
3165
|
}) : /* @__PURE__ */ f("ul", {
|
|
1945
3166
|
className: "cp-list",
|
|
1946
|
-
children:
|
|
3167
|
+
children: l.map((e) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ p("button", {
|
|
1947
3168
|
type: "button",
|
|
1948
3169
|
className: "cp-option",
|
|
1949
|
-
onClick: () =>
|
|
1950
|
-
businessId:
|
|
3170
|
+
onClick: () => r({
|
|
3171
|
+
businessId: i,
|
|
1951
3172
|
eventTypeId: e.id
|
|
1952
3173
|
}),
|
|
1953
3174
|
children: [
|
|
1954
|
-
/* @__PURE__ */ f(
|
|
3175
|
+
/* @__PURE__ */ f(J, {
|
|
1955
3176
|
image: e.image,
|
|
1956
3177
|
alt: "",
|
|
1957
3178
|
size: "small",
|
|
@@ -1959,12 +3180,12 @@ function at(e) {
|
|
|
1959
3180
|
}),
|
|
1960
3181
|
/* @__PURE__ */ f("strong", { children: e.displayName }),
|
|
1961
3182
|
e.description && /* @__PURE__ */ f("span", { children: e.description }),
|
|
1962
|
-
/* @__PURE__ */ f("span", { children:
|
|
3183
|
+
/* @__PURE__ */ f("span", { children: t("business.minutes", { minutes: e.durationMinutes }) }),
|
|
1963
3184
|
e.tags.length > 0 && /* @__PURE__ */ f("span", {
|
|
1964
3185
|
className: "cp-tags",
|
|
1965
3186
|
children: e.tags.slice(0, 3).map((e) => /* @__PURE__ */ f("span", {
|
|
1966
3187
|
className: "cp-tag",
|
|
1967
|
-
style: { "--cp-tag":
|
|
3188
|
+
style: { "--cp-tag": Wt(e.colour) },
|
|
1968
3189
|
children: e.name
|
|
1969
3190
|
}, e.id))
|
|
1970
3191
|
})
|
|
@@ -1974,39 +3195,39 @@ function at(e) {
|
|
|
1974
3195
|
/* @__PURE__ */ f("button", {
|
|
1975
3196
|
type: "button",
|
|
1976
3197
|
className: "cp-secondary",
|
|
1977
|
-
onClick: () =>
|
|
1978
|
-
businessId:
|
|
3198
|
+
onClick: () => r({
|
|
3199
|
+
businessId: i,
|
|
1979
3200
|
all: !0
|
|
1980
3201
|
}),
|
|
1981
|
-
children:
|
|
3202
|
+
children: t("book.seeAll")
|
|
1982
3203
|
})
|
|
1983
3204
|
]
|
|
1984
3205
|
});
|
|
1985
|
-
let
|
|
1986
|
-
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", {
|
|
1987
3208
|
className: "cp-screen",
|
|
1988
3209
|
children: [
|
|
3210
|
+
d,
|
|
1989
3211
|
u,
|
|
1990
|
-
|
|
1991
|
-
/* @__PURE__ */ f(
|
|
1992
|
-
/* @__PURE__ */ f("h2", { children: T("book.chooseResource") }),
|
|
3212
|
+
/* @__PURE__ */ f(Ge, { type: m }),
|
|
3213
|
+
/* @__PURE__ */ f("h2", { children: t("book.chooseResource") }),
|
|
1993
3214
|
/* @__PURE__ */ f("ul", {
|
|
1994
3215
|
className: "cp-list",
|
|
1995
3216
|
children: [{
|
|
1996
3217
|
id: "any",
|
|
1997
|
-
displayName:
|
|
1998
|
-
description:
|
|
3218
|
+
displayName: t("book.anyResource"),
|
|
3219
|
+
description: t("book.anyResourceHint"),
|
|
1999
3220
|
image: null
|
|
2000
|
-
}, ...
|
|
3221
|
+
}, ...m.resources].map((e) => /* @__PURE__ */ f("li", { children: /* @__PURE__ */ p("button", {
|
|
2001
3222
|
type: "button",
|
|
2002
3223
|
className: "cp-option",
|
|
2003
|
-
onClick: () =>
|
|
2004
|
-
businessId:
|
|
2005
|
-
eventTypeId:
|
|
3224
|
+
onClick: () => r({
|
|
3225
|
+
businessId: i,
|
|
3226
|
+
eventTypeId: m.id,
|
|
2006
3227
|
resourceId: e.id
|
|
2007
3228
|
}),
|
|
2008
3229
|
children: [
|
|
2009
|
-
/* @__PURE__ */ f(
|
|
3230
|
+
/* @__PURE__ */ f(J, {
|
|
2010
3231
|
image: e.image,
|
|
2011
3232
|
alt: "",
|
|
2012
3233
|
size: "small",
|
|
@@ -2016,97 +3237,123 @@ function at(e) {
|
|
|
2016
3237
|
e.description && /* @__PURE__ */ f("span", { children: e.description })
|
|
2017
3238
|
]
|
|
2018
3239
|
}) }, e.id))
|
|
3240
|
+
}),
|
|
3241
|
+
/* @__PURE__ */ f("button", {
|
|
3242
|
+
type: "button",
|
|
3243
|
+
className: "cp-secondary",
|
|
3244
|
+
onClick: () => r({
|
|
3245
|
+
businessId: i,
|
|
3246
|
+
all: !0,
|
|
3247
|
+
eventTypeId: m.id,
|
|
3248
|
+
allFrom: { eventTypeId: m.id }
|
|
3249
|
+
}),
|
|
3250
|
+
children: t("book.seeAll")
|
|
2019
3251
|
})
|
|
2020
3252
|
]
|
|
2021
3253
|
}) : /* @__PURE__ */ p("section", {
|
|
2022
3254
|
className: "cp-screen",
|
|
2023
3255
|
children: [
|
|
2024
|
-
|
|
3256
|
+
h ? /* @__PURE__ */ f("button", {
|
|
2025
3257
|
type: "button",
|
|
2026
3258
|
className: "cp-link cp-back",
|
|
2027
|
-
onClick: () =>
|
|
2028
|
-
businessId:
|
|
2029
|
-
eventTypeId:
|
|
3259
|
+
onClick: () => r({
|
|
3260
|
+
businessId: i,
|
|
3261
|
+
eventTypeId: m.id
|
|
2030
3262
|
}),
|
|
2031
|
-
children:
|
|
2032
|
-
}) :
|
|
2033
|
-
|
|
2034
|
-
/* @__PURE__ */ f(
|
|
2035
|
-
|
|
3263
|
+
children: t("book.otherResource")
|
|
3264
|
+
}) : d,
|
|
3265
|
+
u,
|
|
3266
|
+
/* @__PURE__ */ f(Ge, { type: m }),
|
|
3267
|
+
h && g && /* @__PURE__ */ f("p", {
|
|
2036
3268
|
className: "cp-hint",
|
|
2037
|
-
children:
|
|
3269
|
+
children: t("business.with", { resource: g.displayName })
|
|
3270
|
+
}),
|
|
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)
|
|
2038
3276
|
}),
|
|
2039
|
-
/* @__PURE__ */ f(
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
3277
|
+
/* @__PURE__ */ f("button", {
|
|
3278
|
+
type: "button",
|
|
3279
|
+
className: "cp-secondary",
|
|
3280
|
+
onClick: () => r({
|
|
3281
|
+
businessId: i,
|
|
3282
|
+
all: !0,
|
|
3283
|
+
eventTypeId: m.id,
|
|
3284
|
+
...h && g && { resourceId: g.id },
|
|
3285
|
+
allFrom: {
|
|
3286
|
+
eventTypeId: m.id,
|
|
3287
|
+
...h && n.resourceId ? { resourceId: n.resourceId } : {}
|
|
3288
|
+
}
|
|
3289
|
+
}),
|
|
3290
|
+
children: t("book.seeAll")
|
|
2044
3291
|
})
|
|
2045
3292
|
]
|
|
2046
3293
|
});
|
|
2047
3294
|
}
|
|
2048
|
-
function
|
|
2049
|
-
let { client:
|
|
2050
|
-
|
|
2051
|
-
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);
|
|
2052
3299
|
return r(() => {
|
|
2053
3300
|
let e = !0;
|
|
2054
3301
|
return (async () => {
|
|
2055
|
-
let { data:
|
|
2056
|
-
if (!
|
|
2057
|
-
let
|
|
2058
|
-
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 },
|
|
2059
3306
|
query: {
|
|
2060
|
-
from: `${
|
|
2061
|
-
to: `${
|
|
2062
|
-
eventTypeId:
|
|
2063
|
-
...!
|
|
3307
|
+
from: `${r}T00:00`,
|
|
3308
|
+
to: `${Y(r, 1)}T00:00`,
|
|
3309
|
+
eventTypeId: a.eventTypeId,
|
|
3310
|
+
...!a.eventId && a.resourceId && { resourceId: a.resourceId }
|
|
2064
3311
|
}
|
|
2065
|
-
} }), c =
|
|
2066
|
-
e && (c ?
|
|
2067
|
-
business:
|
|
3312
|
+
} }), c = o?.items.find((e) => en(e, a));
|
|
3313
|
+
e && (c ? s.current.onFound({
|
|
3314
|
+
business: t,
|
|
2068
3315
|
candidate: c
|
|
2069
|
-
}) :
|
|
3316
|
+
}) : s.current.onMissing());
|
|
2070
3317
|
})().catch(() => {
|
|
2071
|
-
e &&
|
|
3318
|
+
e && s.current.onMissing();
|
|
2072
3319
|
}), () => {
|
|
2073
3320
|
e = !1;
|
|
2074
3321
|
};
|
|
2075
3322
|
}, [
|
|
2076
|
-
t,
|
|
2077
3323
|
n,
|
|
2078
|
-
|
|
3324
|
+
i,
|
|
3325
|
+
c
|
|
2079
3326
|
]), /* @__PURE__ */ f("section", {
|
|
2080
3327
|
className: "cp-screen",
|
|
2081
3328
|
children: /* @__PURE__ */ f("p", {
|
|
2082
3329
|
role: "status",
|
|
2083
|
-
children:
|
|
3330
|
+
children: t("app.loading")
|
|
2084
3331
|
})
|
|
2085
3332
|
});
|
|
2086
3333
|
}
|
|
2087
|
-
var
|
|
2088
|
-
function
|
|
3334
|
+
var an = "input, .cp-option, .cp-chips button, .cp-candidate button, .cp-actions button:not(:disabled)";
|
|
3335
|
+
function on(e) {
|
|
2089
3336
|
let t = o(null), n = o(!1), { step: i } = e;
|
|
2090
3337
|
return r(() => {
|
|
2091
|
-
let
|
|
2092
|
-
if (!
|
|
2093
|
-
let
|
|
2094
|
-
if (n.current = !0,
|
|
2095
|
-
let
|
|
2096
|
-
let
|
|
2097
|
-
return
|
|
3338
|
+
let r = t.current;
|
|
3339
|
+
if (!r) return;
|
|
3340
|
+
let i = n.current;
|
|
3341
|
+
if (n.current = !0, i ? r.contains(document.activeElement) : !e.initial) return;
|
|
3342
|
+
let a = () => {
|
|
3343
|
+
let e = r.querySelector(an);
|
|
3344
|
+
return e?.focus(), !!e;
|
|
2098
3345
|
};
|
|
2099
|
-
if (
|
|
2100
|
-
let
|
|
2101
|
-
|
|
3346
|
+
if (a()) return;
|
|
3347
|
+
let o = new MutationObserver(() => {
|
|
3348
|
+
a() && o.disconnect();
|
|
2102
3349
|
});
|
|
2103
|
-
|
|
3350
|
+
o.observe(r, {
|
|
2104
3351
|
childList: !0,
|
|
2105
3352
|
subtree: !0
|
|
2106
3353
|
});
|
|
2107
|
-
let
|
|
2108
|
-
return
|
|
2109
|
-
|
|
3354
|
+
let s = () => o.disconnect();
|
|
3355
|
+
return r.addEventListener("focusin", s), () => {
|
|
3356
|
+
o.disconnect(), r.removeEventListener("focusin", s);
|
|
2110
3357
|
};
|
|
2111
3358
|
}, [i]), /* @__PURE__ */ f("div", {
|
|
2112
3359
|
ref: t,
|
|
@@ -2115,78 +3362,89 @@ function ct(e) {
|
|
|
2115
3362
|
});
|
|
2116
3363
|
}
|
|
2117
3364
|
// src/sign-in-standalone.tsx
|
|
2118
|
-
function
|
|
2119
|
-
let t = e.basePath.replace(/\/$/, ""),
|
|
2120
|
-
|
|
2121
|
-
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);
|
|
2122
3369
|
return r(() => {
|
|
2123
|
-
|
|
2124
|
-
}, [
|
|
2125
|
-
|
|
2126
|
-
children:
|
|
2127
|
-
className: "
|
|
2128
|
-
|
|
2129
|
-
children:
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
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
|
+
})
|
|
2138
3389
|
})
|
|
2139
3390
|
});
|
|
2140
3391
|
}
|
|
2141
3392
|
// src/index.tsx
|
|
2142
|
-
function
|
|
2143
|
-
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({
|
|
2144
3395
|
basePath: e.basePath,
|
|
2145
|
-
navigate:
|
|
3396
|
+
navigate: o,
|
|
2146
3397
|
accountNavigation: !0,
|
|
2147
3398
|
onSessionChange: void 0
|
|
2148
|
-
})
|
|
2149
|
-
|
|
2150
|
-
let
|
|
2151
|
-
|
|
3399
|
+
});
|
|
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);
|
|
3405
|
+
}, []);
|
|
3406
|
+
let x = (t) => /* @__PURE__ */ f(Q, {
|
|
3407
|
+
basePath: c,
|
|
2152
3408
|
brand: void 0,
|
|
2153
3409
|
botCheck: e.botCheck,
|
|
2154
|
-
notice:
|
|
2155
|
-
onSignedIn:
|
|
3410
|
+
notice: u,
|
|
3411
|
+
onSignedIn: h,
|
|
2156
3412
|
children: t
|
|
2157
3413
|
});
|
|
2158
|
-
return /* @__PURE__ */ f(
|
|
2159
|
-
portal:
|
|
2160
|
-
loading:
|
|
2161
|
-
|
|
3414
|
+
return /* @__PURE__ */ f(U, {
|
|
3415
|
+
portal: m,
|
|
3416
|
+
loading: l === void 0,
|
|
3417
|
+
locale: e.locale,
|
|
3418
|
+
children: /* @__PURE__ */ f(ut, {
|
|
2162
3419
|
brand: e.brand,
|
|
2163
|
-
tabs:
|
|
2164
|
-
screen:
|
|
2165
|
-
signedIn: !!
|
|
2166
|
-
signingIn: !
|
|
2167
|
-
onNavigate:
|
|
2168
|
-
onSignOut: () =>
|
|
2169
|
-
children:
|
|
2170
|
-
choice:
|
|
2171
|
-
onBack: () =>
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
/* @__PURE__ */ f(
|
|
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 }),
|
|
2175
3433
|
/* @__PURE__ */ f("button", {
|
|
2176
3434
|
type: "button",
|
|
2177
3435
|
className: "cp-link",
|
|
2178
|
-
onClick: () =>
|
|
2179
|
-
children:
|
|
3436
|
+
onClick: () => _(void 0),
|
|
3437
|
+
children: t("book.back")
|
|
2180
3438
|
})
|
|
2181
|
-
] })) : typeof
|
|
2182
|
-
businessId:
|
|
2183
|
-
eventTypeId:
|
|
2184
|
-
onChoose: (e, t) =>
|
|
3439
|
+
] })) : typeof a == "object" ? /* @__PURE__ */ f(Ue, {
|
|
3440
|
+
businessId: a.businessId,
|
|
3441
|
+
eventTypeId: a.eventTypeId,
|
|
3442
|
+
onChoose: (e, t) => _({
|
|
2185
3443
|
business: e,
|
|
2186
3444
|
candidate: t
|
|
2187
3445
|
})
|
|
2188
|
-
}) :
|
|
3446
|
+
}) : a === "businesses" ? /* @__PURE__ */ f(dt, {}) : l ? f(a === "passes" ? vt : a === "details" ? ft : Pe, {}) : x()
|
|
2189
3447
|
})
|
|
2190
3448
|
});
|
|
2191
3449
|
}
|
|
2192
|
-
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 };
|