@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.
@@ -629,6 +629,13 @@
629
629
  direction: ltr;
630
630
  isolation: isolate;
631
631
  }
632
+ .print-only {
633
+ display: none;
634
+ }
635
+ .print-hidden {
636
+ display: block;
637
+ }
638
+ @media print {
632
639
  `;
633
640
  // Inject CSS reset styles
634
641
  y$1(() => {
@@ -974,6 +981,26 @@
974
981
  organizationId: config.organizationId,
975
982
  };
976
983
  };
984
+ // Helper function to detect Stripe return parameters in URL
985
+ const detectStripeReturn = () => {
986
+ if (typeof window === "undefined") {
987
+ return null;
988
+ }
989
+ const urlParams = new URLSearchParams(window.location.search);
990
+ // Check for Stripe return parameters
991
+ const paymentIntent = urlParams.get("payment_intent");
992
+ const paymentIntentClientSecret = urlParams.get("payment_intent_client_secret");
993
+ const redirectStatus = urlParams.get("redirect_status");
994
+ if (paymentIntent && paymentIntentClientSecret && redirectStatus) {
995
+ return {
996
+ isStripeReturn: true,
997
+ paymentIntent,
998
+ paymentIntentClientSecret,
999
+ redirectStatus,
1000
+ };
1001
+ }
1002
+ return null;
1003
+ };
977
1004
 
978
1005
  var isCheckBoxInput = (element) => element.type === 'checkbox';
979
1006
 
@@ -9183,7 +9210,7 @@
9183
9210
  borderRadius: "50%",
9184
9211
  } }) }));
9185
9212
  // Inner component that uses the Stripe hooks
9186
- function PaymentFormInner({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, systemConfig, clientSecret, }) {
9213
+ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, }) {
9187
9214
  const stripe = reactStripe_umdExports.useStripe();
9188
9215
  const elements = reactStripe_umdExports.useElements();
9189
9216
  const [isLoading, setIsLoading] = d$1(false);
@@ -9209,26 +9236,12 @@
9209
9236
  return;
9210
9237
  }
9211
9238
  // First, confirm the payment with Stripe
9239
+ // Build return URL for Stripe redirect
9240
+ const baseUrl = window !== undefined ? window.location.href : `${config.bookingSystemUrl}/booking-success`;
9241
+ const returnUrl = new URL(baseUrl);
9212
9242
  const confirmParams = {
9213
- return_url: "https://bigz.surfschule-zingst.de/booking/success",
9243
+ return_url: returnUrl.toString(),
9214
9244
  };
9215
- // Ensure return_url is properly formatted and doesn't contain fragment identifiers
9216
- try {
9217
- const url = new URL(confirmParams.return_url);
9218
- // Remove any fragment identifiers that might cause issues
9219
- url.hash = "";
9220
- confirmParams.return_url = url.toString();
9221
- }
9222
- catch (e) {
9223
- console.warn("[PAYMENT_FORM] Invalid return_url, using fallback:", confirmParams.return_url);
9224
- // Fallback to current origin if URL parsing fails
9225
- confirmParams.return_url = window.location.origin + window.location.pathname;
9226
- }
9227
- console.log("[PAYMENT_FORM] Confirming payment with params:", {
9228
- paymentIntentId: clientSecret.split("_secret_")[0],
9229
- return_url: confirmParams.return_url,
9230
- redirect: "if_required",
9231
- });
9232
9245
  const { error, paymentIntent } = await stripe.confirmPayment({
9233
9246
  elements,
9234
9247
  confirmParams,
@@ -9246,91 +9259,15 @@
9246
9259
  setPaymentError(error.message || "Zahlungsfehler");
9247
9260
  }
9248
9261
  else {
9249
- setPaymentError("Ein unerwarteter Fehler ist aufgetreten.");
9262
+ setPaymentError("Ein unerwarteter Fehler ist aufgetreten. Bitte versuche es nochmal.");
9250
9263
  }
9251
9264
  return;
9252
9265
  }
9253
9266
  // Payment succeeded, now create the booking
9254
9267
  if (paymentIntent && paymentIntent.status === "succeeded") {
9255
- // Check if we have system configuration
9256
- if (!systemConfig) {
9257
- throw new Error("System-Konfiguration nicht verfügbar. Bitte lade die Seite neu.");
9258
- }
9259
- // Determine which endpoint to use based on system mode
9260
- const isConnectMode = systemConfig.systemMode === "connect";
9261
- const endpoint = isConnectMode
9262
- ? "/booking/create-from-payment"
9263
- : "/booking-proxy/create-booking";
9264
- // Calculate if this is a deposit payment
9265
- const fullAmount = eventDetails.price * formData.participants.filter((p) => p.name.trim()).length;
9266
- const isDepositPayment = eventDetails.deposit > 0;
9267
- // Build request body based on mode
9268
- const requestData = {
9269
- // Payment info
9270
- paymentIntentId: paymentIntent.id,
9271
- paymentMethod: "card",
9272
- paymentStatus: isDepositPayment ? "deposit_paid" : "paid",
9273
- totalAmount,
9274
- depositAmount: isDepositPayment ? totalAmount : undefined,
9275
- fullAmount: fullAmount,
9276
- // Customer info
9277
- customerEmail: formData.customerEmail,
9278
- customerName: formData.customerName,
9279
- customerPhone: formData.customerPhone,
9280
- // Booking info
9281
- participants: formData.participants.filter((p) => p.name.trim()),
9282
- eventInstanceId: config.eventInstanceId || eventDetails.id,
9283
- organizationId: config.organizationId, // Ensure organization ID is always included
9284
- discountCode: discountCode?.code,
9285
- notes: "",
9286
- };
9287
- // Add mode-specific fields
9288
- if (isConnectMode) {
9289
- Object.assign(requestData, {
9290
- source: "connect",
9291
- stripeAccountType: "connect",
9292
- });
9293
- }
9294
- else {
9295
- // ApiKey mode - include required proxy fields
9296
- Object.assign(requestData, {
9297
- bookingSystemApiUrl: config.apiBaseUrl,
9298
- // apiKey would be added here if required
9299
- });
9300
- }
9301
- console.log(`[PAYMENT_FORM] Attempting booking creation via ${endpoint}`, {
9302
- mode: isConnectMode ? "connect" : "apikey",
9303
- paymentIntentId: paymentIntent.id,
9304
- eventInstanceId: requestData.eventInstanceId,
9305
- organizationId: requestData.organizationId,
9306
- participantCount: requestData.participants.length,
9307
- });
9308
- const bookingResponse = await fetch(getApiUrl(config.apiBaseUrl, endpoint), {
9309
- method: "POST",
9310
- headers: createApiHeaders(config),
9311
- body: JSON.stringify(createRequestBody(config, requestData)),
9312
- });
9313
- const bookingData = await bookingResponse.json();
9314
- if (!bookingResponse.ok) {
9315
- console.error(`[PAYMENT_FORM] Booking creation failed:`, {
9316
- status: bookingResponse.status,
9317
- error: bookingData.error,
9318
- details: bookingData.details,
9319
- paymentIntentId: paymentIntent.id,
9320
- });
9321
- throw new Error(bookingData.error || "Fehler beim Erstellen der Buchung");
9322
- }
9323
- console.log(`[PAYMENT_FORM] Booking created successfully:`, {
9324
- bookingId: bookingData.booking?.id,
9325
- orderId: bookingData.order?.id,
9326
- paymentIntentId: paymentIntent.id,
9327
- });
9328
9268
  // Booking created successfully
9329
9269
  onSuccess({
9330
- booking: bookingData.booking,
9331
- payment: "succeeded",
9332
9270
  paymentIntent: paymentIntent,
9333
- formData: formData,
9334
9271
  });
9335
9272
  }
9336
9273
  else {
@@ -9433,11 +9370,6 @@
9433
9370
  setIsCreatingPaymentIntent(true);
9434
9371
  setPaymentError(null);
9435
9372
  try {
9436
- // Determine endpoint based on system mode
9437
- const isConnectMode = systemConfig.systemMode === "connect";
9438
- const endpoint = isConnectMode
9439
- ? "/booking/create-payment-intent"
9440
- : "/booking-proxy/create-payment-intent";
9441
9373
  // Build request data with validation
9442
9374
  const requestData = {
9443
9375
  eventInstanceId: config.eventInstanceId || eventDetails.id,
@@ -9446,7 +9378,10 @@
9446
9378
  currency: "eur",
9447
9379
  participants: formData.participants.filter((p) => p.name?.trim()),
9448
9380
  discountCode: discountCode?.code,
9381
+ customerName: formData.customerName?.trim(),
9449
9382
  customerEmail: formData.customerEmail?.trim(),
9383
+ customerPhone: formData.customerPhone?.trim(),
9384
+ comment: formData.comment?.trim(),
9450
9385
  };
9451
9386
  // Validate required fields
9452
9387
  if (!requestData.eventInstanceId) {
@@ -9464,34 +9399,13 @@
9464
9399
  if (!requestData.customerEmail) {
9465
9400
  throw new Error("Customer email is required");
9466
9401
  }
9467
- console.log("[PAYMENT_FORM] Creating payment intent:", {
9468
- endpoint,
9469
- mode: isConnectMode ? "connect" : "apikey",
9470
- amount: requestData.amount,
9471
- currency: requestData.currency,
9472
- participantCount: requestData.participants.length,
9473
- organizationId: requestData.organizationId,
9474
- eventInstanceId: requestData.eventInstanceId,
9475
- });
9476
- // Add mode-specific fields
9477
- if (!isConnectMode) {
9478
- // ApiKey mode needs additional fields
9479
- Object.assign(requestData, {
9480
- bookingSystemApiUrl: config.apiBaseUrl,
9481
- // apiKey would be added here if required
9482
- });
9483
- }
9484
- const response = await fetch(getApiUrl(config.apiBaseUrl, endpoint), {
9402
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/create-payment-intent"), {
9485
9403
  method: "POST",
9486
9404
  headers: createApiHeaders(config),
9487
9405
  body: JSON.stringify(createRequestBody(config, requestData)),
9488
9406
  });
9489
9407
  const data = await response.json();
9490
9408
  if (response.ok) {
9491
- console.log("[PAYMENT_FORM] Payment intent created successfully:", {
9492
- hasClientSecret: !!data.clientSecret,
9493
- clientSecretPrefix: `${data.clientSecret?.substring(0, 20)}...`,
9494
- });
9495
9409
  setClientSecret(data.clientSecret);
9496
9410
  }
9497
9411
  else {
@@ -10341,162 +10255,339 @@
10341
10255
  ` })] }) }));
