@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.
@@ -12196,15 +12196,12 @@
12196
12196
  setShouldRenderBookingForm(true);
12197
12197
  }
12198
12198
  }, [currentStep, shouldRenderInstanceSelection, shouldRenderBookingForm]);
12199
- // Promo dialog: show Xmas promo once per user during holiday season
12199
+ // Promo dialog: show promo once per session when enabled
12200
12200
  y$1(() => {
12201
- const now = new Date();
12202
- const month = now.getMonth();
12203
- const isHolidaySeason = month === 11 || month === 0;
12204
- if (!isHolidaySeason) {
12201
+ if (!config.promo?.enabled) {
12205
12202
  return;
12206
12203
  }
12207
- const promoId = "xmas-2024";
12204
+ const promoId = config.promo.discountCode || "default";
12208
12205
  const storageKey = `bigz-promo-${promoId}-shown`;
12209
12206
  const globalFlagKey = `__bigzPromoShown_${promoId}`;
12210
12207
  const alreadyShown = localStorage.getItem(storageKey) === "true";
@@ -12214,19 +12211,19 @@
12214
12211
  }
12215
12212
  window[globalFlagKey] = true;
12216
12213
  const timer = setTimeout(() => {
12217
- if (config.promo?.enabled) {
12218
- setShowPromoDialog(true);
12219
- }
12214
+ setShowPromoDialog(true);
12220
12215
  }, 1000);
12221
12216
  return () => clearTimeout(timer);
12222
- }, []);
12217
+ }, [config.promo?.enabled, config.promo?.discountCode]);
12223
12218
  const handlePromoDialogClose = () => {
12224
12219
  setShowPromoDialog(false);
12225
- localStorage.setItem("bigz-promo-xmas-2024-shown", "true");
12220
+ const promoId = config.promo?.discountCode || "default";
12221
+ localStorage.setItem(`bigz-promo-${promoId}-shown`, "true");
12226
12222
  };
12227
12223
  const handlePromoCtaClick = () => {
12228
12224
  setShowPromoDialog(false);
12229
- localStorage.setItem("bigz-promo-xmas-2024-shown", "true");
12225
+ const promoId = config.promo?.discountCode || "default";
12226
+ localStorage.setItem(`bigz-promo-${promoId}-shown`, "true");
12230
12227
  if (widgetContainerRef) {
12231
12228
  widgetContainerRef.scrollIntoView({ behavior: "smooth", block: "start" });
12232
12229
  }