@bowlos/reservations 0.43.0 → 1.0.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 +14 -5
- package/CHANGELOG.md +22 -0
- package/HEADLESS.md +126 -41
- package/README.md +16 -0
- package/dist/{account-B4sZBmPI.d.cts → account-b8chVpED.d.cts} +27 -1
- package/dist/{account-B4sZBmPI.d.ts → account-b8chVpED.d.ts} +27 -1
- package/dist/{booking-change-DzYs9133.d.ts → booking-change-B-ADuVEz.d.cts} +77 -2
- package/dist/{booking-change-Dd4PVgd3.d.cts → booking-change-BrJ-XESC.d.ts} +77 -2
- package/dist/chunk-43WZ6TLQ.js +12 -0
- package/dist/chunk-43WZ6TLQ.js.map +1 -0
- package/dist/{chunk-4JMGS4YB.js → chunk-CTJODEHR.js} +27 -6
- package/dist/chunk-CTJODEHR.js.map +1 -0
- package/dist/{chunk-YAXBZJMI.js → chunk-EPYGIJRJ.js} +20 -3
- package/dist/chunk-EPYGIJRJ.js.map +1 -0
- package/dist/{chunk-YQRTBGXU.js → chunk-EXEKCMQ2.js} +57 -22
- package/dist/chunk-EXEKCMQ2.js.map +1 -0
- package/dist/{chunk-V4JRDYW4.js → chunk-IDRTMFJJ.js} +8 -3
- package/dist/chunk-IDRTMFJJ.js.map +1 -0
- package/dist/{chunk-T2E6AEC7.js → chunk-LFFANITL.js} +4 -11
- package/dist/chunk-LFFANITL.js.map +1 -0
- package/dist/components.cjs +357 -131
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +11 -5
- package/dist/components.d.ts +11 -5
- package/dist/components.js +200 -65
- package/dist/components.js.map +1 -1
- package/dist/index.cjs +34 -0
- 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 +5 -4
- package/dist/index.js.map +1 -1
- package/dist/payments.cjs.map +1 -1
- package/dist/payments.d.cts +1 -1
- package/dist/payments.d.ts +1 -1
- package/dist/payments.js +5 -4
- package/dist/payments.js.map +1 -1
- package/dist/{react-C6NWC80d.d.cts → react-cqGEohr0.d.cts} +4 -2
- package/dist/{react-DVdtpw5n.d.ts → react-s4J-e10i.d.ts} +4 -2
- package/dist/react.cjs +90 -19
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +11 -5
- package/dist/react.d.ts +11 -5
- package/dist/react.js +5 -5
- package/package.json +2 -1
- package/templates/center-site/README.md +1 -0
- package/templates/center-site/app/book/event-reservation-form.tsx +276 -0
- package/templates/center-site/app/book/page.tsx +107 -49
- package/templates/center-site/app/catalog/page.tsx +3 -1
- package/templates/center-site/app/events/[slug]/page.tsx +7 -10
- package/templates/center-site/package.json +1 -1
- package/dist/chunk-4JMGS4YB.js.map +0 -1
- package/dist/chunk-T2E6AEC7.js.map +0 -1
- package/dist/chunk-V4JRDYW4.js.map +0 -1
- package/dist/chunk-YAXBZJMI.js.map +0 -1
- package/dist/chunk-YQRTBGXU.js.map +0 -1
package/dist/components.cjs
CHANGED
|
@@ -59,10 +59,30 @@ var BOWLOS_ERROR_CODES = {
|
|
|
59
59
|
API_KEY_INVALID: "API_KEY_INVALID",
|
|
60
60
|
ORIGIN_NOT_ALLOWED: "ORIGIN_NOT_ALLOWED",
|
|
61
61
|
RATE_LIMITED: "RATE_LIMITED",
|
|
62
|
+
// Auth
|
|
63
|
+
PASSWORD_TOO_WEAK: "PASSWORD_TOO_WEAK",
|
|
64
|
+
CURRENT_PASSWORD_INCORRECT: "CURRENT_PASSWORD_INCORRECT",
|
|
65
|
+
CURRENT_PASSWORD_REQUIRED: "CURRENT_PASSWORD_REQUIRED",
|
|
62
66
|
INVALID_CREDENTIALS: "INVALID_CREDENTIALS",
|
|
67
|
+
SIGNUP_FAILED: "SIGNUP_FAILED",
|
|
68
|
+
// Shared backend codes
|
|
69
|
+
VALIDATION_FAILED: "VALIDATION_FAILED",
|
|
63
70
|
PERMISSION_DENIED: "PERMISSION_DENIED",
|
|
64
71
|
SCOPE_REVOKED: "SCOPE_REVOKED",
|
|
65
|
-
NOT_FOUND: "NOT_FOUND"
|
|
72
|
+
NOT_FOUND: "NOT_FOUND",
|
|
73
|
+
VERSION_CONFLICT: "VERSION_CONFLICT",
|
|
74
|
+
PRICING_SNAPSHOT_STALE: "PRICING_SNAPSHOT_STALE",
|
|
75
|
+
PAYMENTS_NOT_CONNECTED: "PAYMENTS_NOT_CONNECTED",
|
|
76
|
+
CONNECT_ACCOUNT_RESTRICTED: "CONNECT_ACCOUNT_RESTRICTED",
|
|
77
|
+
BILLING_PORTAL_UNAVAILABLE: "BILLING_PORTAL_UNAVAILABLE",
|
|
78
|
+
RETURN_URL_NOT_ALLOWED: "RETURN_URL_NOT_ALLOWED",
|
|
79
|
+
CONFLICT_RETRY: "CONFLICT_RETRY",
|
|
80
|
+
CHECKOUT_EXPIRED: "CHECKOUT_EXPIRED",
|
|
81
|
+
// Client-side
|
|
82
|
+
ROUTE_NOT_FOUND: "ROUTE_NOT_FOUND",
|
|
83
|
+
NETWORK_ERROR: "NETWORK_ERROR",
|
|
84
|
+
UNKNOWN: "ERROR"
|
|
85
|
+
};
|
|
66
86
|
var BowlosApiError = class _BowlosApiError extends Error {
|
|
67
87
|
/** Stable, machine-readable code. Branch on this, not on `message`. */
|
|
68
88
|
code;
|
|
@@ -119,29 +139,48 @@ function useBowlosQuery(name, args = {}, options = {}) {
|
|
|
119
139
|
const client = useBowlosClient();
|
|
120
140
|
const auth = options.auth ?? false;
|
|
121
141
|
const enabled = options.enabled ?? true;
|
|
122
|
-
const
|
|
123
|
-
const [
|
|
124
|
-
const
|
|
142
|
+
const keepPreviousData = options.keepPreviousData ?? true;
|
|
143
|
+
const [state, setState] = react.useState(null);
|
|
144
|
+
const request = react.useRef(0);
|
|
125
145
|
const argsKey = JSON.stringify(args);
|
|
146
|
+
const key = react.useMemo(
|
|
147
|
+
() => ({ client, name, argsKey, auth, enabled }),
|
|
148
|
+
[client, name, argsKey, auth, enabled]
|
|
149
|
+
);
|
|
126
150
|
const refetch = react.useCallback(async () => {
|
|
127
|
-
|
|
128
|
-
|
|
151
|
+
const id = ++request.current;
|
|
152
|
+
setState((previous) => ({
|
|
153
|
+
key,
|
|
154
|
+
data: keepPreviousData || previous?.key === key ? previous?.data ?? null : null,
|
|
155
|
+
error: null,
|
|
156
|
+
loading: true
|
|
157
|
+
}));
|
|
129
158
|
try {
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
159
|
+
const data = await key.client.call(
|
|
160
|
+
key.name,
|
|
161
|
+
JSON.parse(key.argsKey),
|
|
162
|
+
{ auth: key.auth }
|
|
163
|
+
);
|
|
164
|
+
if (request.current === id) setState({ key, data, error: null, loading: false });
|
|
134
165
|
} catch (e) {
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
setLoading(false);
|
|
166
|
+
if (request.current === id) {
|
|
167
|
+
setState({ key, data: null, error: e instanceof BowlosApiError ? e : null, loading: false });
|
|
168
|
+
}
|
|
139
169
|
}
|
|
140
|
-
}, [
|
|
170
|
+
}, [key, keepPreviousData]);
|
|
141
171
|
react.useEffect(() => {
|
|
142
172
|
if (enabled) void refetch();
|
|
173
|
+
return () => {
|
|
174
|
+
request.current++;
|
|
175
|
+
};
|
|
143
176
|
}, [enabled, refetch]);
|
|
144
|
-
|
|
177
|
+
const visible = keepPreviousData || state?.key === key ? state : null;
|
|
178
|
+
return {
|
|
179
|
+
data: visible?.data ?? null,
|
|
180
|
+
error: visible?.error ?? null,
|
|
181
|
+
loading: visible?.key === key ? visible.loading : enabled,
|
|
182
|
+
refetch
|
|
183
|
+
};
|
|
145
184
|
}
|
|
146
185
|
function useBowlosMutation(name, options = {}) {
|
|
147
186
|
const client = useBowlosClient();
|
|
@@ -261,13 +300,19 @@ function useAvailability(args, options) {
|
|
|
261
300
|
return useBowlosQuery("checkAvailability", args, options);
|
|
262
301
|
}
|
|
263
302
|
function useBookingPreview(args, options) {
|
|
264
|
-
return useBowlosQuery("bookingPreview", args,
|
|
303
|
+
return useBowlosQuery("bookingPreview", args, {
|
|
304
|
+
...options,
|
|
305
|
+
keepPreviousData: args.eventOfferSlug ? false : options?.keepPreviousData
|
|
306
|
+
});
|
|
265
307
|
}
|
|
266
308
|
function useAddons(args, options) {
|
|
267
309
|
return useBowlosQuery("listPublicAddons", args, options);
|
|
268
310
|
}
|
|
269
311
|
function useStartTimes(args, options) {
|
|
270
|
-
return useBowlosQuery("availableStartTimes", args,
|
|
312
|
+
return useBowlosQuery("availableStartTimes", args, {
|
|
313
|
+
...options,
|
|
314
|
+
keepPreviousData: args.eventOfferSlug ? false : options?.keepPreviousData
|
|
315
|
+
});
|
|
271
316
|
}
|
|
272
317
|
function useMyReservations(args, options) {
|
|
273
318
|
return useBowlosQuery("listMyReservations", args, { ...options, auth: true });
|
|
@@ -309,6 +354,9 @@ function useTestMode(args, options) {
|
|
|
309
354
|
loading: res.loading
|
|
310
355
|
};
|
|
311
356
|
}
|
|
357
|
+
function useEventOfferOptions(args, options) {
|
|
358
|
+
return useBowlosQuery("eventOfferOptions", args, { ...options, keepPreviousData: false });
|
|
359
|
+
}
|
|
312
360
|
function useRetailPricing(args, options) {
|
|
313
361
|
return useBowlosQuery("listRetailPricing", args, options);
|
|
314
362
|
}
|
|
@@ -377,6 +425,84 @@ function MaintenanceBanner({
|
|
|
377
425
|
}
|
|
378
426
|
);
|
|
379
427
|
}
|
|
428
|
+
function useUpdateMyProfile() {
|
|
429
|
+
return useBowlosMutation("updateMyProfile", {
|
|
430
|
+
auth: true
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
function useMyCommunicationPrefs(args, options) {
|
|
434
|
+
return useBowlosQuery("listMyMarketingPrefs", args, {
|
|
435
|
+
...options,
|
|
436
|
+
auth: true
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
function useSetMyCommunicationPref() {
|
|
440
|
+
return useBowlosMutation(
|
|
441
|
+
"setMyMarketingPref",
|
|
442
|
+
{ auth: true }
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
function useMyPackageOrders(args, options) {
|
|
446
|
+
return useBowlosQuery("listMyPackageOrders", args, {
|
|
447
|
+
...options,
|
|
448
|
+
auth: true
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
function useMyMembershipMembers(args, options) {
|
|
452
|
+
return useBowlosQuery("listMyMembershipMembers", args, {
|
|
453
|
+
...options,
|
|
454
|
+
auth: true
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
function useAddMyMembershipMember() {
|
|
458
|
+
return useBowlosMutation(
|
|
459
|
+
"addMyMembershipMember",
|
|
460
|
+
{ auth: true }
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
function useProduct(args, options) {
|
|
464
|
+
return useBowlosQuery("getPublicProduct", args, { ...options, auth: false });
|
|
465
|
+
}
|
|
466
|
+
function useSlotPrices(args, options) {
|
|
467
|
+
return useBowlosQuery("previewSlotPrices", args, {
|
|
468
|
+
...options,
|
|
469
|
+
auth: args.eventOfferSlug ? options?.auth : false,
|
|
470
|
+
keepPreviousData: args.eventOfferSlug ? false : options?.keepPreviousData
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
function useCenters(args, options) {
|
|
474
|
+
return useBowlosQuery("listPublicCenters", args, {
|
|
475
|
+
...options,
|
|
476
|
+
auth: false
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function useCancelMyMembership() {
|
|
480
|
+
return useIdempotentMutation(
|
|
481
|
+
"cancelMyMembership",
|
|
482
|
+
{ auth: true }
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// src/time-label.ts
|
|
487
|
+
function formatMinuteLabel(min) {
|
|
488
|
+
const h24 = Math.floor(min / 60) % 24;
|
|
489
|
+
const m = min % 60;
|
|
490
|
+
const period = h24 < 12 ? "AM" : "PM";
|
|
491
|
+
const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
|
|
492
|
+
return `${h12}:${m.toString().padStart(2, "0")} ${period}`;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
// src/event-offers.ts
|
|
496
|
+
function isFixedSession(session) {
|
|
497
|
+
return session.fixedDurationMinutes !== null;
|
|
498
|
+
}
|
|
499
|
+
function durationsForStart(options, startMinuteOfDay) {
|
|
500
|
+
return options.find((option) => option.startMinuteOfDay === startMinuteOfDay)?.durationMinutes ?? [];
|
|
501
|
+
}
|
|
502
|
+
function formatSessionRange(startMinuteOfDay, endMinuteOfDay) {
|
|
503
|
+
const nextDay = endMinuteOfDay >= 1440 ? " (next day)" : "";
|
|
504
|
+
return `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}${nextDay}`;
|
|
505
|
+
}
|
|
380
506
|
var DEFAULT_POLL_MS = 2500;
|
|
381
507
|
function useBookingFlow() {
|
|
382
508
|
const client = useBowlosClient();
|
|
@@ -417,6 +543,7 @@ function useBookingFlow() {
|
|
|
417
543
|
stopPolling();
|
|
418
544
|
break;
|
|
419
545
|
case "expired":
|
|
546
|
+
setError(new BowlosApiError(BOWLOS_ERROR_CODES.CHECKOUT_EXPIRED, "Your hold expired \u2014 please pick your time again", 409));
|
|
420
547
|
setStatus("expired");
|
|
421
548
|
stopPolling();
|
|
422
549
|
break;
|
|
@@ -475,12 +602,30 @@ function useBookingFlow() {
|
|
|
475
602
|
},
|
|
476
603
|
[client, stopPolling]
|
|
477
604
|
);
|
|
605
|
+
const checkBeforePayment = react.useCallback(async () => {
|
|
606
|
+
const rt = refTokenRef.current;
|
|
607
|
+
if (!rt) return false;
|
|
608
|
+
try {
|
|
609
|
+
const latest = await getCheckoutStatus(client, rt);
|
|
610
|
+
if (latest.status === "pending_payment" || latest.status === "payment_failed_retryable") return true;
|
|
611
|
+
applyStatus(latest);
|
|
612
|
+
if (latest.status === "expired" || latest.status === "abandoned") {
|
|
613
|
+
setError(new BowlosApiError(BOWLOS_ERROR_CODES.CHECKOUT_EXPIRED, "Your hold expired \u2014 please pick your time again", 409));
|
|
614
|
+
}
|
|
615
|
+
return false;
|
|
616
|
+
} catch (e) {
|
|
617
|
+
if (e instanceof BowlosApiError) setError(e);
|
|
618
|
+
setStatus("error");
|
|
619
|
+
return false;
|
|
620
|
+
}
|
|
621
|
+
}, [client, applyStatus]);
|
|
478
622
|
const preparePayment = react.useCallback(async () => {
|
|
479
623
|
const rt = refTokenRef.current;
|
|
480
624
|
if (!rt) return null;
|
|
481
625
|
setError(null);
|
|
482
626
|
setStatus("preparingPayment");
|
|
483
627
|
try {
|
|
628
|
+
if (!await checkBeforePayment()) return null;
|
|
484
629
|
const pi = await createCheckoutPaymentIntent(client, rt);
|
|
485
630
|
setPaymentIntent(pi);
|
|
486
631
|
setStatus("awaitingPayment");
|
|
@@ -490,7 +635,7 @@ function useBookingFlow() {
|
|
|
490
635
|
setStatus("error");
|
|
491
636
|
return null;
|
|
492
637
|
}
|
|
493
|
-
}, [client]);
|
|
638
|
+
}, [client, checkBeforePayment]);
|
|
494
639
|
const pollStatus = react.useCallback(async () => {
|
|
495
640
|
const rt = refTokenRef.current;
|
|
496
641
|
if (!rt) return null;
|
|
@@ -534,6 +679,7 @@ function useBookingFlow() {
|
|
|
534
679
|
error,
|
|
535
680
|
startHold,
|
|
536
681
|
preparePayment,
|
|
682
|
+
checkBeforePayment,
|
|
537
683
|
pollStatus,
|
|
538
684
|
startPolling,
|
|
539
685
|
stopPolling,
|
|
@@ -682,13 +828,6 @@ function timeToMinutes(t) {
|
|
|
682
828
|
const [h, m] = t.split(":").map(Number);
|
|
683
829
|
return (h ?? 0) * 60 + (m ?? 0);
|
|
684
830
|
}
|
|
685
|
-
function formatMinuteLabel(min) {
|
|
686
|
-
const h24 = Math.floor(min / 60) % 24;
|
|
687
|
-
const m = min % 60;
|
|
688
|
-
const period = h24 < 12 ? "AM" : "PM";
|
|
689
|
-
const h12 = h24 % 12 === 0 ? 12 : h24 % 12;
|
|
690
|
-
return `${h12}:${m.toString().padStart(2, "0")} ${period}`;
|
|
691
|
-
}
|
|
692
831
|
function useCountdown(targetMs) {
|
|
693
832
|
const [now, setNow] = react.useState(null);
|
|
694
833
|
react.useEffect(() => {
|
|
@@ -1026,11 +1165,22 @@ function formatDateLabel(dateISO) {
|
|
|
1026
1165
|
day: "numeric"
|
|
1027
1166
|
});
|
|
1028
1167
|
}
|
|
1029
|
-
function BookingFlow({
|
|
1168
|
+
function BookingFlow(props) {
|
|
1169
|
+
const offer = props.eventOffer;
|
|
1170
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1171
|
+
BookingFlowContent,
|
|
1172
|
+
{
|
|
1173
|
+
...props
|
|
1174
|
+
},
|
|
1175
|
+
offer ? JSON.stringify([offer.slug, props.centerId, props.productId, offer.session?.dateISO]) : "regular"
|
|
1176
|
+
);
|
|
1177
|
+
}
|
|
1178
|
+
function BookingFlowContent({
|
|
1030
1179
|
centerId,
|
|
1031
1180
|
productId,
|
|
1032
|
-
pricingMode = "per_unit_per_hour",
|
|
1033
|
-
durationMinutes = 60,
|
|
1181
|
+
pricingMode: defaultPricingMode = "per_unit_per_hour",
|
|
1182
|
+
durationMinutes: defaultDurationMinutes = 60,
|
|
1183
|
+
eventOffer,
|
|
1034
1184
|
defaultDateISO = "",
|
|
1035
1185
|
defaultStartMinuteOfDay = 18 * 60,
|
|
1036
1186
|
renderPayment,
|
|
@@ -1046,24 +1196,71 @@ function BookingFlow({
|
|
|
1046
1196
|
const signedIn = account.status === "linked" && account.customer !== null;
|
|
1047
1197
|
const acctName = account.customer?.fullName ?? "";
|
|
1048
1198
|
const acctEmail = account.customer?.email ?? "";
|
|
1049
|
-
const
|
|
1199
|
+
const session = eventOffer?.session;
|
|
1200
|
+
const eventOfferSlug = eventOffer?.slug.trim();
|
|
1201
|
+
const pricingMode = session?.pricingMode ?? defaultPricingMode;
|
|
1202
|
+
const [regularDate, setDateISO] = react.useState(defaultDateISO);
|
|
1203
|
+
const dateISO = eventOffer ? session?.dateISO ?? "" : regularDate;
|
|
1050
1204
|
react.useEffect(() => {
|
|
1051
|
-
if (!defaultDateISO && dateISO === "") setDateISO(todayISO());
|
|
1052
|
-
}, [defaultDateISO, dateISO]);
|
|
1053
|
-
const [
|
|
1054
|
-
const
|
|
1205
|
+
if (!eventOffer && !defaultDateISO && dateISO === "") setDateISO(todayISO());
|
|
1206
|
+
}, [eventOffer, defaultDateISO, dateISO]);
|
|
1207
|
+
const [pickedStart, setStartMinuteOfDay] = react.useState(defaultStartMinuteOfDay);
|
|
1208
|
+
const [pickedDuration, setDuration] = react.useState(0);
|
|
1055
1209
|
const [count, setCount] = react.useState(1);
|
|
1210
|
+
const [bowlers, setBowlers] = react.useState(1);
|
|
1211
|
+
const [games, setGames] = react.useState(1);
|
|
1212
|
+
const partyCap = session?.maxPartySizePerUnit == null ? void 0 : session.maxPartySizePerUnit * count;
|
|
1213
|
+
const persons = Math.min(bowlers, partyCap ?? Infinity);
|
|
1214
|
+
const eventArgs = {
|
|
1215
|
+
centerId,
|
|
1216
|
+
productId,
|
|
1217
|
+
dateISO,
|
|
1218
|
+
eventOfferSlug: eventOfferSlug ?? "",
|
|
1219
|
+
mode: pricingMode,
|
|
1220
|
+
units: count,
|
|
1221
|
+
persons,
|
|
1222
|
+
...pricingMode === "per_game" ? { games } : {}
|
|
1223
|
+
};
|
|
1224
|
+
const discovery = useEventOfferOptions(eventArgs, {
|
|
1225
|
+
enabled: Boolean(session && eventOfferSlug),
|
|
1226
|
+
auth: signedIn
|
|
1227
|
+
});
|
|
1228
|
+
const eventOptions = discovery.loading || discovery.error ? [] : discovery.data ?? [];
|
|
1229
|
+
const eventStart = eventOptions.some((option) => option.startMinuteOfDay === pickedStart) ? pickedStart : eventOptions[0]?.startMinuteOfDay;
|
|
1230
|
+
const startMinuteOfDay = eventOffer ? eventStart ?? 0 : pickedStart;
|
|
1231
|
+
const durations = durationsForStart(eventOptions, startMinuteOfDay);
|
|
1232
|
+
const durationMinutes = eventOffer ? durations.includes(pickedDuration) ? pickedDuration : durations[0] ?? 0 : defaultDurationMinutes;
|
|
1233
|
+
const endMinuteOfDay = startMinuteOfDay + durationMinutes;
|
|
1234
|
+
const eventSlotReady = Boolean(session && eventOfferSlug && eventStart !== void 0 && durationMinutes > 0);
|
|
1235
|
+
const fixed = session != null && isFixedSession(session);
|
|
1236
|
+
const slotPrices = useSlotPrices(
|
|
1237
|
+
{ ...eventArgs, duration: durationMinutes, slots: [startMinuteOfDay] },
|
|
1238
|
+
{ enabled: eventSlotReady, auth: signedIn }
|
|
1239
|
+
);
|
|
1240
|
+
const eventSlotUnavailable = slotPrices.data !== null && slotPrices.data[0]?.headlinePriceCents == null;
|
|
1056
1241
|
const [payMessage, setPayMessage] = react.useState(null);
|
|
1057
1242
|
const [reviewing, setReviewing] = react.useState(false);
|
|
1058
|
-
const [addonQtys, setAddonQtys] = react.useState(
|
|
1059
|
-
|
|
1060
|
-
() => Object.entries(addonQtys).filter(([, q]) => q > 0).map(([addonId, quantity]) => ({ addonId, quantity })),
|
|
1061
|
-
[addonQtys]
|
|
1243
|
+
const [addonQtys, setAddonQtys] = react.useState(
|
|
1244
|
+
() => Object.fromEntries((eventOffer?.includedAddons ?? []).map(({ addonId, quantity }) => [addonId, quantity]))
|
|
1062
1245
|
);
|
|
1063
|
-
const
|
|
1246
|
+
const addons = useAddons({ productId }, { enabled: !eventOffer || Boolean(session && eventOfferSlug) });
|
|
1247
|
+
const knownShoeId = session?.defaultShoeAddonId !== void 0 ? session.defaultShoeAddonId : eventOffer?.defaultShoeAddonId;
|
|
1248
|
+
const needsShoeId = Boolean(
|
|
1249
|
+
session?.shoesIncluded && knownShoeId === void 0 && addons.data?.length
|
|
1250
|
+
);
|
|
1251
|
+
const product = useProduct({ productId }, {
|
|
1252
|
+
enabled: needsShoeId,
|
|
1253
|
+
keepPreviousData: false
|
|
1254
|
+
});
|
|
1255
|
+
const shoeAddonId = knownShoeId !== void 0 ? knownShoeId : product.data?.defaultShoeAddonId;
|
|
1256
|
+
const addonList = (addons.data ?? []).filter(
|
|
1257
|
+
(addon) => !session?.shoesIncluded || shoeAddonId !== void 0 && addon.id !== shoeAddonId
|
|
1258
|
+
);
|
|
1259
|
+
const selectedAddons = Object.entries(addonQtys).filter(([id, quantity]) => quantity > 0 && (!eventOffer || addonList.some((addon) => addon.id === id))).map(([addonId, quantity]) => ({ addonId, quantity }));
|
|
1260
|
+
const countArgs = eventOffer ? { units: count, persons, ...pricingMode === "per_game" ? { games } : {} } : pricingMode === "per_person_per_hour" ? { persons: count } : pricingMode === "per_game" ? { games: count } : { units: count };
|
|
1064
1261
|
const availability = useAvailability(
|
|
1065
1262
|
{ productId, dateISO, startMinuteOfDay, endMinuteOfDay },
|
|
1066
|
-
{ enabled: dateISO !== "" }
|
|
1263
|
+
{ enabled: !eventOffer && dateISO !== "" }
|
|
1067
1264
|
);
|
|
1068
1265
|
const preview = useBookingPreview(
|
|
1069
1266
|
{
|
|
@@ -1074,14 +1271,14 @@ function BookingFlow({
|
|
|
1074
1271
|
endMinuteOfDay,
|
|
1075
1272
|
mode: pricingMode,
|
|
1076
1273
|
...countArgs,
|
|
1274
|
+
...eventOffer ? { eventOfferSlug } : {},
|
|
1077
1275
|
addons: selectedAddons
|
|
1078
1276
|
},
|
|
1079
|
-
{ enabled: dateISO !== "", auth: signedIn }
|
|
1277
|
+
{ enabled: eventOffer ? eventSlotReady : dateISO !== "", auth: signedIn }
|
|
1080
1278
|
);
|
|
1081
|
-
const addons = useAddons({ productId }, { enabled: true });
|
|
1082
1279
|
const startTimes = useStartTimes(
|
|
1083
1280
|
{ productId, dateISO, durationMinutes, mode: pricingMode },
|
|
1084
|
-
{ enabled: dateISO !== "" }
|
|
1281
|
+
{ enabled: !eventOffer && dateISO !== "" }
|
|
1085
1282
|
);
|
|
1086
1283
|
const flow = useBookingFlow();
|
|
1087
1284
|
const onConfirmedRef = react.useRef(onConfirmed);
|
|
@@ -1109,25 +1306,25 @@ function BookingFlow({
|
|
|
1109
1306
|
void prepareRef.current();
|
|
1110
1307
|
}
|
|
1111
1308
|
}, [completeSaleOnly, flow.status]);
|
|
1112
|
-
const bookingArgs =
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}),
|
|
1125
|
-
[centerId, productId, dateISO, startMinuteOfDay, endMinuteOfDay, pricingMode, count, selectedAddons, acctName, acctEmail]
|
|
1126
|
-
);
|
|
1309
|
+
const bookingArgs = {
|
|
1310
|
+
centerId,
|
|
1311
|
+
productId,
|
|
1312
|
+
dateISO,
|
|
1313
|
+
startMinuteOfDay,
|
|
1314
|
+
endMinuteOfDay,
|
|
1315
|
+
mode: pricingMode,
|
|
1316
|
+
...countArgs,
|
|
1317
|
+
...eventOffer ? { eventOfferSlug } : {},
|
|
1318
|
+
addons: selectedAddons,
|
|
1319
|
+
customer: { fullName: acctName, email: acctEmail, marketingOptIn: false }
|
|
1320
|
+
};
|
|
1127
1321
|
const availableUnits = availability.data ? availableUnitCount(availability.data) : null;
|
|
1128
1322
|
const quoteCents = preview.data?.totalCentsPerPlan?.[0]?.totalCents ?? null;
|
|
1129
|
-
const
|
|
1130
|
-
const
|
|
1323
|
+
const startOptions = eventOffer ? eventOptions.map((option) => option.startMinuteOfDay) : startTimes.data ?? [];
|
|
1324
|
+
const addonsSettled = (addons.data !== null || addons.error !== null) && (!needsShoeId || product.data !== null || product.error !== null);
|
|
1325
|
+
const eventReady = eventSlotReady && addonsSettled && slotPrices.data !== null && !eventSlotUnavailable && !slotPrices.loading && !slotPrices.error && !preview.loading && !preview.error;
|
|
1326
|
+
const eventReadError = discovery.error ?? slotPrices.error ?? preview.error;
|
|
1327
|
+
const eventUnavailable = !session || !eventOfferSlug || eventSlotUnavailable || eventReadError?.code === "NOT_FOUND";
|
|
1131
1328
|
const s = styles();
|
|
1132
1329
|
if (flow.status === "confirmed") {
|
|
1133
1330
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: s.card, children: [
|
|
@@ -1196,7 +1393,7 @@ function BookingFlow({
|
|
|
1196
1393
|
const fee = preview.data?.reservationFee;
|
|
1197
1394
|
const feeCents = typeof fee?.amountCents === "number" ? fee.amountCents : 0;
|
|
1198
1395
|
const feeLabel = typeof fee?.label === "string" && fee.label ? fee.label : t.reservationFeeLabel;
|
|
1199
|
-
const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", countNoun(preview.data?.unitNoun, count, COUNT_LABEL[pricingMode])).replace("{date}", formatDateLabel(dateISO)).replace("{time}", `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
|
|
1396
|
+
const reservationLine = t.reservationLineLabel.replace("{count}", String(count)).replace("{unit}", countNoun(preview.data?.unitNoun, count, eventOffer ? unitLabel.plural : COUNT_LABEL[pricingMode])).replace("{date}", formatDateLabel(dateISO)).replace("{time}", eventOffer ? formatSessionRange(startMinuteOfDay, endMinuteOfDay) : `${formatMinuteLabel(startMinuteOfDay)}\u2013${formatMinuteLabel(endMinuteOfDay)}`);
|
|
1200
1397
|
const chosenAddons = addonList.map((a) => ({ ...a, quantity: addonQtys[a.id] ?? 0 })).filter((a) => a.quantity > 0);
|
|
1201
1398
|
const fallbackAddonsCents = chosenAddons.reduce(
|
|
1202
1399
|
(sum, a) => sum + a.priceCents * a.quantity,
|
|
@@ -1219,7 +1416,7 @@ function BookingFlow({
|
|
|
1219
1416
|
] }),
|
|
1220
1417
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.muted, children: formatCents(a.lineSubtotalCents) })
|
|
1221
1418
|
] }, a.addonId)),
|
|
1222
|
-
plan.shoesIncluded ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.rowBetween, children: [
|
|
1419
|
+
session?.shoesIncluded || plan.shoesIncluded ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.rowBetween, children: [
|
|
1223
1420
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.muted, children: "Shoes included" }),
|
|
1224
1421
|
/* @__PURE__ */ jsxRuntime.jsx("span", { style: s.muted, children: "\u2014" })
|
|
1225
1422
|
] }) : null,
|
|
@@ -1266,7 +1463,7 @@ function BookingFlow({
|
|
|
1266
1463
|
{
|
|
1267
1464
|
type: "button",
|
|
1268
1465
|
style: s.primaryBtn,
|
|
1269
|
-
disabled: holding || preview.loading || quoteCents == null,
|
|
1466
|
+
disabled: holding || preview.loading || quoteCents == null || Boolean(eventOffer && !eventReady),
|
|
1270
1467
|
onClick: () => void flow.startHold(bookingArgs),
|
|
1271
1468
|
children: holding ? t.securing : t.continueToPayment
|
|
1272
1469
|
}
|
|
@@ -1281,6 +1478,7 @@ function BookingFlow({
|
|
|
1281
1478
|
] })
|
|
1282
1479
|
),
|
|
1283
1480
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", style: s.linkBtn, disabled: holding, onClick: () => setReviewing(false), children: t.editOrder }),
|
|
1481
|
+
eventOffer && eventReadError && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", style: s.error, children: eventUnavailable ? "This event session is unavailable." : eventReadError.message }),
|
|
1284
1482
|
flow.error && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: s.error, children: [
|
|
1285
1483
|
flow.error.code,
|
|
1286
1484
|
" \u2014 ",
|
|
@@ -1290,29 +1488,68 @@ function BookingFlow({
|
|
|
1290
1488
|
}
|
|
1291
1489
|
const onSubmit = (e) => {
|
|
1292
1490
|
e.preventDefault();
|
|
1293
|
-
setReviewing(true);
|
|
1491
|
+
if (!eventOffer || eventReady && quoteCents !== null) setReviewing(true);
|
|
1294
1492
|
};
|
|
1295
1493
|
return /* @__PURE__ */ jsxRuntime.jsxs("form", { className, style: s.card, onSubmit, children: [
|
|
1296
1494
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { style: s.heading, children: t.heading }),
|
|
1297
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1495
|
+
eventOffer ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1496
|
+
session && /* @__PURE__ */ jsxRuntime.jsxs("p", { style: s.body, children: [
|
|
1497
|
+
t.date,
|
|
1498
|
+
" \xB7 ",
|
|
1499
|
+
/* @__PURE__ */ jsxRuntime.jsx("time", { dateTime: dateISO, children: formatDateLabel(dateISO) })
|
|
1500
|
+
] }),
|
|
1501
|
+
eventUnavailable && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", style: s.meta, children: "This event session is unavailable." }),
|
|
1502
|
+
!eventUnavailable && eventReadError && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", style: s.error, children: eventReadError.message }),
|
|
1503
|
+
discovery.loading ? /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", style: s.meta, children: t.loadingTimes }) : startOptions.length === 0 ? !eventUnavailable && !eventReadError && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "status", style: s.meta, children: "No event sessions available for this party." }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1504
|
+
fixed && startOptions.length === 1 ? /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.body, children: formatSessionRange(startMinuteOfDay, endMinuteOfDay) }) : /* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
1505
|
+
t.start,
|
|
1506
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1507
|
+
"select",
|
|
1508
|
+
{
|
|
1509
|
+
value: startMinuteOfDay,
|
|
1510
|
+
style: s.input,
|
|
1511
|
+
onChange: (e) => setStartMinuteOfDay(Number(e.target.value)),
|
|
1512
|
+
children: startOptions.map((start) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: start, children: fixed ? formatSessionRange(start, start + durationMinutes) : formatMinuteLabel(start) }, start))
|
|
1513
|
+
}
|
|
1514
|
+
)
|
|
1515
|
+
] }),
|
|
1516
|
+
!fixed && /* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
1517
|
+
"Duration",
|
|
1518
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1519
|
+
"select",
|
|
1520
|
+
{
|
|
1521
|
+
value: durationMinutes,
|
|
1522
|
+
style: s.input,
|
|
1523
|
+
onChange: (e) => setDuration(Number(e.target.value)),
|
|
1524
|
+
children: durations.map((duration) => /* @__PURE__ */ jsxRuntime.jsxs("option", { value: duration, children: [
|
|
1525
|
+
duration,
|
|
1526
|
+
" minutes"
|
|
1527
|
+
] }, duration))
|
|
1528
|
+
}
|
|
1529
|
+
)
|
|
1530
|
+
] })
|
|
1531
|
+
] })
|
|
1532
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1533
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
1534
|
+
t.date,
|
|
1535
|
+
/* @__PURE__ */ jsxRuntime.jsx("input", { type: "date", value: dateISO, onChange: (e) => setDateISO(e.target.value), style: s.input, required: true })
|
|
1536
|
+
] }),
|
|
1537
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
1538
|
+
t.start,
|
|
1539
|
+
startTimes.loading ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.meta, children: t.loadingTimes }) : startOptions.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: s.meta, children: t.noTimes }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1540
|
+
"select",
|
|
1541
|
+
{
|
|
1542
|
+
value: startMinuteOfDay,
|
|
1543
|
+
onChange: (e) => setStartMinuteOfDay(Number(e.target.value)),
|
|
1544
|
+
style: s.input,
|
|
1545
|
+
children: startOptions.map((min) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: min, children: formatMinuteLabel(min) }, min))
|
|
1546
|
+
}
|
|
1547
|
+
)
|
|
1548
|
+
] })
|
|
1312
1549
|
] }),
|
|
1313
1550
|
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
1314
1551
|
titleCase(
|
|
1315
|
-
(availability.data?.unitNoun ?? preview.data?.unitNoun)?.plural ?? COUNT_LABEL[pricingMode]
|
|
1552
|
+
(availability.data?.unitNoun ?? preview.data?.unitNoun)?.plural ?? (eventOffer ? unitLabel.plural : COUNT_LABEL[pricingMode])
|
|
1316
1553
|
),
|
|
1317
1554
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1318
1555
|
"input",
|
|
@@ -1320,11 +1557,47 @@ function BookingFlow({
|
|
|
1320
1557
|
type: "number",
|
|
1321
1558
|
min: 1,
|
|
1322
1559
|
value: count,
|
|
1323
|
-
onChange: (e) =>
|
|
1560
|
+
onChange: (e) => {
|
|
1561
|
+
const next = Math.max(1, Number(e.target.value) || 1);
|
|
1562
|
+
setCount(eventOffer ? Math.floor(next) : next);
|
|
1563
|
+
const cap = session?.maxPartySizePerUnit;
|
|
1564
|
+
if (cap != null) setBowlers(Math.min(persons, Math.floor(next) * cap));
|
|
1565
|
+
},
|
|
1324
1566
|
style: s.input
|
|
1325
1567
|
}
|
|
1326
1568
|
)
|
|
1327
1569
|
] }),
|
|
1570
|
+
session && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1571
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
1572
|
+
"Bowlers",
|
|
1573
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1574
|
+
"input",
|
|
1575
|
+
{
|
|
1576
|
+
style: s.input,
|
|
1577
|
+
type: "number",
|
|
1578
|
+
min: 1,
|
|
1579
|
+
max: partyCap,
|
|
1580
|
+
value: persons,
|
|
1581
|
+
onChange: (e) => setBowlers(Math.min(partyCap ?? Infinity, Math.max(1, Math.floor(Number(e.target.value) || 1))))
|
|
1582
|
+
}
|
|
1583
|
+
)
|
|
1584
|
+
] }),
|
|
1585
|
+
pricingMode === "per_game" && /* @__PURE__ */ jsxRuntime.jsxs("label", { style: s.label, children: [
|
|
1586
|
+
"Games",
|
|
1587
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1588
|
+
"input",
|
|
1589
|
+
{
|
|
1590
|
+
style: s.input,
|
|
1591
|
+
type: "number",
|
|
1592
|
+
min: 1,
|
|
1593
|
+
value: games,
|
|
1594
|
+
onChange: (e) => setGames(Math.max(1, Math.floor(Number(e.target.value) || 1)))
|
|
1595
|
+
}
|
|
1596
|
+
)
|
|
1597
|
+
] }),
|
|
1598
|
+
session.shoesIncluded && /* @__PURE__ */ jsxRuntime.jsx("p", { style: s.meta, children: "Shoes included" }),
|
|
1599
|
+
(product.error || addons.error) && /* @__PURE__ */ jsxRuntime.jsx("p", { role: "alert", style: s.error, children: "Unable to load add-ons." })
|
|
1600
|
+
] }),
|
|
1328
1601
|
addonList.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.stack, children: [
|
|
1329
1602
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.sectionTitle, children: t.addonsHeading }),
|
|
1330
1603
|
addonList.map((addon) => /* @__PURE__ */ jsxRuntime.jsxs("div", { style: s.rowBetween, children: [
|
|
@@ -1363,16 +1636,16 @@ function BookingFlow({
|
|
|
1363
1636
|
/* @__PURE__ */ jsxRuntime.jsx("a", { href: accountHref, style: s.linkBtn, children: t.notYou })
|
|
1364
1637
|
] }) : null
|
|
1365
1638
|
] }) : t.signInAtCheckout }),
|
|
1366
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1639
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: s.meta, "aria-live": "polite", children: eventOffer ? eventReady && quoteCents !== null ? formatCents(quoteCents) : "" : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1367
1640
|
dateISO === "" || startOptions.length === 0 ? "" : availability.loading ? t.checkingAvailability : availableUnits !== null ? `${availableUnits} ${countNoun(availability.data?.unitNoun ?? unitLabel, availableUnits, unitLabel.plural)} available` : availability.error ? availability.error.code : "",
|
|
1368
1641
|
startOptions.length > 0 && quoteCents !== null ? ` \xB7 ${formatCents(quoteCents)}` : ""
|
|
1369
|
-
] }),
|
|
1642
|
+
] }) }),
|
|
1370
1643
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1371
1644
|
"button",
|
|
1372
1645
|
{
|
|
1373
1646
|
type: "submit",
|
|
1374
1647
|
style: s.primaryBtn,
|
|
1375
|
-
disabled: dateISO === "" || startOptions.length === 0 || quoteCents === null,
|
|
1648
|
+
disabled: dateISO === "" || startOptions.length === 0 || quoteCents === null || Boolean(eventOffer && !eventReady),
|
|
1376
1649
|
children: t.reviewOrder
|
|
1377
1650
|
}
|
|
1378
1651
|
),
|
|
@@ -1412,53 +1685,6 @@ function AccountMenu({ accountHref = "/account", labels, className }) {
|
|
|
1412
1685
|
}
|
|
1413
1686
|
return /* @__PURE__ */ jsxRuntime.jsx("a", { className, href: accountHref, style: { ...wrap, ...s.linkBtn }, children: t.signIn });
|
|
1414
1687
|
}
|
|
1415
|
-
function useUpdateMyProfile() {
|
|
1416
|
-
return useBowlosMutation("updateMyProfile", {
|
|
1417
|
-
auth: true
|
|
1418
|
-
});
|
|
1419
|
-
}
|
|
1420
|
-
function useMyCommunicationPrefs(args, options) {
|
|
1421
|
-
return useBowlosQuery("listMyMarketingPrefs", args, {
|
|
1422
|
-
...options,
|
|
1423
|
-
auth: true
|
|
1424
|
-
});
|
|
1425
|
-
}
|
|
1426
|
-
function useSetMyCommunicationPref() {
|
|
1427
|
-
return useBowlosMutation(
|
|
1428
|
-
"setMyMarketingPref",
|
|
1429
|
-
{ auth: true }
|
|
1430
|
-
);
|
|
1431
|
-
}
|
|
1432
|
-
function useMyPackageOrders(args, options) {
|
|
1433
|
-
return useBowlosQuery("listMyPackageOrders", args, {
|
|
1434
|
-
...options,
|
|
1435
|
-
auth: true
|
|
1436
|
-
});
|
|
1437
|
-
}
|
|
1438
|
-
function useMyMembershipMembers(args, options) {
|
|
1439
|
-
return useBowlosQuery("listMyMembershipMembers", args, {
|
|
1440
|
-
...options,
|
|
1441
|
-
auth: true
|
|
1442
|
-
});
|
|
1443
|
-
}
|
|
1444
|
-
function useAddMyMembershipMember() {
|
|
1445
|
-
return useBowlosMutation(
|
|
1446
|
-
"addMyMembershipMember",
|
|
1447
|
-
{ auth: true }
|
|
1448
|
-
);
|
|
1449
|
-
}
|
|
1450
|
-
function useCenters(args, options) {
|
|
1451
|
-
return useBowlosQuery("listPublicCenters", args, {
|
|
1452
|
-
...options,
|
|
1453
|
-
auth: false
|
|
1454
|
-
});
|
|
1455
|
-
}
|
|
1456
|
-
function useCancelMyMembership() {
|
|
1457
|
-
return useIdempotentMutation(
|
|
1458
|
-
"cancelMyMembership",
|
|
1459
|
-
{ auth: true }
|
|
1460
|
-
);
|
|
1461
|
-
}
|
|
1462
1688
|
function useAccountAction() {
|
|
1463
1689
|
const [busy, setBusy] = react.useState(false);
|
|
1464
1690
|
const [message, setMessage] = react.useState("");
|