10342
10256
  }
10343
10257
 
10344
- const BookingSuccessModal = ({ isOpen, onClose, bookingData, eventDetails, formData, config, }) => {
10345
- if (!isOpen || !bookingData)
10258
+ const BookingSuccessModal = ({ isOpen, onClose, config, onError, paymentIntentId, }) => {
10259
+ const [bookingData, setBookingData] = d$1(null);
10260
+ const [eventDetails, setEventDetails] = d$1(null);
10261
+ const [formData, setFormData] = d$1(null);
10262
+ const [isLoading, setIsLoading] = d$1(false);
10263
+ const [paymentStatus, setPaymentStatus] = d$1(null);
10264
+ const fetchBookingData = async (intentId) => {
10265
+ const targetPaymentIntentId = paymentIntentId;
10266
+ // If we have payment intent ID, fetch from API
10267
+ if (targetPaymentIntentId) {
10268
+ setIsLoading(true);
10269
+ try {
10270
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/get-booking-by-payment-intent"), {
10271
+ method: "POST",
10272
+ headers: createApiHeaders(config),
10273
+ body: JSON.stringify(createRequestBody(config, {
10274
+ paymentIntentId: targetPaymentIntentId,
10275
+ })),
10276
+ });
10277
+ const data = await response.json();
10278
+ if (response.ok) {
10279
+ setBookingData({
10280
+ booking: data.booking,
10281
+ order: data.order,
10282
+ payments: data.payments,
10283
+ orderItems: data.orderItems,
10284
+ stripePaymentIntent: data.stripePaymentIntent,
10285
+ });
10286
+ setEventDetails({
10287
+ id: data.booking.eventInstance.id,
10288
+ name: data.booking.eventInstance.eventType.name,
10289
+ description: data.booking.eventInstance.eventType.description,
10290
+ startTime: data.booking.eventInstance.startTime,
10291
+ endTime: data.booking.eventInstance.endTime,
10292
+ price: data.order.total / data.booking.participantCount,
10293
+ });
10294
+ setFormData({
10295
+ customerEmail: data.booking.customerEmail,
10296
+ customerName: data.booking.customerName,
10297
+ customerPhone: data.booking.customerPhone,
10298
+ participants: data.booking.participants || [],
10299
+ });
10300
+ // Set payment status from Stripe data or order status
10301
+ setPaymentStatus(data.stripePaymentIntent?.status || data.order.status);
10302
+ }
10303
+ else {
10304
+ onError?.(data.error || "Fehler beim Abrufen der Buchungsdaten");
10305
+ }
10306
+ }
10307
+ catch (err) {
10308
+ console.error("[BookingSuccessModal] Error fetching booking data:", err);
10309
+ onError?.("Ein Fehler ist bei der Verarbeitung aufgetreten.");
10310
+ }
10311
+ finally {
10312
+ setIsLoading(false);
10313
+ }
10314
+ return;
10315
+ }
10316
+ };
10317
+ y$1(() => {
10318
+ if (isOpen) {
10319
+ fetchBookingData();
10320
+ }
10321
+ }, [isOpen, paymentIntentId, config, onError]);
10322
+ if (!isOpen)
10346
10323
  return null;
