@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.cjs
CHANGED
|
@@ -591,7 +591,18 @@ var DEFAULT_LABELS = {
|
|
|
591
591
|
needAccount: "New here? Create an account",
|
|
592
592
|
finishProfile: "Save profile",
|
|
593
593
|
saving: "Saving\u2026",
|
|
594
|
-
signOut: "Sign out"
|
|
594
|
+
signOut: "Sign out",
|
|
595
|
+
forgotPassword: "Forgot password?",
|
|
596
|
+
resetHeading: "Reset your password",
|
|
597
|
+
resetIntro: "Enter your email and we'll send you a reset code.",
|
|
598
|
+
sendResetCode: "Send reset code",
|
|
599
|
+
sending: "Sending\u2026",
|
|
600
|
+
resetCode: "Reset code",
|
|
601
|
+
newPassword: "New password",
|
|
602
|
+
resetCodeSent: "If that email has an account, a reset code is on its way. Enter it below with your new password.",
|
|
603
|
+
setNewPassword: "Set new password",
|
|
604
|
+
resetting: "Resetting\u2026",
|
|
605
|
+
backToSignIn: "Back to sign in"
|
|
595
606
|
};
|
|
596
607
|
function AuthForm({
|
|
597
608
|
account,
|
|
@@ -603,6 +614,7 @@ function AuthForm({
|
|
|
603
614
|
const [email, setEmail] = react.useState("");
|
|
604
615
|
const [password, setPassword] = react.useState("");
|
|
605
616
|
const [fullName, setFullName] = react.useState("");
|
|
617
|
+
const [resetCode, setResetCode] = react.useState("");
|
|
606
618
|
const [busy, setBusy] = react.useState(false);
|
|
607
619
|
const s = styles();
|
|
608
620
|
async function guard(action) {
|
|
@@ -628,6 +640,17 @@ function AuthForm({
|
|
|
628
640
|
e.preventDefault();
|
|
629
641
|
void guard(() => account.link({ fullName, email, marketingOptIn: false }));
|
|
630
642
|
};
|
|
643
|
+
const onForgotRequest = (e) => {
|
|
644
|
+
e.preventDefault();
|
|
645
|
+
void guard(async () => {
|
|
646
|
+
await account.requestPasswordReset(email);
|
|
647
|
+
setMode("forgotReset");
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
const onForgotReset = (e) => {
|
|
651
|
+
e.preventDefault();
|
|
652
|
+
void guard(() => account.resetPassword(email, resetCode.trim(), password));
|
|
653
|
+
};
|
|
631
654
|
if (account.status === "loading") {
|
|
632
655
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className, style: s.card, children: /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.muted, children: t.loading }) });
|
|
633
656
|
}
|
|
@@ -657,6 +680,77 @@ function AuthForm({
|
|
|
657
680
|
] });
|
|
658
681
|
}
|
|
659
682
|
if (account.status === "linked") return null;
|
|
683
|
+
if (mode === "forgotRequest") {
|
|
684
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { className, style: s.card, onSubmit: onForgotRequest, children: [
|
|
685
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: t.resetHeading }),
|
|
686
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.muted, children: t.resetIntro }),
|
|
687
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
688
|
+
t.email,
|
|
689
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
690
|
+
"input",
|
|
691
|
+
{
|
|
692
|
+
type: "email",
|
|
693
|
+
value: email,
|
|
694
|
+
onChange: (e) => setEmail(e.target.value),
|
|
695
|
+
style: s.input,
|
|
696
|
+
required: true
|
|
697
|
+
}
|
|
698
|
+
)
|
|
699
|
+
] }),
|
|
700
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.sending : t.sendResetCode }),
|
|
701
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: s.linkBtn, onClick: () => setMode("signIn"), children: t.backToSignIn }),
|
|
702
|
+
account.error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.error, children: account.error.code })
|
|
703
|
+
] });
|
|
704
|
+
}
|
|
705
|
+
if (mode === "forgotReset") {
|
|
706
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("form", { className, style: s.card, onSubmit: onForgotReset, children: [
|
|
707
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: t.resetHeading }),
|
|
708
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.muted, children: t.resetCodeSent }),
|
|
709
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
710
|
+
t.email,
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
712
|
+
"input",
|
|
713
|
+
{
|
|
714
|
+
type: "email",
|
|
715
|
+
value: email,
|
|
716
|
+
onChange: (e) => setEmail(e.target.value),
|
|
717
|
+
style: s.input,
|
|
718
|
+
required: true
|
|
719
|
+
}
|
|
720
|
+
)
|
|
721
|
+
] }),
|
|
722
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
723
|
+
t.resetCode,
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
725
|
+
"input",
|
|
726
|
+
{
|
|
727
|
+
value: resetCode,
|
|
728
|
+
onChange: (e) => setResetCode(e.target.value),
|
|
729
|
+
style: s.input,
|
|
730
|
+
inputMode: "numeric",
|
|
731
|
+
autoComplete: "one-time-code",
|
|
732
|
+
required: true
|
|
733
|
+
}
|
|
734
|
+
)
|
|
735
|
+
] }),
|
|
736
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
737
|
+
t.newPassword,
|
|
738
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
739
|
+
"input",
|
|
740
|
+
{
|
|
741
|
+
type: "password",
|
|
742
|
+
value: password,
|
|
743
|
+
onChange: (e) => setPassword(e.target.value),
|
|
744
|
+
style: s.input,
|
|
745
|
+
required: true
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
] }),
|
|
749
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", style: s.primaryBtn, disabled: busy, children: busy ? t.resetting : t.setNewPassword }),
|
|
750
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: s.linkBtn, onClick: () => setMode("signIn"), children: t.backToSignIn }),
|
|
751
|
+
account.error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.error, children: account.error.code })
|
|
752
|
+
] });
|
|
753
|
+
}
|
|
660
754
|
return /* @__PURE__ */ jsxRuntime.jsxs("form", { className, style: s.card, onSubmit: onAuth, children: [
|
|
661
755
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: mode === "signIn" ? t.signInHeading : t.signUpHeading }),
|
|
662
756
|
mode === "signUp" && /* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
@@ -707,6 +801,15 @@ function AuthForm({
|
|
|
707
801
|
children: mode === "signIn" ? t.needAccount : t.haveAccount
|
|
708
802
|
}
|
|
709
803
|
),
|
|
804
|
+
mode === "signIn" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
805
|
+
"button",
|
|
806
|
+
{
|
|
807
|
+
type: "button",
|
|
808
|
+
style: s.linkBtn,
|
|
809
|
+
onClick: () => setMode("forgotRequest"),
|
|
810
|
+
children: t.forgotPassword
|
|
811
|
+
}
|
|
812
|
+
),
|
|
710
813
|
account.error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.error, children: account.error.code })
|
|
711
814
|
] });
|
|
712
815
|
}
|
|
@@ -749,7 +852,9 @@ var DEFAULT_LABELS2 = {
|
|
|
749
852
|
checkingAvailability: "Checking availability\u2026",
|
|
750
853
|
bookingAs: "Booking as {name}",
|
|
751
854
|
notYou: "Not you?",
|
|
752
|
-
signInHint: "Sign in to book faster"
|
|
855
|
+
signInHint: "Sign in to book faster",
|
|
856
|
+
signInToContinue: "Sign in to continue",
|
|
857
|
+
signInAtCheckout: "You can browse and price your booking now \u2014 you'll sign in to complete it."
|
|
753
858
|
};
|
|
754
859
|
var COUNT_LABEL = {
|
|
755
860
|
per_unit_per_hour: "Lanes",
|
|
@@ -814,7 +919,7 @@ function BookingFlow({
|
|
|
814
919
|
const countArgs = pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count };
|
|
815
920
|
const availability = useAvailability(
|
|
816
921
|
{ productId, dateISO, startMinuteOfDay, endMinuteOfDay },
|
|
817
|
-
{ enabled: dateISO !== ""
|
|
922
|
+
{ enabled: dateISO !== "" }
|
|
818
923
|
);
|
|
819
924
|
const preview = useBookingPreview(
|
|
820
925
|
{
|
|
@@ -827,12 +932,12 @@ function BookingFlow({
|
|
|
827
932
|
...countArgs,
|
|
828
933
|
addons: selectedAddons
|
|
829
934
|
},
|
|
830
|
-
{ enabled: dateISO !== ""
|
|
935
|
+
{ enabled: dateISO !== "", auth: signedIn }
|
|
831
936
|
);
|
|
832
|
-
const addons = useAddons({ productId }, { enabled:
|
|
937
|
+
const addons = useAddons({ productId }, { enabled: true });
|
|
833
938
|
const startTimes = useStartTimes(
|
|
834
939
|
{ productId, dateISO, durationMinutes, mode: pricingMode },
|
|
835
|
-
{ enabled: dateISO !== ""
|
|
940
|
+
{ enabled: dateISO !== "" }
|
|
836
941
|
);
|
|
837
942
|
const flow = useBookingFlow();
|
|
838
943
|
const onConfirmedRef = react.useRef(onConfirmed);
|
|
@@ -936,9 +1041,6 @@ function BookingFlow({
|
|
|
936
1041
|
flow.error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.error, children: flow.error.code })
|
|
937
1042
|
] });
|
|
938
1043
|
}
|
|
939
|
-
if (!signedIn) {
|
|
940
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AuthForm, { account, className });
|
|
941
|
-
}
|
|
942
1044
|
const holding = flow.status === "holding";
|
|
943
1045
|
if (reviewing) {
|
|
944
1046
|
const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
|
|
@@ -973,15 +1075,29 @@ function BookingFlow({
|
|
|
973
1075
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: t.orderTotal }),
|
|
974
1076
|
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: quoteCents != null ? formatCents(quoteCents) : "\u2014" })
|
|
975
1077
|
] }),
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
1078
|
+
signedIn ? (
|
|
1079
|
+
// Signed in → place the hold + pay. Disabled until the (possibly
|
|
1080
|
+
// post-login) quote resolves, so we never hold/charge against a
|
|
1081
|
+
// total the customer hasn't seen. (D4: "Continue" waits for the
|
|
1082
|
+
// re-quote.)
|
|
1083
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1084
|
+
"button",
|
|
1085
|
+
{
|
|
1086
|
+
type: "button",
|
|
1087
|
+
style: s.primaryBtn,
|
|
1088
|
+
disabled: holding || preview.loading || quoteCents == null,
|
|
1089
|
+
onClick: () => void flow.startHold(bookingArgs),
|
|
1090
|
+
children: holding ? t.securing : t.continueToPayment
|
|
1091
|
+
}
|
|
1092
|
+
)
|
|
1093
|
+
) : (
|
|
1094
|
+
// Signed out → gate here (mirrors the white-label "Sign in to
|
|
1095
|
+
// continue" card). After sign-in the quote re-runs with auth, so
|
|
1096
|
+
// member rate / credit apply before payment.
|
|
1097
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.stack, children: [
|
|
1098
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.body, children: t.signInToContinue }),
|
|
1099
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthForm, { account })
|
|
1100
|
+
] })
|
|
985
1101
|
),
|
|
986
1102
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: s.linkBtn, disabled: holding, onClick: () => setReviewing(false), children: t.editOrder }),
|
|
987
1103
|
flow.error && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: s.error, children: [
|
|
@@ -1057,13 +1173,13 @@ function BookingFlow({
|
|
|
1057
1173
|
)
|
|
1058
1174
|
] }, addon.id))
|
|
1059
1175
|
] }) : null,
|
|
1060
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1176
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.meta, children: signedIn ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1061
1177
|
t.bookingAs.replace("{name}", acctName),
|
|
1062
1178
|
accountHref ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1063
1179
|
" \xB7 ",
|
|
1064
1180
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href: accountHref, style: s.linkBtn, children: t.notYou })
|
|
1065
1181
|
] }) : null
|
|
1066
|
-
] }),
|
|
1182
|
+
] }) : t.signInAtCheckout }),
|
|
1067
1183
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: s.meta, "aria-live": "polite", children: [
|
|
1068
1184
|
dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : freeUnits !== null ? `${freeUnits} ${freeUnits === 1 ? unitLabel.singular : unitLabel.plural} available` : availability.error ? availability.error.code : "",
|
|
1069
1185
|
startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
|