@bigz-app/booking-widget 0.1.25 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 {
@@ -9406,6 +9343,7 @@
9406
9343
  // Main PaymentForm component that handles payment intent creation and Elements wrapper
9407
9344
  function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, systemConfig, stripePromise, stripeAppearance, }) {
9408
9345
  const [clientSecret, setClientSecret] = d$1(null);
9346
+ const [paymentIntentId, setPaymentIntentId] = d$1(null);
9409
9347
  const [isCreatingPaymentIntent, setIsCreatingPaymentIntent] = d$1(false);
9410
9348
  const [paymentError, setPaymentError] = d$1(null);
9411
9349
  // Create payment intent when component mounts or when relevant data changes
@@ -9433,11 +9371,6 @@
9433
9371
  setIsCreatingPaymentIntent(true);
9434
9372
  setPaymentError(null);
9435
9373
  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
9374
  // Build request data with validation
9442
9375
  const requestData = {
9443
9376
  eventInstanceId: config.eventInstanceId || eventDetails.id,
@@ -9446,7 +9379,11 @@
9446
9379
  currency: "eur",
9447
9380
  participants: formData.participants.filter((p) => p.name?.trim()),
9448
9381
  discountCode: discountCode?.code,
9382
+ customerName: formData.customerName?.trim(),
9449
9383
  customerEmail: formData.customerEmail?.trim(),
9384
+ customerPhone: formData.customerPhone?.trim(),
9385
+ comment: formData.comment?.trim(),
9386
+ ...(paymentIntentId && { paymentIntentId }), // Include existing payment intent ID if available
9450
9387
  };
9451
9388
  // Validate required fields
9452
9389
  if (!requestData.eventInstanceId) {
@@ -9464,35 +9401,15 @@
9464
9401
  if (!requestData.customerEmail) {
9465
9402
  throw new Error("Customer email is required");
9466
9403
  }
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), {
9404
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/create-payment-intent"), {
9485
9405
  method: "POST",
9486
9406
  headers: createApiHeaders(config),
9487
9407
  body: JSON.stringify(createRequestBody(config, requestData)),
9488
9408
  });
9489
9409
  const data = await response.json();
9490
9410
  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
9411
  setClientSecret(data.clientSecret);
9412
+ setPaymentIntentId(data.paymentIntentId); // Save payment intent ID for future updates
9496
9413
  }
9497
9414
  else {
9498
9415
  console.error("[PAYMENT_FORM] Payment intent creation failed:", {
@@ -9768,6 +9685,7 @@
9768
9685
  customerPhone: stringType().optional(),
9769
9686
  participants: arrayType(participantSchema).min(1, "Mindestens ein Teilnehmer erforderlich"),
9770
9687
  discountCode: stringType().optional(),
9688
+ comment: stringType().optional(),
9771
9689
  acceptTerms: booleanType()
9772
9690
  .refine((val) => val === true, "Bitte akzeptiere die Allgemeinen Geschäftsbedingungen"),
9773
9691
  });
@@ -9783,6 +9701,7 @@
9783
9701
  defaultValues: {
9784
9702
  participants: [{ name: "", age: undefined }],
9785
9703
  discountCode: "",
9704
+ comment: "",
9786
9705
  acceptTerms: false,
9787
9706
  },
9788
9707
  });
@@ -10169,6 +10088,36 @@
10169
10088
  backdropFilter: "blur(4px)",
10170
10089
  borderRadius: "var(--bw-border-radius)",
10171
10090
  padding: "var(--bw-spacing)",