10324
+ // Show loading state while fetching data
10325
+ if (isLoading || !bookingData) {
10326
+ return (u$2(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: u$2("div", { style: {
10327
+ padding: "var(--bw-spacing-large)",
10328
+ textAlign: "center",
10329
+ minHeight: "200px",
10330
+ display: "flex",
10331
+ alignItems: "center",
10332
+ justifyContent: "center",
10333
+ }, children: u$2("div", { style: {
10334
+ color: "var(--bw-text-muted)",
10335
+ fontFamily: "var(--bw-font-family)",
10336
+ fontSize: "var(--bw-font-size-large)",
10337
+ }, children: "Buchungsdaten werden geladen..." }) }) }));
10338
+ }
10347
10339
  const booking = bookingData.booking;
10348
- return (u$2(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: u$2("div", { style: { padding: "var(--bw-spacing-large)" }, children: [u$2("div", { style: {
10349
- textAlign: "center",
10350
- marginBottom: "var(--bw-spacing-large)",
10351
- }, children: [u$2("div", { style: {
10352
- width: "64px",
10353
- height: "64px",
10354
- backgroundColor: "var(--bw-success-color, #10B981)",
10355
- borderRadius: "50%",
10356
- margin: "0 auto var(--bw-spacing)",
10357
- display: "flex",
10358
- alignItems: "center",
10359
- justifyContent: "center",
10360
- fontSize: "32px",
10361
- color: "white",
10362
- }, children: "\u2713" }), u$2("h2", { style: {
10363
- fontSize: "var(--bw-font-size-xl)",
10364
- fontWeight: "700",
10365
- color: "var(--bw-text-color)",
10366
- margin: "0 0 var(--bw-spacing-small) 0",
10367
- fontFamily: "var(--bw-font-family)",
10368
- }, children: "Buchung erfolgreich!" }), u$2("p", { style: {
10369
- color: "var(--bw-text-muted)",
10370
- fontFamily: "var(--bw-font-family)",
10371
- margin: 0,
10372
- }, children: "Deine Buchung wurde erfolgreich abgeschlossen." })] }), u$2("div", { style: {
10373
- backgroundColor: "var(--bw-surface-color)",
10374
- border: `1px solid var(--bw-border-color)`,
10375
- borderRadius: "var(--bw-border-radius)",
10376
- padding: "var(--bw-spacing)",
10340
+ new Date(eventDetails.startTime);
10341
+ new Date(eventDetails.endTime);
10342
+ const handlePrint = () => {
10343
+ window.print();
10344
+ };
10345
+ const formatTime12 = (dateString) => {
10346
+ return formatTime(dateString, "Europe/Berlin", "de");
10347
+ };
10348
+ const formatDate12 = (dateString) => {
10349
+ return formatEventDate(dateString);
10350
+ };
10351
+ return (u$2(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: u$2("div", { style: {
10352
+ fontFamily: "var(--bw-font-family)",
10353
+ padding: "var(--bw-spacing-large)",
10354
+ maxWidth: "100%",
10355
+ }, children: [u$2("div", { className: "flex justify-between items-center print-hidden", style: {
10377
10356
  marginBottom: "var(--bw-spacing-large)",
10378
- }, children: [u$2("h3", { style: {
10379
- fontSize: "var(--bw-font-size-large)",
10380
- fontWeight: "600",
10357
+ display: "flex",
10358
+ alignItems: "center",
10359
+ justifyContent: "space-between",
10360
+ }, children: [u$2("h1", { className: "font-bold text-3xl flex items-center gap-2", style: {
10381
10361
  color: "var(--bw-text-color)",
10382
- margin: "0 0 var(--bw-spacing) 0",
10383
10362
  fontFamily: "var(--bw-font-family)",
10384
- }, children: "Buchungsdetails" }), u$2("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing)" }, children: [booking.bookingHash && (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Buchungs-ID:" }), u$2("span", { style: {
10385
- color: "var(--bw-text-color)",
10386
- fontWeight: "500",
10387
- fontFamily: "monospace",
10388
- fontSize: "var(--bw-font-size-small)",
10389
- backgroundColor: "var(--bw-background-color)",
10390
- padding: "4px 8px",
10391
- borderRadius: "var(--bw-border-radius-small)",
10392
- }, children: booking.bookingHash })] })), u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Event:" }), u$2("span", { style: {
10393
- color: "var(--bw-text-color)",
10394
- fontWeight: "500",
10395
- fontFamily: "var(--bw-font-family)",
10396
- textAlign: "right",
10397
- maxWidth: "60%",
10398
- }, children: eventDetails.name })] }), u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Datum:" }), u$2("span", { style: {
10399
- color: "var(--bw-text-color)",
10400
- fontWeight: "500",
10401
- fontFamily: "var(--bw-font-family)",
10402
- textAlign: "right",
10403
- maxWidth: "60%",
10404
- }, children: formatEventDate(eventDetails.startTime) })] }), u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Uhrzeit:" }), u$2("span", { style: {
10405
- color: "var(--bw-text-color)",
10406
- fontWeight: "500",
10407
- fontFamily: "var(--bw-font-family)",
10408
- textAlign: "right",
10409
- maxWidth: "60%",
10410
- }, children: formatTime(eventDetails.startTime, "Europe/Berlin", "de") })] }), u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Teilnehmer:" }), u$2("span", { style: {
10411
- color: "var(--bw-text-color)",
10412
- fontWeight: "500",
10413
- fontFamily: "var(--bw-font-family)",
10414
- }, children: booking.participantCount })] }), u$2("div", { style: {
10363
+ marginBottom: "var(--bw-spacing-large)",
10364
+ display: "flex",
10365
+ alignItems: "center",
10366
+ gap: "var(--bw-spacing-small)",
10367
+ }, children: [u$2("div", { style: {
10368
+ width: "32px",
10369
+ height: "32px",
10370
+ backgroundColor: "var(--bw-highlight-color, #10B981)",
10371
+ borderRadius: "50%",
10415
10372
  display: "flex",
10416
- justifyContent: "space-between",
10417
10373
  alignItems: "center",
10418
- borderTop: `1px solid var(--bw-border-color)`,
10419
- paddingTop: "var(--bw-spacing)",
10420
- marginTop: "var(--bw-spacing)",
10421
- }, children: [u$2("span", { style: {
10422
- color: "var(--bw-text-color)",
10423
- fontWeight: "600",
10424
- fontFamily: "var(--bw-font-family)",
10425
- }, children: "Gesamtbetrag:" }), u$2("span", { style: {
10426
- color: "var(--bw-text-color)",
10427
- fontWeight: "600",
10428
- fontSize: "var(--bw-font-size-large)",
10429
- fontFamily: "var(--bw-font-family)",
10430
- }, children: formatCurrency(booking.total) })] })] })] }), formData.participants && formData.participants.length > 0 && (u$2("div", { style: {
10431
- border: `1px solid var(--bw-border-color)`,
10432
- borderRadius: "var(--bw-border-radius)",
10433
- padding: "var(--bw-spacing)",
10434
- marginBottom: "var(--bw-spacing-large)",
10435
- }, children: [u$2("h3", { style: {
10436
- fontSize: "var(--bw-font-size-large)",
10437
- fontWeight: "600",
10374
+ justifyContent: "center",
10375
+ color: "white",
10376
+ }, children: "\u2713" }), u$2("p", { style: {
10377
+ fontSize: "var(--bw-font-size-large)",
10378
+ fontWeight: "600",
10379
+ color: "var(--bw-highlight-color)",
10380
+ margin: "0px 10px",
10381
+ }, children: "Buchung erfolgreich erstellt!" })] }), u$2("button", { onClick: handlePrint, style: {
10382
+ backgroundColor: "transparent",
10383
+ border: `1px solid var(--bw-border-color)`,
10438
10384
  color: "var(--bw-text-color)",
10439
- margin: "0 0 var(--bw-spacing) 0",
10385
+ padding: "8px 16px",
10386
+ borderRadius: "var(--bw-border-radius)",
10387
+ cursor: "pointer",
10440
10388
  fontFamily: "var(--bw-font-family)",
10441
- }, children: "Teilnehmer" }), u$2("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: formData.participants
10442
- .filter((p) => p.name.trim())
10443
- .map((participant, index) => (u$2("div", { style: {
10444
- display: "flex",
10445
- justifyContent: "space-between",
10446
- alignItems: "center",
10447
- padding: "var(--bw-spacing-small)",
10448
- borderRadius: "var(--bw-border-radius-small)",
10449
- }, children: [u$2("span", { style: {
10389
+ fontSize: "var(--bw-font-size-small)",
10390
+ }, children: "Drucken" })] }), u$2("div", { className: "print-only print-booking-header", children: [u$2("h1", { children: "Buchungsbest\u00E4tigung" }), u$2("div", { className: "subtitle", children: "Vielen Dank f\u00FCr deine Buchung! Hier sind deine Buchungsdetails." })] }), u$2("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-large)" }, children: [u$2("div", { className: "print-booking-card", style: {
10391
+ backgroundColor: "var(--bw-surface-color)",
10392
+ border: `1px solid var(--bw-border-color)`,
10393
+ borderRadius: "var(--bw-border-radius)",
10394
+ padding: "var(--bw-spacing)",
10395
+ marginBottom: "var(--bw-spacing-large)",
10396
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10397
+ fontSize: "var(--bw-font-size-large)",
10398
+ fontWeight: "600",
10450
10399
  color: "var(--bw-text-color)",
10400
+ margin: "0",
10451
10401
  fontFamily: "var(--bw-font-family)",
10452
- }, children: participant.name }), participant.age && (u$2("span", { style: {
10453
- color: "var(--bw-text-muted)",
10454
- fontSize: "var(--bw-font-size-small)",
10402
+ }, children: "Buchungsdetails" }) }), u$2("div", { className: "print-only", children: u$2("div", { className: "print-section-title", children: "Buchungsdetails" }) }), u$2("div", { className: "space-y-4 print-only:space-y-2 print-only:p-0", children: [u$2("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
10403
+ display: "grid",
10404
+ gridTemplateColumns: "1fr 1fr",
10405
+ gap: "var(--bw-spacing)",
10406
+ }, children: [u$2("div", { className: "print-detail-item", style: { marginBottom: "span 2" }, children: [u$2("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10407
+ color: "var(--bw-text-muted)",
10408
+ fontSize: "var(--bw-font-size-small)",
10409
+ fontFamily: "var(--bw-font-family)",
10410
+ }, children: "Buchungs-ID" }), u$2("p", { className: "font-semibold print-detail-value", style: {
10411
+ fontWeight: "600",
10412
+ color: "var(--bw-text-color)",
10413
+ fontFamily: "var(--bw-font-family)",
10414
+ fontSize: "var(--bw-font-size-medium)",
10415
+ margin: "0px 0px 6px 0",
10416
+ }, children: booking.bookingHash })] }), u$2("div", { className: "print-detail-item", children: [u$2("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: "Bezahl-Status" }), u$2("div", { children: [u$2("span", { className: "print-hidden", style: {
10421
+ backgroundColor: "var(--bw-success-color, #10B981)",
10422
+ color: "white",
10423
+ padding: "2px 8px",
10424
+ borderRadius: "var(--bw-border-radius-small)",
10425
+ fontSize: "var(--bw-font-size-small)",
10426
+ fontFamily: "var(--bw-font-family)",
10427
+ width: "fit-content",
10428
+ }, children: paymentStatus === "succeeded"
10429
+ ? "erfolgreich"
10430
+ : paymentStatus === "canceled" || paymentStatus === "failed"
10431
+ ? "fehlgeschlagen"
10432
+ : "in Bearbeitung" }), u$2("span", { className: "print-only print-status-badge print-status-paid", children: "Bezahlt" })] })] })] }), u$2("div", { className: "print-detail-item print-only:col-span-2", children: [u$2("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10433
+ color: "var(--bw-text-muted)",
10434
+ fontSize: "var(--bw-font-size-small)",
10435
+ fontFamily: "var(--bw-font-family)",
10436
+ }, children: "Event" }), u$2("p", { className: "font-semibold print-detail-value", style: {
10437
+ fontWeight: "600",
10438
+ color: "var(--bw-text-color)",
10439
+ fontFamily: "var(--bw-font-family)",
10440
+ fontSize: "var(--bw-font-size-large)",
10441
+ margin: "0 0 6px 0",
10442
+ }, children: eventDetails.name })] }), u$2("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
10443
+ display: "grid",
10444
+ gridTemplateColumns: "1fr 1fr",
10445
+ gap: "var(--bw-spacing)",
10446
+ }, children: [u$2("div", { className: "print-detail-item", children: [u$2("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10447
+ color: "var(--bw-text-muted)",
10448
+ fontSize: "var(--bw-font-size-small)",
10449
+ fontFamily: "var(--bw-font-family)",
10450
+ }, children: "Datum" }), u$2("p", { className: "print-detail-value", style: {
10451
+ fontWeight: "600",
10452
+ color: "var(--bw-text-color)",
10453
+ fontFamily: "var(--bw-font-family)",
10454
+ fontSize: "var(--bw-font-size-large)",
10455
+ margin: "0 0 6px 0",
10456
+ }, children: formatDate12(eventDetails.startTime) })] }), u$2("div", { className: "print-detail-item", children: [u$2("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10457
+ color: "var(--bw-text-muted)",
10458
+ fontSize: "var(--bw-font-size-small)",
10459
+ fontFamily: "var(--bw-font-family)",
10460
+ }, children: "Zeit" }), u$2("p", { className: "print-detail-value", style: {
10461
+ fontWeight: "600",
10462
+ color: "var(--bw-text-color)",
10463
+ fontFamily: "var(--bw-font-family)",
10464
+ fontSize: "var(--bw-font-size-large)",
10465
+ margin: "0 0 6px 0",
10466
+ }, children: [formatTime12(eventDetails.startTime), " - ", formatTime12(eventDetails.endTime)] })] })] })] })] }), formData.participants && formData.participants.length > 0 && (u$2("div", { className: "print-booking-card", style: {
10467
+ border: `1px solid var(--bw-border-color)`,
10468
+ borderRadius: "var(--bw-border-radius)",
10469
+ padding: "var(--bw-spacing)",
10470
+ marginBottom: "var(--bw-spacing-large)",
10471
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10472
+ fontSize: "var(--bw-font-size-large)",
10473
+ fontWeight: "600",
10474
+ color: "var(--bw-text-color)",
10475
+ margin: "0",
10455
10476
  fontFamily: "var(--bw-font-family)",
10456
- }, children: [participant.age, " Jahre"] }))] }, index))) })] })), u$2("div", { 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
- }, children: [u$2("h3", { style: {
10463
- fontSize: "var(--bw-font-size-large)",
10464
- fontWeight: "600",
10465
- color: "var(--bw-text-color)",
10466
- margin: "0 0 var(--bw-spacing) 0",
10467
- fontFamily: "var(--bw-font-family)",
10468
- }, children: "Kontaktdaten" }), u$2("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: [u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Name:" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerName })] }), u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "E-Mail:" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerEmail })] }), formData.customerPhone && (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Telefon:" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerPhone })] }))] })] }), u$2("div", { style: {
10469
- backgroundColor: "var(--bw-surface-muted-bg, rgba(59, 130, 246, 0.05))",
10470
- border: `1px solid var(--bw-border-color)`,
10471
- borderRadius: "var(--bw-border-radius)",
10472
- padding: "var(--bw-spacing)",
10473
- marginBottom: "var(--bw-spacing-large)",
10474
- textAlign: "center",
10475
- }, children: [u$2("div", { style: {
10476
- color: "var(--bw-highlight-color)",
10477
- fontSize: "24px",
10478
- marginBottom: "var(--bw-spacing-small)",
10479
- }, children: "\uD83D\uDCE7" }), u$2("p", { style: {
10480
- color: "var(--bw-text-muted)",
10481
- margin: 0,
10482
- fontFamily: "var(--bw-font-family)",
10483
- fontSize: "var(--bw-font-size-small)",
10484
- }, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] })] }), u$2("div", { style: { textAlign: "center" }, children: u$2("button", { onClick: onClose, style: {
10485
- backgroundColor: "var(--bw-highlight-color)",
10486
- color: "white",
10487
- padding: "12px 32px",
10488
- border: "none",
10489
- borderRadius: "var(--bw-border-radius)",
10490
- fontSize: "var(--bw-font-size)",
10491
- fontWeight: "600",
10492
- cursor: "pointer",
10493
- fontFamily: "var(--bw-font-family)",
10494
- transition: "all 0.2s ease",
10495
- }, onMouseEnter: (e) => {
10496
- e.currentTarget.style.opacity = "0.9";
10497
- }, onMouseLeave: (e) => {
10498
- e.currentTarget.style.opacity = "1";
10499
- }, children: "Schlie\u00DFen" }) })] }) }));
10477
+ }, children: ["Teilnehmer (", formData.participants.length, ")"] }) }), u$2("div", { className: "print-only", children: u$2("div", { className: "print-section-title", children: ["Teilnehmer (", formData.participants.length, ")"] }) }), u$2("div", { className: "print-only:p-0", children: u$2("div", { className: "space-y-3 print-only:space-y-1", style: {
10478
+ display: "flex",
10479
+ flexDirection: "column",
10480
+ gap: "var(--bw-spacing-small)",
10481
+ }, children: formData.participants
10482
+ .filter((p) => p.name.trim())
10483
+ .map((participant, index) => (u$2("div", { className: "flex justify-between items-center bg-muted p-3 rounded-lg print-participant", style: {
10484
+ display: "flex",
10485
+ justifyContent: "space-between",
10486
+ alignItems: "center",
10487
+ backgroundColor: "var(--bw-surface-color, #f9fafb)",
10488
+ padding: "var(--bw-spacing-small)",
10489
+ borderRadius: "var(--bw-border-radius-small)",
10490
+ }, children: u$2("div", { className: "print-participant-info", children: [u$2("div", { className: "print-participant-name", style: {
10491
+ color: "var(--bw-text-color)",
10492
+ fontFamily: "var(--bw-font-family)",
10493
+ }, children: participant.name }), participant.age && (u$2("div", { className: "text-muted-foreground text-sm print-participant-age", style: {
10494
+ color: "var(--bw-text-muted)",
10495
+ fontSize: "var(--bw-font-size-small)",
10496
+ fontFamily: "var(--bw-font-family)",
10497
+ }, children: [participant.age, " Jahre"] }))] }) }, index))) }) })] })), u$2("div", { className: "print-booking-card", style: {
10498
+ backgroundColor: "var(--bw-surface-color)",
10499
+ border: `1px solid var(--bw-border-color)`,
10500
+ borderRadius: "var(--bw-border-radius)",
10501
+ padding: "var(--bw-spacing)",
10502
+ marginBottom: "var(--bw-spacing-large)",
10503
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10504
+ fontSize: "var(--bw-font-size-large)",
10505
+ fontWeight: "600",
10506
+ color: "var(--bw-text-color)",
10507
+ margin: "0",
10508
+ fontFamily: "var(--bw-font-family)",
10509
+ }, children: "Zahlungs\u00FCbersicht" }) }), u$2("div", { className: "print-only", children: u$2("div", { className: "print-section-title", children: "Zahlungs\u00FCbersicht" }) }), u$2("div", { className: "space-y-2 print-only:p-0 print-only:space-y-1", children: [u$2("div", { className: "print-payment-summary print-only", children: [u$2("div", { className: "print-payment-row", children: [u$2("span", { children: "Gesamtbetrag" }), u$2("span", { children: formatCurrency(booking.total) })] }), u$2("div", { className: "print-payment-row", children: [u$2("span", { children: "Bezahlt" }), u$2("span", { children: formatCurrency(booking.total) })] })] }), u$2("div", { className: "print-hidden space-y-2", style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: [u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: "Gesamtbetrag" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(booking.total) })] }), u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: "Bezahlt" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(booking.total) })] })] })] })] }), u$2("div", { className: "print-booking-card", style: {
10510
+ backgroundColor: "var(--bw-surface-color)",
10511
+ border: `1px solid var(--bw-border-color)`,
10512
+ borderRadius: "var(--bw-border-radius)",
10513
+ padding: "var(--bw-spacing)",
10514
+ marginBottom: "var(--bw-spacing-large)",
10515
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10516
+ fontSize: "var(--bw-font-size-large)",
10517
+ fontWeight: "600",
10518
+ color: "var(--bw-text-color)",
10519
+ margin: "0",
10520
+ fontFamily: "var(--bw-font-family)",
10521
+ }, children: "Kontaktdaten" }) }), u$2("div", { className: "print-only", children: u$2("div", { className: "print-section-title", children: "Kontaktdaten" }) }), u$2("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: [u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Name:" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerName })] }), u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "E-Mail:" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerEmail })] }), formData.customerPhone && (u$2("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [u$2("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Telefon:" }), u$2("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerPhone })] }))] })] }), u$2("div", { className: "print-booking-card", style: {
10522
+ backgroundColor: "var(--bw-surface-color)",
10523
+ border: `1px solid var(--bw-border-color)`,
10524
+ borderRadius: "var(--bw-border-radius)",
10525
+ padding: "var(--bw-spacing)",
10526
+ marginBottom: "var(--bw-spacing-large)",
10527
+ textAlign: "center",
10528
+ }, children: u$2("p", { style: {
10529
+ color: "var(--bw-text-muted)",
10530
+ margin: 0,
10531
+ fontFamily: "var(--bw-font-family)",
10532
+ fontSize: "var(--bw-font-size-small)",
10533
+ textAlign: "center",
10534
+ }, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] }) }), paymentStatus && paymentStatus !== "succeeded" && (u$2("div", { style: {
10535
+ backgroundColor: "var(--bw-warning-bg, #FEF3C7)",
10536
+ border: "1px solid var(--bw-warning-border, #F59E0B)",
10537
+ borderRadius: "var(--bw-border-radius)",
10538
+ padding: "var(--bw-spacing)",
10539
+ marginBottom: "var(--bw-spacing-large)",
10540
+ textAlign: "center",
10541
+ }, children: [u$2("p", { style: {
10542
+ color: "var(--bw-warning-text, #92400E)",
10543
+ margin: "0 0 var(--bw-spacing) 0",
10544
+ fontFamily: "var(--bw-font-family)",
10545
+ fontWeight: "600",
10546
+ }, children: "Zahlung wird noch verarbeitet" }), u$2("p", { style: {
10547
+ color: "var(--bw-warning-text, #92400E)",
10548
+ margin: "0 0 var(--bw-spacing) 0",
10549
+ fontFamily: "var(--bw-font-family)",
10550
+ fontSize: "var(--bw-font-size-small)",
10551
+ }, children: ["Status: ", paymentStatus] }), u$2("button", { onClick: () => fetchBookingData(), disabled: isLoading, style: {
10552
+ backgroundColor: "var(--bw-warning-text, #92400E)",
10553
+ color: "white",
10554
+ padding: "8px 16px",
10555
+ border: "none",
10556
+ borderRadius: "var(--bw-border-radius)",
10557
+ fontSize: "var(--bw-font-size-small)",
10558
+ fontWeight: "600",
10559
+ cursor: isLoading ? "not-allowed" : "pointer",
10560
+ fontFamily: "var(--bw-font-family)",
10561
+ opacity: isLoading ? 0.6 : 1,
10562
+ transition: "all 0.2s ease",
10563
+ }, children: isLoading ? "Aktualisiere..." : "Status aktualisieren" })] })), u$2("div", { style: {
10564
+ textAlign: "center",
10565
+ marginTop: "var(--bw-spacing-large)",
10566
+ paddingTop: "var(--bw-spacing)",
10567
+ borderTop: `1px solid var(--bw-border-color)`,
10568
+ }, children: u$2("button", { onClick: onClose, style: {
10569
+ backgroundColor: "var(--bw-highlight-color)",
10570
+ color: "white",
10571
+ padding: "12px 32px",
10572
+ border: "none",
10573
+ borderRadius: "var(--bw-border-radius)",
10574
+ fontSize: "var(--bw-font-size)",
10575
+ fontWeight: "600",
10576
+ cursor: "pointer",
10577
+ fontFamily: "var(--bw-font-family)",
10578
+ transition: "all 0.2s ease",
10579
+ }, onMouseEnter: (e) => {
10580
+ e.currentTarget.style.opacity = "0.9";
10581
+ }, onMouseLeave: (e) => {
10582
+ e.currentTarget.style.opacity = "1";
10583
+ }, children: "Schlie\u00DFen" }) }), u$2("div", { className: "print-only print-footer", children: [u$2("p", { children: ["Diese Buchungsbest\u00E4tigung wurde am", " ", new Date().toLocaleString("de-DE", {
10584
+ day: "2-digit",
10585
+ month: "2-digit",
10586
+ year: "numeric",
10587
+ hour: "2-digit",
10588
+ minute: "2-digit",
10589
+ timeZone: "Europe/Berlin",
10590
+ }), " ", "erstellt."] }), u$2("p", { children: "Bei Fragen zu deiner Buchung kontaktiere uns gerne." })] })] })] }) }));
10500
10591
  };
