@bigz-app/booking-widget 0.1.25 → 0.2.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/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, systemConfig, clientSecret, }) {
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: "https://bigz.surfschule-zingst.de/booking/success",
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 {
@@ -9368,11 +9305,6 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9368
9305
  setIsCreatingPaymentIntent(true);
9369
9306
  setPaymentError(null);
9370
9307
  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
9308
  // Build request data with validation
9377
9309
  const requestData = {
9378
9310
  eventInstanceId: config.eventInstanceId || eventDetails.id,
@@ -9381,7 +9313,10 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9381
9313
  currency: "eur",
9382
9314
  participants: formData.participants.filter((p) => p.name?.trim()),
9383
9315
  discountCode: discountCode?.code,
9316
+ customerName: formData.customerName?.trim(),
9384
9317
  customerEmail: formData.customerEmail?.trim(),
9318
+ customerPhone: formData.customerPhone?.trim(),
9319
+ comment: formData.comment?.trim(),
9385
9320
  };
9386
9321
  // Validate required fields
9387
9322
  if (!requestData.eventInstanceId) {
@@ -9399,34 +9334,13 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9399
9334
  if (!requestData.customerEmail) {
9400
9335
  throw new Error("Customer email is required");
9401
9336
  }
9402
- console.log("[PAYMENT_FORM] Creating payment intent:", {
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), {
9337
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/create-payment-intent"), {
9420
9338
  method: "POST",
9421
9339
  headers: createApiHeaders(config),
9422
9340
  body: JSON.stringify(createRequestBody(config, requestData)),
9423
9341
  });
9424
9342
  const data = await response.json();
9425
9343
  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
9344
  setClientSecret(data.clientSecret);
9431
9345
  }
9432
9346
  else {
@@ -10276,162 +10190,339 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
10276
10190
  ` })] }) }));
10277
10191
  }
10278
10192
 
10279
- const BookingSuccessModal = ({ isOpen, onClose, bookingData, eventDetails, formData, config, }) => {
10280
- if (!isOpen || !bookingData)
10193
+ const BookingSuccessModal = ({ isOpen, onClose, config, onError, paymentIntentId, }) => {
10194
+ const [bookingData, setBookingData] = React__default.useState(null);
10195
+ const [eventDetails, setEventDetails] = React__default.useState(null);
10196
+ const [formData, setFormData] = React__default.useState(null);
10197
+ const [isLoading, setIsLoading] = React__default.useState(false);
10198
+ const [paymentStatus, setPaymentStatus] = React__default.useState(null);
10199
+ const fetchBookingData = async (intentId) => {
10200
+ const targetPaymentIntentId = paymentIntentId;
10201
+ // If we have payment intent ID, fetch from API
10202
+ if (targetPaymentIntentId) {
10203
+ setIsLoading(true);
10204
+ try {
10205
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/get-booking-by-payment-intent"), {
10206
+ method: "POST",
10207
+ headers: createApiHeaders(config),
10208
+ body: JSON.stringify(createRequestBody(config, {
10209
+ paymentIntentId: targetPaymentIntentId,
10210
+ })),
10211
+ });
10212
+ const data = await response.json();
10213
+ if (response.ok) {
10214
+ setBookingData({
10215
+ booking: data.booking,
10216
+ order: data.order,
10217
+ payments: data.payments,
10218
+ orderItems: data.orderItems,
10219
+ stripePaymentIntent: data.stripePaymentIntent,
10220
+ });
10221
+ setEventDetails({
10222
+ id: data.booking.eventInstance.id,
10223
+ name: data.booking.eventInstance.eventType.name,
10224
+ description: data.booking.eventInstance.eventType.description,
10225
+ startTime: data.booking.eventInstance.startTime,
10226
+ endTime: data.booking.eventInstance.endTime,
10227
+ price: data.order.total / data.booking.participantCount,
10228
+ });
10229
+ setFormData({
10230
+ customerEmail: data.booking.customerEmail,
10231
+ customerName: data.booking.customerName,
10232
+ customerPhone: data.booking.customerPhone,
10233
+ participants: data.booking.participants || [],
10234
+ });
10235
+ // Set payment status from Stripe data or order status
10236
+ setPaymentStatus(data.stripePaymentIntent?.status || data.order.status);
10237
+ }
10238
+ else {
10239
+ onError?.(data.error || "Fehler beim Abrufen der Buchungsdaten");
10240
+ }
10241
+ }
10242
+ catch (err) {
10243
+ console.error("[BookingSuccessModal] Error fetching booking data:", err);
10244
+ onError?.("Ein Fehler ist bei der Verarbeitung aufgetreten.");
10245
+ }
10246
+ finally {
10247
+ setIsLoading(false);
10248
+ }
10249
+ return;
10250
+ }
10251
+ };
10252
+ React__default.useEffect(() => {
10253
+ if (isOpen) {
10254
+ fetchBookingData();
10255
+ }
10256
+ }, [isOpen, paymentIntentId, config, onError]);
10257
+ if (!isOpen)
10281
10258
  return null;
10259
+ // Show loading state while fetching data
10260
+ if (isLoading || !bookingData) {
10261
+ return (jsxRuntime.jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsxRuntime.jsx("div", { style: {
10262
+ padding: "var(--bw-spacing-large)",
10263
+ textAlign: "center",
10264
+ minHeight: "200px",
10265
+ display: "flex",
10266
+ alignItems: "center",
10267
+ justifyContent: "center",
10268
+ }, children: jsxRuntime.jsx("div", { style: {
10269
+ color: "var(--bw-text-muted)",
10270
+ fontFamily: "var(--bw-font-family)",
10271
+ fontSize: "var(--bw-font-size-large)",
10272
+ }, children: "Buchungsdaten werden geladen..." }) }) }));
10273
+ }
10282
10274
  const booking = bookingData.booking;
10283
- return (jsxRuntime.jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsxRuntime.jsxs("div", { style: { padding: "var(--bw-spacing-large)" }, children: [jsxRuntime.jsxs("div", { style: {
10284
- textAlign: "center",
10285
- marginBottom: "var(--bw-spacing-large)",
10286
- }, children: [jsxRuntime.jsx("div", { style: {
10287
- width: "64px",
10288
- height: "64px",
10289
- backgroundColor: "var(--bw-success-color, #10B981)",
10290
- borderRadius: "50%",
10291
- margin: "0 auto var(--bw-spacing)",
10292
- display: "flex",
10293
- alignItems: "center",
10294
- justifyContent: "center",
10295
- fontSize: "32px",
10296
- color: "white",
10297
- }, children: "\u2713" }), jsxRuntime.jsx("h2", { style: {
10298
- fontSize: "var(--bw-font-size-xl)",
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)",
10275
+ new Date(eventDetails.startTime);
10276
+ new Date(eventDetails.endTime);
10277
+ const handlePrint = () => {
10278
+ window.print();
10279
+ };
10280
+ const formatTime12 = (dateString) => {
10281
+ return formatTime(dateString, "Europe/Berlin", "de");
10282
+ };
10283
+ const formatDate12 = (dateString) => {
10284
+ return formatEventDate(dateString);
10285
+ };
10286
+ return (jsxRuntime.jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsxRuntime.jsxs("div", { style: {
10287
+ fontFamily: "var(--bw-font-family)",
10288
+ padding: "var(--bw-spacing-large)",
10289
+ maxWidth: "100%",
10290
+ }, children: [jsxRuntime.jsxs("div", { className: "flex justify-between items-center print-hidden", style: {
10312
10291
  marginBottom: "var(--bw-spacing-large)",
10313
- }, children: [jsxRuntime.jsx("h3", { style: {
10314
- fontSize: "var(--bw-font-size-large)",
10315
- fontWeight: "600",
10292
+ display: "flex",
10293
+ alignItems: "center",
10294
+ justifyContent: "space-between",
10295
+ }, children: [jsxRuntime.jsxs("h1", { className: "font-bold text-3xl flex items-center gap-2", style: {
10316
10296
  color: "var(--bw-text-color)",
10317
- margin: "0 0 var(--bw-spacing) 0",
10318
10297
  fontFamily: "var(--bw-font-family)",
10319
- }, children: "Buchungsdetails" }), jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing)" }, children: [booking.bookingHash && (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: "Buchungs-ID:" }), jsxRuntime.jsx("span", { style: {
10320
- color: "var(--bw-text-color)",
10321
- fontWeight: "500",
10322
- fontFamily: "monospace",
10323
- fontSize: "var(--bw-font-size-small)",
10324
- backgroundColor: "var(--bw-background-color)",
10325
- padding: "4px 8px",
10326
- borderRadius: "var(--bw-border-radius-small)",
10327
- }, children: booking.bookingHash })] })), 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: "Event:" }), jsxRuntime.jsx("span", { style: {
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: {
10298
+ marginBottom: "var(--bw-spacing-large)",
10299
+ display: "flex",
10300
+ alignItems: "center",
10301
+ gap: "var(--bw-spacing-small)",
10302
+ }, children: [jsxRuntime.jsx("div", { style: {
10303
+ width: "32px",
10304
+ height: "32px",
10305
+ backgroundColor: "var(--bw-highlight-color, #10B981)",
10306
+ borderRadius: "50%",
10350
10307
  display: "flex",
10351
- justifyContent: "space-between",
10352
10308
  alignItems: "center",
10353
- borderTop: `1px solid var(--bw-border-color)`,
10354
- paddingTop: "var(--bw-spacing)",
10355
- marginTop: "var(--bw-spacing)",
10356
- }, children: [jsxRuntime.jsx("span", { style: {
10357
- color: "var(--bw-text-color)",
10358
- fontWeight: "600",
10359
- fontFamily: "var(--bw-font-family)",
10360
- }, children: "Gesamtbetrag:" }), jsxRuntime.jsx("span", { style: {
10361
- color: "var(--bw-text-color)",
10362
- fontWeight: "600",
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",
10309
+ justifyContent: "center",
10310
+ color: "white",
10311
+ }, children: "\u2713" }), jsxRuntime.jsx("p", { style: {
10312
+ fontSize: "var(--bw-font-size-large)",
10313
+ fontWeight: "600",
10314
+ color: "var(--bw-highlight-color)",
10315
+ margin: "0px 10px",
10316
+ }, children: "Buchung erfolgreich erstellt!" })] }), jsxRuntime.jsx("button", { onClick: handlePrint, style: {
10317
+ backgroundColor: "transparent",
10318
+ border: `1px solid var(--bw-border-color)`,
10373
10319
  color: "var(--bw-text-color)",
10374
- margin: "0 0 var(--bw-spacing) 0",
10320
+ padding: "8px 16px",
10321
+ borderRadius: "var(--bw-border-radius)",
10322
+ cursor: "pointer",
10375
10323
  fontFamily: "var(--bw-font-family)",
10376
- }, children: "Teilnehmer" }), jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: formData.participants
10377
- .filter((p) => p.name.trim())
10378
- .map((participant, index) => (jsxRuntime.jsxs("div", { style: {
10379
- display: "flex",
10380
- justifyContent: "space-between",
10381
- alignItems: "center",
10382
- padding: "var(--bw-spacing-small)",
10383
- borderRadius: "var(--bw-border-radius-small)",
10384
- }, children: [jsxRuntime.jsx("span", { style: {
10324
+ fontSize: "var(--bw-font-size-small)",
10325
+ }, 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: {
10326
+ backgroundColor: "var(--bw-surface-color)",
10327
+ border: `1px solid var(--bw-border-color)`,
10328
+ borderRadius: "var(--bw-border-radius)",
10329
+ padding: "var(--bw-spacing)",
10330
+ marginBottom: "var(--bw-spacing-large)",
10331
+ }, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsx("h3", { style: {
10332
+ fontSize: "var(--bw-font-size-large)",
10333
+ fontWeight: "600",
10385
10334
  color: "var(--bw-text-color)",
10335
+ margin: "0",
10386
10336
  fontFamily: "var(--bw-font-family)",
10387
- }, children: participant.name }), participant.age && (jsxRuntime.jsxs("span", { style: {
10388
- color: "var(--bw-text-muted)",
10389
- fontSize: "var(--bw-font-size-small)",
10337
+ }, 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: {
10338
+ display: "grid",
10339
+ gridTemplateColumns: "1fr 1fr",
10340
+ gap: "var(--bw-spacing)",
10341
+ }, 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: {
10342
+ color: "var(--bw-text-muted)",
10343
+ fontSize: "var(--bw-font-size-small)",
10344
+ fontFamily: "var(--bw-font-family)",
10345
+ }, children: "Buchungs-ID" }), jsxRuntime.jsx("p", { className: "font-semibold print-detail-value", style: {
10346
+ fontWeight: "600",
10347
+ color: "var(--bw-text-color)",
10348
+ fontFamily: "var(--bw-font-family)",
10349
+ fontSize: "var(--bw-font-size-medium)",
10350
+ margin: "0px 0px 6px 0",
10351
+ }, 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: {
10352
+ color: "var(--bw-text-muted)",
10353
+ fontSize: "var(--bw-font-size-small)",
10354
+ fontFamily: "var(--bw-font-family)",
10355
+ }, children: "Bezahl-Status" }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("span", { className: "print-hidden", style: {
10356
+ backgroundColor: "var(--bw-success-color, #10B981)",
10357
+ color: "white",
10358
+ padding: "2px 8px",
10359
+ borderRadius: "var(--bw-border-radius-small)",
10360
+ fontSize: "var(--bw-font-size-small)",
10361
+ fontFamily: "var(--bw-font-family)",
10362
+ width: "fit-content",
10363
+ }, children: paymentStatus === "succeeded"
10364
+ ? "erfolgreich"
10365
+ : paymentStatus === "canceled" || paymentStatus === "failed"
10366
+ ? "fehlgeschlagen"
10367
+ : "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: {
10368
+ color: "var(--bw-text-muted)",
10369
+ fontSize: "var(--bw-font-size-small)",
10370
+ fontFamily: "var(--bw-font-family)",
10371
+ }, children: "Event" }), jsxRuntime.jsx("p", { className: "font-semibold print-detail-value", style: {
10372
+ fontWeight: "600",
10373
+ color: "var(--bw-text-color)",
10374
+ fontFamily: "var(--bw-font-family)",
10375
+ fontSize: "var(--bw-font-size-large)",
10376
+ margin: "0 0 6px 0",
10377
+ }, children: eventDetails.name })] }), jsxRuntime.jsxs("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
10378
+ display: "grid",
10379
+ gridTemplateColumns: "1fr 1fr",
10380
+ gap: "var(--bw-spacing)",
10381
+ }, children: [jsxRuntime.jsxs("div", { className: "print-detail-item", children: [jsxRuntime.jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10382
+ color: "var(--bw-text-muted)",
10383
+ fontSize: "var(--bw-font-size-small)",
10384
+ fontFamily: "var(--bw-font-family)",
10385
+ }, children: "Datum" }), jsxRuntime.jsx("p", { className: "print-detail-value", style: {
10386
+ fontWeight: "600",
10387
+ color: "var(--bw-text-color)",
10388
+ fontFamily: "var(--bw-font-family)",
10389
+ fontSize: "var(--bw-font-size-large)",
10390
+ margin: "0 0 6px 0",
10391
+ }, 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: {
10392
+ color: "var(--bw-text-muted)",
10393
+ fontSize: "var(--bw-font-size-small)",
10394
+ fontFamily: "var(--bw-font-family)",
10395
+ }, children: "Zeit" }), jsxRuntime.jsxs("p", { className: "print-detail-value", style: {
10396
+ fontWeight: "600",
10397
+ color: "var(--bw-text-color)",
10398
+ fontFamily: "var(--bw-font-family)",
10399
+ fontSize: "var(--bw-font-size-large)",
10400
+ margin: "0 0 6px 0",
10401
+ }, children: [formatTime12(eventDetails.startTime), " - ", formatTime12(eventDetails.endTime)] })] })] })] })] }), formData.participants && formData.participants.length > 0 && (jsxRuntime.jsxs("div", { className: "print-booking-card", style: {
10402
+ border: `1px solid var(--bw-border-color)`,
10403
+ borderRadius: "var(--bw-border-radius)",
10404
+ padding: "var(--bw-spacing)",
10405
+ marginBottom: "var(--bw-spacing-large)",
10406
+ }, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsxs("h3", { style: {
10407
+ fontSize: "var(--bw-font-size-large)",
10408
+ fontWeight: "600",
10409
+ color: "var(--bw-text-color)",
10410
+ margin: "0",
10390
10411
  fontFamily: "var(--bw-font-family)",
10391
- }, children: [participant.age, " Jahre"] }))] }, index))) })] })), jsxRuntime.jsxs("div", { style: {
10392
- backgroundColor: "var(--bw-surface-color)",
10393
- border: `1px solid var(--bw-border-color)`,
10394
- borderRadius: "var(--bw-border-radius)",
10395
- padding: "var(--bw-spacing)",
10396
- marginBottom: "var(--bw-spacing-large)",
10397
- }, children: [jsxRuntime.jsx("h3", { style: {
10398
- fontSize: "var(--bw-font-size-large)",
10399
- fontWeight: "600",
10400
- color: "var(--bw-text-color)",
10401
- margin: "0 0 var(--bw-spacing) 0",
10402
- fontFamily: "var(--bw-font-family)",
10403
- }, children: "Kontaktdaten" }), jsxRuntime.jsxs("div", { 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.jsxs("div", { style: {
10404
- backgroundColor: "var(--bw-surface-muted-bg, rgba(59, 130, 246, 0.05))",
10405
- border: `1px solid var(--bw-border-color)`,
10406
- borderRadius: "var(--bw-border-radius)",
10407
- padding: "var(--bw-spacing)",
10408
- marginBottom: "var(--bw-spacing-large)",
10409
- textAlign: "center",
10410
- }, children: [jsxRuntime.jsx("div", { style: {
10411
- color: "var(--bw-highlight-color)",
10412
- fontSize: "24px",
10413
- marginBottom: "var(--bw-spacing-small)",
10414
- }, children: "\uD83D\uDCE7" }), jsxRuntime.jsxs("p", { style: {
10415
- color: "var(--bw-text-muted)",
10416
- margin: 0,
10417
- fontFamily: "var(--bw-font-family)",
10418
- fontSize: "var(--bw-font-size-small)",
10419
- }, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] })] }), jsxRuntime.jsx("div", { style: { textAlign: "center" }, children: jsxRuntime.jsx("button", { onClick: onClose, style: {
10420
- backgroundColor: "var(--bw-highlight-color)",
10421
- color: "white",
10422
- padding: "12px 32px",
10423
- border: "none",
10424
- borderRadius: "var(--bw-border-radius)",
10425
- fontSize: "var(--bw-font-size)",
10426
- fontWeight: "600",
10427
- cursor: "pointer",
10428
- fontFamily: "var(--bw-font-family)",
10429
- transition: "all 0.2s ease",
10430
- }, onMouseEnter: (e) => {
10431
- e.currentTarget.style.opacity = "0.9";
10432
- }, onMouseLeave: (e) => {
10433
- e.currentTarget.style.opacity = "1";
10434
- }, children: "Schlie\u00DFen" }) })] }) }));
10412
+ }, 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: {
10413
+ display: "flex",
10414
+ flexDirection: "column",
10415
+ gap: "var(--bw-spacing-small)",
10416
+ }, children: formData.participants
10417
+ .filter((p) => p.name.trim())
10418
+ .map((participant, index) => (jsxRuntime.jsx("div", { className: "flex justify-between items-center bg-muted p-3 rounded-lg print-participant", style: {
10419
+ display: "flex",
10420
+ justifyContent: "space-between",
10421
+ alignItems: "center",
10422
+ backgroundColor: "var(--bw-surface-color, #f9fafb)",
10423
+ padding: "var(--bw-spacing-small)",
10424
+ borderRadius: "var(--bw-border-radius-small)",
10425
+ }, children: jsxRuntime.jsxs("div", { className: "print-participant-info", children: [jsxRuntime.jsx("div", { className: "print-participant-name", style: {
10426
+ color: "var(--bw-text-color)",
10427
+ fontFamily: "var(--bw-font-family)",
10428
+ }, children: participant.name }), participant.age && (jsxRuntime.jsxs("div", { className: "text-muted-foreground text-sm print-participant-age", style: {
10429
+ color: "var(--bw-text-muted)",
10430
+ fontSize: "var(--bw-font-size-small)",
10431
+ fontFamily: "var(--bw-font-family)",
10432
+ }, children: [participant.age, " Jahre"] }))] }) }, index))) }) })] })), jsxRuntime.jsxs("div", { className: "print-booking-card", style: {
10433
+ backgroundColor: "var(--bw-surface-color)",
10434
+ border: `1px solid var(--bw-border-color)`,
10435
+ borderRadius: "var(--bw-border-radius)",
10436
+ padding: "var(--bw-spacing)",
10437
+ marginBottom: "var(--bw-spacing-large)",
10438
+ }, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsx("h3", { style: {
10439
+ fontSize: "var(--bw-font-size-large)",
10440
+ fontWeight: "600",
10441
+ color: "var(--bw-text-color)",
10442
+ margin: "0",
10443
+ fontFamily: "var(--bw-font-family)",
10444
+ }, 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: {
10445
+ backgroundColor: "var(--bw-surface-color)",
10446
+ border: `1px solid var(--bw-border-color)`,
10447
+ borderRadius: "var(--bw-border-radius)",
10448
+ padding: "var(--bw-spacing)",
10449
+ marginBottom: "var(--bw-spacing-large)",
10450
+ }, children: [jsxRuntime.jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxRuntime.jsx("h3", { style: {
10451
+ fontSize: "var(--bw-font-size-large)",
10452
+ fontWeight: "600",
10453
+ color: "var(--bw-text-color)",
10454
+ margin: "0",
10455
+ fontFamily: "var(--bw-font-family)",
10456
+ }, 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: {
10457
+ backgroundColor: "var(--bw-surface-color)",
10458
+ border: `1px solid var(--bw-border-color)`,
10459
+ borderRadius: "var(--bw-border-radius)",
10460
+ padding: "var(--bw-spacing)",
10461
+ marginBottom: "var(--bw-spacing-large)",
10462
+ textAlign: "center",
10463
+ }, children: jsxRuntime.jsxs("p", { style: {
10464
+ color: "var(--bw-text-muted)",
10465
+ margin: 0,
10466
+ fontFamily: "var(--bw-font-family)",
10467
+ fontSize: "var(--bw-font-size-small)",
10468
+ textAlign: "center",
10469
+ }, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] }) }), paymentStatus && paymentStatus !== "succeeded" && (jsxRuntime.jsxs("div", { style: {
10470
+ backgroundColor: "var(--bw-warning-bg, #FEF3C7)",
10471
+ border: "1px solid var(--bw-warning-border, #F59E0B)",
10472
+ borderRadius: "var(--bw-border-radius)",
10473
+ padding: "var(--bw-spacing)",
10474
+ marginBottom: "var(--bw-spacing-large)",
10475
+ textAlign: "center",
10476
+ }, children: [jsxRuntime.jsx("p", { style: {
10477
+ color: "var(--bw-warning-text, #92400E)",
10478
+ margin: "0 0 var(--bw-spacing) 0",
10479
+ fontFamily: "var(--bw-font-family)",
10480
+ fontWeight: "600",
10481
+ }, children: "Zahlung wird noch verarbeitet" }), jsxRuntime.jsxs("p", { style: {
10482
+ color: "var(--bw-warning-text, #92400E)",
10483
+ margin: "0 0 var(--bw-spacing) 0",
10484
+ fontFamily: "var(--bw-font-family)",
10485
+ fontSize: "var(--bw-font-size-small)",
10486
+ }, children: ["Status: ", paymentStatus] }), jsxRuntime.jsx("button", { onClick: () => fetchBookingData(), disabled: isLoading, style: {
10487
+ backgroundColor: "var(--bw-warning-text, #92400E)",
10488
+ color: "white",
10489
+ padding: "8px 16px",
10490
+ border: "none",
10491
+ borderRadius: "var(--bw-border-radius)",
10492
+ fontSize: "var(--bw-font-size-small)",
10493
+ fontWeight: "600",
10494
+ cursor: isLoading ? "not-allowed" : "pointer",
10495
+ fontFamily: "var(--bw-font-family)",
10496
+ opacity: isLoading ? 0.6 : 1,
10497
+ transition: "all 0.2s ease",
10498
+ }, children: isLoading ? "Aktualisiere..." : "Status aktualisieren" })] })), jsxRuntime.jsx("div", { style: {
10499
+ textAlign: "center",
10500
+ marginTop: "var(--bw-spacing-large)",
10501
+ paddingTop: "var(--bw-spacing)",
10502
+ borderTop: `1px solid var(--bw-border-color)`,
10503
+ }, children: jsxRuntime.jsx("button", { onClick: onClose, style: {
10504
+ backgroundColor: "var(--bw-highlight-color)",
10505
+ color: "white",
10506
+ padding: "12px 32px",
10507
+ border: "none",
10508
+ borderRadius: "var(--bw-border-radius)",
10509
+ fontSize: "var(--bw-font-size)",
10510
+ fontWeight: "600",
10511
+ cursor: "pointer",
10512
+ fontFamily: "var(--bw-font-family)",
10513
+ transition: "all 0.2s ease",
10514
+ }, onMouseEnter: (e) => {
10515
+ e.currentTarget.style.opacity = "0.9";
10516
+ }, onMouseLeave: (e) => {
10517
+ e.currentTarget.style.opacity = "1";
10518
+ }, 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", {
10519
+ day: "2-digit",
10520
+ month: "2-digit",
10521
+ year: "numeric",
10522
+ hour: "2-digit",
10523
+ minute: "2-digit",
10524
+ timeZone: "Europe/Berlin",
10525
+ }), " ", "erstellt."] }), jsxRuntime.jsx("p", { children: "Bei Fragen zu deiner Buchung kontaktiere uns gerne." })] })] })] }) }));
10435
10526
  };
10436
10527
 
10437
10528
  const months = [
@@ -11547,7 +11638,7 @@ function UniversalBookingWidget({ config: baseConfig }) {
11547
11638
  const [isLoadingShowAll, setIsLoadingShowAll] = React__default.useState(false); // For "show all events" operation
11548
11639
  const [error, setError] = React__default.useState(null);
11549
11640
  const [isSuccess, setIsSuccess] = React__default.useState(false);
11550
- const [successData, setSuccessData] = React__default.useState(null);
11641
+ const [successPaymentIntentId, setSuccessPaymentIntentId] = React__default.useState(null);
11551
11642
  const [systemConfig, setSystemConfig] = React__default.useState(null);
11552
11643
  // PERFORMANCE OPTIMIZATION: Lazy component loading
11553
11644
  const [shouldRenderInstanceSelection, setShouldRenderInstanceSelection] = React__default.useState(false);
@@ -11594,6 +11685,29 @@ function UniversalBookingWidget({ config: baseConfig }) {
11594
11685
  initializeWidget();
11595
11686
  // eslint-disable-next-line react-hooks/exhaustive-deps
11596
11687
  }, [config]);
11688
+ // Handle Stripe payment return
11689
+ React__default.useEffect(() => {
11690
+ const handleStripeReturn = () => {
11691
+ const stripeReturn = detectStripeReturn();
11692
+ if (stripeReturn) {
11693
+ if (stripeReturn.redirectStatus === "succeeded") {
11694
+ // Store payment intent ID and show success modal
11695
+ setSuccessPaymentIntentId(stripeReturn.paymentIntent);
11696
+ setIsSuccess(true);
11697
+ }
11698
+ else if (stripeReturn.redirectStatus === "failed") {
11699
+ setError("Die Zahlung war nicht erfolgreich. Bitte versuche es erneut.");
11700
+ }
11701
+ else {
11702
+ setError("Die Zahlung konnte nicht abgeschlossen werden. Bitte versuche es erneut.");
11703
+ }
11704
+ }
11705
+ };
11706
+ // Only run on mount to avoid running multiple times
11707
+ if (!isLoading) {
11708
+ handleStripeReturn();
11709
+ }
11710
+ }, [isLoading]); // Only depend on isLoading to run after initial load
11597
11711
  // PERFORMANCE OPTIMIZATION: Lazy load components when needed
11598
11712
  React__default.useEffect(() => {
11599
11713
  if (currentStep === "eventInstances" && !shouldRenderInstanceSelection) {
@@ -11836,7 +11950,7 @@ function UniversalBookingWidget({ config: baseConfig }) {
11836
11950
  };
11837
11951
  const handleBookingSuccess = (result) => {
11838
11952
  setIsSuccess(true);
11839
- setSuccessData(result);
11953
+ setSuccessPaymentIntentId(result.paymentIntent.id);
11840
11954
  config.onSuccess?.(result);
11841
11955
  };
11842
11956
  const handleBookingError = (errorMessage) => {
@@ -12019,10 +12133,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
12019
12133
  setIsSuccess(false);
12020
12134
  setCurrentStep("eventTypes");
12021
12135
  setShowingPreview(true);
12136
+ // Reset state
12137
+ setSuccessPaymentIntentId(null);
12022
12138
  // Reset lazy loading flags
12023
12139
  setShouldRenderInstanceSelection(false);
12024
12140
  setShouldRenderBookingForm(false);
12025
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12141
+ // Clean up URL to remove Stripe parameters
12142
+ const url = new URL(window.location.href);
12143
+ url.searchParams.delete("payment_intent");
12144
+ url.searchParams.delete("payment_intent_client_secret");
12145
+ url.searchParams.delete("redirect_status");
12146
+ window.history.replaceState({}, "", url.toString());
12147
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12026
12148
  }
12027
12149
  if (viewMode === "next-events" && !showingPreview && currentStep === "eventInstances") {
12028
12150
  // Show all events for the single event type
@@ -12036,10 +12158,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
12036
12158
  setIsSuccess(false);
12037
12159
  setCurrentStep("eventTypes");
12038
12160
  setShowingPreview(true);
12161
+ // Reset state
12162
+ setSuccessPaymentIntentId(null);
12039
12163
  // Reset lazy loading flags
12040
12164
  setShouldRenderInstanceSelection(false);
12041
12165
  setShouldRenderBookingForm(false);
12042
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12166
+ // Clean up URL to remove Stripe parameters
12167
+ const url = new URL(window.location.href);
12168
+ url.searchParams.delete("payment_intent");
12169
+ url.searchParams.delete("payment_intent_client_secret");
12170
+ url.searchParams.delete("redirect_status");
12171
+ window.history.replaceState({}, "", url.toString());
12172
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12043
12173
  }
12044
12174
  if (viewMode === "button" && (isSingleEventTypeMode || isDirectInstanceMode)) {
12045
12175
  // Button mode - show button that opens sidebar/booking directly
@@ -12073,10 +12203,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
12073
12203
  setIsSuccess(false);
12074
12204
  setCurrentStep("eventTypes");
12075
12205
  setSidebarOpen(false);
12206
+ // Reset state
12207
+ setSuccessPaymentIntentId(null);
12076
12208
  // Reset lazy loading flags
12077
12209
  setShouldRenderInstanceSelection(false);
12078
12210
  setShouldRenderBookingForm(false);
12079
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }) }));
12211
+ // Clean up URL to remove Stripe parameters
12212
+ const url = new URL(window.location.href);
12213
+ url.searchParams.delete("payment_intent");
12214
+ url.searchParams.delete("payment_intent_client_secret");
12215
+ url.searchParams.delete("redirect_status");
12216
+ window.history.replaceState({}, "", url.toString());
12217
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }) }));
12080
12218
  }
12081
12219
  // Cards mode (default) - show event type selection
12082
12220
  const cardsView = (jsxRuntime.jsx(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount() }));
@@ -12112,10 +12250,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
12112
12250
  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
12251
  setIsSuccess(false);
12114
12252
  setCurrentStep("eventTypes");
12253
+ // Reset state
12254
+ setSuccessPaymentIntentId(null);
12115
12255
  // Reset lazy loading flags
12116
12256
  setShouldRenderInstanceSelection(false);
12117
12257
  setShouldRenderBookingForm(false);
12118
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12258
+ // Clean up URL to remove Stripe parameters
12259
+ const url = new URL(window.location.href);
12260
+ url.searchParams.delete("payment_intent");
12261
+ url.searchParams.delete("payment_intent_client_secret");
12262
+ url.searchParams.delete("redirect_status");
12263
+ window.history.replaceState({}, "", url.toString());
12264
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12119
12265
  }
12120
12266
 
12121
12267
  // Export init function for vanilla JS usage