@bigz-app/booking-widget 0.1.25 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -571,6 +571,13 @@ const StyleProvider = ({ config, children, }) => {
571
571
  direction: ltr;
572
572
  isolation: isolate;
573
573
  }
574
+ .print-only {
575
+ display: none;
576
+ }
577
+ .print-hidden {
578
+ display: block;
579
+ }
580
+ @media print {
574
581
  `;
575
582
  // Inject CSS reset styles
576
583
  useEffect(() => {
@@ -916,6 +923,26 @@ const createRequestBody = (config, additionalData) => {
916
923
  organizationId: config.organizationId,
917
924
  };
918
925
  };
926
+ // Helper function to detect Stripe return parameters in URL
927
+ const detectStripeReturn = () => {
928
+ if (typeof window === "undefined") {
929
+ return null;
930
+ }
931
+ const urlParams = new URLSearchParams(window.location.search);
932
+ // Check for Stripe return parameters
933
+ const paymentIntent = urlParams.get("payment_intent");
934
+ const paymentIntentClientSecret = urlParams.get("payment_intent_client_secret");
935
+ const redirectStatus = urlParams.get("redirect_status");
936
+ if (paymentIntent && paymentIntentClientSecret && redirectStatus) {
937
+ return {
938
+ isStripeReturn: true,
939
+ paymentIntent,
940
+ paymentIntentClientSecret,
941
+ redirectStatus,
942
+ };
943
+ }
944
+ return null;
945
+ };
919
946
 
920
947
  var isCheckBoxInput = (element) => element.type === 'checkbox';
921
948
 
@@ -9098,7 +9125,7 @@ const spinner = (borderColor) => (jsx("div", { style: {
9098
9125
  borderRadius: "50%",
9099
9126
  } }) }));
9100
9127
  // Inner component that uses the Stripe hooks
9101
- function PaymentFormInner({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, systemConfig, clientSecret, }) {
9128
+ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, }) {
9102
9129
  const stripe = reactStripe_umdExports.useStripe();
9103
9130
  const elements = reactStripe_umdExports.useElements();
9104
9131
  const [isLoading, setIsLoading] = useState(false);
@@ -9124,26 +9151,12 @@ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discoun
9124
9151
  return;
9125
9152
  }
9126
9153
  // First, confirm the payment with Stripe
9154
+ // Build return URL for Stripe redirect
9155
+ const baseUrl = window !== undefined ? window.location.href : `${config.bookingSystemUrl}/booking-success`;
9156
+ const returnUrl = new URL(baseUrl);
9127
9157
  const confirmParams = {
9128
- return_url: "https://bigz.surfschule-zingst.de/booking/success",
9158
+ return_url: returnUrl.toString(),
9129
9159
  };
9130
- // Ensure return_url is properly formatted and doesn't contain fragment identifiers
9131
- try {
9132
- const url = new URL(confirmParams.return_url);
9133
- // Remove any fragment identifiers that might cause issues
9134
- url.hash = "";
9135
- confirmParams.return_url = url.toString();
9136
- }
9137
- catch (e) {
9138
- console.warn("[PAYMENT_FORM] Invalid return_url, using fallback:", confirmParams.return_url);
9139
- // Fallback to current origin if URL parsing fails
9140
- confirmParams.return_url = window.location.origin + window.location.pathname;
9141
- }
9142
- console.log("[PAYMENT_FORM] Confirming payment with params:", {
9143
- paymentIntentId: clientSecret.split("_secret_")[0],
9144
- return_url: confirmParams.return_url,
9145
- redirect: "if_required",
9146
- });
9147
9160
  const { error, paymentIntent } = await stripe.confirmPayment({
9148
9161
  elements,
9149
9162
  confirmParams,
@@ -9161,91 +9174,15 @@ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discoun
9161
9174
  setPaymentError(error.message || "Zahlungsfehler");
9162
9175
  }
9163
9176
  else {
9164
- setPaymentError("Ein unerwarteter Fehler ist aufgetreten.");
9177
+ setPaymentError("Ein unerwarteter Fehler ist aufgetreten. Bitte versuche es nochmal.");
9165
9178
  }
9166
9179
  return;
9167
9180
  }
9168
9181
  // Payment succeeded, now create the booking
9169
9182
  if (paymentIntent && paymentIntent.status === "succeeded") {
9170
- // Check if we have system configuration
9171
- if (!systemConfig) {
9172
- throw new Error("System-Konfiguration nicht verfügbar. Bitte lade die Seite neu.");
9173
- }
9174
- // Determine which endpoint to use based on system mode
9175
- const isConnectMode = systemConfig.systemMode === "connect";
9176
- const endpoint = isConnectMode
9177
- ? "/booking/create-from-payment"
9178
- : "/booking-proxy/create-booking";
9179
- // Calculate if this is a deposit payment
9180
- const fullAmount = eventDetails.price * formData.participants.filter((p) => p.name.trim()).length;
9181
- const isDepositPayment = eventDetails.deposit > 0;
9182
- // Build request body based on mode
9183
- const requestData = {
9184
- // Payment info
9185
- paymentIntentId: paymentIntent.id,
9186
- paymentMethod: "card",
9187
- paymentStatus: isDepositPayment ? "deposit_paid" : "paid",
9188
- totalAmount,
9189
- depositAmount: isDepositPayment ? totalAmount : undefined,
9190
- fullAmount: fullAmount,
9191
- // Customer info
9192
- customerEmail: formData.customerEmail,
9193
- customerName: formData.customerName,
9194
- customerPhone: formData.customerPhone,
9195
- // Booking info
9196
- participants: formData.participants.filter((p) => p.name.trim()),
9197
- eventInstanceId: config.eventInstanceId || eventDetails.id,
9198
- organizationId: config.organizationId, // Ensure organization ID is always included
9199
- discountCode: discountCode?.code,
9200
- notes: "",
9201
- };
9202
- // Add mode-specific fields
9203
- if (isConnectMode) {
9204
- Object.assign(requestData, {
9205
- source: "connect",
9206
- stripeAccountType: "connect",
9207
- });
9208
- }
9209
- else {
9210
- // ApiKey mode - include required proxy fields
9211
- Object.assign(requestData, {
9212
- bookingSystemApiUrl: config.apiBaseUrl,
9213
- // apiKey would be added here if required
9214
- });
9215
- }
9216
- console.log(`[PAYMENT_FORM] Attempting booking creation via ${endpoint}`, {
9217
- mode: isConnectMode ? "connect" : "apikey",
9218
- paymentIntentId: paymentIntent.id,
9219
- eventInstanceId: requestData.eventInstanceId,
9220
- organizationId: requestData.organizationId,
9221
- participantCount: requestData.participants.length,
9222
- });
9223
- const bookingResponse = await fetch(getApiUrl(config.apiBaseUrl, endpoint), {
9224
- method: "POST",
9225
- headers: createApiHeaders(config),
9226
- body: JSON.stringify(createRequestBody(config, requestData)),
9227
- });
9228
- const bookingData = await bookingResponse.json();
9229
- if (!bookingResponse.ok) {
9230
- console.error(`[PAYMENT_FORM] Booking creation failed:`, {
9231
- status: bookingResponse.status,
9232
- error: bookingData.error,
9233
- details: bookingData.details,
9234
- paymentIntentId: paymentIntent.id,
9235
- });
9236
- throw new Error(bookingData.error || "Fehler beim Erstellen der Buchung");
9237
- }
9238
- console.log(`[PAYMENT_FORM] Booking created successfully:`, {
9239
- bookingId: bookingData.booking?.id,
9240
- orderId: bookingData.order?.id,
9241
- paymentIntentId: paymentIntent.id,
9242
- });
9243
9183
  // Booking created successfully
9244
9184
  onSuccess({
9245
- booking: bookingData.booking,
9246
- payment: "succeeded",
9247
9185
  paymentIntent: paymentIntent,
9248
- formData: formData,
9249
9186
  });
9250
9187
  }
9251
9188
  else {
@@ -9348,11 +9285,6 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9348
9285
  setIsCreatingPaymentIntent(true);
9349
9286
  setPaymentError(null);
9350
9287
  try {
9351
- // Determine endpoint based on system mode
9352
- const isConnectMode = systemConfig.systemMode === "connect";
9353
- const endpoint = isConnectMode
9354
- ? "/booking/create-payment-intent"
9355
- : "/booking-proxy/create-payment-intent";
9356
9288
  // Build request data with validation
9357
9289
  const requestData = {
9358
9290
  eventInstanceId: config.eventInstanceId || eventDetails.id,
@@ -9361,7 +9293,10 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9361
9293
  currency: "eur",
9362
9294
  participants: formData.participants.filter((p) => p.name?.trim()),
9363
9295
  discountCode: discountCode?.code,
9296
+ customerName: formData.customerName?.trim(),
9364
9297
  customerEmail: formData.customerEmail?.trim(),
9298
+ customerPhone: formData.customerPhone?.trim(),
9299
+ comment: formData.comment?.trim(),
9365
9300
  };
9366
9301
  // Validate required fields
9367
9302
  if (!requestData.eventInstanceId) {
@@ -9379,34 +9314,13 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9379
9314
  if (!requestData.customerEmail) {
9380
9315
  throw new Error("Customer email is required");
9381
9316
  }
9382
- console.log("[PAYMENT_FORM] Creating payment intent:", {
9383
- endpoint,
9384
- mode: isConnectMode ? "connect" : "apikey",
9385
- amount: requestData.amount,
9386
- currency: requestData.currency,
9387
- participantCount: requestData.participants.length,
9388
- organizationId: requestData.organizationId,
9389
- eventInstanceId: requestData.eventInstanceId,
9390
- });
9391
- // Add mode-specific fields
9392
- if (!isConnectMode) {
9393
- // ApiKey mode needs additional fields
9394
- Object.assign(requestData, {
9395
- bookingSystemApiUrl: config.apiBaseUrl,
9396
- // apiKey would be added here if required
9397
- });
9398
- }
9399
- const response = await fetch(getApiUrl(config.apiBaseUrl, endpoint), {
9317
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/create-payment-intent"), {
9400
9318
  method: "POST",
9401
9319
  headers: createApiHeaders(config),
9402
9320
  body: JSON.stringify(createRequestBody(config, requestData)),
9403
9321
  });
9404
9322
  const data = await response.json();
9405
9323
  if (response.ok) {
9406
- console.log("[PAYMENT_FORM] Payment intent created successfully:", {
9407
- hasClientSecret: !!data.clientSecret,
9408
- clientSecretPrefix: `${data.clientSecret?.substring(0, 20)}...`,
9409
- });
9410
9324
  setClientSecret(data.clientSecret);
9411
9325
  }
9412
9326
  else {
@@ -10256,162 +10170,339 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
10256
10170
  ` })] }) }));
