@bowlos/reservations 0.35.0 → 0.41.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/AGENTS.md +300 -0
- package/HEADLESS.md +716 -11
- package/README.md +363 -2
- package/dist/{data-qw8P3JW3.d.cts → account-DEX2Lr78.d.cts} +218 -3
- package/dist/{data-qw8P3JW3.d.ts → account-DEX2Lr78.d.ts} +218 -3
- package/dist/booking-change-4DGu-B08.d.ts +1282 -0
- package/dist/booking-change-aK6P37FZ.d.cts +1282 -0
- package/dist/{chunk-UN5E6UEZ.js → chunk-44WKP6MW.js} +38 -7
- package/dist/chunk-44WKP6MW.js.map +1 -0
- package/dist/{chunk-MMSVM3QS.js → chunk-BWJHRJN6.js} +75 -187
- package/dist/chunk-BWJHRJN6.js.map +1 -0
- package/dist/{chunk-Y3YSDO3H.js → chunk-FMFHNBDH.js} +56 -5
- package/dist/chunk-FMFHNBDH.js.map +1 -0
- package/dist/chunk-I37IJNYU.js +139 -0
- package/dist/chunk-I37IJNYU.js.map +1 -0
- package/dist/chunk-VJIS56OO.js +717 -0
- package/dist/chunk-VJIS56OO.js.map +1 -0
- package/dist/{chunk-SMPDCDMB.js → chunk-YAXBZJMI.js} +3 -3
- package/dist/chunk-YAXBZJMI.js.map +1 -0
- package/dist/cli.cjs +34 -6
- package/dist/cli.cjs.map +1 -1
- package/dist/components.cjs +1596 -4
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +208 -7
- package/dist/components.d.ts +208 -7
- package/dist/components.js +1046 -8
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +299 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -5
- package/dist/index.d.ts +56 -5
- package/dist/index.js +77 -5
- package/dist/index.js.map +1 -1
- package/dist/payments.cjs +203 -0
- package/dist/payments.cjs.map +1 -1
- package/dist/payments.d.cts +16 -2
- package/dist/payments.d.ts +16 -2
- package/dist/payments.js +78 -2
- package/dist/payments.js.map +1 -1
- package/dist/{react-C2V1kXnO.d.ts → react-CrRciA7I.d.ts} +2 -2
- package/dist/{react-DtncBQ3b.d.cts → react-QJrsaOnN.d.cts} +2 -2
- package/dist/react.cjs +801 -30
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +150 -7
- package/dist/react.d.ts +150 -7
- package/dist/react.js +72 -4
- package/dist/react.js.map +1 -1
- package/package.json +10 -3
- package/templates/center-site/README.md +5 -0
- package/templates/center-site/app/account/game-cards/page.tsx +17 -0
- package/templates/center-site/app/account/layout.tsx +16 -0
- package/templates/center-site/app/account/memberships/[id]/page.tsx +23 -0
- package/templates/center-site/app/account/memberships/page.tsx +33 -0
- package/templates/center-site/app/account/orders/page.tsx +17 -0
- package/templates/center-site/app/account/page.tsx +14 -0
- package/templates/center-site/app/account/payment-methods/page.tsx +23 -0
- package/templates/center-site/app/account/privacy/page.tsx +17 -0
- package/templates/center-site/app/account/profile/page.tsx +45 -0
- package/templates/center-site/app/account/reservations/[displayId]/change/page.tsx +46 -0
- package/templates/center-site/app/account/reservations/[displayId]/page.tsx +41 -0
- package/templates/center-site/app/account/reservations/page.tsx +35 -0
- package/templates/center-site/app/account/security/page.tsx +17 -0
- package/templates/center-site/app/book/page.tsx +11 -23
- package/templates/center-site/app/catalog/page.tsx +21 -12
- package/templates/center-site/app/events/[slug]/page.tsx +130 -0
- package/templates/center-site/app/events/page.tsx +57 -0
- package/templates/center-site/app/pay/[token]/page.tsx +53 -0
- package/templates/center-site/app/site-header.tsx +1 -0
- package/templates/center-site/lib/reservation.ts +14 -0
- package/templates/center-site/package.json +1 -1
- package/templates/center-site/tsconfig.json +7 -9
- package/dist/account-BJ5UjC0r.d.ts +0 -165
- package/dist/account-QoFg8-i1.d.cts +0 -165
- package/dist/catalog-CGitz1PG.d.ts +0 -221
- package/dist/catalog-p9cwB6Qv.d.cts +0 -221
- package/dist/chunk-MMSVM3QS.js.map +0 -1
- package/dist/chunk-SMPDCDMB.js.map +0 -1
- package/dist/chunk-UN5E6UEZ.js.map +0 -1
- package/dist/chunk-Y3YSDO3H.js.map +0 -1
package/dist/components.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { INQUIRY_FORMS } from './chunk-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { token, styles, formatCents, formatMinuteLabel, minutesToTime, useCountdown, formatCentsRange } from './chunk-
|
|
5
|
-
export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-
|
|
1
|
+
import { INQUIRY_FORMS } from './chunk-YAXBZJMI.js';
|
|
2
|
+
import { useBookingFlow, useCenters, useMyGameCardHistory, useWalletPassUrl, useUpdateMyProfile, useMyCommunicationPrefs, useSetMyCommunicationPref, useAccountDeletion, useMyMembershipMembers, useAddMyMembershipMember, useCancelMyMembership, useOpenMembershipBillingPortal, useBookingChange, useMyPackageOrders } from './chunk-VJIS56OO.js';
|
|
3
|
+
import './chunk-I37IJNYU.js';
|
|
4
|
+
import { token, styles, formatCents, formatMinuteLabel, AccountPanel, QueryState, useAccountAction, minutesToTime, useCountdown, formatCentsRange, timeToMinutes } from './chunk-FMFHNBDH.js';
|
|
5
|
+
export { BOWLOS_DEFAULT_THEME, BowlosTheme, formatCents, formatCentsRange } from './chunk-FMFHNBDH.js';
|
|
6
|
+
import { useTestMode, useAccount, useAvailability, useBookingPreview, useAddons, useStartTimes, useSavedCards, useRemoveCard, useSetDefaultCard, useChangePassword, useBowlosMutation, useMyReservations, useMyMemberships, useMyLoyalty, useMyCredits, useMyPasses, useFlashSale, useFlashSales, useCatalog, useRetailPricing, useMyMembershipDetail, useMyGameCards, useMyEventOrders } from './chunk-BWJHRJN6.js';
|
|
7
|
+
import { availableUnitCount } from './chunk-44WKP6MW.js';
|
|
6
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
9
|
import { useState, useEffect, useMemo, useRef } from 'react';
|
|
8
10
|
|
|
@@ -737,6 +739,626 @@ function AccountMenu({ accountHref = "/account", labels, className }) {
|
|
|
737
739
|
}
|
|
738
740
|
return /* @__PURE__ */ jsx("a", { className, href: accountHref, style: { ...wrap, ...s.linkBtn }, children: t.signIn });
|
|
739
741
|
}
|
|
742
|
+
function GameCardHistory({
|
|
743
|
+
brandId,
|
|
744
|
+
centerId,
|
|
745
|
+
gameCardId,
|
|
746
|
+
unitNoun = "games",
|
|
747
|
+
timeZone,
|
|
748
|
+
labels,
|
|
749
|
+
className
|
|
750
|
+
}) {
|
|
751
|
+
const t = {
|
|
752
|
+
title: "Game card history",
|
|
753
|
+
empty: "No activity yet.",
|
|
754
|
+
more: "Next page",
|
|
755
|
+
back: "First page",
|
|
756
|
+
...labels
|
|
757
|
+
};
|
|
758
|
+
const centers = useCenters({ brandId });
|
|
759
|
+
const [cursor, setCursor] = useState(null);
|
|
760
|
+
const history = useMyGameCardHistory({ brandId, centerId, gameCardId, cursor, numItems: 20 });
|
|
761
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
762
|
+
/* @__PURE__ */ jsx(QueryState, { ...history }),
|
|
763
|
+
history.data?.page.length === 0 && /* @__PURE__ */ jsx("p", { children: t.empty }),
|
|
764
|
+
/* @__PURE__ */ jsx("ul", { children: history.data?.page.map((row) => /* @__PURE__ */ jsxs("li", { children: [
|
|
765
|
+
(timeZone ?? centers.data?.find((center) => center.name === row.centerName)?.timezone) && new Date(row.redeemedAt).toLocaleDateString(void 0, {
|
|
766
|
+
timeZone: timeZone ?? centers.data?.find((center) => center.name === row.centerName)?.timezone
|
|
767
|
+
}),
|
|
768
|
+
" ",
|
|
769
|
+
"\u2014 ",
|
|
770
|
+
row.gamesConsumed,
|
|
771
|
+
" ",
|
|
772
|
+
unitNoun,
|
|
773
|
+
" \u2014 ",
|
|
774
|
+
row.centerName,
|
|
775
|
+
row.notes && /* @__PURE__ */ jsx("p", { children: row.notes })
|
|
776
|
+
] }, row._id)) }),
|
|
777
|
+
history.data && !history.data.isDone && /* @__PURE__ */ jsx(
|
|
778
|
+
"button",
|
|
779
|
+
{
|
|
780
|
+
style: styles().ghostBtn,
|
|
781
|
+
disabled: history.loading,
|
|
782
|
+
onClick: () => setCursor(history.data.continueCursor),
|
|
783
|
+
children: t.more
|
|
784
|
+
}
|
|
785
|
+
),
|
|
786
|
+
cursor && /* @__PURE__ */ jsx("button", { style: styles().ghostBtn, onClick: () => setCursor(null), children: t.back })
|
|
787
|
+
] });
|
|
788
|
+
}
|
|
789
|
+
function AddToWalletButtons({
|
|
790
|
+
eligible = true,
|
|
791
|
+
labels,
|
|
792
|
+
className,
|
|
793
|
+
...scope
|
|
794
|
+
}) {
|
|
795
|
+
const t = { apple: "Add to Apple Wallet", google: "Add to Google Wallet", ...labels };
|
|
796
|
+
const wallet = useWalletPassUrl();
|
|
797
|
+
const action = useAccountAction();
|
|
798
|
+
return /* @__PURE__ */ jsxs("div", { className, style: styles().row, children: [
|
|
799
|
+
eligible && ["apple", "google"].map((platform) => /* @__PURE__ */ jsx(
|
|
800
|
+
"button",
|
|
801
|
+
{
|
|
802
|
+
style: styles().ghostBtn,
|
|
803
|
+
disabled: action.busy,
|
|
804
|
+
onClick: () => void action.run(async () => {
|
|
805
|
+
const result = await wallet.run({ ...scope, platform });
|
|
806
|
+
window.location.assign(result.url);
|
|
807
|
+
}),
|
|
808
|
+
children: t[platform]
|
|
809
|
+
},
|
|
810
|
+
platform
|
|
811
|
+
)),
|
|
812
|
+
action.feedback
|
|
813
|
+
] });
|
|
814
|
+
}
|
|
815
|
+
function EventOrders({
|
|
816
|
+
brandId,
|
|
817
|
+
title = "Event orders",
|
|
818
|
+
empty = "No event orders."
|
|
819
|
+
}) {
|
|
820
|
+
const orders = useMyEventOrders({ brandId });
|
|
821
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title, children: [
|
|
822
|
+
/* @__PURE__ */ jsx(QueryState, { ...orders }),
|
|
823
|
+
orders.data?.length === 0 && /* @__PURE__ */ jsx("p", { children: empty }),
|
|
824
|
+
/* @__PURE__ */ jsx("ul", { children: orders.data?.map((row) => /* @__PURE__ */ jsxs("li", { children: [
|
|
825
|
+
row.displayId,
|
|
826
|
+
" \u2014 ",
|
|
827
|
+
row.eventName,
|
|
828
|
+
" \u2014 ",
|
|
829
|
+
row.quantity,
|
|
830
|
+
" \u2014 ",
|
|
831
|
+
row.status
|
|
832
|
+
] }, row.id)) })
|
|
833
|
+
] });
|
|
834
|
+
}
|
|
835
|
+
function PackageOrders({
|
|
836
|
+
brandId,
|
|
837
|
+
title = "Package orders",
|
|
838
|
+
empty = "No package orders."
|
|
839
|
+
}) {
|
|
840
|
+
const orders = useMyPackageOrders({ brandId });
|
|
841
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title, children: [
|
|
842
|
+
/* @__PURE__ */ jsx(QueryState, { ...orders }),
|
|
843
|
+
orders.data?.length === 0 && /* @__PURE__ */ jsx("p", { children: empty }),
|
|
844
|
+
/* @__PURE__ */ jsx("ul", { children: orders.data?.map((row) => /* @__PURE__ */ jsxs("li", { children: [
|
|
845
|
+
row.displayId,
|
|
846
|
+
" \u2014 ",
|
|
847
|
+
row.packageName,
|
|
848
|
+
" \u2014 ",
|
|
849
|
+
formatCents(row.grandTotalCents),
|
|
850
|
+
" \u2014 ",
|
|
851
|
+
row.status
|
|
852
|
+
] }, row.id)) })
|
|
853
|
+
] });
|
|
854
|
+
}
|
|
855
|
+
function GameCards({
|
|
856
|
+
brandId,
|
|
857
|
+
unitNoun = "games",
|
|
858
|
+
title = "Game cards",
|
|
859
|
+
historyLabel = "History",
|
|
860
|
+
closeHistoryLabel = "Close history",
|
|
861
|
+
empty = "No game cards."
|
|
862
|
+
}) {
|
|
863
|
+
const cards = useMyGameCards({ brandId });
|
|
864
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title, children: [
|
|
865
|
+
/* @__PURE__ */ jsx(QueryState, { ...cards }),
|
|
866
|
+
cards.data?.length === 0 && /* @__PURE__ */ jsx("p", { children: empty }),
|
|
867
|
+
cards.data?.map((card) => /* @__PURE__ */ jsxs("article", { children: [
|
|
868
|
+
/* @__PURE__ */ jsx("h3", { children: card.cardName }),
|
|
869
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
870
|
+
card.remainingGames,
|
|
871
|
+
" ",
|
|
872
|
+
unitNoun
|
|
873
|
+
] }),
|
|
874
|
+
/* @__PURE__ */ jsx(
|
|
875
|
+
HistoryDrawer,
|
|
876
|
+
{
|
|
877
|
+
brandId,
|
|
878
|
+
id: card.id,
|
|
879
|
+
unitNoun,
|
|
880
|
+
label: historyLabel,
|
|
881
|
+
closeLabel: closeHistoryLabel
|
|
882
|
+
}
|
|
883
|
+
),
|
|
884
|
+
/* @__PURE__ */ jsx(
|
|
885
|
+
AddToWalletButtons,
|
|
886
|
+
{
|
|
887
|
+
brandId,
|
|
888
|
+
kind: "game_card",
|
|
889
|
+
id: card.id,
|
|
890
|
+
eligible: card.status === "active"
|
|
891
|
+
}
|
|
892
|
+
)
|
|
893
|
+
] }, card.id))
|
|
894
|
+
] });
|
|
895
|
+
}
|
|
896
|
+
function HistoryDrawer({
|
|
897
|
+
brandId,
|
|
898
|
+
id,
|
|
899
|
+
unitNoun,
|
|
900
|
+
label,
|
|
901
|
+
closeLabel
|
|
902
|
+
}) {
|
|
903
|
+
const [open, setOpen] = useState(false);
|
|
904
|
+
const dialogRef = useRef(null);
|
|
905
|
+
useEffect(() => {
|
|
906
|
+
if (!open) return;
|
|
907
|
+
const dialog = dialogRef.current;
|
|
908
|
+
dialog?.showModal();
|
|
909
|
+
return () => {
|
|
910
|
+
if (dialog?.open) dialog.close();
|
|
911
|
+
};
|
|
912
|
+
}, [open]);
|
|
913
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
914
|
+
/* @__PURE__ */ jsx(
|
|
915
|
+
"button",
|
|
916
|
+
{
|
|
917
|
+
style: styles().ghostBtn,
|
|
918
|
+
"aria-haspopup": "dialog",
|
|
919
|
+
"aria-expanded": open,
|
|
920
|
+
onClick: () => setOpen(true),
|
|
921
|
+
children: label
|
|
922
|
+
}
|
|
923
|
+
),
|
|
924
|
+
open && /* @__PURE__ */ jsxs(
|
|
925
|
+
"dialog",
|
|
926
|
+
{
|
|
927
|
+
ref: dialogRef,
|
|
928
|
+
"aria-label": label,
|
|
929
|
+
onCancel: () => setOpen(false),
|
|
930
|
+
style: {
|
|
931
|
+
...styles().panel,
|
|
932
|
+
position: "fixed",
|
|
933
|
+
marginRight: 0,
|
|
934
|
+
width: "min(420px, 90vw)",
|
|
935
|
+
maxHeight: "90vh",
|
|
936
|
+
overflow: "auto"
|
|
937
|
+
},
|
|
938
|
+
children: [
|
|
939
|
+
/* @__PURE__ */ jsx("button", { style: styles().ghostBtn, "aria-label": closeLabel, onClick: () => setOpen(false), children: "\xD7" }),
|
|
940
|
+
/* @__PURE__ */ jsx(GameCardHistory, { brandId, gameCardId: id, unitNoun })
|
|
941
|
+
]
|
|
942
|
+
}
|
|
943
|
+
)
|
|
944
|
+
] });
|
|
945
|
+
}
|
|
946
|
+
function ProfileForm({ brandId, labels, className }) {
|
|
947
|
+
const t = {
|
|
948
|
+
title: "Profile",
|
|
949
|
+
name: "Name",
|
|
950
|
+
mobile: "Mobile",
|
|
951
|
+
save: "Save profile",
|
|
952
|
+
saved: "Profile saved.",
|
|
953
|
+
reload: "Reload profile",
|
|
954
|
+
missingVersion: "Reload your account to load the current profile version.",
|
|
955
|
+
...labels
|
|
956
|
+
};
|
|
957
|
+
const account = useAccount();
|
|
958
|
+
const update = useUpdateMyProfile();
|
|
959
|
+
const action = useAccountAction();
|
|
960
|
+
const [fullName, setName] = useState(account.customer?.fullName ?? "");
|
|
961
|
+
const [mobile, setMobile] = useState(account.customer?.mobile ?? "");
|
|
962
|
+
const [version, setVersion] = useState(
|
|
963
|
+
typeof account.customer?.version === "number" ? account.customer.version : void 0
|
|
964
|
+
);
|
|
965
|
+
useEffect(() => {
|
|
966
|
+
if (typeof account.customer?.version === "number") setVersion(account.customer.version);
|
|
967
|
+
}, [account.customer?.version]);
|
|
968
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
969
|
+
/* @__PURE__ */ jsxs(
|
|
970
|
+
"form",
|
|
971
|
+
{
|
|
972
|
+
style: styles().stack,
|
|
973
|
+
onSubmit: (e) => {
|
|
974
|
+
e.preventDefault();
|
|
975
|
+
if (version === void 0) return;
|
|
976
|
+
void action.run(async () => {
|
|
977
|
+
const result = await update.run({
|
|
978
|
+
brandId,
|
|
979
|
+
expectedVersion: version,
|
|
980
|
+
fullName,
|
|
981
|
+
mobile: mobile || null
|
|
982
|
+
});
|
|
983
|
+
setVersion(result.version);
|
|
984
|
+
}, t.saved);
|
|
985
|
+
},
|
|
986
|
+
children: [
|
|
987
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
988
|
+
t.name,
|
|
989
|
+
/* @__PURE__ */ jsx(
|
|
990
|
+
"input",
|
|
991
|
+
{
|
|
992
|
+
style: styles().input,
|
|
993
|
+
required: true,
|
|
994
|
+
autoComplete: "name",
|
|
995
|
+
value: fullName,
|
|
996
|
+
onChange: (e) => setName(e.target.value)
|
|
997
|
+
}
|
|
998
|
+
)
|
|
999
|
+
] }),
|
|
1000
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
1001
|
+
t.mobile,
|
|
1002
|
+
/* @__PURE__ */ jsx(
|
|
1003
|
+
"input",
|
|
1004
|
+
{
|
|
1005
|
+
style: styles().input,
|
|
1006
|
+
type: "tel",
|
|
1007
|
+
autoComplete: "tel",
|
|
1008
|
+
value: mobile,
|
|
1009
|
+
onChange: (e) => setMobile(e.target.value)
|
|
1010
|
+
}
|
|
1011
|
+
)
|
|
1012
|
+
] }),
|
|
1013
|
+
/* @__PURE__ */ jsx("button", { style: styles().primaryBtn, disabled: action.busy || version === void 0, children: t.save }),
|
|
1014
|
+
version === void 0 && /* @__PURE__ */ jsx("p", { role: "alert", children: t.missingVersion })
|
|
1015
|
+
]
|
|
1016
|
+
}
|
|
1017
|
+
),
|
|
1018
|
+
/* @__PURE__ */ jsx(
|
|
1019
|
+
"button",
|
|
1020
|
+
{
|
|
1021
|
+
style: styles().ghostBtn,
|
|
1022
|
+
disabled: action.busy,
|
|
1023
|
+
onClick: () => void action.run(async () => {
|
|
1024
|
+
await account.refresh();
|
|
1025
|
+
}),
|
|
1026
|
+
children: t.reload
|
|
1027
|
+
}
|
|
1028
|
+
),
|
|
1029
|
+
action.feedback
|
|
1030
|
+
] });
|
|
1031
|
+
}
|
|
1032
|
+
function CommunicationPrefs({ brandId, labels, className }) {
|
|
1033
|
+
const t = {
|
|
1034
|
+
title: "Communications",
|
|
1035
|
+
email: "Email marketing",
|
|
1036
|
+
sms: "SMS marketing",
|
|
1037
|
+
transactional: "Booking confirmations and receipts are sent independently of marketing preferences.",
|
|
1038
|
+
consent: "I agree to receive marketing messages for this channel.",
|
|
1039
|
+
...labels
|
|
1040
|
+
};
|
|
1041
|
+
const prefs = useMyCommunicationPrefs({ brandId });
|
|
1042
|
+
const update = useSetMyCommunicationPref();
|
|
1043
|
+
const action = useAccountAction();
|
|
1044
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
1045
|
+
/* @__PURE__ */ jsx(QueryState, { ...prefs }),
|
|
1046
|
+
/* @__PURE__ */ jsx("p", { children: t.transactional }),
|
|
1047
|
+
prefs.data && ["email", "sms"].map((channel) => /* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
1048
|
+
/* @__PURE__ */ jsx(
|
|
1049
|
+
"input",
|
|
1050
|
+
{
|
|
1051
|
+
style: styles().input,
|
|
1052
|
+
type: "checkbox",
|
|
1053
|
+
checked: prefs.data?.[channel].status === "subscribed",
|
|
1054
|
+
disabled: action.busy,
|
|
1055
|
+
onChange: (e) => {
|
|
1056
|
+
const subscribed = e.target.checked;
|
|
1057
|
+
void action.run(async () => {
|
|
1058
|
+
await update.run({
|
|
1059
|
+
brandId,
|
|
1060
|
+
channel,
|
|
1061
|
+
status: subscribed ? "subscribed" : "unsubscribed",
|
|
1062
|
+
acceptedTerms: subscribed
|
|
1063
|
+
});
|
|
1064
|
+
await prefs.refetch();
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
),
|
|
1069
|
+
t[channel],
|
|
1070
|
+
" \u2014 ",
|
|
1071
|
+
t.consent
|
|
1072
|
+
] }, channel)),
|
|
1073
|
+
action.feedback
|
|
1074
|
+
] });
|
|
1075
|
+
}
|
|
1076
|
+
function SavedCards({
|
|
1077
|
+
brandId,
|
|
1078
|
+
centerId,
|
|
1079
|
+
labels,
|
|
1080
|
+
renderAddCard,
|
|
1081
|
+
className
|
|
1082
|
+
}) {
|
|
1083
|
+
const t = {
|
|
1084
|
+
title: "Payment methods",
|
|
1085
|
+
empty: "No saved cards.",
|
|
1086
|
+
remove: "Remove",
|
|
1087
|
+
makeDefault: "Make default",
|
|
1088
|
+
default: "Default",
|
|
1089
|
+
loading: "Loading\u2026",
|
|
1090
|
+
...labels
|
|
1091
|
+
};
|
|
1092
|
+
const scope = { brandId, centerId };
|
|
1093
|
+
const cards = useSavedCards(scope);
|
|
1094
|
+
const remove = useRemoveCard();
|
|
1095
|
+
const setDefault = useSetDefaultCard();
|
|
1096
|
+
const action = useAccountAction();
|
|
1097
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
1098
|
+
/* @__PURE__ */ jsx(QueryState, { ...cards, loadingLabel: t.loading }),
|
|
1099
|
+
cards.data?.methods.length === 0 && /* @__PURE__ */ jsx("p", { children: t.empty }),
|
|
1100
|
+
/* @__PURE__ */ jsx("ul", { children: cards.data?.methods.map((card) => /* @__PURE__ */ jsxs("li", { children: [
|
|
1101
|
+
card.brand,
|
|
1102
|
+
" \u2022\u2022\u2022\u2022 ",
|
|
1103
|
+
card.last4,
|
|
1104
|
+
" (",
|
|
1105
|
+
card.expMonth,
|
|
1106
|
+
"/",
|
|
1107
|
+
card.expYear,
|
|
1108
|
+
")",
|
|
1109
|
+
" ",
|
|
1110
|
+
card.isDefault && /* @__PURE__ */ jsx("span", { children: t.default }),
|
|
1111
|
+
/* @__PURE__ */ jsx(
|
|
1112
|
+
"button",
|
|
1113
|
+
{
|
|
1114
|
+
style: styles().ghostBtn,
|
|
1115
|
+
disabled: action.busy,
|
|
1116
|
+
"aria-label": `${t.remove} ${card.last4}`,
|
|
1117
|
+
onClick: () => void action.run(async () => {
|
|
1118
|
+
await remove.run({ ...scope, paymentMethodId: card.id });
|
|
1119
|
+
await cards.refetch();
|
|
1120
|
+
}),
|
|
1121
|
+
children: t.remove
|
|
1122
|
+
}
|
|
1123
|
+
),
|
|
1124
|
+
!card.isDefault && /* @__PURE__ */ jsx(
|
|
1125
|
+
"button",
|
|
1126
|
+
{
|
|
1127
|
+
style: styles().ghostBtn,
|
|
1128
|
+
disabled: action.busy,
|
|
1129
|
+
"aria-label": `${t.makeDefault} ${card.last4}`,
|
|
1130
|
+
onClick: () => void action.run(async () => {
|
|
1131
|
+
await setDefault.run({ ...scope, paymentMethodId: card.id });
|
|
1132
|
+
await cards.refetch();
|
|
1133
|
+
}),
|
|
1134
|
+
children: t.makeDefault
|
|
1135
|
+
}
|
|
1136
|
+
)
|
|
1137
|
+
] }, card.id)) }),
|
|
1138
|
+
action.feedback,
|
|
1139
|
+
renderAddCard?.(() => void cards.refetch())
|
|
1140
|
+
] });
|
|
1141
|
+
}
|
|
1142
|
+
function ChangePasswordForm({ labels, className }) {
|
|
1143
|
+
const t = {
|
|
1144
|
+
title: "Security",
|
|
1145
|
+
currentPassword: "Current password",
|
|
1146
|
+
newPassword: "New password",
|
|
1147
|
+
save: "Change password",
|
|
1148
|
+
forgot: "Forgot your current password?",
|
|
1149
|
+
code: "Email code",
|
|
1150
|
+
reset: "Reset password",
|
|
1151
|
+
sent: "Check your email for a reset code.",
|
|
1152
|
+
success: "Password changed. Sign in again.",
|
|
1153
|
+
...labels
|
|
1154
|
+
};
|
|
1155
|
+
const account = useAccount();
|
|
1156
|
+
const change = useChangePassword();
|
|
1157
|
+
const action = useAccountAction();
|
|
1158
|
+
const [currentPassword, setCurrent] = useState("");
|
|
1159
|
+
const [newPassword, setNew] = useState("");
|
|
1160
|
+
const [code, setCode] = useState("");
|
|
1161
|
+
const [recovery, setRecovery] = useState(false);
|
|
1162
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
1163
|
+
/* @__PURE__ */ jsxs(
|
|
1164
|
+
"form",
|
|
1165
|
+
{
|
|
1166
|
+
style: styles().stack,
|
|
1167
|
+
onSubmit: (e) => {
|
|
1168
|
+
e.preventDefault();
|
|
1169
|
+
void action.run(async () => {
|
|
1170
|
+
if (recovery)
|
|
1171
|
+
await account.resetPassword(account.customer?.email ?? "", code, newPassword);
|
|
1172
|
+
else await change.run({ currentPassword, newPassword });
|
|
1173
|
+
setCurrent("");
|
|
1174
|
+
setNew("");
|
|
1175
|
+
}, t.success);
|
|
1176
|
+
},
|
|
1177
|
+
children: [
|
|
1178
|
+
recovery ? /* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
1179
|
+
t.code,
|
|
1180
|
+
/* @__PURE__ */ jsx(
|
|
1181
|
+
"input",
|
|
1182
|
+
{
|
|
1183
|
+
style: styles().input,
|
|
1184
|
+
autoFocus: true,
|
|
1185
|
+
required: true,
|
|
1186
|
+
value: code,
|
|
1187
|
+
onChange: (e) => setCode(e.target.value),
|
|
1188
|
+
autoComplete: "one-time-code"
|
|
1189
|
+
}
|
|
1190
|
+
)
|
|
1191
|
+
] }) : /* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
1192
|
+
t.currentPassword,
|
|
1193
|
+
/* @__PURE__ */ jsx(
|
|
1194
|
+
"input",
|
|
1195
|
+
{
|
|
1196
|
+
style: styles().input,
|
|
1197
|
+
required: true,
|
|
1198
|
+
type: "password",
|
|
1199
|
+
autoComplete: "current-password",
|
|
1200
|
+
value: currentPassword,
|
|
1201
|
+
onChange: (e) => setCurrent(e.target.value)
|
|
1202
|
+
}
|
|
1203
|
+
)
|
|
1204
|
+
] }),
|
|
1205
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
1206
|
+
t.newPassword,
|
|
1207
|
+
/* @__PURE__ */ jsx(
|
|
1208
|
+
"input",
|
|
1209
|
+
{
|
|
1210
|
+
style: styles().input,
|
|
1211
|
+
required: true,
|
|
1212
|
+
type: "password",
|
|
1213
|
+
autoComplete: "new-password",
|
|
1214
|
+
value: newPassword,
|
|
1215
|
+
onChange: (e) => setNew(e.target.value)
|
|
1216
|
+
}
|
|
1217
|
+
)
|
|
1218
|
+
] }),
|
|
1219
|
+
/* @__PURE__ */ jsx("button", { style: styles().primaryBtn, disabled: action.busy, children: recovery ? t.reset : t.save })
|
|
1220
|
+
]
|
|
1221
|
+
}
|
|
1222
|
+
),
|
|
1223
|
+
/* @__PURE__ */ jsx(
|
|
1224
|
+
"a",
|
|
1225
|
+
{
|
|
1226
|
+
href: "#password-recovery",
|
|
1227
|
+
onClick: (e) => {
|
|
1228
|
+
e.preventDefault();
|
|
1229
|
+
void action.run(async () => {
|
|
1230
|
+
await account.requestPasswordReset(account.customer?.email ?? "");
|
|
1231
|
+
setRecovery(true);
|
|
1232
|
+
}, t.sent);
|
|
1233
|
+
},
|
|
1234
|
+
children: t.forgot
|
|
1235
|
+
}
|
|
1236
|
+
),
|
|
1237
|
+
action.feedback
|
|
1238
|
+
] });
|
|
1239
|
+
}
|
|
1240
|
+
function PrivacyCenter({
|
|
1241
|
+
brandId,
|
|
1242
|
+
supportHref = "/contact",
|
|
1243
|
+
labels,
|
|
1244
|
+
className
|
|
1245
|
+
}) {
|
|
1246
|
+
const t = {
|
|
1247
|
+
cancelRenewal: "Renewal will be cancelled",
|
|
1248
|
+
membershipEnds: "Membership will end",
|
|
1249
|
+
forfeits: "Remaining time forfeited",
|
|
1250
|
+
refund: "refund",
|
|
1251
|
+
credit: "credit",
|
|
1252
|
+
fee: "fee",
|
|
1253
|
+
title: "Privacy",
|
|
1254
|
+
export: "Export my data",
|
|
1255
|
+
download: "Download export",
|
|
1256
|
+
confirm: "Type {phrase} to delete your account",
|
|
1257
|
+
delete: "Delete my account",
|
|
1258
|
+
retry: "Retry",
|
|
1259
|
+
support: "Contact support",
|
|
1260
|
+
loading: "Loading consequences\u2026",
|
|
1261
|
+
deleted: "Account deleted.",
|
|
1262
|
+
pending: "Cancellation is still processing. Retry or contact support.",
|
|
1263
|
+
stale: "Consequences changed. Review them and type the phrase again.",
|
|
1264
|
+
...labels
|
|
1265
|
+
};
|
|
1266
|
+
const deletion = useAccountDeletion({ brandId });
|
|
1267
|
+
const exporter = useBowlosMutation("exportMyDataV2", {
|
|
1268
|
+
auth: true
|
|
1269
|
+
});
|
|
1270
|
+
const action = useAccountAction();
|
|
1271
|
+
const [typed, setTyped] = useState("");
|
|
1272
|
+
useEffect(() => {
|
|
1273
|
+
setTyped("");
|
|
1274
|
+
}, [deletion.preview?.previewToken]);
|
|
1275
|
+
const busy = deletion.status === "deleting" || deletion.status === "loading";
|
|
1276
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
1277
|
+
/* @__PURE__ */ jsx(
|
|
1278
|
+
"button",
|
|
1279
|
+
{
|
|
1280
|
+
style: styles().ghostBtn,
|
|
1281
|
+
disabled: action.busy,
|
|
1282
|
+
onClick: () => void action.run(() => exporter.run({ brandId })),
|
|
1283
|
+
children: t.export
|
|
1284
|
+
}
|
|
1285
|
+
),
|
|
1286
|
+
exporter.data && /* @__PURE__ */ jsx("a", { href: exporter.data.url, children: t.download }),
|
|
1287
|
+
action.feedback,
|
|
1288
|
+
/* @__PURE__ */ jsx("p", { role: "status", children: deletion.status === "loading" ? t.loading : deletion.status === "deleted" ? t.deleted : deletion.status === "pending" ? t.pending : deletion.status === "stale" ? t.stale : "" }),
|
|
1289
|
+
deletion.preview && deletion.status !== "deleted" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1290
|
+
/* @__PURE__ */ jsxs("ul", { children: [
|
|
1291
|
+
deletion.preview.memberships.map((m) => /* @__PURE__ */ jsxs("li", { children: [
|
|
1292
|
+
m.name,
|
|
1293
|
+
" \u2014 ",
|
|
1294
|
+
m.status,
|
|
1295
|
+
" \u2014 ",
|
|
1296
|
+
m.willCancelStripe ? t.cancelRenewal : t.membershipEnds,
|
|
1297
|
+
m.forfeitsRemainingTime && ` \u2014 ${t.forfeits}`
|
|
1298
|
+
] }, m.id)),
|
|
1299
|
+
deletion.preview.upcoming.map((item) => /* @__PURE__ */ jsxs("li", { children: [
|
|
1300
|
+
item.displayId,
|
|
1301
|
+
" \u2014 ",
|
|
1302
|
+
item.date,
|
|
1303
|
+
" \u2014 ",
|
|
1304
|
+
item.centerName,
|
|
1305
|
+
":",
|
|
1306
|
+
" ",
|
|
1307
|
+
formatCents(item.refundPreview.refundCents),
|
|
1308
|
+
" ",
|
|
1309
|
+
t.refund,
|
|
1310
|
+
",",
|
|
1311
|
+
" ",
|
|
1312
|
+
formatCents(item.refundPreview.creditCents),
|
|
1313
|
+
" ",
|
|
1314
|
+
t.credit,
|
|
1315
|
+
",",
|
|
1316
|
+
" ",
|
|
1317
|
+
formatCents(item.refundPreview.feeCents),
|
|
1318
|
+
" ",
|
|
1319
|
+
t.fee,
|
|
1320
|
+
" \u2014",
|
|
1321
|
+
" ",
|
|
1322
|
+
item.refundPreview.policyLabel
|
|
1323
|
+
] }, item.id)),
|
|
1324
|
+
deletion.preview.loses.map((item) => /* @__PURE__ */ jsx("li", { children: item }, item))
|
|
1325
|
+
] }),
|
|
1326
|
+
/* @__PURE__ */ jsxs(
|
|
1327
|
+
"form",
|
|
1328
|
+
{
|
|
1329
|
+
onSubmit: (e) => {
|
|
1330
|
+
e.preventDefault();
|
|
1331
|
+
void deletion.confirm(typed);
|
|
1332
|
+
},
|
|
1333
|
+
children: [
|
|
1334
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
1335
|
+
t.confirm.replace("{phrase}", deletion.confirmPhrase ?? ""),
|
|
1336
|
+
/* @__PURE__ */ jsx(
|
|
1337
|
+
"input",
|
|
1338
|
+
{
|
|
1339
|
+
style: styles().input,
|
|
1340
|
+
required: true,
|
|
1341
|
+
autoCorrect: "off",
|
|
1342
|
+
autoComplete: "off",
|
|
1343
|
+
spellCheck: false,
|
|
1344
|
+
autoCapitalize: "none",
|
|
1345
|
+
value: typed,
|
|
1346
|
+
onChange: (e) => setTyped(e.target.value)
|
|
1347
|
+
}
|
|
1348
|
+
)
|
|
1349
|
+
] }),
|
|
1350
|
+
/* @__PURE__ */ jsx("button", { style: styles().primaryBtn, disabled: busy || typed !== deletion.confirmPhrase, children: t.delete })
|
|
1351
|
+
]
|
|
1352
|
+
}
|
|
1353
|
+
)
|
|
1354
|
+
] }),
|
|
1355
|
+
deletion.error != null && /* @__PURE__ */ jsx("p", { role: "alert", children: deletion.error instanceof Error ? deletion.error.message : t.pending }),
|
|
1356
|
+
deletion.status !== "deleted" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1357
|
+
/* @__PURE__ */ jsx("button", { style: styles().ghostBtn, disabled: busy, onClick: () => void deletion.retry(), children: t.retry }),
|
|
1358
|
+
/* @__PURE__ */ jsx("a", { href: supportHref, children: t.support })
|
|
1359
|
+
] })
|
|
1360
|
+
] });
|
|
1361
|
+
}
|
|
740
1362
|
var DEFAULT_LABELS4 = {
|
|
741
1363
|
welcome: "Welcome, {name}",
|
|
742
1364
|
signOut: "Sign out",
|
|
@@ -759,11 +1381,28 @@ var DEFAULT_LABELS4 = {
|
|
|
759
1381
|
autoRenews: "Auto-renews",
|
|
760
1382
|
balanceDue: "Balance due"
|
|
761
1383
|
};
|
|
762
|
-
var ALL_SECTIONS = [
|
|
763
|
-
|
|
1384
|
+
var ALL_SECTIONS = [
|
|
1385
|
+
"reservations",
|
|
1386
|
+
"memberships",
|
|
1387
|
+
"loyalty",
|
|
1388
|
+
"credits",
|
|
1389
|
+
"passes"
|
|
1390
|
+
];
|
|
1391
|
+
function AccountDashboard({
|
|
1392
|
+
brandId,
|
|
1393
|
+
sections = ALL_SECTIONS,
|
|
1394
|
+
labels,
|
|
1395
|
+
className,
|
|
1396
|
+
centerId,
|
|
1397
|
+
unitNoun,
|
|
1398
|
+
supportHref
|
|
1399
|
+
}) {
|
|
764
1400
|
return /* @__PURE__ */ jsx(AuthGate, { labels, className, children: ({ customer, account }) => /* @__PURE__ */ jsx(
|
|
765
1401
|
Dashboard,
|
|
766
1402
|
{
|
|
1403
|
+
centerId,
|
|
1404
|
+
unitNoun,
|
|
1405
|
+
supportHref,
|
|
767
1406
|
brandId,
|
|
768
1407
|
sections,
|
|
769
1408
|
labels,
|
|
@@ -775,6 +1414,9 @@ function AccountDashboard({ brandId, sections = ALL_SECTIONS, labels, className
|
|
|
775
1414
|
}
|
|
776
1415
|
function Dashboard({
|
|
777
1416
|
brandId,
|
|
1417
|
+
centerId,
|
|
1418
|
+
unitNoun,
|
|
1419
|
+
supportHref,
|
|
778
1420
|
sections,
|
|
779
1421
|
labels,
|
|
780
1422
|
className,
|
|
@@ -870,6 +1512,68 @@ function Dashboard({
|
|
|
870
1512
|
/* @__PURE__ */ jsx("p", { style: s.listTitle, children: p.kind }),
|
|
871
1513
|
/* @__PURE__ */ jsx("span", { style: s.badge, children: p.state })
|
|
872
1514
|
] }, p.id)) }) }, section);
|
|
1515
|
+
case "eventOrders":
|
|
1516
|
+
return /* @__PURE__ */ jsx(EventOrders, { brandId, title: labels?.eventOrders }, section);
|
|
1517
|
+
case "packageOrders":
|
|
1518
|
+
return /* @__PURE__ */ jsx(PackageOrders, { brandId, title: labels?.packageOrders }, section);
|
|
1519
|
+
case "gameCards":
|
|
1520
|
+
return /* @__PURE__ */ jsx(
|
|
1521
|
+
GameCards,
|
|
1522
|
+
{
|
|
1523
|
+
brandId,
|
|
1524
|
+
unitNoun,
|
|
1525
|
+
title: labels?.gameCards,
|
|
1526
|
+
historyLabel: labels?.history,
|
|
1527
|
+
closeHistoryLabel: labels?.closeHistory
|
|
1528
|
+
},
|
|
1529
|
+
section
|
|
1530
|
+
);
|
|
1531
|
+
case "profile":
|
|
1532
|
+
return /* @__PURE__ */ jsx(
|
|
1533
|
+
ProfileForm,
|
|
1534
|
+
{
|
|
1535
|
+
labels: { title: labels?.profile ?? "Profile" },
|
|
1536
|
+
brandId
|
|
1537
|
+
},
|
|
1538
|
+
section
|
|
1539
|
+
);
|
|
1540
|
+
case "communications":
|
|
1541
|
+
return /* @__PURE__ */ jsx(
|
|
1542
|
+
CommunicationPrefs,
|
|
1543
|
+
{
|
|
1544
|
+
labels: { title: labels?.communications ?? "Communications" },
|
|
1545
|
+
brandId
|
|
1546
|
+
},
|
|
1547
|
+
section
|
|
1548
|
+
);
|
|
1549
|
+
case "paymentMethods":
|
|
1550
|
+
return centerId ? /* @__PURE__ */ jsx(
|
|
1551
|
+
SavedCards,
|
|
1552
|
+
{
|
|
1553
|
+
labels: { title: labels?.paymentMethods ?? "Payment methods" },
|
|
1554
|
+
brandId,
|
|
1555
|
+
centerId
|
|
1556
|
+
},
|
|
1557
|
+
section
|
|
1558
|
+
) : /* @__PURE__ */ jsx("p", { role: "alert", children: "Select a center to manage payment methods." }, section);
|
|
1559
|
+
case "security":
|
|
1560
|
+
return /* @__PURE__ */ jsx(
|
|
1561
|
+
ChangePasswordForm,
|
|
1562
|
+
{
|
|
1563
|
+
labels: { title: labels?.security ?? "Security" }
|
|
1564
|
+
},
|
|
1565
|
+
section
|
|
1566
|
+
);
|
|
1567
|
+
case "privacy":
|
|
1568
|
+
return /* @__PURE__ */ jsx(
|
|
1569
|
+
PrivacyCenter,
|
|
1570
|
+
{
|
|
1571
|
+
labels: { title: labels?.privacy ?? "Privacy" },
|
|
1572
|
+
brandId,
|
|
1573
|
+
supportHref
|
|
1574
|
+
},
|
|
1575
|
+
section
|
|
1576
|
+
);
|
|
873
1577
|
default:
|
|
874
1578
|
return null;
|
|
875
1579
|
}
|
|
@@ -1417,7 +2121,341 @@ function PricingTable({
|
|
|
1417
2121
|
}
|
|
1418
2122
|
);
|
|
1419
2123
|
}
|
|
2124
|
+
function EventList({ items, loading, error, labels, children, className }) {
|
|
2125
|
+
const text = {
|
|
2126
|
+
title: "Events",
|
|
2127
|
+
empty: "No upcoming events.",
|
|
2128
|
+
loading: "Loading events\u2026",
|
|
2129
|
+
error: "Unable to load events.",
|
|
2130
|
+
...labels
|
|
2131
|
+
};
|
|
2132
|
+
const sorted = [...items].sort(
|
|
2133
|
+
(a, b) => a.date.localeCompare(b.date) || (a.startMinuteOfDay ?? 0) - (b.startMinuteOfDay ?? 0) || a.title.localeCompare(b.title)
|
|
2134
|
+
);
|
|
2135
|
+
return /* @__PURE__ */ jsxs(
|
|
2136
|
+
"section",
|
|
2137
|
+
{
|
|
2138
|
+
className,
|
|
2139
|
+
"aria-label": text.title,
|
|
2140
|
+
"aria-busy": loading,
|
|
2141
|
+
style: { color: token("colorText"), fontFamily: token("fontFamily") },
|
|
2142
|
+
children: [
|
|
2143
|
+
/* @__PURE__ */ jsx("h1", { children: text.title }),
|
|
2144
|
+
loading && /* @__PURE__ */ jsx("p", { role: "status", children: text.loading }),
|
|
2145
|
+
error && /* @__PURE__ */ jsx("p", { role: "alert", style: { color: token("colorError") }, children: text.error }),
|
|
2146
|
+
!loading && !error && sorted.length === 0 && /* @__PURE__ */ jsx("p", { children: text.empty }),
|
|
2147
|
+
/* @__PURE__ */ jsx("ul", { children: sorted.map((item) => /* @__PURE__ */ jsx("li", { children: children ? children(item) : /* @__PURE__ */ jsxs(
|
|
2148
|
+
"a",
|
|
2149
|
+
{
|
|
2150
|
+
style: { color: token("colorPrimary") },
|
|
2151
|
+
href: `/events/${encodeURIComponent(item.slug)}`,
|
|
2152
|
+
children: [
|
|
2153
|
+
item.title,
|
|
2154
|
+
" \u2014 ",
|
|
2155
|
+
/* @__PURE__ */ jsx("time", { dateTime: item.date, children: item.date })
|
|
2156
|
+
]
|
|
2157
|
+
}
|
|
2158
|
+
) }, item.id)) })
|
|
2159
|
+
]
|
|
2160
|
+
}
|
|
2161
|
+
);
|
|
2162
|
+
}
|
|
2163
|
+
function MembershipDetail({
|
|
2164
|
+
brandId,
|
|
2165
|
+
membershipId,
|
|
2166
|
+
centerId,
|
|
2167
|
+
timeZone,
|
|
2168
|
+
returnUrl,
|
|
2169
|
+
labels,
|
|
2170
|
+
className
|
|
2171
|
+
}) {
|
|
2172
|
+
const t = {
|
|
2173
|
+
title: "Membership",
|
|
2174
|
+
members: "Members",
|
|
2175
|
+
email: "Member email",
|
|
2176
|
+
add: "Add member",
|
|
2177
|
+
cancel: "Cancel at period end",
|
|
2178
|
+
reason: "Cancellation reason",
|
|
2179
|
+
billing: "Manage billing",
|
|
2180
|
+
ends: "Access ends",
|
|
2181
|
+
cancelled: "Renewal cancelled.",
|
|
2182
|
+
...labels
|
|
2183
|
+
};
|
|
2184
|
+
const centers = useCenters({ brandId });
|
|
2185
|
+
const zone = timeZone ?? centers.data?.find((center) => center.id === centerId)?.timezone ?? (centers.data?.length === 1 ? centers.data[0]?.timezone : void 0);
|
|
2186
|
+
const scope = { brandId, membershipId };
|
|
2187
|
+
const detail = useMyMembershipDetail(scope);
|
|
2188
|
+
const members = useMyMembershipMembers(scope);
|
|
2189
|
+
const add = useAddMyMembershipMember();
|
|
2190
|
+
const cancel = useCancelMyMembership();
|
|
2191
|
+
const portal = useOpenMembershipBillingPortal();
|
|
2192
|
+
const action = useAccountAction();
|
|
2193
|
+
const [email, setEmail] = useState("");
|
|
2194
|
+
const [reason, setReason] = useState("");
|
|
2195
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
2196
|
+
/* @__PURE__ */ jsx(QueryState, { ...detail }),
|
|
2197
|
+
detail.data && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2198
|
+
/* @__PURE__ */ jsx("h3", { children: detail.data.template?.name }),
|
|
2199
|
+
/* @__PURE__ */ jsx("p", { children: detail.data.status }),
|
|
2200
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
2201
|
+
t.ends,
|
|
2202
|
+
":",
|
|
2203
|
+
" ",
|
|
2204
|
+
zone ? new Date(detail.data.currentPeriodEndsAt).toLocaleDateString(void 0, {
|
|
2205
|
+
timeZone: zone
|
|
2206
|
+
}) : "\u2026"
|
|
2207
|
+
] }),
|
|
2208
|
+
/* @__PURE__ */ jsxs(
|
|
2209
|
+
"form",
|
|
2210
|
+
{
|
|
2211
|
+
style: styles().stack,
|
|
2212
|
+
onSubmit: (e) => {
|
|
2213
|
+
e.preventDefault();
|
|
2214
|
+
void action.run(async () => {
|
|
2215
|
+
await cancel.run({ ...scope, expectedVersion: detail.data.version, reason });
|
|
2216
|
+
await detail.refetch();
|
|
2217
|
+
}, t.cancelled);
|
|
2218
|
+
},
|
|
2219
|
+
children: [
|
|
2220
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
2221
|
+
t.reason,
|
|
2222
|
+
/* @__PURE__ */ jsx(
|
|
2223
|
+
"input",
|
|
2224
|
+
{
|
|
2225
|
+
style: styles().input,
|
|
2226
|
+
required: true,
|
|
2227
|
+
value: reason,
|
|
2228
|
+
onChange: (e) => setReason(e.target.value)
|
|
2229
|
+
}
|
|
2230
|
+
)
|
|
2231
|
+
] }),
|
|
2232
|
+
/* @__PURE__ */ jsx(
|
|
2233
|
+
"button",
|
|
2234
|
+
{
|
|
2235
|
+
style: styles().ghostBtn,
|
|
2236
|
+
disabled: action.busy || detail.data.status === "cancel_at_period_end",
|
|
2237
|
+
children: t.cancel
|
|
2238
|
+
}
|
|
2239
|
+
)
|
|
2240
|
+
]
|
|
2241
|
+
}
|
|
2242
|
+
),
|
|
2243
|
+
/* @__PURE__ */ jsx(
|
|
2244
|
+
"button",
|
|
2245
|
+
{
|
|
2246
|
+
style: styles().primaryBtn,
|
|
2247
|
+
disabled: action.busy,
|
|
2248
|
+
onClick: () => void action.run(async () => {
|
|
2249
|
+
const result = await portal.run({ ...scope, centerId, returnUrl });
|
|
2250
|
+
window.location.assign(result.url);
|
|
2251
|
+
}),
|
|
2252
|
+
children: t.billing
|
|
2253
|
+
}
|
|
2254
|
+
)
|
|
2255
|
+
] }),
|
|
2256
|
+
/* @__PURE__ */ jsx("h3", { children: t.members }),
|
|
2257
|
+
/* @__PURE__ */ jsx(QueryState, { ...members }),
|
|
2258
|
+
/* @__PURE__ */ jsx("ul", { children: members.data?.members.map((member) => /* @__PURE__ */ jsx("li", { children: member.customerName }, member.customerId)) }),
|
|
2259
|
+
members.data?.canManage && /* @__PURE__ */ jsxs(
|
|
2260
|
+
"form",
|
|
2261
|
+
{
|
|
2262
|
+
onSubmit: (e) => {
|
|
2263
|
+
e.preventDefault();
|
|
2264
|
+
void action.run(async () => {
|
|
2265
|
+
await add.run({ ...scope, email });
|
|
2266
|
+
setEmail("");
|
|
2267
|
+
await members.refetch();
|
|
2268
|
+
});
|
|
2269
|
+
},
|
|
2270
|
+
children: [
|
|
2271
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
2272
|
+
t.email,
|
|
2273
|
+
/* @__PURE__ */ jsx(
|
|
2274
|
+
"input",
|
|
2275
|
+
{
|
|
2276
|
+
style: styles().input,
|
|
2277
|
+
type: "email",
|
|
2278
|
+
required: true,
|
|
2279
|
+
value: email,
|
|
2280
|
+
onChange: (e) => setEmail(e.target.value)
|
|
2281
|
+
}
|
|
2282
|
+
)
|
|
2283
|
+
] }),
|
|
2284
|
+
/* @__PURE__ */ jsx("button", { style: styles().ghostBtn, disabled: action.busy, children: t.add })
|
|
2285
|
+
]
|
|
2286
|
+
}
|
|
2287
|
+
),
|
|
2288
|
+
action.feedback
|
|
2289
|
+
] });
|
|
2290
|
+
}
|
|
2291
|
+
function BookingChange({
|
|
2292
|
+
brandId,
|
|
2293
|
+
centerId,
|
|
2294
|
+
reservationId,
|
|
2295
|
+
expectedVersion,
|
|
2296
|
+
initial,
|
|
2297
|
+
unitNoun = "Units",
|
|
2298
|
+
renderPayment,
|
|
2299
|
+
labels,
|
|
2300
|
+
className
|
|
2301
|
+
}) {
|
|
2302
|
+
const t = {
|
|
2303
|
+
title: "Change reservation",
|
|
2304
|
+
date: "Date",
|
|
2305
|
+
start: "Start time",
|
|
2306
|
+
end: "End time",
|
|
2307
|
+
persons: "Guests",
|
|
2308
|
+
preview: "Preview change",
|
|
2309
|
+
apply: "Confirm change",
|
|
2310
|
+
payment: "Continue to payment",
|
|
2311
|
+
reset: "Start again",
|
|
2312
|
+
reason: "Change unavailable",
|
|
2313
|
+
done: "Reservation updated.",
|
|
2314
|
+
slotTaken: "The requested time is no longer available. Any payment will be refunded. Reload the reservation before trying again.",
|
|
2315
|
+
expired: "This change expired. Reload your reservation before trying again.",
|
|
2316
|
+
cancelled: "This change was cancelled.",
|
|
2317
|
+
paymentRequired: "Payment is required to complete this change.",
|
|
2318
|
+
...labels
|
|
2319
|
+
};
|
|
2320
|
+
const change = useBookingChange({ brandId, centerId });
|
|
2321
|
+
const action = useAccountAction();
|
|
2322
|
+
const statusRef = useRef(null);
|
|
2323
|
+
useEffect(() => {
|
|
2324
|
+
if (change.status !== "idle") statusRef.current?.focus();
|
|
2325
|
+
}, [change.status]);
|
|
2326
|
+
const [date, setDate] = useState(initial.dateISO);
|
|
2327
|
+
const [start, setStart] = useState(initial.startMinuteOfDay);
|
|
2328
|
+
const [end, setEnd] = useState(initial.endMinuteOfDay);
|
|
2329
|
+
const [units, setUnits] = useState(initial.units);
|
|
2330
|
+
const [persons, setPersons] = useState(initial.persons);
|
|
2331
|
+
const args = {
|
|
2332
|
+
reservationId,
|
|
2333
|
+
newDateISO: date,
|
|
2334
|
+
newStartMinuteOfDay: start,
|
|
2335
|
+
newEndMinuteOfDay: end,
|
|
2336
|
+
newUnits: units,
|
|
2337
|
+
newPersons: persons
|
|
2338
|
+
};
|
|
2339
|
+
const editing = change.status === "idle" || change.status === "error";
|
|
2340
|
+
return /* @__PURE__ */ jsxs(AccountPanel, { title: t.title, className, children: [
|
|
2341
|
+
editing && /* @__PURE__ */ jsxs(
|
|
2342
|
+
"form",
|
|
2343
|
+
{
|
|
2344
|
+
style: styles().stack,
|
|
2345
|
+
onSubmit: (e) => {
|
|
2346
|
+
e.preventDefault();
|
|
2347
|
+
void action.run(() => change.loadPreview(args));
|
|
2348
|
+
},
|
|
2349
|
+
children: [
|
|
2350
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
2351
|
+
t.date,
|
|
2352
|
+
/* @__PURE__ */ jsx(
|
|
2353
|
+
"input",
|
|
2354
|
+
{
|
|
2355
|
+
style: styles().input,
|
|
2356
|
+
required: true,
|
|
2357
|
+
type: "date",
|
|
2358
|
+
value: date,
|
|
2359
|
+
onChange: (e) => setDate(e.target.value)
|
|
2360
|
+
}
|
|
2361
|
+
)
|
|
2362
|
+
] }),
|
|
2363
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
2364
|
+
t.start,
|
|
2365
|
+
/* @__PURE__ */ jsx(
|
|
2366
|
+
"input",
|
|
2367
|
+
{
|
|
2368
|
+
style: styles().input,
|
|
2369
|
+
required: true,
|
|
2370
|
+
type: "time",
|
|
2371
|
+
defaultValue: `${String(Math.floor(start / 60)).padStart(2, "0")}:${String(start % 60).padStart(2, "0")}`,
|
|
2372
|
+
onChange: (e) => setStart(timeToMinutes(e.target.value))
|
|
2373
|
+
}
|
|
2374
|
+
)
|
|
2375
|
+
] }),
|
|
2376
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
2377
|
+
t.end,
|
|
2378
|
+
/* @__PURE__ */ jsx(
|
|
2379
|
+
"input",
|
|
2380
|
+
{
|
|
2381
|
+
style: styles().input,
|
|
2382
|
+
required: true,
|
|
2383
|
+
type: "time",
|
|
2384
|
+
defaultValue: `${String(Math.floor(end / 60)).padStart(2, "0")}:${String(end % 60).padStart(2, "0")}`,
|
|
2385
|
+
onChange: (e) => setEnd(timeToMinutes(e.target.value))
|
|
2386
|
+
}
|
|
2387
|
+
)
|
|
2388
|
+
] }),
|
|
2389
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
2390
|
+
unitNoun,
|
|
2391
|
+
/* @__PURE__ */ jsx(
|
|
2392
|
+
"input",
|
|
2393
|
+
{
|
|
2394
|
+
style: styles().input,
|
|
2395
|
+
required: true,
|
|
2396
|
+
type: "number",
|
|
2397
|
+
min: 1,
|
|
2398
|
+
value: units,
|
|
2399
|
+
onChange: (e) => setUnits(Number(e.target.value))
|
|
2400
|
+
}
|
|
2401
|
+
)
|
|
2402
|
+
] }),
|
|
2403
|
+
/* @__PURE__ */ jsxs("label", { style: styles().label, children: [
|
|
2404
|
+
t.persons,
|
|
2405
|
+
/* @__PURE__ */ jsx(
|
|
2406
|
+
"input",
|
|
2407
|
+
{
|
|
2408
|
+
style: styles().input,
|
|
2409
|
+
required: true,
|
|
2410
|
+
type: "number",
|
|
2411
|
+
min: 1,
|
|
2412
|
+
value: persons,
|
|
2413
|
+
onChange: (e) => setPersons(Number(e.target.value))
|
|
2414
|
+
}
|
|
2415
|
+
)
|
|
2416
|
+
] }),
|
|
2417
|
+
/* @__PURE__ */ jsx("button", { style: styles().primaryBtn, disabled: action.busy, children: t.preview })
|
|
2418
|
+
]
|
|
2419
|
+
}
|
|
2420
|
+
),
|
|
2421
|
+
change.status === "preview" && change.preview && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2422
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
2423
|
+
formatCents(change.preview.oldFinalCents),
|
|
2424
|
+
" \u2192",
|
|
2425
|
+
" ",
|
|
2426
|
+
formatCents(change.preview.newFinalCents),
|
|
2427
|
+
" (",
|
|
2428
|
+
formatCents(change.preview.diffCents),
|
|
2429
|
+
")"
|
|
2430
|
+
] }),
|
|
2431
|
+
!change.preview.eligible && /* @__PURE__ */ jsx("p", { role: "alert", children: change.preview.reason ?? t.reason }),
|
|
2432
|
+
/* @__PURE__ */ jsx(
|
|
2433
|
+
"button",
|
|
2434
|
+
{
|
|
2435
|
+
style: styles().ghostBtn,
|
|
2436
|
+
disabled: !change.preview.eligible || action.busy,
|
|
2437
|
+
onClick: () => void action.run(() => change.apply({ ...args, expectedVersion })),
|
|
2438
|
+
children: t.apply
|
|
2439
|
+
}
|
|
2440
|
+
)
|
|
2441
|
+
] }),
|
|
2442
|
+
change.status === "pay" && !change.payment && /* @__PURE__ */ jsx(
|
|
2443
|
+
"button",
|
|
2444
|
+
{
|
|
2445
|
+
style: styles().ghostBtn,
|
|
2446
|
+
disabled: action.busy,
|
|
2447
|
+
onClick: () => void action.run(() => change.createPayment()),
|
|
2448
|
+
children: t.payment
|
|
2449
|
+
}
|
|
2450
|
+
),
|
|
2451
|
+
change.status === "pay" && change.payment && renderPayment?.(change.payment, change.paymentConfirmed),
|
|
2452
|
+
/* @__PURE__ */ jsx("p", { ref: statusRef, tabIndex: -1, role: "status", children: change.status === "done" ? t.done : change.status === "failed_slot_taken" ? t.slotTaken : change.status === "expired" ? t.expired : change.status === "cancelled" ? t.cancelled : change.status === "pay" ? t.paymentRequired : change.status }),
|
|
2453
|
+
change.error != null && /* @__PURE__ */ jsx("p", { role: "alert", children: change.error instanceof Error ? change.error.message : t.reason }),
|
|
2454
|
+
action.feedback,
|
|
2455
|
+
!["idle", "pay", "polling", "applying", "previewing"].includes(change.status) && /* @__PURE__ */ jsx("button", { style: styles().ghostBtn, disabled: action.busy, onClick: change.reset, children: t.reset })
|
|
2456
|
+
] });
|
|
2457
|
+
}
|
|
1420
2458
|
|
|
1421
|
-
export { AccountDashboard, AccountMenu, AuthForm, AuthGate, BookingCatalog, BookingFlow, FlashSale, FlashSaleIndex, InquiryForm, MaintenanceBanner, PricingTable };
|
|
2459
|
+
export { AccountDashboard, AccountMenu, AddToWalletButtons, AuthForm, AuthGate, BookingCatalog, BookingChange, BookingFlow, ChangePasswordForm, CommunicationPrefs, EventList, FlashSale, FlashSaleIndex, GameCardHistory, InquiryForm, MaintenanceBanner, MembershipDetail, PricingTable, PrivacyCenter, ProfileForm, SavedCards };
|
|
1422
2460
|
//# sourceMappingURL=components.js.map
|
|
1423
2461
|
//# sourceMappingURL=components.js.map
|