@bigz-app/booking-widget 1.3.3 → 1.4.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/dist/booking-widget.js +358 -340
- package/dist/booking-widget.js.map +1 -1
- package/dist/components/UniversalBookingWidget.d.ts.map +1 -1
- package/dist/components/booking/BookingForm.d.ts +14 -5
- package/dist/components/booking/BookingForm.d.ts.map +1 -1
- package/dist/components/booking/index.d.ts +1 -1
- package/dist/components/booking/index.d.ts.map +1 -1
- package/dist/components/upsells/UpsellCard.d.ts.map +1 -1
- package/dist/components/upsells/UpsellsStep.d.ts +2 -0
- package/dist/components/upsells/UpsellsStep.d.ts.map +1 -1
- package/dist/i18n/locales/de.d.ts.map +1 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/es.d.ts.map +1 -1
- package/dist/i18n/locales/pt.d.ts.map +1 -1
- package/dist/i18n/locales/sv.d.ts.map +1 -1
- package/dist/index.cjs +358 -340
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +358 -340
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/booking-widget.js
CHANGED
|
@@ -283,6 +283,8 @@
|
|
|
283
283
|
"button.depositAndBook": "Anzahlen & buchen",
|
|
284
284
|
"button.continueWithout": "Weiter ohne Extras",
|
|
285
285
|
"button.continue": "Weiter",
|
|
286
|
+
"button.continueToPayment": "Weiter zur Zahlung",
|
|
287
|
+
"button.backToDetails": "Zurück zu den Angaben",
|
|
286
288
|
"button.addExtras": "Extras hinzufügen",
|
|
287
289
|
// Event types
|
|
288
290
|
"events.noEventsAvailable": "Keine Veranstaltungen verfügbar",
|
|
@@ -475,6 +477,8 @@
|
|
|
475
477
|
"upsells.noExtras": "Keine Extras für diese Buchung verfügbar.",
|
|
476
478
|
"upsells.selected": "{{count}} Extra ausgewählt",
|
|
477
479
|
"upsells.selectedPlural": "{{count}} Extras ausgewählt",
|
|
480
|
+
"upsells.savePercent": "{{percent}}% sparen",
|
|
481
|
+
"booking.paymentUnavailable": "Online-Zahlung ist für diese Buchung nicht verfügbar. Bitte kontaktiere uns, um die Reservierung abzuschließen.",
|
|
478
482
|
"upsells.spotsFree": "{{count}} Plätze frei",
|
|
479
483
|
"upsells.notAvailable": "Nicht verfügbar",
|
|
480
484
|
"upsells.reason.outOfStock": "{{productName}} ist nicht auf Lager",
|
|
@@ -559,6 +563,8 @@
|
|
|
559
563
|
"button.depositAndBook": "Pay deposit & book",
|
|
560
564
|
"button.continueWithout": "Continue without extras",
|
|
561
565
|
"button.continue": "Continue",
|
|
566
|
+
"button.continueToPayment": "Continue to payment",
|
|
567
|
+
"button.backToDetails": "Back to details",
|
|
562
568
|
"button.addExtras": "Add extras",
|
|
563
569
|
// Event types
|
|
564
570
|
"events.noEventsAvailable": "No events available",
|
|
@@ -751,6 +757,8 @@
|
|
|
751
757
|
"upsells.noExtras": "No extras available for this booking.",
|
|
752
758
|
"upsells.selected": "{{count}} extra selected",
|
|
753
759
|
"upsells.selectedPlural": "{{count}} extras selected",
|
|
760
|
+
"upsells.savePercent": "Save {{percent}}%",
|
|
761
|
+
"booking.paymentUnavailable": "Online payment is not available for this booking. Please contact us to complete your reservation.",
|
|
754
762
|
"upsells.spotsFree": "{{count}} spots available",
|
|
755
763
|
"upsells.notAvailable": "Not available",
|
|
756
764
|
"upsells.reason.outOfStock": "{{productName}} is out of stock",
|
|
@@ -835,6 +843,8 @@
|
|
|
835
843
|
"button.depositAndBook": "Pagar depósito y reservar",
|
|
836
844
|
"button.continueWithout": "Continuar sin extras",
|
|
837
845
|
"button.continue": "Continuar",
|
|
846
|
+
"button.continueToPayment": "Continuar al pago",
|
|
847
|
+
"button.backToDetails": "Volver a los datos",
|
|
838
848
|
"button.addExtras": "Añadir extras",
|
|
839
849
|
// Event types
|
|
840
850
|
"events.noEventsAvailable": "No hay eventos disponibles",
|
|
@@ -1027,6 +1037,8 @@
|
|
|
1027
1037
|
"upsells.noExtras": "No hay extras disponibles para esta reserva.",
|
|
1028
1038
|
"upsells.selected": "{{count}} extra seleccionado",
|
|
1029
1039
|
"upsells.selectedPlural": "{{count}} extras seleccionados",
|
|
1040
|
+
"upsells.savePercent": "Ahorra {{percent}}%",
|
|
1041
|
+
"booking.paymentUnavailable": "El pago en línea no está disponible para esta reserva. Contáctanos para completarla.",
|
|
1030
1042
|
"upsells.spotsFree": "{{count}} plazas disponibles",
|
|
1031
1043
|
"upsells.notAvailable": "No disponible",
|
|
1032
1044
|
"upsells.reason.outOfStock": "{{productName}} está agotado",
|
|
@@ -1111,6 +1123,8 @@
|
|
|
1111
1123
|
"button.depositAndBook": "Pagar sinal e reservar",
|
|
1112
1124
|
"button.continueWithout": "Continuar sem extras",
|
|
1113
1125
|
"button.continue": "Continuar",
|
|
1126
|
+
"button.continueToPayment": "Continuar para pagamento",
|
|
1127
|
+
"button.backToDetails": "Voltar aos dados",
|
|
1114
1128
|
"button.addExtras": "Adicionar extras",
|
|
1115
1129
|
// Event types
|
|
1116
1130
|
"events.noEventsAvailable": "Sem eventos disponíveis",
|
|
@@ -1303,6 +1317,8 @@
|
|
|
1303
1317
|
"upsells.noExtras": "Sem extras disponíveis para esta reserva.",
|
|
1304
1318
|
"upsells.selected": "{{count}} extra selecionado",
|
|
1305
1319
|
"upsells.selectedPlural": "{{count}} extras selecionados",
|
|
1320
|
+
"upsells.savePercent": "Poupa {{percent}}%",
|
|
1321
|
+
"booking.paymentUnavailable": "O pagamento online não está disponível para esta reserva. Contacta-nos para concluir a reserva.",
|
|
1306
1322
|
"upsells.spotsFree": "{{count}} lugares disponíveis",
|
|
1307
1323
|
"upsells.notAvailable": "Não disponível",
|
|
1308
1324
|
"upsells.reason.outOfStock": "{{productName}} está esgotado",
|
|
@@ -1387,6 +1403,8 @@
|
|
|
1387
1403
|
"button.depositAndBook": "Betala handpenning & boka",
|
|
1388
1404
|
"button.continueWithout": "Fortsätt utan tillägg",
|
|
1389
1405
|
"button.continue": "Fortsätt",
|
|
1406
|
+
"button.continueToPayment": "Fortsätt till betalning",
|
|
1407
|
+
"button.backToDetails": "Tillbaka till uppgifter",
|
|
1390
1408
|
"button.addExtras": "Lägg till tillägg",
|
|
1391
1409
|
// Event types
|
|
1392
1410
|
"events.noEventsAvailable": "Inga evenemang tillgängliga",
|
|
@@ -1579,6 +1597,8 @@
|
|
|
1579
1597
|
"upsells.noExtras": "Inga tillägg tillgängliga för denna bokning.",
|
|
1580
1598
|
"upsells.selected": "{{count}} tillägg valt",
|
|
1581
1599
|
"upsells.selectedPlural": "{{count}} tillägg valda",
|
|
1600
|
+
"upsells.savePercent": "Spara {{percent}}%",
|
|
1601
|
+
"booking.paymentUnavailable": "Onlinebetalning är inte tillgänglig för denna bokning. Kontakta oss för att slutföra bokningen.",
|
|
1582
1602
|
"upsells.spotsFree": "{{count}} platser lediga",
|
|
1583
1603
|
"upsells.notAvailable": "Inte tillgängligt",
|
|
1584
1604
|
"upsells.reason.outOfStock": "{{productName}} är slut i lager",
|
|
@@ -11579,7 +11599,7 @@
|
|
|
11579
11599
|
const labelStyles$1 = formStyles.label;
|
|
11580
11600
|
const inputStyles$1 = formStyles.input;
|
|
11581
11601
|
const errorTextStyles$1 = formStyles.error;
|
|
11582
|
-
function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
|
|
11602
|
+
function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError, isOpen, onClose, systemConfig, selectedUpsells = [], upsells = [], persistedState = null, onPersistedStateChange, }) {
|
|
11583
11603
|
const t$1 = useTranslations();
|
|
11584
11604
|
const { locale } = useLocale();
|
|
11585
11605
|
const timezone = useTimezone();
|
|
@@ -11591,15 +11611,16 @@
|
|
|
11591
11611
|
const raw = Math.round((baseAmount * basisPoints) / 10000);
|
|
11592
11612
|
return round ? roundDiscountUp(raw) : raw;
|
|
11593
11613
|
};
|
|
11594
|
-
const [appliedVouchers, setAppliedVouchers] = d$1([]);
|
|
11595
|
-
const
|
|
11614
|
+
const [appliedVouchers, setAppliedVouchers] = d$1(() => persistedState?.appliedVouchers ?? []);
|
|
11615
|
+
const [checkoutStep, setCheckoutStep] = d$1(() => persistedState?.checkoutStep ?? "details");
|
|
11596
11616
|
// Payment option: "deposit" or "full" - only relevant when deposit is available
|
|
11597
|
-
const [paymentOption, setPaymentOption] = d$1("deposit");
|
|
11617
|
+
const [paymentOption, setPaymentOption] = d$1(() => persistedState?.paymentOption ?? "deposit");
|
|
11598
11618
|
// Per-participant upsell selections: participantIndex -> array of upsell package IDs
|
|
11599
|
-
const [participantUpsells, setParticipantUpsells] = d$1({});
|
|
11619
|
+
const [participantUpsells, setParticipantUpsells] = d$1(() => persistedState?.participantUpsells ?? {});
|
|
11620
|
+
const wasOpenRef = A$2(false);
|
|
11600
11621
|
const form = useForm({
|
|
11601
11622
|
resolver: t(createBookingFormSchema(t$1, participantFieldsConfig)),
|
|
11602
|
-
defaultValues: {
|
|
11623
|
+
defaultValues: persistedState?.formData ?? {
|
|
11603
11624
|
customerName: "",
|
|
11604
11625
|
customerEmail: "",
|
|
11605
11626
|
customerPhone: "",
|
|
@@ -11609,6 +11630,28 @@
|
|
|
11609
11630
|
acceptTerms: false,
|
|
11610
11631
|
},
|
|
11611
11632
|
});
|
|
11633
|
+
const persistState = q$2(() => {
|
|
11634
|
+
onPersistedStateChange?.({
|
|
11635
|
+
formData: form.getValues(),
|
|
11636
|
+
checkoutStep,
|
|
11637
|
+
paymentOption,
|
|
11638
|
+
appliedVouchers,
|
|
11639
|
+
participantUpsells,
|
|
11640
|
+
});
|
|
11641
|
+
}, [onPersistedStateChange, form, checkoutStep, paymentOption, appliedVouchers, participantUpsells]);
|
|
11642
|
+
y$1(() => {
|
|
11643
|
+
if (isOpen && !wasOpenRef.current && persistedState) {
|
|
11644
|
+
form.reset(persistedState.formData);
|
|
11645
|
+
setCheckoutStep(persistedState.checkoutStep);
|
|
11646
|
+
setPaymentOption(persistedState.paymentOption);
|
|
11647
|
+
setAppliedVouchers(persistedState.appliedVouchers);
|
|
11648
|
+
setParticipantUpsells(persistedState.participantUpsells);
|
|
11649
|
+
}
|
|
11650
|
+
if (!isOpen && wasOpenRef.current) {
|
|
11651
|
+
persistState();
|
|
11652
|
+
}
|
|
11653
|
+
wasOpenRef.current = isOpen;
|
|
11654
|
+
}, [isOpen, persistedState, form, persistState]);
|
|
11612
11655
|
const watchedParticipants = form.watch("participants");
|
|
11613
11656
|
const participantCount = watchedParticipants.length;
|
|
11614
11657
|
const watchedCustomerName = form.watch("customerName");
|
|
@@ -11733,6 +11776,18 @@
|
|
|
11733
11776
|
}), [watchedCustomerName, watchedCustomerEmail, watchedCustomerPhone, watchedParticipants, watchedComment]);
|
|
11734
11777
|
const appliedDiscountCode = appliedVouchers.find((v) => v.type === "discount");
|
|
11735
11778
|
const appliedGiftCards = appliedVouchers.filter((v) => v.type === "giftCard");
|
|
11779
|
+
const discountCodeProp = appliedDiscountCode
|
|
11780
|
+
? {
|
|
11781
|
+
id: appliedDiscountCode.id,
|
|
11782
|
+
code: appliedDiscountCode.code,
|
|
11783
|
+
description: appliedDiscountCode.description || undefined,
|
|
11784
|
+
type: appliedDiscountCode.discountType || "percentage",
|
|
11785
|
+
value: appliedDiscountCode.discountValue || 0,
|
|
11786
|
+
discountAmount: appliedDiscountCode.discountAmount,
|
|
11787
|
+
newTotal: appliedDiscountCode.newTotal,
|
|
11788
|
+
}
|
|
11789
|
+
: null;
|
|
11790
|
+
const hasPaymentProvider = Boolean(stripePromise || systemConfig?.paymentProvider === "mollie");
|
|
11736
11791
|
const handleVoucherValidated = q$2((voucher, _error) => {
|
|
11737
11792
|
if (voucher) {
|
|
11738
11793
|
setAppliedVouchers((prev) => [...prev, voucher]);
|
|
@@ -11844,19 +11899,12 @@
|
|
|
11844
11899
|
});
|
|
11845
11900
|
}, [config]);
|
|
11846
11901
|
const handleClose = () => {
|
|
11902
|
+
persistState();
|
|
11903
|
+
setCheckoutStep("details");
|
|
11847
11904
|
onClose();
|
|
11848
|
-
if (selectedEventInstance && selectedEventType) {
|
|
11849
|
-
onBackToEventInstances?.();
|
|
11850
|
-
}
|
|
11851
|
-
else if (selectedEventType) {
|
|
11852
|
-
onBackToEventTypes?.();
|
|
11853
|
-
}
|
|
11854
|
-
};
|
|
11855
|
-
const scrollToPayment = () => {
|
|
11856
|
-
paymentSectionRef.current?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
11857
11905
|
};
|
|
11858
11906
|
// Footer navigation
|
|
11859
|
-
const footerContent = (u$2(k$3, { children: [u$2("button", { type: "button", onClick: handleClose, style: mergeStyles(buttonStyles.secondary, buttonStyles.fullWidth), children: t$1("common.back") }), u$2("button", { type: "button", onClick:
|
|
11907
|
+
const footerContent = (u$2(k$3, { children: [u$2("button", { type: "button", onClick: checkoutStep === "payment" ? () => setCheckoutStep("details") : handleClose, style: mergeStyles(buttonStyles.secondary, buttonStyles.fullWidth), children: checkoutStep === "payment" ? t$1("button.backToDetails") : t$1("common.back") }), checkoutStep === "details" && (u$2("button", { type: "button", onClick: () => setCheckoutStep("payment"), disabled: !isReadyForPayment() || !hasPaymentProvider, style: mergeStyles(buttonStyles.primary, buttonStyles.fullWidth), children: t$1("button.continueToPayment") }))] }));
|
|
11860
11908
|
if (!eventDetails.bookingOpen) {
|
|
11861
11909
|
return (u$2(Sidebar, { isOpen: isOpen, onClose: handleClose, title: t$1("booking.notPossible"), children: u$2("div", { style: {
|
|
11862
11910
|
display: "flex",
|
|
@@ -11873,264 +11921,211 @@
|
|
|
11873
11921
|
fontFamily: "var(--bw-font-family)",
|
|
11874
11922
|
}, children: t$1("booking.notPossible") }), u$2("p", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: t$1("booking.notPossibleMessage") })] }) }) }));
|
|
11875
11923
|
}
|
|
11876
|
-
return (u$2(Sidebar, { isOpen: isOpen, onClose: handleClose, title: t$1("booking.title", { name: eventDetails.name }), footer: footerContent, children: u$2("div", { className: "booking-widget-container", style: { padding: "16px" }, children: [u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: sectionHeaderStyles$1, children: t$1("booking.eventDetails") }), u$2("div", { style: {
|
|
11877
|
-
|
|
11878
|
-
|
|
11879
|
-
|
|
11880
|
-
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
|
|
11887
|
-
|
|
11888
|
-
|
|
11889
|
-
|
|
11890
|
-
|
|
11891
|
-
|
|
11892
|
-
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
11900
|
-
|
|
11901
|
-
|
|
11902
|
-
|
|
11903
|
-
|
|
11924
|
+
return (u$2(Sidebar, { isOpen: isOpen, onClose: handleClose, title: t$1("booking.title", { name: eventDetails.name }), footer: footerContent, children: u$2("div", { className: "booking-widget-container", style: { padding: "16px" }, children: [checkoutStep === "details" && (u$2(k$3, { children: [u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: sectionHeaderStyles$1, children: t$1("booking.eventDetails") }), u$2("div", { style: {
|
|
11925
|
+
display: "grid",
|
|
11926
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))",
|
|
11927
|
+
gap: "12px",
|
|
11928
|
+
fontSize: "14px",
|
|
11929
|
+
}, children: [u$2("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [u$2("span", { style: {
|
|
11930
|
+
color: "var(--bw-text-muted)",
|
|
11931
|
+
fontFamily: "var(--bw-font-family)",
|
|
11932
|
+
display: "flex",
|
|
11933
|
+
alignItems: "center",
|
|
11934
|
+
gap: "4px",
|
|
11935
|
+
}, children: [u$2(IconCalendar, { size: 20, color: "var(--bw-highlight-color)" }), " ", t$1("booking.date")] }), u$2("span", { style: {
|
|
11936
|
+
color: "var(--bw-text-color)",
|
|
11937
|
+
fontWeight: 500,
|
|
11938
|
+
fontFamily: "var(--bw-font-family)",
|
|
11939
|
+
}, children: [formatEventDate(eventDetails.startTime, timezone, locale), " \u2022 ", formatTime(eventDetails.startTime, timezone, locale)] })] }), u$2("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [u$2("span", { style: {
|
|
11940
|
+
color: "var(--bw-text-muted)",
|
|
11941
|
+
fontFamily: "var(--bw-font-family)",
|
|
11942
|
+
display: "flex",
|
|
11943
|
+
alignItems: "center",
|
|
11944
|
+
gap: "4px",
|
|
11945
|
+
}, children: [u$2(IconClock, { size: 20, color: "var(--bw-highlight-color)" }), " ", t$1("booking.duration")] }), u$2("span", { style: {
|
|
11946
|
+
color: "var(--bw-text-color)",
|
|
11947
|
+
fontWeight: 500,
|
|
11948
|
+
fontFamily: "var(--bw-font-family)",
|
|
11949
|
+
}, children: [eventDetails.durationDays, " ", eventDetails.durationDays > 1 ? t$1("common.days") : t$1("common.day")] })] }), u$2("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [u$2("span", { style: {
|
|
11950
|
+
color: "var(--bw-text-muted)",
|
|
11951
|
+
fontFamily: "var(--bw-font-family)",
|
|
11952
|
+
display: "flex",
|
|
11953
|
+
alignItems: "center",
|
|
11954
|
+
gap: "4px",
|
|
11955
|
+
}, children: [u$2(IconMoney, { size: 20, color: "var(--bw-highlight-color)" }), " ", t$1("booking.price")] }), u$2("span", { style: {
|
|
11956
|
+
color: "var(--bw-text-color)",
|
|
11957
|
+
fontWeight: 500,
|
|
11958
|
+
fontFamily: "var(--bw-font-family)",
|
|
11959
|
+
}, children: [formatCurrency(eventDetails.price), " ", t$1("common.perPerson")] })] })] })] }), u$2("div", { style: { display: "flex", flexDirection: "column", gap: "24px" }, children: [u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: sectionHeaderStyles$1, children: t$1("booking.contactInfo") }), u$2("div", { style: { marginTop: "10px", display: "flex", flexDirection: "column", gap: "16px" }, children: [u$2("div", { style: {
|
|
11960
|
+
display: "grid",
|
|
11961
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))",
|
|
11962
|
+
gap: "16px",
|
|
11963
|
+
}, children: [u$2("div", { children: [u$2("label", { htmlFor: "customerName", style: labelStyles$1, children: t$1("booking.name") }), u$2("input", { id: "customerName", ...form.register("customerName"), type: "text", style: inputStyles$1, placeholder: t$1("booking.namePlaceholder") }), customerNameError && (u$2("p", { style: errorTextStyles$1, children: customerNameError.message }))] }), u$2("div", { children: [u$2("label", { htmlFor: "customerEmail", style: labelStyles$1, children: t$1("booking.email") }), u$2("input", { id: "customerEmail", ...form.register("customerEmail"), type: "email", style: inputStyles$1, placeholder: t$1("booking.emailPlaceholder") }), customerEmailError && (u$2("p", { style: errorTextStyles$1, children: customerEmailError.message }))] })] }), u$2("div", { children: [u$2("label", { htmlFor: "customerPhone", style: labelStyles$1, children: t$1("booking.phone") }), u$2("input", { id: "customerPhone", ...form.register("customerPhone"), type: "tel", style: inputStyles$1, placeholder: t$1("booking.phonePlaceholder") })] }), u$2("div", { style: { marginTop: "10px", border: "1px solid var(--bw-border-color)", padding: "16px", borderRadius: "var(--bw-border-radius)" }, children: [u$2("div", { style: { display: "flex", alignItems: "flex-start", gap: "12px" }, children: [u$2("input", { id: "acceptTerms", ...form.register("acceptTerms"), type: "checkbox", style: formStyles.checkbox }), u$2("label", { htmlFor: "acceptTerms", style: {
|
|
11964
|
+
fontSize: "14px",
|
|
11965
|
+
color: "var(--bw-text-muted)",
|
|
11966
|
+
fontFamily: "var(--bw-font-family)",
|
|
11967
|
+
maxWidth: "calc(100% - 32px)",
|
|
11968
|
+
overflowWrap: "break-word",
|
|
11969
|
+
cursor: "pointer",
|
|
11970
|
+
}, children: [t$1("booking.acceptTerms"), " ", u$2("a", { href: eventDetails.agbUrl || "/terms", style: { color: "var(--bw-highlight-color)", textDecoration: "none" }, target: "_blank", rel: "noopener noreferrer", children: t$1("booking.terms") }), "*"] })] }), form.formState.errors.acceptTerms && (u$2("p", { style: { ...errorTextStyles$1, marginTop: "8px" }, children: form.formState.errors.acceptTerms.message }))] })] })] }), u$2("div", { style: cardStyles$1, children: [u$2("div", { style: {
|
|
11904
11971
|
display: "flex",
|
|
11972
|
+
justifyContent: "space-between",
|
|
11905
11973
|
alignItems: "center",
|
|
11906
|
-
|
|
11907
|
-
}, children: [u$2(
|
|
11908
|
-
|
|
11909
|
-
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
11913
|
-
|
|
11914
|
-
|
|
11915
|
-
|
|
11974
|
+
marginBottom: "16px",
|
|
11975
|
+
}, children: u$2("h2", { style: { ...sectionHeaderStyles$1, marginBottom: 0 }, children: t$1("booking.participants") }) }), u$2("div", { style: { display: "flex", flexDirection: "column", gap: "16px" }, children: [watchedParticipants.map((_, index) => (u$2("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [u$2("div", { style: { display: "flex", gap: "12px", alignItems: "center" }, children: [participantFieldsConfig.name.enabled && (u$2("div", { style: { flex: 1 }, children: [u$2("label", { htmlFor: `participant-name-${index}`, style: labelStyles$1, children: t$1("booking.participantName") }), u$2("input", { id: `participant-name-${index}`, ...form.register(`participants.${index}.name`), type: "text", style: inputStyles$1, placeholder: t$1("booking.participantNamePlaceholder") }), form.formState.errors.participants?.[index]?.name && (u$2("p", { style: errorTextStyles$1, children: form.formState.errors.participants[index]?.name?.message }))] })), participantFieldsConfig.age.enabled && (u$2("div", { style: { width: "80px" }, children: [u$2("label", { htmlFor: `participant-age-${index}`, style: labelStyles$1, children: t$1("booking.participantAge") }), u$2("input", { id: `participant-age-${index}`, ...form.register(`participants.${index}.age`, {
|
|
11976
|
+
setValueAs: (value) => {
|
|
11977
|
+
if (value === "" || value === null || value === undefined) {
|
|
11978
|
+
return undefined;
|
|
11979
|
+
}
|
|
11980
|
+
const num = Number(value);
|
|
11981
|
+
return Number.isNaN(num) ? undefined : num;
|
|
11982
|
+
},
|
|
11983
|
+
}), type: "number", min: "0", max: "120", style: inputStyles$1, placeholder: "25" })] })), watchedParticipants.length > 1 && (u$2("div", { children: [u$2("label", { style: { ...labelStyles$1, visibility: "hidden" }, children: "\u00A0" }), u$2("button", { type: "button", onClick: () => removeParticipant(index), style: {
|
|
11984
|
+
color: "var(--bw-error-color)",
|
|
11985
|
+
backgroundColor: "var(--bw-surface-color)",
|
|
11986
|
+
border: "1px solid var(--bw-border-color)",
|
|
11987
|
+
borderRadius: "50%",
|
|
11988
|
+
width: "36px",
|
|
11989
|
+
height: "36px",
|
|
11990
|
+
display: "flex",
|
|
11991
|
+
alignItems: "center",
|
|
11992
|
+
justifyContent: "center",
|
|
11993
|
+
cursor: "pointer",
|
|
11994
|
+
transition: "all 0.2s ease",
|
|
11995
|
+
fontSize: "24px",
|
|
11996
|
+
fontWeight: 700,
|
|
11997
|
+
fontFamily: "var(--bw-font-family)",
|
|
11998
|
+
padding: 0,
|
|
11999
|
+
}, children: "\u00D7" })] }))] }), participantFieldsConfig.level.enabled && (u$2("div", { style: { minWidth: "140px" }, children: [u$2("label", { htmlFor: `participant-level-${index}`, style: labelStyles$1, children: t$1("booking.participantLevel") }), u$2("select", { id: `participant-level-${index}`, ...form.register(`participants.${index}.level`), style: inputStyles$1, children: [u$2("option", { value: "", children: t$1("booking.participantLevelPlaceholder") }), participantLevelOptions.map((level) => (u$2("option", { value: level, children: t$1(`level.${level}`) }, level)))] }), form.formState.errors.participants?.[index]?.level && (u$2("p", { style: errorTextStyles$1, children: form.formState.errors.participants[index]?.level?.message }))] })), upsells.length > 0 && (u$2("div", { style: participantUpsellStyles.container, children: upsells.map((upsell) => {
|
|
12000
|
+
const isSelected = (participantUpsells[index] || []).includes(upsell.id);
|
|
12001
|
+
return (u$2("label", { htmlFor: `upsell-${index}-${upsell.id}`, style: isSelected ? participantUpsellStyles.labelSelected : participantUpsellStyles.label, children: [u$2("input", { id: `upsell-${index}-${upsell.id}`, type: "checkbox", style: participantUpsellStyles.checkbox, checked: isSelected, onChange: () => toggleParticipantUpsell(index, upsell.id) }), u$2("span", { style: { fontWeight: 500 }, children: upsell.name }), u$2("span", { style: { fontSize: "12px", opacity: 0.8 }, children: ["(+", formatCurrency(upsell.price), ")"] })] }, upsell.id));
|
|
12002
|
+
}) }))] }, index))), watchedParticipants.length < eventDetails.availableSpots ? (u$2("div", { style: {
|
|
12003
|
+
display: "flex",
|
|
12004
|
+
flexDirection: "column",
|
|
12005
|
+
alignItems: "center",
|
|
12006
|
+
marginTop: "12px",
|
|
12007
|
+
}, children: u$2("button", { type: "button", onClick: addParticipant, style: {
|
|
12008
|
+
color: "#ffffff",
|
|
12009
|
+
fontSize: "14px",
|
|
12010
|
+
fontWeight: 600,
|
|
12011
|
+
padding: "8px 16px",
|
|
12012
|
+
borderRadius: "var(--bw-border-radius)",
|
|
12013
|
+
backgroundColor: "var(--bw-highlight-color)",
|
|
12014
|
+
border: "1px solid var(--bw-highlight-color)",
|
|
12015
|
+
cursor: "pointer",
|
|
12016
|
+
transition: "all 0.2s ease",
|
|
12017
|
+
marginBottom: "4px",
|
|
12018
|
+
fontFamily: "var(--bw-font-family)",
|
|
12019
|
+
boxShadow: "0 2px 8px 0 var(--bw-highlight-color)",
|
|
12020
|
+
}, children: t$1("booking.addParticipant", { number: watchedParticipants.length + 1 }) }) })) : (u$2("p", { style: { ...errorTextStyles$1, margin: 0 }, children: t$1("booking.maxSpotsReached", { count: eventDetails.availableSpots }) }))] })] }), u$2(VoucherInput, { config: config, orderValue: baseTotal, eventInstanceId: eventDetails?.id, customerEmail: watchedCustomerEmail, onVoucherValidated: handleVoucherValidated, appliedVouchers: appliedVouchers, onRemoveVoucher: handleRemoveVoucher, disabled: !eventDetails }), u$2("div", { style: cardStyles$1, children: [u$2("label", { htmlFor: "booking-comment", style: labelStyles$1, children: t$1("booking.comment") }), u$2("textarea", { id: "booking-comment", ...form.register("comment"), placeholder: t$1("booking.commentPlaceholder"), rows: 3, style: {
|
|
12021
|
+
...inputStyles$1,
|
|
12022
|
+
resize: "vertical",
|
|
12023
|
+
minHeight: "80px",
|
|
12024
|
+
} })] })] })] })), checkoutStep === "payment" && (u$2("div", { style: { display: "flex", flexDirection: "column", gap: "24px" }, children: [u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: { ...sectionHeaderStyles$1, marginBottom: "16px" }, children: t$1("summary.title") }), u$2("div", { style: { marginTop: "10px", display: "flex", flexDirection: "column", gap: "12px" }, children: [u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: t$1("booking.price") }), u$2("div", { style: {
|
|
12025
|
+
color: "var(--bw-text-color)",
|
|
12026
|
+
fontWeight: 500,
|
|
12027
|
+
fontFamily: "var(--bw-font-family)",
|
|
12028
|
+
}, children: [u$2("span", { style: { fontWeight: 200 }, children: [watchedParticipants.length > 1 ? watchedParticipants.length : 1, " x "] }), " ", formatCurrency(eventDetails.price)] })] }), upsellsTotal > 0 && (u$2("div", { style: { marginTop: "8px", paddingTop: "8px", borderTop: "1px dashed var(--bw-border-color)" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)", fontSize: "13px", display: "block", marginBottom: "4px" }, children: [t$1("common.extras"), ":"] }), upsells.map((upsell) => {
|
|
12029
|
+
// Count how many participants have this upsell selected
|
|
12030
|
+
const countWithUpsell = watchedParticipants.filter((_, idx) => (participantUpsells[idx] || []).includes(upsell.id)).length;
|
|
12031
|
+
if (countWithUpsell === 0)
|
|
12032
|
+
return null;
|
|
12033
|
+
const upsellLineTotal = upsell.price * countWithUpsell;
|
|
12034
|
+
return (u$2("div", { style: { display: "flex", flexDirection: "column", gap: "2px", fontSize: "13px" }, children: u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-highlight-color)", fontFamily: "var(--bw-font-family)" }, children: ["+ ", upsell.name, " (", countWithUpsell, "\u00D7)"] }), u$2("span", { style: { color: "var(--bw-highlight-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(upsellLineTotal) })] }) }, upsell.id));
|
|
12035
|
+
})] })), appliedVouchers.length > 0 && (u$2(k$3, { children: [u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: t$1("summary.subtotal") }), u$2("span", { style: {
|
|
12036
|
+
fontFamily: "var(--bw-font-family)",
|
|
12037
|
+
color: totalDiscount > 0 ? "var(--bw-text-muted)" : "var(--bw-text-muted)",
|
|
12038
|
+
textDecoration: totalDiscount > 0 ? "line-through" : "none",
|
|
12039
|
+
}, children: formatCurrency(baseTotal) })] }), appliedDiscountCode && (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: {
|
|
12040
|
+
color: "var(--bw-success-color)",
|
|
12041
|
+
fontFamily: "var(--bw-font-family)",
|
|
11916
12042
|
fontSize: "14px",
|
|
12043
|
+
}, children: t$1("summary.discount", { code: appliedDiscountCode.code }) }), u$2("span", { style: { color: "var(--bw-success-color)", fontFamily: "var(--bw-font-family)" }, children: ["-", formatCurrency(appliedDiscountCode.discountAmount)] })] })), appliedGiftCards.map((giftCard) => (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: {
|
|
12044
|
+
color: "var(--bw-success-color)",
|
|
12045
|
+
fontFamily: "var(--bw-font-family)",
|
|
12046
|
+
fontSize: "14px",
|
|
12047
|
+
}, children: t$1("summary.giftCard", { code: giftCard.code }) }), u$2("span", { style: { color: "var(--bw-success-color)", fontFamily: "var(--bw-font-family)" }, children: ["-", formatCurrency(giftCard.balanceToUse || giftCard.discountAmount)] })] }, giftCard.code)))] })), u$2("div", { style: {
|
|
12048
|
+
borderTop: "1px solid var(--bw-border-color)",
|
|
12049
|
+
paddingTop: "12px",
|
|
12050
|
+
}, children: [hasDepositOption && (u$2("div", { style: {
|
|
12051
|
+
display: "flex",
|
|
12052
|
+
justifyContent: "space-between",
|
|
12053
|
+
alignItems: "center",
|
|
12054
|
+
fontSize: "14px",
|
|
12055
|
+
marginBottom: "12px",
|
|
12056
|
+
}, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: t$1("summary.totalAmount") }), u$2("span", { style: {
|
|
11917
12057
|
color: "var(--bw-text-muted)",
|
|
11918
12058
|
fontFamily: "var(--bw-font-family)",
|
|
11919
|
-
|
|
11920
|
-
|
|
12059
|
+
fontWeight: 500,
|
|
12060
|
+
}, children: formatCurrency(totalAmount) })] })), hasDepositOption && (u$2("div", { style: {
|
|
12061
|
+
display: "flex",
|
|
12062
|
+
gap: "8px",
|
|
12063
|
+
marginBottom: "16px",
|
|
12064
|
+
}, children: [u$2("button", { type: "button", onClick: () => setPaymentOption("deposit"), style: {
|
|
12065
|
+
flex: 1,
|
|
12066
|
+
padding: "12px",
|
|
12067
|
+
borderRadius: "var(--bw-border-radius)",
|
|
12068
|
+
border: paymentOption === "deposit"
|
|
12069
|
+
? "2px solid var(--bw-highlight-color)"
|
|
12070
|
+
: "1px solid var(--bw-border-color)",
|
|
12071
|
+
backgroundColor: paymentOption === "deposit"
|
|
12072
|
+
? "rgba(var(--bw-highlight-color-rgb, 0, 177, 170), 0.1)"
|
|
12073
|
+
: "var(--bw-surface-color)",
|
|
11921
12074
|
cursor: "pointer",
|
|
11922
|
-
|
|
11923
|
-
|
|
11924
|
-
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
|
|
11930
|
-
return undefined;
|
|
11931
|
-
}
|
|
11932
|
-
const num = Number(value);
|
|
11933
|
-
return Number.isNaN(num) ? undefined : num;
|
|
11934
|
-
},
|
|
11935
|
-
}), type: "number", min: "0", max: "120", style: inputStyles$1, placeholder: "25" })] })), watchedParticipants.length > 1 && (u$2("div", { children: [u$2("label", { style: { ...labelStyles$1, visibility: "hidden" }, children: "\u00A0" }), u$2("button", { type: "button", onClick: () => removeParticipant(index), style: {
|
|
11936
|
-
color: "var(--bw-error-color)",
|
|
11937
|
-
backgroundColor: "var(--bw-surface-color)",
|
|
11938
|
-
border: "1px solid var(--bw-border-color)",
|
|
11939
|
-
borderRadius: "50%",
|
|
11940
|
-
width: "36px",
|
|
11941
|
-
height: "36px",
|
|
11942
|
-
display: "flex",
|
|
11943
|
-
alignItems: "center",
|
|
11944
|
-
justifyContent: "center",
|
|
11945
|
-
cursor: "pointer",
|
|
11946
|
-
transition: "all 0.2s ease",
|
|
11947
|
-
fontSize: "24px",
|
|
12075
|
+
fontFamily: "var(--bw-font-family)",
|
|
12076
|
+
transition: "all 0.2s ease",
|
|
12077
|
+
}, children: [u$2("div", { style: {
|
|
12078
|
+
fontSize: "13px",
|
|
12079
|
+
color: "var(--bw-text-muted)",
|
|
12080
|
+
marginBottom: "4px",
|
|
12081
|
+
}, children: t$1("summary.deposit") }), u$2("div", { style: {
|
|
12082
|
+
fontSize: "18px",
|
|
11948
12083
|
fontWeight: 700,
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
|
|
11953
|
-
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
padding: "8px 16px",
|
|
11964
|
-
borderRadius: "var(--bw-border-radius)",
|
|
11965
|
-
backgroundColor: "var(--bw-highlight-color)",
|
|
11966
|
-
border: "1px solid var(--bw-highlight-color)",
|
|
11967
|
-
cursor: "pointer",
|
|
11968
|
-
transition: "all 0.2s ease",
|
|
11969
|
-
marginBottom: "4px",
|
|
11970
|
-
fontFamily: "var(--bw-font-family)",
|
|
11971
|
-
boxShadow: "0 2px 8px 0 var(--bw-highlight-color)",
|
|
11972
|
-
}, children: t$1("booking.addParticipant", { number: watchedParticipants.length + 1 }) }) })) : (u$2("p", { style: { ...errorTextStyles$1, margin: 0 }, children: t$1("booking.maxSpotsReached", { count: eventDetails.availableSpots }) }))] })] }), u$2(VoucherInput, { config: config, orderValue: baseTotal, eventInstanceId: eventDetails?.id, customerEmail: watchedCustomerEmail, onVoucherValidated: handleVoucherValidated, appliedVouchers: appliedVouchers, onRemoveVoucher: handleRemoveVoucher, disabled: !eventDetails }), u$2("div", { style: cardStyles$1, children: [u$2("label", { htmlFor: "booking-comment", style: labelStyles$1, children: t$1("booking.comment") }), u$2("textarea", { id: "booking-comment", ...form.register("comment"), placeholder: t$1("booking.commentPlaceholder"), rows: 3, style: {
|
|
11973
|
-
...inputStyles$1,
|
|
11974
|
-
resize: "vertical",
|
|
11975
|
-
minHeight: "80px",
|
|
11976
|
-
} })] }), u$2("div", { style: { display: "flex", flexDirection: "column", gap: "24px" }, children: [u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: { ...sectionHeaderStyles$1, marginBottom: "16px" }, children: t$1("summary.title") }), u$2("div", { style: { marginTop: "10px", display: "flex", flexDirection: "column", gap: "12px" }, children: [u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: t$1("booking.price") }), u$2("div", { style: {
|
|
11977
|
-
color: "var(--bw-text-color)",
|
|
11978
|
-
fontWeight: 500,
|
|
12084
|
+
color: paymentOption === "deposit"
|
|
12085
|
+
? "var(--bw-highlight-color)"
|
|
12086
|
+
: "var(--bw-text-color)",
|
|
12087
|
+
}, children: formatCurrency(depositAmount) })] }), u$2("button", { type: "button", onClick: () => setPaymentOption("full"), style: {
|
|
12088
|
+
flex: 1,
|
|
12089
|
+
padding: "12px",
|
|
12090
|
+
borderRadius: "var(--bw-border-radius)",
|
|
12091
|
+
border: paymentOption === "full"
|
|
12092
|
+
? "2px solid var(--bw-highlight-color)"
|
|
12093
|
+
: "1px solid var(--bw-border-color)",
|
|
12094
|
+
backgroundColor: paymentOption === "full"
|
|
12095
|
+
? "rgba(var(--bw-highlight-color-rgb, 0, 177, 170), 0.1)"
|
|
12096
|
+
: "var(--bw-surface-color)",
|
|
12097
|
+
cursor: "pointer",
|
|
11979
12098
|
fontFamily: "var(--bw-font-family)",
|
|
11980
|
-
|
|
11981
|
-
|
|
11982
|
-
|
|
11983
|
-
if (countWithUpsell === 0)
|
|
11984
|
-
return null;
|
|
11985
|
-
const upsellLineTotal = upsell.price * countWithUpsell;
|
|
11986
|
-
return (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", fontSize: "13px" }, children: [u$2("span", { style: { color: "var(--bw-highlight-color)", fontFamily: "var(--bw-font-family)" }, children: ["+ ", upsell.name, " (", countWithUpsell, "\u00D7)"] }), u$2("span", { style: { color: "var(--bw-highlight-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(upsellLineTotal) })] }, upsell.id));
|
|
11987
|
-
})] })), appliedVouchers.length > 0 && (u$2(k$3, { children: [u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: t$1("summary.subtotal") }), u$2("span", { style: {
|
|
11988
|
-
fontFamily: "var(--bw-font-family)",
|
|
11989
|
-
color: totalDiscount > 0 ? "var(--bw-text-muted)" : "var(--bw-text-muted)",
|
|
11990
|
-
textDecoration: totalDiscount > 0 ? "line-through" : "none",
|
|
11991
|
-
}, children: formatCurrency(baseTotal) })] }), appliedDiscountCode && (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: {
|
|
11992
|
-
color: "var(--bw-success-color)",
|
|
11993
|
-
fontFamily: "var(--bw-font-family)",
|
|
11994
|
-
fontSize: "14px",
|
|
11995
|
-
}, children: t$1("summary.discount", { code: appliedDiscountCode.code }) }), u$2("span", { style: { color: "var(--bw-success-color)", fontFamily: "var(--bw-font-family)" }, children: ["-", formatCurrency(appliedDiscountCode.discountAmount)] })] })), appliedGiftCards.map((giftCard) => (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: {
|
|
11996
|
-
color: "var(--bw-success-color)",
|
|
11997
|
-
fontFamily: "var(--bw-font-family)",
|
|
11998
|
-
fontSize: "14px",
|
|
11999
|
-
}, children: t$1("summary.giftCard", { code: giftCard.code }) }), u$2("span", { style: { color: "var(--bw-success-color)", fontFamily: "var(--bw-font-family)" }, children: ["-", formatCurrency(giftCard.balanceToUse || giftCard.discountAmount)] })] }, giftCard.code)))] })), u$2("div", { style: {
|
|
12000
|
-
borderTop: "1px solid var(--bw-border-color)",
|
|
12001
|
-
paddingTop: "12px",
|
|
12002
|
-
}, children: [hasDepositOption && (u$2("div", { style: {
|
|
12003
|
-
display: "flex",
|
|
12004
|
-
gap: "8px",
|
|
12005
|
-
marginBottom: "16px",
|
|
12006
|
-
}, children: [u$2("button", { type: "button", onClick: () => setPaymentOption("deposit"), style: {
|
|
12007
|
-
flex: 1,
|
|
12008
|
-
padding: "12px",
|
|
12009
|
-
borderRadius: "var(--bw-border-radius)",
|
|
12010
|
-
border: paymentOption === "deposit"
|
|
12011
|
-
? "2px solid var(--bw-highlight-color)"
|
|
12012
|
-
: "1px solid var(--bw-border-color)",
|
|
12013
|
-
backgroundColor: paymentOption === "deposit"
|
|
12014
|
-
? "rgba(var(--bw-highlight-color-rgb, 0, 177, 170), 0.1)"
|
|
12015
|
-
: "var(--bw-surface-color)",
|
|
12016
|
-
cursor: "pointer",
|
|
12017
|
-
fontFamily: "var(--bw-font-family)",
|
|
12018
|
-
transition: "all 0.2s ease",
|
|
12019
|
-
}, children: [u$2("div", { style: {
|
|
12020
|
-
fontSize: "13px",
|
|
12021
|
-
color: "var(--bw-text-muted)",
|
|
12022
|
-
marginBottom: "4px",
|
|
12023
|
-
}, children: t$1("summary.deposit") }), u$2("div", { style: {
|
|
12024
|
-
fontSize: "18px",
|
|
12025
|
-
fontWeight: 700,
|
|
12026
|
-
color: paymentOption === "deposit"
|
|
12027
|
-
? "var(--bw-highlight-color)"
|
|
12028
|
-
: "var(--bw-text-color)",
|
|
12029
|
-
}, children: formatCurrency(depositAmount) })] }), u$2("button", { type: "button", onClick: () => setPaymentOption("full"), style: {
|
|
12030
|
-
flex: 1,
|
|
12031
|
-
padding: "12px",
|
|
12032
|
-
borderRadius: "var(--bw-border-radius)",
|
|
12033
|
-
border: paymentOption === "full"
|
|
12034
|
-
? "2px solid var(--bw-highlight-color)"
|
|
12035
|
-
: "1px solid var(--bw-border-color)",
|
|
12036
|
-
backgroundColor: paymentOption === "full"
|
|
12037
|
-
? "rgba(var(--bw-highlight-color-rgb, 0, 177, 170), 0.1)"
|
|
12038
|
-
: "var(--bw-surface-color)",
|
|
12039
|
-
cursor: "pointer",
|
|
12040
|
-
fontFamily: "var(--bw-font-family)",
|
|
12041
|
-
transition: "all 0.2s ease",
|
|
12042
|
-
}, children: [u$2("div", { style: {
|
|
12043
|
-
fontSize: "13px",
|
|
12044
|
-
color: "var(--bw-text-muted)",
|
|
12045
|
-
marginBottom: "4px",
|
|
12046
|
-
}, children: t$1("summary.payFull") }), u$2("div", { style: {
|
|
12047
|
-
fontSize: "18px",
|
|
12048
|
-
fontWeight: 700,
|
|
12049
|
-
color: paymentOption === "full"
|
|
12050
|
-
? "var(--bw-highlight-color)"
|
|
12051
|
-
: "var(--bw-text-color)",
|
|
12052
|
-
}, children: formatCurrency(totalAmount) })] })] })), hasDepositOption && paymentOption === "deposit" && (u$2("div", { style: {
|
|
12053
|
-
display: "flex",
|
|
12054
|
-
justifyContent: "space-between",
|
|
12055
|
-
alignItems: "center",
|
|
12056
|
-
fontSize: "14px",
|
|
12057
|
-
marginBottom: "8px",
|
|
12058
|
-
}, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: t$1("summary.totalAmount") }), u$2("span", { style: {
|
|
12099
|
+
transition: "all 0.2s ease",
|
|
12100
|
+
}, children: [u$2("div", { style: {
|
|
12101
|
+
fontSize: "13px",
|
|
12059
12102
|
color: "var(--bw-text-muted)",
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
display: "flex",
|
|
12064
|
-
justifyContent: "space-between",
|
|
12065
|
-
alignItems: "center",
|
|
12066
|
-
fontSize: "18px",
|
|
12067
|
-
fontWeight: 600,
|
|
12068
|
-
}, children: [u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: hasDepositOption && paymentOption === "deposit"
|
|
12069
|
-
? t$1("summary.payToday")
|
|
12070
|
-
: t$1("summary.totalAmount") }), u$2("span", { style: {
|
|
12071
|
-
color: "var(--bw-highlight-color)",
|
|
12072
|
-
fontFamily: "var(--bw-font-family)",
|
|
12103
|
+
marginBottom: "4px",
|
|
12104
|
+
}, children: t$1("summary.payFull") }), u$2("div", { style: {
|
|
12105
|
+
fontSize: "18px",
|
|
12073
12106
|
fontWeight: 700,
|
|
12074
|
-
|
|
12075
|
-
|
|
12076
|
-
|
|
12107
|
+
color: paymentOption === "full"
|
|
12108
|
+
? "var(--bw-highlight-color)"
|
|
12109
|
+
: "var(--bw-text-color)",
|
|
12110
|
+
}, children: formatCurrency(totalAmount) })] })] })), u$2("div", { style: {
|
|
12111
|
+
display: "flex",
|
|
12112
|
+
justifyContent: "space-between",
|
|
12113
|
+
alignItems: "center",
|
|
12114
|
+
fontSize: "18px",
|
|
12115
|
+
fontWeight: 600,
|
|
12116
|
+
}, children: [u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: hasDepositOption && paymentOption === "deposit"
|
|
12117
|
+
? t$1("summary.payToday")
|
|
12118
|
+
: t$1("summary.totalAmount") }), u$2("span", { style: {
|
|
12119
|
+
color: "var(--bw-highlight-color)",
|
|
12077
12120
|
fontFamily: "var(--bw-font-family)",
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
if (!isReadyForPayment()) {
|
|
12083
|
-
const participantsWithNames = watchedParticipants.filter((p) => p.name?.trim()).length;
|
|
12084
|
-
const totalParticipantRows = watchedParticipants.length;
|
|
12085
|
-
const participantsWithoutNames = totalParticipantRows - participantsWithNames;
|
|
12086
|
-
const missing = [];
|
|
12087
|
-
if (participantFieldsConfig.name.required) {
|
|
12088
|
-
if (participantsWithNames === 0) {
|
|
12089
|
-
missing.push(t$1("payment.needParticipant"));
|
|
12090
|
-
}
|
|
12091
|
-
else if (participantsWithoutNames > 0) {
|
|
12092
|
-
missing.push(t$1("payment.needAllNames", { count: totalParticipantRows }));
|
|
12093
|
-
}
|
|
12094
|
-
}
|
|
12095
|
-
if (participantsWithNames > (eventDetails?.availableSpots || 0)) {
|
|
12096
|
-
missing.push(t$1("payment.reduceParticipants", { count: eventDetails?.availableSpots || 0 }));
|
|
12097
|
-
}
|
|
12098
|
-
if (!watchedCustomerName || watchedCustomerName.trim().length < 2 || customerNameError) {
|
|
12099
|
-
missing.push(t$1("payment.needValidName"));
|
|
12100
|
-
}
|
|
12101
|
-
if (!watchedCustomerEmail || watchedCustomerEmail.trim().length === 0 || customerEmailError) {
|
|
12102
|
-
missing.push(t$1("payment.needValidEmail"));
|
|
12103
|
-
}
|
|
12104
|
-
if (!watchedAcceptTerms) {
|
|
12105
|
-
missing.push(t$1("payment.needAcceptTerms"));
|
|
12106
|
-
}
|
|
12107
|
-
const message = missing.length > 0
|
|
12108
|
-
? t$1("payment.missingFields", { fields: missing.join(", ") })
|
|
12109
|
-
: t$1("payment.fillRequired");
|
|
12110
|
-
return (u$2("div", { style: {
|
|
12111
|
-
...cardStyles$1,
|
|
12112
|
-
border: "1px solid var(--bw-warning-color)",
|
|
12113
|
-
color: "var(--bw-warning-color)",
|
|
12121
|
+
fontWeight: 700,
|
|
12122
|
+
}, children: formatCurrency(paymentAmount) })] }), hasDepositOption && paymentOption === "deposit" && (u$2("div", { style: {
|
|
12123
|
+
fontSize: "12px",
|
|
12124
|
+
color: "var(--bw-text-muted)",
|
|
12114
12125
|
fontFamily: "var(--bw-font-family)",
|
|
12115
|
-
|
|
12116
|
-
|
|
12117
|
-
|
|
12118
|
-
const discountCodeProp = appliedDiscountCode
|
|
12119
|
-
? {
|
|
12120
|
-
id: appliedDiscountCode.id,
|
|
12121
|
-
code: appliedDiscountCode.code,
|
|
12122
|
-
description: appliedDiscountCode.description || undefined,
|
|
12123
|
-
type: appliedDiscountCode.discountType || "percentage",
|
|
12124
|
-
value: appliedDiscountCode.discountValue || 0,
|
|
12125
|
-
discountAmount: appliedDiscountCode.discountAmount,
|
|
12126
|
-
newTotal: appliedDiscountCode.newTotal,
|
|
12127
|
-
}
|
|
12128
|
-
: null;
|
|
12129
|
-
if (systemConfig?.paymentProvider === "mollie") {
|
|
12130
|
-
return (u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: { ...sectionHeaderStyles$1 }, children: t$1("summary.payment") }), u$2(MolliePaymentForm, { config: config, eventDetails: eventDetails, formData: paymentFormData, totalAmount: paymentAmount, discountCode: discountCodeProp, giftCards: appliedGiftCards, onSuccess: onSuccess, onError: onError, upsellSelections: aggregatedUpsellSelections(), mollieProfileId: systemConfig?.mollieProfileId, mollieTestmode: systemConfig?.mollieTestmode })] }));
|
|
12131
|
-
}
|
|
12132
|
-
return (u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: { ...sectionHeaderStyles$1 }, children: t$1("summary.payment") }), u$2(StripePaymentForm, { config: config, eventDetails: eventDetails, formData: paymentFormData, totalAmount: paymentAmount, discountCode: discountCodeProp, giftCards: appliedGiftCards, onSuccess: onSuccess, onError: onError, systemConfig: systemConfig ?? null, stripePromise: stripePromise, stripeAppearance: stripeAppearance, upsellSelections: aggregatedUpsellSelections() })] }));
|
|
12133
|
-
})() })] })] })] }) }));
|
|
12126
|
+
marginTop: "8px",
|
|
12127
|
+
textAlign: "right",
|
|
12128
|
+
}, children: t$1("summary.remainingOnSite", { amount: formatCurrency(totalAmount - depositAmount) }) }))] })] })] }), !hasPaymentProvider && (u$2("div", { style: cardStyles$1, children: u$2("p", { style: { ...errorTextStyles$1, margin: 0 }, children: t$1("booking.paymentUnavailable") }) })), hasPaymentProvider && (systemConfig?.paymentProvider === "mollie" ? (u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: { ...sectionHeaderStyles$1 }, children: t$1("summary.payment") }), u$2(MolliePaymentForm, { config: config, eventDetails: eventDetails, formData: paymentFormData, totalAmount: paymentAmount, discountCode: discountCodeProp, giftCards: appliedGiftCards, onSuccess: onSuccess, onError: onError, upsellSelections: aggregatedUpsellSelections(), mollieProfileId: systemConfig?.mollieProfileId, mollieTestmode: systemConfig?.mollieTestmode })] })) : (u$2("div", { style: cardStyles$1, children: [u$2("h2", { style: { ...sectionHeaderStyles$1 }, children: t$1("summary.payment") }), u$2(StripePaymentForm, { config: config, eventDetails: eventDetails, formData: paymentFormData, totalAmount: paymentAmount, discountCode: discountCodeProp, giftCards: appliedGiftCards, onSuccess: onSuccess, onError: onError, systemConfig: systemConfig ?? null, stripePromise: stripePromise, stripeAppearance: stripeAppearance, upsellSelections: aggregatedUpsellSelections() })] })))] }))] }) }));
|
|
12134
12129
|
}
|
|
12135
12130
|
|
|
12136
12131
|
/**
|
|
@@ -15297,12 +15292,11 @@
|
|
|
15297
15292
|
return $$1(dialogContent, portalContainer);
|
|
15298
15293
|
}
|
|
15299
15294
|
|
|
15300
|
-
// Upsell card styles
|
|
15301
15295
|
const cardBaseStyles = {
|
|
15302
15296
|
position: "relative",
|
|
15303
15297
|
display: "flex",
|
|
15304
15298
|
flexDirection: "column",
|
|
15305
|
-
padding: "
|
|
15299
|
+
padding: "12px",
|
|
15306
15300
|
backgroundColor: "var(--bw-surface-color)",
|
|
15307
15301
|
borderWidth: "2px",
|
|
15308
15302
|
borderStyle: "solid",
|
|
@@ -15322,19 +15316,13 @@
|
|
|
15322
15316
|
opacity: 0.6,
|
|
15323
15317
|
cursor: "not-allowed",
|
|
15324
15318
|
};
|
|
15325
|
-
const checkboxContainerStyles = {
|
|
15326
|
-
position: "absolute",
|
|
15327
|
-
bottom: "12px",
|
|
15328
|
-
left: "12px",
|
|
15329
|
-
zIndex: 1,
|
|
15330
|
-
};
|
|
15331
15319
|
const checkboxInnerStyles = {
|
|
15332
|
-
width: "
|
|
15333
|
-
height: "
|
|
15320
|
+
width: "48px",
|
|
15321
|
+
height: "48px",
|
|
15334
15322
|
borderWidth: "2px",
|
|
15335
15323
|
borderStyle: "solid",
|
|
15336
15324
|
borderColor: "var(--bw-border-color)",
|
|
15337
|
-
borderRadius: "
|
|
15325
|
+
borderRadius: "12px",
|
|
15338
15326
|
display: "flex",
|
|
15339
15327
|
alignItems: "center",
|
|
15340
15328
|
justifyContent: "center",
|
|
@@ -15346,13 +15334,13 @@
|
|
|
15346
15334
|
borderColor: "var(--bw-highlight-color)",
|
|
15347
15335
|
backgroundColor: "var(--bw-highlight-color)",
|
|
15348
15336
|
};
|
|
15349
|
-
const
|
|
15350
|
-
width: "
|
|
15351
|
-
height: "
|
|
15352
|
-
marginBottom: "12px",
|
|
15337
|
+
const previewImageContainerStyles = {
|
|
15338
|
+
width: "56px",
|
|
15339
|
+
height: "56px",
|
|
15353
15340
|
borderRadius: "calc(var(--bw-border-radius) - 4px)",
|
|
15354
15341
|
overflow: "hidden",
|
|
15355
15342
|
backgroundColor: "var(--bw-background-color)",
|
|
15343
|
+
flexShrink: 0,
|
|
15356
15344
|
};
|
|
15357
15345
|
const imageStyles = {
|
|
15358
15346
|
width: "100%",
|
|
@@ -15367,23 +15355,53 @@
|
|
|
15367
15355
|
justifyContent: "center",
|
|
15368
15356
|
color: "var(--bw-text-muted)",
|
|
15369
15357
|
};
|
|
15370
|
-
const
|
|
15358
|
+
const previewNameStyles = {
|
|
15371
15359
|
fontSize: "16px",
|
|
15372
15360
|
fontWeight: 600,
|
|
15373
15361
|
color: "var(--bw-text-color)",
|
|
15374
|
-
margin:
|
|
15375
|
-
|
|
15362
|
+
margin: 0,
|
|
15363
|
+
fontFamily: "var(--bw-font-family)",
|
|
15364
|
+
};
|
|
15365
|
+
const previewHeaderStyles = {
|
|
15366
|
+
display: "flex",
|
|
15367
|
+
alignItems: "center",
|
|
15368
|
+
gap: "10px",
|
|
15369
|
+
};
|
|
15370
|
+
const previewPriceStyles = {
|
|
15371
|
+
fontSize: "13px",
|
|
15372
|
+
color: "var(--bw-text-muted)",
|
|
15373
|
+
marginTop: "2px",
|
|
15376
15374
|
fontFamily: "var(--bw-font-family)",
|
|
15377
15375
|
};
|
|
15376
|
+
const headerRightStyles = {
|
|
15377
|
+
marginLeft: "auto",
|
|
15378
|
+
display: "flex",
|
|
15379
|
+
alignItems: "center",
|
|
15380
|
+
gap: "8px",
|
|
15381
|
+
};
|
|
15382
|
+
const chevronStyles = {
|
|
15383
|
+
fontSize: "12px",
|
|
15384
|
+
color: "var(--bw-text-muted)",
|
|
15385
|
+
transition: "transform 0.2s ease",
|
|
15386
|
+
};
|
|
15387
|
+
const expandedContentStyles = {
|
|
15388
|
+
marginTop: "12px",
|
|
15389
|
+
paddingTop: "12px",
|
|
15390
|
+
borderTop: "1px solid var(--bw-border-color)",
|
|
15391
|
+
};
|
|
15392
|
+
const expandedImageContainerStyles = {
|
|
15393
|
+
width: "100%",
|
|
15394
|
+
height: "180px",
|
|
15395
|
+
marginBottom: "12px",
|
|
15396
|
+
borderRadius: "calc(var(--bw-border-radius) - 4px)",
|
|
15397
|
+
overflow: "hidden",
|
|
15398
|
+
backgroundColor: "var(--bw-background-color)",
|
|
15399
|
+
};
|
|
15378
15400
|
const descriptionStyles = {
|
|
15379
15401
|
fontSize: "13px",
|
|
15380
15402
|
color: "var(--bw-text-muted)",
|
|
15381
15403
|
margin: "0 0 10px 0",
|
|
15382
15404
|
lineHeight: 1.4,
|
|
15383
|
-
display: "-webkit-box",
|
|
15384
|
-
WebkitLineClamp: 5,
|
|
15385
|
-
WebkitBoxOrient: "vertical",
|
|
15386
|
-
overflow: "hidden",
|
|
15387
15405
|
fontFamily: "var(--bw-font-family)",
|
|
15388
15406
|
};
|
|
15389
15407
|
const itemsContainerStyles = {
|
|
@@ -15465,6 +15483,8 @@
|
|
|
15465
15483
|
const { locale } = useLocale();
|
|
15466
15484
|
const totalPrice = upsell.price * participantCount;
|
|
15467
15485
|
const isDisabled = !upsell.available;
|
|
15486
|
+
const [isExpanded, setIsExpanded] = d$1(false);
|
|
15487
|
+
const hasSavings = (upsell.savingsPercent ?? 0) > 0;
|
|
15468
15488
|
const getCardStyles = () => {
|
|
15469
15489
|
if (isDisabled)
|
|
15470
15490
|
return cardDisabledStyles;
|
|
@@ -15472,16 +15492,22 @@
|
|
|
15472
15492
|
return cardSelectedStyles;
|
|
15473
15493
|
return cardBaseStyles;
|
|
15474
15494
|
};
|
|
15475
|
-
|
|
15495
|
+
const toggleExpanded = () => {
|
|
15496
|
+
setIsExpanded((current) => !current);
|
|
15497
|
+
};
|
|
15498
|
+
return (u$2("div", { style: getCardStyles(), onClick: !isDisabled ? toggleExpanded : undefined, role: "button", "aria-expanded": isExpanded, tabIndex: isDisabled ? -1 : 0, onKeyDown: (e) => {
|
|
15476
15499
|
if (!isDisabled && (e.key === "Enter" || e.key === " ")) {
|
|
15477
15500
|
e.preventDefault();
|
|
15478
|
-
|
|
15501
|
+
toggleExpanded();
|
|
15479
15502
|
}
|
|
15480
|
-
}, children: [u$2("div", { style:
|
|
15503
|
+
}, children: [u$2("div", { style: previewHeaderStyles, children: [u$2("div", { style: previewImageContainerStyles, children: upsell.image ? (u$2("img", { src: upsell.image, alt: upsell.name, style: imageStyles })) : (u$2("div", { style: imagePlaceholderStyles, children: u$2("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", style: { width: "32px", height: "32px", opacity: 0.4 }, children: u$2("path", { d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }) })) }), u$2("div", { style: { minWidth: 0 }, children: [u$2("h4", { style: previewNameStyles, children: upsell.name }), u$2("div", { style: previewPriceStyles, children: [formatCurrency(upsell.price), "/", t("common.perPerson")] }), hasSavings && (u$2("div", { style: { ...previewPriceStyles, color: "var(--bw-highlight-color)" }, children: t("upsells.savePercent", { percent: upsell.savingsPercent ?? 0 }) }))] }), u$2("div", { style: headerRightStyles, children: [u$2("button", { type: "button", onClick: (event) => {
|
|
15504
|
+
event.stopPropagation();
|
|
15505
|
+
onSelect();
|
|
15506
|
+
}, "aria-label": t("common.extras"), style: { background: "transparent", border: "none", cursor: "pointer", padding: 0 }, disabled: isDisabled, children: u$2("div", { style: isSelected ? checkboxSelectedStyles : checkboxInnerStyles, children: isSelected && (u$2("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "3", strokeLinecap: "round", strokeLinejoin: "round", style: { width: "32px", height: "32px" }, children: u$2("polyline", { points: "20 6 9 17 4 12" }) })) }) }), u$2("span", { style: { ...chevronStyles, transform: isExpanded ? "rotate(180deg)" : "rotate(0deg)" }, children: "\u25BC" })] })] }), isExpanded && (u$2("div", { style: expandedContentStyles, children: [u$2("div", { style: expandedImageContainerStyles, children: upsell.image ? (u$2("img", { src: upsell.image, alt: upsell.name, style: imageStyles })) : (u$2("div", { style: imagePlaceholderStyles, children: u$2("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", style: { width: "40px", height: "40px", opacity: 0.4 }, children: u$2("path", { d: "M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" }) }) })) }), upsell.description && (u$2("p", { style: descriptionStyles, children: upsell.description })), upsell.items.length > 0 && (u$2("div", { style: itemsContainerStyles, children: upsell.items.map((item, index) => (u$2("span", { style: itemStyles, children: [item.type === "product" ? "📦" : "🎫", " ", item.name, item.quantity > 1 && ` (${item.quantity}x)`] }, index))) })), upsell.suggestedEventInstance && (u$2("div", { style: eventInfoStyles, children: [u$2("span", { style: { color: "var(--bw-text-color)", fontWeight: 500 }, children: ["\uD83D\uDCC5 ", new Date(upsell.suggestedEventInstance.date).toLocaleDateString(locale === "de" ? "de-DE" : locale === "en" ? "en-US" : locale === "es" ? "es-ES" : locale === "sv" ? "sv-SE" : "pt-PT", {
|
|
15481
15507
|
weekday: "short",
|
|
15482
15508
|
day: "numeric",
|
|
15483
15509
|
month: "short",
|
|
15484
|
-
})] }), u$2("span", { style: { color: "var(--bw-text-muted)" }, children: t("upsells.spotsFree", { count: upsell.suggestedEventInstance.availableSpots }) })] }))
|
|
15510
|
+
})] }), u$2("span", { style: { color: "var(--bw-text-muted)" }, children: t("upsells.spotsFree", { count: upsell.suggestedEventInstance.availableSpots }) })] })), u$2("div", { style: priceContainerStyles, children: [u$2("span", { style: pricePerPersonStyles, children: [formatCurrency(upsell.price), "/", t("common.perPerson")] }), participantCount > 1 && (u$2("span", { style: priceTotalStyles, children: ["= ", formatCurrency(totalPrice)] })), hasSavings && (u$2("span", { style: priceTotalStyles, children: t("upsells.savePercent", { percent: upsell.savingsPercent ?? 0 }) }))] })] })), isDisabled && (u$2("div", { style: unavailableOverlayStyles, children: u$2("span", { children: upsell.unavailableReason
|
|
15485
15511
|
? formatUnavailableReason(upsell.unavailableReason, t)
|
|
15486
15512
|
: t("upsells.notAvailable") }) }))] }));
|
|
15487
15513
|
}
|
|
@@ -15500,20 +15526,9 @@
|
|
|
15500
15526
|
}
|
|
15501
15527
|
};
|
|
15502
15528
|
const isSelected = (upsellId) => selectedUpsells.some((s) => s.upsellPackageId === upsellId);
|
|
15503
|
-
// Calculate total for selected upsells
|
|
15504
|
-
const calculateTotal = () => {
|
|
15505
|
-
return selectedUpsells.reduce((total, selection) => {
|
|
15506
|
-
const upsell = upsells.find((u) => u.id === selection.upsellPackageId);
|
|
15507
|
-
if (upsell) {
|
|
15508
|
-
return total + upsell.price * selection.quantity;
|
|
15509
|
-
}
|
|
15510
|
-
return total;
|
|
15511
|
-
}, 0);
|
|
15512
|
-
};
|
|
15513
|
-
const selectedTotal = calculateTotal();
|
|
15514
15529
|
const selectedCount = selectedUpsells.length;
|
|
15515
15530
|
const footerContent = (u$2(k$3, { children: [u$2("button", { type: "button", onClick: onBack, style: mergeStyles(buttonStyles.secondary, buttonStyles.fullWidth), className: buttonClassName, children: t("common.back") }), u$2("button", { type: "button", onClick: onContinue, style: mergeStyles(buttonStyles.primary, buttonStyles.fullWidth), className: buttonClassName, children: selectedCount === 0 ? t("button.continueWithout") : t("button.continue") })] }));
|
|
15516
|
-
return (u$2(Sidebar, { isOpen: isOpen, onClose: onClose, title: t("upsells.title"), footer: footerContent, children: u$2("div", { style: { display: "flex", flexDirection: "column", height: "100%", padding: "16px 16px" }, children: [isLoading && (u$2("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "12px", padding: "40px 20px", ...textStyles.muted }, children: [spinner(), u$2("span", { children: t("upsells.loading") })] })), !isLoading && upsells.length === 0 && (u$2("div", { style: { textAlign: "center", padding: "40px 20px", ...textStyles.muted }, children: u$2("p", { children: t("upsells.noExtras") }) })), !isLoading && upsells.length > 0 && (u$2("div", { style: { display: "flex", flexDirection: "column", gap: "12px", flex: 1, overflowY: "auto", paddingBottom: "16px" }, children: upsells.map((upsell) => (u$2(UpsellCard, { upsell: upsell, isSelected: isSelected(upsell.id), participantCount: participantCount, onSelect: () => selectUpsell(upsell.id) }, upsell.id))) })), selectedCount > 0 && (u$2("div", { style: { display: "flex",
|
|
15531
|
+
return (u$2(Sidebar, { isOpen: isOpen, onClose: onClose, title: t("upsells.title"), footer: footerContent, children: u$2("div", { style: { display: "flex", flexDirection: "column", height: "100%", padding: "16px 16px" }, children: [isLoading && (u$2("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "12px", padding: "40px 20px", ...textStyles.muted }, children: [spinner(), u$2("span", { children: t("upsells.loading") })] })), !isLoading && upsells.length === 0 && (u$2("div", { style: { textAlign: "center", padding: "40px 20px", ...textStyles.muted }, children: u$2("p", { children: t("upsells.noExtras") }) })), !isLoading && upsells.length > 0 && (u$2("div", { style: { display: "flex", flexDirection: "column", gap: "12px", flex: 1, overflowY: "auto", paddingBottom: "16px" }, children: upsells.map((upsell) => (u$2(UpsellCard, { upsell: upsell, isSelected: isSelected(upsell.id), participantCount: participantCount, onSelect: () => selectUpsell(upsell.id) }, upsell.id))) })), selectedCount > 0 && (u$2("div", { style: { display: "flex", alignItems: "center", marginTop: "16px", paddingBottom: "16px", paddingTop: "16px", borderTop: "1px solid var(--bw-border-color)", fontSize: "14px" }, children: u$2("span", { style: textStyles.muted, children: selectedCount === 1 ? t("upsells.selected", { count: selectedCount }) : t("upsells.selectedPlural", { count: selectedCount }) }) }))] }) }));
|
|
15517
15532
|
}
|
|
15518
15533
|
|
|
15519
15534
|
/**
|
|
@@ -15651,6 +15666,7 @@
|
|
|
15651
15666
|
// Upsells state
|
|
15652
15667
|
const [upsells, setUpsells] = d$1([]);
|
|
15653
15668
|
const [selectedUpsells, setSelectedUpsells] = d$1([]);
|
|
15669
|
+
const [bookingPersistedState, setBookingPersistedState] = d$1(null);
|
|
15654
15670
|
const [isLoadingUpsells, setIsLoadingUpsells] = d$1(false);
|
|
15655
15671
|
const [tempParticipantCount, setTempParticipantCount] = d$1(1); // Used during upsell step
|
|
15656
15672
|
// State for upcoming events (next-events view mode)
|
|
@@ -16305,6 +16321,7 @@
|
|
|
16305
16321
|
const handleEventInstanceSelect = async (eventInstance) => {
|
|
16306
16322
|
trackEvent("event_instance_selected", { eventInstanceId: eventInstance.id, eventInstanceName: eventInstance.name });
|
|
16307
16323
|
setSelectedEventInstance(eventInstance);
|
|
16324
|
+
setBookingPersistedState(null);
|
|
16308
16325
|
bookingReturnStep.current = "eventInstances";
|
|
16309
16326
|
// Set default participant count for upsell calculations
|
|
16310
16327
|
const defaultParticipantCount = 1;
|
|
@@ -16358,6 +16375,21 @@
|
|
|
16358
16375
|
setCurrentStep(bookingReturnStep.current);
|
|
16359
16376
|
setSelectedEventInstance(null);
|
|
16360
16377
|
setEventDetails(null);
|
|
16378
|
+
setBookingPersistedState(null);
|
|
16379
|
+
};
|
|
16380
|
+
const handleBackFromBooking = () => {
|
|
16381
|
+
if (upsells.length > 0) {
|
|
16382
|
+
setCurrentStep("upsells");
|
|
16383
|
+
return;
|
|
16384
|
+
}
|
|
16385
|
+
if (isDirectInstanceMode) {
|
|
16386
|
+
setCurrentStep("eventTypes");
|
|
16387
|
+
setSidebarOpen(false);
|
|
16388
|
+
setEventDetails(null);
|
|
16389
|
+
setBookingPersistedState(null);
|
|
16390
|
+
return;
|
|
16391
|
+
}
|
|
16392
|
+
handleBackToEventInstances();
|
|
16361
16393
|
};
|
|
16362
16394
|
const handleBookingSuccess = (result) => {
|
|
16363
16395
|
trackEvent("booking_completed", { paymentIntentId: result.paymentIntent?.id });
|
|
@@ -16365,6 +16397,7 @@
|
|
|
16365
16397
|
setSuccessPaymentId(result.paymentIntent.id);
|
|
16366
16398
|
setSidebarOpen(false);
|
|
16367
16399
|
setShouldRenderBookingForm(false);
|
|
16400
|
+
setBookingPersistedState(null);
|
|
16368
16401
|
config.onSuccess?.(result);
|
|
16369
16402
|
};
|
|
16370
16403
|
const handleBookingError = (errorMessage) => {
|
|
@@ -16433,6 +16466,7 @@
|
|
|
16433
16466
|
? (eventTypes.find((et) => et.id === eventTypeId) ?? selectedEventType)
|
|
16434
16467
|
: selectedEventType;
|
|
16435
16468
|
if (resolvedEventType && resolvedEventType !== selectedEventType) {
|
|
16469
|
+
trackEvent("event_type_selected", { eventTypeId: resolvedEventType.id, eventTypeName: resolvedEventType.name });
|
|
16436
16470
|
setSelectedEventType(resolvedEventType);
|
|
16437
16471
|
}
|
|
16438
16472
|
// Check if this is coming from a card preview (eventTypeId was provided)
|
|
@@ -16486,7 +16520,9 @@
|
|
|
16486
16520
|
}
|
|
16487
16521
|
: null;
|
|
16488
16522
|
if (eventInstance) {
|
|
16523
|
+
trackEvent("event_instance_selected", { eventInstanceId: eventInstance.id, eventInstanceName: eventInstance.name });
|
|
16489
16524
|
setSelectedEventInstance(eventInstance);
|
|
16525
|
+
setBookingPersistedState(null);
|
|
16490
16526
|
}
|
|
16491
16527
|
setError(null);
|
|
16492
16528
|
// Check for upsells before going to booking (same as handleEventInstanceSelect)
|
|
@@ -16650,19 +16686,7 @@
|
|
|
16650
16686
|
}
|
|
16651
16687
|
// Main view based on view mode
|
|
16652
16688
|
if (viewMode === "next-events" && showingPreview) {
|
|
16653
|
-
return (u$2(StyleProvider, { config: config, children: [u$2("div", { ref: setWidgetContainerRef, children: [u$2(NextEventsPreview, { events: upcomingEvents, onEventSelect: handleUpcomingEventSelect, onShowAll: handleShowAllEvents, showAllButtonText: nextEventsSettings.showAllButtonText, showAllButton: nextEventsSettings.showAllButton, isLoadingEventDetails: isLoadingEventDetails, isLoadingShowAll: isLoadingShowAll, isLoading: isLoading }), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError,
|
|
16654
|
-
setCurrentStep("eventTypes");
|
|
16655
|
-
setShowingPreview(true);
|
|
16656
|
-
setEventDetails(null);
|
|
16657
|
-
}, onBackToEventTypes: () => {
|
|
16658
|
-
setCurrentStep("eventTypes");
|
|
16659
|
-
setShowingPreview(true);
|
|
16660
|
-
setEventDetails(null);
|
|
16661
|
-
}, selectedEventType: selectedEventType, selectedEventInstance: selectedEventInstance, isOpen: currentStep === "booking" && !!eventDetails, onClose: () => {
|
|
16662
|
-
setCurrentStep("eventTypes");
|
|
16663
|
-
setShowingPreview(true);
|
|
16664
|
-
setEventDetails(null);
|
|
16665
|
-
}, systemConfig: systemConfig, selectedUpsells: selectedUpsells, upsells: upsells })), u$2(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
|
|
16689
|
+
return (u$2(StyleProvider, { config: config, children: [u$2("div", { ref: setWidgetContainerRef, children: [u$2(NextEventsPreview, { events: upcomingEvents, onEventSelect: handleUpcomingEventSelect, onShowAll: handleShowAllEvents, showAllButtonText: nextEventsSettings.showAllButtonText, showAllButton: nextEventsSettings.showAllButton, isLoadingEventDetails: isLoadingEventDetails, isLoadingShowAll: isLoadingShowAll, isLoading: isLoading }), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError, isOpen: currentStep === "booking" && !!eventDetails, onClose: handleBackFromBooking, systemConfig: systemConfig, selectedUpsells: selectedUpsells, upsells: upsells, persistedState: bookingPersistedState, onPersistedStateChange: setBookingPersistedState })), u$2(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
|
|
16666
16690
|
setIsSuccess(false);
|
|
16667
16691
|
setCurrentStep("eventTypes");
|
|
16668
16692
|
setShowingPreview(true);
|
|
@@ -16672,6 +16696,7 @@
|
|
|
16672
16696
|
setShouldRenderBookingForm(false);
|
|
16673
16697
|
setSelectedUpsells([]);
|
|
16674
16698
|
setUpsells([]);
|
|
16699
|
+
setBookingPersistedState(null);
|
|
16675
16700
|
const url = new URL(window.location.href);
|
|
16676
16701
|
url.searchParams.delete("payment_intent");
|
|
16677
16702
|
url.searchParams.delete("payment_intent_client_secret");
|
|
@@ -16682,19 +16707,7 @@
|
|
|
16682
16707
|
}, config: config, googleAdsConfig: googleAdsConfig, onError: setError, paymentIntentId: successPaymentId })] }), showPromoDialog && config.promo && (u$2(PromoDialog, { config: config.promo, onClose: handlePromoDialogClose, onCtaClick: handlePromoCtaClick }))] }));
|
|
16683
16708
|
}
|
|
16684
16709
|
if (viewMode === "specials" && showingPreview) {
|
|
16685
|
-
return (u$2(StyleProvider, { config: config, children: [u$2("div", { ref: setWidgetContainerRef, children: [u$2(SpecialsView, { specials: specials, onEventSelect: handleUpcomingEventSelect, isLoading: isLoadingSpecials, showSavingsAmount: config.specialsSettings?.showSavingsAmount ?? true, showSavingsPercent: config.specialsSettings?.showSavingsPercent ?? false, emptyStateText: config.specialsSettings?.emptyStateText }), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError,
|
|
16686
|
-
setCurrentStep("eventTypes");
|
|
16687
|
-
setShowingPreview(true);
|
|
16688
|
-
setEventDetails(null);
|
|
16689
|
-
}, onBackToEventTypes: () => {
|
|
16690
|
-
setCurrentStep("eventTypes");
|
|
16691
|
-
setShowingPreview(true);
|
|
16692
|
-
setEventDetails(null);
|
|
16693
|
-
}, selectedEventType: selectedEventType, selectedEventInstance: selectedEventInstance, isOpen: currentStep === "booking" && !!eventDetails, onClose: () => {
|
|
16694
|
-
setCurrentStep("eventTypes");
|
|
16695
|
-
setShowingPreview(true);
|
|
16696
|
-
setEventDetails(null);
|
|
16697
|
-
}, systemConfig: systemConfig, selectedUpsells: selectedUpsells, upsells: upsells })), u$2(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
|
|
16710
|
+
return (u$2(StyleProvider, { config: config, children: [u$2("div", { ref: setWidgetContainerRef, children: [u$2(SpecialsView, { specials: specials, onEventSelect: handleUpcomingEventSelect, isLoading: isLoadingSpecials, showSavingsAmount: config.specialsSettings?.showSavingsAmount ?? true, showSavingsPercent: config.specialsSettings?.showSavingsPercent ?? false, emptyStateText: config.specialsSettings?.emptyStateText }), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError, isOpen: currentStep === "booking" && !!eventDetails, onClose: handleBackFromBooking, systemConfig: systemConfig, selectedUpsells: selectedUpsells, upsells: upsells, persistedState: bookingPersistedState, onPersistedStateChange: setBookingPersistedState })), u$2(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
|
|
16698
16711
|
setIsSuccess(false);
|
|
16699
16712
|
setCurrentStep("eventTypes");
|
|
16700
16713
|
setShowingPreview(true);
|
|
@@ -16704,6 +16717,7 @@
|
|
|
16704
16717
|
setShouldRenderBookingForm(false);
|
|
16705
16718
|
setSelectedUpsells([]);
|
|
16706
16719
|
setUpsells([]);
|
|
16720
|
+
setBookingPersistedState(null);
|
|
16707
16721
|
}, config: config, googleAdsConfig: googleAdsConfig, onError: setError, paymentIntentId: successPaymentId })] }), showPromoDialog && config.promo && (u$2(PromoDialog, { config: config.promo, onClose: handlePromoDialogClose, onCtaClick: handlePromoCtaClick }))] }));
|
|
16708
16722
|
}
|
|
16709
16723
|
if (viewMode === "next-events" && !showingPreview && currentStep === "eventInstances") {
|
|
@@ -16756,7 +16770,7 @@
|
|
|
16756
16770
|
setShouldRenderInstanceSelection(true);
|
|
16757
16771
|
}
|
|
16758
16772
|
}, children: config.buttonText ||
|
|
16759
|
-
(isDirectInstanceMode ? t("button.bookNow") : t("button.selectDate")) }), shouldRenderInstanceSelection && (u$2(EventInstanceSelection, { eventInstances: eventInstances, selectedEventType: selectedEventType, onEventInstanceSelect: handleEventInstanceSelect, onBackToEventTypes: () => setSidebarOpen(false), isOpen: sidebarOpen && currentStep === "eventInstances", onClose: () => setSidebarOpen(false), isLoadingEventInstances: isLoadingEventInstances, isLoadingEventDetails: isLoadingEventDetails })), shouldRenderUpsells && (u$2(UpsellsStep, { upsells: upsells, selectedUpsells: selectedUpsells, participantCount: tempParticipantCount, isLoading: isLoadingUpsells, isOpen: currentStep === "upsells", onClose: () => setCurrentStep("eventInstances"), onSelect: handleUpsellsSelect, onContinue: handleUpsellsContinue, onBack: handleUpsellsBack })), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError,
|
|
16773
|
+
(isDirectInstanceMode ? t("button.bookNow") : t("button.selectDate")) }), shouldRenderInstanceSelection && (u$2(EventInstanceSelection, { eventInstances: eventInstances, selectedEventType: selectedEventType, onEventInstanceSelect: handleEventInstanceSelect, onBackToEventTypes: () => setSidebarOpen(false), isOpen: sidebarOpen && currentStep === "eventInstances", onClose: () => setSidebarOpen(false), isLoadingEventInstances: isLoadingEventInstances, isLoadingEventDetails: isLoadingEventDetails })), shouldRenderUpsells && (u$2(UpsellsStep, { upsells: upsells, selectedUpsells: selectedUpsells, participantCount: tempParticipantCount, isLoading: isLoadingUpsells, isOpen: currentStep === "upsells", onClose: () => setCurrentStep("eventInstances"), onSelect: handleUpsellsSelect, onContinue: handleUpsellsContinue, onBack: handleUpsellsBack })), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError, isOpen: currentStep === "booking" && !!eventDetails, onClose: handleBackFromBooking, systemConfig: systemConfig, selectedUpsells: selectedUpsells, upsells: upsells, persistedState: bookingPersistedState, onPersistedStateChange: setBookingPersistedState })), u$2(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
|
|
16760
16774
|
setIsSuccess(false);
|
|
16761
16775
|
setCurrentStep("eventTypes");
|
|
16762
16776
|
setSidebarOpen(false);
|
|
@@ -16788,32 +16802,36 @@
|
|
|
16788
16802
|
// Determine the correct back handlers based on view mode
|
|
16789
16803
|
const getBackHandlers = () => {
|
|
16790
16804
|
if (viewMode === "next-events") {
|
|
16791
|
-
|
|
16792
|
-
|
|
16793
|
-
setCurrentStep("
|
|
16805
|
+
const backFromBooking = () => {
|
|
16806
|
+
if (upsells.length > 0) {
|
|
16807
|
+
setCurrentStep("upsells");
|
|
16794
16808
|
setShowingPreview(false);
|
|
16795
|
-
|
|
16796
|
-
}
|
|
16809
|
+
return;
|
|
16810
|
+
}
|
|
16811
|
+
setCurrentStep("eventInstances");
|
|
16812
|
+
setShowingPreview(false);
|
|
16813
|
+
setEventDetails(null);
|
|
16814
|
+
setBookingPersistedState(null);
|
|
16815
|
+
};
|
|
16816
|
+
return {
|
|
16817
|
+
onBackToEventInstances: backFromBooking,
|
|
16797
16818
|
onBackToEventTypes: () => {
|
|
16798
16819
|
setShowingPreview(true);
|
|
16799
16820
|
setCurrentStep("eventTypes");
|
|
16800
16821
|
setEventDetails(null);
|
|
16822
|
+
setBookingPersistedState(null);
|
|
16801
16823
|
},
|
|
16802
|
-
onClose:
|
|
16803
|
-
setCurrentStep("eventInstances");
|
|
16804
|
-
setShowingPreview(false);
|
|
16805
|
-
setEventDetails(null);
|
|
16806
|
-
},
|
|
16824
|
+
onClose: backFromBooking,
|
|
16807
16825
|
};
|
|
16808
16826
|
}
|
|
16809
16827
|
return {
|
|
16810
|
-
onBackToEventInstances:
|
|
16828
|
+
onBackToEventInstances: handleBackFromBooking,
|
|
16811
16829
|
onBackToEventTypes: handleBackToEventTypes,
|
|
16812
|
-
onClose:
|
|
16830
|
+
onClose: handleBackFromBooking,
|
|
16813
16831
|
};
|
|
16814
16832
|
};
|
|
16815
16833
|
const backHandlers = getBackHandlers();
|
|
16816
|
-
return (u$2(StyleProvider, { config: config, children: [u$2("div", { ref: setWidgetContainerRef, children: [cardsView, shouldRenderInstanceSelection && (u$2(EventInstanceSelection, { eventInstances: eventInstances, selectedEventType: selectedEventType, onEventInstanceSelect: handleEventInstanceSelect, onBackToEventTypes: handleBackToEventTypes, isOpen: currentStep === "eventInstances", onClose: handleBackToEventTypes, isLoadingEventInstances: isLoadingEventInstances, isLoadingEventDetails: isLoadingEventDetails })), shouldRenderUpsells && (u$2(UpsellsStep, { upsells: upsells, selectedUpsells: selectedUpsells, participantCount: tempParticipantCount, isLoading: isLoadingUpsells, isOpen: currentStep === "upsells", onClose: () => setCurrentStep("eventInstances"), onSelect: handleUpsellsSelect, onContinue: handleUpsellsContinue, onBack: handleUpsellsBack })), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError,
|
|
16834
|
+
return (u$2(StyleProvider, { config: config, children: [u$2("div", { ref: setWidgetContainerRef, children: [cardsView, shouldRenderInstanceSelection && (u$2(EventInstanceSelection, { eventInstances: eventInstances, selectedEventType: selectedEventType, onEventInstanceSelect: handleEventInstanceSelect, onBackToEventTypes: handleBackToEventTypes, isOpen: currentStep === "eventInstances", onClose: handleBackToEventTypes, isLoadingEventInstances: isLoadingEventInstances, isLoadingEventDetails: isLoadingEventDetails })), shouldRenderUpsells && (u$2(UpsellsStep, { upsells: upsells, selectedUpsells: selectedUpsells, participantCount: tempParticipantCount, isLoading: isLoadingUpsells, isOpen: currentStep === "upsells", onClose: () => setCurrentStep("eventInstances"), onSelect: handleUpsellsSelect, onContinue: handleUpsellsContinue, onBack: handleUpsellsBack })), shouldRenderBookingForm && eventDetails && (u$2(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError, isOpen: currentStep === "booking" && !!eventDetails, onClose: backHandlers.onClose, systemConfig: systemConfig, selectedUpsells: selectedUpsells, upsells: upsells, persistedState: bookingPersistedState, onPersistedStateChange: setBookingPersistedState })), u$2(BookingSuccessModal, { isOpen: isSuccess && !voucherPurchaseResult, onClose: () => {
|
|
16817
16835
|
setIsSuccess(false);
|
|
16818
16836
|
setCurrentStep("eventTypes");
|
|
16819
16837
|
setSuccessPaymentId(null);
|