10257
10171
  }
10258
10172
 
10259
- const BookingSuccessModal = ({ isOpen, onClose, bookingData, eventDetails, formData, config, }) => {
10260
- if (!isOpen || !bookingData)
10173
+ const BookingSuccessModal = ({ isOpen, onClose, config, onError, paymentIntentId, }) => {
10174
+ const [bookingData, setBookingData] = useState(null);
10175
+ const [eventDetails, setEventDetails] = useState(null);
10176
+ const [formData, setFormData] = useState(null);
10177
+ const [isLoading, setIsLoading] = useState(false);
10178
+ const [paymentStatus, setPaymentStatus] = useState(null);
10179
+ const fetchBookingData = async (intentId) => {
10180
+ const targetPaymentIntentId = paymentIntentId;
10181
+ // If we have payment intent ID, fetch from API
10182
+ if (targetPaymentIntentId) {
10183
+ setIsLoading(true);
10184
+ try {
10185
+ const response = await fetch(getApiUrl(config.apiBaseUrl, "/booking/get-booking-by-payment-intent"), {
10186
+ method: "POST",
10187
+ headers: createApiHeaders(config),
10188
+ body: JSON.stringify(createRequestBody(config, {
10189
+ paymentIntentId: targetPaymentIntentId,
10190
+ })),
10191
+ });
10192
+ const data = await response.json();
10193
+ if (response.ok) {
10194
+ setBookingData({
10195
+ booking: data.booking,
10196
+ order: data.order,
10197
+ payments: data.payments,
10198
+ orderItems: data.orderItems,
10199
+ stripePaymentIntent: data.stripePaymentIntent,
10200
+ });
10201
+ setEventDetails({
10202
+ id: data.booking.eventInstance.id,
10203
+ name: data.booking.eventInstance.eventType.name,
10204
+ description: data.booking.eventInstance.eventType.description,
10205
+ startTime: data.booking.eventInstance.startTime,
10206
+ endTime: data.booking.eventInstance.endTime,
10207
+ price: data.order.total / data.booking.participantCount,
10208
+ });
10209
+ setFormData({
10210
+ customerEmail: data.booking.customerEmail,
10211
+ customerName: data.booking.customerName,
10212
+ customerPhone: data.booking.customerPhone,
10213
+ participants: data.booking.participants || [],
10214
+ });
10215
+ // Set payment status from Stripe data or order status
10216
+ setPaymentStatus(data.stripePaymentIntent?.status || data.order.status);
10217
+ }
10218
+ else {
10219
+ onError?.(data.error || "Fehler beim Abrufen der Buchungsdaten");
10220
+ }
10221
+ }
10222
+ catch (err) {
10223
+ console.error("[BookingSuccessModal] Error fetching booking data:", err);
10224
+ onError?.("Ein Fehler ist bei der Verarbeitung aufgetreten.");
10225
+ }
10226
+ finally {
10227
+ setIsLoading(false);
10228
+ }
10229
+ return;
10230
+ }
10231
+ };
10232
+ useEffect(() => {
10233
+ if (isOpen) {
10234
+ fetchBookingData();
10235
+ }
10236
+ }, [isOpen, paymentIntentId, config, onError]);
10237
+ if (!isOpen)
10261
10238
  return null;
10239
+ // Show loading state while fetching data
10240
+ if (isLoading || !bookingData) {
10241
+ return (jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsx("div", { style: {
10242
+ padding: "var(--bw-spacing-large)",
10243
+ textAlign: "center",
10244
+ minHeight: "200px",
10245
+ display: "flex",
10246
+ alignItems: "center",
10247
+ justifyContent: "center",
10248
+ }, children: jsx("div", { style: {
10249
+ color: "var(--bw-text-muted)",
10250
+ fontFamily: "var(--bw-font-family)",
10251
+ fontSize: "var(--bw-font-size-large)",
10252
+ }, children: "Buchungsdaten werden geladen..." }) }) }));
10253
+ }
10262
10254
  const booking = bookingData.booking;
