UNPKG

@braze/web-sdk

Version:

Braze SDK for web sites and other JS platforms.

20 lines (19 loc) 564 B
import { logger as N } from "../../shared-lib/index.js"; import r from "../managers/braze-instance.js"; import i from "./banner-provider-factory.js"; export function getBannerIfNotExpired(n, r) { const e = n[r]; if (!e) return null; const t = e.Gt, o = new Date().valueOf(); return -1 !== t && 1e3 * t < o ? (N.info(`Banner with ID: ${e.id} and placement ID: ${r} has expired.`), null) : e; } export function getBanner(n) { if (!r.rr()) return; const e = i.m(); if (!e.L()) return null; return getBannerIfNotExpired(e.dt(), n); }