@bigz-app/booking-widget 1.2.0 → 1.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.
- package/dist/booking-widget.js +29 -24
- package/dist/booking-widget.js.map +1 -1
- package/dist/components/UniversalBookingWidget.d.ts.map +1 -1
- package/dist/components/voucher/VoucherIntegration.d.ts +23 -0
- package/dist/components/voucher/VoucherIntegration.d.ts.map +1 -0
- package/dist/components/voucher/index.d.ts +2 -0
- package/dist/components/voucher/index.d.ts.map +1 -1
- package/dist/components/voucher/useVoucherConfig.d.ts +57 -0
- package/dist/components/voucher/useVoucherConfig.d.ts.map +1 -0
- package/dist/index.cjs +29 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +29 -24
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/booking-widget.js
CHANGED
|
@@ -12835,8 +12835,8 @@
|
|
|
12835
12835
|
const displayPrice = !config.allowMonetaryVouchers && minEventPrice && minEventPrice > 0
|
|
12836
12836
|
? minEventPrice
|
|
12837
12837
|
: minEventPrice && minEventPrice > 0
|
|
12838
|
-
? Math.min(config.monetaryPresets[0] ||
|
|
12839
|
-
: config.monetaryPresets[0] ||
|
|
12838
|
+
? Math.min(config.monetaryPresets[0] || 2000, minEventPrice)
|
|
12839
|
+
: config.monetaryPresets[0] || 2000;
|
|
12840
12840
|
const slideshowImages = T$2(() => Array.from(new Set(fallbackImages.filter(Boolean))).slice(0, 5), [fallbackImages]);
|
|
12841
12841
|
const hasSlideshow = !config.image && slideshowImages.length > 0;
|
|
12842
12842
|
y$1(() => {
|
|
@@ -13490,7 +13490,7 @@
|
|
|
13490
13490
|
color: "var(--bw-text-muted)",
|
|
13491
13491
|
fontFamily: "var(--bw-font-family)",
|
|
13492
13492
|
}, children: [t("voucher.for"), " ", recipientName] }))] })] }), u$2("div", { style: {
|
|
13493
|
-
fontSize: "
|
|
13493
|
+
fontSize: "clamp(18px, 4vw, 22px)",
|
|
13494
13494
|
fontWeight: 700,
|
|
13495
13495
|
color: "var(--bw-highlight-color)",
|
|
13496
13496
|
fontFamily: "var(--bw-font-family)",
|
|
@@ -13761,6 +13761,20 @@
|
|
|
13761
13761
|
}, children: t("voucher.buyAsGift") })] }));
|
|
13762
13762
|
}
|
|
13763
13763
|
|
|
13764
|
+
function VoucherIntegration({ config, voucherConfig, eventTypes, systemConfig, isFormOpen, isLoadingConfig, preselectedEventTypeId, voucherPurchaseResult, isSuccess, showStandaloneCard, onCardClick, onFormClose, onSuccess, onError, onSuccessModalClose, }) {
|
|
13765
|
+
if (!voucherConfig?.enabled) {
|
|
13766
|
+
return null;
|
|
13767
|
+
}
|
|
13768
|
+
return (u$2(k$3, { children: [showStandaloneCard && (u$2("div", { style: { padding: "0" }, children: u$2("div", { style: {
|
|
13769
|
+
display: "grid",
|
|
13770
|
+
gridTemplateColumns: "minmax(350px, 500px)",
|
|
13771
|
+
gap: "24px",
|
|
13772
|
+
justifyContent: "center",
|
|
13773
|
+
}, children: u$2(VoucherPurchaseCard, { config: voucherConfig, minEventPrice: eventTypes.length > 0
|
|
13774
|
+
? Math.min(...eventTypes.map((et) => et.maxPrice))
|
|
13775
|
+
: undefined, fallbackImages: eventTypes.flatMap((eventType) => eventType.images || []), onClick: onCardClick, standalone: true }) }) })), u$2(VoucherPurchaseForm, { config: config, voucherConfig: voucherConfig, eventTypes: eventTypes, isOpen: isFormOpen, onClose: onFormClose, onSuccess: onSuccess, onError: onError, systemConfig: systemConfig, preselectedEventTypeId: preselectedEventTypeId, isLoadingEventTypes: isLoadingConfig }), isSuccess && voucherPurchaseResult && (u$2(VoucherSuccessModal, { isOpen: true, onClose: onSuccessModalClose, result: voucherPurchaseResult }))] }));
|
|
13776
|
+
}
|
|
13777
|
+
|
|
13764
13778
|
// Helper function to preprocess markdown for underline support
|
|
13765
13779
|
const preprocessMarkdown = (markdown) => {
|
|
13766
13780
|
// Convert double underscores to HTML underline tags for React Markdown
|
|
@@ -15143,7 +15157,6 @@
|
|
|
15143
15157
|
// Detect single event type mode and direct instance mode
|
|
15144
15158
|
const isSingleEventTypeMode = !!config.eventTypeId && !config.categoryId && !config.eventTypeIds;
|
|
15145
15159
|
const isDirectInstanceMode = !!config.eventInstanceId;
|
|
15146
|
-
const isMultiEventListingContext = Boolean(config.categoryId || config.eventTypeIds?.length);
|
|
15147
15160
|
// Voucher card integration logic:
|
|
15148
15161
|
// - For standalone voucher mode: always show voucher card (it's the main content)
|
|
15149
15162
|
// - For event listings (single or multi): show by default unless explicitly disabled
|
|
@@ -15200,8 +15213,9 @@
|
|
|
15200
15213
|
// Load voucher config if:
|
|
15201
15214
|
// - Explicit voucher params are set
|
|
15202
15215
|
// - OR voucherIntegration is explicitly set (even to true/false)
|
|
15203
|
-
// - OR it's
|
|
15204
|
-
|
|
15216
|
+
// - OR it's an event listing context (single or multi) that may want to show voucher card
|
|
15217
|
+
const shouldLoadVoucherConfig = isVoucherModeRequested || hasEventSelection;
|
|
15218
|
+
if (!shouldLoadVoucherConfig)
|
|
15205
15219
|
return;
|
|
15206
15220
|
setIsLoadingVoucherConfig(true);
|
|
15207
15221
|
try {
|
|
@@ -15254,10 +15268,10 @@
|
|
|
15254
15268
|
const mergedConfig = {
|
|
15255
15269
|
enabled: true,
|
|
15256
15270
|
monetaryPresets: allowMonetaryVouchers
|
|
15257
|
-
? (presetFromValue ?? serverConfig.monetaryPresets ?? [
|
|
15271
|
+
? (presetFromValue ?? serverConfig.monetaryPresets ?? [2000, 5000, 10000, 15000, 20000, 25000, 30000, 40000, 50000])
|
|
15258
15272
|
: [],
|
|
15259
|
-
minAmount: serverConfig.minAmount ||
|
|
15260
|
-
maxAmount: serverConfig.maxAmount ||
|
|
15273
|
+
minAmount: serverConfig.minAmount || 500,
|
|
15274
|
+
maxAmount: serverConfig.maxAmount || 1000000,
|
|
15261
15275
|
allowMonetaryVouchers,
|
|
15262
15276
|
allowEventVouchers,
|
|
15263
15277
|
title: serverConfig.title,
|
|
@@ -15292,8 +15306,8 @@
|
|
|
15292
15306
|
const initializeWidget = async () => {
|
|
15293
15307
|
try {
|
|
15294
15308
|
setIsLoading(true);
|
|
15295
|
-
// Load voucher config in parallel if voucher mode is requested or
|
|
15296
|
-
if (isVoucherModeRequested ||
|
|
15309
|
+
// Load voucher config in parallel if voucher mode is requested or there's event selection
|
|
15310
|
+
if (isVoucherModeRequested || hasEventSelection) {
|
|
15297
15311
|
void loadVoucherConfig();
|
|
15298
15312
|
}
|
|
15299
15313
|
// Direct instance selection (old behavior)
|
|
@@ -15339,7 +15353,7 @@
|
|
|
15339
15353
|
}
|
|
15340
15354
|
};
|
|
15341
15355
|
void initializeWidget();
|
|
15342
|
-
}, [config, isVoucherModeRequested, hasEventSelection, isStandaloneVoucherMode
|
|
15356
|
+
}, [config, isVoucherModeRequested, hasEventSelection, isStandaloneVoucherMode]);
|
|
15343
15357
|
// Re-fetch translated content when locale changes (skip initial mount)
|
|
15344
15358
|
const prevLocaleRef = A$2(locale);
|
|
15345
15359
|
y$1(() => {
|
|
@@ -16084,14 +16098,7 @@
|
|
|
16084
16098
|
}, config: config, onError: setError, paymentIntentId: successPaymentId })] }), showPromoDialog && config.promo && (u$2(PromoDialog, { config: config.promo, onClose: handlePromoDialogClose, onCtaClick: handlePromoCtaClick }))] }));
|
|
16085
16099
|
}
|
|
16086
16100
|
// Cards mode (default) - show event type selection with optional voucher card
|
|
16087
|
-
const cardsView = (u$2(k$3, { children: [hasEventSelection && (u$2(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount(), showVoucherAttachment: Boolean(voucherConfig?.enabled && voucherCardIntegrationEnabled && !isStandaloneVoucherMode), onVoucherClick: handleVoucherAttachmentClick })), voucherConfig?.enabled && voucherCardIntegrationEnabled
|
|
16088
|
-
display: "grid",
|
|
16089
|
-
gridTemplateColumns: "minmax(350px, 500px)",
|
|
16090
|
-
gap: "24px",
|
|
16091
|
-
justifyContent: "center",
|
|
16092
|
-
}, children: u$2(VoucherPurchaseCard, { config: voucherConfig, minEventPrice: voucherEventTypes.length > 0
|
|
16093
|
-
? Math.min(...voucherEventTypes.map((et) => et.maxPrice))
|
|
16094
|
-
: undefined, fallbackImages: voucherEventTypes.flatMap((eventType) => eventType.images || []), onClick: handleVoucherCardClick, standalone: true }) }) })), isStandaloneVoucherMode && isLoading && !voucherConfig && (u$2("div", { style: { padding: "24px", textAlign: "center" }, children: u$2("div", { style: {
|
|
16101
|
+
const cardsView = (u$2(k$3, { children: [hasEventSelection && (u$2(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount(), showVoucherAttachment: Boolean(voucherConfig?.enabled && voucherCardIntegrationEnabled && !isStandaloneVoucherMode), onVoucherClick: handleVoucherAttachmentClick })), isStandaloneVoucherMode && (u$2(VoucherIntegration, { config: config, voucherConfig: voucherConfig, eventTypes: voucherEventTypes, systemConfig: systemConfig, isFormOpen: false, isLoadingConfig: isLoadingVoucherConfig, preselectedEventTypeId: null, voucherPurchaseResult: null, isSuccess: false, showStandaloneCard: Boolean(voucherConfig?.enabled && voucherCardIntegrationEnabled), onCardClick: handleVoucherCardClick, onFormClose: handleVoucherFormClose, onSuccess: handleVoucherSuccess, onError: handleVoucherError, onSuccessModalClose: () => { } })), isStandaloneVoucherMode && isLoading && !voucherConfig && (u$2("div", { style: { padding: "24px", textAlign: "center" }, children: u$2("div", { style: {
|
|
16095
16102
|
display: "inline-block",
|
|
16096
16103
|
width: "32px",
|
|
16097
16104
|
height: "32px",
|
|
@@ -16144,19 +16151,17 @@
|
|
|
16144
16151
|
url.searchParams.delete("mollie_payment_id");
|
|
16145
16152
|
url.searchParams.delete("mollie_status");
|
|
16146
16153
|
window.history.replaceState({}, "", url.toString());
|
|
16147
|
-
}, config: config, onError: setError, paymentIntentId: successPaymentId }),
|
|
16154
|
+
}, config: config, onError: setError, paymentIntentId: successPaymentId }), u$2(VoucherIntegration, { config: config, voucherConfig: voucherConfig, eventTypes: voucherEventTypes, systemConfig: systemConfig, isFormOpen: isVoucherFormOpen, isLoadingConfig: isLoadingVoucherConfig, preselectedEventTypeId: preselectedVoucherEventTypeId, voucherPurchaseResult: voucherPurchaseResult, isSuccess: isSuccess, showStandaloneCard: false, onCardClick: handleVoucherCardClick, onFormClose: handleVoucherFormClose, onSuccess: handleVoucherSuccess, onError: handleVoucherError, onSuccessModalClose: () => {
|
|
16148
16155
|
setIsSuccess(false);
|
|
16149
16156
|
setVoucherPurchaseResult(null);
|
|
16150
16157
|
const url = new URL(window.location.href);
|
|
16151
|
-
// Clean up Stripe params
|
|
16152
16158
|
url.searchParams.delete("payment_intent");
|
|
16153
16159
|
url.searchParams.delete("payment_intent_client_secret");
|
|
16154
16160
|
url.searchParams.delete("redirect_status");
|
|
16155
|
-
// Clean up Mollie params
|
|
16156
16161
|
url.searchParams.delete("mollie_payment_id");
|
|
16157
16162
|
url.searchParams.delete("mollie_status");
|
|
16158
16163
|
window.history.replaceState({}, "", url.toString());
|
|
16159
|
-
}
|
|
16164
|
+
} })] }), showPromoDialog && config.promo && (u$2(PromoDialog, { config: config.promo, onClose: handlePromoDialogClose, onCtaClick: handlePromoCtaClick }))] }));
|
|
16160
16165
|
}
|
|
16161
16166
|
function UniversalBookingWidget(props) {
|
|
16162
16167
|
const [languagePolicy, setLanguagePolicy] = d$1(null);
|