@bigz-app/booking-widget 0.1.25 → 0.2.1
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 +454 -273
- package/dist/booking-widget.js.map +1 -1
- package/dist/components/BookingForm.d.ts.map +1 -1
- package/dist/components/BookingSuccessModal.d.ts +3 -4
- package/dist/components/BookingSuccessModal.d.ts.map +1 -1
- package/dist/components/PaymentForm.d.ts.map +1 -1
- package/dist/components/UniversalBookingWidget.d.ts.map +1 -1
- package/dist/index.cjs +454 -273
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +454 -273
- package/dist/index.esm.js.map +1 -1
- package/dist/styles/StyleProvider.d.ts.map +1 -1
- package/dist/utils.d.ts +6 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -591,6 +591,13 @@ const StyleProvider = ({ config, children, }) => {
|
|
|
591
591
|
direction: ltr;
|
|
592
592
|
isolation: isolate;
|
|
593
593
|
}
|
|
594
|
+
.print-only {
|
|
595
|
+
display: none;
|
|
596
|
+
}
|
|
597
|
+
.print-hidden {
|
|
598
|
+
display: block;
|
|
599
|
+
}
|
|
600
|
+
@media print {
|
|
594
601
|
`;
|
|
595
602
|
// Inject CSS reset styles
|
|
596
603
|
React__default.useEffect(() => {
|
|
@@ -936,6 +943,26 @@ const createRequestBody = (config, additionalData) => {
|
|
|
936
943
|
organizationId: config.organizationId,
|
|
937
944
|
};
|
|
938
945
|
};
|
|
946
|
+
// Helper function to detect Stripe return parameters in URL
|
|
947
|
+
const detectStripeReturn = () => {
|
|
948
|
+
if (typeof window === "undefined") {
|
|
949
|
+
return null;
|
|
950
|
+
}
|
|
951
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
952
|
+
// Check for Stripe return parameters
|
|
953
|
+
const paymentIntent = urlParams.get("payment_intent");
|
|
954
|
+
const paymentIntentClientSecret = urlParams.get("payment_intent_client_secret");
|
|
955
|
+
const redirectStatus = urlParams.get("redirect_status");
|
|
956
|
+
if (paymentIntent && paymentIntentClientSecret && redirectStatus) {
|
|
957
|
+
return {
|
|
958
|
+
isStripeReturn: true,
|
|
959
|
+
paymentIntent,
|
|
960
|
+
paymentIntentClientSecret,
|
|
961
|
+
redirectStatus,
|
|
962
|
+
};
|
|
963
|
+
}
|
|
964
|
+
return null;
|
|
965
|
+
};
|
|
939
966
|
|
|
940
967
|
var isCheckBoxInput = (element) => element.type === 'checkbox';
|
|
941
968
|
|
|
@@ -9118,7 +9145,7 @@ const spinner = (borderColor) => (jsxRuntime.jsx("div", { style: {
|
|
|
9118
9145
|
borderRadius: "50%",
|
|
9119
9146
|
} }) }));
|
|
9120
9147
|
// Inner component that uses the Stripe hooks
|
|
9121
|
-
function PaymentFormInner({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError,
|
|
9148
|
+
function PaymentFormInner({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, }) {
|
|
9122
9149
|
const stripe = reactStripe_umdExports.useStripe();
|
|
9123
9150
|
const elements = reactStripe_umdExports.useElements();
|
|
9124
9151
|
const [isLoading, setIsLoading] = React__default.useState(false);
|
|
@@ -9144,26 +9171,12 @@ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discoun
|
|
|
9144
9171
|
return;
|
|
9145
9172
|
}
|
|
9146
9173
|
// First, confirm the payment with Stripe
|
|
9174
|
+
// Build return URL for Stripe redirect
|
|
9175
|
+
const baseUrl = window !== undefined ? window.location.href : `${config.bookingSystemUrl}/booking-success`;
|
|
9176
|
+
const returnUrl = new URL(baseUrl);
|
|
9147
9177
|
const confirmParams = {
|
|
9148
|
-
return_url:
|
|
9178
|
+
return_url: returnUrl.toString(),
|
|
9149
9179
|
};
|
|
9150
|
-
// Ensure return_url is properly formatted and doesn't contain fragment identifiers
|
|
9151
|
-
try {
|
|
9152
|
-
const url = new URL(confirmParams.return_url);
|
|
9153
|
-
// Remove any fragment identifiers that might cause issues
|
|
9154
|
-
url.hash = "";
|
|
9155
|
-
confirmParams.return_url = url.toString();
|
|
9156
|
-
}
|
|
9157
|
-
catch (e) {
|
|
9158
|
-
console.warn("[PAYMENT_FORM] Invalid return_url, using fallback:", confirmParams.return_url);
|
|
9159
|
-
// Fallback to current origin if URL parsing fails
|
|
9160
|
-
confirmParams.return_url = window.location.origin + window.location.pathname;
|
|
9161
|
-
}
|
|
9162
|
-
console.log("[PAYMENT_FORM] Confirming payment with params:", {
|
|
9163
|
-
paymentIntentId: clientSecret.split("_secret_")[0],
|
|
9164
|
-
return_url: confirmParams.return_url,
|
|
9165
|
-
redirect: "if_required",
|
|
9166
|
-
});
|
|
9167
9180
|
const { error, paymentIntent } = await stripe.confirmPayment({
|
|
9168
9181
|
elements,
|
|
9169
9182
|
confirmParams,
|
|
@@ -9181,91 +9194,15 @@ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discoun
|
|
|
9181
9194
|
setPaymentError(error.message || "Zahlungsfehler");
|
|
9182
9195
|
}
|
|
9183
9196
|
else {
|
|
9184
|
-
setPaymentError("Ein unerwarteter Fehler ist aufgetreten.");
|
|
9197
|
+
setPaymentError("Ein unerwarteter Fehler ist aufgetreten. Bitte versuche es nochmal.");
|
|
9185
9198
|
}
|
|
9186
9199
|
return;
|
|
9187
9200
|
}
|
|
9188
9201
|
// Payment succeeded, now create the booking
|
|
9189
9202
|
if (paymentIntent && paymentIntent.status === "succeeded") {
|
|
9190
|
-
// Check if we have system configuration
|
|
9191
|
-
if (!systemConfig) {
|
|
9192
|
-
throw new Error("System-Konfiguration nicht verfügbar. Bitte lade die Seite neu.");
|
|
9193
|
-
}
|
|
9194
|
-
// Determine which endpoint to use based on system mode
|
|
9195
|
-
const isConnectMode = systemConfig.systemMode === "connect";
|
|
9196
|
-
const endpoint = isConnectMode
|
|
9197
|
-
? "/booking/create-from-payment"
|
|
9198
|
-
: "/booking-proxy/create-booking";
|
|
9199
|
-
// Calculate if this is a deposit payment
|
|
9200
|
-
const fullAmount = eventDetails.price * formData.participants.filter((p) => p.name.trim()).length;
|
|
9201
|
-
const isDepositPayment = eventDetails.deposit > 0;
|
|
9202
|
-
// Build request body based on mode
|
|
9203
|
-
const requestData = {
|
|
9204
|
-
// Payment info
|
|
9205
|
-
paymentIntentId: paymentIntent.id,
|
|
9206
|
-
paymentMethod: "card",
|
|
9207
|
-
paymentStatus: isDepositPayment ? "deposit_paid" : "paid",
|
|
9208
|
-
totalAmount,
|
|
9209
|
-
depositAmount: isDepositPayment ? totalAmount : undefined,
|
|
9210
|
-
fullAmount: fullAmount,
|
|
9211
|
-
// Customer info
|
|
9212
|
-
customerEmail: formData.customerEmail,
|
|
9213
|
-
customerName: formData.customerName,
|
|
9214
|
-
customerPhone: formData.customerPhone,
|
|
9215
|
-
// Booking info
|
|
9216
|
-
participants: formData.participants.filter((p) => p.name.trim()),
|
|
9217
|
-
eventInstanceId: config.eventInstanceId || eventDetails.id,
|
|
9218
|
-
organizationId: config.organizationId, // Ensure organization ID is always included
|
|
9219
|
-
discountCode: discountCode?.code,
|
|
9220
|
-
notes: "",
|
|
9221
|
-
};
|
|
9222
|
-
// Add mode-specific fields
|
|
9223
|
-
if (isConnectMode) {
|
|
9224
|
-
Object.assign(requestData, {
|
|
9225
|
-
source: "connect",
|
|
9226
|
-
stripeAccountType: "connect",
|
|
9227
|
-
});
|
|
9228
|
-
}
|
|
9229
|
-
else {
|
|
9230
|
-
// ApiKey mode - include required proxy fields
|
|
9231
|
-
Object.assign(requestData, {
|
|
9232
|
-
bookingSystemApiUrl: config.apiBaseUrl,
|
|
9233
|
-
// apiKey would be added here if required
|
|
9234
|
-
});
|
|
9235
|
-
}
|
|
9236
|
-
console.log(`[PAYMENT_FORM] Attempting booking creation via ${endpoint}`, {
|
|
9237
|
-
mode: isConnectMode ? "connect" : "apikey",
|
|
9238
|
-
paymentIntentId: paymentIntent.id,
|
|
9239
|
-
eventInstanceId: requestData.eventInstanceId,
|
|
9240
|
-
organizationId: requestData.organizationId,
|
|
9241
|
-
participantCount: requestData.participants.length,
|
|
9242
|
-
});
|
|
9243
|
-
const bookingResponse = await fetch(getApiUrl(config.apiBaseUrl, endpoint), {
|
|
9244
|
-
method: "POST",
|
|
9245
|
-
headers: createApiHeaders(config),
|
|
9246
|
-
body: JSON.stringify(createRequestBody(config, requestData)),
|
|
9247
|
-
});
|
|
9248
|
-
const bookingData = await bookingResponse.json();
|
|
9249
|
-
if (!bookingResponse.ok) {
|
|
9250
|
-
console.error(`[PAYMENT_FORM] Booking creation failed:`, {
|
|
9251
|
-
status: bookingResponse.status,
|
|
9252
|
-
error: bookingData.error,
|
|
9253
|
-
details: bookingData.details,
|
|
9254
|
-
paymentIntentId: paymentIntent.id,
|
|
9255
|
-
});
|
|
9256
|
-
throw new Error(bookingData.error || "Fehler beim Erstellen der Buchung");
|
|
9257
|
-
}
|
|
9258
|
-
console.log(`[PAYMENT_FORM] Booking created successfully:`, {
|
|
9259
|
-
bookingId: bookingData.booking?.id,
|
|
9260
|
-
orderId: bookingData.order?.id,
|
|
9261
|
-
paymentIntentId: paymentIntent.id,
|
|
9262
|
-
});
|
|
9263
9203
|
// Booking created successfully
|
|
9264
9204
|
onSuccess({
|
|
9265
|
-
booking: bookingData.booking,
|
|
9266
|
-
payment: "succeeded",
|
|
9267
9205
|
paymentIntent: paymentIntent,
|
|
9268
|
-
formData: formData,
|
|
9269
9206
|
});
|
|
9270
9207
|
}
|
|
9271
9208
|
else {
|
|
@@ -9341,6 +9278,7 @@ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discoun
|
|
|
9341
9278
|
// Main PaymentForm component that handles payment intent creation and Elements wrapper
|
|
9342
9279
|
function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, systemConfig, stripePromise, stripeAppearance, }) {
|
|
9343
9280
|
const [clientSecret, setClientSecret] = React__default.useState(null);
|
|
9281
|
+
const [paymentIntentId, setPaymentIntentId] = React__default.useState(null);
|
|
9344
9282
|
const [isCreatingPaymentIntent, setIsCreatingPaymentIntent] = React__default.useState(false);
|
|
9345
9283
|
const [paymentError, setPaymentError] = React__default.useState(null);
|
|
9346
9284
|
// Create payment intent when component mounts or when relevant data changes
|
|
@@ -9368,11 +9306,6 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
|
|
|
9368
9306
|
setIsCreatingPaymentIntent(true);
|
|
9369
9307
|
setPaymentError(null);
|
|
9370
9308
|
try {
|
|
9371
|
-
// Determine endpoint based on system mode
|
|
9372
|
-
const isConnectMode = systemConfig.systemMode === "connect";
|
|
9373
|
-
const endpoint = isConnectMode
|
|
9374
|
-
? "/booking/create-payment-intent"
|
|
9375
|
-
: "/booking-proxy/create-payment-intent";
|
|
9376
9309
|
// Build request data with validation
|
|
9377
9310
|
const requestData = {
|
|
9378
9311
|
eventInstanceId: config.eventInstanceId || eventDetails.id,
|
|
@@ -9381,7 +9314,11 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
|
|
|
9381
9314
|
currency: "eur",
|
|
9382
9315
|
participants: formData.participants.filter((p) => p.name?.trim()),
|
|
9383
9316
|
discountCode: discountCode?.code,
|
|
9317
|
+
customerName: formData.customerName?.trim(),
|
|
9384
9318
|
customerEmail: formData.customerEmail?.trim(),
|
|
9319
|
+
customerPhone: formData.customerPhone?.trim(),
|
|
9320
|
+
comment: formData.comment?.trim(),
|
|
9321
|
+
...(paymentIntentId && { paymentIntentId }), // Include existing payment intent ID if available
|
|
9385
9322
|
};
|
|
9386
9323
|
// Validate required fields
|
|
9387
9324
|
if (!requestData.eventInstanceId) {
|
|
@@ -9399,35 +9336,15 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
|
|
|
9399
9336
|
if (!requestData.customerEmail) {
|
|
9400
9337
|
throw new Error("Customer email is required");
|
|
9401
9338
|
}
|
|
9402
|
-
|
|
9403
|
-
endpoint,
|
|
9404
|
-
mode: isConnectMode ? "connect" : "apikey",
|
|
9405
|
-
amount: requestData.amount,
|
|
9406
|
-
currency: requestData.currency,
|
|
9407
|
-
participantCount: requestData.participants.length,
|
|
9408
|
-
organizationId: requestData.organizationId,
|
|
9409
|
-
eventInstanceId: requestData.eventInstanceId,
|
|
9410
|
-
});
|
|
9411
|
-
// Add mode-specific fields
|
|
9412
|
-
if (!isConnectMode) {
|
|
9413
|
-
// ApiKey mode needs additional fields
|
|
9414
|
-
Object.assign(requestData, {
|
|
9415
|
-
bookingSystemApiUrl: config.apiBaseUrl,
|
|
9416
|
-
// apiKey would be added here if required
|
|
9417
|
-
});
|
|
9418
|
-
}
|
|
9419
|
-
const response = await fetch(getApiUrl(config.apiBaseUrl, endpoint), {
|
|
9339
|
+
const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/create-payment-intent"), {
|
|
9420
9340
|
method: "POST",
|
|
9421
9341
|
headers: createApiHeaders(config),
|
|
9422
9342
|
body: JSON.stringify(createRequestBody(config, requestData)),
|
|
9423
9343
|
});
|
|
9424
9344
|
const data = await response.json();
|
|
9425
9345
|
if (response.ok) {
|
|
9426
|
-
console.log("[PAYMENT_FORM] Payment intent created successfully:", {
|
|
9427
|
-
hasClientSecret: !!data.clientSecret,
|
|
9428
|
-
clientSecretPrefix: `${data.clientSecret?.substring(0, 20)}...`,
|
|
9429
|
-
});
|
|
9430
9346
|
setClientSecret(data.clientSecret);
|
|
9347
|
+
setPaymentIntentId(data.paymentIntentId); // Save payment intent ID for future updates
|
|
9431
9348
|
}
|
|
9432
9349
|
else {
|
|
9433
9350
|
console.error("[PAYMENT_FORM] Payment intent creation failed:", {
|
|
@@ -9703,6 +9620,7 @@ const bookingFormSchema = objectType({
|
|
|
9703
9620
|
customerPhone: stringType().optional(),
|
|
9704
9621
|
participants: arrayType(participantSchema).min(1, "Mindestens ein Teilnehmer erforderlich"),
|
|
9705
9622
|
discountCode: stringType().optional(),
|
|
9623
|
+
comment: stringType().optional(),
|
|
9706
9624
|
acceptTerms: booleanType()
|
|
9707
9625
|
.refine((val) => val === true, "Bitte akzeptiere die Allgemeinen Geschäftsbedingungen"),
|
|
9708
9626
|
});
|
|
@@ -9718,6 +9636,7 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
|
|
|
9718
9636
|
defaultValues: {
|
|
9719
9637
|
participants: [{ name: "", age: undefined }],
|
|
9720
9638
|
discountCode: "",
|
|
9639
|
+
comment: "",
|
|
9721
9640
|
acceptTerms: false,
|
|
9722
9641
|
},
|
|
9723
9642
|
});
|
|
@@ -10104,6 +10023,36 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
|
|
|
10104
10023
|
backdropFilter: "blur(4px)",
|
|
10105
10024
|
borderRadius: "var(--bw-border-radius)",
|
|
10106
10025
|
padding: "var(--bw-spacing)",
|
|
10026
|
+
}, children: [jsxRuntime.jsx("label", { htmlFor: "booking-comment", style: {
|
|
10027
|
+
fontSize: "var(--bw-font-size)",
|
|
10028
|
+
fontWeight: "500",
|
|
10029
|
+
color: "var(--bw-text-color)",
|
|
10030
|
+
fontFamily: "var(--bw-font-family)",
|
|
10031
|
+
display: "block",
|
|
10032
|
+
marginBottom: "8px",
|
|
10033
|
+
}, children: "Kommentar (optional)" }), jsxRuntime.jsx("textarea", { id: "booking-comment", ...form.register("comment"), placeholder: "Zus\u00E4tzliche Anmerkungen zu Ihrer Buchung...", rows: 3, style: {
|
|
10034
|
+
width: "100%",
|
|
10035
|
+
padding: "12px",
|
|
10036
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10037
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10038
|
+
fontSize: "var(--bw-font-size)",
|
|
10039
|
+
fontFamily: "var(--bw-font-family)",
|
|
10040
|
+
backgroundColor: "var(--bw-input-bg)",
|
|
10041
|
+
color: "var(--bw-text-color)",
|
|
10042
|
+
resize: "vertical",
|
|
10043
|
+
minHeight: "80px",
|
|
10044
|
+
outline: "none",
|
|
10045
|
+
transition: "border-color 0.2s ease",
|
|
10046
|
+
}, onFocus: (e) => {
|
|
10047
|
+
e.target.style.borderColor = "var(--bw-highlight-color)";
|
|
10048
|
+
}, onBlur: (e) => {
|
|
10049
|
+
e.target.style.borderColor = "var(--bw-border-color)";
|
|
10050
|
+
} })] }), jsxRuntime.jsxs("div", { style: {
|
|
10051
|
+
backgroundColor: "var(--bw-surface-color)",
|
|
10052
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10053
|
+
backdropFilter: "blur(4px)",
|
|
10054
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10055
|
+
padding: "var(--bw-spacing)",
|
|
10107
10056
|
}, children: [jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [jsxRuntime.jsx("input", { id: "acceptTerms", ...form.register("acceptTerms"), type: "checkbox", style: {
|
|
10108
10057
|
marginTop: "4px",
|
|
10109
10058
|
width: "20px",
|
|
@@ -10276,162 +10225,339 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
|
|
|
10276
10225
|
` })] }) }));
|
|
10277
10226
|
}
|
|
10278
10227
|
|
|
10279
|
-
const BookingSuccessModal = ({ isOpen, onClose,
|
|
10280
|
-
|
|
10228
|
+
const BookingSuccessModal = ({ isOpen, onClose, config, onError, paymentIntentId, }) => {
|
|
10229
|
+
const [bookingData, setBookingData] = React__default.useState(null);
|
|
10230
|
+
const [eventDetails, setEventDetails] = React__default.useState(null);
|
|
10231
|
+
const [formData, setFormData] = React__default.useState(null);
|
|
10232
|
+
const [isLoading, setIsLoading] = React__default.useState(false);
|
|
10233
|
+
const [paymentStatus, setPaymentStatus] = React__default.useState(null);
|
|
10234
|
+
const fetchBookingData = async (intentId) => {
|
|
10235
|
+
const targetPaymentIntentId = paymentIntentId;
|
|
10236
|
+
// If we have payment intent ID, fetch from API
|
|
10237
|
+
if (targetPaymentIntentId) {
|
|
10238
|
+
setIsLoading(true);
|
|
10239
|
+
try {
|
|
10240
|
+
const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/get-booking-by-payment-intent"), {
|
|
10241
|
+
method: "POST",
|
|
10242
|
+
headers: createApiHeaders(config),
|
|
10243
|
+
body: JSON.stringify(createRequestBody(config, {
|
|
10244
|
+
paymentIntentId: targetPaymentIntentId,
|
|
10245
|
+
})),
|
|
10246
|
+
});
|
|
10247
|
+
const data = await response.json();
|
|
10248
|
+
if (response.ok) {
|
|
10249
|
+
setBookingData({
|
|
10250
|
+
booking: data.booking,
|
|
10251
|
+
order: data.order,
|
|
10252
|
+
payments: data.payments,
|
|
10253
|
+
orderItems: data.orderItems,
|
|
10254
|
+
stripePaymentIntent: data.stripePaymentIntent,
|
|
10255
|
+
});
|
|
10256
|
+
setEventDetails({
|
|
10257
|
+
id: data.booking.eventInstance.id,
|
|
10258
|
+
name: data.booking.eventInstance.eventType.name,
|
|
10259
|
+
description: data.booking.eventInstance.eventType.description,
|
|
10260
|
+
startTime: data.booking.eventInstance.startTime,
|
|
10261
|
+
endTime: data.booking.eventInstance.endTime,
|
|
10262
|
+
price: data.order.total / data.booking.participantCount,
|
|
10263
|
+
});
|
|
10264
|
+
setFormData({
|
|
10265
|
+
customerEmail: data.booking.customerEmail,
|
|
10266
|
+
customerName: data.booking.customerName,
|
|
10267
|
+
customerPhone: data.booking.customerPhone,
|
|
10268
|
+
participants: data.booking.participants || [],
|
|
10269
|
+
});
|
|
10270
|
+
// Set payment status from Stripe data or order status
|
|
10271
|
+
setPaymentStatus(data.stripePaymentIntent?.status || data.order.status);
|
|
10272
|
+
}
|
|
10273
|
+
else {
|
|
10274
|
+
onError?.(data.error || "Fehler beim Abrufen der Buchungsdaten");
|
|
10275
|
+
}
|
|
10276
|
+
}
|
|
10277
|
+
catch (err) {
|
|
10278
|
+
console.error("[BookingSuccessModal] Error fetching booking data:", err);
|
|
10279
|
+
onError?.("Ein Fehler ist bei der Verarbeitung aufgetreten.");
|
|
10280
|
+
}
|
|
10281
|
+
finally {
|
|
10282
|
+
setIsLoading(false);
|
|
10283
|
+
}
|
|
10284
|
+
return;
|
|
10285
|
+
}
|
|
10286
|
+
};
|
|
10287
|
+
React__default.useEffect(() => {
|
|
10288
|
+
if (isOpen) {
|
|
10289
|
+
fetchBookingData();
|
|
10290
|
+
}
|
|
10291
|
+
}, [isOpen, paymentIntentId, config, onError]);
|
|
10292
|
+
if (!isOpen)
|
|
10281
10293
|
return null;
|
|
10294
|
+
// Show loading state while fetching data
|
|
10295
|
+
if (isLoading || !bookingData) {
|
|
10296
|
+
return (jsxRuntime.jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsxRuntime.jsx("div", { style: {
|
|
10297
|
+
padding: "var(--bw-spacing-large)",
|
|
10298
|
+
textAlign: "center",
|
|
10299
|
+
minHeight: "200px",
|
|
10300
|
+
display: "flex",
|
|
10301
|
+
alignItems: "center",
|
|
10302
|
+
justifyContent: "center",
|
|
10303
|
+
}, children: jsxRuntime.jsx("div", { style: {
|
|
10304
|
+
color: "var(--bw-text-muted)",
|
|
10305
|
+
fontFamily: "var(--bw-font-family)",
|
|
10306
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10307
|
+
}, children: "Buchungsdaten werden geladen..." }) }) }));
|
|
10308
|
+
}
|
|
10282
10309
|
const booking = bookingData.booking;
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
|
|
10286
|
-
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
|
|
10294
|
-
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
fontWeight: "700",
|
|
10300
|
-
color: "var(--bw-text-color)",
|
|
10301
|
-
margin: "0 0 var(--bw-spacing-small) 0",
|
|
10302
|
-
fontFamily: "var(--bw-font-family)",
|
|
10303
|
-
}, children: "Buchung erfolgreich!" }), jsxRuntime.jsx("p", { style: {
|
|
10304
|
-
color: "var(--bw-text-muted)",
|
|
10305
|
-
fontFamily: "var(--bw-font-family)",
|
|
10306
|
-
margin: 0,
|
|
10307
|
-
}, children: "Deine Buchung wurde erfolgreich abgeschlossen." })] }), jsxRuntime.jsxs("div", { style: {
|
|
10308
|
-
backgroundColor: "var(--bw-surface-color)",
|
|
10309
|
-
border: `1px solid var(--bw-border-color)`,
|
|
10310
|
-
borderRadius: "var(--bw-border-radius)",
|
|
10311
|
-
padding: "var(--bw-spacing)",
|
|
10310
|
+
new Date(eventDetails.startTime);
|
|
10311
|
+
new Date(eventDetails.endTime);
|
|
10312
|
+
const handlePrint = () => {
|
|
10313
|
+
window.print();
|
|
10314
|
+
};
|
|
10315
|
+
const formatTime12 = (dateString) => {
|
|
10316
|
+
return formatTime(dateString, "Europe/Berlin", "de");
|
|
10317
|
+
};
|
|
10318
|
+
const formatDate12 = (dateString) => {
|
|
10319
|
+
return formatEventDate(dateString);
|
|
10320
|
+
};
|
|
10321
|
+
return (jsxRuntime.jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsxRuntime.jsxs("div", { style: {
|
|
10322
|
+
fontFamily: "var(--bw-font-family)",
|
|
10323
|
+
padding: "var(--bw-spacing-large)",
|
|
10324
|
+
maxWidth: "100%",
|
|
10325
|
+
}, children: [jsxRuntime.jsxs("div", { className: "flex justify-between items-center print-hidden", style: {
|
|
10312
10326
|
marginBottom: "var(--bw-spacing-large)",
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10327
|
+
display: "flex",
|
|
10328
|
+
alignItems: "center",
|
|
10329
|
+
justifyContent: "space-between",
|
|
10330
|
+
}, children: [jsxRuntime.jsxs("h1", { className: "font-bold text-3xl flex items-center gap-2", style: {
|
|
10316
10331
|
color: "var(--bw-text-color)",
|
|
10317
|
-
margin: "0 0 var(--bw-spacing) 0",
|
|
10318
10332
|
fontFamily: "var(--bw-font-family)",
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
color: "var(--bw-text-color)",
|
|
10329
|
-
fontWeight: "500",
|
|
10330
|
-
fontFamily: "var(--bw-font-family)",
|
|
10331
|
-
textAlign: "right",
|
|
10332
|
-
maxWidth: "60%",
|
|
10333
|
-
}, children: eventDetails.name })] }), jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Datum:" }), jsxRuntime.jsx("span", { style: {
|
|
10334
|
-
color: "var(--bw-text-color)",
|
|
10335
|
-
fontWeight: "500",
|
|
10336
|
-
fontFamily: "var(--bw-font-family)",
|
|
10337
|
-
textAlign: "right",
|
|
10338
|
-
maxWidth: "60%",
|
|
10339
|
-
}, children: formatEventDate(eventDetails.startTime) })] }), jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Uhrzeit:" }), jsxRuntime.jsx("span", { style: {
|
|
10340
|
-
color: "var(--bw-text-color)",
|
|
10341
|
-
fontWeight: "500",
|
|
10342
|
-
fontFamily: "var(--bw-font-family)",
|
|
10343
|
-
textAlign: "right",
|
|
10344
|
-
maxWidth: "60%",
|
|
10345
|
-
}, children: formatTime(eventDetails.startTime, "Europe/Berlin", "de") })] }), jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Teilnehmer:" }), jsxRuntime.jsx("span", { style: {
|
|
10346
|
-
color: "var(--bw-text-color)",
|
|
10347
|
-
fontWeight: "500",
|
|
10348
|
-
fontFamily: "var(--bw-font-family)",
|
|
10349
|
-
}, children: booking.participantCount })] }), jsxRuntime.jsxs("div", { style: {
|
|
10333
|
+
marginBottom: "var(--bw-spacing-large)",
|
|
10334
|
+
display: "flex",
|
|
10335
|
+
alignItems: "center",
|
|
10336
|
+
gap: "var(--bw-spacing-small)",
|
|
10337
|
+
}, children: [jsxRuntime.jsx("div", { style: {
|
|
10338
|
+
width: "32px",
|
|
10339
|
+
height: "32px",
|
|
10340
|
+
backgroundColor: "var(--bw-highlight-color, #10B981)",
|
|
10341
|
+
borderRadius: "50%",
|
|
10350
10342
|
display: "flex",
|
|
10351
|
-
justifyContent: "space-between",
|
|
10352
10343
|
alignItems: "center",
|
|
10353
|
-
|
|
10354
|
-
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
|
|
10361
|
-
|
|
10362
|
-
|
|
10363
|
-
fontSize: "var(--bw-font-size-large)",
|
|
10364
|
-
fontFamily: "var(--bw-font-family)",
|
|
10365
|
-
}, children: formatCurrency(booking.total) })] })] })] }), formData.participants && formData.participants.length > 0 && (jsxRuntime.jsxs("div", { style: {
|
|
10366
|
-
border: `1px solid var(--bw-border-color)`,
|
|
10367
|
-
borderRadius: "var(--bw-border-radius)",
|
|
10368
|
-
padding: "var(--bw-spacing)",
|
|
10369
|
-
marginBottom: "var(--bw-spacing-large)",
|
|
10370
|
-
}, children: [jsxRuntime.jsx("h3", { style: {
|
|
10371
|
-
fontSize: "var(--bw-font-size-large)",
|
|
10372
|
-
fontWeight: "600",
|
|
10344
|
+
justifyContent: "center",
|
|
10345
|
+
color: "white",
|
|
10346
|
+
}, children: "\u2713" }), jsxRuntime.jsx("p", { style: {
|
|
10347
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10348
|
+
fontWeight: "600",
|
|
10349
|
+
color: "var(--bw-highlight-color)",
|
|
10350
|
+
margin: "0px 10px",
|
|
10351
|
+
}, children: "Buchung erfolgreich erstellt!" })] }), jsxRuntime.jsx("button", { onClick: handlePrint, style: {
|
|
10352
|
+
backgroundColor: "transparent",
|
|
10353
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10373
10354
|
color: "var(--bw-text-color)",
|
|
10374
|
-
|
|
10355
|
+
padding: "8px 16px",
|
|
10356
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10357
|
+
cursor: "pointer",
|
|
10375
10358
|
fontFamily: "var(--bw-font-family)",
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10359
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10360
|
+
}, children: "Drucken" })] }), jsxRuntime.jsxs("div", { className: "print-only print-booking-header", children: [jsxRuntime.jsx("h1", { children: "Buchungsbest\u00E4tigung" }), jsxRuntime.jsx("div", { className: "subtitle", children: "Vielen Dank f\u00FCr deine Buchung! Hier sind deine Buchungsdetails." })] }), jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-large)" }, children: [jsxRuntime.jsxs("div", { className: "print-booking-card", style: {
|
|
10361
|
+
backgroundColor: "var(--bw-surface-color)",
|
|
10362
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10363
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10364
|
+
padding: "var(--bw-spacing)",
|
|
10365
|
+
marginBottom: "var(--bw-spacing-large)",
|
|
10366
|
+
}, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsx("h3", { style: {
|
|
10367
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10368
|
+
fontWeight: "600",
|
|
10385
10369
|
color: "var(--bw-text-color)",
|
|
10370
|
+
margin: "0",
|
|
10386
10371
|
fontFamily: "var(--bw-font-family)",
|
|
10387
|
-
}, children:
|
|
10388
|
-
|
|
10389
|
-
|
|
10372
|
+
}, children: "Buchungsdetails" }) }), jsxRuntime.jsx("div", { className: "print-only", children: jsxRuntime.jsx("div", { className: "print-section-title", children: "Buchungsdetails" }) }), jsxRuntime.jsxs("div", { className: "space-y-4 print-only:space-y-2 print-only:p-0", children: [jsxRuntime.jsxs("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
|
|
10373
|
+
display: "grid",
|
|
10374
|
+
gridTemplateColumns: "1fr 1fr",
|
|
10375
|
+
gap: "var(--bw-spacing)",
|
|
10376
|
+
}, children: [jsxRuntime.jsxs("div", { className: "print-detail-item", style: { marginBottom: "span 2" }, children: [jsxRuntime.jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
|
|
10377
|
+
color: "var(--bw-text-muted)",
|
|
10378
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10379
|
+
fontFamily: "var(--bw-font-family)",
|
|
10380
|
+
}, children: "Buchungs-ID" }), jsxRuntime.jsx("p", { className: "font-semibold print-detail-value", style: {
|
|
10381
|
+
fontWeight: "600",
|
|
10382
|
+
color: "var(--bw-text-color)",
|
|
10383
|
+
fontFamily: "var(--bw-font-family)",
|
|
10384
|
+
fontSize: "var(--bw-font-size-medium)",
|
|
10385
|
+
margin: "0px 0px 6px 0",
|
|
10386
|
+
}, children: booking.bookingHash })] }), jsxRuntime.jsxs("div", { className: "print-detail-item", children: [jsxRuntime.jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
|
|
10387
|
+
color: "var(--bw-text-muted)",
|
|
10388
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10389
|
+
fontFamily: "var(--bw-font-family)",
|
|
10390
|
+
}, children: "Bezahl-Status" }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("span", { className: "print-hidden", style: {
|
|
10391
|
+
backgroundColor: "var(--bw-success-color, #10B981)",
|
|
10392
|
+
color: "white",
|
|
10393
|
+
padding: "2px 8px",
|
|
10394
|
+
borderRadius: "var(--bw-border-radius-small)",
|
|
10395
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10396
|
+
fontFamily: "var(--bw-font-family)",
|
|
10397
|
+
width: "fit-content",
|
|
10398
|
+
}, children: paymentStatus === "succeeded"
|
|
10399
|
+
? "erfolgreich"
|
|
10400
|
+
: paymentStatus === "canceled" || paymentStatus === "failed"
|
|
10401
|
+
? "fehlgeschlagen"
|
|
10402
|
+
: "in Bearbeitung" }), jsxRuntime.jsx("span", { className: "print-only print-status-badge print-status-paid", children: "Bezahlt" })] })] })] }), jsxRuntime.jsxs("div", { className: "print-detail-item print-only:col-span-2", children: [jsxRuntime.jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
|
|
10403
|
+
color: "var(--bw-text-muted)",
|
|
10404
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10405
|
+
fontFamily: "var(--bw-font-family)",
|
|
10406
|
+
}, children: "Event" }), jsxRuntime.jsx("p", { className: "font-semibold print-detail-value", style: {
|
|
10407
|
+
fontWeight: "600",
|
|
10408
|
+
color: "var(--bw-text-color)",
|
|
10409
|
+
fontFamily: "var(--bw-font-family)",
|
|
10410
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10411
|
+
margin: "0 0 6px 0",
|
|
10412
|
+
}, children: eventDetails.name })] }), jsxRuntime.jsxs("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
|
|
10413
|
+
display: "grid",
|
|
10414
|
+
gridTemplateColumns: "1fr 1fr",
|
|
10415
|
+
gap: "var(--bw-spacing)",
|
|
10416
|
+
}, children: [jsxRuntime.jsxs("div", { className: "print-detail-item", children: [jsxRuntime.jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
|
|
10417
|
+
color: "var(--bw-text-muted)",
|
|
10418
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10419
|
+
fontFamily: "var(--bw-font-family)",
|
|
10420
|
+
}, children: "Datum" }), jsxRuntime.jsx("p", { className: "print-detail-value", style: {
|
|
10421
|
+
fontWeight: "600",
|
|
10422
|
+
color: "var(--bw-text-color)",
|
|
10423
|
+
fontFamily: "var(--bw-font-family)",
|
|
10424
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10425
|
+
margin: "0 0 6px 0",
|
|
10426
|
+
}, children: formatDate12(eventDetails.startTime) })] }), jsxRuntime.jsxs("div", { className: "print-detail-item", children: [jsxRuntime.jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
|
|
10427
|
+
color: "var(--bw-text-muted)",
|
|
10428
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10429
|
+
fontFamily: "var(--bw-font-family)",
|
|
10430
|
+
}, children: "Zeit" }), jsxRuntime.jsxs("p", { className: "print-detail-value", style: {
|
|
10431
|
+
fontWeight: "600",
|
|
10432
|
+
color: "var(--bw-text-color)",
|
|
10433
|
+
fontFamily: "var(--bw-font-family)",
|
|
10434
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10435
|
+
margin: "0 0 6px 0",
|
|
10436
|
+
}, children: [formatTime12(eventDetails.startTime), " - ", formatTime12(eventDetails.endTime)] })] })] })] })] }), formData.participants && formData.participants.length > 0 && (jsxRuntime.jsxs("div", { className: "print-booking-card", style: {
|
|
10437
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10438
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10439
|
+
padding: "var(--bw-spacing)",
|
|
10440
|
+
marginBottom: "var(--bw-spacing-large)",
|
|
10441
|
+
}, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsxs("h3", { style: {
|
|
10442
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10443
|
+
fontWeight: "600",
|
|
10444
|
+
color: "var(--bw-text-color)",
|
|
10445
|
+
margin: "0",
|
|
10390
10446
|
fontFamily: "var(--bw-font-family)",
|
|
10391
|
-
}, children: [
|
|
10392
|
-
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
|
|
10415
|
-
|
|
10416
|
-
|
|
10417
|
-
|
|
10418
|
-
|
|
10419
|
-
|
|
10420
|
-
|
|
10421
|
-
|
|
10422
|
-
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10447
|
+
}, children: ["Teilnehmer (", formData.participants.length, ")"] }) }), jsxRuntime.jsx("div", { className: "print-only", children: jsxRuntime.jsxs("div", { className: "print-section-title", children: ["Teilnehmer (", formData.participants.length, ")"] }) }), jsxRuntime.jsx("div", { className: "print-only:p-0", children: jsxRuntime.jsx("div", { className: "space-y-3 print-only:space-y-1", style: {
|
|
10448
|
+
display: "flex",
|
|
10449
|
+
flexDirection: "column",
|
|
10450
|
+
gap: "var(--bw-spacing-small)",
|
|
10451
|
+
}, children: formData.participants
|
|
10452
|
+
.filter((p) => p.name.trim())
|
|
10453
|
+
.map((participant, index) => (jsxRuntime.jsx("div", { className: "flex justify-between items-center bg-muted p-3 rounded-lg print-participant", style: {
|
|
10454
|
+
display: "flex",
|
|
10455
|
+
justifyContent: "space-between",
|
|
10456
|
+
alignItems: "center",
|
|
10457
|
+
backgroundColor: "var(--bw-surface-color, #f9fafb)",
|
|
10458
|
+
padding: "var(--bw-spacing-small)",
|
|
10459
|
+
borderRadius: "var(--bw-border-radius-small)",
|
|
10460
|
+
}, children: jsxRuntime.jsxs("div", { className: "print-participant-info", children: [jsxRuntime.jsx("div", { className: "print-participant-name", style: {
|
|
10461
|
+
color: "var(--bw-text-color)",
|
|
10462
|
+
fontFamily: "var(--bw-font-family)",
|
|
10463
|
+
}, children: participant.name }), participant.age && (jsxRuntime.jsxs("div", { className: "text-muted-foreground text-sm print-participant-age", style: {
|
|
10464
|
+
color: "var(--bw-text-muted)",
|
|
10465
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10466
|
+
fontFamily: "var(--bw-font-family)",
|
|
10467
|
+
}, children: [participant.age, " Jahre"] }))] }) }, index))) }) })] })), jsxRuntime.jsxs("div", { className: "print-booking-card", style: {
|
|
10468
|
+
backgroundColor: "var(--bw-surface-color)",
|
|
10469
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10470
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10471
|
+
padding: "var(--bw-spacing)",
|
|
10472
|
+
marginBottom: "var(--bw-spacing-large)",
|
|
10473
|
+
}, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsx("h3", { style: {
|
|
10474
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10475
|
+
fontWeight: "600",
|
|
10476
|
+
color: "var(--bw-text-color)",
|
|
10477
|
+
margin: "0",
|
|
10478
|
+
fontFamily: "var(--bw-font-family)",
|
|
10479
|
+
}, children: "Zahlungs\u00FCbersicht" }) }), jsxRuntime.jsx("div", { className: "print-only", children: jsxRuntime.jsx("div", { className: "print-section-title", children: "Zahlungs\u00FCbersicht" }) }), jsxRuntime.jsxs("div", { className: "space-y-2 print-only:p-0 print-only:space-y-1", children: [jsxRuntime.jsxs("div", { className: "print-payment-summary print-only", children: [jsxRuntime.jsxs("div", { className: "print-payment-row", children: [jsxRuntime.jsx("span", { children: "Gesamtbetrag" }), jsxRuntime.jsx("span", { children: formatCurrency(booking.total) })] }), jsxRuntime.jsxs("div", { className: "print-payment-row", children: [jsxRuntime.jsx("span", { children: "Bezahlt" }), jsxRuntime.jsx("span", { children: formatCurrency(booking.total) })] })] }), jsxRuntime.jsxs("div", { className: "print-hidden space-y-2", style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: [jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: "Gesamtbetrag" }), jsxRuntime.jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(booking.total) })] }), jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: "Bezahlt" }), jsxRuntime.jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(booking.total) })] })] })] })] }), jsxRuntime.jsxs("div", { className: "print-booking-card", style: {
|
|
10480
|
+
backgroundColor: "var(--bw-surface-color)",
|
|
10481
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10482
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10483
|
+
padding: "var(--bw-spacing)",
|
|
10484
|
+
marginBottom: "var(--bw-spacing-large)",
|
|
10485
|
+
}, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsx("h3", { style: {
|
|
10486
|
+
fontSize: "var(--bw-font-size-large)",
|
|
10487
|
+
fontWeight: "600",
|
|
10488
|
+
color: "var(--bw-text-color)",
|
|
10489
|
+
margin: "0",
|
|
10490
|
+
fontFamily: "var(--bw-font-family)",
|
|
10491
|
+
}, children: "Kontaktdaten" }) }), jsxRuntime.jsx("div", { className: "print-only", children: jsxRuntime.jsx("div", { className: "print-section-title", children: "Kontaktdaten" }) }), jsxRuntime.jsxs("div", { className: "space-y-2 print-only:p-0 print-only:space-y-1", style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: [jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Name:" }), jsxRuntime.jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerName })] }), jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "E-Mail:" }), jsxRuntime.jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerEmail })] }), formData.customerPhone && (jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsxRuntime.jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Telefon:" }), jsxRuntime.jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerPhone })] }))] })] }), jsxRuntime.jsx("div", { className: "print-booking-card", style: {
|
|
10492
|
+
backgroundColor: "var(--bw-surface-color)",
|
|
10493
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10494
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10495
|
+
padding: "var(--bw-spacing)",
|
|
10496
|
+
marginBottom: "var(--bw-spacing-large)",
|
|
10497
|
+
textAlign: "center",
|
|
10498
|
+
}, children: jsxRuntime.jsxs("p", { style: {
|
|
10499
|
+
color: "var(--bw-text-muted)",
|
|
10500
|
+
margin: 0,
|
|
10501
|
+
fontFamily: "var(--bw-font-family)",
|
|
10502
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10503
|
+
textAlign: "center",
|
|
10504
|
+
}, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] }) }), paymentStatus && paymentStatus !== "succeeded" && (jsxRuntime.jsxs("div", { style: {
|
|
10505
|
+
backgroundColor: "var(--bw-warning-bg, #FEF3C7)",
|
|
10506
|
+
border: "1px solid var(--bw-warning-border, #F59E0B)",
|
|
10507
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10508
|
+
padding: "var(--bw-spacing)",
|
|
10509
|
+
marginBottom: "var(--bw-spacing-large)",
|
|
10510
|
+
textAlign: "center",
|
|
10511
|
+
}, children: [jsxRuntime.jsx("p", { style: {
|
|
10512
|
+
color: "var(--bw-warning-text, #92400E)",
|
|
10513
|
+
margin: "0 0 var(--bw-spacing) 0",
|
|
10514
|
+
fontFamily: "var(--bw-font-family)",
|
|
10515
|
+
fontWeight: "600",
|
|
10516
|
+
}, children: "Zahlung wird noch verarbeitet" }), jsxRuntime.jsxs("p", { style: {
|
|
10517
|
+
color: "var(--bw-warning-text, #92400E)",
|
|
10518
|
+
margin: "0 0 var(--bw-spacing) 0",
|
|
10519
|
+
fontFamily: "var(--bw-font-family)",
|
|
10520
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10521
|
+
}, children: ["Status: ", paymentStatus] }), jsxRuntime.jsx("button", { onClick: () => fetchBookingData(), disabled: isLoading, style: {
|
|
10522
|
+
backgroundColor: "var(--bw-warning-text, #92400E)",
|
|
10523
|
+
color: "white",
|
|
10524
|
+
padding: "8px 16px",
|
|
10525
|
+
border: "none",
|
|
10526
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10527
|
+
fontSize: "var(--bw-font-size-small)",
|
|
10528
|
+
fontWeight: "600",
|
|
10529
|
+
cursor: isLoading ? "not-allowed" : "pointer",
|
|
10530
|
+
fontFamily: "var(--bw-font-family)",
|
|
10531
|
+
opacity: isLoading ? 0.6 : 1,
|
|
10532
|
+
transition: "all 0.2s ease",
|
|
10533
|
+
}, children: isLoading ? "Aktualisiere..." : "Status aktualisieren" })] })), jsxRuntime.jsx("div", { style: {
|
|
10534
|
+
textAlign: "center",
|
|
10535
|
+
marginTop: "var(--bw-spacing-large)",
|
|
10536
|
+
paddingTop: "var(--bw-spacing)",
|
|
10537
|
+
borderTop: `1px solid var(--bw-border-color)`,
|
|
10538
|
+
}, children: jsxRuntime.jsx("button", { onClick: onClose, style: {
|
|
10539
|
+
backgroundColor: "var(--bw-highlight-color)",
|
|
10540
|
+
color: "white",
|
|
10541
|
+
padding: "12px 32px",
|
|
10542
|
+
border: "none",
|
|
10543
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10544
|
+
fontSize: "var(--bw-font-size)",
|
|
10545
|
+
fontWeight: "600",
|
|
10546
|
+
cursor: "pointer",
|
|
10547
|
+
fontFamily: "var(--bw-font-family)",
|
|
10548
|
+
transition: "all 0.2s ease",
|
|
10549
|
+
}, onMouseEnter: (e) => {
|
|
10550
|
+
e.currentTarget.style.opacity = "0.9";
|
|
10551
|
+
}, onMouseLeave: (e) => {
|
|
10552
|
+
e.currentTarget.style.opacity = "1";
|
|
10553
|
+
}, children: "Schlie\u00DFen" }) }), jsxRuntime.jsxs("div", { className: "print-only print-footer", children: [jsxRuntime.jsxs("p", { children: ["Diese Buchungsbest\u00E4tigung wurde am", " ", new Date().toLocaleString("de-DE", {
|
|
10554
|
+
day: "2-digit",
|
|
10555
|
+
month: "2-digit",
|
|
10556
|
+
year: "numeric",
|
|
10557
|
+
hour: "2-digit",
|
|
10558
|
+
minute: "2-digit",
|
|
10559
|
+
timeZone: "Europe/Berlin",
|
|
10560
|
+
}), " ", "erstellt."] }), jsxRuntime.jsx("p", { children: "Bei Fragen zu deiner Buchung kontaktiere uns gerne." })] })] })] }) }));
|
|
10435
10561
|
};
|
|
10436
10562
|
|
|
10437
10563
|
const months = [
|
|
@@ -11547,7 +11673,7 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
11547
11673
|
const [isLoadingShowAll, setIsLoadingShowAll] = React__default.useState(false); // For "show all events" operation
|
|
11548
11674
|
const [error, setError] = React__default.useState(null);
|
|
11549
11675
|
const [isSuccess, setIsSuccess] = React__default.useState(false);
|
|
11550
|
-
const [
|
|
11676
|
+
const [successPaymentIntentId, setSuccessPaymentIntentId] = React__default.useState(null);
|
|
11551
11677
|
const [systemConfig, setSystemConfig] = React__default.useState(null);
|
|
11552
11678
|
// PERFORMANCE OPTIMIZATION: Lazy component loading
|
|
11553
11679
|
const [shouldRenderInstanceSelection, setShouldRenderInstanceSelection] = React__default.useState(false);
|
|
@@ -11594,6 +11720,29 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
11594
11720
|
initializeWidget();
|
|
11595
11721
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11596
11722
|
}, [config]);
|
|
11723
|
+
// Handle Stripe payment return
|
|
11724
|
+
React__default.useEffect(() => {
|
|
11725
|
+
const handleStripeReturn = () => {
|
|
11726
|
+
const stripeReturn = detectStripeReturn();
|
|
11727
|
+
if (stripeReturn) {
|
|
11728
|
+
if (stripeReturn.redirectStatus === "succeeded") {
|
|
11729
|
+
// Store payment intent ID and show success modal
|
|
11730
|
+
setSuccessPaymentIntentId(stripeReturn.paymentIntent);
|
|
11731
|
+
setIsSuccess(true);
|
|
11732
|
+
}
|
|
11733
|
+
else if (stripeReturn.redirectStatus === "failed") {
|
|
11734
|
+
setError("Die Zahlung war nicht erfolgreich. Bitte versuche es erneut.");
|
|
11735
|
+
}
|
|
11736
|
+
else {
|
|
11737
|
+
setError("Die Zahlung konnte nicht abgeschlossen werden. Bitte versuche es erneut.");
|
|
11738
|
+
}
|
|
11739
|
+
}
|
|
11740
|
+
};
|
|
11741
|
+
// Only run on mount to avoid running multiple times
|
|
11742
|
+
if (!isLoading) {
|
|
11743
|
+
handleStripeReturn();
|
|
11744
|
+
}
|
|
11745
|
+
}, [isLoading]); // Only depend on isLoading to run after initial load
|
|
11597
11746
|
// PERFORMANCE OPTIMIZATION: Lazy load components when needed
|
|
11598
11747
|
React__default.useEffect(() => {
|
|
11599
11748
|
if (currentStep === "eventInstances" && !shouldRenderInstanceSelection) {
|
|
@@ -11836,7 +11985,7 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
11836
11985
|
};
|
|
11837
11986
|
const handleBookingSuccess = (result) => {
|
|
11838
11987
|
setIsSuccess(true);
|
|
11839
|
-
|
|
11988
|
+
setSuccessPaymentIntentId(result.paymentIntent.id);
|
|
11840
11989
|
config.onSuccess?.(result);
|
|
11841
11990
|
};
|
|
11842
11991
|
const handleBookingError = (errorMessage) => {
|
|
@@ -12019,10 +12168,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
12019
12168
|
setIsSuccess(false);
|
|
12020
12169
|
setCurrentStep("eventTypes");
|
|
12021
12170
|
setShowingPreview(true);
|
|
12171
|
+
// Reset state
|
|
12172
|
+
setSuccessPaymentIntentId(null);
|
|
12022
12173
|
// Reset lazy loading flags
|
|
12023
12174
|
setShouldRenderInstanceSelection(false);
|
|
12024
12175
|
setShouldRenderBookingForm(false);
|
|
12025
|
-
|
|
12176
|
+
// Clean up URL to remove Stripe parameters
|
|
12177
|
+
const url = new URL(window.location.href);
|
|
12178
|
+
url.searchParams.delete("payment_intent");
|
|
12179
|
+
url.searchParams.delete("payment_intent_client_secret");
|
|
12180
|
+
url.searchParams.delete("redirect_status");
|
|
12181
|
+
window.history.replaceState({}, "", url.toString());
|
|
12182
|
+
}, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
|
|
12026
12183
|
}
|
|
12027
12184
|
if (viewMode === "next-events" && !showingPreview && currentStep === "eventInstances") {
|
|
12028
12185
|
// Show all events for the single event type
|
|
@@ -12036,10 +12193,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
12036
12193
|
setIsSuccess(false);
|
|
12037
12194
|
setCurrentStep("eventTypes");
|
|
12038
12195
|
setShowingPreview(true);
|
|
12196
|
+
// Reset state
|
|
12197
|
+
setSuccessPaymentIntentId(null);
|
|
12039
12198
|
// Reset lazy loading flags
|
|
12040
12199
|
setShouldRenderInstanceSelection(false);
|
|
12041
12200
|
setShouldRenderBookingForm(false);
|
|
12042
|
-
|
|
12201
|
+
// Clean up URL to remove Stripe parameters
|
|
12202
|
+
const url = new URL(window.location.href);
|
|
12203
|
+
url.searchParams.delete("payment_intent");
|
|
12204
|
+
url.searchParams.delete("payment_intent_client_secret");
|
|
12205
|
+
url.searchParams.delete("redirect_status");
|
|
12206
|
+
window.history.replaceState({}, "", url.toString());
|
|
12207
|
+
}, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
|
|
12043
12208
|
}
|
|
12044
12209
|
if (viewMode === "button" && (isSingleEventTypeMode || isDirectInstanceMode)) {
|
|
12045
12210
|
// Button mode - show button that opens sidebar/booking directly
|
|
@@ -12073,10 +12238,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
12073
12238
|
setIsSuccess(false);
|
|
12074
12239
|
setCurrentStep("eventTypes");
|
|
12075
12240
|
setSidebarOpen(false);
|
|
12241
|
+
// Reset state
|
|
12242
|
+
setSuccessPaymentIntentId(null);
|
|
12076
12243
|
// Reset lazy loading flags
|
|
12077
12244
|
setShouldRenderInstanceSelection(false);
|
|
12078
12245
|
setShouldRenderBookingForm(false);
|
|
12079
|
-
|
|
12246
|
+
// Clean up URL to remove Stripe parameters
|
|
12247
|
+
const url = new URL(window.location.href);
|
|
12248
|
+
url.searchParams.delete("payment_intent");
|
|
12249
|
+
url.searchParams.delete("payment_intent_client_secret");
|
|
12250
|
+
url.searchParams.delete("redirect_status");
|
|
12251
|
+
window.history.replaceState({}, "", url.toString());
|
|
12252
|
+
}, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }) }));
|
|
12080
12253
|
}
|
|
12081
12254
|
// Cards mode (default) - show event type selection
|
|
12082
12255
|
const cardsView = (jsxRuntime.jsx(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount() }));
|
|
@@ -12112,10 +12285,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
12112
12285
|
return (jsxRuntime.jsxs(StyleProvider, { config: config, children: [cardsView, shouldRenderInstanceSelection && (jsxRuntime.jsx(EventInstanceSelection, { eventInstances: eventInstances, selectedEventType: selectedEventType, onEventInstanceSelect: handleEventInstanceSelect, onBackToEventTypes: handleBackToEventTypes, isOpen: currentStep === "eventInstances", onClose: handleBackToEventTypes, isLoadingEventInstances: isLoadingEventInstances, isLoadingEventDetails: isLoadingEventDetails })), shouldRenderBookingForm && eventDetails && (jsxRuntime.jsx(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError, onBackToEventInstances: backHandlers.onBackToEventInstances, onBackToEventTypes: backHandlers.onBackToEventTypes, selectedEventType: selectedEventType, selectedEventInstance: selectedEventInstance, isOpen: currentStep === "booking" && !!eventDetails, onClose: backHandlers.onClose, systemConfig: systemConfig })), jsxRuntime.jsx(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
|
|
12113
12286
|
setIsSuccess(false);
|
|
12114
12287
|
setCurrentStep("eventTypes");
|
|
12288
|
+
// Reset state
|
|
12289
|
+
setSuccessPaymentIntentId(null);
|
|
12115
12290
|
// Reset lazy loading flags
|
|
12116
12291
|
setShouldRenderInstanceSelection(false);
|
|
12117
12292
|
setShouldRenderBookingForm(false);
|
|
12118
|
-
|
|
12293
|
+
// Clean up URL to remove Stripe parameters
|
|
12294
|
+
const url = new URL(window.location.href);
|
|
12295
|
+
url.searchParams.delete("payment_intent");
|
|
12296
|
+
url.searchParams.delete("payment_intent_client_secret");
|
|
12297
|
+
url.searchParams.delete("redirect_status");
|
|
12298
|
+
window.history.replaceState({}, "", url.toString());
|
|
12299
|
+
}, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
|
|
12119
12300
|
}
|
|
12120
12301
|
|
|
12121
12302
|
// Export init function for vanilla JS usage
|