10501
10592
 
10502
10593
  const months = [
@@ -11612,7 +11703,7 @@
11612
11703
  const [isLoadingShowAll, setIsLoadingShowAll] = d$1(false); // For "show all events" operation
11613
11704
  const [error, setError] = d$1(null);
11614
11705
  const [isSuccess, setIsSuccess] = d$1(false);
11615
- const [successData, setSuccessData] = d$1(null);
11706
+ const [successPaymentIntentId, setSuccessPaymentIntentId] = d$1(null);
11616
11707
  const [systemConfig, setSystemConfig] = d$1(null);
11617
11708
  // PERFORMANCE OPTIMIZATION: Lazy component loading
11618
11709
  const [shouldRenderInstanceSelection, setShouldRenderInstanceSelection] = d$1(false);
@@ -11659,6 +11750,29 @@
11659
11750
  initializeWidget();
11660
11751
  // eslint-disable-next-line react-hooks/exhaustive-deps
11661
11752
  }, [config]);
11753
+ // Handle Stripe payment return
11754
+ y$1(() => {
11755
+ const handleStripeReturn = () => {
11756
+ const stripeReturn = detectStripeReturn();
11757
+ if (stripeReturn) {
11758
+ if (stripeReturn.redirectStatus === "succeeded") {
11759
+ // Store payment intent ID and show success modal
11760
+ setSuccessPaymentIntentId(stripeReturn.paymentIntent);
11761
+ setIsSuccess(true);
11762
+ }
11763
+ else if (stripeReturn.redirectStatus === "failed") {
11764
+ setError("Die Zahlung war nicht erfolgreich. Bitte versuche es erneut.");
11765
+ }
11766
+ else {
11767
+ setError("Die Zahlung konnte nicht abgeschlossen werden. Bitte versuche es erneut.");
11768
+ }
11769
+ }
11770
+ };
11771
+ // Only run on mount to avoid running multiple times
11772
+ if (!isLoading) {
11773
+ handleStripeReturn();
11774
+ }
11775
+ }, [isLoading]); // Only depend on isLoading to run after initial load
11662
11776
  // PERFORMANCE OPTIMIZATION: Lazy load components when needed