10091
+ }, children: [u$2("label", { htmlFor: "booking-comment", style: {
10092
+ fontSize: "var(--bw-font-size)",
10093
+ fontWeight: "500",
10094
+ color: "var(--bw-text-color)",
10095
+ fontFamily: "var(--bw-font-family)",
10096
+ display: "block",
10097
+ marginBottom: "8px",
10098
+ }, children: "Kommentar (optional)" }), u$2("textarea", { id: "booking-comment", ...form.register("comment"), placeholder: "Zus\u00E4tzliche Anmerkungen zu Ihrer Buchung...", rows: 3, style: {
10099
+ width: "100%",
10100
+ padding: "12px",
10101
+ border: `1px solid var(--bw-border-color)`,
10102
+ borderRadius: "var(--bw-border-radius)",
10103
+ fontSize: "var(--bw-font-size)",
10104
+ fontFamily: "var(--bw-font-family)",
10105
+ backgroundColor: "var(--bw-input-bg)",
10106
+ color: "var(--bw-text-color)",
10107
+ resize: "vertical",
10108
+ minHeight: "80px",
10109
+ outline: "none",
10110
+ transition: "border-color 0.2s ease",
10111
+ }, onFocus: (e) => {
10112
+ e.target.style.borderColor = "var(--bw-highlight-color)";
10113
+ }, onBlur: (e) => {
10114
+ e.target.style.borderColor = "var(--bw-border-color)";
10115
+ } })] }), u$2("div", { style: {
10116
+ backgroundColor: "var(--bw-surface-color)",
10117
+ border: `1px solid var(--bw-border-color)`,
10118
+ backdropFilter: "blur(4px)",
10119
+ borderRadius: "var(--bw-border-radius)",
10120
+ padding: "var(--bw-spacing)",
10172
10121
  }, children: [u$2("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [u$2("input", { id: "acceptTerms", ...form.register("acceptTerms"), type: "checkbox", style: {
10173
10122
  marginTop: "4px",
10174
10123
  width: "20px",
@@ -10341,162 +10290,339 @@
10341
10290
  ` })] }) }));
10342
10291
  }
10343
10292
 
10344
- const BookingSuccessModal = ({ isOpen, onClose, bookingData, eventDetails, formData, config, }) => {
10345
- if (!isOpen || !bookingData)
10293
+ const BookingSuccessModal = ({ isOpen, onClose, config, onError, paymentIntentId, }) => {
10294
+ const [bookingData, setBookingData] = d$1(null);
10295
+ const [eventDetails, setEventDetails] = d$1(null);
10296
+ const [formData, setFormData] = d$1(null);
10297
+ const [isLoading, setIsLoading] = d$1(false);
10298
+ const [paymentStatus, setPaymentStatus] = d$1(null);
10299
+ const fetchBookingData = async (intentId) => {
10300
+ const targetPaymentIntentId = paymentIntentId;
10301
+ // If we have payment intent ID, fetch from API
10302
+ if (targetPaymentIntentId) {
10303
+ setIsLoading(true);
10304
+ try {
10305
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/get-booking-by-payment-intent"), {
10306
+ method: "POST",
10307
+ headers: createApiHeaders(config),
10308
+ body: JSON.stringify(createRequestBody(config, {
10309
+ paymentIntentId: targetPaymentIntentId,
10310
+ })),
10311
+ });
10312
+ const data = await response.json();
10313
+ if (response.ok) {
10314
+ setBookingData({
10315
+ booking: data.booking,
10316
+ order: data.order,
10317
+ payments: data.payments,
10318
+ orderItems: data.orderItems,
10319
+ stripePaymentIntent: data.stripePaymentIntent,
10320
+ });
10321
+ setEventDetails({
10322
+ id: data.booking.eventInstance.id,
10323
+ name: data.booking.eventInstance.eventType.name,
10324
+ description: data.booking.eventInstance.eventType.description,
10325
+ startTime: data.booking.eventInstance.startTime,
10326
+ endTime: data.booking.eventInstance.endTime,
10327
+ price: data.order.total / data.booking.participantCount,
10328
+ });
10329
+ setFormData({
10330
+ customerEmail: data.booking.customerEmail,
10331
+ customerName: data.booking.customerName,
10332
+ customerPhone: data.booking.customerPhone,
10333
+ participants: data.booking.participants || [],
10334
+ });
10335
+ // Set payment status from Stripe data or order status
10336
+ setPaymentStatus(data.stripePaymentIntent?.status || data.order.status);
10337
+ }
10338
+ else {
10339
+ onError?.(data.error || "Fehler beim Abrufen der Buchungsdaten");
10340
+ }
10341
+ }
10342
+ catch (err) {
10343
+ console.error("[BookingSuccessModal] Error fetching booking data:", err);
10344
+ onError?.("Ein Fehler ist bei der Verarbeitung aufgetreten.");
10345
+ }
10346
+ finally {
10347
+ setIsLoading(false);
10348
+ }
10349
+ return;
10350
+ }
10351
+ };
10352
+ y$1(() => {
10353
+ if (isOpen) {
10354
+ fetchBookingData();
10355
+ }
10356
+ }, [isOpen, paymentIntentId, config, onError]);
10357
+ if (!isOpen)
10346
10358
  return null;
10359
+ // Show loading state while fetching data
10360
+ if (isLoading || !bookingData) {
10361
+ return (u$2(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: u$2("div", { style: {
10362
+ padding: "var(--bw-spacing-large)",
10363
+ textAlign: "center",
10364
+ minHeight: "200px",
10365
+ display: "flex",
10366
+ alignItems: "center",
10367
+ justifyContent: "center",
10368
+ }, children: u$2("div", { style: {
10369
+ color: "var(--bw-text-muted)",
10370
+ fontFamily: "var(--bw-font-family)",
10371
+ fontSize: "var(--bw-font-size-large)",
10372
+ }, children: "Buchungsdaten werden geladen..." }) }) }));
10373
+ }
10347
10374
  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)",
10375
+ new Date(eventDetails.startTime);
10376
+ new Date(eventDetails.endTime);
10377
+ const handlePrint = () => {
10378
+ window.print();
10379
+ };
10380
+ const formatTime12 = (dateString) => {
10381
+ return formatTime(dateString, "Europe/Berlin", "de");
10382
+ };
10383
+ const formatDate12 = (dateString) => {
10384
+ return formatEventDate(dateString);
10385
+ };
10386
+ return (u$2(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: u$2("div", { style: {
10387
+ fontFamily: "var(--bw-font-family)",
10388
+ padding: "var(--bw-spacing-large)",
10389
+ maxWidth: "100%",
10390
+ }, children: [u$2("div", { className: "flex justify-between items-center print-hidden", style: {
10377
10391
  marginBottom: "var(--bw-spacing-large)",
10378
- }, children: [u$2("h3", { style: {
10379
- fontSize: "var(--bw-font-size-large)",
10380
- fontWeight: "600",
10392
+ display: "flex",
10393
+ alignItems: "center",
10394
+ justifyContent: "space-between",
10395
+ }, children: [u$2("h1", { className: "font-bold text-3xl flex items-center gap-2", style: {
10381
10396
  color: "var(--bw-text-color)",
10382
- margin: "0 0 var(--bw-spacing) 0",
10383
10397
  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: {
10398
+ marginBottom: "var(--bw-spacing-large)",
10399
+ display: "flex",
10400
+ alignItems: "center",
10401
+ gap: "var(--bw-spacing-small)",
10402
+ }, children: [u$2("div", { style: {
10403
+ width: "32px",
10404
+ height: "32px",
10405
+ backgroundColor: "var(--bw-highlight-color, #10B981)",
10406
+ borderRadius: "50%",
10415
10407
  display: "flex",
10416
- justifyContent: "space-between",
10417
10408
  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",
10409
+ justifyContent: "center",
10410
+ color: "white",
10411
+ }, children: "\u2713" }), u$2("p", { style: {
10412
+ fontSize: "var(--bw-font-size-large)",
10413
+ fontWeight: "600",
10414
+ color: "var(--bw-highlight-color)",
10415
+ margin: "0px 10px",
10416
+ }, children: "Buchung erfolgreich erstellt!" })] }), u$2("button", { onClick: handlePrint, style: {
10417
+ backgroundColor: "transparent",
10418
+ border: `1px solid var(--bw-border-color)`,
10438
10419
  color: "var(--bw-text-color)",
10439
- margin: "0 0 var(--bw-spacing) 0",
10420
+ padding: "8px 16px",
10421
+ borderRadius: "var(--bw-border-radius)",
10422
+ cursor: "pointer",
10440
10423
  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: {
10424
+ fontSize: "var(--bw-font-size-small)",
10425
+ }, 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: {
10426
+ backgroundColor: "var(--bw-surface-color)",
10427
+ border: `1px solid var(--bw-border-color)`,
10428
+ borderRadius: "var(--bw-border-radius)",
10429
+ padding: "var(--bw-spacing)",
10430
+ marginBottom: "var(--bw-spacing-large)",
10431
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10432
+ fontSize: "var(--bw-font-size-large)",
10433
+ fontWeight: "600",
10450
10434
  color: "var(--bw-text-color)",
10435
+ margin: "0",
10451
10436
  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)",
10437
+ }, 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: {
10438
+ display: "grid",
10439
+ gridTemplateColumns: "1fr 1fr",
10440
+ gap: "var(--bw-spacing)",
10441
+ }, 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: {
10442
+ color: "var(--bw-text-muted)",
10443
+ fontSize: "var(--bw-font-size-small)",
10444
+ fontFamily: "var(--bw-font-family)",
10445
+ }, children: "Buchungs-ID" }), u$2("p", { className: "font-semibold print-detail-value", style: {
10446
+ fontWeight: "600",
10447
+ color: "var(--bw-text-color)",
10448
+ fontFamily: "var(--bw-font-family)",
10449
+ fontSize: "var(--bw-font-size-medium)",
10450
+ margin: "0px 0px 6px 0",
10451
+ }, 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: {
10452
+ color: "var(--bw-text-muted)",
10453
+ fontSize: "var(--bw-font-size-small)",
10454
+ fontFamily: "var(--bw-font-family)",
10455
+ }, children: "Bezahl-Status" }), u$2("div", { children: [u$2("span", { className: "print-hidden", style: {
10456
+ backgroundColor: "var(--bw-success-color, #10B981)",
10457
+ color: "white",
10458
+ padding: "2px 8px",
10459
+ borderRadius: "var(--bw-border-radius-small)",
10460
+ fontSize: "var(--bw-font-size-small)",
10461
+ fontFamily: "var(--bw-font-family)",
10462
+ width: "fit-content",
10463
+ }, children: paymentStatus === "succeeded"
10464
+ ? "erfolgreich"
10465
+ : paymentStatus === "canceled" || paymentStatus === "failed"
10466
+ ? "fehlgeschlagen"
10467
+ : "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: {
10468
+ color: "var(--bw-text-muted)",
10469
+ fontSize: "var(--bw-font-size-small)",
10470
+ fontFamily: "var(--bw-font-family)",
10471
+ }, children: "Event" }), u$2("p", { className: "font-semibold print-detail-value", style: {
10472
+ fontWeight: "600",
10473
+ color: "var(--bw-text-color)",
10474
+ fontFamily: "var(--bw-font-family)",
10475
+ fontSize: "var(--bw-font-size-large)",
10476
+ margin: "0 0 6px 0",
10477
+ }, children: eventDetails.name })] }), u$2("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
10478
+ display: "grid",
10479
+ gridTemplateColumns: "1fr 1fr",
10480
+ gap: "var(--bw-spacing)",
10481
+ }, children: [u$2("div", { className: "print-detail-item", children: [u$2("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10482
+ color: "var(--bw-text-muted)",
10483
+ fontSize: "var(--bw-font-size-small)",
10484
+ fontFamily: "var(--bw-font-family)",
10485
+ }, children: "Datum" }), u$2("p", { className: "print-detail-value", style: {
10486
+ fontWeight: "600",
10487
+ color: "var(--bw-text-color)",
10488
+ fontFamily: "var(--bw-font-family)",
10489
+ fontSize: "var(--bw-font-size-large)",
10490
+ margin: "0 0 6px 0",
10491
+ }, 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: {
10492
+ color: "var(--bw-text-muted)",
10493
+ fontSize: "var(--bw-font-size-small)",
10494
+ fontFamily: "var(--bw-font-family)",
10495
+ }, children: "Zeit" }), u$2("p", { className: "print-detail-value", style: {
10496
+ fontWeight: "600",
10497
+ color: "var(--bw-text-color)",
10498
+ fontFamily: "var(--bw-font-family)",
10499
+ fontSize: "var(--bw-font-size-large)",
10500
+ margin: "0 0 6px 0",
10501
+ }, children: [formatTime12(eventDetails.startTime), " - ", formatTime12(eventDetails.endTime)] })] })] })] })] }), formData.participants && formData.participants.length > 0 && (u$2("div", { className: "print-booking-card", style: {
10502
+ border: `1px solid var(--bw-border-color)`,
10503
+ borderRadius: "var(--bw-border-radius)",
10504
+ padding: "var(--bw-spacing)",
10505
+ marginBottom: "var(--bw-spacing-large)",
10506
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10507
+ fontSize: "var(--bw-font-size-large)",
10508
+ fontWeight: "600",
10509
+ color: "var(--bw-text-color)",
10510
+ margin: "0",
10455
10511
  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" }) })] }) }));
10512
+ }, 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: {
10513
+ display: "flex",
10514
+ flexDirection: "column",
10515
+ gap: "var(--bw-spacing-small)",
10516
+ }, children: formData.participants
10517
+ .filter((p) => p.name.trim())
10518
+ .map((participant, index) => (u$2("div", { className: "flex justify-between items-center bg-muted p-3 rounded-lg print-participant", style: {
10519
+ display: "flex",
10520
+ justifyContent: "space-between",
10521
+ alignItems: "center",
10522
+ backgroundColor: "var(--bw-surface-color, #f9fafb)",
10523
+ padding: "var(--bw-spacing-small)",
10524
+ borderRadius: "var(--bw-border-radius-small)",
10525
+ }, children: u$2("div", { className: "print-participant-info", children: [u$2("div", { className: "print-participant-name", style: {
10526
+ color: "var(--bw-text-color)",
10527
+ fontFamily: "var(--bw-font-family)",
10528
+ }, children: participant.name }), participant.age && (u$2("div", { className: "text-muted-foreground text-sm print-participant-age", style: {
10529
+ color: "var(--bw-text-muted)",
10530
+ fontSize: "var(--bw-font-size-small)",
10531
+ fontFamily: "var(--bw-font-family)",
10532
+ }, children: [participant.age, " Jahre"] }))] }) }, index))) }) })] })), u$2("div", { className: "print-booking-card", style: {
10533
+ backgroundColor: "var(--bw-surface-color)",
10534
+ border: `1px solid var(--bw-border-color)`,
10535
+ borderRadius: "var(--bw-border-radius)",
10536
+ padding: "var(--bw-spacing)",
10537
+ marginBottom: "var(--bw-spacing-large)",
10538
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10539
+ fontSize: "var(--bw-font-size-large)",
10540
+ fontWeight: "600",
10541
+ color: "var(--bw-text-color)",
10542
+ margin: "0",
10543
+ fontFamily: "var(--bw-font-family)",
10544
+ }, 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: {
10545
+ backgroundColor: "var(--bw-surface-color)",
10546
+ border: `1px solid var(--bw-border-color)`,
10547
+ borderRadius: "var(--bw-border-radius)",
10548
+ padding: "var(--bw-spacing)",
10549
+ marginBottom: "var(--bw-spacing-large)",
10550
+ }, children: [u$2("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: u$2("h3", { style: {
10551
+ fontSize: "var(--bw-font-size-large)",
10552
+ fontWeight: "600",
10553
+ color: "var(--bw-text-color)",
10554
+ margin: "0",
10555
+ fontFamily: "var(--bw-font-family)",
10556
+ }, 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: {
10557
+ backgroundColor: "var(--bw-surface-color)",
10558
+ border: `1px solid var(--bw-border-color)`,
10559
+ borderRadius: "var(--bw-border-radius)",
10560
+ padding: "var(--bw-spacing)",
10561
+ marginBottom: "var(--bw-spacing-large)",
10562
+ textAlign: "center",
10563
+ }, children: u$2("p", { style: {
10564
+ color: "var(--bw-text-muted)",
10565
+ margin: 0,
10566
+ fontFamily: "var(--bw-font-family)",
10567
+ fontSize: "var(--bw-font-size-small)",
10568
+ textAlign: "center",
10569
+ }, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] }) }), paymentStatus && paymentStatus !== "succeeded" && (u$2("div", { style: {
10570
+ backgroundColor: "var(--bw-warning-bg, #FEF3C7)",
10571
+ border: "1px solid var(--bw-warning-border, #F59E0B)",
10572
+ borderRadius: "var(--bw-border-radius)",
10573
+ padding: "var(--bw-spacing)",
10574
+ marginBottom: "var(--bw-spacing-large)",
10575
+ textAlign: "center",
10576
+ }, children: [u$2("p", { style: {
10577
+ color: "var(--bw-warning-text, #92400E)",
10578
+ margin: "0 0 var(--bw-spacing) 0",
10579
+ fontFamily: "var(--bw-font-family)",
10580
+ fontWeight: "600",
10581
+ }, children: "Zahlung wird noch verarbeitet" }), u$2("p", { style: {
10582
+ color: "var(--bw-warning-text, #92400E)",
10583
+ margin: "0 0 var(--bw-spacing) 0",
10584
+ fontFamily: "var(--bw-font-family)",
10585
+ fontSize: "var(--bw-font-size-small)",
10586
+ }, children: ["Status: ", paymentStatus] }), u$2("button", { onClick: () => fetchBookingData(), disabled: isLoading, style: {
10587
+ backgroundColor: "var(--bw-warning-text, #92400E)",
10588
+ color: "white",
10589
+ padding: "8px 16px",
10590
+ border: "none",
10591
+ borderRadius: "var(--bw-border-radius)",
10592
+ fontSize: "var(--bw-font-size-small)",
10593
+ fontWeight: "600",
10594
+ cursor: isLoading ? "not-allowed" : "pointer",
10595
+ fontFamily: "var(--bw-font-family)",
10596
+ opacity: isLoading ? 0.6 : 1,
10597
+ transition: "all 0.2s ease",
10598
+ }, children: isLoading ? "Aktualisiere..." : "Status aktualisieren" })] })), u$2("div", { style: {
10599
+ textAlign: "center",
10600
+ marginTop: "var(--bw-spacing-large)",
10601
+ paddingTop: "var(--bw-spacing)",
10602
+ borderTop: `1px solid var(--bw-border-color)`,
10603
+ }, children: u$2("button", { onClick: onClose, style: {
10604
+ backgroundColor: "var(--bw-highlight-color)",
10605
+ color: "white",
10606
+ padding: "12px 32px",
10607
+ border: "none",
10608
+ borderRadius: "var(--bw-border-radius)",
10609
+ fontSize: "var(--bw-font-size)",
10610
+ fontWeight: "600",
10611
+ cursor: "pointer",
10612
+ fontFamily: "var(--bw-font-family)",
10613
+ transition: "all 0.2s ease",
10614
+ }, onMouseEnter: (e) => {
10615
+ e.currentTarget.style.opacity = "0.9";
10616
+ }, onMouseLeave: (e) => {
10617
+ e.currentTarget.style.opacity = "1";
10618
+ }, 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", {
10619
+ day: "2-digit",
10620
+ month: "2-digit",
10621
+ year: "numeric",
10622
+ hour: "2-digit",
10623
+ minute: "2-digit",
10624
+ timeZone: "Europe/Berlin",
10625
+ }), " ", "erstellt."] }), u$2("p", { children: "Bei Fragen zu deiner Buchung kontaktiere uns gerne." })] })] })] }) }));
10500
10626
  };
10501
10627
 
10502
10628
  const months = [
@@ -11612,7 +11738,7 @@
11612
11738
  const [isLoadingShowAll, setIsLoadingShowAll] = d$1(false); // For "show all events" operation
11613
11739
  const [error, setError] = d$1(null);
11614
11740
  const [isSuccess, setIsSuccess] = d$1(false);
11615
- const [successData, setSuccessData] = d$1(null);
11741
+ const [successPaymentIntentId, setSuccessPaymentIntentId] = d$1(null);
11616
11742
  const [systemConfig, setSystemConfig] = d$1(null);
11617
11743
  // PERFORMANCE OPTIMIZATION: Lazy component loading
11618
11744
  const [shouldRenderInstanceSelection, setShouldRenderInstanceSelection] = d$1(false);
@@ -11659,6 +11785,29 @@
11659
11785
  initializeWidget();
11660
11786
  // eslint-disable-next-line react-hooks/exhaustive-deps
11661
11787
  }, [config]);
11788
+ // Handle Stripe payment return
11789
+ y$1(() => {
11790
+ const handleStripeReturn = () => {
11791
+ const stripeReturn = detectStripeReturn();
11792
+ if (stripeReturn) {
11793
+ if (stripeReturn.redirectStatus === "succeeded") {
11794
+ // Store payment intent ID and show success modal
11795
+ setSuccessPaymentIntentId(stripeReturn.paymentIntent);
11796
+ setIsSuccess(true);
11797
+ }
11798
+ else if (stripeReturn.redirectStatus === "failed") {
11799
+ setError("Die Zahlung war nicht erfolgreich. Bitte versuche es erneut.");
11800
+ }
11801
+ else {
11802
+ setError("Die Zahlung konnte nicht abgeschlossen werden. Bitte versuche es erneut.");
11803
+ }
11804
+ }
11805
+ };
11806
+ // Only run on mount to avoid running multiple times
11807
+ if (!isLoading) {
11808
+ handleStripeReturn();
11809
+ }
11810
+ }, [isLoading]); // Only depend on isLoading to run after initial load
11662
11811
  // PERFORMANCE OPTIMIZATION: Lazy load components when needed
11663
11812
  y$1(() => {
11664
11813
  if (currentStep === "eventInstances" && !shouldRenderInstanceSelection) {
@@ -11901,7 +12050,7 @@
11901
12050
  };
11902
12051
  const handleBookingSuccess = (result) => {
11903
12052
  setIsSuccess(true);
11904
- setSuccessData(result);
12053
+ setSuccessPaymentIntentId(result.paymentIntent.id);
11905
12054
  config.onSuccess?.(result);
11906
12055
  };
11907
12056
  const handleBookingError = (errorMessage) => {
@@ -12084,10 +12233,18 @@
12084
12233
  setIsSuccess(false);
12085
12234
  setCurrentStep("eventTypes");
12086
12235
  setShowingPreview(true);
12236
+ // Reset state
12237
+ setSuccessPaymentIntentId(null);
12087
12238
  // Reset lazy loading flags
12088
12239
  setShouldRenderInstanceSelection(false);
12089
12240
  setShouldRenderBookingForm(false);
12090
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12241
+ // Clean up URL to remove Stripe parameters
12242
+ const url = new URL(window.location.href);
12243
+ url.searchParams.delete("payment_intent");
12244
+ url.searchParams.delete("payment_intent_client_secret");
12245
+ url.searchParams.delete("redirect_status");
12246
+ window.history.replaceState({}, "", url.toString());
12247
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12091
12248
  }
12092
12249
  if (viewMode === "next-events" && !showingPreview && currentStep === "eventInstances") {
12093
12250
  // Show all events for the single event type
@@ -12101,10 +12258,18 @@
12101
12258
  setIsSuccess(false);
12102
12259
  setCurrentStep("eventTypes");
12103
12260
  setShowingPreview(true);
12261
+ // Reset state
12262
+ setSuccessPaymentIntentId(null);
12104
12263
  // Reset lazy loading flags
12105
12264
  setShouldRenderInstanceSelection(false);
12106
12265
  setShouldRenderBookingForm(false);
12107
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12266
+ // Clean up URL to remove Stripe parameters
12267
+ const url = new URL(window.location.href);
12268
+ url.searchParams.delete("payment_intent");
12269
+ url.searchParams.delete("payment_intent_client_secret");
12270
+ url.searchParams.delete("redirect_status");
12271
+ window.history.replaceState({}, "", url.toString());
12272
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12108
12273
  }
12109
12274
  if (viewMode === "button" && (isSingleEventTypeMode || isDirectInstanceMode)) {
12110
12275
  // Button mode - show button that opens sidebar/booking directly
@@ -12138,10 +12303,18 @@
12138
12303
  setIsSuccess(false);
12139
12304
  setCurrentStep("eventTypes");
12140
12305
  setSidebarOpen(false);
12306
+ // Reset state
12307
+ setSuccessPaymentIntentId(null);
12141
12308
  // Reset lazy loading flags
12142
12309
  setShouldRenderInstanceSelection(false);
12143
12310
  setShouldRenderBookingForm(false);
12144
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }) }));
12311
+ // Clean up URL to remove Stripe parameters
12312
+ const url = new URL(window.location.href);
12313
+ url.searchParams.delete("payment_intent");
12314
+ url.searchParams.delete("payment_intent_client_secret");
12315
+ url.searchParams.delete("redirect_status");
12316
+ window.history.replaceState({}, "", url.toString());
12317
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }) }));
12145
12318
  }
12146
12319
  // Cards mode (default) - show event type selection
12147
12320
  const cardsView = (u$2(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount() }));
@@ -12177,10 +12350,18 @@
12177
12350
  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
12351
  setIsSuccess(false);
12179
12352
  setCurrentStep("eventTypes");
12353
+ // Reset state
12354
+ setSuccessPaymentIntentId(null);
12180
12355
  // Reset lazy loading flags
12181
12356
  setShouldRenderInstanceSelection(false);
12182
12357
  setShouldRenderBookingForm(false);
12183
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12358
+ // Clean up URL to remove Stripe parameters
12359
+ const url = new URL(window.location.href);
12360
+ url.searchParams.delete("payment_intent");
12361
+ url.searchParams.delete("payment_intent_client_secret");
12362
+ url.searchParams.delete("redirect_status");
12363
+ window.history.replaceState({}, "", url.toString());
12364
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12184
12365
  }
12185
12366
 
12186
12367
  // Export init function for vanilla JS usage with Preact