@bigz-app/booking-widget 0.2.0 → 0.2.2

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
@@ -915,6 +915,9 @@ const inferConfigFromUrl = (baseConfig) => {
915
915
  const createApiHeaders = (config) => {
916
916
  return {
917
917
  "Content-Type": "application/json",
918
+ "x-origin-url": window.location.href,
919
+ "x-language": navigator.language,
920
+ "x-user-agent": navigator.userAgent,
918
921
  };
919
922
  };
920
923
  const createRequestBody = (config, additionalData) => {
@@ -9258,6 +9261,7 @@ function PaymentFormInner({ config, eventDetails, formData, totalAmount, discoun
9258
9261
  // Main PaymentForm component that handles payment intent creation and Elements wrapper
9259
9262
  function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, systemConfig, stripePromise, stripeAppearance, }) {
9260
9263
  const [clientSecret, setClientSecret] = useState(null);
9264
+ const [paymentIntentId, setPaymentIntentId] = useState(null);
9261
9265
  const [isCreatingPaymentIntent, setIsCreatingPaymentIntent] = useState(false);
9262
9266
  const [paymentError, setPaymentError] = useState(null);
9263
9267
  // Create payment intent when component mounts or when relevant data changes
@@ -9297,6 +9301,7 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9297
9301
  customerEmail: formData.customerEmail?.trim(),
9298
9302
  customerPhone: formData.customerPhone?.trim(),
9299
9303
  comment: formData.comment?.trim(),
9304
+ ...(paymentIntentId && { paymentIntentId }), // Include existing payment intent ID if available
9300
9305
  };
9301
9306
  // Validate required fields
9302
9307
  if (!requestData.eventInstanceId) {
@@ -9322,6 +9327,7 @@ function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode
9322
9327
  const data = await response.json();
9323
9328
  if (response.ok) {
9324
9329
  setClientSecret(data.clientSecret);
9330
+ setPaymentIntentId(data.paymentIntentId); // Save payment intent ID for future updates
9325
9331
  }
9326
9332
  else {
9327
9333
  console.error("[PAYMENT_FORM] Payment intent creation failed:", {
@@ -9597,6 +9603,7 @@ const bookingFormSchema = objectType({
9597
9603
  customerPhone: stringType().optional(),
9598
9604
  participants: arrayType(participantSchema).min(1, "Mindestens ein Teilnehmer erforderlich"),
9599
9605
  discountCode: stringType().optional(),
9606
+ comment: stringType().optional(),
9600
9607
  acceptTerms: booleanType()
9601
9608
  .refine((val) => val === true, "Bitte akzeptiere die Allgemeinen Geschäftsbedingungen"),
9602
9609
  });
@@ -9612,6 +9619,7 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
9612
9619
  defaultValues: {
9613
9620
  participants: [{ name: "", age: undefined }],
9614
9621
  discountCode: "",
9622
+ comment: "",
9615
9623
  acceptTerms: false,
9616
9624
  },
9617
9625
  });
@@ -9998,6 +10006,36 @@ function BookingForm({ config, eventDetails, stripePromise, onSuccess, onError,
9998
10006
  backdropFilter: "blur(4px)",
9999
10007
  borderRadius: "var(--bw-border-radius)",
10000
10008
  padding: "var(--bw-spacing)",
10009
+ }, children: [jsx("label", { htmlFor: "booking-comment", style: {
10010
+ fontSize: "var(--bw-font-size)",
10011
+ fontWeight: "500",
10012
+ color: "var(--bw-text-color)",
10013
+ fontFamily: "var(--bw-font-family)",
10014
+ display: "block",
10015
+ marginBottom: "8px",
10016
+ }, children: "Kommentar (optional)" }), jsx("textarea", { id: "booking-comment", ...form.register("comment"), placeholder: "Zus\u00E4tzliche Anmerkungen zu Ihrer Buchung...", rows: 3, style: {
10017
+ width: "100%",
10018
+ padding: "12px",
10019
+ border: `1px solid var(--bw-border-color)`,
10020
+ borderRadius: "var(--bw-border-radius)",
10021
+ fontSize: "var(--bw-font-size)",
10022
+ fontFamily: "var(--bw-font-family)",
10023
+ backgroundColor: "var(--bw-input-bg)",
10024
+ color: "var(--bw-text-color)",
10025
+ resize: "vertical",
10026
+ minHeight: "80px",
10027
+ outline: "none",
10028
+ transition: "border-color 0.2s ease",
10029
+ }, onFocus: (e) => {
10030
+ e.target.style.borderColor = "var(--bw-highlight-color)";
10031
+ }, onBlur: (e) => {
10032
+ e.target.style.borderColor = "var(--bw-border-color)";
10033
+ } })] }), jsxs("div", { style: {
10034
+ backgroundColor: "var(--bw-surface-color)",
10035
+ border: `1px solid var(--bw-border-color)`,
10036
+ backdropFilter: "blur(4px)",
10037
+ borderRadius: "var(--bw-border-radius)",
10038
+ padding: "var(--bw-spacing)",
10001
10039
  }, children: [jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [jsx("input", { id: "acceptTerms", ...form.register("acceptTerms"), type: "checkbox", style: {
10002
10040
  marginTop: "4px",
10003
10041
  width: "20px",