11663
11777
  y$1(() => {
11664
11778
  if (currentStep === "eventInstances" && !shouldRenderInstanceSelection) {
@@ -11901,7 +12015,7 @@
11901
12015
  };
11902
12016
  const handleBookingSuccess = (result) => {
11903
12017
  setIsSuccess(true);
11904
- setSuccessData(result);
12018
+ setSuccessPaymentIntentId(result.paymentIntent.id);
11905
12019
  config.onSuccess?.(result);
11906
12020
  };
11907
12021
  const handleBookingError = (errorMessage) => {
@@ -12084,10 +12198,18 @@
12084
12198
  setIsSuccess(false);
12085
12199
  setCurrentStep("eventTypes");
12086
12200
  setShowingPreview(true);
12201
+ // Reset state
12202
+ setSuccessPaymentIntentId(null);
12087
12203
  // Reset lazy loading flags
12088
12204
  setShouldRenderInstanceSelection(false);
12089
12205
  setShouldRenderBookingForm(false);
12090
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12206
+ // Clean up URL to remove Stripe parameters
12207
+ const url = new URL(window.location.href);
12208
+ url.searchParams.delete("payment_intent");
12209
+ url.searchParams.delete("payment_intent_client_secret");
12210
+ url.searchParams.delete("redirect_status");
12211
+ window.history.replaceState({}, "", url.toString());
12212
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12091
12213
  }
12092
12214
  if (viewMode === "next-events" && !showingPreview && currentStep === "eventInstances") {
12093
12215
  // Show all events for the single event type
@@ -12101,10 +12223,18 @@
12101
12223
  setIsSuccess(false);
12102
12224
  setCurrentStep("eventTypes");
12103
12225
  setShowingPreview(true);
12226
+ // Reset state
12227
+ setSuccessPaymentIntentId(null);
12104
12228
  // Reset lazy loading flags
12105
12229
  setShouldRenderInstanceSelection(false);
12106
12230
  setShouldRenderBookingForm(false);
12107
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12231
+ // Clean up URL to remove Stripe parameters
12232
+ const url = new URL(window.location.href);
12233
+ url.searchParams.delete("payment_intent");
12234
+ url.searchParams.delete("payment_intent_client_secret");
12235
+ url.searchParams.delete("redirect_status");
12236
+ window.history.replaceState({}, "", url.toString());
12237
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12108
12238
  }
12109
12239
  if (viewMode === "button" && (isSingleEventTypeMode || isDirectInstanceMode)) {
12110
12240
  // Button mode - show button that opens sidebar/booking directly
@@ -12138,10 +12268,18 @@
12138
12268
  setIsSuccess(false);
12139
12269
  setCurrentStep("eventTypes");
12140
12270
  setSidebarOpen(false);
12271
+ // Reset state
12272
+ setSuccessPaymentIntentId(null);
12141
12273
  // Reset lazy loading flags
12142
12274
  setShouldRenderInstanceSelection(false);
12143
12275
  setShouldRenderBookingForm(false);
12144
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }) }));
12276
+ // Clean up URL to remove Stripe parameters
12277
+ const url = new URL(window.location.href);
12278
+ url.searchParams.delete("payment_intent");
12279
+ url.searchParams.delete("payment_intent_client_secret");
12280
+ url.searchParams.delete("redirect_status");
12281
+ window.history.replaceState({}, "", url.toString());
12282
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }) }));
12145
12283
  }
