@bigz-app/booking-widget 1.1.2 → 1.1.3
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
|
@@ -12070,15 +12070,12 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
12070
12070
|
setShouldRenderBookingForm(true);
|
|
12071
12071
|
}
|
|
12072
12072
|
}, [currentStep, shouldRenderInstanceSelection, shouldRenderBookingForm]);
|
|
12073
|
-
// Promo dialog: show
|
|
12073
|
+
// Promo dialog: show promo once per session when enabled
|
|
12074
12074
|
useEffect(() => {
|
|
12075
|
-
|
|
12076
|
-
const month = now.getMonth();
|
|
12077
|
-
const isHolidaySeason = month === 11 || month === 0;
|
|
12078
|
-
if (!isHolidaySeason) {
|
|
12075
|
+
if (!config.promo?.enabled) {
|
|
12079
12076
|
return;
|
|
12080
12077
|
}
|
|
12081
|
-
const promoId = "
|
|
12078
|
+
const promoId = config.promo.discountCode || "default";
|
|
12082
12079
|
const storageKey = `bigz-promo-${promoId}-shown`;
|
|
12083
12080
|
const globalFlagKey = `__bigzPromoShown_${promoId}`;
|
|
12084
12081
|
const alreadyShown = localStorage.getItem(storageKey) === "true";
|
|
@@ -12088,19 +12085,19 @@ function UniversalBookingWidget({ config: baseConfig }) {
|
|
|
12088
12085
|
}
|
|
12089
12086
|
window[globalFlagKey] = true;
|
|
12090
12087
|
const timer = setTimeout(() => {
|
|
12091
|
-
|
|
12092
|
-
setShowPromoDialog(true);
|
|
12093
|
-
}
|
|
12088
|
+
setShowPromoDialog(true);
|
|
12094
12089
|
}, 1000);
|
|
12095
12090
|
return () => clearTimeout(timer);
|
|
12096
|
-
}, []);
|
|
12091
|
+
}, [config.promo?.enabled, config.promo?.discountCode]);
|
|
12097
12092
|
const handlePromoDialogClose = () => {
|
|
12098
12093
|
setShowPromoDialog(false);
|
|
12099
|
-
|
|
12094
|
+
const promoId = config.promo?.discountCode || "default";
|
|
12095
|
+
localStorage.setItem(`bigz-promo-${promoId}-shown`, "true");
|
|
12100
12096
|
};
|
|
12101
12097
|
const handlePromoCtaClick = () => {
|
|
12102
12098
|
setShowPromoDialog(false);
|
|
12103
|
-
|
|
12099
|
+
const promoId = config.promo?.discountCode || "default";
|
|
12100
|
+
localStorage.setItem(`bigz-promo-${promoId}-shown`, "true");
|
|
12104
12101
|
if (widgetContainerRef) {
|
|
12105
12102
|
widgetContainerRef.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
12106
12103
|
}
|