@bowlos/reservations 0.26.0 → 0.28.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 +109 -16
- package/README.md +7 -5
- package/dist/{account-BXf9e6UW.d.cts → account-BZ-lZcs5.d.cts} +1 -1
- package/dist/{account-N1Zs7yvQ.d.ts → account-DVAwhiki.d.ts} +1 -1
- package/dist/{catalog-CVvwgrbZ.d.cts → catalog-BdOZC2nx.d.cts} +1 -1
- package/dist/{catalog-BF_xtQxf.d.ts → catalog-C-YyKVk5.d.ts} +1 -1
- package/dist/{chunk-AYQIKZCU.js → chunk-44AWSRIG.js} +32 -4
- package/dist/chunk-44AWSRIG.js.map +1 -0
- package/dist/{chunk-PPCQFT3U.js → chunk-P5YWNLEC.js} +30 -4
- package/dist/chunk-P5YWNLEC.js.map +1 -0
- package/dist/cli.cjs +24 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/components.cjs +136 -20
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +17 -4
- package/dist/components.d.ts +17 -4
- package/dist/components.js +138 -22
- package/dist/components.js.map +1 -1
- package/dist/{data-BCbYaSC1.d.cts → data-BzO2guh0.d.cts} +23 -3
- package/dist/{data-BCbYaSC1.d.ts → data-BzO2guh0.d.ts} +23 -3
- package/dist/index.cjs +28 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/payments.d.cts +1 -1
- package/dist/payments.d.ts +1 -1
- package/dist/{react-BQikV5KJ.d.ts → react-BQaKMnCR.d.ts} +8 -2
- package/dist/{react-Y11QkXEQ.d.cts → react-CYgFZdHO.d.cts} +8 -2
- package/dist/react.cjs +53 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +5 -5
- package/dist/react.d.ts +5 -5
- package/dist/react.js +3 -3
- package/package.json +1 -1
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-AYQIKZCU.js.map +0 -1
- package/dist/chunk-PPCQFT3U.js.map +0 -1
package/dist/components.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { m as PublicSurface, g as CatalogItem } from './catalog-
|
|
4
|
-
export { h as CatalogResult, i as CatalogSection } from './catalog-
|
|
5
|
-
import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-
|
|
6
|
-
import { d as UseAccountResult } from './react-
|
|
3
|
+
import { m as PublicSurface, g as CatalogItem } from './catalog-BdOZC2nx.cjs';
|
|
4
|
+
export { h as CatalogResult, i as CatalogSection } from './catalog-BdOZC2nx.cjs';
|
|
5
|
+
import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BzO2guh0.cjs';
|
|
6
|
+
import { d as UseAccountResult } from './react-CYgFZdHO.cjs';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Themeable design tokens for the `@bowlos/reservations/components` layer.
|
|
@@ -93,6 +93,8 @@ interface BookingFlowLabels {
|
|
|
93
93
|
bookingAs: string;
|
|
94
94
|
notYou: string;
|
|
95
95
|
signInHint: string;
|
|
96
|
+
signInToContinue: string;
|
|
97
|
+
signInAtCheckout: string;
|
|
96
98
|
}
|
|
97
99
|
interface BookingFlowProps {
|
|
98
100
|
centerId: string;
|
|
@@ -163,6 +165,17 @@ interface AuthGateLabels {
|
|
|
163
165
|
finishProfile: string;
|
|
164
166
|
saving: string;
|
|
165
167
|
signOut: string;
|
|
168
|
+
forgotPassword: string;
|
|
169
|
+
resetHeading: string;
|
|
170
|
+
resetIntro: string;
|
|
171
|
+
sendResetCode: string;
|
|
172
|
+
sending: string;
|
|
173
|
+
resetCode: string;
|
|
174
|
+
newPassword: string;
|
|
175
|
+
resetCodeSent: string;
|
|
176
|
+
setNewPassword: string;
|
|
177
|
+
resetting: string;
|
|
178
|
+
backToSignIn: string;
|
|
166
179
|
}
|
|
167
180
|
/**
|
|
168
181
|
* The presentational session form — driven by a session controller passed in,
|
package/dist/components.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
-
import { m as PublicSurface, g as CatalogItem } from './catalog-
|
|
4
|
-
export { h as CatalogResult, i as CatalogSection } from './catalog-
|
|
5
|
-
import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-
|
|
6
|
-
import { d as UseAccountResult } from './react-
|
|
3
|
+
import { m as PublicSurface, g as CatalogItem } from './catalog-C-YyKVk5.js';
|
|
4
|
+
export { h as CatalogResult, i as CatalogSection } from './catalog-C-YyKVk5.js';
|
|
5
|
+
import { U as PricingMode, S as PaymentIntentInfo, l as Customer } from './data-BzO2guh0.js';
|
|
6
|
+
import { d as UseAccountResult } from './react-BQaKMnCR.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Themeable design tokens for the `@bowlos/reservations/components` layer.
|
|
@@ -93,6 +93,8 @@ interface BookingFlowLabels {
|
|
|
93
93
|
bookingAs: string;
|
|
94
94
|
notYou: string;
|
|
95
95
|
signInHint: string;
|
|
96
|
+
signInToContinue: string;
|
|
97
|
+
signInAtCheckout: string;
|
|
96
98
|
}
|
|
97
99
|
interface BookingFlowProps {
|
|
98
100
|
centerId: string;
|
|
@@ -163,6 +165,17 @@ interface AuthGateLabels {
|
|
|
163
165
|
finishProfile: string;
|
|
164
166
|
saving: string;
|
|
165
167
|
signOut: string;
|
|
168
|
+
forgotPassword: string;
|
|
169
|
+
resetHeading: string;
|
|
170
|
+
resetIntro: string;
|
|
171
|
+
sendResetCode: string;
|
|
172
|
+
sending: string;
|
|
173
|
+
resetCode: string;
|
|
174
|
+
newPassword: string;
|
|
175
|
+
resetCodeSent: string;
|
|
176
|
+
setNewPassword: string;
|
|
177
|
+
resetting: string;
|
|
178
|
+
backToSignIn: string;
|
|
166
179
|
}
|
|
167
180
|
/**
|
|
168
181
|
* The presentational session form — driven by a session controller passed in,
|
package/dist/components.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog } from './chunk-
|
|
2
|
-
import { availableUnitCount } from './chunk-
|
|
1
|
+
import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useBookingFlow, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog } from './chunk-44AWSRIG.js';
|
|
2
|
+
import { availableUnitCount } from './chunk-P5YWNLEC.js';
|
|
3
3
|
import { token, styles, formatCents, formatMinuteLabel, minutesToTime, useCountdown, formatCentsRange } from './chunk-Y3YSDO3H.js';
|
|
4
4
|
export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-Y3YSDO3H.js';
|
|
5
5
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -52,7 +52,18 @@ var DEFAULT_LABELS = {
|
|
|
52
52
|
needAccount: "New here? Create an account",
|
|
53
53
|
finishProfile: "Save profile",
|
|
54
54
|
saving: "Saving\u2026",
|
|
55
|
-
signOut: "Sign out"
|
|
55
|
+
signOut: "Sign out",
|
|
56
|
+
forgotPassword: "Forgot password?",
|
|
57
|
+
resetHeading: "Reset your password",
|
|
58
|
+
resetIntro: "Enter your email and we'll send you a reset code.",
|
|
59
|
+
sendResetCode: "Send reset code",
|
|
60
|
+
sending: "Sending\u2026",
|
|
61
|
+
resetCode: "Reset code",
|
|
62
|
+
newPassword: "New password",
|
|
63
|
+
resetCodeSent: "If that email has an account, a reset code is on its way. Enter it below with your new password.",
|
|
64
|
+
setNewPassword: "Set new password",
|
|
65
|
+
resetting: "Resetting\u2026",
|
|
66
|
+
backToSignIn: "Back to sign in"
|
|
56
67
|
};
|
|
57
68
|
function AuthForm({
|
|
58
69
|
account,
|
|
@@ -64,6 +75,7 @@ function AuthForm({
|
|
|
64
75
|
const [email, setEmail] = useState("");
|
|
65
76
|
const [password, setPassword] = useState("");
|
|
66
77
|
const [fullName, setFullName] = useState("");
|
|
78
|
+
const [resetCode, setResetCode] = useState("");
|
|
67
79
|
const [busy, setBusy] = useState(false);
|
|
68
80
|
const s = styles();
|
|
69
81
|
async function guard(action) {
|
|
@@ -89,6 +101,17 @@ function AuthForm({
|
|
|
89
101
|
e.preventDefault();
|
|
90
102
|
void guard(() => account.link({ fullName, email, marketingOptIn: false }));
|
|
91
103
|
};
|
|
104
|
+
const onForgotRequest = (e) => {
|
|
105
|
+
e.preventDefault();
|
|
106
|
+
void guard(async () => {
|
|
107
|
+
await account.requestPasswordReset(email);
|
|
108
|
+
setMode("forgotReset");
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
const onForgotReset = (e) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
void guard(() => account.resetPassword(email, resetCode.trim(), password));
|
|
114
|
+
};
|
|
92
115
|
if (account.status === "loading") {
|
|
93
116
|
return /* @__PURE__ */ jsx("div", { className, style: s.card, children: /* @__PURE__ */ jsx("p", { style: s.muted, children: t.loading }) });
|
|
94
117
|
}
|
|
@@ -118,6 +141,77 @@ function AuthForm({
|
|
|
118
141
|
] });
|
|
119
142
|
}
|
|
120
143
|
if (account.status === "linked") return null;
|
|
144
|
+
if (mode === "forgotRequest") {
|
|
145
|
+
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onForgotRequest, children: [
|
|
146
|
+
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.resetHeading }),
|
|
147
|
+
/* @__PURE__ */ jsx("p", { style: s.muted, children: t.resetIntro }),
|
|
148
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
149
|
+
t.email,
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
"input",
|
|
152
|
+
{
|
|
153
|
+
type: "email",
|
|
154
|
+
value: email,
|
|
155
|
+
onChange: (e) => setEmail(e.target.value),
|
|
156
|
+
style: s.input,
|
|
157
|
+
required: true
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.sending : t.sendResetCode }),
|
|
162
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, onClick: () => setMode("signIn"), children: t.backToSignIn }),
|
|
163
|
+
account.error && /* @__PURE__ */ jsx("p", { style: s.error, children: account.error.code })
|
|
164
|
+
] });
|
|
165
|
+
}
|
|
166
|
+
if (mode === "forgotReset") {
|
|
167
|
+
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onForgotReset, children: [
|
|
168
|
+
/* @__PURE__ */ jsx("h3", { style: s.heading, children: t.resetHeading }),
|
|
169
|
+
/* @__PURE__ */ jsx("p", { style: s.muted, children: t.resetCodeSent }),
|
|
170
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
171
|
+
t.email,
|
|
172
|
+
/* @__PURE__ */ jsx(
|
|
173
|
+
"input",
|
|
174
|
+
{
|
|
175
|
+
type: "email",
|
|
176
|
+
value: email,
|
|
177
|
+
onChange: (e) => setEmail(e.target.value),
|
|
178
|
+
style: s.input,
|
|
179
|
+
required: true
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
184
|
+
t.resetCode,
|
|
185
|
+
/* @__PURE__ */ jsx(
|
|
186
|
+
"input",
|
|
187
|
+
{
|
|
188
|
+
value: resetCode,
|
|
189
|
+
onChange: (e) => setResetCode(e.target.value),
|
|
190
|
+
style: s.input,
|
|
191
|
+
inputMode: "numeric",
|
|
192
|
+
autoComplete: "one-time-code",
|
|
193
|
+
required: true
|
|
194
|
+
}
|
|
195
|
+
)
|
|
196
|
+
] }),
|
|
197
|
+
/* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
198
|
+
t.newPassword,
|
|
199
|
+
/* @__PURE__ */ jsx(
|
|
200
|
+
"input",
|
|
201
|
+
{
|
|
202
|
+
type: "password",
|
|
203
|
+
value: password,
|
|
204
|
+
onChange: (e) => setPassword(e.target.value),
|
|
205
|
+
style: s.input,
|
|
206
|
+
required: true
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
] }),
|
|
210
|
+
/* @__PURE__ */ jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.resetting : t.setNewPassword }),
|
|
211
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, onClick: () => setMode("signIn"), children: t.backToSignIn }),
|
|
212
|
+
account.error && /* @__PURE__ */ jsx("p", { style: s.error, children: account.error.code })
|
|
213
|
+
] });
|
|
214
|
+
}
|
|
121
215
|
return /* @__PURE__ */ jsxs("form", { className, style: s.card, onSubmit: onAuth, children: [
|
|
122
216
|
/* @__PURE__ */ jsx("h3", { style: s.heading, children: mode === "signIn" ? t.signInHeading : t.signUpHeading }),
|
|
123
217
|
mode === "signUp" && /* @__PURE__ */ jsxs("label", { style: s.label, children: [
|
|
@@ -168,6 +262,15 @@ function AuthForm({
|
|
|
168
262
|
children: mode === "signIn" ? t.needAccount : t.haveAccount
|
|
169
263
|
}
|
|
170
264
|
),
|
|
265
|
+
mode === "signIn" && /* @__PURE__ */ jsx(
|
|
266
|
+
"button",
|
|
267
|
+
{
|
|
268
|
+
type: "button",
|
|
269
|
+
style: s.linkBtn,
|
|
270
|
+
onClick: () => setMode("forgotRequest"),
|
|
271
|
+
children: t.forgotPassword
|
|
272
|
+
}
|
|
273
|
+
),
|
|
171
274
|
account.error && /* @__PURE__ */ jsx("p", { style: s.error, children: account.error.code })
|
|
172
275
|
] });
|
|
173
276
|
}
|
|
@@ -210,7 +313,9 @@ var DEFAULT_LABELS2 = {
|
|
|
210
313
|
checkingAvailability: "Checking availability\u2026",
|
|
211
314
|
bookingAs: "Booking as {name}",
|
|
212
315
|
notYou: "Not you?",
|
|
213
|
-
signInHint: "Sign in to book faster"
|
|
316
|
+
signInHint: "Sign in to book faster",
|
|
317
|
+
signInToContinue: "Sign in to continue",
|
|
318
|
+
signInAtCheckout: "You can browse and price your booking now \u2014 you'll sign in to complete it."
|
|
214
319
|
};
|
|
215
320
|
var COUNT_LABEL = {
|
|
216
321
|
per_unit_per_hour: "Lanes",
|
|
@@ -275,7 +380,7 @@ function BookingFlow({
|
|
|
275
380
|
const countArgs = pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count };
|
|
276
381
|
const availability = useAvailability(
|
|
277
382
|
{ productId, dateISO, startMinuteOfDay, endMinuteOfDay },
|
|
278
|
-
{ enabled: dateISO !== ""
|
|
383
|
+
{ enabled: dateISO !== "" }
|
|
279
384
|
);
|
|
280
385
|
const preview = useBookingPreview(
|
|
281
386
|
{
|
|
@@ -288,12 +393,12 @@ function BookingFlow({
|
|
|
288
393
|
...countArgs,
|
|
289
394
|
addons: selectedAddons
|
|
290
395
|
},
|
|
291
|
-
{ enabled: dateISO !== ""
|
|
396
|
+
{ enabled: dateISO !== "", auth: signedIn }
|
|
292
397
|
);
|
|
293
|
-
const addons = useAddons({ productId }, { enabled:
|
|
398
|
+
const addons = useAddons({ productId }, { enabled: true });
|
|
294
399
|
const startTimes = useStartTimes(
|
|
295
400
|
{ productId, dateISO, durationMinutes, mode: pricingMode },
|
|
296
|
-
{ enabled: dateISO !== ""
|
|
401
|
+
{ enabled: dateISO !== "" }
|
|
297
402
|
);
|
|
298
403
|
const flow = useBookingFlow();
|
|
299
404
|
const onConfirmedRef = useRef(onConfirmed);
|
|
@@ -397,9 +502,6 @@ function BookingFlow({
|
|
|
397
502
|
flow.error && /* @__PURE__ */ jsx("p", { style: s.error, children: flow.error.code })
|
|
398
503
|
] });
|
|
399
504
|
}
|
|
400
|
-
if (!signedIn) {
|
|
401
|
-
return /* @__PURE__ */ jsx(AuthForm, { account, className });
|
|
402
|
-
}
|
|
403
505
|
const holding = flow.status === "holding";
|
|
404
506
|
if (reviewing) {
|
|
405
507
|
const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
|
|
@@ -434,15 +536,29 @@ function BookingFlow({
|
|
|
434
536
|
/* @__PURE__ */ jsx("strong", { children: t.orderTotal }),
|
|
435
537
|
/* @__PURE__ */ jsx("strong", { children: quoteCents != null ? formatCents(quoteCents) : "\u2014" })
|
|
436
538
|
] }),
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
539
|
+
signedIn ? (
|
|
540
|
+
// Signed in → place the hold + pay. Disabled until the (possibly
|
|
541
|
+
// post-login) quote resolves, so we never hold/charge against a
|
|
542
|
+
// total the customer hasn't seen. (D4: "Continue" waits for the
|
|
543
|
+
// re-quote.)
|
|
544
|
+
/* @__PURE__ */ jsx(
|
|
545
|
+
"button",
|
|
546
|
+
{
|
|
547
|
+
type: "button",
|
|
548
|
+
style: s.primaryBtn,
|
|
549
|
+
disabled: holding || preview.loading || quoteCents == null,
|
|
550
|
+
onClick: () => void flow.startHold(bookingArgs),
|
|
551
|
+
children: holding ? t.securing : t.continueToPayment
|
|
552
|
+
}
|
|
553
|
+
)
|
|
554
|
+
) : (
|
|
555
|
+
// Signed out → gate here (mirrors the white-label "Sign in to
|
|
556
|
+
// continue" card). After sign-in the quote re-runs with auth, so
|
|
557
|
+
// member rate / credit apply before payment.
|
|
558
|
+
/* @__PURE__ */ jsxs("div", { style: s.stack, children: [
|
|
559
|
+
/* @__PURE__ */ jsx("p", { style: s.body, children: t.signInToContinue }),
|
|
560
|
+
/* @__PURE__ */ jsx(AuthForm, { account })
|
|
561
|
+
] })
|
|
446
562
|
),
|
|
447
563
|
/* @__PURE__ */ jsx("button", { type: "button", style: s.linkBtn, disabled: holding, onClick: () => setReviewing(false), children: t.editOrder }),
|
|
448
564
|
flow.error && /* @__PURE__ */ jsxs("p", { style: s.error, children: [
|
|
@@ -518,13 +634,13 @@ function BookingFlow({
|
|
|
518
634
|
)
|
|
519
635
|
] }, addon.id))
|
|
520
636
|
] }) : null,
|
|
521
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ jsx("p", { style: s.meta, children: signedIn ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
522
638
|
t.bookingAs.replace("{name}", acctName),
|
|
523
639
|
accountHref ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
524
640
|
" \xB7 ",
|
|
525
641
|
/* @__PURE__ */ jsx("a", { href: accountHref, style: s.linkBtn, children: t.notYou })
|
|
526
642
|
] }) : null
|
|
527
|
-
] }),
|
|
643
|
+
] }) : t.signInAtCheckout }),
|
|
528
644
|
/* @__PURE__ */ jsxs("p", { style: s.meta, "aria-live": "polite", children: [
|
|
529
645
|
dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : freeUnits !== null ? `${freeUnits} ${freeUnits === 1 ? unitLabel.singular : unitLabel.plural} available` : availability.error ? availability.error.code : "",
|
|
530
646
|
startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
|