@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/index.esm.js CHANGED
@@ -12709,8 +12709,8 @@ function VoucherPurchaseCard({ config, minEventPrice, fallbackImages = [], onCli
12709
12709
  const displayPrice = !config.allowMonetaryVouchers && minEventPrice && minEventPrice > 0
12710
12710
  ? minEventPrice
12711
12711
  : minEventPrice && minEventPrice > 0
12712
- ? Math.min(config.monetaryPresets[0] || 2500, minEventPrice)
12713
- : config.monetaryPresets[0] || 2500;
12712
+ ? Math.min(config.monetaryPresets[0] || 2000, minEventPrice)
12713
+ : config.monetaryPresets[0] || 2000;
12714
12714
  const slideshowImages = useMemo(() => Array.from(new Set(fallbackImages.filter(Boolean))).slice(0, 5), [fallbackImages]);
12715
12715
  const hasSlideshow = !config.image && slideshowImages.length > 0;
12716
12716
  useEffect(() => {
@@ -13364,7 +13364,7 @@ function VoucherPurchaseForm({ config, voucherConfig, eventTypes, isOpen, onClos
13364
13364
  color: "var(--bw-text-muted)",
13365
13365
  fontFamily: "var(--bw-font-family)",
13366
13366
  }, children: [t("voucher.for"), " ", recipientName] }))] })] }), jsx("div", { style: {
13367
- fontSize: "24px",
13367
+ fontSize: "clamp(18px, 4vw, 22px)",
13368
13368
  fontWeight: 700,
13369
13369
  color: "var(--bw-highlight-color)",
13370
13370
  fontFamily: "var(--bw-font-family)",
@@ -13635,6 +13635,20 @@ function VoucherAttachment({ onClick }) {
13635
13635
  }, children: t("voucher.buyAsGift") })] }));
13636
13636
  }
13637
13637
 
13638
+ function VoucherIntegration({ config, voucherConfig, eventTypes, systemConfig, isFormOpen, isLoadingConfig, preselectedEventTypeId, voucherPurchaseResult, isSuccess, showStandaloneCard, onCardClick, onFormClose, onSuccess, onError, onSuccessModalClose, }) {
13639
+ if (!voucherConfig?.enabled) {
13640
+ return null;
13641
+ }
13642
+ return (jsxs(Fragment, { children: [showStandaloneCard && (jsx("div", { style: { padding: "0" }, children: jsx("div", { style: {
13643
+ display: "grid",
13644
+ gridTemplateColumns: "minmax(350px, 500px)",
13645
+ gap: "24px",
13646
+ justifyContent: "center",
13647
+ }, children: jsx(VoucherPurchaseCard, { config: voucherConfig, minEventPrice: eventTypes.length > 0
13648
+ ? Math.min(...eventTypes.map((et) => et.maxPrice))
13649
+ : undefined, fallbackImages: eventTypes.flatMap((eventType) => eventType.images || []), onClick: onCardClick, standalone: true }) }) })), jsx(VoucherPurchaseForm, { config: config, voucherConfig: voucherConfig, eventTypes: eventTypes, isOpen: isFormOpen, onClose: onFormClose, onSuccess: onSuccess, onError: onError, systemConfig: systemConfig, preselectedEventTypeId: preselectedEventTypeId, isLoadingEventTypes: isLoadingConfig }), isSuccess && voucherPurchaseResult && (jsx(VoucherSuccessModal, { isOpen: true, onClose: onSuccessModalClose, result: voucherPurchaseResult }))] }));
13650
+ }
13651
+
13638
13652
  // Helper function to preprocess markdown for underline support
13639
13653
  const preprocessMarkdown = (markdown) => {
13640
13654
  // Convert double underscores to HTML underline tags for React Markdown
@@ -15017,7 +15031,6 @@ function UniversalBookingWidgetInner({ config: baseConfig, onWidgetLanguage, onT
15017
15031
  // Detect single event type mode and direct instance mode
15018
15032
  const isSingleEventTypeMode = !!config.eventTypeId && !config.categoryId && !config.eventTypeIds;
15019
15033
  const isDirectInstanceMode = !!config.eventInstanceId;
15020
- const isMultiEventListingContext = Boolean(config.categoryId || config.eventTypeIds?.length);
15021
15034
  // Voucher card integration logic:
15022
15035
  // - For standalone voucher mode: always show voucher card (it's the main content)
15023
15036
  // - For event listings (single or multi): show by default unless explicitly disabled
@@ -15074,8 +15087,9 @@ function UniversalBookingWidgetInner({ config: baseConfig, onWidgetLanguage, onT
15074
15087
  // Load voucher config if:
15075
15088
  // - Explicit voucher params are set
15076
15089
  // - OR voucherIntegration is explicitly set (even to true/false)
15077
- // - OR it's a multi-event listing context (may want to show voucher card)
15078
- if (!isVoucherModeRequested && !isMultiEventListingContext)
15090
+ // - OR it's an event listing context (single or multi) that may want to show voucher card
15091
+ const shouldLoadVoucherConfig = isVoucherModeRequested || hasEventSelection;
15092
+ if (!shouldLoadVoucherConfig)
15079
15093
  return;
15080
15094
  setIsLoadingVoucherConfig(true);
15081
15095
  try {
@@ -15128,10 +15142,10 @@ function UniversalBookingWidgetInner({ config: baseConfig, onWidgetLanguage, onT
15128
15142
  const mergedConfig = {
15129
15143
  enabled: true,
15130
15144
  monetaryPresets: allowMonetaryVouchers
15131
- ? (presetFromValue ?? serverConfig.monetaryPresets ?? [2500, 5000, 10000, 15000, 20000])
15145
+ ? (presetFromValue ?? serverConfig.monetaryPresets ?? [2000, 5000, 10000, 15000, 20000, 25000, 30000, 40000, 50000])
15132
15146
  : [],
15133
- minAmount: serverConfig.minAmount || 1000,
15134
- maxAmount: serverConfig.maxAmount || 100000,
15147
+ minAmount: serverConfig.minAmount || 500,
15148
+ maxAmount: serverConfig.maxAmount || 1000000,
15135
15149
  allowMonetaryVouchers,
15136
15150
  allowEventVouchers,
15137
15151
  title: serverConfig.title,
@@ -15166,8 +15180,8 @@ function UniversalBookingWidgetInner({ config: baseConfig, onWidgetLanguage, onT
15166
15180
  const initializeWidget = async () => {
15167
15181
  try {
15168
15182
  setIsLoading(true);
15169
- // Load voucher config in parallel if voucher mode is requested or it's a multi-event context
15170
- if (isVoucherModeRequested || isMultiEventListingContext) {
15183
+ // Load voucher config in parallel if voucher mode is requested or there's event selection
15184
+ if (isVoucherModeRequested || hasEventSelection) {
15171
15185
  void loadVoucherConfig();
15172
15186
  }
15173
15187
  // Direct instance selection (old behavior)
@@ -15213,7 +15227,7 @@ function UniversalBookingWidgetInner({ config: baseConfig, onWidgetLanguage, onT
15213
15227
  }
15214
15228
  };
15215
15229
  void initializeWidget();
15216
- }, [config, isVoucherModeRequested, hasEventSelection, isStandaloneVoucherMode, isMultiEventListingContext]);
15230
+ }, [config, isVoucherModeRequested, hasEventSelection, isStandaloneVoucherMode]);
15217
15231
  // Re-fetch translated content when locale changes (skip initial mount)
15218
15232
  const prevLocaleRef = useRef(locale);
15219
15233
  useEffect(() => {
@@ -15958,14 +15972,7 @@ function UniversalBookingWidgetInner({ config: baseConfig, onWidgetLanguage, onT
15958
15972
  }, config: config, onError: setError, paymentIntentId: successPaymentId })] }), showPromoDialog && config.promo && (jsx(PromoDialog, { config: config.promo, onClose: handlePromoDialogClose, onCtaClick: handlePromoCtaClick }))] }));
15959
15973
  }
15960
15974
  // Cards mode (default) - show event type selection with optional voucher card
15961
- const cardsView = (jsxs(Fragment, { children: [hasEventSelection && (jsx(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount(), showVoucherAttachment: Boolean(voucherConfig?.enabled && voucherCardIntegrationEnabled && !isStandaloneVoucherMode), onVoucherClick: handleVoucherAttachmentClick })), voucherConfig?.enabled && voucherCardIntegrationEnabled && isStandaloneVoucherMode && (jsx("div", { style: { padding: hasEventSelection ? "0 0 24px 0" : "0" }, children: jsx("div", { style: {
15962
- display: "grid",
15963
- gridTemplateColumns: "minmax(350px, 500px)",
15964
- gap: "24px",
15965
- justifyContent: "center",
15966
- }, children: jsx(VoucherPurchaseCard, { config: voucherConfig, minEventPrice: voucherEventTypes.length > 0
15967
- ? Math.min(...voucherEventTypes.map((et) => et.maxPrice))
15968
- : undefined, fallbackImages: voucherEventTypes.flatMap((eventType) => eventType.images || []), onClick: handleVoucherCardClick, standalone: true }) }) })), isStandaloneVoucherMode && isLoading && !voucherConfig && (jsx("div", { style: { padding: "24px", textAlign: "center" }, children: jsx("div", { style: {
15975
+ const cardsView = (jsxs(Fragment, { children: [hasEventSelection && (jsx(EventTypeSelection, { eventTypes: eventTypes, onEventTypeSelect: handleEventTypeSelect, isLoading: isLoading, skeletonCount: getSkeletonCount(), showVoucherAttachment: Boolean(voucherConfig?.enabled && voucherCardIntegrationEnabled && !isStandaloneVoucherMode), onVoucherClick: handleVoucherAttachmentClick })), isStandaloneVoucherMode && (jsx(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 && (jsx("div", { style: { padding: "24px", textAlign: "center" }, children: jsx("div", { style: {
15969
15976
  display: "inline-block",
15970
15977
  width: "32px",
15971
15978
  height: "32px",
@@ -16018,19 +16025,17 @@ function UniversalBookingWidgetInner({ config: baseConfig, onWidgetLanguage, onT
16018
16025
  url.searchParams.delete("mollie_payment_id");
16019
16026
  url.searchParams.delete("mollie_status");
16020
16027
  window.history.replaceState({}, "", url.toString());
16021
- }, config: config, onError: setError, paymentIntentId: successPaymentId }), isSuccess && voucherPurchaseResult && (jsx(VoucherSuccessModal, { isOpen: true, onClose: () => {
16028
+ }, config: config, onError: setError, paymentIntentId: successPaymentId }), jsx(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: () => {
16022
16029
  setIsSuccess(false);
16023
16030
  setVoucherPurchaseResult(null);
16024
16031
  const url = new URL(window.location.href);
16025
- // Clean up Stripe params
16026
16032
  url.searchParams.delete("payment_intent");
16027
16033
  url.searchParams.delete("payment_intent_client_secret");
16028
16034
  url.searchParams.delete("redirect_status");
16029
- // Clean up Mollie params
16030
16035
  url.searchParams.delete("mollie_payment_id");
16031
16036
  url.searchParams.delete("mollie_status");
16032
16037
  window.history.replaceState({}, "", url.toString());
16033
- }, result: voucherPurchaseResult })), voucherConfig?.enabled && (jsx(VoucherPurchaseForm, { config: config, voucherConfig: voucherConfig, eventTypes: voucherEventTypes, isOpen: isVoucherFormOpen, onClose: handleVoucherFormClose, onSuccess: handleVoucherSuccess, onError: handleVoucherError, systemConfig: systemConfig, preselectedEventTypeId: preselectedVoucherEventTypeId, isLoadingEventTypes: isLoadingVoucherConfig }))] }), showPromoDialog && config.promo && (jsx(PromoDialog, { config: config.promo, onClose: handlePromoDialogClose, onCtaClick: handlePromoCtaClick }))] }));
16038
+ } })] }), showPromoDialog && config.promo && (jsx(PromoDialog, { config: config.promo, onClose: handlePromoDialogClose, onCtaClick: handlePromoCtaClick }))] }));
16034
16039
  }
16035
16040
  function UniversalBookingWidget(props) {
16036
16041
  const [languagePolicy, setLanguagePolicy] = useState(null);