@bowlos/reservations 0.7.0 → 0.14.0
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/HEADLESS.md +294 -0
- package/README.md +93 -12
- package/dist/{catalog-DBIisELC.d.ts → catalog-kd07kri0.d.ts} +1 -1
- package/dist/{catalog-DEwo88hz.d.cts → catalog-kdDjgvT1.d.cts} +1 -1
- package/dist/{chunk-YICHFUAY.js → chunk-2X7MFQWY.js} +9 -3
- package/dist/chunk-2X7MFQWY.js.map +1 -0
- package/dist/{chunk-JBBWGMRT.js → chunk-FPUWLOW3.js} +10 -4
- package/dist/chunk-FPUWLOW3.js.map +1 -0
- package/dist/chunk-Y3YSDO3H.js +221 -0
- package/dist/chunk-Y3YSDO3H.js.map +1 -0
- package/dist/components.cjs +332 -166
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +14 -3
- package/dist/components.d.ts +14 -3
- package/dist/components.js +322 -373
- package/dist/components.js.map +1 -1
- package/dist/{data-DrM0D6Pi.d.cts → data-lC-l-haz.d.cts} +33 -54
- package/dist/{data-DrM0D6Pi.d.ts → data-lC-l-haz.d.ts} +33 -54
- package/dist/errors-IIK7xibp.d.cts +54 -0
- package/dist/errors-IIK7xibp.d.ts +54 -0
- package/dist/index.cjs +8 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -2
- package/dist/payments.cjs +245 -0
- package/dist/payments.cjs.map +1 -0
- package/dist/payments.d.cts +37 -0
- package/dist/payments.d.ts +37 -0
- package/dist/payments.js +83 -0
- package/dist/payments.js.map +1 -0
- package/dist/{react-7ruEsubp.d.cts → react-B3dlcklN.d.ts} +2 -1
- package/dist/{react-Cb_NZCXa.d.ts → react-aZplAyHS.d.cts} +2 -1
- package/dist/react.cjs +8 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +12 -5
- package/dist/react.d.ts +12 -5
- package/dist/react.js +2 -2
- package/package.json +22 -3
- package/templates/center-site/README.md +8 -7
- package/templates/center-site/app/book/page.tsx +10 -3
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-JBBWGMRT.js.map +0 -1
- package/dist/chunk-YICHFUAY.js.map +0 -1
- package/templates/center-site/app/book/checkout-form.tsx +0 -85
package/dist/components.js
CHANGED
|
@@ -1,226 +1,152 @@
|
|
|
1
|
-
import { useAccount, useAvailability, useBookingPreview, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useProducts, useEvents, usePackages, usePublicMemberships, useGameCards } from './chunk-
|
|
2
|
-
import { availableUnitCount } from './chunk-
|
|
1
|
+
import { useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useProducts, useEvents, usePackages, usePublicMemberships, useGameCards } from './chunk-FPUWLOW3.js';
|
|
2
|
+
import { availableUnitCount } from './chunk-2X7MFQWY.js';
|
|
3
|
+
import { styles, formatCents, formatMinuteLabel, token, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
|
|
4
|
+
export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-Y3YSDO3H.js';
|
|
5
|
+
import { useState, useEffect, useMemo, useRef } from 'react';
|
|
3
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { useState, useRef, useEffect, useMemo } from 'react';
|
|
5
7
|
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
colorText: "#111827",
|
|
23
|
-
colorMuted: "#6b7280",
|
|
24
|
-
colorBg: "#ffffff",
|
|
25
|
-
colorSurface: "#f9fafb",
|
|
26
|
-
colorBorder: "#e5e7eb",
|
|
27
|
-
colorError: "#dc2626",
|
|
28
|
-
colorSuccess: "#16a34a",
|
|
29
|
-
radius: "10px",
|
|
30
|
-
fontFamily: "system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif"
|
|
8
|
+
var DEFAULT_LABELS = {
|
|
9
|
+
signInHeading: "Sign in",
|
|
10
|
+
signUpHeading: "Create your account",
|
|
11
|
+
linkHeading: "Finish your profile",
|
|
12
|
+
loading: "Loading\u2026",
|
|
13
|
+
email: "Email",
|
|
14
|
+
password: "Password",
|
|
15
|
+
name: "Name",
|
|
16
|
+
signIn: "Sign in",
|
|
17
|
+
signingIn: "Signing in\u2026",
|
|
18
|
+
createAccount: "Create account",
|
|
19
|
+
haveAccount: "Already have an account? Sign in",
|
|
20
|
+
needAccount: "New here? Create an account",
|
|
21
|
+
finishProfile: "Save profile",
|
|
22
|
+
saving: "Saving\u2026",
|
|
23
|
+
signOut: "Sign out"
|
|
31
24
|
};
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (value) out[VAR[key]] = value;
|
|
37
|
-
}
|
|
38
|
-
return out;
|
|
39
|
-
}
|
|
40
|
-
function BowlosTheme({
|
|
41
|
-
theme = {},
|
|
42
|
-
className,
|
|
43
|
-
style,
|
|
44
|
-
children
|
|
25
|
+
function AuthForm({
|
|
26
|
+
account,
|
|
27
|
+
labels,
|
|
28
|
+
className
|
|
45
29
|
}) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
fontFamily: token("fontFamily"),
|
|
68
|
-
color: token("colorText"),
|
|
69
|
-
background: token("colorBg"),
|
|
70
|
-
border: `1px solid ${token("colorBorder")}`,
|
|
71
|
-
borderRadius: token("radius"),
|
|
72
|
-
padding: "1rem 1.25rem",
|
|
73
|
-
display: "flex",
|
|
74
|
-
flexDirection: "column",
|
|
75
|
-
gap: "0.625rem"
|
|
76
|
-
},
|
|
77
|
-
// text
|
|
78
|
-
heading: { margin: "0 0 0.25rem", fontSize: "1.25rem" },
|
|
79
|
-
sectionTitle: {
|
|
80
|
-
margin: "0 0 0.5rem",
|
|
81
|
-
fontSize: "0.8rem",
|
|
82
|
-
fontWeight: 700,
|
|
83
|
-
letterSpacing: "0.04em",
|
|
84
|
-
textTransform: "uppercase",
|
|
85
|
-
color: token("colorMuted")
|
|
86
|
-
},
|
|
87
|
-
body: { margin: 0, color: token("colorText") },
|
|
88
|
-
meta: { margin: 0, fontSize: "0.9rem", color: token("colorMuted"), minHeight: "1.2em" },
|
|
89
|
-
muted: { margin: 0, fontSize: "0.9rem", color: token("colorMuted") },
|
|
90
|
-
error: { margin: 0, color: token("colorError"), fontSize: "0.9rem" },
|
|
91
|
-
// form
|
|
92
|
-
label: {
|
|
93
|
-
display: "flex",
|
|
94
|
-
flexDirection: "column",
|
|
95
|
-
gap: "0.25rem",
|
|
96
|
-
fontSize: "0.85rem",
|
|
97
|
-
color: token("colorMuted")
|
|
98
|
-
},
|
|
99
|
-
input: {
|
|
100
|
-
padding: "0.5rem 0.625rem",
|
|
101
|
-
fontSize: "1rem",
|
|
102
|
-
color: token("colorText"),
|
|
103
|
-
background: token("colorSurface"),
|
|
104
|
-
border: `1px solid ${token("colorBorder")}`,
|
|
105
|
-
borderRadius: token("radius")
|
|
106
|
-
},
|
|
107
|
-
// layout
|
|
108
|
-
row: { display: "flex", gap: "0.5rem", flexWrap: "wrap", alignItems: "center" },
|
|
109
|
-
rowBetween: { display: "flex", gap: "0.5rem", justifyContent: "space-between", alignItems: "center" },
|
|
110
|
-
stack: { display: "flex", flexDirection: "column", gap: "0.75rem" },
|
|
111
|
-
// buttons
|
|
112
|
-
primaryBtn: {
|
|
113
|
-
padding: "0.625rem 1rem",
|
|
114
|
-
fontSize: "1rem",
|
|
115
|
-
fontWeight: 600,
|
|
116
|
-
color: token("colorPrimaryContrast"),
|
|
117
|
-
background: token("colorPrimary"),
|
|
118
|
-
border: "none",
|
|
119
|
-
borderRadius: token("radius"),
|
|
120
|
-
cursor: "pointer"
|
|
121
|
-
},
|
|
122
|
-
ghostBtn: {
|
|
123
|
-
padding: "0.625rem 1rem",
|
|
124
|
-
fontSize: "1rem",
|
|
125
|
-
color: token("colorText"),
|
|
126
|
-
background: "transparent",
|
|
127
|
-
border: `1px solid ${token("colorBorder")}`,
|
|
128
|
-
borderRadius: token("radius"),
|
|
129
|
-
cursor: "pointer"
|
|
130
|
-
},
|
|
131
|
-
linkBtn: {
|
|
132
|
-
padding: 0,
|
|
133
|
-
fontSize: "0.9rem",
|
|
134
|
-
color: token("colorPrimary"),
|
|
135
|
-
background: "transparent",
|
|
136
|
-
border: "none",
|
|
137
|
-
cursor: "pointer",
|
|
138
|
-
textDecoration: "underline"
|
|
139
|
-
},
|
|
140
|
-
// list rows (reservations, memberships, ledger, passes, flash items)
|
|
141
|
-
listItem: {
|
|
142
|
-
display: "flex",
|
|
143
|
-
justifyContent: "space-between",
|
|
144
|
-
alignItems: "baseline",
|
|
145
|
-
gap: "0.75rem",
|
|
146
|
-
padding: "0.625rem 0",
|
|
147
|
-
borderTop: `1px solid ${token("colorBorder")}`
|
|
148
|
-
},
|
|
149
|
-
listTitle: { margin: 0, fontSize: "1rem", fontWeight: 600 },
|
|
150
|
-
listMeta: { margin: 0, fontSize: "0.85rem", color: token("colorMuted") },
|
|
151
|
-
// badges + prices
|
|
152
|
-
badge: {
|
|
153
|
-
display: "inline-block",
|
|
154
|
-
padding: "0.125rem 0.5rem",
|
|
155
|
-
fontSize: "0.75rem",
|
|
156
|
-
fontWeight: 600,
|
|
157
|
-
color: token("colorMuted"),
|
|
158
|
-
background: token("colorSurface"),
|
|
159
|
-
border: `1px solid ${token("colorBorder")}`,
|
|
160
|
-
borderRadius: "999px",
|
|
161
|
-
whiteSpace: "nowrap"
|
|
162
|
-
},
|
|
163
|
-
priceSale: { fontSize: "1.05rem", fontWeight: 700, color: token("colorText") },
|
|
164
|
-
priceStrike: { fontSize: "0.9rem", color: token("colorMuted"), textDecoration: "line-through" },
|
|
165
|
-
// flash hero
|
|
166
|
-
banner: {
|
|
167
|
-
width: "100%",
|
|
168
|
-
height: 140,
|
|
169
|
-
objectFit: "cover",
|
|
170
|
-
borderTopLeftRadius: token("radius"),
|
|
171
|
-
borderTopRightRadius: token("radius"),
|
|
172
|
-
display: "block"
|
|
173
|
-
},
|
|
174
|
-
countdown: { margin: 0, fontSize: "0.95rem", fontWeight: 600, color: token("colorPrimary") }
|
|
30
|
+
const t = { ...DEFAULT_LABELS, ...labels };
|
|
31
|
+
const [mode, setMode] = useState("signIn");
|
|
32
|
+
const [email, setEmail] = useState("");
|
|
33
|
+
const [password, setPassword] = useState("");
|
|
34
|
+
const [fullName, setFullName] = useState("");
|
|
35
|
+
const [busy, setBusy] = useState(false);
|
|
36
|
+
const s = styles();
|
|
37
|
+
async function guard(action) {
|
|
38
|
+
setBusy(true);
|
|
39
|
+
try {
|
|
40
|
+
await action();
|
|
41
|
+
} catch {
|
|
42
|
+
} finally {
|
|
43
|
+
setBusy(false);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const onAuth = (e) => {
|
|
47
|
+
e.preventDefault();
|
|
48
|
+
void guard(
|
|
49
|
+
() => mode === "signIn" ? account.signIn(email, password) : account.signUp(email, password)
|
|
50
|
+
);
|
|
175
51
|
};
|
|
52
|
+
const onLink = (e) => {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
void guard(() => account.link({ fullName, email, marketingOptIn: false }));
|
|
55
|
+
};
|
|
56
|
+
if (account.status === "loading") {
|
|
57
|
+
return /* @__PURE__ */ jsx("div", { className, style: s.card, children: /* @__PURE__ */ jsx("p", { style: s.muted, children: t.loading }) });
|
|
58
|
+
}
|
|
59
|
+
if (account.status === "authed_no_customer") {
|
|
60
|
+
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onLink, children: [
|
|
61
|
+
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.linkHeading }),
|
|
62
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
63
|
+
t.name,
|
|
64
|
+
/* @__PURE__ */ jsx("input", { value: fullName, onChange: (e) => setFullName(e.target.value), style: s.input, required: true })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
67
|
+
t.email,
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"input",
|
|
70
|
+
{
|
|
71
|
+
type: "email",
|
|
72
|
+
value: email,
|
|
73
|
+
onChange: (e) => setEmail(e.target.value),
|
|
74
|
+
style: s.input,
|
|
75
|
+
required: true
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.saving : t.finishProfile }),
|
|
80
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, onClick: () => void account.signOut(), children: t.signOut }),
|
|
81
|
+
account.error && /* @__PURE__ */ jsx("p", { style: s.error, children: account.error.code })
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
if (account.status === "linked") return null;
|
|
85
|
+
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onAuth, children: [
|
|
86
|
+
/* @__PURE__ */ jsx("h3", { style: s.heading, children: mode === "signIn" ? t.signInHeading : t.signUpHeading }),
|
|
87
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
88
|
+
t.email,
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
"input",
|
|
91
|
+
{
|
|
92
|
+
type: "email",
|
|
93
|
+
value: email,
|
|
94
|
+
onChange: (e) => setEmail(e.target.value),
|
|
95
|
+
style: s.input,
|
|
96
|
+
required: true
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
101
|
+
t.password,
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
"input",
|
|
104
|
+
{
|
|
105
|
+
type: "password",
|
|
106
|
+
value: password,
|
|
107
|
+
onChange: (e) => setPassword(e.target.value),
|
|
108
|
+
style: s.input,
|
|
109
|
+
required: true
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.signingIn : mode === "signIn" ? t.signIn : t.createAccount }),
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
"button",
|
|
116
|
+
{
|
|
117
|
+
type: "button",
|
|
118
|
+
style: s.linkBtn,
|
|
119
|
+
onClick: () => setMode(mode === "signIn" ? "signUp" : "signIn"),
|
|
120
|
+
children: mode === "signIn" ? t.needAccount : t.haveAccount
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
account.error && /* @__PURE__ */ jsx("p", { style: s.error, children: account.error.code })
|
|
124
|
+
] });
|
|
176
125
|
}
|
|
177
|
-
function
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
function minutesToTime(min) {
|
|
184
|
-
const h = Math.floor(min / 60).toString().padStart(2, "0");
|
|
185
|
-
const m = (min % 60).toString().padStart(2, "0");
|
|
186
|
-
return `${h}:${m}`;
|
|
187
|
-
}
|
|
188
|
-
function timeToMinutes(t) {
|
|
189
|
-
const [h, m] = t.split(":").map(Number);
|
|
190
|
-
return (h ?? 0) * 60 + (m ?? 0);
|
|
191
|
-
}
|
|
192
|
-
function useCountdown(targetMs) {
|
|
193
|
-
const [now, setNow] = useState(null);
|
|
194
|
-
useEffect(() => {
|
|
195
|
-
if (targetMs === null) return;
|
|
196
|
-
setNow(Date.now());
|
|
197
|
-
const id = setInterval(() => setNow(Date.now()), 1e3);
|
|
198
|
-
return () => clearInterval(id);
|
|
199
|
-
}, [targetMs]);
|
|
200
|
-
if (now === null || targetMs === null) return null;
|
|
201
|
-
const remaining = targetMs - now;
|
|
202
|
-
if (remaining <= 0) return { ended: true, label: "" };
|
|
203
|
-
return { ended: false, label: humanizeRemaining(remaining) };
|
|
204
|
-
}
|
|
205
|
-
function humanizeRemaining(ms) {
|
|
206
|
-
const totalSec = Math.floor(ms / 1e3);
|
|
207
|
-
const d = Math.floor(totalSec / 86400);
|
|
208
|
-
const h = Math.floor(totalSec % 86400 / 3600);
|
|
209
|
-
const m = Math.floor(totalSec % 3600 / 60);
|
|
210
|
-
const s = totalSec % 60;
|
|
211
|
-
if (d > 0) return `${d}d ${h}h ${m}m`;
|
|
212
|
-
if (h > 0) return `${h}h ${m}m ${s}s`;
|
|
213
|
-
if (m > 0) return `${m}m ${s}s`;
|
|
214
|
-
return `${s}s`;
|
|
126
|
+
function AuthGate({ children, labels, className }) {
|
|
127
|
+
const account = useAccount();
|
|
128
|
+
if (account.status === "linked" && account.customer) {
|
|
129
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children?.({ customer: account.customer, account }) });
|
|
130
|
+
}
|
|
131
|
+
return /* @__PURE__ */ jsx(AuthForm, { account, labels, className });
|
|
215
132
|
}
|
|
216
|
-
var
|
|
133
|
+
var DEFAULT_LABELS2 = {
|
|
217
134
|
heading: "Book",
|
|
218
135
|
date: "Date",
|
|
219
136
|
start: "Start time",
|
|
137
|
+
loadingTimes: "Finding times\u2026",
|
|
138
|
+
noTimes: "No times available for this date.",
|
|
220
139
|
quantity: "Quantity",
|
|
140
|
+
addonsHeading: "Add-ons",
|
|
221
141
|
name: "Name",
|
|
222
142
|
email: "Email",
|
|
223
|
-
|
|
143
|
+
reviewOrder: "Review order",
|
|
144
|
+
reviewHeading: "Review your order",
|
|
145
|
+
reservationLineLabel: "{count} {unit} \xB7 {date} \xB7 {time}",
|
|
146
|
+
reservationFeeLabel: "Reservation fee",
|
|
147
|
+
orderTotal: "Total",
|
|
148
|
+
editOrder: "Edit order",
|
|
149
|
+
hold: "Book Now",
|
|
224
150
|
holding: "Booking\u2026",
|
|
225
151
|
continueToPayment: "Continue to payment",
|
|
226
152
|
preparing: "Preparing\u2026",
|
|
@@ -238,6 +164,32 @@ var DEFAULT_LABELS = {
|
|
|
238
164
|
notYou: "Not you?",
|
|
239
165
|
signInHint: "Sign in to book faster"
|
|
240
166
|
};
|
|
167
|
+
var COUNT_LABEL = {
|
|
168
|
+
per_unit_per_hour: "Lanes",
|
|
169
|
+
per_person_per_hour: "Bowlers",
|
|
170
|
+
per_game: "Games"
|
|
171
|
+
};
|
|
172
|
+
var ADDON_RATE_SUFFIX = {
|
|
173
|
+
per_person: " / person",
|
|
174
|
+
per_unit: " / unit",
|
|
175
|
+
flat: ""
|
|
176
|
+
};
|
|
177
|
+
function todayISO() {
|
|
178
|
+
const d = /* @__PURE__ */ new Date();
|
|
179
|
+
const y = d.getFullYear();
|
|
180
|
+
const m = String(d.getMonth() + 1).padStart(2, "0");
|
|
181
|
+
const day = String(d.getDate()).padStart(2, "0");
|
|
182
|
+
return `${y}-${m}-${day}`;
|
|
183
|
+
}
|
|
184
|
+
function formatDateLabel(dateISO) {
|
|
185
|
+
const [y, m, d] = dateISO.split("-").map(Number);
|
|
186
|
+
if (!y || !m || !d) return dateISO;
|
|
187
|
+
return new Date(y, m - 1, d).toLocaleDateString(void 0, {
|
|
188
|
+
weekday: "short",
|
|
189
|
+
month: "short",
|
|
190
|
+
day: "numeric"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
241
193
|
function BookingFlow({
|
|
242
194
|
centerId,
|
|
243
195
|
productId,
|
|
@@ -253,25 +205,47 @@ function BookingFlow({
|
|
|
253
205
|
labels,
|
|
254
206
|
className
|
|
255
207
|
}) {
|
|
256
|
-
const t = { ...
|
|
208
|
+
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
257
209
|
const account = useAccount();
|
|
258
210
|
const signedIn = account.status === "linked" && account.customer !== null;
|
|
259
211
|
const acctName = account.customer?.fullName ?? "";
|
|
260
212
|
const acctEmail = account.customer?.email ?? "";
|
|
261
213
|
const [dateISO, setDateISO] = useState(defaultDateISO);
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
if (!defaultDateISO && dateISO === "") setDateISO(todayISO());
|
|
216
|
+
}, [defaultDateISO, dateISO]);
|
|
262
217
|
const [startMinuteOfDay, setStartMinuteOfDay] = useState(defaultStartMinuteOfDay);
|
|
263
218
|
const endMinuteOfDay = startMinuteOfDay + durationMinutes;
|
|
264
|
-
const [
|
|
265
|
-
const [fullName, setFullName] = useState("");
|
|
266
|
-
const [email, setEmail] = useState("");
|
|
219
|
+
const [count, setCount] = useState(1);
|
|
267
220
|
const [payMessage, setPayMessage] = useState(null);
|
|
221
|
+
const [reviewing, setReviewing] = useState(false);
|
|
222
|
+
const [addonQtys, setAddonQtys] = useState({});
|
|
223
|
+
const selectedAddons = useMemo(
|
|
224
|
+
() => Object.entries(addonQtys).filter(([, q]) => q > 0).map(([addonId, quantity]) => ({ addonId, quantity })),
|
|
225
|
+
[addonQtys]
|
|
226
|
+
);
|
|
227
|
+
const countArgs = pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count };
|
|
268
228
|
const availability = useAvailability(
|
|
269
229
|
{ productId, dateISO, startMinuteOfDay, endMinuteOfDay },
|
|
270
|
-
{ enabled: dateISO !== "" }
|
|
230
|
+
{ enabled: dateISO !== "" && signedIn }
|
|
271
231
|
);
|
|
272
232
|
const preview = useBookingPreview(
|
|
273
|
-
{
|
|
274
|
-
|
|
233
|
+
{
|
|
234
|
+
centerId,
|
|
235
|
+
productId,
|
|
236
|
+
dateISO,
|
|
237
|
+
startMinuteOfDay,
|
|
238
|
+
endMinuteOfDay,
|
|
239
|
+
mode: pricingMode,
|
|
240
|
+
...countArgs,
|
|
241
|
+
addons: selectedAddons
|
|
242
|
+
},
|
|
243
|
+
{ enabled: dateISO !== "" && signedIn }
|
|
244
|
+
);
|
|
245
|
+
const addons = useAddons({ productId }, { enabled: signedIn });
|
|
246
|
+
const startTimes = useStartTimes(
|
|
247
|
+
{ productId, dateISO, durationMinutes, mode: pricingMode },
|
|
248
|
+
{ enabled: dateISO !== "" && signedIn }
|
|
275
249
|
);
|
|
276
250
|
const flow = useBookingFlow();
|
|
277
251
|
const onConfirmedRef = useRef(onConfirmed);
|
|
@@ -281,6 +255,17 @@ function BookingFlow({
|
|
|
281
255
|
onConfirmedRef.current?.(flow.reservation);
|
|
282
256
|
}
|
|
283
257
|
}, [flow.status, flow.reservation]);
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (typeof window !== "undefined" && (flow.status === "held" || flow.status === "preparingPayment" || flow.status === "awaitingPayment" || flow.status === "confirmed")) {
|
|
260
|
+
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
261
|
+
}
|
|
262
|
+
}, [flow.status]);
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
const opts = startTimes.data;
|
|
265
|
+
if (opts && opts.length > 0 && !opts.includes(startMinuteOfDay)) {
|
|
266
|
+
setStartMinuteOfDay(opts[0]);
|
|
267
|
+
}
|
|
268
|
+
}, [startTimes.data, startMinuteOfDay]);
|
|
284
269
|
const prepareRef = useRef(flow.preparePayment);
|
|
285
270
|
prepareRef.current = flow.preparePayment;
|
|
286
271
|
useEffect(() => {
|
|
@@ -296,14 +281,17 @@ function BookingFlow({
|
|
|
296
281
|
startMinuteOfDay,
|
|
297
282
|
endMinuteOfDay,
|
|
298
283
|
mode: pricingMode,
|
|
299
|
-
units,
|
|
300
|
-
|
|
284
|
+
...pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count },
|
|
285
|
+
addons: selectedAddons,
|
|
286
|
+
// Always the signed-in customer — online booking requires login.
|
|
287
|
+
customer: { fullName: acctName, email: acctEmail, marketingOptIn: false }
|
|
301
288
|
}),
|
|
302
|
-
[centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, pricingMode,
|
|
289
|
+
[centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, pricingMode, count, selectedAddons, acctName, acctEmail]
|
|
303
290
|
);
|
|
304
291
|
const freeUnits = availability.data ? availableUnitCount(availability.data) : null;
|
|
305
292
|
const quoteCents = preview.data?.totalCentsPerPlan?.[0]?.totalCents ?? null;
|
|
306
|
-
const
|
|
293
|
+
const addonList = addons.data ?? [];
|
|
294
|
+
const startOptions = startTimes.data ?? [];
|
|
307
295
|
const s = styles();
|
|
308
296
|
if (flow.status === "confirmed") {
|
|
309
297
|
return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
|
|
@@ -313,7 +301,18 @@ function BookingFlow({
|
|
|
313
301
|
": ",
|
|
314
302
|
/* @__PURE__ */ jsx("strong", { children: flow.reservation?.reservationDisplayId ?? "\u2014" })
|
|
315
303
|
] }),
|
|
316
|
-
/* @__PURE__ */ jsx(
|
|
304
|
+
/* @__PURE__ */ jsx(
|
|
305
|
+
"button",
|
|
306
|
+
{
|
|
307
|
+
type: "button",
|
|
308
|
+
style: s.primaryBtn,
|
|
309
|
+
onClick: () => {
|
|
310
|
+
setReviewing(false);
|
|
311
|
+
flow.reset();
|
|
312
|
+
},
|
|
313
|
+
children: t.bookAnother
|
|
314
|
+
}
|
|
315
|
+
)
|
|
317
316
|
] });
|
|
318
317
|
}
|
|
319
318
|
if (flow.status === "awaitingPayment" && flow.paymentIntent) {
|
|
@@ -350,10 +349,64 @@ function BookingFlow({
|
|
|
350
349
|
flow.error && /* @__PURE__ */ jsx("p", { style: s.error, children: flow.error.code })
|
|
351
350
|
] });
|
|
352
351
|
}
|
|
352
|
+
if (!signedIn) {
|
|
353
|
+
return /* @__PURE__ */ jsx(AuthForm, { account, className });
|
|
354
|
+
}
|
|
353
355
|
const holding = flow.status === "holding";
|
|
356
|
+
if (reviewing) {
|
|
357
|
+
const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
|
|
358
|
+
const addonsSubtotalCents = chosenAddons.reduce(
|
|
359
|
+
(sum, a) => sum + a.priceCents * a.quantity,
|
|
360
|
+
0
|
|
361
|
+
);
|
|
362
|
+
const fee = preview.data?.reservationFee;
|
|
363
|
+
const feeCents = typeof fee?.amountCents === "number" ? fee.amountCents : 0;
|
|
364
|
+
const feeLabel = typeof fee?.label === "string" && fee.label ? fee.label : t.reservationFeeLabel;
|
|
365
|
+
const reservationCents = quoteCents != null ? quoteCents - addonsSubtotalCents - feeCents : null;
|
|
366
|
+
const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", COUNT_LABEL[pricingMode]).replace("{date}", formatDateLabel(dateISO)).replace("{time}", `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
|
|
367
|
+
return /* @__PURE__ */ jsxs("div", { className, style: s.card, children: [
|
|
368
|
+
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.reviewHeading }),
|
|
369
|
+
/* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
|
|
370
|
+
/* @__PURE__ */ jsx("span", { style: s.body, children: reservationLine }),
|
|
371
|
+
reservationCents != null ? /* @__PURE__ */ jsx("span", { style: s.body, children: formatCents(reservationCents) }) : null
|
|
372
|
+
] }),
|
|
373
|
+
chosenAddons.map((a) => /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
|
|
374
|
+
/* @__PURE__ */ jsxs("span", { style: s.muted, children: [
|
|
375
|
+
a.name,
|
|
376
|
+
" \xD7 ",
|
|
377
|
+
a.quantity
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(a.priceCents * a.quantity) })
|
|
380
|
+
] }, a.id)),
|
|
381
|
+
feeCents > 0 ? /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
|
|
382
|
+
/* @__PURE__ */ jsx("span", { style: s.muted, children: feeLabel }),
|
|
383
|
+
/* @__PURE__ */ jsx("span", { style: s.muted, children: formatCents(feeCents) })
|
|
384
|
+
] }) : null,
|
|
385
|
+
/* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
|
|
386
|
+
/* @__PURE__ */ jsx("strong", { children: t.orderTotal }),
|
|
387
|
+
/* @__PURE__ */ jsx("strong", { children: quoteCents != null ? formatCents(quoteCents) : "\u2014" })
|
|
388
|
+
] }),
|
|
389
|
+
/* @__PURE__ */ jsx(
|
|
390
|
+
"button",
|
|
391
|
+
{
|
|
392
|
+
type: "button",
|
|
393
|
+
style: s.primaryBtn,
|
|
394
|
+
disabled: holding || quoteCents == null,
|
|
395
|
+
onClick: () => void flow.startHold(bookingArgs),
|
|
396
|
+
children: holding ? t.securing : t.continueToPayment
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, disabled: holding, onClick: () => setReviewing(false), children: t.editOrder }),
|
|
400
|
+
flow.error && /* @__PURE__ */ jsxs("p", { style: s.error, children: [
|
|
401
|
+
flow.error.code,
|
|
402
|
+
" \u2014 ",
|
|
403
|
+
flow.error.message
|
|
404
|
+
] })
|
|
405
|
+
] });
|
|
406
|
+
}
|
|
354
407
|
const onSubmit = (e) => {
|
|
355
408
|
e.preventDefault();
|
|
356
|
-
|
|
409
|
+
setReviewing(true);
|
|
357
410
|
};
|
|
358
411
|
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit, children: [
|
|
359
412
|
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.heading }),
|
|
@@ -363,57 +416,78 @@ function BookingFlow({
|
|
|
363
416
|
] }),
|
|
364
417
|
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
365
418
|
t.start,
|
|
366
|
-
/* @__PURE__ */ jsx(
|
|
367
|
-
"
|
|
419
|
+
startTimes.loading ? /* @__PURE__ */ jsx("span", { style: s.meta, children: t.loadingTimes }) : startOptions.length === 0 ? /* @__PURE__ */ jsx("span", { style: s.meta, children: t.noTimes }) : /* @__PURE__ */ jsx(
|
|
420
|
+
"select",
|
|
368
421
|
{
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
422
|
+
value: startMinuteOfDay,
|
|
423
|
+
onChange: (e) => setStartMinuteOfDay(Number(e.target.value)),
|
|
424
|
+
style: s.input,
|
|
425
|
+
children: startOptions.map((min) => /* @__PURE__ */ jsx("option", { value: min, children: formatMinuteLabel(min) }, min))
|
|
373
426
|
}
|
|
374
427
|
)
|
|
375
428
|
] }),
|
|
376
429
|
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
377
|
-
|
|
430
|
+
COUNT_LABEL[pricingMode],
|
|
378
431
|
/* @__PURE__ */ jsx(
|
|
379
432
|
"input",
|
|
380
433
|
{
|
|
381
434
|
type: "number",
|
|
382
435
|
min: 1,
|
|
383
|
-
value:
|
|
384
|
-
onChange: (e) =>
|
|
436
|
+
value: count,
|
|
437
|
+
onChange: (e) => setCount(Math.max(1, Number(e.target.value) || 1)),
|
|
385
438
|
style: s.input
|
|
386
439
|
}
|
|
387
440
|
)
|
|
388
441
|
] }),
|
|
389
|
-
|
|
442
|
+
addonList.length > 0 ? /* @__PURE__ */ jsxs("div", { style: s.stack, children: [
|
|
443
|
+
/* @__PURE__ */ jsx("p", { style: s.sectionTitle, children: t.addonsHeading }),
|
|
444
|
+
addonList.map((addon) => /* @__PURE__ */ jsxs("div", { style: s.rowBetween, children: [
|
|
445
|
+
/* @__PURE__ */ jsxs("span", { style: s.body, children: [
|
|
446
|
+
/* @__PURE__ */ jsx("strong", { children: addon.name }),
|
|
447
|
+
" ",
|
|
448
|
+
/* @__PURE__ */ jsxs("span", { style: s.muted, children: [
|
|
449
|
+
formatCents(addon.priceCents),
|
|
450
|
+
ADDON_RATE_SUFFIX[addon.rateMode]
|
|
451
|
+
] }),
|
|
452
|
+
addon.description ? /* @__PURE__ */ jsxs("span", { style: s.muted, children: [
|
|
453
|
+
" \xB7 ",
|
|
454
|
+
addon.description
|
|
455
|
+
] }) : null
|
|
456
|
+
] }),
|
|
457
|
+
/* @__PURE__ */ jsx(
|
|
458
|
+
"input",
|
|
459
|
+
{
|
|
460
|
+
type: "number",
|
|
461
|
+
min: 0,
|
|
462
|
+
value: addonQtys[addon.id] ?? 0,
|
|
463
|
+
onChange: (e) => setAddonQtys((prev) => ({
|
|
464
|
+
...prev,
|
|
465
|
+
[addon.id]: Math.max(0, Math.floor(Number(e.target.value) || 0))
|
|
466
|
+
})),
|
|
467
|
+
style: { ...s.input, width: "4.5rem" },
|
|
468
|
+
"aria-label": `${addon.name} quantity`
|
|
469
|
+
}
|
|
470
|
+
)
|
|
471
|
+
] }, addon.id))
|
|
472
|
+
] }) : null,
|
|
473
|
+
/* @__PURE__ */ jsxs("p", { style: s.meta, children: [
|
|
390
474
|
t.bookingAs.replace("{name}", acctName),
|
|
391
475
|
accountHref ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
392
476
|
" \xB7 ",
|
|
393
477
|
/* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: t.notYou })
|
|
394
478
|
] }) : null
|
|
395
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
396
|
-
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
397
|
-
t.name,
|
|
398
|
-
/* @__PURE__ */ jsx("input", { value: fullName, onChange: (e) => setFullName(e.target.value), style: s.input, required: true })
|
|
399
|
-
] }),
|
|
400
|
-
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
401
|
-
t.email,
|
|
402
|
-
/* @__PURE__ */ jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), style: s.input, required: true })
|
|
403
|
-
] }),
|
|
404
|
-
accountHref ? /* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: t.signInHint }) : null
|
|
405
479
|
] }),
|
|
406
480
|
/* @__PURE__ */ jsxs("p", { style: s.meta, "aria-live": "polite", children: [
|
|
407
|
-
dateISO === "" ? "" : availability.loading ? t.checkingAvailability : freeUnits !== null ? `${freeUnits} ${freeUnits === 1 ? unitLabel.singular : unitLabel.plural} available` : availability.error ? availability.error.code : "",
|
|
408
|
-
quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
|
|
481
|
+
dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : freeUnits !== null ? `${freeUnits} ${freeUnits === 1 ? unitLabel.singular : unitLabel.plural} available` : availability.error ? availability.error.code : "",
|
|
482
|
+
startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
|
|
409
483
|
] }),
|
|
410
484
|
/* @__PURE__ */ jsx(
|
|
411
485
|
"button",
|
|
412
486
|
{
|
|
413
487
|
type: "submit",
|
|
414
488
|
style: s.primaryBtn,
|
|
415
|
-
disabled:
|
|
416
|
-
children:
|
|
489
|
+
disabled: dateISO === "" || startOptions.length === 0 || quoteCents === null,
|
|
490
|
+
children: t.reviewOrder
|
|
417
491
|
}
|
|
418
492
|
),
|
|
419
493
|
flow.error && /* @__PURE__ */ jsxs("p", { style: s.error, children: [
|
|
@@ -423,131 +497,6 @@ function BookingFlow({
|
|
|
423
497
|
] })
|
|
424
498
|
] });
|
|
425
499
|
}
|
|
426
|
-
var DEFAULT_LABELS2 = {
|
|
427
|
-
signInHeading: "Sign in",
|
|
428
|
-
signUpHeading: "Create your account",
|
|
429
|
-
linkHeading: "Finish your profile",
|
|
430
|
-
loading: "Loading\u2026",
|
|
431
|
-
email: "Email",
|
|
432
|
-
password: "Password",
|
|
433
|
-
name: "Name",
|
|
434
|
-
signIn: "Sign in",
|
|
435
|
-
signingIn: "Signing in\u2026",
|
|
436
|
-
createAccount: "Create account",
|
|
437
|
-
haveAccount: "Already have an account? Sign in",
|
|
438
|
-
needAccount: "New here? Create an account",
|
|
439
|
-
finishProfile: "Save profile",
|
|
440
|
-
saving: "Saving\u2026",
|
|
441
|
-
signOut: "Sign out"
|
|
442
|
-
};
|
|
443
|
-
function AuthForm({
|
|
444
|
-
account,
|
|
445
|
-
labels,
|
|
446
|
-
className
|
|
447
|
-
}) {
|
|
448
|
-
const t = { ...DEFAULT_LABELS2, ...labels };
|
|
449
|
-
const [mode, setMode] = useState("signIn");
|
|
450
|
-
const [email, setEmail] = useState("");
|
|
451
|
-
const [password, setPassword] = useState("");
|
|
452
|
-
const [fullName, setFullName] = useState("");
|
|
453
|
-
const [busy, setBusy] = useState(false);
|
|
454
|
-
const s = styles();
|
|
455
|
-
async function guard(action) {
|
|
456
|
-
setBusy(true);
|
|
457
|
-
try {
|
|
458
|
-
await action();
|
|
459
|
-
} catch {
|
|
460
|
-
} finally {
|
|
461
|
-
setBusy(false);
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
const onAuth = (e) => {
|
|
465
|
-
e.preventDefault();
|
|
466
|
-
void guard(
|
|
467
|
-
() => mode === "signIn" ? account.signIn(email, password) : account.signUp(email, password)
|
|
468
|
-
);
|
|
469
|
-
};
|
|
470
|
-
const onLink = (e) => {
|
|
471
|
-
e.preventDefault();
|
|
472
|
-
void guard(() => account.link({ fullName, email, marketingOptIn: false }));
|
|
473
|
-
};
|
|
474
|
-
if (account.status === "loading") {
|
|
475
|
-
return /* @__PURE__ */ jsx("div", { className, style: s.card, children: /* @__PURE__ */ jsx("p", { style: s.muted, children: t.loading }) });
|
|
476
|
-
}
|
|
477
|
-
if (account.status === "authed_no_customer") {
|
|
478
|
-
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onLink, children: [
|
|
479
|
-
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.linkHeading }),
|
|
480
|
-
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
481
|
-
t.name,
|
|
482
|
-
/* @__PURE__ */ jsx("input", { value: fullName, onChange: (e) => setFullName(e.target.value), style: s.input, required: true })
|
|
483
|
-
] }),
|
|
484
|
-
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
485
|
-
t.email,
|
|
486
|
-
/* @__PURE__ */ jsx(
|
|
487
|
-
"input",
|
|
488
|
-
{
|
|
489
|
-
type: "email",
|
|
490
|
-
value: email,
|
|
491
|
-
onChange: (e) => setEmail(e.target.value),
|
|
492
|
-
style: s.input,
|
|
493
|
-
required: true
|
|
494
|
-
}
|
|
495
|
-
)
|
|
496
|
-
] }),
|
|
497
|
-
/* @__PURE__ */ jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.saving : t.finishProfile }),
|
|
498
|
-
/* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, onClick: () => void account.signOut(), children: t.signOut }),
|
|
499
|
-
account.error && /* @__PURE__ */ jsx("p", { style: s.error, children: account.error.code })
|
|
500
|
-
] });
|
|
501
|
-
}
|
|
502
|
-
if (account.status === "linked") return null;
|
|
503
|
-
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onAuth, children: [
|
|
504
|
-
/* @__PURE__ */ jsx("h3", { style: s.heading, children: mode === "signIn" ? t.signInHeading : t.signUpHeading }),
|
|
505
|
-
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
506
|
-
t.email,
|
|
507
|
-
/* @__PURE__ */ jsx(
|
|
508
|
-
"input",
|
|
509
|
-
{
|
|
510
|
-
type: "email",
|
|
511
|
-
value: email,
|
|
512
|
-
onChange: (e) => setEmail(e.target.value),
|
|
513
|
-
style: s.input,
|
|
514
|
-
required: true
|
|
515
|
-
}
|
|
516
|
-
)
|
|
517
|
-
] }),
|
|
518
|
-
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
519
|
-
t.password,
|
|
520
|
-
/* @__PURE__ */ jsx(
|
|
521
|
-
"input",
|
|
522
|
-
{
|
|
523
|
-
type: "password",
|
|
524
|
-
value: password,
|
|
525
|
-
onChange: (e) => setPassword(e.target.value),
|
|
526
|
-
style: s.input,
|
|
527
|
-
required: true
|
|
528
|
-
}
|
|
529
|
-
)
|
|
530
|
-
] }),
|
|
531
|
-
/* @__PURE__ */ jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.signingIn : mode === "signIn" ? t.signIn : t.createAccount }),
|
|
532
|
-
/* @__PURE__ */ jsx(
|
|
533
|
-
"button",
|
|
534
|
-
{
|
|
535
|
-
type: "button",
|
|
536
|
-
style: s.linkBtn,
|
|
537
|
-
onClick: () => setMode(mode === "signIn" ? "signUp" : "signIn"),
|
|
538
|
-
children: mode === "signIn" ? t.needAccount : t.haveAccount
|
|
539
|
-
}
|
|
540
|
-
),
|
|
541
|
-
account.error && /* @__PURE__ */ jsx("p", { style: s.error, children: account.error.code })
|
|
542
|
-
] });
|
|
543
|
-
}
|
|
544
|
-
function AuthGate({ children, labels, className }) {
|
|
545
|
-
const account = useAccount();
|
|
546
|
-
if (account.status === "linked" && account.customer) {
|
|
547
|
-
return /* @__PURE__ */ jsx(Fragment, { children: children?.({ customer: account.customer, account }) });
|
|
548
|
-
}
|
|
549
|
-
return /* @__PURE__ */ jsx(AuthForm, { account, labels, className });
|
|
550
|
-
}
|
|
551
500
|
var DEFAULT_LABELS3 = {
|
|
552
501
|
signIn: "Sign in",
|
|
553
502
|
signOut: "Sign out",
|
|
@@ -973,6 +922,6 @@ function subtitle(offer, t) {
|
|
|
973
922
|
}
|
|
974
923
|
}
|
|
975
924
|
|
|
976
|
-
export { AccountDashboard, AccountMenu, AuthForm, AuthGate,
|
|
925
|
+
export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BookingCatalog, BookingFlow, FlashSale, FlashSaleIndex };
|
|
977
926
|
//# sourceMappingURL=components.js.map
|
|
978
927
|
//# sourceMappingURL=components.js.map
|