New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@braze/web-sdk

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@braze/web-sdk - npm Package Compare versions

Comparing version 4.5.1 to 4.6.0

src/Card/log-content-card-click.js

2

package.json
{
"name": "@braze/web-sdk",
"version": "4.5.1",
"version": "4.6.0",
"description": "Braze SDK for web sites and other JS platforms.",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -11,3 +11,3 @@ # Braze Web SDK

(c) Braze, Inc. 2022 - http://braze.com
(c) Braze, Inc. 2023 - http://braze.com
License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE

@@ -1,8 +0,8 @@

import ve from "./encoding-utils.js";
import { EventTypes as De, InternalEventTypes as Be } from "./event-types.js";
import Ae from "./guid.js";
import Ge from "./indexed-db-adapter.js";
import Oe from "./logger.js";
import Ue from "./supported-options.js";
const r = { kn: ve, A: De, qr: Be, it: Ae, qt: Ge, xt: Ge.ep, D: Oe, Vo: Ue };
import je from "./encoding-utils.js";
import { EventTypes as ve, InternalEventTypes as De } from "./event-types.js";
import Be from "./guid.js";
import Ae from "./indexed-db-adapter.js";
import Ge from "./logger.js";
import Oe from "./supported-options.js";
const r = { Dn: je, A: ve, Ar: De, it: Be, qt: Ae, xt: Ae.ep, D: Ge, Go: Oe };
export default r;

@@ -1,3 +0,3 @@

const ve = {
vn: function(t) {
const je = {
Pn: function(t) {
const r = (t + "=".repeat((4 - (t.length % 4)) % 4))

@@ -12,2 +12,2 @@ .replace(/\-/g, "+")

};
export default ve;
export default je;

@@ -1,2 +0,2 @@

const De = {
const ve = {
CustomEvent: "ce",

@@ -6,3 +6,3 @@ Pr: "p",

cc: "ca",
za: "i",
Ba: "i",
qs: "ie",

@@ -13,8 +13,8 @@ T: "cci",

L: "ccd",
Ch: "ss",
dh: "se",
gi: "si",
pi: "sc",
mi: "sbc",
ui: "sfe",
_h: "ss",
gh: "se",
bi: "si",
yi: "sc",
ji: "sbc",
vi: "sfe",
ro: "iec",

@@ -27,9 +27,9 @@ Ul: "lr",

Wl: "lcar",
Fn: "inc",
Un: "add",
En: "rem",
An: "set",
Tn: "inc",
En: "add",
Fn: "rem",
Un: "set",
Gl: "sgu"
},
Be = { Fr: "feed_displayed", dc: "content_cards_displayed" };
export { De as EventTypes, Be as InternalEventTypes };
De = { qr: "feed_displayed", dc: "content_cards_displayed" };
export { ve as EventTypes, De as InternalEventTypes };

@@ -1,2 +0,2 @@

const Ae = {
const Be = {
nt: () => {

@@ -10,2 +10,2 @@ const t = t => {

};
export default Ae;
export default Be;

@@ -1,2 +0,2 @@

export default class Ge {
export default class Ae {
constructor(t, e) {

@@ -299,3 +299,3 @@ (this.td = "undefined" == typeof window ? self : window),

}
Ge.ep = {
Ae.ep = {
Ft: {

@@ -312,3 +312,3 @@ dd: "AppboyServiceWorkerAsyncStorage",

$r: "pendingData",
On: "sdkAuthenticationSignature"
Vn: "sdkAuthenticationSignature"
},

@@ -315,0 +315,0 @@ se: 1

@@ -1,38 +0,38 @@

const Oe = {
const Ge = {
init: function(n) {
(void 0 === n && void 0 !== Oe.zg) || (Oe.zg = !!n), Oe.Eg || (Oe.Eg = !0);
(void 0 === n && void 0 !== Ge.zg) || (Ge.zg = !!n), Ge.Eg || (Ge.Eg = !0);
},
destroy: function() {
(Oe.Eg = !1), (Oe.zg = void 0), (Oe.nd = void 0);
(Ge.Eg = !1), (Ge.zg = void 0), (Ge.nd = void 0);
},
setLogger: function(n) {
"function" == typeof n
? (Oe.init(), (Oe.nd = n))
: Oe.info("Ignoring setLogger call since logger is not a function");
? (Ge.init(), (Ge.nd = n))
: Ge.info("Ignoring setLogger call since logger is not a function");
},
toggleLogging: function() {
Oe.init(),
Oe.zg
? (console.log("Disabling Braze logging"), (Oe.zg = !1))
: (console.log("Enabled Braze logging"), (Oe.zg = !0));
Ge.init(),
Ge.zg
? (console.log("Disabling Braze logging"), (Ge.zg = !1))
: (console.log("Enabled Braze logging"), (Ge.zg = !0));
},
info: function(n) {
if (Oe.zg) {
if (Ge.zg) {
const o = "Braze: " + n;
null != Oe.nd ? Oe.nd(o) : console.log(o);
null != Ge.nd ? Ge.nd(o) : console.log(o);
}
},
warn: function(n) {
if (Oe.zg) {
const o = "Braze SDK Warning: " + n + " (v4.5.1)";
null != Oe.nd ? Oe.nd(o) : console.warn(o);
if (Ge.zg) {
const o = "Braze SDK Warning: " + n + " (v4.6.0)";
null != Ge.nd ? Ge.nd(o) : console.warn(o);
}
},
error: function(n) {
if (Oe.zg) {
const o = "Braze SDK Error: " + n + " (v4.5.1)";
null != Oe.nd ? Oe.nd(o) : console.error(o);
if (Ge.zg) {
const o = "Braze SDK Error: " + n + " (v4.6.0)";
null != Ge.nd ? Ge.nd(o) : console.error(o);
}
}
};
export default Oe;
export default Ge;
export default {
Zn: "allowCrawlerActivity",
ho: "baseUrl",
po: "noCookies",
Eo: "devicePropertyAllowlist",
ho: "allowCrawlerActivity",
po: "baseUrl",
Eo: "noCookies",
_o: "devicePropertyAllowlist",
ta: "disablePushTokenMaintenance",
_o: "enableLogging",
Io: "enableSdkAuthentication",
Io: "enableLogging",
Ao: "enableSdkAuthentication",
ia: "manageServiceWorkerExternally",
Ao: "minimumIntervalBetweenTriggerActionsInSeconds",
So: "sessionTimeoutInSeconds",
No: "appVersion",
So: "minimumIntervalBetweenTriggerActionsInSeconds",
No: "sessionTimeoutInSeconds",
wo: "appVersion",
na: "serviceWorkerLocation",
ra: "safariWebsitePushId",
jn: "localization",
zn: "localization",
ao: "contentSecurityNonce",
wo: "enableHtmlInAppMessages",
To: "allowUserSuppliedJavascript",
To: "enableHtmlInAppMessages",
Oo: "allowUserSuppliedJavascript",
no: "inAppMessageZIndex",
lo: "openInAppMessagesInNewTab",
en: "openNewsFeedCardsInNewTab",
qi: "requireExplicitInAppMessageDismissal",
Oo: "doNotLoadFontAwesome",
vo: "sdkFlavor",
eh: "requireExplicitInAppMessageDismissal",
vo: "doNotLoadFontAwesome",
Co: "sdkFlavor",
tn: "openCardsInNewTab"
};

@@ -6,1 +6,2 @@ export * from "./models/index.js";

export { logContentCardImpressions } from "./log-content-card-impressions.js";
export { logContentCardClick } from "./log-content-card-click.js";

@@ -25,2 +25,2 @@ import { ControlCard } from "../Card/index.js";

}
(x.ur = 6e4), (x.Ki = 500), (x.uo = 1e4);
(x.ur = 6e4), (x.Zi = 500), (x.uo = 1e4);
import x from "./base-feed.js";
import {
bottomHadImpression as de,
getCardId as be,
impressOnBottom as ye,
impressOnTop as Fe,
markCardAsRead as Te,
topHadImpression as he
getCardId as fe,
impressOnBottom as be,
impressOnTop as ye,
markCardAsRead as Fe,
topHadImpression as Te
} from "../Card/display/card-display.js";
import { bottomIsInView as _e, topIsInView as xe } from "../util/dom-utils.js";
import { bottomIsInView as he, topIsInView as _e } from "../util/dom-utils.js";
import { Card, ControlCard } from "../Card/index.js";
import { cardToHtml as Ee } from "../Card/display/card-display.js";
import { cardToHtml as xe } from "../Card/display/card-display.js";
import { isArray as p } from "../util/code-utils.js";
import { KeyCodes as at } from "../util/key-codes.js";
import je from "../l10n/l10n-manager-factory.js";
import Ee from "../l10n/l10n-manager-factory.js";
import { removeSubscription } from "../Core/remove-subscription.js";

@@ -23,3 +23,3 @@ import r from "../../shared-lib/braze-shared-lib.js";

getDecodedBrazeAction as J,
containsUnknownBrazeAction as ct
containsUnknownBrazeAction as gt
} from "../util/braze-actions.js";

@@ -34,3 +34,3 @@ export const LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE =

e && e.parentNode && e.parentNode.removeChild(e);
}, x.Ki));
}, x.Zi));
const t = e.getAttribute("data-update-subscription-id");

@@ -61,3 +61,3 @@ null != t && removeSubscription(t);

!a || e.dr()
? (o.appendChild(Ee(n, logCardClick, t)), (s = s || !a))
? (o.appendChild(xe(n, logCardClick, t)), (s = s || !a))
: r.D.error(

@@ -70,3 +70,3 @@ "Received a control card for a legacy news feed. Control cards are only supported with content cards."

(e.className = "ab-no-cards-message"),
(e.innerHTML = je.m().get("NO_CARDS_MESSAGE")),
(e.innerHTML = Ee.m().get("NO_CARDS_MESSAGE")),
e.setAttribute("role", "article"),

@@ -84,16 +84,16 @@ o.appendChild(e);

for (let t = 0; t < r.length; t++) {
const s = be(r[t]);
const s = fe(r[t]);
if (e.do[s]) continue;
let n = he(r[t]),
let n = Te(r[t]),
a = de(r[t]);
const i = n,
d = a,
f = xe(r[t]),
c = _e(r[t]);
f = _e(r[t]),
c = he(r[t]);
if (
(!n && f && ((n = !0), Fe(r[t])),
!a && c && ((a = !0), ye(r[t])),
(!n && f && ((n = !0), ye(r[t])),
!a && c && ((a = !0), be(r[t])),
n && a)
) {
if ((f || c || Te(r[t]), i && d)) continue;
if ((f || c || Fe(r[t]), i && d)) continue;
for (const t of e.cards)

@@ -123,3 +123,3 @@ if (t.id === s) {

const e = document.createElement("span");
(e.innerHTML = je.m().get("FEED_TIMEOUT_MESSAGE")),
(e.innerHTML = Ee.m().get("FEED_TIMEOUT_MESSAGE")),
o.parentNode.appendChild(e),

@@ -186,4 +186,4 @@ o.parentNode.removeChild(o);

let t = J(e.url);
if (ct(t)) {
r.D.error(ht(ft.yi, "Content Card"));
if (gt(t)) {
r.D.error(ht(ft.Di, "Content Card"));
continue;

@@ -190,0 +190,0 @@ }

import r from "../../shared-lib/braze-shared-lib.js";
import ee from "./feature-flag.js";
import FeatureFlag from "./feature-flag.js";
export function newFeatureFlagFromJson(e) {
if (e[ee.At.ns] && "boolean" == typeof e[ee.At.Fe])
return new ee(e[ee.At.ns], e[ee.At.Fe], e[ee.At.we]);
if (e[FeatureFlag.At.ns] && "boolean" == typeof e[FeatureFlag.At.Fe])
return new FeatureFlag(
e[FeatureFlag.At.ns],
e[FeatureFlag.At.Fe],
e[FeatureFlag.At.we]
);
r.D.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
}
export function newFeatureFlagFromSerializedValue(e) {
if (e[ee.hs.ns] && "boolean" == typeof e[ee.hs.Fe])
return new ee(e[ee.hs.ns], e[ee.hs.Fe], e[ee.hs.we]);
if (e[FeatureFlag.hs.ns] && "boolean" == typeof e[FeatureFlag.hs.Fe])
return new FeatureFlag(
e[FeatureFlag.hs.ns],
e[FeatureFlag.hs.Fe],
e[FeatureFlag.hs.we]
);
r.D.info(

@@ -12,0 +20,0 @@ `Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`

@@ -1,16 +0,44 @@

export default class ee {
constructor(t, s = !1, i = {}) {
(this.id = t), (this.enabled = s), (this.properties = i);
import r from "../../shared-lib/braze-shared-lib.js";
export default class FeatureFlag {
constructor(t, r = !1, e = {}) {
(this.id = t), (this.enabled = r), (this.properties = e);
}
getStringProperty(t) {
if (!this.yr(t)) return null;
const r = this.properties[t];
return this.Er(r, "string") ? r.value : null;
}
getNumberProperty(t) {
if (!this.yr(t)) return null;
const r = this.properties[t];
return this.Er(r, "number") ? r.value : null;
}
getBooleanProperty(t) {
if (!this.yr(t)) return null;
const r = this.properties[t];
return this.Er(r, "boolean") ? r.value : null;
}
ss() {
const t = {};
return (
(t[ee.hs.ns] = this.id),
(t[ee.hs.Fe] = this.enabled),
(t[ee.hs.we] = this.properties),
(t[FeatureFlag.hs.ns] = this.id),
(t[FeatureFlag.hs.Fe] = this.enabled),
(t[FeatureFlag.hs.we] = this.properties),
t
);
}
yr(t) {
return (
!(!this.properties || !this.properties[t]) ||
(r.D.info(`${t} not found in feature flag properties.`), !1)
);
}
Er(t, e) {
return (
(t.type === e && typeof t.value === e) ||
(r.D.info(`Property is not of type ${e}.`), !1)
);
}
}
(ee.hs = { ns: "id", Fe: "e", we: "pr" }),
(ee.At = { ns: "id", Fe: "enabled", we: "properties" });
(FeatureFlag.hs = { ns: "id", Fe: "e", we: "pr" }),
(FeatureFlag.At = { ns: "id", Fe: "enabled", we: "properties" });

@@ -6,24 +6,27 @@ import r from "../../shared-lib/braze-shared-lib.js";

import u from "../managers/subscription-manager.js";
import { randomInclusive as tt } from "../util/math.js";
import b from "../util/net.js";
import {
newFeatureFlagFromJson as tt,
newFeatureFlagFromSerializedValue as et
newFeatureFlagFromJson as et,
newFeatureFlagFromSerializedValue as st
} from "./feature-flag-factory.js";
export default class er extends y {
constructor(t, s, r) {
constructor(t, s, i) {
super(),
(this.gt = t),
(this.vt = s),
(this.h = r),
(this.h = i),
(this.he = new u()),
(this.ye = 10),
(this.Te = null),
e.jt(this.he);
}
Rs(t) {
if (this.gt.ye() && null != t && t.feature_flags) {
this.De = [];
if (this.gt._e() && null != t && t.feature_flags) {
this.Re = [];
for (const e of t.feature_flags) {
let t = tt(e);
t && this.De.push(t);
let t = et(e);
t && this.Re.push(t);
}
(this.Ne = new Date().getTime()), this._e(), this.he.St(this.De);
(this.De = new Date().getTime()), this.Ne(), this.he.St(this.Re);
}

@@ -35,4 +38,4 @@ }

for (let s in t) {
let r = et(t[s]);
r && (e[r.id] = r);
let i = st(t[s]);
i && (e[i.id] = i);
}

@@ -44,25 +47,36 @@ return e;

}
refreshFeatureFlags(t, e, s) {
if (!this.Re(s))
return void (
this.Se ||
(this.Se = this.gt.Te(() => {
this.refreshFeatureFlags(t, e);
}))
refreshFeatureFlags(t, e, s, i) {
if (!this.Se(s))
return (
this.$e ||
(this.$e = this.gt.qe(() => {
this.refreshFeatureFlags(t, e);
})),
void ("function" == typeof e && e())
);
null == i && (i = !0), i && this.Me();
const r = this.vt.Ps({}, !0),
i = this.vt.Bs(r, !1, !0);
a = this.vt.Bs(r, !1, !0);
let h = !1;
this.vt.Gs(r, () => {
b.Hs({
url: `${this.vt.Ks()}/feature_flags/sync`,
headers: i,
headers: a,
data: r,
S: s => {
this.vt.Os(r, s)
? (this.vt.Qs(), this.Rs(s), "function" == typeof t && t())
: "function" == typeof e && e();
if (!this.vt.Os(r, s))
return (h = !0), void ("function" == typeof e && e());
this.vt.Qs(), this.Rs(s), "function" == typeof t && t();
},
error: t => {
this.vt.Vs(t, "retrieving feature flags"),
(h = !0),
"function" == typeof e && e();
},
Ue: () => {
if (i && h && !this.ke) {
let i = this.Te;
(null == i || i < 1e3 * this.ye) && (i = 1e3 * this.ye),
this.Ae(Math.min(3e5, tt(1e3 * this.ye, 3 * i)), t, e, s);
}
}

@@ -72,9 +86,20 @@ });

}
Re(t) {
Me() {
null != this.ke && (clearTimeout(this.ke), (this.ke = null));
}
Ae(t, e, s, i) {
null == t && (t = 1e3 * this.ye),
this.Me(),
(this.ke = setTimeout(() => {
this.refreshFeatureFlags(e, s, i);
}, t)),
(this.Te = t);
}
Se(t) {
if (!t) {
const t = parseFloat(this.gt.$e());
const t = parseFloat(this.gt.Be());
let e = !1;
if (!isNaN(t)) {
if (-1 === t) return r.D.info("Feature flag refreshes not allowed"), !1;
e = new Date().getTime() >= (this.Ne || 0) + 1e3 * t;
e = new Date().getTime() >= (this.De || 0) + 1e3 * t;
}

@@ -87,13 +112,13 @@ if (!e)

}
return this.gt.ye();
return this.gt._e();
}
_e() {
Ne() {
const t = {};
for (let e = 0; e < this.De.length; e++) {
let s = this.De[e],
r = s.ss();
t[s.id] = r;
for (let e = 0; e < this.Re.length; e++) {
let s = this.Re[e],
i = s.ss();
t[s.id] = i;
}
this.h.B(o.q.ze, t), this.h.B(o.q.qe, this.Ne);
this.h.B(o.q.ze, t), this.h.B(o.q.Ce, this.De);
}
}
import r from "../../shared-lib/braze-shared-lib.js";
import e from "../managers/braze-instance.js";
import { newFeatureFlagFromJson as tt } from "./feature-flag-factory.js";
import { newFeatureFlagFromJson as et } from "./feature-flag-factory.js";
import ir from "./feature-flags-provider-factory.js";

@@ -8,6 +8,6 @@ export function getAllFeatureFlags() {

let t = [];
if (!e.ir().ye()) return r.D.info("Feature flags are not enabled."), t;
if (!e.ir()._e()) return r.D.info("Feature flags are not enabled."), t;
const a = ir.er().xe();
for (let r in a) t.push(tt(a[r]));
for (let r in a) t.push(et(a[r]));
return t;
}
import r from "../../shared-lib/braze-shared-lib.js";
import e from "../managers/braze-instance.js";
import { newFeatureFlagFromJson as tt } from "./feature-flag-factory.js";
import ee from "./feature-flag.js";
import { newFeatureFlagFromJson as et } from "./feature-flag-factory.js";
import FeatureFlag from "./feature-flag.js";
import ir from "./feature-flags-provider-factory.js";
export function getFeatureFlag(a) {
if (!e.rr()) return;
if (!e.ir().ye())
return r.D.info("Feature flags are not enabled."), new ee(a);
if (!e.ir()._e())
return r.D.info("Feature flags are not enabled."), new FeatureFlag(a);
const t = ir.er().xe();
return t[a] ? tt(t[a]) : new ee(a);
return t[a] ? et(t[a]) : new FeatureFlag(a);
}

@@ -0,1 +1,2 @@

export { default as FeatureFlag } from "./feature-flag.js";
export { refreshFeatureFlags } from "./refresh-feature-flags.js";

@@ -2,0 +3,0 @@ export { getFeatureFlag } from "./get-feature-flag.js";

import e from "../managers/braze-instance.js";
import re from "./feed-provider.js";
const ie = {
import ee from "./feed-provider.js";
const re = {
t: !1,
provider: null,
er: () => (
ie.o(),
ie.provider || ((ie.provider = new re(e.l(), e.mr())), e.ar(ie.provider)),
ie.provider
re.o(),
re.provider || ((re.provider = new ee(e.l(), e.mr())), e.ar(re.provider)),
re.provider
),
o: () => {
ie.t || (e.u(ie), (ie.t = !0));
re.t || (e.u(re), (re.t = !0));
},
destroy: () => {
(ie.provider = null), (ie.t = !1);
(re.provider = null), (re.t = !1);
}
};
export default ie;
export default re;

@@ -5,3 +5,3 @@ import y from "../common/base-provider.js";

import {
newCardFromFeedJson as st,
newCardFromFeedJson as it,
newCardFromSerializedValue as S

@@ -12,3 +12,3 @@ } from "../Card/util/card-factory.js";

import u from "../managers/subscription-manager.js";
export default class re extends y {
export default class ee extends y {
constructor(t, s) {

@@ -38,3 +38,3 @@ super(),

i = t[h];
const o = st(i);
const o = it(i);
null != o && (e[o.id] && ((o.viewed = !0), (r[o.id] = !0)), s.push(o));

@@ -41,0 +41,0 @@ }

import e from "../managers/braze-instance.js";
import ie from "./feed-provider-factory.js";
import re from "./feed-provider-factory.js";
export function getCachedFeed() {
if (e.rr()) return ie.er().ai();
if (e.rr()) return re.er().ai();
}
import e from "../managers/braze-instance.js";
import r from "../../shared-lib/braze-shared-lib.js";
export function logFeedDisplayed() {
if (e.rr()) return e.nr().yr(r.qr.Fr).S;
if (e.rr()) return e.nr().Fr(r.Ar.qr).S;
}
import e from "../managers/braze-instance.js";
import ie from "./feed-provider-factory.js";
import re from "./feed-provider-factory.js";
export function requestFeedRefresh() {
if (e.rr()) return ie.er().Is();
if (e.rr()) return re.er().Is();
}
import e from "../managers/braze-instance.js";
import ie from "./feed-provider-factory.js";
import re from "./feed-provider-factory.js";
export function subscribeToFeedUpdates(r) {
if (e.rr()) return ie.er().Ws(r);
if (e.rr()) return re.er().Ws(r);
}

@@ -12,3 +12,3 @@ import e, { OPTIONS as T } from "../../managers/braze-instance.js";

import { Feed, logFeedDisplayed, subscribeToFeedUpdates } from "../index.js";
import ie from "../feed-provider-factory.js";
import re from "../feed-provider-factory.js";
import { intersection as te } from "../../util/code-utils.js";

@@ -40,3 +40,3 @@ import { setCardHeight as A } from "../../Card/display/card-display.js";

null == n
? ((f = ie.er().ai()),
? ((f = re.er().ai()),
k(f, s(f.cards, o), f.lastUpdated, null, i),

@@ -43,0 +43,0 @@ (a = !0))

@@ -8,5 +8,5 @@ import { attachInAppMessageCSS as nt } from "../../ui/js/iam-css.js";

import { OperatingSystems as rt } from "../../util/device-constants.js";
import { parseQueryStringKeyValues as it } from "../../util/url-utils.js";
import { parseQueryStringKeyValues as ut } from "../../util/url-utils.js";
import { WindowUtils as H } from "../../util/window-utils.js";
export default function ut(t, n, e, o, s, r) {
export default function ct(t, n, e, o, s, r) {
const i = document.createElement("iframe");

@@ -19,3 +19,3 @@ i.setAttribute("title", "Modal Message"), s && (i.style.zIndex = s + 1);

if (null != s && "function" == typeof s && !1 === s()) return;
let u = it(e).abButtonId;
let u = ut(e).abButtonId;
if (

@@ -22,0 +22,0 @@ ((null != u && "" !== u) || (u = n.getAttribute("id")),

@@ -8,3 +8,3 @@ import {

import { createCloseButton as i } from "../../util/component-utils.js";
import { isTransparent as ne, toRgba as me } from "../../util/color-utils.js";
import { isTransparent as ie, toRgba as ne } from "../../util/color-utils.js";
import FullScreenMessage from "../models/full-screen-message.js";

@@ -17,32 +17,42 @@ import HtmlMessage from "../models/html-message.js";

import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js";
import ut from "./html-message-to-html.js";
import ce from "./modal-utils.js";
import ct from "./html-message-to-html.js";
import me from "./modal-utils.js";
import r from "../../../shared-lib/braze-shared-lib.js";
export default function le(e, o, s, t, a, n) {
if (((e.ke = document.activeElement), e instanceof HtmlMessage))
return ut(e, o, s, t, a, n);
const l = (function(e, o, s, t, a) {
const n = document.createElement("div");
(n.className = "ab-in-app-message ab-start-hidden ab-background"),
a && (n.style.zIndex = a + 1),
e.Me() &&
((n.className += " ab-modal-interactions"),
n.setAttribute("tabindex", "-1")),
export default function ce(e, o, a, s, t, n, l) {
if (((e.Le = document.activeElement), e instanceof HtmlMessage))
return ct(e, o, a, t, n, l);
const b = (function(e, o, a, s, t, n) {
const c = document.createElement("div");
(c.className = "ab-in-app-message ab-start-hidden ab-background"),
n && (c.style.zIndex = n + 1),
e.Ie() &&
((c.className += " ab-modal-interactions"),
c.setAttribute("tabindex", "-1")),
e.sn() ||
((n.style.color = me(e.textColor)),
(n.style.backgroundColor = me(e.backgroundColor)),
ne(e.backgroundColor) && (n.className += " ab-no-shadow"));
const c = () => {
-1 !== n.className.indexOf("ab-start-hidden") &&
((n.className = n.className.replace("ab-start-hidden", "")), s(n));
};
((c.style.color = ne(e.textColor)),
(c.style.backgroundColor = ne(e.backgroundColor)),
ie(e.backgroundColor) && (c.className += " ab-no-shadow"));
const d = () => {
-1 !== c.className.indexOf("ab-start-hidden") &&
((c.className = c.className.replace("ab-start-hidden", "")),
document.querySelectorAll(".ab-iam-img-loading").length > 0
? s(
`Cannot show in-app message ${e.message} because another message is being shown.`,
InAppMessage.Ge.Ee
)
: a(c));
},
l = () => {
const e = document.querySelectorAll(".ab-iam-root");
e && e.length > 0 && (e[0].classList.remove("ab-iam-img-loading"), d());
};
e.imageStyle === InAppMessage.ImageStyle.GRAPHIC &&
(n.className += " graphic"),
(c.className += " graphic"),
e.orientation === InAppMessage.Orientation.LANDSCAPE &&
(n.className += " landscape"),
(c.className += " landscape"),
0 === e.buttons.length &&
(e.clickAction !== InAppMessage.ClickAction.NONE &&
(n.className += " ab-clickable"),
(n.onclick = s => (
e.on(n, () => {
(c.className += " ab-clickable"),
(c.onclick = a => (
e.on(c, () => {
logInAppMessageClick(e),

@@ -52,3 +62,3 @@ e.clickAction === InAppMessage.ClickAction.URI

e.uri,
s,
a,
t || e.openTarget === InAppMessage.OpenTarget.BLANK

@@ -58,20 +68,20 @@ )

}),
s.stopPropagation(),
a.stopPropagation(),
!1
)));
const l = i(
const b = i(
"Close Message",
e.sn() ? void 0 : me(e.closeButtonColor),
e.sn() ? void 0 : ne(e.closeButtonColor),
() => {
e.on(n);
e.on(c);
}
);
n.appendChild(l), a && (l.style.zIndex = a + 2);
const d = document.createElement("div");
d.className = "ab-message-text";
const u = (e.messageAlignment || e.Ce).toLowerCase();
d.className += " " + u + "-aligned";
let b = !1;
const f = document.createElement("div");
if (((f.className = "ab-image-area"), e.imageUrl)) {
c.appendChild(b), n && (b.style.zIndex = n + 2);
const u = document.createElement("div");
u.className = "ab-message-text";
const p = (e.messageAlignment || e.He).toLowerCase();
u.className += " " + p + "-aligned";
let f = !1;
const g = document.createElement("div");
if (((g.className = "ab-image-area"), e.imageUrl)) {
if (e.cropType === InAppMessage.CropType.CENTER_CROP) {

@@ -83,75 +93,80 @@ const o = document.createElement("span");

o.setAttribute("aria-label", "Modal Image"),
e.Le(o),
f.appendChild(o);
e.Je(o),
g.appendChild(o);
} else {
const o = document.createElement("img");
o.setAttribute("src", e.imageUrl),
e.Le(o),
(b = !0),
(o.onload = c),
setTimeout(c, 1e3),
f.appendChild(o);
if (
(o.setAttribute("src", e.imageUrl),
e.Je(o),
0 === document.querySelectorAll(".ab-iam-img-loading").length)
) {
f = !0;
const e = document.querySelectorAll(".ab-iam-root");
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"),
(o.onload = l);
}
setTimeout(d, 1e3), g.appendChild(o);
}
n.appendChild(f), (d.className += " ab-with-image");
c.appendChild(g), (u.className += " ab-with-image");
} else if (e.icon) {
f.className += " ab-icon-area";
g.className += " ab-icon-area";
const o = document.createElement("span");
(o.className = "ab-icon"),
e.sn() ||
((o.style.backgroundColor = me(e.iconBackgroundColor)),
(o.style.color = me(e.iconColor)));
const s = document.createElement("i");
(s.className = "fa"),
s.appendChild(document.createTextNode(e.icon)),
s.setAttribute("aria-hidden", !0),
o.appendChild(s),
f.appendChild(o),
n.appendChild(f),
(d.className += " ab-with-icon");
((o.style.backgroundColor = ne(e.iconBackgroundColor)),
(o.style.color = ne(e.iconColor)));
const a = document.createElement("i");
(a.className = "fa"),
a.appendChild(document.createTextNode(e.icon)),
a.setAttribute("aria-hidden", !0),
o.appendChild(a),
g.appendChild(o),
c.appendChild(g),
(u.className += " ab-with-icon");
}
if ((oe(d, "touchstart", function() {}), e.header && e.header.length > 0)) {
if ((oe(u, "touchstart", function() {}), e.header && e.header.length > 0)) {
const o = document.createElement("h1");
(o.className = "ab-message-header"), (e.Ie = r.it.nt()), (o.id = e.Ie);
const s = (
(o.className = "ab-message-header"), (e.Ke = r.it.nt()), (o.id = e.Ke);
const a = (
e.headerAlignment || InAppMessage.TextAlignment.CENTER
).toLowerCase();
(o.className += " " + s + "-aligned"),
e.sn() || (o.style.color = me(e.headerTextColor)),
(o.className += " " + a + "-aligned"),
e.sn() || (o.style.color = ne(e.headerTextColor)),
o.appendChild(document.createTextNode(e.header)),
d.appendChild(o);
u.appendChild(o);
}
return d.appendChild(e.Ae()), n.appendChild(d), b || c(), (e.mn = n), n;
})(e, o, s, t, a);
return u.appendChild(e.Oe()), c.appendChild(u), f || d(), (e.mn = c), c;
})(e, o, a, s, t, n);
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
const s = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
(l.className += ` ${s} ab-centered`),
ce.Be(e, o, l, t),
ce.Ee(l),
ce.Ge(e.Ie, l);
const a = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
(b.className += ` ${a} ab-centered`),
me.Pe(e, o, b, t),
me.Qe(b),
me.Ve(e.Ke, b);
} else if (e instanceof SlideUpMessage) {
l.className += " ab-slideup";
const o = l.getElementsByClassName("ab-close-button")[0];
b.className += " ab-slideup";
const o = b.getElementsByClassName("ab-close-button")[0];
if (null != o) {
const s = ae(
const a = ae(
"0 0 11.38 19.44",
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
e.sn() ? void 0 : me(e.closeButtonColor)
e.sn() ? void 0 : ne(e.closeButtonColor)
);
s.setAttribute("class", "ab-chevron"), o.appendChild(s);
a.setAttribute("class", "ab-chevron"), o.appendChild(a);
}
let s, t;
d(l, c.ot, e => {
(l.className += " ab-swiped-left"), o.onclick(e);
let a, s;
d(b, c.ot, e => {
(b.className += " ab-swiped-left"), o.onclick(e);
}),
d(l, c.et, e => {
(l.className += " ab-swiped-right"), o.onclick(e);
d(b, c.et, e => {
(b.className += " ab-swiped-right"), o.onclick(e);
}),
e.slideFrom === InAppMessage.SlideFrom.TOP
? ((s = c.He), (t = " ab-swiped-up"))
: ((s = c.Je), (t = " ab-swiped-down")),
d(l, s, e => {
(l.className += t), o.onclick(e);
? ((a = c.We), (s = " ab-swiped-up"))
: ((a = c.Xe), (s = " ab-swiped-down")),
d(b, a, e => {
(b.className += s), o.onclick(e);
});
}
return l;
return b;
}
import InAppMessage from "../models/in-app-message.js";
import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js";
import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js";
import { toRgba as me } from "../../util/color-utils.js";
import { toRgba as ne } from "../../util/color-utils.js";
import { addPassiveEventListener as oe } from "../../util/dom-utils.js";
import { KeyCodes as at } from "../../util/key-codes.js";
const ce = {
Ee: t => {
const me = {
Qe: t => {
const o = t.querySelectorAll(

@@ -27,3 +27,3 @@ ".ab-close-button, .ab-message-text, .ab-message-button"

},
Ge: (t, o) => {
Ve: (t, o) => {
o.setAttribute("role", "dialog"),

@@ -34,3 +34,3 @@ o.setAttribute("aria-modal", !0),

},
Be: (t, o, e, s) => {
Pe: (t, o, e, s) => {
if (t.buttons.length > 0) {

@@ -61,5 +61,5 @@ const a = document.createElement("div");

t.sn() ||
((s.style.backgroundColor = me(e.backgroundColor)),
(s.style.color = me(e.textColor)),
(s.style.borderColor = me(e.borderColor))),
((s.style.backgroundColor = ne(e.backgroundColor)),
(s.style.color = ne(e.textColor)),
(s.style.borderColor = ne(e.borderColor))),
(s.onclick = n(e)),

@@ -71,2 +71,2 @@ a.appendChild(s);

};
export default ce;
export default me;

@@ -49,3 +49,3 @@ import InAppMessage from "./models/in-app-message.js";

((C = void 0), (D = void 0)),
s === ModalMessage.es || s === InAppMessage.es.Ke)
s === ModalMessage.es || s === InAppMessage.es.Ye)
)

@@ -52,0 +52,0 @@ B = new ModalMessage(

import ge from "./in-app-message-manager.js";
import e from "../managers/braze-instance.js";
const pe = {
Oe: null,
Ze: null,
t: !1,
m: () => (
pe.o(), pe.Oe || (pe.Oe = new ge(e.nr(), e.g(), e.l(), e.p())), pe.Oe
pe.o(), pe.Ze || (pe.Ze = new ge(e.nr(), e.g(), e.l(), e.p())), pe.Ze
),

@@ -13,5 +13,5 @@ o: () => {

destroy: () => {
(pe.Oe = null), (pe.t = !1);
(pe.Ze = null), (pe.t = !1);
}
};
export default pe;

@@ -9,12 +9,12 @@ import b from "../util/net.js";

import { newInAppMessageFromJson as lt } from "./in-app-message-factory.js";
import { randomInclusive as pt } from "../util/math.js";
import { randomInclusive as tt } from "../util/math.js";
import t from "../models/request-result.js";
import r from "../../shared-lib/braze-shared-lib.js";
import u from "../managers/subscription-manager.js";
import mt from "../triggers/models/trigger.js";
import pt from "../triggers/models/trigger.js";
import { validateValueIsFromEnum as F } from "../util/code-utils.js";
import { BRAZE_ACTION_URI_REGEX as O } from "../util/validation-utils.js";
import {
containsPushPrimerBrazeAction as gt,
containsUnknownBrazeAction as ct,
containsPushPrimerBrazeAction as mt,
containsUnknownBrazeAction as gt,
getDecodedBrazeAction as J,

@@ -31,23 +31,23 @@ ineligibleBrazeActionURLErrorMessage as ht,

(this.v = r),
(this.Pe = new u()),
e.jt(this.Pe),
(this.Qe = 1e3),
(this.Ue = 6e4);
(this.ni = new u()),
e.jt(this.ni),
(this.li = 1e3),
(this.ui = 6e4);
}
Ve() {
return this.Pe;
pi() {
return this.ni;
}
We(t) {
return this.Pe.ut(t);
mi(t) {
return this.ni.ut(t);
}
Xe() {
return this.Ye;
gi() {
return this.ci;
}
Ze(t) {
this.Ye = t;
fi(t) {
this.ci = t;
}
ni(e, i) {
di(e, i) {
if (
!F(
InAppMessage.li,
InAppMessage.Ge,
i,

@@ -60,3 +60,3 @@ `${i} is not a valid in-app message display failure`,

const n = { trigger_ids: [e], error_code: i };
return s.G(r.A.ui, n);
return s.G(r.A.vi, n);
}

@@ -68,3 +68,3 @@ G(e, i, n, o) {

else {
if (i === r.A.pi || (e instanceof HtmlMessage && i === r.A.mi)) {
if (i === r.A.yi || (e instanceof HtmlMessage && i === r.A.ji)) {
if (!e.k(o))

@@ -77,3 +77,3 @@ return (

);
} else if (i === r.A.gi) {
} else if (i === r.A.bi) {
if (!e.R())

@@ -87,7 +87,7 @@ return (

}
l = this.ci(e);
l = this.Ii(e);
}
return null == l ? a : (null != n && (l.bid = n), s.G(i, l));
}
fi(e, i) {
Ai(e, i) {
const n = new t();

@@ -101,6 +101,6 @@ if (!e.k())

);
const o = this.ci(i);
const o = this.Ii(i);
return null == o
? n
: e.id === InAppMessageButton.di
: e.id === InAppMessageButton.Mi
? (r.D.info(

@@ -110,12 +110,12 @@ "This in-app message button does not have a tracking id. Not logging event to Braze servers."

n)
: (null != e.id && (o.bid = e.id), s.G(r.A.mi, o));
: (null != e.id && (o.bid = e.id), s.G(r.A.ji, o));
}
vi(t) {
zi(t) {
if (!(t instanceof InAppMessage)) return;
const s = t => {
const s = J(t);
return ct(s)
? ht(ft.yi, "In-App Message")
: gt(s) && !dt.ji()
? ht(ft.bi, "In-App Message")
return gt(s)
? ht(ft.Di, "In-App Message")
: mt(s) && !dt.Ti()
? ht(ft._i, "In-App Message")
: void 0;

@@ -136,7 +136,7 @@ },

}
Ii(t, s, e, i) {
let n = this.vt.Ai(!1, !1);
ki(t, s, e, i) {
let n = this.vt.wi(!1, !1);
(n = this.vt.Ps(n)),
(n.template = { trigger_id: t.triggerId, trigger_event_type: s }),
null != e && (n.template.data = e.Mi());
null != e && (n.template.data = e.Si());
const o = this.vt.Bs(n);

@@ -151,31 +151,31 @@ this.vt.Gs(n, () => {

return (
this.ni(t.triggerId, InAppMessage.li.zi),
void ("function" == typeof t.Di && t.Di())
this.di(t.triggerId, InAppMessage.Ge.$i),
void ("function" == typeof t.Bi && t.Bi())
);
if ((this.vt.Qs(), null == s || null == s.templated_message))
return void this.ni(t.triggerId, InAppMessage.li.zi);
return void this.di(t.triggerId, InAppMessage.Ge.$i);
const e = s.templated_message;
if (e.type !== mt._i.Ti)
return void this.ni(t.triggerId, InAppMessage.li.ki);
if (e.type !== pt.Fi.Ei)
return void this.di(t.triggerId, InAppMessage.Ge.Gi);
const i = lt(e.data);
if (null == i) return void this.ni(t.triggerId, InAppMessage.li.ki);
let a = this.vi(i);
if (null == i) return void this.di(t.triggerId, InAppMessage.Ge.Gi);
let a = this.zi(i);
if (a)
return r.D.error(a), void ("function" == typeof t.Di && t.Di());
"function" == typeof t.wi
? t.wi(i)
: this.ni(t.triggerId, InAppMessage.li.zi);
return r.D.error(a), void ("function" == typeof t.Bi && t.Bi());
"function" == typeof t.Ni
? t.Ni(i)
: this.di(t.triggerId, InAppMessage.Ge.$i);
},
error: r => {
let n = `getting user personalization for message ${t.triggerId}`;
if (new Date().valueOf() - t.Si > t.$i)
this.ni(t.triggerId, InAppMessage.li.zi);
if (new Date().valueOf() - t.qi > t.xi)
this.di(t.triggerId, InAppMessage.Ge.$i);
else {
const r = Math.min(t.$i, this.Ue),
o = this.Qe;
const r = Math.min(t.xi, this.ui),
o = this.li;
null == i && (i = o);
const a = Math.min(r, pt(o, 3 * i));
const a = Math.min(r, tt(o, 3 * i));
(n += `. Retrying in ${a} ms`),
setTimeout(() => {
this.Ii(t, s, e, a);
this.ki(t, s, e, a);
}, a);

@@ -188,3 +188,3 @@ }

}
ci(t) {
Ii(t) {
if (null == t.triggerId)

@@ -191,0 +191,0 @@ return (

@@ -14,7 +14,7 @@ import e from "../managers/braze-instance.js";

if (!(o instanceof InAppMessage)) return r.D.error(or), !1;
const s = pe.m().fi(t, o);
const s = pe.m().Ai(t, o);
if (s.S)
for (let r = 0; r < s.ve.length; r++)
W.er().je(V.Ar, [o.triggerId, t.id], s.ve[r]);
W.er().je(V.Br, [o.triggerId, t.id], s.ve[r]);
return s.S;
}

@@ -12,9 +12,9 @@ import e from "../managers/braze-instance.js";

if (!(o instanceof InAppMessage)) return r.D.error(or), !1;
const s = pe.m().G(o, r.A.pi);
const s = pe.m().G(o, r.A.yi);
if (s) {
o.Cr() || logInAppMessageImpression(o);
for (let r = 0; r < s.ve.length; r++)
W.er().je(V.Ar, [o.triggerId], s.ve[r]);
W.er().je(V.Br, [o.triggerId], s.ve[r]);
}
return s.S;
}

@@ -16,9 +16,9 @@ import e from "../managers/braze-instance.js";

);
let m = r.A.pi;
null != t && (m = r.A.mi);
let m = r.A.yi;
null != t && (m = r.A.ji);
const i = pe.m().G(s, m, t, o);
if (i.S)
for (let r = 0; r < i.ve.length; r++)
W.er().je(V.Ar, [s.triggerId, t], i.ve[r]);
W.er().je(V.Br, [s.triggerId, t], i.ve[r]);
return i.S;
}

@@ -11,4 +11,4 @@ import e from "../managers/braze-instance.js";

return r.D.error(or), !1;
const s = o instanceof ControlMessage ? r.A.ro : r.A.gi;
const s = o instanceof ControlMessage ? r.A.ro : r.A.bi;
return pe.m().G(o, s).S;
}

@@ -67,3 +67,3 @@ import InAppMessage from "./in-app-message.js";

}
get Ce() {
get He() {
return InAppMessage.TextAlignment.CENTER;

@@ -70,0 +70,0 @@ }

@@ -6,8 +6,8 @@ import InAppMessage from "./in-app-message.js";

(this.text = s || ""),
(this.backgroundColor = t || InAppMessage.xi.Ci),
(this.textColor = i || InAppMessage.xi.Ei),
(this.backgroundColor = t || InAppMessage.Ji.Ci),
(this.textColor = i || InAppMessage.Ji.Hi),
(this.borderColor = r || this.backgroundColor),
(this.clickAction = e || InAppMessage.ClickAction.NONE),
(this.uri = h),
null == n && (n = InAppMessageButton.di),
null == n && (n = InAppMessageButton.Mi),
(this.id = n),

@@ -41,2 +41,2 @@ (this.nl = !1),

}
InAppMessageButton.di = -1;
InAppMessageButton.Mi = -1;

@@ -54,7 +54,7 @@ import e, { OPTIONS as T } from "../../managers/braze-instance.js";

(this.imageStyle = m || InAppMessage.ImageStyle.TOP),
(this.iconColor = c || InAppMessage.xi.Ei),
(this.iconBackgroundColor = I || InAppMessage.xi.Ci),
(this.backgroundColor = A || InAppMessage.xi.Ei),
(this.textColor = N || InAppMessage.xi.Ni),
(this.closeButtonColor = _ || InAppMessage.xi.Li),
(this.iconColor = c || InAppMessage.Ji.Hi),
(this.iconBackgroundColor = I || InAppMessage.Ji.Ci),
(this.backgroundColor = A || InAppMessage.Ji.Hi),
(this.textColor = N || InAppMessage.Ji.Li),
(this.closeButtonColor = _ || InAppMessage.Ji.Oi),
(this.animateIn = L),

@@ -66,4 +66,4 @@ null == this.animateIn && (this.animateIn = !0),

(this.headerAlignment = S || InAppMessage.TextAlignment.CENTER),
(this.headerTextColor = D || InAppMessage.xi.Ni),
(this.frameColor = M || InAppMessage.xi.Oi),
(this.headerTextColor = D || InAppMessage.Ji.Li),
(this.frameColor = M || InAppMessage.Ji.Ri),
(this.buttons = R || []),

@@ -75,7 +75,7 @@ (this.cropType = b || InAppMessage.CropType.FIT_CENTER),

(this.isControl = !1),
(this.Ri = !1),
(this.Pi = !1),
(this.nl = !1),
(this.Pi = !1),
(this.Ui = !1),
(this.lt = new u()),
(this.Ui = new u());
(this.Wi = new u());
}

@@ -86,9 +86,9 @@ subscribeToClickedEvent(t) {

subscribeToDismissedEvent(t) {
return this.Ui.ut(t);
return this.Wi.ut(t);
}
removeSubscription(t) {
this.lt.removeSubscription(t), this.Ui.removeSubscription(t);
this.lt.removeSubscription(t), this.Wi.removeSubscription(t);
}
removeAllSubscriptions() {
this.lt.removeAllSubscriptions(), this.Ui.removeAllSubscriptions();
this.lt.removeAllSubscriptions(), this.Wi.removeAllSubscriptions();
}

@@ -98,7 +98,7 @@ closeMessage() {

}
Me() {
Ie() {
return !0;
}
ll() {
return this.Me();
return this.Ie();
}

@@ -115,6 +115,6 @@ an() {

R() {
return !this.Ri && ((this.Ri = !0), !0);
return !this.Pi && ((this.Pi = !0), !0);
}
Cr() {
return this.Ri;
return this.Pi;
}

@@ -125,13 +125,13 @@ k() {

J() {
return !this.Pi && ((this.Pi = !0), this.Ui.St(), !0);
return !this.Ui && ((this.Ui = !0), this.Wi.St(), !0);
}
Hi(t) {
Ki(t) {
if (t && t.parentNode) {
let s = t.closest(".ab-iam-root");
if ((null == s && (s = t), this.Me() && null != s.parentNode)) {
if ((null == s && (s = t), this.Ie() && null != s.parentNode)) {
const t = s.parentNode.classList;
t && t.contains(InAppMessage.Fi) && t.remove(InAppMessage.Fi),
document.body.removeEventListener("touchmove", InAppMessage.Bi);
t && t.contains(InAppMessage.Yi) && t.remove(InAppMessage.Yi),
document.body.removeEventListener("touchmove", InAppMessage.Xi);
}
s.className = s.className.replace(InAppMessage.Gi, InAppMessage.Wi);
s.className = s.className.replace(InAppMessage.Vi, InAppMessage.Qi);
}

@@ -149,3 +149,3 @@ return this.animateOut;

let e = !1;
i && (e = this.Hi(i));
i && (e = this.Ki(i));
const h = document.body;

@@ -165,13 +165,13 @@ if (null != h) var n = h.scrollTop;

};
e ? setTimeout(r, InAppMessage.Ki) : r(), this.ke && this.ke.focus();
e ? setTimeout(r, InAppMessage.Zi) : r(), this.Le && this.Le.focus();
}
Ae() {
Oe() {
return document.createTextNode(this.message);
}
Le(t) {
Je(t) {
let s = "";
this.message || this.header || !this.Me() || (s = "Modal Image"),
this.message || this.header || !this.Ie() || (s = "Modal Image"),
t.setAttribute("alt", s);
}
static Bi(t) {
static Xi(t) {
(t.targetTouches && t.targetTouches.length > 1) ||

@@ -181,21 +181,21 @@ (t.target.classList &&

t.target.scrollHeight > t.target.clientHeight) ||
(document.querySelector(`.${InAppMessage.Fi}`) && t.preventDefault());
(document.querySelector(`.${InAppMessage.Yi}`) && t.preventDefault());
}
Yi(t) {
this.Me() &&
th(t) {
this.Ie() &&
null != t.parentNode &&
this.orientation !== InAppMessage.Orientation.LANDSCAPE &&
(null != t.parentNode.classList &&
t.parentNode.classList.add(InAppMessage.Fi),
t.parentNode.classList.add(InAppMessage.Yi),
document.body.addEventListener(
"touchmove",
InAppMessage.Bi,
InAppMessage.Xi,
!!Tt() && { passive: !1 }
)),
(t.className += " " + InAppMessage.Gi);
(t.className += " " + InAppMessage.Vi);
}
static Xi(t) {
static sh(t) {
if (
t.keyCode === at.Vi &&
!e.nn(T.qi) &&
t.keyCode === at.ih &&
!e.nn(T.eh) &&
document.querySelectorAll(".ab-modal-interactions").length > 0

@@ -219,29 +219,29 @@ ) {

}
Ji() {
this.Qi ||
e.nn(T.qi) ||
(document.addEventListener("keydown", InAppMessage.Xi, !1),
e.Zi(() => {
document.removeEventListener("keydown", InAppMessage.Xi);
hh() {
this.nh ||
e.nn(T.eh) ||
(document.addEventListener("keydown", InAppMessage.sh, !1),
e.rh(() => {
document.removeEventListener("keydown", InAppMessage.sh);
}),
(this.Qi = !0));
(this.nh = !0));
}
}
(InAppMessage.xi = {
Ni: 4281545523,
Ei: 4294967295,
(InAppMessage.Ji = {
Li: 4281545523,
Hi: 4294967295,
Ci: 4278219733,
th: 4293914607,
sh: 4283782485,
Oi: 3224580915,
Li: 4288387995
oh: 4293914607,
lh: 4283782485,
Ri: 3224580915,
Oi: 4288387995
}),
(InAppMessage.li = {
ih: "hd",
eh: "ias",
hh: "of",
nh: "do",
ki: "umt",
zi: "tf",
rh: "te"
(InAppMessage.Ge = {
Eh: "hd",
Ee: "ias",
uh: "of",
Th: "do",
Gi: "umt",
$i: "tf",
ah: "te"
}),

@@ -271,5 +271,5 @@ (InAppMessage.SlideFrom = { TOP: "TOP", BOTTOM: "BOTTOM" }),

(InAppMessage.es = {
oh: "SLIDEUP",
lh: "MODAL",
Ke: "MODAL_STYLED",
mh: "SLIDEUP",
Ih: "MODAL",
Ye: "MODAL_STYLED",
Tr: "FULL",

@@ -279,6 +279,6 @@ el: "WEB_HTML",

}),
(InAppMessage.Ki = 500),
(InAppMessage.Eh = 200),
(InAppMessage.Gi = "ab-show"),
(InAppMessage.Wi = "ab-hide"),
(InAppMessage.Fi = "ab-pause-scrolling");
(InAppMessage.Zi = 500),
(InAppMessage.Ah = 200),
(InAppMessage.Vi = "ab-show"),
(InAppMessage.Qi = "ab-hide"),
(InAppMessage.Yi = "ab-pause-scrolling");

@@ -64,6 +64,6 @@ import InAppMessage from "./in-app-message.js";

}
get Ce() {
get He() {
return InAppMessage.TextAlignment.CENTER;
}
}
ModalMessage.es = InAppMessage.es.lh;
ModalMessage.es = InAppMessage.es.Ih;

@@ -5,4 +5,4 @@ import InAppMessage from "./in-app-message.js";

constructor(t, e, o, s, n, i, r, d, u, a, p, l, m, c, v, x, g, f, h, I, M) {
(x = x || InAppMessage.xi.sh),
(v = v || InAppMessage.xi.th),
(x = x || InAppMessage.Ji.lh),
(v = v || InAppMessage.Ji.oh),
super(

@@ -40,13 +40,13 @@ t,

}
Me() {
Ie() {
return !1;
}
get Ce() {
get He() {
return InAppMessage.TextAlignment.START;
}
Ae() {
Oe() {
const t = document.createElement("span");
return t.appendChild(document.createTextNode(this.message)), t;
}
Yi(t) {
th(t) {
const e = t.getElementsByClassName("ab-in-app-message")[0];

@@ -57,5 +57,5 @@ vt.eo(e, !0, !0) ||

: (e.style.bottom = "0px")),
super.Yi(t);
super.th(t);
}
}
SlideUpMessage.es = InAppMessage.es.oh;
SlideUpMessage.es = InAppMessage.es.mh;
export default class wt {
constructor(t, s, l, n, i) {
(this.triggerId = t),
(this.wi = s),
(this.Di = l),
(this.Si = n),
(this.$i = i);
(this.Ni = s),
(this.Bi = l),
(this.qi = n),
(this.xi = i);
}

@@ -9,0 +9,0 @@ static fromJson(t, s, l, n, i) {

@@ -7,5 +7,5 @@ import e from "../managers/braze-instance.js";

? null
: pe.m().We(function(r) {
: pe.m().mi(function(r) {
return n(r[0]), r.slice(1);
});
}

@@ -10,7 +10,7 @@ import pe from "../in-app-message-manager-factory.js";

const s = pe.m();
if (null == s.Xe()) {
if (null == s.gi()) {
const r = subscribeToInAppMessage(s => showInAppMessage(s));
s.Ze(r);
s.fi(r);
}
return s.Xe();
return s.gi();
}

@@ -8,6 +8,6 @@ import e, { OPTIONS as T } from "../../managers/braze-instance.js";

import se from "../display/get-animation-effect.js";
import le from "../display/in-app-message-to-html.js";
import ce from "../display/in-app-message-to-html.js";
import { logInAppMessageImpression } from "../log-in-app-message-impression.js";
import {
ORIENTATION as fe,
ORIENTATION as le,
WindowUtils as H

@@ -19,3 +19,3 @@ } from "../../util/window-utils.js";

import r from "../../../shared-lib/braze-shared-lib.js";
import { toRgba as me } from "../../util/color-utils.js";
import { toRgba as ne } from "../../util/color-utils.js";
export function showInAppMessage(t, s, o) {

@@ -34,3 +34,3 @@ if (!e.rr()) return;

const i = pe.m();
t.Ji();
t.hh();
const n = t instanceof HtmlMessage;

@@ -42,6 +42,6 @@ if (n && !t.trusted && !e.tr())

),
i.ni(t.triggerId, InAppMessage.li.ih),
i.di(t.triggerId, InAppMessage.Ge.Eh),
!1
);
if ((null == s && (s = document.body), t.Me())) {
if ((null == s && (s = document.body), t.Ie())) {
if (s.querySelectorAll(".ab-modal-interactions").length > 0)

@@ -52,3 +52,3 @@ return (

),
i.ni(t.triggerId, InAppMessage.li.eh),
i.di(t.triggerId, InAppMessage.Ge.Ee),
!1

@@ -60,8 +60,8 @@ );

if (
(e === fe.PORTRAIT &&
(e === le.PORTRAIT &&
t.orientation === InAppMessage.Orientation.LANDSCAPE) ||
(e === fe.LANDSCAPE &&
(e === le.LANDSCAPE &&
t.orientation === InAppMessage.Orientation.PORTRAIT)
) {
const s = e === fe.PORTRAIT ? "portrait" : "landscape",
const s = e === le.PORTRAIT ? "portrait" : "landscape",
o =

@@ -75,3 +75,3 @@ t.orientation === InAppMessage.Orientation.PORTRAIT

),
i.ni(t.triggerId, InAppMessage.li.hh),
i.di(t.triggerId, InAppMessage.Ge.uh),
!1

@@ -96,3 +96,3 @@ );

),
i.ni(t.triggerId, InAppMessage.li.ih),
i.di(t.triggerId, InAppMessage.Ge.Eh),
!1

@@ -118,3 +118,3 @@ );

const l = t instanceof SlideUpMessage,
m = le(
m = ce(
t,

@@ -125,18 +125,18 @@ () => {

s => {
if (t.Me() && t.ll()) {
if (t.Ie() && t.ll()) {
const o = document.createElement("div");
if (
((o.className = "ab-page-blocker"),
t.sn() || (o.style.backgroundColor = me(t.frameColor)),
t.sn() || (o.style.backgroundColor = ne(t.frameColor)),
e.nn(T.no) && (o.style.zIndex = e.nn(T.no)),
a.appendChild(o),
!e.nn(T.qi))
!e.nn(T.eh))
) {
const e = new Date().valueOf();
o.onclick = o => {
new Date().valueOf() - e > InAppMessage.Eh &&
new Date().valueOf() - e > InAppMessage.Ah &&
(t.on(s), o.stopPropagation());
};
}
a.appendChild(s), s.focus(), t.Yi(a);
a.appendChild(s), s.focus(), t.th(a);
} else if (l) {

@@ -162,6 +162,6 @@ const e = document.querySelectorAll(".ab-slideup");

}
} else if (n && !e.nn(T.qi)) {
} else if (n && !e.nn(T.eh)) {
const e = t;
s.contentWindow.addEventListener("keydown", function(t) {
t.keyCode === at.Vi && e.closeMessage();
t.keyCode === at.ih && e.closeMessage();
});

@@ -176,2 +176,5 @@ }

},
(e, s) => {
r.D.info(e), i.di(t.triggerId, s);
},
e.nn(T.lo),

@@ -181,3 +184,3 @@ e.nn(T.no),

);
return (n || l) && (a.appendChild(m), t.Yi(a)), !0;
return (n || l) && (a.appendChild(m), t.th(a)), !0;
}
import e, { OPTIONS as T } from "../managers/braze-instance.js";
import ot from "../util/browser-detector.js";
import nr from "./l10n-manager.js";
const je = {
const Ee = {
t: !1,
i: null,
m: () => {
if ((je.o(), !je.i)) {
if ((Ee.o(), !Ee.i)) {
let r = ot.language,
t = !1;
e.nn(T.jn) && ((r = e.nn(T.jn)), (t = !0)), (je.i = new nr(r, t));
e.nn(T.zn) && ((r = e.nn(T.zn)), (t = !0)), (Ee.i = new nr(r, t));
}
return je.i;
return Ee.i;
},
o: () => {
je.t || (e.u(je), (je.t = !0));
Ee.t || (e.u(Ee), (Ee.t = !0));
},
destroy: () => {
(je.i = null), (je.t = !1);
(Ee.i = null), (Ee.t = !1);
}
};
export default je;
export default Ee;

@@ -8,42 +8,42 @@ import { STORAGE_KEYS as o } from "./storage-manager.js";

(this.xn = i || !1),
(this.zn = s),
(this.qn = new u()),
(this.Gn = 0),
(this.Hn = 1);
(this.qn = s),
(this.Gn = new u()),
(this.Hn = 0),
(this.Jn = 1);
}
Jn() {
Kn() {
return this.xn;
}
Kn() {
return this.h.I(o.q.Mn);
Mn() {
return this.h.I(o.q.Qn);
}
setSdkAuthenticationSignature(t) {
const i = this.Kn();
this.h.B(o.q.Mn, t);
const i = this.Mn();
this.h.B(o.q.Qn, t);
const s = r.xt.Ft;
new r.qt(s, r.D).setItem(s.$t.On, this.Hn, t), i !== t && this.Qs();
new r.qt(s, r.D).setItem(s.$t.Vn, this.Jn, t), i !== t && this.Qs();
}
Qn() {
this.h.Xs(o.q.Mn);
Wn() {
this.h.Xs(o.q.Qn);
const t = r.xt.Ft;
new r.qt(t, r.D).br(t.$t.On, this.Hn);
new r.qt(t, r.D).br(t.$t.Vn, this.Jn);
}
subscribeToSdkAuthenticationFailures(t) {
return this.zn.ut(t);
return this.qn.ut(t);
}
Vn(t) {
this.zn.St(t);
Xn(t) {
this.qn.St(t);
}
Wn() {
this.qn.removeAllSubscriptions();
Yn() {
this.Gn.removeAllSubscriptions();
}
Xn() {
this.Gn += 1;
Zn() {
this.Hn += 1;
}
Yn() {
return this.Gn;
au() {
return this.Hn;
}
Qs() {
this.Gn = 0;
this.Hn = 0;
}
}

@@ -24,22 +24,22 @@ import St from "./auth-manager.js";

import { User } from "../User/index.js";
import { parseQueryStringKeyValues as it } from "../util/url-utils.js";
import { parseQueryStringKeyValues as ut } from "../util/url-utils.js";
import { WindowUtils as H } from "../util/window-utils.js";
const T = {
Zn: "allowCrawlerActivity",
ho: "baseUrl",
po: "noCookies",
Eo: "devicePropertyAllowlist",
ho: "allowCrawlerActivity",
po: "baseUrl",
Eo: "noCookies",
_o: "devicePropertyAllowlist",
ta: "disablePushTokenMaintenance",
_o: "enableLogging",
Io: "enableSdkAuthentication",
Io: "enableLogging",
Ao: "enableSdkAuthentication",
ia: "manageServiceWorkerExternally",
Ao: "minimumIntervalBetweenTriggerActionsInSeconds",
So: "sessionTimeoutInSeconds",
No: "appVersion",
So: "minimumIntervalBetweenTriggerActionsInSeconds",
No: "sessionTimeoutInSeconds",
wo: "appVersion",
na: "serviceWorkerLocation",
ra: "safariWebsitePushId",
jn: "localization",
zn: "localization",
ao: "contentSecurityNonce",
wo: "enableHtmlInAppMessages",
To: "allowUserSuppliedJavascript",
To: "enableHtmlInAppMessages",
Oo: "allowUserSuppliedJavascript",
no: "inAppMessageZIndex",

@@ -49,36 +49,36 @@ lo: "openInAppMessagesInNewTab",

en: "openNewsFeedCardsInNewTab",
qi: "requireExplicitInAppMessageDismissal",
Oo: "doNotLoadFontAwesome",
vo: "sdkFlavor"
eh: "requireExplicitInAppMessageDismissal",
vo: "doNotLoadFontAwesome",
Co: "sdkFlavor"
};
class jt {
constructor() {
(this.Co = !1),
(this.Lo = !1),
(this.Po = new u()),
(this.Lo = !1),
(this.Po = !1),
(this.Ro = new u()),
(this.Mo = {}),
(this.jo = []),
(this.Mo = new u()),
(this.jo = {}),
(this.yo = []),
(this.Pe = []),
(this.Do = "4.5.1");
(this.Do = []),
(this.ni = []),
(this.Uo = "4.6.0");
}
Uo(t) {
this.Po.ut(t);
}
Zi(t) {
zo(t) {
this.Ro.ut(t);
}
rh(t) {
this.Mo.ut(t);
}
initialize(t, i) {
if (this.zo())
if (this.Bo())
return (
r.D.info("Braze has already been initialized with an API key."), !0
);
this.Mo = i || {};
let s = this.nn(T._o);
const e = it(H.gn());
this.jo = i || {};
let s = this.nn(T.Io);
const e = ut(H.yn());
if (
(e && "true" === e.brazeLogging && (s = !0),
r.D.init(s),
r.D.info(`Initialization Options: ${JSON.stringify(this.Mo, null, 2)}`),
r.D.info(`Initialization Options: ${JSON.stringify(this.jo, null, 2)}`),
null == t || "" === t || "string" != typeof t)

@@ -88,3 +88,3 @@ )

this._r = t;
let n = this.nn(T.ho);
let n = this.nn(T.po);
if (null == n || "" === n || "string" != typeof n)

@@ -98,28 +98,28 @@ return r.D.error("Braze requires a valid baseUrl to be initialized."), !1;

"/" === n.pathname && (n = `${n}api/v3`),
(this.Bo = n.toString()),
ot.Wo && !this.nn(T.Zn))
(this.Wo = n.toString()),
ot.Fo && !this.nn(T.ho))
)
return (
r.D.info("Ignoring activity from crawler bot " + navigator.userAgent),
(this.Lo = !0),
(this.Po = !0),
!1
);
const h = this.nn(jt.po) || !1;
if (((this.h = Mt.Fo(t, h)), new G.ne(null, !0).lr(o.ae)))
const h = this.nn(jt.Eo) || !1;
if (((this.h = Mt.Vo(t, h)), new G.ne(null, !0).lr(o.ae)))
return (
r.D.info("Ignoring all activity due to previous opt out"),
(this.Lo = !0),
(this.Po = !0),
!1
);
for (const t of rr(this.Mo))
-1 === At(r.Vo).indexOf(t) &&
for (const t of rr(this.jo))
-1 === At(r.Go).indexOf(t) &&
r.D.warn(`Ignoring unknown initialization option '${t}'.`);
const l = ["mparticle", "wordpress", "tealium"];
if (null != this.nn(T.vo)) {
const t = this.nn(T.vo);
if (null != this.nn(T.Co)) {
const t = this.nn(T.Co);
-1 !== l.indexOf(t)
? (this.Go = t)
? (this.Ko = t)
: r.D.error("Invalid sdk flavor passed: " + t);
}
let f = this.nn(r.Vo.Eo);
let f = this.nn(r.Go._o);
if (null != f)

@@ -144,6 +144,6 @@ if (p(f)) {

(this.v = new bt(this.gt, this.h)),
(this.j = new Rt(this.h, this.v, this.gt, this.nn(T.So)));
(this.j = new Rt(this.h, this.v, this.gt, this.nn(T.No)));
const m = new u();
return (
(this.Ko = new St(this.h, this.nn(T.Io), m)),
(this.Ho = new St(this.h, this.nn(T.Ao), m)),
this.jt(m),

@@ -153,3 +153,3 @@ (this.vt = new Ot(

this.h,
this.Ko,
this.Ho,
this.v,

@@ -159,10 +159,10 @@ this.j,

this._r,
this.Bo,
this.Do,
this.Go,
this.nn(T.No)
this.Wo,
this.Uo,
this.Ko,
this.nn(T.wo)
)),
(this.si = new Lt(
this._r,
this.Bo,
this.Wo,
this.j,

@@ -174,5 +174,5 @@ this.Ur,

t => {
if (this.zo()) for (const i of this.re()) i.Rs(t);
if (this.Bo()) for (const i of this.re()) i.Rs(t);
},
this.Ko,
this.Ho,
this.vt

@@ -183,6 +183,6 @@ )),

`Initialized for the Braze backend at "${this.nn(
T.ho
T.po
)}" with API key "${this._r}".`
),
null != this.nn(T.wo) &&
null != this.nn(T.To) &&
D(

@@ -194,4 +194,4 @@ "enableHtmlInAppMessages",

W.init(),
this.gt.Te(() => {
this.gt.ye() &&
this.gt.qe(() => {
this.gt._e() &&
import("../FeatureFlags/refresh-feature-flags.js").then(t => {

@@ -202,3 +202,3 @@ (0, t.default)();

this.si.cr(() => {
this.gt.ye() &&
this.gt._e() &&
import("../FeatureFlags/refresh-feature-flags.js").then(t => {

@@ -208,4 +208,4 @@ (0, t.default)(null, null, !0);

}),
this.Po.St(this.Mo),
(this.Co = !0),
this.Ro.St(this.jo),
(this.Lo = !0),
!0

@@ -215,13 +215,13 @@ );

destroy(t) {
if ((r.D.destroy(), this.zo())) {
this.Ro.St(), this.Ro.removeAllSubscriptions();
for (const t of this.jo) t.destroy();
this.jo = [];
for (const t of this.yo) t.clearData(!1);
(this.yo = []),
if ((r.D.destroy(), this.Bo())) {
this.Mo.St(), this.Mo.removeAllSubscriptions();
for (const t of this.yo) t.destroy();
this.yo = [];
for (const t of this.Do) t.clearData(!1);
(this.Do = []),
this.removeAllSubscriptions(),
(this.Pe = []),
(this.ni = []),
this.si.destroy(),
(this.si = null),
(this.Ko = null),
(this.Ho = null),
(this.Ur = null),

@@ -232,6 +232,6 @@ (this.vt = null),

(this.v = null),
(this.Mo = {}),
(this.Go = void 0),
(this.Co = !1),
(this.jo = {}),
(this.Ko = void 0),
(this.Lo = !1),
(this.Po = !1),
t && (this.h = null);

@@ -241,4 +241,4 @@ }

rr() {
if (this.Ho()) return !1;
if (!this.zo())
if (this.$o()) return !1;
if (!this.Bo())
throw new Error("Braze must be initialized before calling methods.");

@@ -251,6 +251,6 @@ return !0;

ii() {
return this.Ko;
return this.Ho;
}
Ks() {
return this.Bo;
return this.Wo;
}

@@ -264,6 +264,6 @@ ce() {

nn(t) {
return this.Mo[t];
return this.jo[t];
}
re() {
return this.yo;
return this.Do;
}

@@ -289,34 +289,34 @@ mr() {

tr() {
return !0 === this.nn(T.To) || !0 === this.nn(T.wo);
return !0 === this.nn(T.Oo) || !0 === this.nn(T.To);
}
u(t) {
let i = !1;
for (const s of this.jo) s === t && (i = !0);
i || this.jo.push(t);
for (const s of this.yo) s === t && (i = !0);
i || this.yo.push(t);
}
ar(t) {
let i = !1;
for (const s of this.yo) s.constructor === t.constructor && (i = !0);
t instanceof y && !i && this.yo.push(t);
for (const s of this.Do) s.constructor === t.constructor && (i = !0);
t instanceof y && !i && this.Do.push(t);
}
jt(t) {
t instanceof u && this.Pe.push(t);
t instanceof u && this.ni.push(t);
}
removeAllSubscriptions() {
if (this.rr()) for (const t of this.Pe) t.removeAllSubscriptions();
if (this.rr()) for (const t of this.ni) t.removeAllSubscriptions();
}
removeSubscription(t) {
if (this.rr()) for (const i of this.Pe) i.removeSubscription(t);
if (this.rr()) for (const i of this.ni) i.removeSubscription(t);
}
le(t) {
this.Lo = t;
this.Po = t;
}
zo() {
return this.Co;
}
Ho() {
Bo() {
return this.Lo;
}
$o() {
return this.Po;
}
Ds() {
return this.Do;
return this.Uo;
}

@@ -323,0 +323,0 @@ }

@@ -64,5 +64,5 @@ import ot from "../util/browser-detector.js";

const t = e.getTimezoneOffset();
return this.$o(t);
return this.sa(t);
}
$o(e) {
sa(e) {
const t = parseInt(e / 60),

@@ -69,0 +69,0 @@ r = parseInt(e % 60);

@@ -15,3 +15,3 @@ import qt from "../models/backend-errors.js";

(this.h = e),
(this.Ko = s),
(this.Ho = s),
(this.v = i),

@@ -21,11 +21,11 @@ (this.j = r),

(this._r = n),
(this.Bo = a),
(this.Do = u),
(this.Go = h),
(this.sa = c),
(this.oa = ["npm"]);
(this.Wo = a),
(this.Uo = u),
(this.Ko = h),
(this.oa = c),
(this.ua = ["npm"]);
}
Ps(t, e) {
const s = this.Ur.te(),
i = s.Mi(),
i = s.Si(),
r = this.h.I(o.q.Yo);

@@ -35,11 +35,11 @@ ii(r, i) || (t.device = i),

(t.time = l(new Date().valueOf(), !0));
const n = this.h.I(o.q.ua) || [],
a = this.h.I(o.q.ha) || "";
const n = this.h.I(o.q.ha) || [],
a = this.h.I(o.q.ca) || "";
if (
(this.oa.length > 0 &&
(!ii(n, this.oa) || a !== this.j.ca()) &&
(t.sdk_metadata = this.oa),
(t.sdk_version = this.Do),
this.Go && (t.sdk_flavor = this.Go),
(t.app_version = this.sa),
(this.ua.length > 0 &&
(!ii(n, this.ua) || a !== this.j.la()) &&
(t.sdk_metadata = this.ua),
(t.sdk_version = this.Uo),
this.Ko && (t.sdk_flavor = this.Ko),
(t.app_version = this.oa),
(t.device_id = s.id),

@@ -59,3 +59,3 @@ e)

let e;
this.Ko.Xn();
this.Ho.Zn();
const s = { errorCode: o.error_code };

@@ -72,8 +72,8 @@ for (const t of i)

: (e = `with error code ${o.error_code}.`),
this.Ko.Jn() ||
this.Ho.Kn() ||
(e +=
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
r.D.error(`SDK Authentication failed ${e}`),
this.la(t.events, t.attributes),
this.Ko.Vn(s),
this.fa(t.events, t.attributes),
this.Ho.Xn(s),
!1

@@ -85,16 +85,16 @@ );

switch (i) {
case qt.fa:
case qt.ma:
const o = "Received successful response with empty body.";
return s.G(r.A.qs, { e: o }), r.D.info(o), !1;
case qt.ma:
case qt.pa:
const n = "Received successful response with invalid JSON";
return s.G(r.A.qs, { e: n + ": " + e.response }), r.D.info(n), !1;
case qt.pa:
i = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Bo}`;
case qt.Ra:
i = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Wo}`;
break;
case qt.Ra:
case qt.ba:
i =
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
break;
case qt.ba:
case qt.ga:
i = "No device identifier. Please contact support@braze.com";

@@ -106,6 +106,6 @@ }

}
ga(t, e, s, i) {
qa(t, e, s, i) {
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i);
}
qa(t, e, s, i) {
Aa(t, e, s, i) {
const r = [],

@@ -118,7 +118,7 @@ o = t => t || "",

c,
l = this.Ai(t, e);
l = this.wi(t, e);
if (s.length > 0) {
const t = [];
for (const e of s) {
if (((a = e.Mi()), this.Ko.Jn())) {
if (((a = e.Si()), this.Ho.Kn())) {
if (n && !a.user_id) {

@@ -140,3 +140,3 @@ c || ((c = {}), (c.events = [])), c.events.push(a);

for (const e of i)
this.Ko.Jn() && o(e.user_id) !== n
this.Ho.Kn() && o(e.user_id) !== n
? (h || (h = []), h.push(e))

@@ -146,3 +146,3 @@ : t.push(e);

}
if ((this.la(u, h), (l = this.Ps(l, !0)), c)) {
if ((this.fa(u, h), (l = this.Ps(l, !0)), c)) {
c = this.Ps(c, !1);

@@ -152,7 +152,7 @@ const t = { requestData: c, headers: this.Bs(c) };

}
if (l && !this.ga(l.events, l.attributes, t, e)) return c ? r : null;
if (l && !this.qa(l.events, l.attributes, t, e)) return c ? r : null;
const f = { requestData: l, headers: this.Bs(l) };
return r.push(f), r;
}
la(t, e) {
fa(t, e) {
if (t) {

@@ -166,3 +166,3 @@ const e = [];

}
if (e) for (const t of e) this.h.Aa(t);
if (e) for (const t of e) this.h.za(t);
}

@@ -173,6 +173,6 @@ Vs(t, e) {

}
yr(t) {
return s.G(r.A.za, { n: t });
Fr(t) {
return s.G(r.A.Ba, { n: t });
}
Ai(t, e, s) {
wi(t, e, s) {
const i = {};

@@ -208,5 +208,5 @@ t && (i.feed = !0), e && (i.triggers = !0);

n && r.push(["X-Braze-DataRequest", "true"]),
this.Ko.Jn())
this.Ho.Kn())
) {
const t = this.Ko.Kn();
const t = this.Ho.Mn();
null != t && r.push(["X-Braze-Auth-Signature", t]);

@@ -225,10 +225,10 @@ }

Qs() {
this.Ko.Qs();
this.Ho.Qs();
}
Ks() {
return this.Bo;
return this.Wo;
}
addSdkMetadata(t) {
for (const e of t) -1 === this.oa.indexOf(e) && this.oa.push(e);
for (const e of t) -1 === this.ua.indexOf(e) && this.ua.push(e);
}
}

@@ -17,3 +17,3 @@ import { STORAGE_KEYS as o } from "./storage-manager.js";

const t = this.h.I(o.q.ol);
this.rl = null != t ? Ft.Sn(t) : new Ft();
this.rl = null != t ? Ft.jn(t) : new Ft();
}

@@ -40,7 +40,7 @@ return this.rl;

let s = !1;
null != t.gl && this.wn() !== t.gl && (s = !0);
null != t.gl && this.vn() !== t.gl && (s = !0);
let i = !1;
null != t.ml.enabled && this.Ys() !== t.ml.enabled && (i = !0);
let r = !1;
null != t.cl.enabled && this.ye() !== t.cl.enabled && (r = !0),
null != t.cl.enabled && this._e() !== t.cl.enabled && (r = !0),
(this.rl = t),

@@ -54,3 +54,3 @@ this.h.B(o.q.ol, t.ss()),

}
yn(t) {
kn(t) {
let e = this.tl.ut(t);

@@ -62,3 +62,3 @@ return this.fl && this.tl.removeSubscription(this.fl), (this.fl = e), e;

}
Te(t) {
qe(t) {
return this.il.ut(t);

@@ -78,3 +78,3 @@ }

}
wn() {
vn() {
return this.hl().gl;

@@ -85,10 +85,10 @@ }

}
ye() {
return this.hl().cl.enabled && null == this.$e()
_e() {
return this.hl().cl.enabled && null == this.Be()
? (s.G(r.A.qs, { e: "Missing feature flag refresh_rate_limit." }), !1)
: this.hl().cl.enabled || !1;
}
$e() {
Be() {
return this.hl().cl.refresh_rate_limit;
}
}

@@ -11,6 +11,6 @@ import { STORAGE_KEYS as o } from "../managers/storage-manager.js";

(this.gt = e),
(this.uh = 1e3),
(this.dh = 1e3),
(i = parseFloat(i)),
isNaN(i) && (i = 1800),
i < this.uh / 1e3 &&
i < this.dh / 1e3 &&
(r.D.info(

@@ -20,36 +20,36 @@ "Specified session timeout of " +

"s is too small, using the minimum session timeout of " +
this.uh / 1e3 +
this.dh / 1e3 +
"s instead."
),
(i = this.uh / 1e3)),
(this.ah = i);
(i = this.dh / 1e3)),
(this.fh = i);
}
mh(s, t) {
return new ue(this.v.getUserId(), r.A.dh, s, t.iu, { d: l(s - t.fh) });
ph(s, t) {
return new ue(this.v.getUserId(), r.A.gh, s, t.iu, { d: l(s - t.wh) });
}
ca() {
const s = this.h.tu(o.eu.ph);
la() {
const s = this.h.tu(o.eu.Sh);
return null == s ? null : s.iu;
}
gh() {
jh() {
const s = new Date().valueOf(),
t = this.gt.wl(),
e = this.h.I(o.q.wh);
e = this.h.I(o.q.bh);
if (null != e && null == t) return !1;
const i = null == e || s - e > 1e3 * t;
return i && this.h.B(o.q.wh, s), i;
return i && this.h.B(o.q.bh, s), i;
}
Sh(s, t) {
return null == t || (!(s - t.fh < this.uh) && t.jh < s);
xh(s, t) {
return null == t || (!(s - t.wh < this.dh) && t.Dh < s);
}
mo() {
const s = new Date().valueOf(),
t = s + 1e3 * this.ah,
e = this.h.tu(o.eu.ph);
if (this.Sh(s, e)) {
t = s + 1e3 * this.fh,
e = this.h.tu(o.eu.Sh);
if (this.xh(s, e)) {
let i = "Generating session start event with time " + s;
if (null != e) {
let s = e.bh;
s - e.fh < this.uh && (s = e.fh + this.xh),
this.h.Dh(this.mh(s, e)),
let s = e.Ch;
s - e.wh < this.dh && (s = e.wh + this.Gh),
this.h.Nh(this.ph(s, e)),
(i += " (old session ended " + s + ")");

@@ -59,13 +59,13 @@ }

const n = new _t(r.it.nt(), t);
this.h.Dh(new ue(this.v.getUserId(), r.A.Ch, s, n.iu)),
this.h.ru(o.eu.ph, n);
return null == this.h.I(o.q.wh) && this.h.B(o.q.wh, s), n.iu;
this.h.Nh(new ue(this.v.getUserId(), r.A._h, s, n.iu)),
this.h.ru(o.eu.Sh, n);
return null == this.h.I(o.q.bh) && this.h.B(o.q.bh, s), n.iu;
}
return (e.bh = s), (e.jh = t), this.h.ru(o.eu.ph, e), e.iu;
return (e.Ch = s), (e.Dh = t), this.h.ru(o.eu.Sh, e), e.iu;
}
Gh() {
const s = this.h.tu(o.eu.ph);
Fh() {
const s = this.h.tu(o.eu.Sh);
null != s &&
(this.h.Nh(o.eu.ph), this.h.Dh(this.mh(new Date().valueOf(), s)));
(this.h.Hh(o.eu.Sh), this.h.Nh(this.ph(new Date().valueOf(), s)));
}
}
import G, { STORAGE_KEYS as o } from "./storage-manager.js";
import r from "../../shared-lib/braze-shared-lib.js";
const Mt = {
Fo: (e, t) => {
Vo: (e, t) => {
let a = !1;

@@ -6,0 +6,0 @@ try {

@@ -16,3 +16,3 @@ import ot from "../util/browser-detector.js";

Jo: "ab.storage.deviceId",
ph: "ab.storage.sessionId"
Sh: "ab.storage.sessionId"
},

@@ -25,5 +25,5 @@ q: {

Yo: "ab.storage.device",
ua: "ab.storage.sdk_metadata",
ha: "ab.storage.session_id_for_cached_metadata",
Pn: "ab.storage.pushToken",
ha: "ab.storage.sdk_metadata",
ca: "ab.storage.session_id_for_cached_metadata",
Sn: "ab.storage.pushToken",
ei: "ab.storage.newsFeed",

@@ -35,3 +35,3 @@ hi: "ab.storage.lastNewsFeedRefresh",

Da: "ab.storage.triggers.ts",
wh: "ab.storage.messagingSessionStart",
bh: "ab.storage.messagingSessionStart",
Yt: "ab.storage.cc",

@@ -46,7 +46,7 @@ vs: "ab.storage.ccLastFullSync",

va: "ab.storage.triggerFireInstancesById",
Mn: "ab.storage.signature",
Qn: "ab.storage.signature",
As: "ab.storage.brazeSyncRetryCount",
_s: "ab.storage.sdkVersion",
ze: "ab.storage.ff",
qe: "ab.storage.ffLastRefreshAt"
Ce: "ab.storage.ffLastRefreshAt"
},

@@ -65,8 +65,8 @@ ae: "ab.optOut"

const e = this.tu(t);
null != e && ((e.bh = new Date().valueOf()), this.ru(t, e));
null != e && ((e.Ch = new Date().valueOf()), this.ru(t, e));
}
tu(t) {
return _t.Sn(this.Ma.lr(t));
return _t.jn(this.Ma.lr(t));
}
Nh(t) {
Hh(t) {
this.Ma.remove(t);

@@ -82,3 +82,3 @@ }

}
Dh(t) {
Nh(t) {
return null != t && this.bo([t]);

@@ -94,3 +94,3 @@ }

for (let s = 0; s < t.length; s++)
ue.Fa(t[s]) ? e.push(ue.Sn(t[s])) : (o = s);
ue.Fa(t[s]) ? e.push(ue.jn(t[s])) : (o = s);
else s = !0;

@@ -157,10 +157,10 @@ if (s || null != o) {

}
Aa(t) {
za(t) {
let e = this.Ca.lr(STORAGE_KEYS.q.Ia);
null == e && (e = {});
const s = this.La(t[User.Rn]);
const s = this.La(t[User.On]);
for (let r in t)
r === User.Rn ||
r === User.On ||
(null != e[s] && null != e[s][r]) ||
this.mu(t[User.Rn], r, t[r]);
this.mu(t[User.On], r, t[r]);
}

@@ -173,3 +173,3 @@ mu(t, e, s) {

if (
(null == n && ((n = {}), null != t && (n[User.Rn] = t)), e === User.lu)
(null == n && ((n = {}), null != t && (n[User.On] = t)), e === User.lu)
) {

@@ -181,3 +181,3 @@ null == n[e] && (n[e] = {});

}
Ba() {
Pa() {
const t = this.Ca.lr(STORAGE_KEYS.q.Ia);

@@ -197,6 +197,6 @@ this.Ca.remove(STORAGE_KEYS.q.Ia);

this.Ca.store(STORAGE_KEYS.q.Ia, e),
(r[User.Rn] = t),
this.Aa(r));
(r[User.On] = t),
this.za(r));
}
const s = this.tu(STORAGE_KEYS.eu.ph);
const s = this.tu(STORAGE_KEYS.eu.Sh);
let r = null;

@@ -208,7 +208,7 @@ null != s && (r = s.iu);

const s = o[e];
null == s.userId && s.sessionId == r && (s.userId = t), this.Dh(s);
null == s.userId && s.sessionId == r && (s.userId = t), this.Nh(s);
}
}
Pa() {
return this.Ca.xa;
xa() {
return this.Ca.Ja;
}

@@ -218,5 +218,5 @@ }

constructor(t) {
(this._r = t), (this.xa = ot.Ja() ? 3 : 10);
(this._r = t), (this.Ja = ot.ka() ? 3 : 10);
}
ka(t) {
Va(t) {
return t + "." + this._r;

@@ -227,3 +227,3 @@ }

try {
return localStorage.setItem(this.ka(t), JSON.stringify(s)), !0;
return localStorage.setItem(this.Va(t), JSON.stringify(s)), !0;
} catch (t) {

@@ -235,3 +235,3 @@ return r.D.info("Storage failure: " + t.message), !1;

try {
const e = JSON.parse(localStorage.getItem(this.ka(t)));
const e = JSON.parse(localStorage.getItem(this.Va(t)));
return null == e ? null : e.v;

@@ -244,3 +244,3 @@ } catch (t) {

try {
localStorage.removeItem(this.ka(t));
localStorage.removeItem(this.Va(t));
} catch (t) {

@@ -253,8 +253,8 @@ return r.D.info("Storage removal failure: " + t.message), !1;

constructor(t, e) {
(this._r = t), (this.Va = this.Qa()), (this.Ha = 576e3), (this.Wa = !!e);
(this._r = t), (this.Qa = this.Ha()), (this.Wa = 576e3), (this.Xa = !!e);
}
ka(t) {
Va(t) {
return null != this._r ? t + "." + this._r : t;
}
Qa() {
Ha() {
let t = 0,

@@ -276,5 +276,5 @@ e = document.location.hostname;

const t = new Date();
return t.setTime(t.getTime() + 60 * this.Ha * 1e3), t.getFullYear();
return t.setTime(t.getTime() + 60 * this.Wa * 1e3), t.getFullYear();
}
Xa() {
Za() {
const t = At(STORAGE_KEYS.eu),

@@ -293,3 +293,3 @@ e = document.cookie.split(";");

const t = r.split("=")[0];
-1 === t.indexOf("." + this._r) && this.Za(t);
-1 === t.indexOf("." + this._r) && this.$a(t);
}

@@ -299,10 +299,10 @@ }

store(t, e) {
this.Xa();
this.Za();
const s = new Date();
s.setTime(s.getTime() + 60 * this.Ha * 1e3);
s.setTime(s.getTime() + 60 * this.Wa * 1e3);
const o = "expires=" + s.toUTCString(),
n = "domain=" + this.Va;
n = "domain=" + this.Qa;
let i;
i = this.Wa ? e : encodeURIComponent(JSON.stringify(e));
const a = this.ka(t) + "=" + i + ";" + o + ";" + n + ";path=/";
i = this.Xa ? e : encodeURIComponent(JSON.stringify(e));
const a = this.Va(t) + "=" + i + ";" + o + ";" + n + ";path=/";
return a.length >= 4093

@@ -319,3 +319,3 @@ ? (r.D.info(

const e = [],
s = this.ka(t) + "=",
s = this.Va(t) + "=",
o = document.cookie.split(";");

@@ -328,3 +328,3 @@ for (let n = 0; n < o.length; n++) {

let t;
(t = this.Wa
(t = this.Xa
? i.substring(s.length, i.length)

@@ -344,8 +344,8 @@ : JSON.parse(decodeURIComponent(i.substring(s.length, i.length)))),

remove(t) {
this.Za(this.ka(t));
this.$a(this.Va(t));
}
Za(t) {
$a(t) {
const e = t + "=;expires=" + new Date(0).toGMTString();
(document.cookie = e), (document.cookie = e + ";path=/");
const s = e + ";domain=" + this.Va;
const s = e + ";domain=" + this.Qa;
(document.cookie = s), (document.cookie = s + ";path=/");

@@ -356,8 +356,8 @@ }

constructor() {
(this.$a = {}), (this.El = 5242880), (this.xa = 3);
(this.El = {}), (this.Sl = 5242880), (this.Ja = 3);
}
store(t, e) {
const s = { value: e },
o = this.Sl(e);
return o > this.El
o = this._l(e);
return o > this.Sl
? (r.D.info(

@@ -367,8 +367,8 @@ "Storage failure: object is ≈" +

" bytes which is greater than the max of " +
this.El
this.Sl
),
!1)
: ((this.$a[t] = s), !0);
: ((this.El[t] = s), !0);
}
Sl(t) {
_l(t) {
const e = [],

@@ -390,7 +390,7 @@ s = [t];

lr(t) {
const e = this.$a[t];
const e = this.El[t];
return null == e ? null : e.value;
}
remove(t) {
this.$a[t] = null;
this.El[t] = null;
}

@@ -400,15 +400,15 @@ };

constructor(t, e, s) {
(this._l = []),
e && this._l.push(new G.ne(t)),
s && this._l.push(new G._a(t)),
this._l.push(new G.Oa(t));
(this.Tl = []),
e && this.Tl.push(new G.ne(t)),
s && this.Tl.push(new G._a(t)),
this.Tl.push(new G.Oa(t));
}
store(t, e) {
let s = !0;
for (let r = 0; r < this._l.length; r++) s = this._l[r].store(t, e) && s;
for (let r = 0; r < this.Tl.length; r++) s = this.Tl[r].store(t, e) && s;
return s;
}
lr(t) {
for (let e = 0; e < this._l.length; e++) {
const s = this._l[e].lr(t);
for (let e = 0; e < this.Tl.length; e++) {
const s = this.Tl[e].lr(t);
if (null != s) return s;

@@ -419,4 +419,4 @@ }

remove(t) {
for (let e = 0; e < this._l.length; e++) this._l[e].remove(t);
for (let e = 0; e < this.Tl.length; e++) this.Tl[e].remove(t);
}
};
import r from "../../shared-lib/braze-shared-lib.js";
export default class u {
constructor() {
this.Pe = {};
this.ni = {};
}

@@ -9,18 +9,18 @@ ut(t) {

const i = r.it.nt();
return (this.Pe[i] = t), i;
return (this.ni[i] = t), i;
}
removeSubscription(t) {
delete this.Pe[t];
delete this.ni[t];
}
removeAllSubscriptions() {
this.Pe = {};
this.ni = {};
}
bu() {
return Object.keys(this.Pe).length;
return Object.keys(this.ni).length;
}
St(t) {
const i = [];
for (let r in this.Pe) i.push(this.Pe[r](t));
for (let r in this.ni) i.push(this.ni[r](t));
return i;
}
}
export default {
pa: "invalid_api_key",
Ra: "blacklisted",
ba: "no_device_identifier",
ma: "invalid_json_response",
fa: "empty_response",
Ra: "invalid_api_key",
ba: "blacklisted",
ga: "no_device_identifier",
pa: "invalid_json_response",
ma: "empty_response",
__: "sdk_auth_error"
};

@@ -14,3 +14,3 @@ import { isObject as Jt } from "../util/code-utils.js";

}
Mi() {
Si() {
const t = {

@@ -39,5 +39,5 @@ name: this.type,

}
static Sn(t) {
static jn(t) {
return new ue(t.u, t.t, t.ts, t.s, t.d);
}
}

@@ -6,3 +6,3 @@ import DeviceProperties from "../Core/device-properties.js";

}
Mi() {
Si() {
const s = {};

@@ -9,0 +9,0 @@ return (

@@ -8,14 +8,14 @@ import r from "../../shared-lib/braze-shared-lib.js";

(this.iu = t),
(this.fh = s),
(this.bh = new Date().valueOf()),
(this.jh = e);
(this.wh = s),
(this.Ch = new Date().valueOf()),
(this.Dh = e);
}
ss() {
return { g: this.iu, e: this.jh, c: this.fh, l: this.bh };
return { g: this.iu, e: this.Dh, c: this.wh, l: this.Ch };
}
static Sn(t) {
static jn(t) {
if (null == t || null == t.g) return null;
const e = new _t(t.g, t.e, t.c);
return (e.bh = t.l), e;
return (e.Ch = t.l), e;
}
}

@@ -5,3 +5,3 @@ import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";

(this.endpoint = t || null),
(this.Dn = i || null),
(this._n = i || null),
(this.publicKey = l || null),

@@ -14,3 +14,3 @@ (this.zl = s || null),

e: this.endpoint,
c: this.Dn,
c: this._n,
p: this.publicKey,

@@ -21,5 +21,5 @@ u: this.zl,

}
static Sn(t) {
static jn(t) {
return new ei(t.e, w(t.c), t.p, t.u, t.v);
}
}

@@ -15,3 +15,3 @@ export default class Ft {

return {
s: "4.5.1",
s: "4.6.0",
l: this.ul,

@@ -27,8 +27,8 @@ e: this.bl,

}
static Sn(t) {
static jn(t) {
let s = t.l;
return (
"4.5.1" !== t.s && (s = 0), new Ft(s, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
"4.6.0" !== t.s && (s = 0), new Ft(s, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
);
}
}

@@ -18,15 +18,15 @@ import { isArray as p, isEqual as ii } from "../util/code-utils.js";

(this.Vr = u || !1),
(this.Er = a || !1),
(this.Or = a || !1),
(this.h = h),
(this.Or = dt.Br()),
(this.Mr = dt.Yr());
(this.Mr = dt.Yr()),
(this.Gr = dt.Hr());
}
Gr() {
return this.Er;
Jr() {
return this.Or;
}
Hr(i, e, t, s, n) {
Kr(i, e, t, s, n) {
i.unsubscribe()
.then(i => {
i
? this.Jr(e, t, s, n)
? this.Lr(e, t, s, n)
: (r.D.error("Failed to unsubscribe device from push."),

@@ -40,3 +40,3 @@ "function" == typeof n && n(!1));

}
Kr(i, e, t) {
Qr(i, e, t) {
const s = (i => {

@@ -48,5 +48,5 @@ if ("string" == typeof i) return i;

return (
i.Lr &&
-1 === i.endpoint.indexOf(i.Lr) &&
(e = i.endpoint + "/" + i.Lr),
i.Xr &&
-1 === i.endpoint.indexOf(i.Xr) &&
(e = i.endpoint + "/" + i.Xr),
e

@@ -79,11 +79,11 @@ );

})(i);
this.Sr.Qr(s, t, r, n, o), s && "function" == typeof e && e(s, r, n);
this.Sr.Zr(s, t, r, n, o), s && "function" == typeof e && e(s, r, n);
}
Xr() {
this.Sr.Zr(!0);
hn() {
this.Sr.fn(!0);
}
hn(i, e) {
this.Sr.Zr(!1), r.D.info(i), "function" == typeof e && e(!1);
dn(i, e) {
this.Sr.fn(!1), r.D.info(i), "function" == typeof e && e(!1);
}
fn(i, e, t, s) {
pn(i, e, t, s) {
if ("default" === e.permission)

@@ -100,11 +100,11 @@ try {

),
this.fn(i, e, t, s);
this.pn(i, e, t, s);
}
);
} catch (i) {
this.hn("Could not request permission for push: " + i, s);
this.dn("Could not request permission for push: " + i, s);
}
else
"denied" === e.permission
? this.hn(
? this.dn(
"The user has blocked notifications from this site, or Safari push is not configured in the Braze dashboard.",

@@ -115,5 +115,5 @@ s

(r.D.info("Device successfully subscribed to push."),
this.Kr(e.deviceToken, t, new Date()));
this.Qr(e.deviceToken, t, new Date()));
}
dn(i, e, t) {
bn(i, e, t) {
const s = s => {

@@ -141,3 +141,3 @@ switch (s) {

}
Jr(i, e, t, s) {
Lr(i, e, t, s) {
const n = { userVisibleOnly: !0 };

@@ -149,3 +149,3 @@ null != e && (n.applicationServerKey = e),

r.D.info("Device successfully subscribed to push."),
this.Kr(i, t, new Date());
this.Qr(i, t, new Date());
})

@@ -159,3 +159,3 @@ .catch(i => {

}
pn() {
gn() {
return this.Vr

@@ -176,3 +176,3 @@ ? navigator.serviceWorker.getRegistration()

}
bn(i) {
wn(i) {
this.Vr ||

@@ -183,3 +183,3 @@ (i.unregister(), r.D.info("Service worker successfully unregistered."));

if (dt.isPushSupported()) {
if (this.Or) {
if (this.Mr) {
if (!this.Vr && null != window.location) {

@@ -192,3 +192,3 @@ let i = this.Nr;

const e = i.substr(0, i.lastIndexOf("/") + 1);
if (0 !== H.gn().indexOf(e))
if (0 !== H.yn().indexOf(e))
return void r.D.error(

@@ -203,7 +203,7 @@ "Cannot subscribe to push from a path higher than the service worker location (tried to subscribe from " +

if (dt.isPushBlocked())
return void this.hn(
return void this.dn(
"Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
e
);
if (this.gt && !this.gt.wn() && 0 === this.gt.Zs())
if (this.gt && !this.gt.vn() && 0 === this.gt.Zs())
return (

@@ -213,3 +213,3 @@ r.D.info(

),
void this.gt.yn(() => {
void this.gt.kn(() => {
this.subscribe(i, e);

@@ -236,3 +236,3 @@ })

),
this.pn()
this.gn()
.then(t => {

@@ -252,4 +252,4 @@ if (null == t)

(this.gt &&
null != this.gt.wn() &&
(n = r.kn.vn(this.gt.wn())),
null != this.gt.vn() &&
(n = r.Dn.Pn(this.gt.vn())),
s)

@@ -259,7 +259,7 @@ ) {

a = null;
const h = this.h.I(o.q.Pn);
const h = this.h.I(o.q.Sn);
if (h && !p(h)) {
let i;
try {
i = ei.Sn(h).Dn;
i = ei.jn(h)._n;
} catch (e) {

@@ -288,3 +288,3 @@ i = null;

),
this.Hr(s, t, n, i, e))
this.Kr(s, t, n, i, e))
: s.expirationTime &&

@@ -295,5 +295,5 @@ new Date(s.expirationTime) <= new Date().valueOf()

),
this.Hr(s, t, n, i, e))
this.Kr(s, t, n, i, e))
: h && p(h)
? this.Hr(s, t, n, i, e)
? this.Kr(s, t, n, i, e)
: null == a

@@ -303,3 +303,3 @@ ? (r.D.info(

),
this.Hr(s, t, n, i, e))
this.Kr(s, t, n, i, e))
: a <= new Date().valueOf()

@@ -309,8 +309,8 @@ ? (r.D.info(

),
this.Hr(s, t, n, i, e))
this.Kr(s, t, n, i, e))
: (r.D.info(
"Device already subscribed to push, sending existing subscription to backend."
),
this.Kr(s, i, u));
} else this.Jr(t, n, i, e);
this.Qr(s, i, u));
} else this.Lr(t, n, i, e);
})

@@ -327,4 +327,4 @@ .catch(i => {

};
this.dn(u, s, t);
} else if (this.Mr) {
this.bn(u, s, t);
} else if (this.Gr) {
if (null == this.Ir || "" === this.Ir)

@@ -335,9 +335,9 @@ return void r.D.error(

const t = window.safari.pushNotification.permission(this.Ir);
this.fn(this.Ir, t, i, e);
this.pn(this.Ir, t, i, e);
}
} else r.D.info(this._n);
} else r.D.info(this.An);
}
unsubscribe(i, e) {
dt.isPushSupported()
? this.Or
? this.Mr
? navigator.serviceWorker.getRegistration().then(t => {

@@ -349,3 +349,3 @@ t

s &&
(this.Xr(),
(this.hn(),
s

@@ -363,3 +363,3 @@ .unsubscribe()

"function" == typeof e && e()),
this.bn(t);
this.wn(t);
})

@@ -378,9 +378,9 @@ .catch(i => {

})
: this.Mr &&
(this.Xr(),
: this.Gr &&
(this.hn(),
r.D.info("Device unsubscribed from push."),
"function" == typeof i && i())
: r.D.info(this._n);
: r.D.info(this.An);
}
}
aa._n = "Push notifications are not supported in this browser.";
aa.An = "Push notifications are not supported in this browser.";
const dt = {
Br: () =>
Yr: () =>
"serviceWorker" in navigator &&

@@ -7,3 +7,3 @@ "undefined" != typeof ServiceWorkerRegistration &&

"PushManager" in window,
Yr: () =>
Hr: () =>
"safari" in window &&

@@ -13,3 +13,3 @@ "pushNotification" in window.safari &&

"function" == typeof window.safari.pushNotification.requestPermission,
isPushSupported: () => dt.Br() || dt.Yr(),
isPushSupported: () => dt.Yr() || dt.Hr(),
isPushBlocked: () => {

@@ -33,5 +33,5 @@ const i =

"granted" === window.Notification.permission,
ji: () =>
Ti: () =>
!dt.isPushBlocked() && dt.isPushSupported() && !dt.isPushPermissionGranted()
};
export default dt;
import b from "./util/net.js";
import ue from "./models/braze-event.js";
import s from "./common/event-logger.js";
import { randomInclusive as pt } from "./util/math.js";
import { randomInclusive as tt } from "./util/math.js";
import t from "./models/request-result.js";

@@ -13,5 +13,5 @@ import r from "../shared-lib/braze-shared-lib.js";

(this._r = t),
(this.Bo = s),
(this.Wo = s),
(this.kl = 0),
(this.yl = h.Pa()),
(this.yl = h.xa()),
(this.jl = null),

@@ -23,13 +23,13 @@ (this.j = i),

(this.h = h),
(this.Ko = r),
(this.Ho = r),
(this.vt = a),
(this.$l = o),
(this.Al = new u()),
(this.Tl = 50);
(this.ql = 50);
}
ql(t, s) {
return !t && !s && this.Ko.Yn() >= this.Tl;
Fl(t, s) {
return !t && !s && this.Ho.au() >= this.ql;
}
Fl(t) {
let s = this.j.gh();
Dl(t) {
let s = this.j.jh();
if (t.length > 0) {

@@ -39,3 +39,3 @@ const i = this.v.getUserId();

const t = (!e.userId && !i) || e.userId === i;
e.type === r.A.Ch && t && (s = !0);
e.type === r.A._h && t && (s = !0);
}

@@ -45,6 +45,6 @@ }

}
Dl(t, s, i, e, n, l, h) {
null == i && (i = !0), i && this.Ll();
Ll(t, s, i, e, n, l, h) {
null == i && (i = !0), i && this.Pl();
const u = this.h.Ua(),
a = this.h.Ba();
a = this.h.Pa();
let c = !1;

@@ -54,3 +54,3 @@ const d = (t, s) => {

b.Hs({
url: this.Bo + "/data/",
url: this.Wo + "/data/",
data: t,

@@ -63,3 +63,3 @@ headers: s,

this.vt.Os(t, i, s)
? (this.Ko.Qs(),
? (this.Ho.Qs(),
this.gt.al(i),

@@ -70,4 +70,4 @@ (null != t.respond_with &&

null != t.sdk_metadata &&
(this.h.B(o.q.ua, t.sdk_metadata),
this.h.B(o.q.ha, this.j.ca())),
(this.h.B(o.q.ha, t.sdk_metadata),
this.h.B(o.q.ca, this.j.la())),
this.$l(i),

@@ -81,6 +81,6 @@ "function" == typeof e && e()))

(this.kl = Math.max(this.kl - 1, 0)),
this.vt.la(t.events, t.attributes),
this.vt.fa(t.events, t.attributes),
"function" == typeof n && n();
},
Pl: t => {
Ue: t => {
if (("function" == typeof l && l(t), i && !c)) {

@@ -91,3 +91,3 @@ if (t && !h) this.Rl();

(null == t || t < 1e3 * this.yl) && (t = 1e3 * this.yl),
this.Rl(Math.min(3e5, pt(1e3 * this.yl, 3 * t)));
this.Rl(Math.min(3e5, tt(1e3 * this.yl, 3 * t)));
}

@@ -99,11 +99,11 @@ c = !0;

},
m = this.Fl(u),
m = this.Dl(u),
f = s || m;
if (this.ql(h, m))
if (this.Fl(h, m))
return void r.D.info(
"Declining to flush data due to 50 consecutive authentication failures"
);
if (i && !this.vt.ga(u, a, t, f))
if (i && !this.vt.qa(u, a, t, f))
return this.Rl(), void ("function" == typeof l && l(!0));
const g = this.vt.qa(t, f, u, a);
const g = this.vt.Aa(t, f, u, a);
f && this.kl++;

@@ -114,3 +114,3 @@ let p = !1;

this.vt.Gs(t.requestData, () => d(t.requestData, t.headers)), (p = !0);
this.Ko.Jn() && i && !p
this.Ho.Kn() && i && !p
? this.Rl()

@@ -125,3 +125,3 @@ : m && (r.D.info("Invoking new session subscriptions"), this.Al.St());

(null == t && (t = 1e3 * this.yl),
this.Ll(),
this.Pl(),
(this.Nl = setTimeout(() => {

@@ -132,10 +132,10 @@ if (document.hidden) {

document.hidden ||
(document.removeEventListener(t, s, !1), this.Dl());
(document.removeEventListener(t, s, !1), this.Ll());
};
document.addEventListener(t, s, !1);
} else this.Dl();
} else this.Ll();
}, t)),
(this.jl = t));
}
Ll() {
Pl() {
null != this.Nl && (clearTimeout(this.Nl), (this.Nl = null));

@@ -148,6 +148,6 @@ }

this.Al.removeAllSubscriptions(),
this.Ko.Wn(),
this.Ll(),
this.Ho.Yn(),
this.Pl(),
(this.Il = !0),
this.Dl(null, null, !1),
this.Ll(null, null, !1),
(this.Nl = null);

@@ -159,6 +159,6 @@ }

openSession() {
const t = this.j.ca() !== this.j.mo();
const t = this.j.la() !== this.j.mo();
t && (this.h.ya(o.eu.Jo), this.h.ya(o.eu.su)),
this.Dl(null, !1, null, null, null),
this.Ln(),
this.Ll(null, !1, null, null, null),
this.Rn(),
t &&

@@ -173,3 +173,3 @@ import("./Push/push-manager-factory.js").then(t => {

const t = () => {
s.Gr()
s.Jr()
? r.D.info(

@@ -184,3 +184,3 @@ "Push token maintenance is disabled, not refreshing token for backend."

e = () => {
const s = this.h.I(o.q.Pn);
const s = this.h.I(o.q.Sn);
(null == s || s) && t();

@@ -196,6 +196,6 @@ },

if (e !== t) {
this.j.Gh(),
null != e && this.Dl(null, !1, null, null, null),
this.j.Fh(),
null != e && this.Ll(null, !1, null, null, null),
this.v.uu(t),
i ? this.Ko.setSdkAuthenticationSignature(i) : this.Ko.Qn();
i ? this.Ho.setSdkAuthenticationSignature(i) : this.Ho.Wn();
for (let t = 0; t < s.length; t++) s[t].changeUser(null == e);

@@ -209,4 +209,4 @@ null != e && this.h.Xs(o.q.P),

i &&
this.Ko.Kn() !== i &&
(this.Ko.setSdkAuthenticationSignature(i),
this.Ho.Mn() !== i &&
(this.Ho.setSdkAuthenticationSignature(i),
(s = "Updated SDK authentication signature")),

@@ -217,4 +217,4 @@ r.D.info(`Current user is already ${t}. ${s}`);

requestImmediateDataFlush(t) {
this.Ll(), this.j.mo();
this.Dl(
this.Pl(), this.j.mo();
this.Ll(
null,

@@ -234,3 +234,3 @@ null,

requestFeedRefresh() {
this.j.mo(), this.Dl(!0);
this.j.mo(), this.Ll(!0);
}

@@ -240,3 +240,3 @@ zr(t, s) {

r.D.info("Requesting explicit trigger refresh."),
this.Dl(null, !0, null, t, s);
this.Ll(null, !0, null, t, s);
}

@@ -276,9 +276,9 @@ Nn(t, i) {

}
Ln() {
Rn() {
const t = r.xt.Ft;
new r.qt(t, r.D).setItem(t.$t.Kl, 1, {
baseUrl: this.Bo,
baseUrl: this.Wo,
data: { api_key: this._r, device_id: this.Ur.te().id },
userId: this.v.getUserId(),
sdkAuthEnabled: this.Ko.Jn()
sdkAuthEnabled: this.Ho.Kn()
});

@@ -288,3 +288,3 @@ }

for (const s of t)
if (s.api_key === this._r) this.vt.la(s.events, s.attributes);
if (s.api_key === this._r) this.vt.fa(s.events, s.attributes);
else {

@@ -295,3 +295,3 @@ const t = r.xt.Ft;

}
Tn(i, e, n) {
$n(i, e, n) {
if (this.gt.hu(i))

@@ -309,3 +309,3 @@ return (

}
$n(t, i) {
Bn(t, i) {
const e = { group_id: t, status: i };

@@ -312,0 +312,0 @@ return s.G(r.A.Gl, e);

@@ -45,3 +45,3 @@ import Gt from "./filter.js";

}
static Sn(t) {
static jn(t) {
const r = [];

@@ -51,3 +51,3 @@ for (let e = 0; e < t.length; e++) {

s = t[e];
for (let t = 0; t < s.length; t++) o.push(Gt.Sn(s[t]));
for (let t = 0; t < s.length; t++) o.push(Gt.jn(s[t]));
r.push(o);

@@ -54,0 +54,0 @@ }

@@ -14,7 +14,7 @@ import { isDate as yt } from "../../util/code-utils.js";

(this.Yl = i),
this.Vl === Gt.Th.Zl &&
this.comparator !== Gt._h.Ah &&
this.comparator !== Gt._h.yh &&
this.comparator !== Gt._h.Mh &&
this.comparator !== Gt._h.Rh &&
this.Vl === Gt.yh.Zl &&
this.comparator !== Gt.Rh.Mh &&
this.comparator !== Gt.Rh.Lh &&
this.comparator !== Gt.Rh.Oh &&
this.comparator !== Gt.Rh.Uh &&
(this.Yl = h(this.Yl));

@@ -25,19 +25,19 @@ }

switch ((null != t && (s = t[this.Xl]), this.comparator)) {
case Gt._h.Hh:
case Gt.Rh.Qh:
return null != s && s.valueOf() === this.Yl.valueOf();
case Gt._h.Lh:
case Gt.Rh.Xh:
return null == s || s.valueOf() !== this.Yl.valueOf();
case Gt._h.Ih:
case Gt.Rh.Bh:
return typeof s == typeof this.Yl && s > this.Yl;
case Gt._h.Ah:
return this.Vl === Gt.Th.Zl
case Gt.Rh.Mh:
return this.Vl === Gt.yh.Zl
? null != s && yt(s) && Ht(s) <= this.Yl
: typeof s == typeof this.Yl && s >= this.Yl;
case Gt._h.Oh:
case Gt.Rh.kh:
return typeof s == typeof this.Yl && s < this.Yl;
case Gt._h.yh:
return this.Vl === Gt.Th.Zl
case Gt.Rh.Lh:
return this.Vl === Gt.yh.Zl
? null != s && yt(s) && Ht(s) >= this.Yl
: typeof s == typeof this.Yl && s <= this.Yl;
case Gt._h.Uh:
case Gt.Rh.Jh:
return (

@@ -49,11 +49,11 @@ null != s &&

);
case Gt._h.Qh:
case Gt.Rh.Vh:
return null != s;
case Gt._h.Xh:
case Gt.Rh.qh:
return null == s;
case Gt._h.Mh:
case Gt.Rh.Oh:
return null != s && yt(s) && Ut(s) < this.Yl;
case Gt._h.Rh:
case Gt.Rh.Uh:
return null != s && yt(s) && Ut(s) > this.Yl;
case Gt._h.Bh:
case Gt.Rh.Kh:
return (

@@ -83,20 +83,20 @@ null == s ||

}
static Sn(t) {
static jn(t) {
return new Gt(t.k, t.t, t.c, t.v);
}
}
(Gt._h = {
Hh: 1,
Lh: 2,
Ih: 3,
Ah: 4,
Oh: 5,
yh: 6,
Uh: 10,
Qh: 11,
Xh: 12,
Mh: 15,
Rh: 16,
Bh: 17
(Gt.Rh = {
Qh: 1,
Xh: 2,
Bh: 3,
Mh: 4,
kh: 5,
Lh: 6,
Jh: 10,
Vh: 11,
qh: 12,
Oh: 15,
Uh: 16,
Kh: 17
}),
(Gt.Th = { Fh: "boolean", kh: "number", Jh: "string", Zl: "date" });
(Gt.yh = { Ph: "boolean", Wh: "number", Yh: "string", Zl: "date" });
import Kt from "./trigger-condition.js";
export default class Qt {
constructor(t, i) {
(this.fu = t), (this.au = i);
(this.fu = t), (this.du = i);
}
Hl(t) {
if (null == this.fu) return !1;
const i = Kt.du(t[0], this.fu);
const i = Kt.gu(t[0], this.fu);
if (!i) return !1;
let r = null == this.au || 0 === this.au.length;
if (null != this.au)
for (let i = 0; i < this.au.length; i++)
if (this.au[i] === t[1]) {
let r = null == this.du || 0 === this.du.length;
if (null != this.du)
for (let i = 0; i < this.du.length; i++)
if (this.du[i] === t[1]) {
r = !0;

@@ -15,0 +15,0 @@ break;

@@ -7,3 +7,3 @@ import Kt from "./trigger-condition.js";

Hl(t) {
return null == this.fu || Kt.du(t[0], this.fu);
return null == this.fu || Kt.gu(t[0], this.fu);
}

@@ -10,0 +10,0 @@ static fromJson(t) {

@@ -17,3 +17,3 @@ import xt from "./custom-event-data.js";

}
static du(e, t) {
static gu(e, t) {
let a = null;

@@ -51,3 +51,3 @@ try {

break;
case Kt.rc.Ar:
case Kt.rc.Br:
r = Qt.fromJson(e.data);

@@ -63,3 +63,3 @@ break;

}
static Sn(e) {
static jn(e) {
let t, r;

@@ -74,3 +74,3 @@ switch (e.t) {

case Kt.rc.ac:
(r = e.d || {}), (t = new Xt(r.id, kt.Sn(r.pf || [])));
(r = e.d || {}), (t = new Xt(r.id, kt.jn(r.pf || [])));
break;

@@ -84,5 +84,5 @@ case Kt.rc.vr:

case Kt.rc.sc:
(r = e.d || {}), (t = new Dt(r.e, kt.Sn(r.pf || [])));
(r = e.d || {}), (t = new Dt(r.e, kt.jn(r.pf || [])));
break;
case Kt.rc.Ar:
case Kt.rc.Br:
t = new Qt(e.d);

@@ -103,3 +103,3 @@ break;

sc: "custom_event_property",
Ar: "iam_click",
Br: "iam_click",
ks: "test"

@@ -114,3 +114,3 @@ }),

(Kt.tc[Kt.rc.sc] = V.be),
(Kt.tc[Kt.rc.Ar] = V.Ar),
(Kt.tc[Kt.rc.Br] = V.Br),
(Kt.tc[Kt.rc.ks] = V.ks);

@@ -6,4 +6,4 @@ export default {

be: "custom_event",
Ar: "iam_click",
Br: "iam_click",
ks: "test"
};

@@ -8,6 +8,6 @@ import {

import { validateValueIsFromEnum as F } from "../../util/code-utils.js";
export default class mt {
export default class pt {
constructor(t, i, s, e, r, l, o, n, h, a, u, d) {
(this.id = t),
(this.Ph = i || []),
(this.$h = i || []),
void 0 === s && (s = null),

@@ -19,30 +19,30 @@ (this.startTime = s),

(this.type = l),
(this.$h = n || 0),
null == a && (a = 1e3 * (this.$h + 30)),
(this.$i = a),
(this.Zh = n || 0),
null == a && (a = 1e3 * (this.Zh + 30)),
(this.xi = a),
(this.data = o),
null == h && (h = mt.Vh),
(this.qh = h),
(this.Kh = u),
(this.Wh = d || null);
null == h && (h = pt.pu),
(this.Tu = h),
(this.Du = u),
(this.Pu = d || null);
}
Yh(t) {
yu(t) {
return (
null == this.Wh || (this.qh !== mt.Vh && t - this.Wh >= 1e3 * this.qh)
null == this.Pu || (this.Tu !== pt.pu && t - this.Pu >= 1e3 * this.Tu)
);
}
Zh(t) {
this.Wh = t;
ju(t) {
this.Pu = t;
}
gu(t) {
const i = t + 1e3 * this.$h;
wu(t) {
const i = t + 1e3 * this.Zh;
return Math.max(i - new Date().valueOf(), 0);
}
pu(t) {
Eu(t) {
const i = new Date().valueOf() - t,
s = null == t || isNaN(i) || null == this.$i || i < this.$i;
s = null == t || isNaN(i) || null == this.xi || i < this.xi;
return (
s ||
r.D.info(
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.$i}ms.`
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.xi}ms.`
),

@@ -67,3 +67,3 @@ !s

return F(
mt._i,
pt.Fi,
o,

@@ -73,3 +73,3 @@ "Could not construct Trigger from server data",

)
? new mt(i, s, e, r, l, o, d, n, a, u, m)
? new pt(i, s, e, r, l, o, d, n, a, u, m)
: null;

@@ -79,3 +79,3 @@ }

const t = [];
for (let i = 0; i < this.Ph.length; i++) t.push(this.Ph[i].ss());
for (let i = 0; i < this.$h.length; i++) t.push(this.$h[i].ss());
return {

@@ -89,13 +89,13 @@ i: this.id,

da: this.data,
d: this.$h,
r: this.qh,
tm: this.$i,
ss: this.Kh,
ld: this.Wh
d: this.Zh,
r: this.Tu,
tm: this.xi,
ss: this.Du,
ld: this.Pu
};
}
static Sn(t) {
static jn(t) {
const i = [];
for (let s = 0; s < t.c.length; s++) i.push(Kt.Sn(t.c[s]));
return new mt(
for (let s = 0; s < t.c.length; s++) i.push(Kt.jn(t.c[s]));
return new pt(
t.i,

@@ -116,2 +116,2 @@ i,

}
(mt.Vh = -1), (mt._i = { Ti: "inapp", Tu: "templated_iam" });
(pt.pu = -1), (pt.Fi = { Ei: "inapp", Nu: "templated_iam" });

@@ -10,6 +10,6 @@ import pe from "../InAppMessage/in-app-message-manager-factory.js";

if (!TriggersProviderFactory.provider) {
const r = e.nn(T.Ao);
const r = e.nn(T.So);
(TriggersProviderFactory.provider = new gr(
null != r ? r : 30,
pe.m().Ve(),
pe.m().pi(),
e.l(),

@@ -16,0 +16,0 @@ e.mr(),

@@ -12,3 +12,3 @@ import y from "../common/base-provider.js";

import wt from "../InAppMessage/models/templated-in-app-message.js";
import mt from "./models/trigger.js";
import pt from "./models/trigger.js";
import V from "./models/trigger-events.js";

@@ -38,3 +38,3 @@ import r from "../../shared-lib/braze-shared-lib.js";

const i = this.cg[t];
null != this.ng[i.id] && i.Zh(this.ng[i.id]);
null != this.ng[i.id] && i.ju(this.ng[i.id]);
}

@@ -46,3 +46,3 @@ }

i = [];
for (let s = 0; s < t.length; s++) i.push(mt.Sn(t[s]));
for (let s = 0; s < t.length; s++) i.push(pt.jn(t[s]));
(this.cg = i), this.gg();

@@ -67,3 +67,3 @@ }

const o = t[e],
n = r.gu(o.Si);
n = r.wu(o.qi);
if (n > 0) {

@@ -73,3 +73,3 @@ let t, e;

null != o.dg && (t = o.dg),
null != o.mg && ue.Fa(o.mg) && (e = ue.Sn(o.mg));
null != o.mg && ue.Fa(o.mg) && (e = ue.jn(o.mg));
const a = [];

@@ -81,3 +81,3 @@ if (p(o.pg))

}
this.eg.push(setTimeout(i(r, o.Si, t, e, a), n));
this.eg.push(setTimeout(i(r, o.qi, t, e, a), n));
}

@@ -111,8 +111,8 @@ }

for (let r = 0; r < t.triggers.length; r++) {
const h = mt.fromJson(t.triggers[r]);
const h = pt.fromJson(t.triggers[r]);
null != this.ng[h.id] &&
(h.Zh(this.ng[h.id]), (s[h.id] = this.ng[h.id])),
(h.ju(this.ng[h.id]), (s[h.id] = this.ng[h.id])),
null != this.og[h.id] && (e[h.id] = this.og[h.id]);
for (let t = 0; t < h.Ph.length; t++)
if (h.Ph[t].ec(V.ks, null)) {
for (let t = 0; t < h.$h.length; t++)
if (h.$h[t].ec(V.ks, null)) {
i = !0;

@@ -139,9 +139,9 @@ break;

const h = new Date().valueOf();
if (!t.pu(i))
return !1 === navigator.onLine && t.type === mt._i.Ti && e.imageUrl
if (!t.Eu(i))
return !1 === navigator.onLine && t.type === pt.Fi.Ei && e.imageUrl
? (r.D.info(
`Not showing ${t.type} trigger action ${t.id} due to offline state.`
),
void this.ig.ni(t.id, InAppMessage.li.nh))
: void (t.Yh(h) && this.yg(t, h, s)
void this.ig.di(t.id, InAppMessage.Ge.Th))
: void (t.yu(h) && this.yg(t, h, s)
? 0 === this.yt.bu()

@@ -155,5 +155,5 @@ ? r.D.info(

));
t.type === mt._i.Tu
? this.ig.ni(t.id, InAppMessage.li.zi)
: this.ig.ni(t.id, InAppMessage.li.rh);
t.type === pt.Fi.Nu
? this.ig.di(t.id, InAppMessage.Ge.$i)
: this.ig.di(t.id, InAppMessage.Ge.ah);
},

@@ -164,7 +164,7 @@ n = () => {

if (null != o)
if ((this.wg(o, i, s, e, h), o.pu(i))) {
if ((this.wg(o, i, s, e, h), o.Eu(i))) {
let t = `Server aborted in-app message display, but the timeout on fallback trigger ${o.id} has already elapsed.`;
h.length > 0 && (t += " Continuing to fall back."),
r.D.info(t),
this.ig.ni(o.id, InAppMessage.li.rh),
this.ig.di(o.id, InAppMessage.Ge.ah),
n();

@@ -175,3 +175,3 @@ } else {

);
const n = 1e3 * o.$h - (new Date().valueOf() - i);
const n = 1e3 * o.Zh - (new Date().valueOf() - i);
n > 0

@@ -187,3 +187,3 @@ ? this.eg.push(

switch (t.type) {
case mt._i.Ti:
case pt.Fi.Ei:
const h = lt(t.data);

@@ -194,6 +194,6 @@ if (null == h) {

),
this.ig.ni(t.id, InAppMessage.li.ki);
this.ig.di(t.id, InAppMessage.Ge.Gi);
break;
}
let a = this.ig.vi(h);
let a = this.ig.zi(h);
if (a) {

@@ -205,4 +205,4 @@ r.D.error(a), n();

break;
case mt._i.Tu:
const l = wt.fromJson(t.data, o, n, i, t.$i);
case pt.Fi.Nu:
const l = wt.fromJson(t.data, o, n, i, t.xi);
if (null == l) {

@@ -212,6 +212,6 @@ r.D.error(

),
this.ig.ni(t.id, InAppMessage.li.ki);
this.ig.di(t.id, InAppMessage.Ge.Gi);
break;
}
this.ig.Ii(l, s, e);
this.ig.ki(l, s, e);
break;

@@ -222,3 +222,3 @@ default:

),
this.ig.ni(t.id, InAppMessage.li.ki);
this.ig.di(t.id, InAppMessage.Ge.Gi);
}

@@ -243,5 +243,5 @@ }

const r = this.cg[s],
h = e + 1e3 * r.$h;
h = e + 1e3 * r.Zh;
if (
r.Yh(h) &&
r.yu(h) &&
(null == r.startTime || r.startTime <= e) &&

@@ -251,4 +251,4 @@ (null == r.endTime || r.endTime >= e)

let s = !1;
for (let e = 0; e < r.Ph.length; e++)
if (r.Ph[e].ec(t, i)) {
for (let e = 0; e < r.$h.length; e++)
if (r.$h[e].ec(t, i)) {
s = !0;

@@ -276,3 +276,3 @@ break;

this.wg(l, e, t, s, a),
0 === l.$h
0 === l.Zh
? this.ug(l, e, t, s, a)

@@ -282,3 +282,3 @@ : this.eg.push(

this.ug(l, e, t, s, a);
}, 1e3 * l.$h)
}, 1e3 * l.Zh)
));

@@ -307,3 +307,3 @@ }

);
let e = t.Kh;
let e = t.Du;
return null == e && (e = this.tg), i - this.hg >= 1e3 * e;

@@ -315,3 +315,3 @@ }

let n;
(h.Si = i), (h.dg = s), null != e && (n = e.ss()), (h.mg = n);
(h.qi = i), (h.dg = s), null != e && (n = e.ss()), (h.mg = n);
const a = [];

@@ -323,3 +323,3 @@ for (let t = 0; t < r.length; t++) a.push(r[t].id);

this.gg(),
t.Zh(i),
t.ju(i),
(this.hg = i),

@@ -326,0 +326,0 @@ this.h.B(o.q.Na, i),

import e, { OPTIONS as T } from "../../managers/braze-instance.js";
export function attachCSS(n, t, o) {
const c = n || document.querySelector("head"),
s = `ab-${t}-css-definitions-${"4.5.1".replace(/\./g, "-")}`,
s = `ab-${t}-css-definitions-${"4.6.0".replace(/\./g, "-")}`,
a = c.ownerDocument || document;

@@ -6,0 +6,0 @@ if (null == a.getElementById(s)) {

import e, { OPTIONS as T } from "../../managers/braze-instance.js";
export function loadFontAwesome() {
if (e.nn(T.Oo)) return;
if (e.nn(T.vo)) return;
const t = "https://use.fontawesome.com/7f85a56ba4.css";

@@ -5,0 +5,0 @@ if (

@@ -47,3 +47,3 @@ import _t from "../models/identifier.js";

}
Qr(t, s, e, i, u) {
Zr(t, s, e, i, u) {
this.nu("push_token", t, !1, !0),

@@ -56,5 +56,5 @@ this.nu("custom_push_public_key", e, !1, !0),

l = new ei(t, s, e, i, u);
this.h.B(o.q.Pn, l.ss()), n.setItem(h.$t.cu, h.se, !0);
this.h.B(o.q.Sn, l.ss()), n.setItem(h.$t.cu, h.se, !0);
}
Zr(t) {
fn(t) {
if (

@@ -69,5 +69,5 @@ (this.nu("push_token", null, !1, !0),

s = new r.qt(t, r.D);
this.h.B(o.q.Pn, !1), s.setItem(t.$t.cu, t.se, !1);
this.h.B(o.q.Sn, !1), s.setItem(t.$t.cu, t.se, !1);
}
}
}

@@ -179,3 +179,3 @@ import {

}
return this.si.In(r.A.An, t, e).S;
return this.si.In(r.A.Un, t, e).S;
}

@@ -191,3 +191,3 @@ return this.v.setCustomUserAttribute(t, e);

) &&
this.si.In(r.A.Un, t, e).S
this.si.In(r.A.En, t, e).S
);

@@ -202,3 +202,3 @@ }

) &&
this.si.In(r.A.En, t, e).S
this.si.In(r.A.Fn, t, e).S
);

@@ -215,3 +215,3 @@ }

!1)
: this.si.In(r.A.Fn, t, s).S;
: this.si.In(r.A.Tn, t, s).S;
}

@@ -229,3 +229,3 @@ setCustomLocationAttribute(t, e, s) {

!1)
: this.si.Tn(t, e, s).S)
: this.si.$n(t, e, s).S)
);

@@ -244,3 +244,3 @@ }

!1)
: this.si.$n(t, User.Bn.SUBSCRIBED).S;
: this.si.Bn(t, User.Ln.SUBSCRIBED).S;
}

@@ -258,9 +258,9 @@ removeFromSubscriptionGroup(t) {

!1)
: this.si.$n(t, User.Bn.UNSUBSCRIBED).S;
: this.si.Bn(t, User.Ln.UNSUBSCRIBED).S;
}
Qr(t, e, s, r, i) {
this.v.Qr(t, e, s, r, i), this.si.Ln();
Zr(t, e, s, r, i) {
this.v.Zr(t, e, s, r, i), this.si.Rn();
}
Zr(t) {
this.v.Zr(t);
fn(t) {
this.v.fn(t);
}

@@ -282,5 +282,5 @@ }

}),
(User.Bn = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
(User.Rn = "user_id"),
(User.Ln = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
(User.On = "user_id"),
(User.lu = "custom"),
(User.ee = 997);

@@ -27,10 +27,10 @@ import r from "../../shared-lib/braze-shared-lib.js";

export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = {
yi: "unknownBrazeAction",
bi: "noPushPrompt"
Di: "unknownBrazeAction",
_i: "noPushPrompt"
};
export const ineligibleBrazeActionURLErrorMessage = (t, o) => {
switch (t) {
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.yi:
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Di:
return `${o} contains an unknown braze action type and will not be displayed.`;
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.bi:
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES._i:
return `${o} contains a push prompt braze action, but is not eligible for a push prompt. Ignoring.`;

@@ -37,0 +37,0 @@ default:

@@ -19,3 +19,3 @@ import ti from "./client-hints-parser.js";

).toLowerCase()),
(this.Wo = si.Bg(this.userAgent));
(this.Fo = si.Bg(this.userAgent));
}

@@ -25,3 +25,3 @@ Og() {

}
Ja() {
ka() {
return this.browser === ri.kg;

@@ -28,0 +28,0 @@ }

@@ -19,11 +19,11 @@ export function _isInView(t, n, e, s) {

}
export const DOMUtils = { wu: null, eo: _isInView };
export const DIRECTIONS = { He: "up", Je: "down", ot: "left", et: "right" };
export const DOMUtils = { vu: null, eo: _isInView };
export const DIRECTIONS = { We: "up", Xe: "down", ot: "left", et: "right" };
export function supportsPassive() {
if (null == DOMUtils.wu) {
DOMUtils.wu = !1;
if (null == DOMUtils.vu) {
DOMUtils.vu = !1;
try {
const t = Object.defineProperty({}, "passive", {
get: () => {
DOMUtils.wu = !0;
DOMUtils.vu = !0;
}

@@ -35,3 +35,3 @@ });

}
return DOMUtils.wu;
return DOMUtils.vu;
}

@@ -70,5 +70,5 @@ export function addPassiveEventListener(t, n, e) {

(((u > 0 &&
n === DIRECTIONS.He &&
n === DIRECTIONS.We &&
t.scrollTop === t.scrollHeight - t.offsetHeight) ||
(u < 0 && n === DIRECTIONS.Je && 0 === t.scrollTop)) &&
(u < 0 && n === DIRECTIONS.Xe && 0 === t.scrollTop)) &&
e(o),

@@ -75,0 +75,0 @@ (s = null),

@@ -1,1 +0,1 @@

export const KeyCodes = { fo: 32, oo: 9, co: 13, Vi: 27 };
export const KeyCodes = { fo: 32, oo: 9, co: 13, ih: 27 };

@@ -16,3 +16,3 @@ import r from "../../shared-lib/braze-shared-lib.js";

"function" == typeof t.error && t.error(e.status),
"function" == typeof t.Pl && t.Pl(!1);
"function" == typeof t.Ue && t.Ue(!1);
};

@@ -32,3 +32,3 @@ (e.onload = () => {

const n = {
error: "" === e.responseText ? qt.fa : qt.ma,
error: "" === e.responseText ? qt.ma : qt.pa,
response: e.responseText

@@ -40,3 +40,3 @@ };

}
"function" == typeof t.Pl && t.Pl(!0);
"function" == typeof t.Ue && t.Ue(!0);
} else r();

@@ -43,0 +43,0 @@ }),

@@ -34,3 +34,3 @@ export const ORIENTATION = { PORTRAIT: 0, LANDSCAPE: 1 };

io: _getOrientation,
gn: _getCurrentUrl
yn: _getCurrentUrl
};

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc