@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/booking-widget.js +38 -0
- package/dist/booking-widget.js.map +1 -1
- package/dist/components/BookingForm.d.ts.map +1 -1
- package/dist/components/PaymentForm.d.ts.map +1 -1
- package/dist/index.cjs +38 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +38 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/booking-widget.js
CHANGED
|
@@ -973,6 +973,9 @@
|
|
|
973
973
|
const createApiHeaders = (config) => {
|
|
974
974
|
return {
|
|
975
975
|
"Content-Type": "application/json",
|
|
976
|
+
"x-origin-url": window.location.href,
|
|
977
|
+
"x-language": navigator.language,
|
|
978
|
+
"x-user-agent": navigator.userAgent,
|
|
976
979
|
};
|
|
977
980
|
};
|
|
978
981
|
const createRequestBody = (config, additionalData) => {
|
|
@@ -9343,6 +9346,7 @@
|
|
|
9343
9346
|
// Main PaymentForm component that handles payment intent creation and Elements wrapper
|
|
9344
9347
|
function PaymentForm({ config, eventDetails, formData, totalAmount, discountCode, onSuccess, onError, systemConfig, stripePromise, stripeAppearance, }) {
|
|
9345
9348
|
const [clientSecret, setClientSecret] = d$1(null);
|
|
9349
|
+
const [paymentIntentId, setPaymentIntentId] = d$1(null);
|
|
9346
9350
|
const [isCreatingPaymentIntent, setIsCreatingPaymentIntent] = d$1(false);
|
|
9347
9351
|
const [paymentError, setPaymentError] = d$1(null);
|
|
9348
9352
|
// Create payment intent when component mounts or when relevant data changes
|
|
@@ -9382,6 +9386,7 @@
|
|
|
9382
9386
|
customerEmail: formData.customerEmail?.trim(),
|
|
9383
9387
|
customerPhone: formData.customerPhone?.trim(),
|
|
9384
9388
|
comment: formData.comment?.trim(),
|
|
9389
|
+
...(paymentIntentId && { paymentIntentId }), // Include existing payment intent ID if available
|
|
9385
9390
|
};
|
|
9386
9391
|
// Validate required fields
|
|
9387
9392
|
if (!requestData.eventInstanceId) {
|
|
@@ -9407,6 +9412,7 @@
|
|
|
9407
9412
|
const data = await response.json();
|
|
9408
9413
|
if (response.ok) {
|
|
9409
9414
|
setClientSecret(data.clientSecret);
|
|
9415
|
+
setPaymentIntentId(data.paymentIntentId); // Save payment intent ID for future updates
|
|
9410
9416
|
}
|
|
9411
9417
|
else {
|
|
9412
9418
|
console.error("[PAYMENT_FORM] Payment intent creation failed:", {
|
|
@@ -9682,6 +9688,7 @@
|
|
|
9682
9688
|
customerPhone: stringType().optional(),
|
|
9683
9689
|
participants: arrayType(participantSchema).min(1, "Mindestens ein Teilnehmer erforderlich"),
|
|
9684
9690
|
discountCode: stringType().optional(),
|
|
9691
|
+
comment: stringType().optional(),
|
|
9685
9692
|
acceptTerms: booleanType()
|
|
9686
9693
|
.refine((val) => val === true, "Bitte akzeptiere die Allgemeinen Geschäftsbedingungen"),
|
|
9687
9694
|
});
|
|
@@ -9697,6 +9704,7 @@
|
|
|
9697
9704
|
defaultValues: {
|
|
9698
9705
|
participants: [{ name: "", age: undefined }],
|
|
9699
9706
|
discountCode: "",
|
|
9707
|
+
comment: "",
|
|
9700
9708
|
acceptTerms: false,
|
|
9701
9709
|
},
|
|
9702
9710
|
});
|
|
@@ -10083,6 +10091,36 @@
|
|
|
10083
10091
|
backdropFilter: "blur(4px)",
|
|
10084
10092
|
borderRadius: "var(--bw-border-radius)",
|
|
10085
10093
|
padding: "var(--bw-spacing)",
|
|
10094
|
+
}, children: [u$2("label", { htmlFor: "booking-comment", style: {
|
|
10095
|
+
fontSize: "var(--bw-font-size)",
|
|
10096
|
+
fontWeight: "500",
|
|
10097
|
+
color: "var(--bw-text-color)",
|
|
10098
|
+
fontFamily: "var(--bw-font-family)",
|
|
10099
|
+
display: "block",
|
|
10100
|
+
marginBottom: "8px",
|
|
10101
|
+
}, children: "Kommentar (optional)" }), u$2("textarea", { id: "booking-comment", ...form.register("comment"), placeholder: "Zus\u00E4tzliche Anmerkungen zu Ihrer Buchung...", rows: 3, style: {
|
|
10102
|
+
width: "100%",
|
|
10103
|
+
padding: "12px",
|
|
10104
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10105
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10106
|
+
fontSize: "var(--bw-font-size)",
|
|
10107
|
+
fontFamily: "var(--bw-font-family)",
|
|
10108
|
+
backgroundColor: "var(--bw-input-bg)",
|
|
10109
|
+
color: "var(--bw-text-color)",
|
|
10110
|
+
resize: "vertical",
|
|
10111
|
+
minHeight: "80px",
|
|
10112
|
+
outline: "none",
|
|
10113
|
+
transition: "border-color 0.2s ease",
|
|
10114
|
+
}, onFocus: (e) => {
|
|
10115
|
+
e.target.style.borderColor = "var(--bw-highlight-color)";
|
|
10116
|
+
}, onBlur: (e) => {
|
|
10117
|
+
e.target.style.borderColor = "var(--bw-border-color)";
|
|
10118
|
+
} })] }), u$2("div", { style: {
|
|
10119
|
+
backgroundColor: "var(--bw-surface-color)",
|
|
10120
|
+
border: `1px solid var(--bw-border-color)`,
|
|
10121
|
+
backdropFilter: "blur(4px)",
|
|
10122
|
+
borderRadius: "var(--bw-border-radius)",
|
|
10123
|
+
padding: "var(--bw-spacing)",
|
|
10086
10124
|
}, children: [u$2("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [u$2("input", { id: "acceptTerms", ...form.register("acceptTerms"), type: "checkbox", style: {
|
|
10087
10125
|
marginTop: "4px",
|
|
10088
10126
|
width: "20px",
|