UNPKG

@braze/web-sdk

Version:

Braze SDK for web sites and other JS platforms.

26 lines (25 loc) 822 B
import { logger as E, EventTypes as m } from "../../shared-lib/index.js"; import c from "../common/event-logger.js"; import r from "../managers/braze-instance.js"; import nr from "./feature-flags-provider-factory.js"; export function logFeatureFlagImpression(e) { if (!r.rr()) return; if (!e) return !1; const t = "Not logging a feature flag impression. The feature flag was not part of any matching experiment.", o = nr.o().De(); if (!o[e]) return E.info(t), !1; const n = o[e].trackingString; if (!n) return E.info(t), !1; const i = nr.o().Se(); if (i[n]) return ( E.info( "Not logging another feature flag impression. This ID was already logged this session.", ), !1 ); (i[n] = !0), nr.o().Ne(i); const s = { fid: e, fts: n }; return c.rt(m.Fr, s).W; }