12146
12284
  // Cards mode (default) - show event type selection
12147
12285
  const cardsView = (u$2(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount() }));
@@ -12177,10 +12315,18 @@
12177
12315
  return (u$2(StyleProvider, { config: config, children: [cardsView, shouldRenderInstanceSelection && (u$2(EventInstanceSelection, { eventInstances: eventInstances, selectedEventType: selectedEventType, onEventInstanceSelect: handleEventInstanceSelect, onBackToEventTypes: handleBackToEventTypes, isOpen: currentStep === "eventInstances", onClose: handleBackToEventTypes, isLoadingEventInstances: isLoadingEventInstances, isLoadingEventDetails: isLoadingEventDetails })), shouldRenderBookingForm && eventDetails && (u$2(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 })), u$2(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
12178
12316
  setIsSuccess(false);
12179
12317
  setCurrentStep("eventTypes");
12318
+ // Reset state
12319
+ setSuccessPaymentIntentId(null);
12180
12320
  // Reset lazy loading flags
12181
12321
  setShouldRenderInstanceSelection(false);
12182
12322
  setShouldRenderBookingForm(false);
12183
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12323
+ // Clean up URL to remove Stripe parameters
12324
+ const url = new URL(window.location.href);
12325
+ url.searchParams.delete("payment_intent");
12326
+ url.searchParams.delete("payment_intent_client_secret");
12327
+ url.searchParams.delete("redirect_status");
12328
+ window.history.replaceState({}, "", url.toString());
12329
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12184
12330
  }
12185
12331
 
12186
12332
  // Export init function for vanilla JS usage with Preact