Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "wordpress-plugins/real-cookie-banner/src/public/ts/components/inAppFomoCouponCounter"

Index

Variables

Const IN_APP_FOMO_URL_PARAMETER_TO_DEACTIVATE_WEBSITE_FOMO

IN_APP_FOMO_URL_PARAMETER_TO_DEACTIVATE_WEBSITE_FOMO: "promo=in-app" = "promo=in-app"

Const InAppFomoCouponCounter

InAppFomoCouponCounter: (Anonymous function) = observer(({ style }: { style?: CSSProperties }) => {const {optionStore: { fomoCoupon }} = useStores();const coupon = fomoCoupon?.coupon;const valueInPercent = fomoCoupon?.valueInPercent;const validUntil = fomoCoupon?.validUntil;const createTimerString = useCallback(() => {if (validUntil) {const remaining = new Date(validUntil).getTime() - new Date().getTime();// Already expired?if (remaining <= 0) {return undefined;}const fullSeconds = remaining / 1000;return [Math.floor(fullSeconds / 3600), Math.floor(fullSeconds / 60) % 60, Math.floor(fullSeconds % 60)].map((v) => (v < 10 ? `0${v}` : v)).filter((v, i) => v !== "00" || i > 0).join(":");} else {return undefined;}}, [validUntil]);const [, setRerender] = useState<number>();useEffect(() => {const interval = setInterval(() => {setRerender(new Date().getTime());}, 1000);return () => {clearInterval(interval);};}, []);const timerString = createTimerString();return timerString ? (<Alertstyle={style}message={_i(__("Use coupon {{tag}}%s{{/tag}} in the next {{strongHours}}%s hours{{/strongHours}} and save {{strongPercent}}%d %%{{/strongPercent}} in the first year!",coupon,timerString,valueInPercent),{tag: (<Tagcolor="success"style={{ marginRight: 0, cursor: "pointer" }}onClick={() => {copyToClipboard(coupon);message.success(__("Successfully copied coupon to clipboard!"));}}/>),strongHours: <strong style={{ color: "#d33131" }} />,strongPercent: <strong />})}/>) : null;})

Generated using TypeDoc