10263
- return (jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsxs("div", { style: { padding: "var(--bw-spacing-large)" }, children: [jsxs("div", { style: {
10264
- textAlign: "center",
10265
- marginBottom: "var(--bw-spacing-large)",
10266
- }, children: [jsx("div", { style: {
10267
- width: "64px",
10268
- height: "64px",
10269
- backgroundColor: "var(--bw-success-color, #10B981)",
10270
- borderRadius: "50%",
10271
- margin: "0 auto var(--bw-spacing)",
10272
- display: "flex",
10273
- alignItems: "center",
10274
- justifyContent: "center",
10275
- fontSize: "32px",
10276
- color: "white",
10277
- }, children: "\u2713" }), jsx("h2", { style: {
10278
- fontSize: "var(--bw-font-size-xl)",
10279
- fontWeight: "700",
10280
- color: "var(--bw-text-color)",
10281
- margin: "0 0 var(--bw-spacing-small) 0",
10282
- fontFamily: "var(--bw-font-family)",
10283
- }, children: "Buchung erfolgreich!" }), jsx("p", { style: {
10284
- color: "var(--bw-text-muted)",
10285
- fontFamily: "var(--bw-font-family)",
10286
- margin: 0,
10287
- }, children: "Deine Buchung wurde erfolgreich abgeschlossen." })] }), jsxs("div", { style: {
10288
- backgroundColor: "var(--bw-surface-color)",
10289
- border: `1px solid var(--bw-border-color)`,
10290
- borderRadius: "var(--bw-border-radius)",
10291
- padding: "var(--bw-spacing)",
10255
+ new Date(eventDetails.startTime);
10256
+ new Date(eventDetails.endTime);
10257
+ const handlePrint = () => {
10258
+ window.print();
10259
+ };
10260
+ const formatTime12 = (dateString) => {
10261
+ return formatTime(dateString, "Europe/Berlin", "de");
10262
+ };
10263
+ const formatDate12 = (dateString) => {
10264
+ return formatEventDate(dateString);
10265
+ };
10266
+ return (jsx(DialogWrapper, { isOpen: isOpen, onClose: onClose, maxWidth: "700px", children: jsxs("div", { style: {
10267
+ fontFamily: "var(--bw-font-family)",
10268
+ padding: "var(--bw-spacing-large)",
10269
+ maxWidth: "100%",
10270
+ }, children: [jsxs("div", { className: "flex justify-between items-center print-hidden", style: {
10292
10271
  marginBottom: "var(--bw-spacing-large)",
10293
- }, children: [jsx("h3", { style: {
10294
- fontSize: "var(--bw-font-size-large)",
10295
- fontWeight: "600",
10272
+ display: "flex",
10273
+ alignItems: "center",
10274
+ justifyContent: "space-between",
10275
+ }, children: [jsxs("h1", { className: "font-bold text-3xl flex items-center gap-2", style: {
10296
10276
  color: "var(--bw-text-color)",
10297
- margin: "0 0 var(--bw-spacing) 0",
10298
10277
  fontFamily: "var(--bw-font-family)",
10299
- }, children: "Buchungsdetails" }), jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing)" }, children: [booking.bookingHash && (jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Buchungs-ID:" }), jsx("span", { style: {
10300
- color: "var(--bw-text-color)",
10301
- fontWeight: "500",
10302
- fontFamily: "monospace",
10303
- fontSize: "var(--bw-font-size-small)",
10304
- backgroundColor: "var(--bw-background-color)",
10305
- padding: "4px 8px",
10306
- borderRadius: "var(--bw-border-radius-small)",
10307
- }, children: booking.bookingHash })] })), jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Event:" }), jsx("span", { style: {
10308
- color: "var(--bw-text-color)",
10309
- fontWeight: "500",
10310
- fontFamily: "var(--bw-font-family)",
10311
- textAlign: "right",
10312
- maxWidth: "60%",
10313
- }, children: eventDetails.name })] }), jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Datum:" }), jsx("span", { style: {
10314
- color: "var(--bw-text-color)",
10315
- fontWeight: "500",
10316
- fontFamily: "var(--bw-font-family)",
10317
- textAlign: "right",
10318
- maxWidth: "60%",
10319
- }, children: formatEventDate(eventDetails.startTime) })] }), jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Uhrzeit:" }), jsx("span", { style: {
10320
- color: "var(--bw-text-color)",
10321
- fontWeight: "500",
10322
- fontFamily: "var(--bw-font-family)",
10323
- textAlign: "right",
10324
- maxWidth: "60%",
10325
- }, children: formatTime(eventDetails.startTime, "Europe/Berlin", "de") })] }), jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Teilnehmer:" }), jsx("span", { style: {
10326
- color: "var(--bw-text-color)",
10327
- fontWeight: "500",
10328
- fontFamily: "var(--bw-font-family)",
10329
- }, children: booking.participantCount })] }), jsxs("div", { style: {
10278
+ marginBottom: "var(--bw-spacing-large)",
10279
+ display: "flex",
10280
+ alignItems: "center",
10281
+ gap: "var(--bw-spacing-small)",
10282
+ }, children: [jsx("div", { style: {
10283
+ width: "32px",
10284
+ height: "32px",
10285
+ backgroundColor: "var(--bw-highlight-color, #10B981)",
10286
+ borderRadius: "50%",
10330
10287
  display: "flex",
10331
- justifyContent: "space-between",
10332
10288
  alignItems: "center",
10333
- borderTop: `1px solid var(--bw-border-color)`,
10334
- paddingTop: "var(--bw-spacing)",
10335
- marginTop: "var(--bw-spacing)",
10336
- }, children: [jsx("span", { style: {
10337
- color: "var(--bw-text-color)",
10338
- fontWeight: "600",
10339
- fontFamily: "var(--bw-font-family)",
10340
- }, children: "Gesamtbetrag:" }), jsx("span", { style: {
10341
- color: "var(--bw-text-color)",
10342
- fontWeight: "600",
10343
- fontSize: "var(--bw-font-size-large)",
10344
- fontFamily: "var(--bw-font-family)",
10345
- }, children: formatCurrency(booking.total) })] })] })] }), formData.participants && formData.participants.length > 0 && (jsxs("div", { style: {
10346
- border: `1px solid var(--bw-border-color)`,
10347
- borderRadius: "var(--bw-border-radius)",
10348
- padding: "var(--bw-spacing)",
10349
- marginBottom: "var(--bw-spacing-large)",
10350
- }, children: [jsx("h3", { style: {
10351
- fontSize: "var(--bw-font-size-large)",
10352
- fontWeight: "600",
10289
+ justifyContent: "center",
10290
+ color: "white",
10291
+ }, children: "\u2713" }), jsx("p", { style: {
10292
+ fontSize: "var(--bw-font-size-large)",
10293
+ fontWeight: "600",
10294
+ color: "var(--bw-highlight-color)",
10295
+ margin: "0px 10px",
10296
+ }, children: "Buchung erfolgreich erstellt!" })] }), jsx("button", { onClick: handlePrint, style: {
10297
+ backgroundColor: "transparent",
10298
+ border: `1px solid var(--bw-border-color)`,
10353
10299
  color: "var(--bw-text-color)",
10354
- margin: "0 0 var(--bw-spacing) 0",
10300
+ padding: "8px 16px",
10301
+ borderRadius: "var(--bw-border-radius)",
10302
+ cursor: "pointer",
10355
10303
  fontFamily: "var(--bw-font-family)",
10356
- }, children: "Teilnehmer" }), jsx("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: formData.participants
10357
- .filter((p) => p.name.trim())
10358
- .map((participant, index) => (jsxs("div", { style: {
10359
- display: "flex",
10360
- justifyContent: "space-between",
10361
- alignItems: "center",
10362
- padding: "var(--bw-spacing-small)",
10363
- borderRadius: "var(--bw-border-radius-small)",
10364
- }, children: [jsx("span", { style: {
10304
+ fontSize: "var(--bw-font-size-small)",
10305
+ }, children: "Drucken" })] }), jsxs("div", { className: "print-only print-booking-header", children: [jsx("h1", { children: "Buchungsbest\u00E4tigung" }), jsx("div", { className: "subtitle", children: "Vielen Dank f\u00FCr deine Buchung! Hier sind deine Buchungsdetails." })] }), jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-large)" }, children: [jsxs("div", { className: "print-booking-card", style: {
10306
+ backgroundColor: "var(--bw-surface-color)",
10307
+ border: `1px solid var(--bw-border-color)`,
10308
+ borderRadius: "var(--bw-border-radius)",
10309
+ padding: "var(--bw-spacing)",
10310
+ marginBottom: "var(--bw-spacing-large)",
10311
+ }, children: [jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsx("h3", { style: {
10312
+ fontSize: "var(--bw-font-size-large)",
10313
+ fontWeight: "600",
10365
10314
  color: "var(--bw-text-color)",
10315
+ margin: "0",
10366
10316
  fontFamily: "var(--bw-font-family)",
10367
- }, children: participant.name }), participant.age && (jsxs("span", { style: {
10368
- color: "var(--bw-text-muted)",
10369
- fontSize: "var(--bw-font-size-small)",
10317
+ }, children: "Buchungsdetails" }) }), jsx("div", { className: "print-only", children: jsx("div", { className: "print-section-title", children: "Buchungsdetails" }) }), jsxs("div", { className: "space-y-4 print-only:space-y-2 print-only:p-0", children: [jsxs("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
10318
+ display: "grid",
10319
+ gridTemplateColumns: "1fr 1fr",
10320
+ gap: "var(--bw-spacing)",
10321
+ }, children: [jsxs("div", { className: "print-detail-item", style: { marginBottom: "span 2" }, children: [jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10322
+ color: "var(--bw-text-muted)",
10323
+ fontSize: "var(--bw-font-size-small)",
10324
+ fontFamily: "var(--bw-font-family)",
10325
+ }, children: "Buchungs-ID" }), jsx("p", { className: "font-semibold print-detail-value", style: {
10326
+ fontWeight: "600",
10327
+ color: "var(--bw-text-color)",
10328
+ fontFamily: "var(--bw-font-family)",
10329
+ fontSize: "var(--bw-font-size-medium)",
10330
+ margin: "0px 0px 6px 0",
10331
+ }, children: booking.bookingHash })] }), jsxs("div", { className: "print-detail-item", children: [jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10332
+ color: "var(--bw-text-muted)",
10333
+ fontSize: "var(--bw-font-size-small)",
10334
+ fontFamily: "var(--bw-font-family)",
10335
+ }, children: "Bezahl-Status" }), jsxs("div", { children: [jsx("span", { className: "print-hidden", style: {
10336
+ backgroundColor: "var(--bw-success-color, #10B981)",
10337
+ color: "white",
10338
+ padding: "2px 8px",
10339
+ borderRadius: "var(--bw-border-radius-small)",
10340
+ fontSize: "var(--bw-font-size-small)",
10341
+ fontFamily: "var(--bw-font-family)",
10342
+ width: "fit-content",
10343
+ }, children: paymentStatus === "succeeded"
10344
+ ? "erfolgreich"
10345
+ : paymentStatus === "canceled" || paymentStatus === "failed"
10346
+ ? "fehlgeschlagen"
10347
+ : "in Bearbeitung" }), jsx("span", { className: "print-only print-status-badge print-status-paid", children: "Bezahlt" })] })] })] }), jsxs("div", { className: "print-detail-item print-only:col-span-2", children: [jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10348
+ color: "var(--bw-text-muted)",
10349
+ fontSize: "var(--bw-font-size-small)",
10350
+ fontFamily: "var(--bw-font-family)",
10351
+ }, children: "Event" }), jsx("p", { className: "font-semibold print-detail-value", style: {
10352
+ fontWeight: "600",
10353
+ color: "var(--bw-text-color)",
10354
+ fontFamily: "var(--bw-font-family)",
10355
+ fontSize: "var(--bw-font-size-large)",
10356
+ margin: "0 0 6px 0",
10357
+ }, children: eventDetails.name })] }), jsxs("div", { className: "gap-4 grid grid-cols-2 print-detail-grid", style: {
10358
+ display: "grid",
10359
+ gridTemplateColumns: "1fr 1fr",
10360
+ gap: "var(--bw-spacing)",
10361
+ }, children: [jsxs("div", { className: "print-detail-item", children: [jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10362
+ color: "var(--bw-text-muted)",
10363
+ fontSize: "var(--bw-font-size-small)",
10364
+ fontFamily: "var(--bw-font-family)",
10365
+ }, children: "Datum" }), jsx("p", { className: "print-detail-value", style: {
10366
+ fontWeight: "600",
10367
+ color: "var(--bw-text-color)",
10368
+ fontFamily: "var(--bw-font-family)",
10369
+ fontSize: "var(--bw-font-size-large)",
10370
+ margin: "0 0 6px 0",
10371
+ }, children: formatDate12(eventDetails.startTime) })] }), jsxs("div", { className: "print-detail-item", children: [jsx("div", { className: "font-medium text-muted-foreground text-sm print-detail-label", style: {
10372
+ color: "var(--bw-text-muted)",
10373
+ fontSize: "var(--bw-font-size-small)",
10374
+ fontFamily: "var(--bw-font-family)",
10375
+ }, children: "Zeit" }), jsxs("p", { className: "print-detail-value", style: {
10376
+ fontWeight: "600",
10377
+ color: "var(--bw-text-color)",
10378
+ fontFamily: "var(--bw-font-family)",
10379
+ fontSize: "var(--bw-font-size-large)",
10380
+ margin: "0 0 6px 0",
10381
+ }, children: [formatTime12(eventDetails.startTime), " - ", formatTime12(eventDetails.endTime)] })] })] })] })] }), formData.participants && formData.participants.length > 0 && (jsxs("div", { className: "print-booking-card", style: {
10382
+ border: `1px solid var(--bw-border-color)`,
10383
+ borderRadius: "var(--bw-border-radius)",
10384
+ padding: "var(--bw-spacing)",
10385
+ marginBottom: "var(--bw-spacing-large)",
10386
+ }, children: [jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsxs("h3", { style: {
10387
+ fontSize: "var(--bw-font-size-large)",
10388
+ fontWeight: "600",
10389
+ color: "var(--bw-text-color)",
10390
+ margin: "0",
10370
10391
  fontFamily: "var(--bw-font-family)",
10371
- }, children: [participant.age, " Jahre"] }))] }, index))) })] })), jsxs("div", { style: {
10372
- backgroundColor: "var(--bw-surface-color)",
10373
- border: `1px solid var(--bw-border-color)`,
10374
- borderRadius: "var(--bw-border-radius)",
10375
- padding: "var(--bw-spacing)",
10376
- marginBottom: "var(--bw-spacing-large)",
10377
- }, children: [jsx("h3", { style: {
10378
- fontSize: "var(--bw-font-size-large)",
10379
- fontWeight: "600",
10380
- color: "var(--bw-text-color)",
10381
- margin: "0 0 var(--bw-spacing) 0",
10382
- fontFamily: "var(--bw-font-family)",
10383
- }, children: "Kontaktdaten" }), jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: [jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Name:" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerName })] }), jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "E-Mail:" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerEmail })] }), formData.customerPhone && (jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Telefon:" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerPhone })] }))] })] }), jsxs("div", { style: {
10384
- backgroundColor: "var(--bw-surface-muted-bg, rgba(59, 130, 246, 0.05))",
10385
- border: `1px solid var(--bw-border-color)`,
10386
- borderRadius: "var(--bw-border-radius)",
10387
- padding: "var(--bw-spacing)",
10388
- marginBottom: "var(--bw-spacing-large)",
10389
- textAlign: "center",
10390
- }, children: [jsx("div", { style: {
10391
- color: "var(--bw-highlight-color)",
10392
- fontSize: "24px",
10393
- marginBottom: "var(--bw-spacing-small)",
10394
- }, children: "\uD83D\uDCE7" }), jsxs("p", { style: {
10395
- color: "var(--bw-text-muted)",
10396
- margin: 0,
10397
- fontFamily: "var(--bw-font-family)",
10398
- fontSize: "var(--bw-font-size-small)",
10399
- }, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] })] }), jsx("div", { style: { textAlign: "center" }, children: jsx("button", { onClick: onClose, style: {
10400
- backgroundColor: "var(--bw-highlight-color)",
10401
- color: "white",
10402
- padding: "12px 32px",
10403
- border: "none",
10404
- borderRadius: "var(--bw-border-radius)",
10405
- fontSize: "var(--bw-font-size)",
10406
- fontWeight: "600",
10407
- cursor: "pointer",
10408
- fontFamily: "var(--bw-font-family)",
10409
- transition: "all 0.2s ease",
10410
- }, onMouseEnter: (e) => {
10411
- e.currentTarget.style.opacity = "0.9";
10412
- }, onMouseLeave: (e) => {
10413
- e.currentTarget.style.opacity = "1";
10414
- }, children: "Schlie\u00DFen" }) })] }) }));
10392
+ }, children: ["Teilnehmer (", formData.participants.length, ")"] }) }), jsx("div", { className: "print-only", children: jsxs("div", { className: "print-section-title", children: ["Teilnehmer (", formData.participants.length, ")"] }) }), jsx("div", { className: "print-only:p-0", children: jsx("div", { className: "space-y-3 print-only:space-y-1", style: {
10393
+ display: "flex",
10394
+ flexDirection: "column",
10395
+ gap: "var(--bw-spacing-small)",
10396
+ }, children: formData.participants
10397
+ .filter((p) => p.name.trim())
10398
+ .map((participant, index) => (jsx("div", { className: "flex justify-between items-center bg-muted p-3 rounded-lg print-participant", style: {
10399
+ display: "flex",
10400
+ justifyContent: "space-between",
10401
+ alignItems: "center",
10402
+ backgroundColor: "var(--bw-surface-color, #f9fafb)",
10403
+ padding: "var(--bw-spacing-small)",
10404
+ borderRadius: "var(--bw-border-radius-small)",
10405
+ }, children: jsxs("div", { className: "print-participant-info", children: [jsx("div", { className: "print-participant-name", style: {
10406
+ color: "var(--bw-text-color)",
10407
+ fontFamily: "var(--bw-font-family)",
10408
+ }, children: participant.name }), participant.age && (jsxs("div", { className: "text-muted-foreground text-sm print-participant-age", style: {
10409
+ color: "var(--bw-text-muted)",
10410
+ fontSize: "var(--bw-font-size-small)",
10411
+ fontFamily: "var(--bw-font-family)",
10412
+ }, children: [participant.age, " Jahre"] }))] }) }, index))) }) })] })), jsxs("div", { className: "print-booking-card", style: {
10413
+ backgroundColor: "var(--bw-surface-color)",
10414
+ border: `1px solid var(--bw-border-color)`,
10415
+ borderRadius: "var(--bw-border-radius)",
10416
+ padding: "var(--bw-spacing)",
10417
+ marginBottom: "var(--bw-spacing-large)",
10418
+ }, children: [jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsx("h3", { style: {
10419
+ fontSize: "var(--bw-font-size-large)",
10420
+ fontWeight: "600",
10421
+ color: "var(--bw-text-color)",
10422
+ margin: "0",
10423
+ fontFamily: "var(--bw-font-family)",
10424
+ }, children: "Zahlungs\u00FCbersicht" }) }), jsx("div", { className: "print-only", children: jsx("div", { className: "print-section-title", children: "Zahlungs\u00FCbersicht" }) }), jsxs("div", { className: "space-y-2 print-only:p-0 print-only:space-y-1", children: [jsxs("div", { className: "print-payment-summary print-only", children: [jsxs("div", { className: "print-payment-row", children: [jsx("span", { children: "Gesamtbetrag" }), jsx("span", { children: formatCurrency(booking.total) })] }), jsxs("div", { className: "print-payment-row", children: [jsx("span", { children: "Bezahlt" }), jsx("span", { children: formatCurrency(booking.total) })] })] }), jsxs("div", { className: "print-hidden space-y-2", style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: [jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: "Gesamtbetrag" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(booking.total) })] }), jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: "Bezahlt" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formatCurrency(booking.total) })] })] })] })] }), jsxs("div", { className: "print-booking-card", style: {
10425
+ backgroundColor: "var(--bw-surface-color)",
10426
+ border: `1px solid var(--bw-border-color)`,
10427
+ borderRadius: "var(--bw-border-radius)",
10428
+ padding: "var(--bw-spacing)",
10429
+ marginBottom: "var(--bw-spacing-large)",
10430
+ }, children: [jsx("div", { className: "print-hidden", style: { marginBottom: "var(--bw-spacing)" }, children: jsx("h3", { style: {
10431
+ fontSize: "var(--bw-font-size-large)",
10432
+ fontWeight: "600",
10433
+ color: "var(--bw-text-color)",
10434
+ margin: "0",
10435
+ fontFamily: "var(--bw-font-family)",
10436
+ }, children: "Kontaktdaten" }) }), jsx("div", { className: "print-only", children: jsx("div", { className: "print-section-title", children: "Kontaktdaten" }) }), jsxs("div", { className: "space-y-2 print-only:p-0 print-only:space-y-1", style: { display: "flex", flexDirection: "column", gap: "var(--bw-spacing-small)" }, children: [jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Name:" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerName })] }), jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "E-Mail:" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerEmail })] }), formData.customerPhone && (jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center" }, children: [jsx("span", { style: { color: "var(--bw-text-muted)", fontFamily: "var(--bw-font-family)" }, children: "Telefon:" }), jsx("span", { style: { color: "var(--bw-text-color)", fontFamily: "var(--bw-font-family)" }, children: formData.customerPhone })] }))] })] }), jsx("div", { className: "print-booking-card", style: {
10437
+ backgroundColor: "var(--bw-surface-color)",
10438
+ border: `1px solid var(--bw-border-color)`,
10439
+ borderRadius: "var(--bw-border-radius)",
10440
+ padding: "var(--bw-spacing)",
10441
+ marginBottom: "var(--bw-spacing-large)",
10442
+ textAlign: "center",
10443
+ }, children: jsxs("p", { style: {
10444
+ color: "var(--bw-text-muted)",
10445
+ margin: 0,
10446
+ fontFamily: "var(--bw-font-family)",
10447
+ fontSize: "var(--bw-font-size-small)",
10448
+ textAlign: "center",
10449
+ }, children: ["Eine Best\u00E4tigungs-E-Mail wird in K\u00FCrze an ", formData.customerEmail, " gesendet."] }) }), paymentStatus && paymentStatus !== "succeeded" && (jsxs("div", { style: {
10450
+ backgroundColor: "var(--bw-warning-bg, #FEF3C7)",
10451
+ border: "1px solid var(--bw-warning-border, #F59E0B)",
10452
+ borderRadius: "var(--bw-border-radius)",
10453
+ padding: "var(--bw-spacing)",
10454
+ marginBottom: "var(--bw-spacing-large)",
10455
+ textAlign: "center",
10456
+ }, children: [jsx("p", { style: {
10457
+ color: "var(--bw-warning-text, #92400E)",
10458
+ margin: "0 0 var(--bw-spacing) 0",
10459
+ fontFamily: "var(--bw-font-family)",
10460
+ fontWeight: "600",
10461
+ }, children: "Zahlung wird noch verarbeitet" }), jsxs("p", { style: {
10462
+ color: "var(--bw-warning-text, #92400E)",
10463
+ margin: "0 0 var(--bw-spacing) 0",
10464
+ fontFamily: "var(--bw-font-family)",
10465
+ fontSize: "var(--bw-font-size-small)",
10466
+ }, children: ["Status: ", paymentStatus] }), jsx("button", { onClick: () => fetchBookingData(), disabled: isLoading, style: {
10467
+ backgroundColor: "var(--bw-warning-text, #92400E)",
10468
+ color: "white",
10469
+ padding: "8px 16px",
10470
+ border: "none",
10471
+ borderRadius: "var(--bw-border-radius)",
10472
+ fontSize: "var(--bw-font-size-small)",
10473
+ fontWeight: "600",
10474
+ cursor: isLoading ? "not-allowed" : "pointer",
10475
+ fontFamily: "var(--bw-font-family)",
10476
+ opacity: isLoading ? 0.6 : 1,
10477
+ transition: "all 0.2s ease",
10478
+ }, children: isLoading ? "Aktualisiere..." : "Status aktualisieren" })] })), jsx("div", { style: {
10479
+ textAlign: "center",
10480
+ marginTop: "var(--bw-spacing-large)",
10481
+ paddingTop: "var(--bw-spacing)",
10482
+ borderTop: `1px solid var(--bw-border-color)`,
10483
+ }, children: jsx("button", { onClick: onClose, style: {
10484
+ backgroundColor: "var(--bw-highlight-color)",
10485
+ color: "white",
10486
+ padding: "12px 32px",
10487
+ border: "none",
10488
+ borderRadius: "var(--bw-border-radius)",
10489
+ fontSize: "var(--bw-font-size)",
10490
+ fontWeight: "600",
10491
+ cursor: "pointer",
10492
+ fontFamily: "var(--bw-font-family)",
10493
+ transition: "all 0.2s ease",
10494
+ }, onMouseEnter: (e) => {
10495
+ e.currentTarget.style.opacity = "0.9";
10496
+ }, onMouseLeave: (e) => {
10497
+ e.currentTarget.style.opacity = "1";
10498
+ }, children: "Schlie\u00DFen" }) }), jsxs("div", { className: "print-only print-footer", children: [jsxs("p", { children: ["Diese Buchungsbest\u00E4tigung wurde am", " ", new Date().toLocaleString("de-DE", {
10499
+ day: "2-digit",
10500
+ month: "2-digit",
10501
+ year: "numeric",
10502
+ hour: "2-digit",
10503
+ minute: "2-digit",
10504
+ timeZone: "Europe/Berlin",
10505
+ }), " ", "erstellt."] }), jsx("p", { children: "Bei Fragen zu deiner Buchung kontaktiere uns gerne." })] })] })] }) }));
10415
10506
  };
10416
10507
 
10417
10508
  const months = [
@@ -11527,7 +11618,7 @@ function UniversalBookingWidget({ config: baseConfig }) {
11527
11618
  const [isLoadingShowAll, setIsLoadingShowAll] = useState(false); // For "show all events" operation
11528
11619
  const [error, setError] = useState(null);
11529
11620
  const [isSuccess, setIsSuccess] = useState(false);
11530
- const [successData, setSuccessData] = useState(null);
11621
+ const [successPaymentIntentId, setSuccessPaymentIntentId] = useState(null);
11531
11622
  const [systemConfig, setSystemConfig] = useState(null);
11532
11623
  // PERFORMANCE OPTIMIZATION: Lazy component loading
11533
11624
  const [shouldRenderInstanceSelection, setShouldRenderInstanceSelection] = useState(false);
@@ -11574,6 +11665,29 @@ function UniversalBookingWidget({ config: baseConfig }) {
11574
11665
  initializeWidget();
11575
11666
  // eslint-disable-next-line react-hooks/exhaustive-deps
11576
11667
  }, [config]);
11668
+ // Handle Stripe payment return
11669
+ useEffect(() => {
11670
+ const handleStripeReturn = () => {
11671
+ const stripeReturn = detectStripeReturn();
11672
+ if (stripeReturn) {
11673
+ if (stripeReturn.redirectStatus === "succeeded") {
11674
+ // Store payment intent ID and show success modal
11675
+ setSuccessPaymentIntentId(stripeReturn.paymentIntent);
11676
+ setIsSuccess(true);
11677
+ }
11678
+ else if (stripeReturn.redirectStatus === "failed") {
11679
+ setError("Die Zahlung war nicht erfolgreich. Bitte versuche es erneut.");
11680
+ }
11681
+ else {
11682
+ setError("Die Zahlung konnte nicht abgeschlossen werden. Bitte versuche es erneut.");
11683
+ }
11684
+ }
11685
+ };
11686
+ // Only run on mount to avoid running multiple times
11687
+ if (!isLoading) {
11688
+ handleStripeReturn();
11689
+ }
11690
+ }, [isLoading]); // Only depend on isLoading to run after initial load
11577
11691
  // PERFORMANCE OPTIMIZATION: Lazy load components when needed
11578
11692
  useEffect(() => {
11579
11693
  if (currentStep === "eventInstances" && !shouldRenderInstanceSelection) {
@@ -11816,7 +11930,7 @@ function UniversalBookingWidget({ config: baseConfig }) {
11816
11930
  };
11817
11931
  const handleBookingSuccess = (result) => {
11818
11932
  setIsSuccess(true);
11819
- setSuccessData(result);
11933
+ setSuccessPaymentIntentId(result.paymentIntent.id);
11820
11934
  config.onSuccess?.(result);
11821
11935
  };
11822
11936
  const handleBookingError = (errorMessage) => {
@@ -11999,10 +12113,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
11999
12113
  setIsSuccess(false);
12000
12114
  setCurrentStep("eventTypes");
12001
12115
  setShowingPreview(true);
12116
+ // Reset state
12117
+ setSuccessPaymentIntentId(null);
12002
12118
  // Reset lazy loading flags
12003
12119
  setShouldRenderInstanceSelection(false);
12004
12120
  setShouldRenderBookingForm(false);
12005
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12121
+ // Clean up URL to remove Stripe parameters
12122
+ const url = new URL(window.location.href);
12123
+ url.searchParams.delete("payment_intent");
12124
+ url.searchParams.delete("payment_intent_client_secret");
12125
+ url.searchParams.delete("redirect_status");
12126
+ window.history.replaceState({}, "", url.toString());
12127
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12006
12128
  }
12007
12129
  if (viewMode === "next-events" && !showingPreview && currentStep === "eventInstances") {
12008
12130
  // Show all events for the single event type
@@ -12016,10 +12138,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
12016
12138
  setIsSuccess(false);
12017
12139
  setCurrentStep("eventTypes");
12018
12140
  setShowingPreview(true);
12141
+ // Reset state
12142
+ setSuccessPaymentIntentId(null);
12019
12143
  // Reset lazy loading flags
12020
12144
  setShouldRenderInstanceSelection(false);
12021
12145
  setShouldRenderBookingForm(false);
12022
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12146
+ // Clean up URL to remove Stripe parameters
12147
+ const url = new URL(window.location.href);
12148
+ url.searchParams.delete("payment_intent");
12149
+ url.searchParams.delete("payment_intent_client_secret");
12150
+ url.searchParams.delete("redirect_status");
12151
+ window.history.replaceState({}, "", url.toString());
12152
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12023
12153
  }
12024
12154
  if (viewMode === "button" && (isSingleEventTypeMode || isDirectInstanceMode)) {
12025
12155
  // Button mode - show button that opens sidebar/booking directly
@@ -12053,10 +12183,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
12053
12183
  setIsSuccess(false);
12054
12184
  setCurrentStep("eventTypes");
12055
12185
  setSidebarOpen(false);
12186
+ // Reset state
12187
+ setSuccessPaymentIntentId(null);
12056
12188
  // Reset lazy loading flags
12057
12189
  setShouldRenderInstanceSelection(false);
12058
12190
  setShouldRenderBookingForm(false);
12059
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }) }));
12191
+ // Clean up URL to remove Stripe parameters
12192
+ const url = new URL(window.location.href);
12193
+ url.searchParams.delete("payment_intent");
12194
+ url.searchParams.delete("payment_intent_client_secret");
12195
+ url.searchParams.delete("redirect_status");
12196
+ window.history.replaceState({}, "", url.toString());
12197
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }) }));
12060
12198
  }
12061
12199
  // Cards mode (default) - show event type selection
12062
12200
  const cardsView = (jsx(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount() }));
@@ -12092,10 +12230,18 @@ function UniversalBookingWidget({ config: baseConfig }) {
12092
12230
  return (jsxs(StyleProvider, { config: config, children: [cardsView, shouldRenderInstanceSelection && (jsx(EventInstanceSelection, { eventInstances: eventInstances, selectedEventType: selectedEventType, onEventInstanceSelect: handleEventInstanceSelect, onBackToEventTypes: handleBackToEventTypes, isOpen: currentStep === "eventInstances", onClose: handleBackToEventTypes, isLoadingEventInstances: isLoadingEventInstances, isLoadingEventDetails: isLoadingEventDetails })), shouldRenderBookingForm && eventDetails && (jsx(BookingForm, { config: config, eventDetails: eventDetails, stripePromise: stripePromise, onSuccess: handleBookingSuccess, onError: handleBookingError, onBackToEventInstances: backHandlers.onBackToEventInstances, onBackToEventTypes: backHandlers.onBackToEventTypes, selectedEventType: selectedEventType, selectedEventInstance: selectedEventInstance, isOpen: currentStep === "booking" && !!eventDetails, onClose: backHandlers.onClose, systemConfig: systemConfig })), jsx(BookingSuccessModal, { isOpen: isSuccess, onClose: () => {
12093
12231
  setIsSuccess(false);
12094
12232
  setCurrentStep("eventTypes");
12233
+ // Reset state
12234
+ setSuccessPaymentIntentId(null);
12095
12235
  // Reset lazy loading flags
12096
12236
  setShouldRenderInstanceSelection(false);
12097
12237
  setShouldRenderBookingForm(false);
12098
- }, bookingData: successData, eventDetails: eventDetails, formData: successData?.formData, config: config })] }));
12238
+ // Clean up URL to remove Stripe parameters
12239
+ const url = new URL(window.location.href);
12240
+ url.searchParams.delete("payment_intent");
12241
+ url.searchParams.delete("payment_intent_client_secret");
12242
+ url.searchParams.delete("redirect_status");
12243
+ window.history.replaceState({}, "", url.toString());
12244
+ }, config: config, onError: setError, paymentIntentId: successPaymentIntentId })] }));
12099
12245
  }
12100
12246
 
12101
12247
  // Export init function for vanilla JS usage