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.8.0 to 4.8.1

src/managers/types.js

2

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

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

@@ -7,3 +7,3 @@ import je from "./encoding-utils.js";

import Ge from "./supported-options.js";
const r = { _n: je, q: ve, Cr: De, Z: Ie, xt: Be, zt: Be.ep, j: Ae, Jo: Ge };
const r = { xn: je, q: ve, Cr: De, Z: Ie, xt: Be, zt: Be.ep, j: Ae, xo: Ge };
export default r;
const je = {
Wn: function(t) {
_n: function(t) {
const r = (t + "=".repeat((4 - (t.length % 4)) % 4))

@@ -4,0 +4,0 @@ .replace(/\-/g, "+")

const ve = {
CustomEvent: "ce",
Pr: "p",
Rl: "pc",
cc: "ca",
ya: "i",
du: "pc",
dc: "ca",
ka: "i",
Is: "ie",

@@ -12,4 +12,4 @@ P: "cci",

H: "ccd",
Vh: "ss",
Fh: "se",
Wl: "ss",
xl: "se",
_i: "si",

@@ -20,8 +20,8 @@ Ii: "sc",

ro: "iec",
Pl: "lr",
Ll: "uae",
au: "lr",
Zh: "uae",
R: "ci",
B: "cc",
Nl: "lcaa",
Ml: "lcar",
gu: "lcaa",
fu: "lcar",
Rn: "inc",

@@ -32,5 +32,5 @@ Bn: "add",

$n: "ncam",
Ol: "sgu"
pu: "sgu"
},
De = { Ar: "feed_displayed", dc: "content_cards_displayed" };
De = { Ar: "feed_displayed", Cc: "content_cards_displayed" };
export { ve as EventTypes, De as InternalEventTypes };
export default class Be {
constructor(t, e) {
(this.td = "undefined" == typeof window ? self : window),
(this.ed = t),
(this.nd = e);
(this.nd = "undefined" == typeof window ? self : window),
(this.od = t),
(this.sd = e);
}
od() {
if ("indexedDB" in this.td) return this.td.indexedDB;
dd() {
if ("indexedDB" in this.nd) return this.nd.indexedDB;
}
rd() {
ud() {
try {
if (null == this.od()) return !1;
if (null == this.dd()) return !1;
{
const t = this.od().open("Braze IndexedDB Support Test");
const t = this.dd().open("Braze IndexedDB Support Test");
if (

@@ -23,3 +23,3 @@ ((t.onupgradeneeded = () => t.result.close()),

return (
this.nd.info(
this.sd.info(
"Not using IndexedDB for storage because we are running inside an extension"

@@ -34,3 +34,3 @@ ),

return (
this.nd.info(
this.sd.info(
"Not using IndexedDB for storage due to following error: " + t

@@ -42,4 +42,4 @@ ),

}
sd(t, e) {
const n = this.od().open(this.ed.dd, this.ed.VERSION);
fd(t, e) {
const n = this.dd().open(this.od.ad, this.od.VERSION);
if (null == n) return "function" == typeof e && e(), !1;

@@ -49,10 +49,10 @@ const o = this;

(n.onupgradeneeded = t => {
o.nd.info(
"Upgrading indexedDB " + o.ed.dd + " to v" + o.ed.VERSION + "..."
o.sd.info(
"Upgrading indexedDB " + o.od.ad + " to v" + o.od.VERSION + "..."
);
const e = t.target.result;
for (const t in o.ed.Jt)
o.ed.Jt.hasOwnProperty(t) &&
!e.objectStoreNames.contains(o.ed.Jt[t]) &&
e.createObjectStore(o.ed.Jt[t]);
for (const t in o.od.Jt)
o.od.Jt.hasOwnProperty(t) &&
!e.objectStoreNames.contains(o.od.Jt[t]) &&
e.createObjectStore(o.od.Jt[t]);
}),

@@ -64,3 +64,3 @@ (n.onsuccess = n => {

"function" == typeof e && e(),
o.nd.error(
o.sd.error(
"Needed to close the database unexpectedly because of an upgrade in another tab"

@@ -72,7 +72,7 @@ );

(n.onerror = t => (
o.nd.info(
o.sd.info(
"Could not open indexedDB " +
o.ed.dd +
o.od.ad +
" v" +
o.ed.VERSION +
o.od.VERSION +
": " +

@@ -88,8 +88,8 @@ t.target.errorCode

setItem(t, e, n, o, i) {
if (!this.rd()) return "function" == typeof i && i(), !1;
if (!this.ud()) return "function" == typeof i && i(), !1;
const r = this;
return this.sd(s => {
return this.fd(s => {
if (!s.objectStoreNames.contains(t))
return (
r.nd.error(
r.sd.error(
"Could not store object " +

@@ -100,3 +100,3 @@ e +

" on indexedDB " +
r.ed.dd +
r.od.ad +
" - " +

@@ -113,3 +113,3 @@ t +

(u.onerror = () => {
r.nd.error(
r.sd.error(
"Could not store object " +

@@ -120,3 +120,3 @@ e +

" on indexedDB " +
r.ed.dd
r.od.ad
),

@@ -131,8 +131,8 @@ "function" == typeof i && i();

getItem(t, e, n) {
if (!this.rd()) return !1;
if (!this.ud()) return !1;
const o = this;
return this.sd(i => {
return this.fd(i => {
if (!i.objectStoreNames.contains(t))
return (
o.nd.error(
o.sd.error(
"Could not retrieve object " +

@@ -143,3 +143,3 @@ e +

" on indexedDB " +
o.ed.dd +
o.od.ad +
" - " +

@@ -155,3 +155,3 @@ t +

(s.onerror = () => {
o.nd.error(
o.sd.error(
"Could not retrieve object " +

@@ -162,3 +162,3 @@ e +

" on indexedDB " +
o.ed.dd
o.od.ad
);

@@ -173,12 +173,12 @@ }),

hr(t, e, n) {
if (!this.rd()) return "function" == typeof n && n(), !1;
if (!this.ud()) return "function" == typeof n && n(), !1;
const o = this;
return this.sd(i => {
return this.fd(i => {
if (!i.objectStoreNames.contains(t))
return (
o.nd.error(
o.sd.error(
"Could not retrieve last record from " +
t +
" on indexedDB " +
o.ed.dd +
o.od.ad +
" - " +

@@ -195,4 +195,4 @@ t +

(s.onerror = () => {
o.nd.error(
"Could not open cursor for " + t + " on indexedDB " + o.ed.dd
o.sd.error(
"Could not open cursor for " + t + " on indexedDB " + o.od.ad
),

@@ -210,8 +210,8 @@ "function" == typeof n && n();

br(t, e) {
if (!this.rd()) return !1;
if (!this.ud()) return !1;
const n = this;
return this.sd(o => {
return this.fd(o => {
if (!o.objectStoreNames.contains(t))
return (
n.nd.error(
n.sd.error(
"Could not delete record " +

@@ -222,3 +222,3 @@ e +

" on indexedDB " +
n.ed.dd +
n.od.ad +
" - " +

@@ -233,3 +233,3 @@ t +

i.objectStore(t).delete(e).onerror = () => {
n.nd.error(
n.sd.error(
"Could not delete record " +

@@ -240,3 +240,3 @@ e +

" on indexedDB " +
n.ed.dd
n.od.ad
);

@@ -247,12 +247,12 @@ };

Mt(t, e) {
if (!this.rd()) return !1;
if (!this.ud()) return !1;
const n = this;
return this.sd(o => {
return this.fd(o => {
if (!o.objectStoreNames.contains(t))
return (
n.nd.error(
n.sd.error(
"Could not retrieve objects from " +
t +
" on indexedDB " +
n.ed.dd +
n.od.ad +
" - " +

@@ -271,11 +271,11 @@ t +

d.length > 0
? (n.nd.info(
? (n.sd.info(
"Cursor closed midway through for " +
t +
" on indexedDB " +
n.ed.dd
n.od.ad
),
e(d))
: n.nd.error(
"Could not open cursor for " + t + " on indexedDB " + n.ed.dd
: n.sd.error(
"Could not open cursor for " + t + " on indexedDB " + n.od.ad
);

@@ -297,10 +297,10 @@ }),

clearData() {
if (!this.rd()) return !1;
if (!this.ud()) return !1;
const t = [];
for (const e in this.ed.Jt)
this.ed.Jt.hasOwnProperty(e) &&
this.ed.Jt[e] !== this.ed.Jt.oe &&
t.push(this.ed.Jt[e]);
for (const e in this.od.Jt)
this.od.Jt.hasOwnProperty(e) &&
this.od.Jt[e] !== this.od.Jt.oe &&
t.push(this.od.Jt[e]);
const e = this;
return this.sd(function(n) {
return this.fd(function(n) {
const o = n.transaction(t, "readwrite");

@@ -311,4 +311,4 @@ o.oncomplete = () => n.close();

o.objectStore(i).clear().onerror = function() {
e.nd.error(
"Could not clear " + this.source.name + " on indexedDB " + e.ed.dd
e.sd.error(
"Could not clear " + this.source.name + " on indexedDB " + e.od.ad
);

@@ -318,3 +318,3 @@ };

o.onerror = function() {
e.nd.error("Could not clear object stores on indexedDB " + e.ed.dd);
e.sd.error("Could not clear object stores on indexedDB " + e.od.ad);
};

@@ -326,13 +326,13 @@ });

Ft: {
dd: "AppboyServiceWorkerAsyncStorage",
ad: "AppboyServiceWorkerAsyncStorage",
VERSION: 6,
Jt: {
Xa: "data",
Sa: "data",
kr: "pushClicks",
cu: "pushSubscribed",
ud: "fallbackDevice",
hd: "fallbackDevice",
qt: "cardUpdates",
oe: "optOut",
yr: "pendingData",
gu: "sdkAuthenticationSignature"
kh: "sdkAuthenticationSignature"
},

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

@@ -6,7 +6,7 @@ const Ae = {

destroy: function() {
(Ae.Eg = !1), (Ae.zg = void 0), (Ae.nd = void 0);
(Ae.Eg = !1), (Ae.zg = void 0), (Ae.sd = void 0);
},
setLogger: function(n) {
"function" == typeof n
? (Ae.init(), (Ae.nd = n))
? (Ae.init(), (Ae.sd = n))
: Ae.info("Ignoring setLogger call since logger is not a function");

@@ -23,3 +23,3 @@ },

const o = "Braze: " + n;
null != Ae.nd ? Ae.nd(o) : console.log(o);
null != Ae.sd ? Ae.sd(o) : console.log(o);
}

@@ -29,4 +29,4 @@ },

if (Ae.zg) {
const o = "Braze SDK Warning: " + n + " (v4.8.0)";
null != Ae.nd ? Ae.nd(o) : console.warn(o);
const o = "Braze SDK Warning: " + n + " (v4.8.1)";
null != Ae.sd ? Ae.sd(o) : console.warn(o);
}

@@ -36,4 +36,4 @@ },

if (Ae.zg) {
const o = "Braze SDK Error: " + n + " (v4.8.0)";
null != Ae.nd ? Ae.nd(o) : console.error(o);
const o = "Braze SDK Error: " + n + " (v4.8.1)";
null != Ae.sd ? Ae.sd(o) : console.error(o);
}

@@ -40,0 +40,0 @@ }

@@ -48,3 +48,3 @@ import { ControlCard } from "./models/index.js";

u = [];
let a;
let a = {};
this.u && (a = o ? this.u.v(i.k.K) || {} : this.u.v(i.k.L) || {});

@@ -51,0 +51,0 @@ for (const s of n)

@@ -8,10 +8,10 @@ import x from "./base-feed.js";

markCardAsRead as Fe,
topHadImpression as Te
topHadImpression as _e
} from "../Card/display/card-display.js";
import { bottomIsInView as he, topIsInView as _e } from "../util/dom-utils.js";
import { bottomIsInView as Te, topIsInView as xe } from "../util/dom-utils.js";
import { Card, ControlCard } from "../Card/index.js";
import { cardToHtml as xe } from "../Card/display/card-display.js";
import { cardToHtml as Ee } from "../Card/display/card-display.js";
import { isArray as p } from "../util/code-utils.js";
import { KeyCodes as lt } from "../util/key-codes.js";
import Ee from "../l10n/l10n-manager-factory.js";
import he from "../l10n/l10n-manager-factory.js";
import { removeSubscription } from "../Core/remove-subscription.js";

@@ -29,2 +29,4 @@ import r from "../../shared-lib/braze-shared-lib.js";

export const _SUBSCRIPTION_ID_DATA_ATTRIBUTE = "data-update-subscription-id";
export const _SCROLL_LISTENER_ID = "data-listener-id";
export const scrollListeners = {};
export function destroyFeedHtml(e) {

@@ -38,2 +40,6 @@ e &&

null != t && removeSubscription(t);
const o = e.getAttribute("data-listener-id");
null != o &&
(window.removeEventListener("scroll", scrollListeners[o]),
delete scrollListeners[o]);
}

@@ -60,5 +66,5 @@ export function _generateFeedBody(e, t) {

for (const n of e.cards) {
const a = n instanceof ControlCard;
!a || e.ur()
? (o.appendChild(xe(n, logCardClick, t)), (s = s || !a))
const i = n instanceof ControlCard;
!i || e.ur()
? (o.appendChild(Ee(n, logCardClick, t)), (s = s || !i))
: r.j.error(

@@ -71,3 +77,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 = Ee.m().get("NO_CARDS_MESSAGE")),
(e.innerHTML = he.m().get("NO_CARDS_MESSAGE")),
e.setAttribute("role", "article"),

@@ -82,21 +88,24 @@ o.appendChild(e);

const o = [],
r = t.querySelectorAll(".ab-card");
s = t.querySelectorAll(".ab-card");
e.fo || (e.fo = {});
for (let t = 0; t < r.length; t++) {
const s = fe(r[t]);
if (e.fo[s]) continue;
let n = Te(r[t]),
a = de(r[t]);
const i = n,
d = a,
f = _e(r[t]),
c = he(r[t]);
for (let t = 0; t < s.length; t++) {
const r = fe(s[t]),
n = xe(s[t]),
i = Te(s[t]);
if (e.fo[r]) {
n || i || Fe(s[t]);
continue;
}
let a = _e(s[t]),
d = de(s[t]);
const l = a,
c = d;
if (
(!n && f && ((n = !0), ye(r[t])),
!a && c && ((a = !0), be(r[t])),
n && a)
(!a && n && ((a = !0), ye(s[t])),
!d && i && ((d = !0), be(s[t])),
a && d)
) {
if ((f || c || Fe(r[t]), i && d)) continue;
if (l && c) continue;
for (const t of e.cards)
if (t.id === s) {
if (t.id === r) {
(e.fo[t.id] = !0), o.push(t);

@@ -114,6 +123,6 @@ break;

null != o && (o.className += " fa-spin");
const r = new Date().valueOf().toString();
t.setAttribute("data-last-requested-refresh", r),
const s = new Date().valueOf().toString();
t.setAttribute("data-last-requested-refresh", s),
setTimeout(() => {
if (t.getAttribute("data-last-requested-refresh") === r) {
if (t.getAttribute("data-last-requested-refresh") === s) {
const e = t.querySelectorAll(".fa-spin");

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

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

@@ -136,50 +145,51 @@ o.parentNode.removeChild(o);

}
export function feedToHtml(e, t) {
const o = document.createElement("div");
(o.className = "ab-feed ab-hide ab-effect-slide"),
o.setAttribute("role", "dialog"),
o.setAttribute("aria-label", "Feed"),
o.setAttribute("tabindex", "-1");
const r = document.createElement("div");
(r.className = "ab-feed-buttons-wrapper"),
r.setAttribute("role", "group"),
o.appendChild(r);
const s = document.createElement("i");
(s.className = "fa fa-times ab-close-button"),
s.setAttribute("aria-label", "Close Feed"),
s.setAttribute("tabindex", "0"),
s.setAttribute("role", "button");
const n = e => {
destroyFeedHtml(o), e.stopPropagation();
export function feedToHtml(e, t, o) {
const s = document.createElement("div");
(s.className = "ab-feed ab-hide ab-effect-slide"),
s.setAttribute("role", "dialog"),
s.setAttribute("aria-label", "Feed"),
s.setAttribute("tabindex", "-1");
const n = document.createElement("div");
(n.className = "ab-feed-buttons-wrapper"),
n.setAttribute("role", "group"),
s.appendChild(n);
const i = document.createElement("i");
(i.className = "fa fa-times ab-close-button"),
i.setAttribute("aria-label", "Close Feed"),
i.setAttribute("tabindex", "0"),
i.setAttribute("role", "button");
const a = e => {
destroyFeedHtml(s), e.stopPropagation();
};
s.addEventListener("keydown", e => {
(e.keyCode !== lt.yo && e.keyCode !== lt.Fo) || n(e);
i.addEventListener("keydown", e => {
(e.keyCode !== lt.yo && e.keyCode !== lt.Fo) || a(e);
}),
(s.onclick = n);
const a = document.createElement("i");
(a.className = "fa fa-refresh ab-refresh-button"),
null == e.lastUpdated && (a.className += " fa-spin"),
a.setAttribute("aria-label", "Refresh Feed"),
a.setAttribute("tabindex", "0"),
a.setAttribute("role", "button");
const i = t => {
refreshFeed(e, o), t.stopPropagation();
(i.onclick = a);
const d = document.createElement("i");
(d.className = "fa fa-refresh ab-refresh-button"),
null == e.lastUpdated && (d.className += " fa-spin"),
d.setAttribute("aria-label", "Refresh Feed"),
d.setAttribute("tabindex", "0"),
d.setAttribute("role", "button");
const l = t => {
refreshFeed(e, s), t.stopPropagation();
};
return (
a.addEventListener("keydown", e => {
(e.keyCode !== lt.yo && e.keyCode !== lt.Fo) || i(e);
}),
(a.onclick = i),
r.appendChild(a),
r.appendChild(s),
o.appendChild(_generateFeedBody(e, t)),
(o.onscroll = () => {
detectFeedImpressions(e, o);
}),
o
);
d.addEventListener("keydown", e => {
(e.keyCode !== lt.yo && e.keyCode !== lt.Fo) || l(e);
}),
(d.onclick = l),
n.appendChild(d),
n.appendChild(i),
s.appendChild(_generateFeedBody(e, t));
const c = () => detectFeedImpressions(e, s);
if ((s.addEventListener("scroll", c), !o)) {
window.addEventListener("scroll", c);
const e = r.Z.Y();
(scrollListeners[e] = c), s.setAttribute("data-listener-id", e);
}
return s;
}
export function updateFeedCards(e, t, o, s, n) {
if (!p(t)) return;
const a = [];
const i = [];
for (const e of t)

@@ -190,9 +200,9 @@ if (e instanceof Card) {

if (ft(t)) {
r.j.error(dt(vt.Ji, "Content Card"));
r.j.error(dt(vt.Ki, "Content Card"));
continue;
}
}
a.push(e);
i.push(e);
}
if (((e.cards = a), (e.lastUpdated = o), null != s))
if (((e.cards = i), (e.lastUpdated = o), null != s))
if ((s.setAttribute("aria-busy", "false"), null == e.lastUpdated))

@@ -199,0 +209,0 @@ destroyFeedHtml(s);

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

"function" == typeof t && B(i, t(i.cards.slice()), i.lastUpdated, null, a);
const s = I(i, a),
const s = I(i, a, o),
l = g.er(),

@@ -27,0 +27,0 @@ f = l.Vt();

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

n && n.requestImmediateDataFlush();
const o = new O.ee(null, !0);
o.store(i.re, "This-cookie-will-expire-in-" + o.ne());
const s = r.zt.Ft;
new r.xt(s, r.j).setItem(s.Jt.oe, s.se, !0), e.destroy(!1), e.ae(!0);
const o = new O.ee(null, !0),
s = "This-cookie-will-expire-in-" + o.re();
o.store(i.ne, s);
const a = r.zt.Ft;
new r.xt(a, r.j).setItem(a.Jt.oe, a.se, !0), e.destroy(!1), e.ae(!0);
}

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

export function enableSDK() {
new O.ee(null, !0).remove(i.re);
new O.ee(null, !0).remove(i.ne);
const a = r.zt.Ft;
new r.xt(a, r.j).br(a.Jt.oe, a.se), e.destroy(!1), e.ae(!1);
}
import O, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
export function isDisabled() {
return !!new O.ee(null, !0).wr(i.re);
return !!new O.ee(null, !0).wr(i.ne);
}

@@ -25,7 +25,7 @@ import r from "../../shared-lib/braze-shared-lib.js";

(this.gi = null),
(this.Fi = new E()),
(this.wi = 10),
(this.yi = null),
(this.wi = new E()),
(this.yi = 10),
(this.Fi = null),
(this.ji = null),
e.jt(this.Fi);
e.jt(this.wi);
}

@@ -39,3 +39,3 @@ Ts(t) {

}
(this.pi = new Date().getTime()), this.vi(), this.Fi.Et(this.mi);
(this.pi = new Date().getTime()), this.vi(), this.wi.Et(this.mi);
}

@@ -54,3 +54,3 @@ }

hi(t) {
return this.Fi.lt(t);
return this.wi.lt(t);
}

@@ -90,5 +90,5 @@ refreshFeatureFlags(t, s, i = !1, e = !0) {

if (e && o && !this.ji) {
let e = this.yi;
(null == e || e < 1e3 * this.wi) && (e = 1e3 * this.wi),
this.zi(Math.min(3e5, D(1e3 * this.wi, 3 * e)), t, s, i);
let e = this.Fi;
(null == e || e < 1e3 * this.yi) && (e = 1e3 * this.yi),
this.zi(Math.min(3e5, D(1e3 * this.yi, 3 * e)), t, s, i);
}

@@ -103,3 +103,3 @@ }

}
zi(t = 1e3 * this.wi, s, i, e) {
zi(t = 1e3 * this.yi, s, i, e) {
this.qi(),

@@ -109,3 +109,3 @@ (this.ji = window.setTimeout(() => {

}, t)),
(this.yi = t);
(this.Fi = t);
}

@@ -115,3 +115,3 @@ Ri(t) {

if (!t) {
const t = parseFloat(this.wt.Si());
const t = this.wt.Si();
let s = !1;

@@ -118,0 +118,0 @@ if (!isNaN(t)) {

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

: (f = new Feed(s(n, o), new Date()));
const u = I(f, i);
const u = I(f, i, l);
if (a) {

@@ -46,0 +46,0 @@ (null == f.lastUpdated ||

@@ -89,7 +89,7 @@ import C from "../util/net.js";

}
l = this.Gi(e);
l = this.Pi(e);
}
return null == l ? a : (null != n && (l.bid = n), s.N(i, l));
}
Oi(e, i) {
Gi(e, i) {
const n = new t();

@@ -103,6 +103,6 @@ if (!e.p())

);
const o = this.Gi(i);
const o = this.Pi(i);
return null == o
? n
: e.id === InAppMessageButton.Pi
: e.id === InAppMessageButton.Oi
? (r.j.info(

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

Hi(t) {
const s = t.messageFields;
return (null != s && s.is_push_primer) || !1;
}
Ji(t) {
if (!(t instanceof InAppMessage)) return;
const s = t => {
if (!t) return;
const s = Q(t);
return ft(s)
? dt(vt.Ji, "In-App Message")
: gt(s) && !yt.Ki()
? dt(vt.Li, "In-App Message")
: void 0;
},
e = t.buttons || [];
if (!t) return;
const s = Q(t);
return ft(s)
? dt(vt.Ki, "In-App Message")
: gt(s) && !yt.Li()
? dt(vt.Qi, "In-App Message")
: void 0;
};
if (this.Hi(t) && !yt.Li())
return "In-App Message contains a push prompt, but is not eligible for a push prompt. Ignoring.";
const e = t.buttons || [];
let i;

@@ -142,12 +148,12 @@ for (const t of e)

}
Qi(t, s, e, i) {
Vi(t, s, e, i) {
if (!this.gt) return;
const n = this.gt.Vi(!1, !1),
const n = this.gt.Wi(!1, !1),
o = this.gt.Gs(n);
(o.template = { trigger_id: t.triggerId, trigger_event_type: s }),
null != e && (o.template.data = e.Wi());
const a = this.gt.Ks(o, T.Qs.Xi);
null != e && (o.template.data = e.Xi());
const a = this.gt.Ks(o, T.Qs.Yi);
this.gt.Vs(o, () => {
this.gt &&
(T.Xs(this.u, T.Qs.Xi, new Date().valueOf()),
(T.Xs(this.u, T.Qs.Yi, new Date().valueOf()),
C.Ys({

@@ -160,25 +166,25 @@ url: `${this.gt.Zs()}/template/`,

return (
this.Ye(t.triggerId, InAppMessage.Me.Yi),
void ("function" == typeof t.Zi && t.Zi())
this.Ye(t.triggerId, InAppMessage.Me.Zi),
void ("function" == typeof t.Mr && t.Mr())
);
if ((this.gt.si(), null == s || null == s.templated_message))
return void this.Ye(t.triggerId, InAppMessage.Me.Yi);
return void this.Ye(t.triggerId, InAppMessage.Me.Zi);
const e = s.templated_message;
if (e.type !== mt._r.Mr)
return void this.Ye(t.triggerId, InAppMessage.Me.Gr);
if (e.type !== mt.Gr._r)
return void this.Ye(t.triggerId, InAppMessage.Me.Or);
const i = pt(e.data);
if (null == i) return void this.Ye(t.triggerId, InAppMessage.Me.Gr);
const n = this.Hi(i);
if (null == i) return void this.Ye(t.triggerId, InAppMessage.Me.Or);
const n = this.Ji(i);
if (n)
return r.j.error(n), void ("function" == typeof t.Zi && t.Zi());
"function" == typeof t.Or
? t.Or(i)
: this.Ye(t.triggerId, InAppMessage.Me.Yi);
return r.j.error(n), void ("function" == typeof t.Mr && t.Mr());
"function" == typeof t.Hr
? t.Hr(i)
: this.Ye(t.triggerId, InAppMessage.Me.Zi);
},
error: r => {
let n = `getting user personalization for message ${t.triggerId}`;
if (new Date().valueOf() - t.Hr > t.Jr)
this.Ye(t.triggerId, InAppMessage.Me.Yi);
if (new Date().valueOf() - t.Jr > t.Kr)
this.Ye(t.triggerId, InAppMessage.Me.Zi);
else {
const r = Math.min(t.Jr, this.Re),
const r = Math.min(t.Kr, this.Re),
o = this.Oe;

@@ -189,3 +195,3 @@ null == i && (i = o);

setTimeout(() => {
this.Qi(t, s, e, a);
this.Vi(t, s, e, a);
}, a);

@@ -198,3 +204,3 @@ }

}
Gi(t) {
Pi(t) {
if (null == t.triggerId)

@@ -201,0 +207,0 @@ return (

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

if (!(o instanceof InAppMessage)) return r.j.error(or), !1;
const s = ea.m().Oi(t, o);
const s = ea.m().Gi(t, o);
if (s.O)
for (let r = 0; r < s.ve.length; r++)
et.er().je(tt.Kr, [o.triggerId, t.id], s.ve[r]);
et.er().je(tt.Lr, [o.triggerId, t.id], s.ve[r]);
return s.O;
}

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

if (s) {
o.Lr() || logInAppMessageImpression(o);
o.Qr() || logInAppMessageImpression(o);
for (let r = 0; r < s.ve.length; r++)
et.er().je(tt.Kr, [o.triggerId], s.ve[r]);
et.er().je(tt.Lr, [o.triggerId], s.ve[r]);
}
return s.O;
}

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

for (let r = 0; r < i.ve.length; r++)
et.er().je(tt.Kr, [s.triggerId, t], i.ve[r]);
et.er().je(tt.Lr, [s.triggerId, t], i.ve[r]);
return i.O;
}

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

(this.text = s || ""),
(this.backgroundColor = t || InAppMessage.Ur.Qr),
(this.textColor = i || InAppMessage.Ur.Vr),
(this.backgroundColor = t || InAppMessage.Vr.Ur),
(this.textColor = i || InAppMessage.Vr.Wr),
(this.borderColor = r || this.backgroundColor),
(this.clickAction = h || InAppMessage.ClickAction.NONE),
(this.uri = e),
null == n && (n = InAppMessageButton.Pi),
null == n && (n = InAppMessageButton.Oi),
(this.id = n),

@@ -48,2 +48,2 @@ (this.vo = !1),

}
InAppMessageButton.Pi = -1;
InAppMessageButton.Oi = -1;

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

(this.imageStyle = m || InAppMessage.ImageStyle.TOP),
(this.iconColor = c || InAppMessage.Ur.Vr),
(this.iconBackgroundColor = I || InAppMessage.Ur.Qr),
(this.backgroundColor = L || InAppMessage.Ur.Vr),
(this.textColor = A || InAppMessage.Ur.th),
(this.closeButtonColor = N || InAppMessage.Ur.sh),
(this.iconColor = c || InAppMessage.Vr.Wr),
(this.iconBackgroundColor = I || InAppMessage.Vr.Ur),
(this.backgroundColor = L || InAppMessage.Vr.Wr),
(this.textColor = A || InAppMessage.Vr.th),
(this.closeButtonColor = N || InAppMessage.Vr.sh),
(this.animateIn = d),

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

(this.headerAlignment = S || InAppMessage.TextAlignment.CENTER),
(this.headerTextColor = D || InAppMessage.Ur.th),
(this.frameColor = M || InAppMessage.Ur.ih),
(this.headerTextColor = D || InAppMessage.Vr.th),
(this.frameColor = M || InAppMessage.Vr.ih),
(this.buttons = R || []),

@@ -148,3 +148,3 @@ (this.cropType = b || InAppMessage.CropType.FIT_CENTER),

}
Lr() {
Qr() {
return this.eh;

@@ -263,6 +263,6 @@ }

}
(InAppMessage.Ur = {
(InAppMessage.Vr = {
th: 4281545523,
Vr: 4294967295,
Qr: 4278219733,
Wr: 4294967295,
Ur: 4278219733,
dh: 4293914607,

@@ -278,4 +278,4 @@ _h: 4283782485,

Dh: "do",
Gr: "umt",
Yi: "tf",
Or: "umt",
Zi: "tf",
Mh: "te"

@@ -282,0 +282,0 @@ }),

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

constructor(o, s, t, e, i, d, n, r, a, p, u, m, c, v, l, x, h, f, g, I, M) {
(x = x || InAppMessage.Ur._h),
(l = l || InAppMessage.Ur.dh),
(x = x || InAppMessage.Vr._h),
(l = l || InAppMessage.Vr.dh),
super(

@@ -9,0 +9,0 @@ o,

export default class wt {
constructor(t, s, i, h, l) {
(this.triggerId = t),
(this.Or = s),
(this.Zi = i),
(this.Hr = h),
(this.Jr = l),
(this.Hr = s),
(this.Mr = i),
(this.Jr = h),
(this.Kr = l),
(this.triggerId = t),
(this.Or = s),
(this.Zi = i),
(this.Hr = h),
(this.Jr = l);
(this.Hr = s),
(this.Mr = i),
(this.Jr = h),
(this.Kr = l);
}

@@ -14,0 +14,0 @@ static fromJson(t, s, i, h, l) {

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

s.$e() && (a.id = s.htmlId),
e.nn(L.mo) && (a.style.zIndex = e.nn(L.mo) + 1),
e.nn(L.mo) && (a.style.zIndex = (e.nn(L.mo) + 1).toString()),
t.appendChild(a),

@@ -126,3 +126,3 @@ s.ye())

s.ye() || (o.style.backgroundColor = me(s.frameColor)),
e.nn(L.mo) && (o.style.zIndex = e.nn(L.mo)),
e.nn(L.mo) && (o.style.zIndex = e.nn(L.mo).toString()),
a.appendChild(o),

@@ -129,0 +129,0 @@ !e.nn(L.Lh))

import e, { OPTIONS as L } from "../managers/braze-instance.js";
import V from "../util/browser-detector.js";
import nr from "./l10n-manager.js";
const Ee = {
const he = {
t: !1,
i: null,
m: () => {
if ((Ee.o(), !Ee.i)) {
if ((he.o(), !he.i)) {
let r = V.language,
t = !1;
e.nn(L.Mn) && ((r = e.nn(L.Mn)), (t = !0)), (Ee.i = new nr(r, t));
e.nn(L.Mn) && ((r = e.nn(L.Mn)), (t = !0)), (he.i = new nr(r, t));
}
return Ee.i;
return he.i;
},
o: () => {
Ee.t || (e.g(Ee), (Ee.t = !0));
he.t || (e.g(he), (he.t = !0));
},
destroy: () => {
(Ee.i = null), (Ee.t = !1);
(he.i = null), (he.t = !1);
}
};
export default Ee;
export default he;

@@ -6,5 +6,8 @@ import { STORAGE_KEYS as i } from "./storage-manager.js";

constructor(t, i, s) {
(this.Jn = t),
(this.Kn = i || !1),
(this.u = t),
(this.Jn = i),
(this.Qn = s),
(this.u = t),
(this.Jn = i || !1),
(this.Qn = s),
(this.Vn = new E()),

@@ -15,17 +18,17 @@ (this.Xn = 0),

Zn() {
return this.Kn;
return this.Jn;
}
au() {
return this.Jn.v(i.k.bu);
gh() {
return this.u.v(i.k.Fh);
}
setSdkAuthenticationSignature(t) {
const s = this.au();
this.Jn.D(i.k.bu, t);
const s = this.gh();
this.u.D(i.k.Fh, t);
const e = r.zt.Ft;
new r.xt(e, r.j).setItem(e.Jt.gu, this.Yn, t), s !== t && this.si();
new r.xt(e, r.j).setItem(e.Jt.kh, this.Yn, t), s !== t && this.si();
}
du() {
this.Jn.ri(i.k.bu);
fh() {
this.u.ri(i.k.Fh);
const t = r.zt.Ft;
new r.xt(t, r.j).br(t.Jt.gu, this.Yn);
new r.xt(t, r.j).br(t.Jt.kh, this.Yn);
}

@@ -35,12 +38,12 @@ subscribeToSdkAuthenticationFailures(t) {

}
Su(t) {
wh(t) {
this.Qn.Et(t);
}
Au() {
jh() {
this.Vn.removeAllSubscriptions();
}
pu() {
Ch() {
this.Xn += 1;
}
Fu() {
xh() {
return this.Xn;

@@ -47,0 +50,0 @@ }

@@ -55,17 +55,29 @@ import jt from "./auth-manager.js";

constructor() {
(this.Ro = !1),
(this.Mo = !1),
(this.jo = new E()),
(this.Do = new E()),
(this.Uo = {}),
(this.Bo = []),
(this.Wo = []),
(this.zo = []),
(this.Vo = "4.8.0");
(this.Xr = ""),
(this.Ro = ""),
(this.Mo = void 0),
(this.jo = null),
(this.Zr = null),
(this.gt = null),
(this.Ci = null),
(this.wt = null),
(this._e = null),
(this.u = null),
(this.ft = null),
(this.Do = ""),
(this.Uo = !1),
(this.Bo = !1),
(this.Wo = new E()),
(this.zo = new E()),
(this.options = {}),
(this.Vo = []),
(this.Go = []),
(this.Se = []),
(this.Ro = "4.8.1");
}
Go(t) {
this.jo.lt(t);
Ko(t) {
this.Wo.lt(t);
}
Nh(t) {
this.Do.lt(t);
this.zo.lt(t);
}

@@ -77,13 +89,15 @@ initialize(t, s) {

);
this.Uo = s || {};
this.options = s || {};
let e = this.nn(L.Ao);
const n = ct(Z.An());
const n = ct(Z.jn());
if (
(n && "true" === n.brazeLogging && (e = !0),
r.j.init(e),
r.j.info(`Initialization Options: ${JSON.stringify(this.Uo, null, 2)}`),
r.j.info(
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`
),
null == t || "" === t || "string" != typeof t)
)
return r.j.error("Braze requires a valid API key to be initialized."), !1;
this.Ko = t;
this.Xr = t;
let o = this.nn(L.Eo);

@@ -93,3 +107,3 @@ if (null == o || "" === o || "string" != typeof o)

!1 === /^https?:/.test(o) && (o = `https://${o}`);
let h = o;
const h = o;
if (

@@ -99,8 +113,8 @@ ((o = document.createElement("a")),

"/" === o.pathname && (o = `${o}api/v3`),
(this.Ho = o.toString()),
V.$o && !this.nn(L.ho))
(this.Do = o.toString()),
V.Ho && !this.nn(L.ho))
)
return (
r.j.info("Ignoring activity from crawler bot " + navigator.userAgent),
(this.Mo = !0),
(this.Bo = !0),
!1

@@ -110,11 +124,11 @@ );

if (
((this.Jn = Bt.qo(t, a)), a && this.Jn.xo(t), new O.ee(null, !0).wr(i.re))
((this.u = Bt.$o(t, a)), a && this.u.qo(t), new O.ee(null, !0).wr(i.ne))
)
return (
r.j.info("Ignoring all activity due to previous opt out"),
(this.Mo = !0),
(this.Bo = !0),
!1
);
for (const t of oo(this.Uo))
-1 === Lt(r.Jo).indexOf(t) &&
for (const t of oo(this.options))
-1 === Lt(r.xo).indexOf(t) &&
r.j.warn(`Ignoring unknown initialization option '${t}'.`);

@@ -125,6 +139,6 @@ const l = ["mparticle", "wordpress", "tealium"];

-1 !== l.indexOf(t)
? (this.Yo = t)
? (this.Mo = t)
: r.j.error("Invalid sdk flavor passed: " + t);
}
let u = this.nn(r.Jo.Io);
let u = this.nn(r.xo.Io);
if (null != u)

@@ -146,42 +160,42 @@ if (p(u)) {

(u = null);
(this.Xo = new Ot(this.Jn, u)),
(this.Zo = new Mt(this.Jn)),
(this.Qo = new bt(this.Zo, this.Jn)),
(this.fh = new Dt(this.Jn, this.Qo, this.Zo, this.nn(L.wo)));
(this.Zr = new Ot(this.u, u)),
(this.wt = new Mt(this.u)),
(this.ft = new bt(this.wt, this.u)),
(this._e = new Dt(this.u, this.ft, this.wt, this.nn(L.wo)));
const f = new E();
return (
(this.gh = new jt(this.Jn, this.nn(L.So), f)),
(this.jo = new jt(this.u, this.nn(L.So), f)),
this.jt(f),
(this.wh = new Pt(
this.Xo,
this.Jn,
this.gh,
this.Qo,
this.fh,
this.Zo,
this.Ko,
this.Ho,
this.Vo,
this.Yo,
(this.gt = new Pt(
this.Zr,
this.u,
this.jo,
this.ft,
this._e,
this.wt,
this.Xr,
this.Do,
this.Ro,
this.Mo || "",
this.nn(L.To)
)),
(this.Ch = new Rt(
this.Ko,
this.Ho,
this.fh,
this.Xo,
this.Qo,
this.Zo,
this.Jn,
(this.Ci = new Rt(
this.Xr,
this.Do,
this._e,
this.Zr,
this.ft,
this.wt,
this.u,
t => {
if (this.ue()) for (const i of this.gr()) i.Ts(t);
},
this.gh,
this.wh
this.jo,
this.gt
)),
this.Ch.initialize(),
this.Ci.initialize(),
r.j.info(
`Initialized for the Braze backend at "${this.nn(
L.Eo
)}" with API key "${this.Ko}".`
)}" with API key "${this.Xr}".`
),

@@ -195,20 +209,22 @@ null != this.nn(L.Oo) &&

et.init(),
this.Zo.Ni(() => {
this.Ro &&
this.Zo.bi() &&
this.wt.Ni(() => {
this.Uo &&
this.wt &&
this.wt.bi() &&
import("../FeatureFlags/refresh-feature-flags.js").then(t => {
if (!this.Ro) return;
if (!this.Uo) return;
(0, t.default)();
});
}),
this.Ch.pr(() => {
this.Ro &&
this.Zo.bi() &&
this.Ci.pr(() => {
this.Uo &&
this.wt &&
this.wt.bi() &&
import("../FeatureFlags/refresh-feature-flags.js").then(t => {
if (!this.Ro) return;
if (!this.Uo) return;
(0, t.default)(null, null, !0);
});
}),
this.jo.Et(this.Uo),
(this.Ro = !0),
this.Wo.Et(this.options),
(this.Uo = !0),
!0

@@ -219,26 +235,26 @@ );

if ((r.j.destroy(), this.ue())) {
this.Do.Et(), this.Do.removeAllSubscriptions();
for (const t of this.Bo) t.destroy();
this.Bo = [];
for (const t of this.Wo) t.clearData(!1);
(this.Wo = []),
this.zo.Et(), this.zo.removeAllSubscriptions();
for (const t of this.Vo) t.destroy();
this.Vo = [];
for (const t of this.Go) t.clearData(!1);
(this.Go = []),
this.removeAllSubscriptions(),
(this.zo = []),
this.Ch.destroy(),
(this.Ch = null),
(this.gh = null),
(this.Xo = null),
(this.wh = null),
(this.Zo = null),
(this.fh = null),
(this.Qo = null),
(this.Uo = {}),
(this.Yo = void 0),
(this.Ro = !1),
(this.Mo = !1),
t && (this.Jn = null);
(this.Se = []),
null != this.Ci && this.Ci.destroy(),
(this.Ci = null),
(this.jo = null),
(this.Zr = null),
(this.gt = null),
(this.wt = null),
(this._e = null),
(this.ft = null),
(this.options = {}),
(this.Mo = void 0),
(this.Uo = !1),
(this.Bo = !1),
t && (this.u = null);
}
}
rr() {
if (this.Ph()) return !1;
if (this.Jo()) return !1;
if (!this.ue()) throw new Error(P);

@@ -248,39 +264,39 @@ return !0;

ea() {
return this.Ko;
return this.Xr;
}
Sr() {
return this.gh;
return this.jo;
}
Zs() {
return this.Ho;
return this.Do;
}
ie() {
return this.Xo;
return this.Zr;
}
ar() {
return this.wh;
return this.gt;
}
nn(t) {
return this.Uo[t];
return this.options[t];
}
gr() {
return this.Wo;
return this.Go;
}
cr() {
return this.Ch;
return this.Ci;
}
tr() {
return this.Zo;
return this.wt;
}
aa() {
return this.fh;
return this._e;
}
l() {
return this.Jn;
return this.u;
}
jr() {
if (this.Qo && this.Ch) return new User(this.Qo, this.Ch);
if (this.ft && this.Ci) return new User(this.ft, this.Ci);
}
ir() {
return this.Qo;
return this.ft;
}

@@ -292,30 +308,30 @@ nr() {

let i = !1;
for (const s of this.Bo) s === t && (i = !0);
i || this.Bo.push(t);
for (const s of this.Vo) s === t && (i = !0);
i || this.Vo.push(t);
}
dr(t) {
let i = !1;
for (const s of this.Wo) s.constructor === t.constructor && (i = !0);
t instanceof y && !i && this.Wo.push(t);
for (const s of this.Go) s.constructor === t.constructor && (i = !0);
t instanceof y && !i && this.Go.push(t);
}
jt(t) {
t instanceof E && this.zo.push(t);
t instanceof E && this.Se.push(t);
}
removeAllSubscriptions() {
if (this.rr()) for (const t of this.zo) t.removeAllSubscriptions();
if (this.rr()) for (const t of this.Se) t.removeAllSubscriptions();
}
removeSubscription(t) {
if (this.rr()) for (const i of this.zo) i.removeSubscription(t);
if (this.rr()) for (const i of this.Se) i.removeSubscription(t);
}
ae(t) {
this.Mo = t;
this.Bo = t;
}
ue() {
return this.Ro;
return this.Uo;
}
Ph() {
return this.Mo;
Jo() {
return this.Bo;
}
Us() {
return this.Vo;
return this.Ro;
}

@@ -322,0 +338,0 @@ }

import V from "../util/browser-detector.js";
import ge from "../models/device.js";
import xt from "../models/device.js";
import DeviceProperties from "../Core/device-properties.js";

@@ -8,48 +8,53 @@ import _t from "../models/identifier.js";

import { values as Lt } from "../util/code-utils.js";
import { getErrorMessage as ei } from "../util/error-utils.js";
export default class Ot {
constructor(e, t) {
(this.Jn = e), null == t && (t = Lt(DeviceProperties)), (this.sa = t);
constructor(t, e) {
(this.u = t),
(this.Qo = e),
(this.u = t),
null == e && (e = Lt(DeviceProperties)),
(this.Qo = e);
}
te() {
let e = this.Jn.tu(i.eu.oa);
null == e && ((e = new _t(r.Z.Y())), this.Jn.uu(i.eu.oa, e));
const t = new ge(e.iu);
for (let e = 0; e < this.sa.length; e++) {
const r = this.sa[e];
switch (r) {
let t = this.u.tu(i.eu.Xo);
null == t && ((t = new _t(r.Z.Y())), this.u.uu(i.eu.Xo, t));
const e = new xt(t.iu);
for (let t = 0; t < this.Qo.length; t++) {
switch (this.Qo[t]) {
case DeviceProperties.BROWSER:
t[r] = V.browser;
e.browser = V.browser;
break;
case DeviceProperties.BROWSER_VERSION:
t[r] = V.version;
e.Yo = V.version;
break;
case DeviceProperties.OS:
t[r] = this.ca();
e.os = this.Zo();
break;
case DeviceProperties.RESOLUTION:
t[r] = screen.width + "x" + screen.height;
e.sa = screen.width + "x" + screen.height;
break;
case DeviceProperties.LANGUAGE:
t[r] = V.language;
e.language = V.language;
break;
case DeviceProperties.TIME_ZONE:
t[r] = this.fa(new Date());
e.timeZone = this.oa(new Date());
break;
case DeviceProperties.USER_AGENT:
t[r] = V.userAgent;
e.userAgent = V.userAgent;
}
}
return t;
return e;
}
ca() {
if (V.la()) return V.la();
const e = this.Jn.v(i.k.ma);
return e && e.os_version ? e.os_version : V.ua();
Zo() {
if (V.ca()) return V.ca();
const t = this.u.v(i.k.la);
return t && t.os_version ? t.os_version : V.Zo();
}
fa(e) {
oa(t) {
let e = !1;
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
try {
if ("function" == typeof Intl.DateTimeFormat().resolvedOptions) {
const e = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (null != e && "" !== e) return e;
const t = Intl.DateTimeFormat().resolvedOptions().timeZone;
if (null != t && "" !== t) return t;
}

@@ -59,19 +64,19 @@ } catch (t) {

"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
t.message
ei(t)
),
(e = "");
(e = !0);
}
if (!e) return e;
const t = e.getTimezoneOffset();
return this.ha(t);
if (e) return "";
const s = t.getTimezoneOffset();
return this.fa(s);
}
ha(e) {
const t = parseInt(e / 60),
r = parseInt(e % 60);
fa(t) {
const e = Math.trunc(t / 60),
r = Math.trunc(t % 60);
let s = "GMT";
return (
0 !== e &&
((s += e < 0 ? "+" : "-"),
0 !== t &&
((s += t < 0 ? "+" : "-"),
(s +=
("00" + Math.abs(t)).slice(-2) +
("00" + Math.abs(e)).slice(-2) +
":" +

@@ -78,0 +83,0 @@ ("00" + Math.abs(r)).slice(-2))),

@@ -14,36 +14,47 @@ import qt from "../models/backend-errors.js";

export default class Pt {
constructor(t, e, s, i, r, o, n, a, u, h, c) {
(this.Xo = t),
(this.Jn = e),
(this.gh = s),
(this.Qo = i),
(this.fh = r),
(this.Zo = o),
(this.Ko = n),
(this.Ho = a),
(this.Vo = u),
(this.Yo = h),
(this.pa = c),
(this.Ra = ["npm"]);
constructor(t, e, s, i, r, o, n, a, h, u, c) {
(this.Zr = t),
(this.u = e),
(this.jo = s),
(this.ft = i),
(this._e = r),
(this.wt = o),
(this.Xr = n),
(this.Do = a),
(this.Ro = h),
(this.Mo = u),
(this.appVersion = c),
(this.Zr = t),
(this.u = e),
(this.jo = s),
(this.ft = i),
(this._e = r),
(this.wt = o),
(this.Xr = n),
(this.Do = a),
(this.Ro = h),
(this.Mo = u),
(this.appVersion = c),
(this.ha = ["npm"]);
}
Gs(t, e) {
const s = this.Xo.te(),
r = s.Wi(),
o = this.Jn.v(i.k.ma);
Gs(t, e = !1) {
const s = this.Zr.te(),
r = s.Xi(),
o = this.u.v(i.k.la);
ii(o, r) || (t.device = r),
(t.api_key = this.Ko),
(t.api_key = this.Xr),
(t.time = h(new Date().valueOf(), !0));
const n = this.Jn.v(i.k.ga) || [],
a = this.Jn.v(i.k.qa) || "";
const n = this.u.v(i.k.ua) || [],
a = this.u.v(i.k.ma) || "";
if (
(this.Ra.length > 0 &&
(!ii(n, this.Ra) || a !== this.fh.ba()) &&
(t.sdk_metadata = this.Ra),
(t.sdk_version = this.Vo),
this.Yo && (t.sdk_flavor = this.Yo),
(t.app_version = this.pa),
(this.ha.length > 0 &&
(!ii(n, this.ha) || a !== this._e.pa()) &&
(t.sdk_metadata = this.ha),
(t.sdk_version = this.Ro),
this.Mo && (t.sdk_flavor = this.Mo),
(t.app_version = this.appVersion),
(t.device_id = s.id),
e)
) {
const e = this.Qo.getUserId();
const e = this.ft.getUserId();
null != e && (t.user_id = e);

@@ -59,3 +70,3 @@ }

let e;
this.gh.pu();
this.jo.Ch();
const s = { errorCode: o.error_code };

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

: (e = `with error code ${o.error_code}.`),
this.gh.Zn() ||
this.jo.Zn() ||
(e +=
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
r.j.error(`SDK Authentication failed ${e}`),
this.Aa(t.events, t.attributes),
this.gh.Su(s),
this.Ra(t.events || [], t.attributes || []),
this.jo.wh(s),
!1

@@ -86,3 +97,3 @@ );

switch (o) {
case qt.za:
case qt.ga:
return (

@@ -94,3 +105,3 @@ (i = "Received successful response with empty body."),

);
case qt.Ba:
case qt.qa:
return (

@@ -102,10 +113,10 @@ (i = "Received successful response with invalid JSON"),

);
case qt.Da:
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Ho}`;
case qt.ba:
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Do}`;
break;
case qt.Sa:
case qt.Aa:
o =
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
break;
case qt.va:
case qt.za:
o = "No device identifier. Please contact support@braze.com";

@@ -117,30 +128,30 @@ }

}
ka(t, e, s, i) {
Ba(t, e, s, i) {
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i);
}
Ta(t, e, s, i) {
Da(t, e, s, i) {
const r = [],
o = t => t || "",
n = o(this.Qo.getUserId());
let a,
u,
h,
c,
l = this.Vi(t, e);
n = o(this.ft.getUserId());
let a = this.Wi(t, e);
const h = [],
u = [];
let c,
l = null;
if (s.length > 0) {
const t = [];
for (const e of s) {
if (((a = e.Wi()), this.gh.Zn())) {
if (n && !a.user_id) {
c || ((c = {}), (c.events = [])), c.events.push(a);
if (((c = e.Xi()), this.jo.Zn())) {
if (n && !c.user_id) {
l || (l = {}), l.events || (l.events = []), l.events.push(c);
continue;
}
if (o(a.user_id) !== n) {
u || (u = []), u.push(a);
if (o(c.user_id) !== n) {
u.push(c);
continue;
}
}
t.push(a);
t.push(c);
}
t.length > 0 && (l.events = t);
t.length > 0 && (a.events = t);
}

@@ -150,17 +161,15 @@ if (i.length > 0) {

for (const e of i)
this.gh.Zn() && o(e.user_id) !== n
? (h || (h = []), h.push(e))
: t.push(e);
t.length > 0 && (l.attributes = t);
this.jo.Zn() && o(e.user_id) !== n ? h.push(e) : t.push(e);
t.length > 0 && (a.attributes = t);
}
if ((this.Aa(u, h), (l = this.Gs(l, !0)), c)) {
c = this.Gs(c, !1);
const t = { requestData: c, headers: this.Ks(c, T.Qs.Xa) };
if ((this.Ra(u, h), (a = this.Gs(a, !0)), l)) {
l = this.Gs(l, !1);
const t = { requestData: l, headers: this.Ks(l, T.Qs.Sa) };
r.push(t);
}
if (l && !this.ka(l.events, l.attributes, t, e)) return c ? r : null;
const f = { requestData: l, headers: this.Ks(l, T.Qs.Xa) };
if (a && !this.Ba(a.events, a.attributes, t, e)) return l ? r : null;
const f = { requestData: a, headers: this.Ks(a, T.Qs.Sa) };
return r.push(f), r;
}
Aa(t, e) {
Ra(t, e) {
if (t) {

@@ -172,5 +181,5 @@ const e = [];

}
this.Jn.co(e);
this.u.co(e);
}
if (e) for (const t of e) this.Jn.wa(t);
if (e) for (const t of e) this.u.va(t);
}

@@ -182,18 +191,18 @@ ii(t, e) {

qr(t) {
return s.N(r.q.ya, { n: t });
return s.N(r.q.ka, { n: t });
}
Vi(t, e, s) {
Wi(t, e, s) {
const i = {};
t && (i.feed = !0), e && (i.triggers = !0);
const r = null != s ? s : this.Qo.getUserId();
const r = null != s ? s : this.ft.getUserId();
return (
r && (i.user_id = r),
(i.config = { config_time: this.Zo.oi() }),
(i.config = { config_time: this.wt.oi() }),
{ respond_with: i }
);
}
Ca(t) {
Ta(t) {
const e = new Date().valueOf();
let s = Ht.toString(),
i = T.Ea(this.Jn, t);
let s = Ht.toString();
const i = T.Xa(this.u, t);
if (-1 !== i) {

@@ -204,5 +213,5 @@ s = (e - i).toString();

}
Ks(t, e, s) {
const r = [["X-Braze-Api-Key", this.Ko]];
let o = this.Ca(e);
Ks(t, e, s = !1) {
const r = [["X-Braze-Api-Key", this.Xr]],
o = this.Ta(e);
r.push(["X-Braze-Last-Req-Ms-Ago", o]);

@@ -220,4 +229,4 @@ let n = !1;

r.push(["X-Braze-ContentCardsRequest", "true"]);
let t = this.Jn.v(i.k.Fs);
(t && s) || ((t = 0), this.Jn.D(i.k.Fs, t)),
let t = this.u.v(i.k.Fs);
(t && s) || ((t = 0), this.u.D(i.k.Fs, t)),
r.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]),

@@ -230,5 +239,5 @@ (n = !0);

n && r.push(["X-Braze-DataRequest", "true"]),
this.gh.Zn())
this.jo.Zn())
) {
const t = this.gh.au();
const t = this.jo.gh();
null != t && r.push(["X-Braze-Auth-Signature", t]);

@@ -247,10 +256,10 @@ }

si() {
this.gh.si();
this.jo.si();
}
Zs() {
return this.Ho;
return this.Do;
}
addSdkMetadata(t) {
for (const e of t) -1 === this.Ra.indexOf(e) && this.Ra.push(e);
for (const e of t) -1 === this.ha.indexOf(e) && this.ha.push(e);
}
}

@@ -7,27 +7,29 @@ import { STORAGE_KEYS as i } from "./storage-manager.js";

import {
CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT as xt,
CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Vt
CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT as Vt,
CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Gt
} from "../common/constants.js";
export default class Mt {
constructor(t) {
(this.Jn = t),
(this.u = t),
(this.u = t),
(this.tl = new E()),
(this.el = new E()),
(this.sl = new E()),
(this.il = null);
(this.il = null),
(this.rl = null);
}
rl() {
if (null == this.il) {
const t = this.Jn.v(i.k.ll);
this.il = null != t ? Kt.Tn(t) : new Kt();
ll() {
if (null == this.rl) {
const t = this.u.v(i.k.hl);
this.rl = null != t ? Kt.zn(t) : new Kt();
}
return this.il;
return this.rl;
}
oi() {
return this.rl().hl;
return this.ll().ol;
}
ol(t) {
ul(t) {
if (null != t && null != t.config) {
const e = t.config;
if (e.time > this.rl().hl) {
if (e.time > this.ll().ol) {
const t = new Kt(

@@ -44,9 +46,9 @@ e.time,

let s = !1;
null != t.al && this.jn() !== t.al && (s = !0);
null != t.al && this.Un() !== t.al && (s = !0);
let r = !1;
null != t.ul.enabled && this.ni() !== t.ul.enabled && (r = !0);
null != t.ml.enabled && this.ni() !== t.ml.enabled && (r = !0);
let n = !1;
null != t.mi.enabled && this.bi() !== t.mi.enabled && (n = !0),
(this.il = t),
this.Jn.D(i.k.ll, t.ss()),
(this.rl = t),
this.u.D(i.k.hl, t.ss()),
s && this.tl.Et(),

@@ -58,5 +60,5 @@ r && this.el.Et(),

}
Un(t) {
let e = this.tl.lt(t);
return this.ml && this.tl.removeSubscription(this.ml), (this.ml = e), e;
Wn(t) {
const e = this.tl.lt(t);
return this.il && this.tl.removeSubscription(this.il), (this.il = e), e;
}

@@ -70,21 +72,21 @@ $s(t) {

ge(t) {
return -1 !== this.rl().cl.indexOf(t);
return -1 !== this.ll().cl.indexOf(t);
}
hu(t) {
return -1 !== this.rl().gl.indexOf(t);
return -1 !== this.ll().gl.indexOf(t);
}
Dr(t) {
return -1 !== this.rl().fl.indexOf(t);
return -1 !== this.ll().fl.indexOf(t);
}
dl() {
return this.rl().bl;
return this.ll().bl;
}
jn() {
return this.rl().al;
Un() {
return this.ll().al;
}
ni() {
return this.rl().ul.enabled || !1;
return this.ll().ml.enabled || !1;
}
_s() {
const t = this.rl().ul.rate_limit;
const t = this.ll().ml.rate_limit;
return !(!t || null == t.enabled) && t.enabled;

@@ -94,18 +96,18 @@ }

if (!this._s()) return -1;
const t = this.rl().ul.rate_limit;
return null == t.capacity ? xt : t.capacity <= 0 ? -1 : t.capacity;
const t = this.ll().ml.rate_limit;
return null == t.capacity ? Vt : t.capacity <= 0 ? -1 : t.capacity;
}
di() {
if (!this._s()) return -1;
const t = this.rl().ul.rate_limit;
return null == t.refill_rate ? Vt : t.refill_rate <= 0 ? -1 : t.refill_rate;
const t = this.ll().ml.rate_limit;
return null == t.refill_rate ? Gt : t.refill_rate <= 0 ? -1 : t.refill_rate;
}
bi() {
return this.rl().mi.enabled && null == this.Si()
return this.ll().mi.enabled && null == this.Si()
? (s.N(r.q.Is, { e: "Missing feature flag refresh_rate_limit." }), !1)
: this.rl().mi.enabled || !1;
: this.ll().mi.enabled || !1;
}
Si() {
return this.rl().mi.refresh_rate_limit;
return this.ll().mi.refresh_rate_limit;
}
}

@@ -7,63 +7,70 @@ import { STORAGE_KEYS as i } from "../managers/storage-manager.js";

export default class Dt {
constructor(s, t, e, i) {
(this.Jn = s),
(this.Qo = t),
(this.Zo = e),
(this.jh = 1e3),
(i = parseFloat(i)),
isNaN(i) && (i = 1800),
i < this.jh / 1e3 &&
constructor(s, t, i, e) {
(this.u = s),
(this.ft = t),
(this.wt = i),
(this.wl = e),
(this.u = s),
(this.ft = t),
(this.wt = i),
(this.Sl = 1e3),
(null == e || isNaN(e)) && (e = 1800),
e < this.Sl / 1e3 &&
(r.j.info(
"Specified session timeout of " +
i +
e +
"s is too small, using the minimum session timeout of " +
this.jh / 1e3 +
this.Sl / 1e3 +
"s instead."
),
(i = this.jh / 1e3)),
(this.xh = i);
(e = this.Sl / 1e3)),
(this.wl = e);
}
Gh(s, t) {
return new ue(this.Qo.getUserId(), r.q.Fh, s, t.iu, { d: h(s - t.Hh) });
jl(s, t) {
return new ue(this.ft.getUserId(), r.q.xl, s, t.iu, { d: h(s - t.vl) });
}
ba() {
const s = this.Jn.tu(i.eu.Wh);
pa() {
const s = this.u.tu(i.eu.Dl);
return null == s ? null : s.iu;
}
kh() {
El() {
const s = new Date().valueOf(),
t = this.Zo.dl(),
e = this.Jn.v(i.k.qh);
t = this.wt.dl(),
e = this.u.v(i.k.zl);
if (null != e && null == t) return !1;
const n = null == e || s - e > 1e3 * t;
return n && this.Jn.D(i.k.qh, s), n;
let n = !1;
return (
null == e ? (n = !0) : null != t && (n = s - e > 1e3 * t),
n && this.u.D(i.k.zl, s),
n
);
}
yh(s, t) {
return null == t || (!(s - t.Hh < this.jh) && t.Bh < s);
Cl(s, t) {
return null == t || null == t.Gl || (!(s - t.vl < this.Sl) && t.Gl < s);
}
bo() {
const s = new Date().valueOf(),
t = s + 1e3 * this.xh,
e = this.Jn.tu(i.eu.Wh);
if (this.yh(s, e)) {
t = s + 1e3 * this.wl,
e = this.u.tu(i.eu.Dl);
if (this.Cl(s, e)) {
let n = "Generating session start event with time " + s;
if (null != e) {
let s = e.Jh;
s - e.Hh < this.jh && (s = e.Hh + this.Kh),
this.Jn.Qh(this.Gh(s, e)),
let s = e.Nl;
s - e.vl < this.Sl && (s = e.vl + this.Sl),
this.u.Hl(this.jl(s, e)),
(n += " (old session ended " + s + ")");
}
(n += ". Will expire " + t.valueOf()), r.j.info(n);
const o = new _t(r.Z.Y(), t);
this.Jn.Qh(new ue(this.Qo.getUserId(), r.q.Vh, s, o.iu)),
this.Jn.uu(i.eu.Wh, o);
return null == this.Jn.v(i.k.qh) && this.Jn.D(i.k.qh, s), o.iu;
const l = new _t(r.Z.Y(), t);
this.u.Hl(new ue(this.ft.getUserId(), r.q.Wl, s, l.iu)),
this.u.uu(i.eu.Dl, l);
return null == this.u.v(i.k.zl) && this.u.D(i.k.zl, s), l.iu;
}
return (e.Jh = s), (e.Bh = t), this.Jn.uu(i.eu.Wh, e), e.iu;
if (null != e) return (e.Nl = s), (e.Gl = t), this.u.uu(i.eu.Dl, e), e.iu;
}
Xh() {
const s = this.Jn.tu(i.eu.Wh);
kl() {
const s = this.u.tu(i.eu.Dl);
null != s &&
(this.Jn.Yh(i.eu.Wh), this.Jn.Qh(this.Gh(new Date().valueOf(), s)));
(this.u.ql(i.eu.Dl), this.u.Hl(this.jl(new Date().valueOf(), s)));
}
}
import O, { STORAGE_KEYS as i } from "./storage-manager.js";
import r from "../../shared-lib/braze-shared-lib.js";
const Bt = {
qo: (e, o) => {
$o: function(e, o = !1) {
let t = !1;

@@ -9,10 +9,13 @@ try {

try {
localStorage.setItem(i.k._a, !0),
localStorage.getItem(i.k._a) &&
(localStorage.removeItem(i.k._a), (t = !0));
localStorage.setItem(i.k.Ea, "true"),
localStorage.getItem(i.k.Ea) &&
(localStorage.removeItem(i.k.Ea), (t = !0));
} catch (e) {
if (
("QuotaExceededError" !== e.name &&
"NS_ERROR_DOM_QUOTA_REACHED" !== e.name) ||
!(localStorage.length > 0)
!(
e instanceof Error &&
("QuotaExceededError" === e.name ||
"NS_ERROR_DOM_QUOTA_REACHED" === e.name) &&
localStorage.length > 0
)
)

@@ -25,13 +28,17 @@ throw e;

}
const a = Bt.Oa(),
l = new O.xa(e, a && !o, t);
let c = null;
return (c = t ? new O.Ma(e) : new O.Qa()), new O(l, c);
const a = Bt.wa(),
n = new O._a(e, a && !o, t);
let c;
return (c = t ? new O.Oa(e) : new O.xa()), new O(n, c);
},
Oa: () =>
navigator.cookieEnabled ||
("cookie" in document &&
(document.cookie.length > 0 ||
(document.cookie = "test").indexOf.call(document.cookie, "test") > -1))
wa: function() {
return (
navigator.cookieEnabled ||
("cookie" in document &&
(document.cookie.length > 0 ||
(document.cookie = "test").indexOf.call(document.cookie, "test") >
-1))
);
}
};
export default Bt;

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

import V from "../util/browser-detector.js";
import ue from "../models/braze-event.js";

@@ -12,24 +11,26 @@ import _t from "../models/identifier.js";

import { User } from "../User/index.js";
import V from "../util/browser-detector.js";
import { getErrorMessage as ei } from "../util/error-utils.js";
export const STORAGE_KEYS = {
eu: {
su: "ab.storage.userId",
oa: "ab.storage.deviceId",
Wh: "ab.storage.sessionId"
Xo: "ab.storage.deviceId",
Dl: "ab.storage.sessionId"
},
k: {
_a: "ab.test",
Ea: "ab.test",
Ia: "ab.storage.events",
Ka: "ab.storage.attributes",
Ya: "ab.storage.attributes.anonymous_user",
ma: "ab.storage.device",
ga: "ab.storage.sdk_metadata",
qa: "ab.storage.session_id_for_cached_metadata",
xn: "ab.storage.pushToken",
la: "ab.storage.device",
ua: "ab.storage.sdk_metadata",
ma: "ab.storage.session_id_for_cached_metadata",
Nn: "ab.storage.pushToken",
ki: "ab.storage.newsFeed",
Ai: "ab.storage.lastNewsFeedRefresh",
L: "ab.storage.cardImpressions",
ll: "ab.storage.serverConfig",
hl: "ab.storage.serverConfig",
Na: "ab.storage.triggers",
Ga: "ab.storage.triggers.ts",
qh: "ab.storage.messagingSessionStart",
Ca: "ab.storage.triggers.ts",
zl: "ab.storage.messagingSessionStart",
Zt: "ab.storage.cc",

@@ -43,6 +44,6 @@ vs: "ab.storage.ccLastFullSync",

G: "ab.storage.ccDismissals",
Ua: "ab.storage.lastDisplayedTriggerTimesById",
La: "ab.storage.lastDisplayedTriggerTime",
Fa: "ab.storage.triggerFireInstancesById",
bu: "ab.storage.signature",
Ga: "ab.storage.lastDisplayedTriggerTimesById",
Ma: "ab.storage.lastDisplayedTriggerTime",
ya: "ab.storage.triggerFireInstancesById",
Fh: "ab.storage.signature",
Fs: "ab.storage.brazeSyncRetryCount",

@@ -52,38 +53,44 @@ Ss: "ab.storage.sdkVersion",

$i: "ab.storage.ffLastRefreshAt",
Pa: "ab.storage.lastReqToEndpoint"
Ua: "ab.storage.lastReqToEndpoint"
},
re: "ab.optOut"
ne: "ab.optOut"
};
export default class O {
constructor(t, e) {
(this.Ja = t), (this.Va = e);
(this.La = t), (this.Fa = e), (this.La = t), (this.Fa = e);
}
qo(t) {
const e = oo(STORAGE_KEYS.eu),
s = new O.ee(t);
for (const t of e) s.remove(STORAGE_KEYS.eu[t]);
}
uu(t, e) {
let s = e;
null != e && e instanceof _t && (s = e.ss()), this.Ja.store(t, s);
let s = null;
null != e && e instanceof _t && (s = e.ss()), this.La.store(t, s);
}
Ha(t) {
Pa(t) {
const e = this.tu(t);
null != e && ((e.Jh = new Date().valueOf()), this.uu(t, e));
null != e && ((e.Nl = new Date().valueOf()), this.uu(t, e));
}
tu(t) {
return _t.Tn(this.Ja.wr(t));
return _t.zn(this.La.wr(t));
}
Yh(t) {
this.Ja.remove(t);
ql(t) {
this.La.remove(t);
}
co(t) {
let e;
if (null == t || 0 === t.length) return !1;
p(t) || (t = [t]);
let e = this.Va.wr(STORAGE_KEYS.k.Ia);
(null != e && p(e)) || (e = []);
for (let s = 0; s < t.length; s++) e.push(t[s].ss());
return this.Va.store(STORAGE_KEYS.k.Ia, e);
e = p(t) ? t : [t];
let s = this.Fa.wr(STORAGE_KEYS.k.Ia);
(null != s && p(s)) || (s = []);
for (let t = 0; t < e.length; t++) s.push(e[t].ss());
return this.Fa.store(STORAGE_KEYS.k.Ia, s);
}
Qh(t) {
Hl(t) {
return null != t && this.co([t]);
}
Wa() {
let t = this.Va.wr(STORAGE_KEYS.k.Ia);
this.Va.remove(STORAGE_KEYS.k.Ia), null == t && (t = []);
Ja() {
let t = this.Fa.wr(STORAGE_KEYS.k.Ia);
this.Fa.remove(STORAGE_KEYS.k.Ia), null == t && (t = []);
const e = [];

@@ -94,3 +101,3 @@ let s = !1,

for (let s = 0; s < t.length; s++)
ue.Za(t[s]) ? e.push(ue.Tn(t[s])) : (o = s);
ue.Qa(t[s]) ? e.push(ue.zn(t[s])) : (o = s);
else s = !0;

@@ -119,3 +126,3 @@ if (s || null != o) {

"STORAGE_KEYS.OBJECTS"
) && this.Va.store(t, e)
) && this.Fa.store(t, e)
);

@@ -130,3 +137,3 @@ }

"STORAGE_KEYS.OBJECTS"
) && this.Va.wr(t)
) && this.Fa.wr(t)
);

@@ -141,10 +148,5 @@ }

"STORAGE_KEYS.OBJECTS"
) && (this.Va.remove(t), !0)
) && (this.Fa.remove(t), !0)
);
}
xo(t) {
const e = oo(STORAGE_KEYS.eu),
s = new O.ee(t);
for (const t of e) s.remove(STORAGE_KEYS.eu[t]);
}
clearData() {

@@ -155,72 +157,73 @@ const t = oo(STORAGE_KEYS.eu),

const s = t[e];
this.Ja.remove(STORAGE_KEYS.eu[s]);
this.La.remove(STORAGE_KEYS.eu[s]);
}
for (let t = 0; t < e.length; t++) {
const s = e[t];
this.Va.remove(STORAGE_KEYS.k[s]);
this.Fa.remove(STORAGE_KEYS.k[s]);
}
}
$a(t) {
Va(t) {
return t || STORAGE_KEYS.k.Ya;
}
wa(t) {
let e = this.Va.wr(STORAGE_KEYS.k.Ka);
va(t) {
let e = this.Fa.wr(STORAGE_KEYS.k.Ka);
null == e && (e = {});
const s = this.$a(t[User.Hn]);
for (let r in t)
r === User.Hn ||
(null != e[s] && null != e[s][r]) ||
this.mu(t[User.Hn], r, t[r]);
const s = this.Va(t[User.Kn]),
r = e[s];
for (const o in t)
o !== User.Kn &&
(null == e[s] || (r && null == r[o])) &&
this.mu(t[User.Kn], o, t[o]);
}
mu(t, e, s) {
let r = this.Va.wr(STORAGE_KEYS.k.Ka);
let r = this.Fa.wr(STORAGE_KEYS.k.Ka);
null == r && (r = {});
const o = this.$a(t);
const o = this.Va(t);
let n = r[o];
if (
(null == n && ((n = {}), null != t && (n[User.Hn] = t)), e === User.lu)
(null == n && ((n = {}), null != t && (n[User.Kn] = t)), e === User.lu)
) {
null == n[e] && (n[e] = {});
for (let t in s) n[e][t] = s[t];
} else n[e] = s;
return (r[o] = n), this.Va.store(STORAGE_KEYS.k.Ka, r);
for (const t in s) n[e][t] = s[t];
} else null != s && (n[e] = s);
return (r[o] = n), this.Fa.store(STORAGE_KEYS.k.Ka, r);
}
tE() {
const t = this.Va.wr(STORAGE_KEYS.k.Ka);
this.Va.remove(STORAGE_KEYS.k.Ka);
Ha() {
const t = this.Fa.wr(STORAGE_KEYS.k.Ka);
this.Fa.remove(STORAGE_KEYS.k.Ka);
const e = [];
for (let s in t) null != t[s] && e.push(t[s]);
for (const s in t) null != t[s] && e.push(t[s]);
return e;
}
ou(t) {
const e = this.Va.wr(STORAGE_KEYS.k.Ka);
const e = this.Fa.wr(STORAGE_KEYS.k.Ka);
if (null != e) {
const s = this.$a(null),
const s = this.Va(null),
r = e[s];
null != r &&
((e[s] = void 0),
this.Va.store(STORAGE_KEYS.k.Ka, e),
(r[User.Hn] = t),
this.wa(r));
this.Fa.store(STORAGE_KEYS.k.Ka, e),
(r[User.Kn] = t),
this.va(r));
}
const s = this.tu(STORAGE_KEYS.eu.Wh);
const s = this.tu(STORAGE_KEYS.eu.Dl);
let r = null;
null != s && (r = s.iu);
const o = this.Wa();
const o = this.Ja();
if (null != o)
for (let e = 0; e < o.length; e++) {
const s = o[e];
null == s.userId && s.sessionId == r && (s.userId = t), this.Qh(s);
null == s.userId && s.sessionId == r && (s.userId = t), this.Hl(s);
}
}
eE() {
return this.Va.sE;
Wa() {
return this.Fa.Za;
}
}
O.Ma = class {
(O.Oa = class {
constructor(t) {
(this.Ko = t), (this.sE = V.rE() ? 3 : 10);
(this.Xr = t), (this.Xr = t), (this.Za = V.$a() ? 3 : 10);
}
oE(t) {
return t + "." + this.Ko;
_l(t) {
return t + "." + this.Xr;
}

@@ -230,5 +233,5 @@ store(t, e) {

try {
return localStorage.setItem(this.oE(t), JSON.stringify(s)), !0;
return localStorage.setItem(this._l(t), JSON.stringify(s)), !0;
} catch (t) {
return r.j.info("Storage failure: " + t.message), !1;
return r.j.info("Storage failure: " + ei(t)), !1;
}

@@ -238,6 +241,7 @@ }

try {
const e = JSON.parse(localStorage.getItem(this.oE(t)));
return null == e ? null : e.v;
let e = null;
const s = localStorage.getItem(this._l(t));
return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
} catch (t) {
return r.j.info("Storage retrieval failure: " + t.message), null;
return r.j.info("Storage retrieval failure: " + ei(t)), null;
}

@@ -247,169 +251,177 @@ }

try {
localStorage.removeItem(this.oE(t));
localStorage.removeItem(this._l(t));
} catch (t) {
return r.j.info("Storage removal failure: " + t.message), !1;
return r.j.info("Storage removal failure: " + ei(t)), !1;
}
}
};
O.ee = class {
constructor(t, e) {
(this.Ko = t), (this.nE = this.aE()), (this.iE = 576e3), (this.EE = !!e);
}
oE(t) {
return null != this.Ko ? t + "." + this.Ko : t;
}
aE() {
let t = 0,
e = document.location.hostname;
const s = e.split("."),
r = "ab._gd";
for (; t < s.length - 1 && -1 === document.cookie.indexOf(r + "=" + r); )
t++,
(e = "." + s.slice(-1 - t).join(".")),
(document.cookie = r + "=" + r + ";domain=" + e + ";");
return (
(document.cookie =
r + "=;expires=" + new Date(0).toGMTString() + ";domain=" + e + ";"),
e
);
}
ne() {
const t = new Date();
return t.setTime(t.getTime() + 60 * this.iE * 1e3), t.getFullYear();
}
lE() {
const t = Lt(STORAGE_KEYS.eu),
e = document.cookie.split(";");
for (let s = 0; s < e.length; s++) {
let r = e[s];
for (; " " === r.charAt(0); ) r = r.substring(1);
let o = !1;
for (let e = 0; e < t.length; e++)
if (0 === r.indexOf(t[e])) {
o = !0;
break;
}),
(O.xa = class {
constructor() {
(this.Tl = {}), (this.Al = 5242880), (this.Za = 3);
}
store(t, e) {
const s = { value: e },
o = this.Rl(e);
return o > this.Al
? (r.j.info(
"Storage failure: object is ≈" +
o +
" bytes which is greater than the max of " +
this.Al
),
!1)
: ((this.Tl[t] = s), !0);
}
Rl(t) {
const e = [],
s = [t];
let r = 0;
for (; s.length; ) {
const t = s.pop();
if ("boolean" == typeof t) r += 4;
else if ("string" == typeof t) r += 2 * t.length;
else if ("number" == typeof t) r += 8;
else if ("object" == typeof t && -1 === e.indexOf(t)) {
let r, o;
e.push(t);
for (const e in t) (o = t), (r = e), s.push(o[r]);
}
if (o) {
const t = r.split("=")[0];
-1 === t.indexOf("." + this.Ko) && this.SE(t);
}
return r;
}
}
store(t, e) {
this.lE();
const s = new Date();
s.setTime(s.getTime() + 60 * this.iE * 1e3);
const o = "expires=" + s.toUTCString(),
n = "domain=" + this.nE;
let a;
a = this.EE ? e : encodeURIComponent(JSON.stringify(e));
const i = this.oE(t) + "=" + a + ";" + o + ";" + n + ";path=/";
return i.length >= 4093
? (r.j.info(
"Storage failure: string is " +
i.length +
" chars which is too large to store as a cookie."
),
!1)
: ((document.cookie = i), !0);
}
wr(t) {
const e = [],
s = this.oE(t) + "=",
o = document.cookie.split(";");
for (let n = 0; n < o.length; n++) {
let a = o[n];
for (; " " === a.charAt(0); ) a = a.substring(1);
if (0 === a.indexOf(s))
try {
let t;
(t = this.EE
? a.substring(s.length, a.length)
: JSON.parse(decodeURIComponent(a.substring(s.length, a.length)))),
e.push(t);
} catch (e) {
return (
r.j.info("Storage retrieval failure: " + e.message),
this.remove(t),
null
);
wr(t) {
const e = this.Tl[t];
return null == e ? null : e.value;
}
remove(t) {
this.Tl[t] = null;
}
}),
(O.ee = class {
constructor(t, e) {
(this.Xr = t),
(this.Ol = e),
(this.Xr = t),
(this.Il = this.Kl()),
(this.Yl = 576e3),
(this.Ol = !!e);
}
_l(t) {
return null != this.Xr ? t + "." + this.Xr : t;
}
Kl() {
let t = 0,
e = document.location.hostname;
const s = e.split("."),
r = "ab._gd";
for (; t < s.length - 1 && -1 === document.cookie.indexOf(r + "=" + r); )
t++,
(e = "." + s.slice(-1 - t).join(".")),
(document.cookie = r + "=" + r + ";domain=" + e + ";");
return (
(document.cookie =
r + "=;expires=" + new Date(0).toUTCString() + ";domain=" + e + ";"),
e
);
}
re() {
const t = new Date();
return t.setTime(t.getTime() + 60 * this.Yl * 1e3), t.getFullYear();
}
Ml() {
const t = Lt(STORAGE_KEYS.eu),
e = document.cookie.split(";");
for (let s = 0; s < e.length; s++) {
let r = e[s];
for (; " " === r.charAt(0); ) r = r.substring(1);
let o = !1;
for (let e = 0; e < t.length; e++)
if (0 === r.indexOf(t[e])) {
o = !0;
break;
}
if (o) {
const t = r.split("=")[0];
-1 === t.indexOf("." + this.Xr) && this.yl(t);
}
}
}
return e.length > 0 ? e[e.length - 1] : null;
}
remove(t) {
this.SE(this.oE(t));
}
SE(t) {
const e = t + "=;expires=" + new Date(0).toGMTString();
(document.cookie = e), (document.cookie = e + ";path=/");
const s = e + ";domain=" + this.nE;
(document.cookie = s), (document.cookie = s + ";path=/");
}
};
O.Qa = class {
constructor() {
(this._E = {}), (this.uE = 5242880), (this.sE = 3);
}
store(t, e) {
const s = { value: e },
o = this.cE(e);
return o > this.uE
? (r.j.info(
"Storage failure: object is ≈" +
o +
" bytes which is greater than the max of " +
this.uE
),
!1)
: ((this._E[t] = s), !0);
}
cE(t) {
const e = [],
s = [t];
let r = 0;
for (; s.length; ) {
const t = s.pop();
if ("boolean" == typeof t) r += 4;
else if ("string" == typeof t) r += 2 * t.length;
else if ("number" == typeof t) r += 8;
else if ("object" == typeof t && -1 === e.indexOf(t)) {
e.push(t);
for (let e in t) s.push(t[e]);
store(t, e) {
this.Ml();
const s = new Date();
s.setTime(s.getTime() + 60 * this.Yl * 1e3);
const o = "expires=" + s.toUTCString(),
n = "domain=" + this.Il;
let i;
i = this.Ol ? e : encodeURIComponent(JSON.stringify(e));
const a = this._l(t) + "=" + i + ";" + o + ";" + n + ";path=/";
return a.length >= 4093
? (r.j.info(
"Storage failure: string is " +
a.length +
" chars which is too large to store as a cookie."
),
!1)
: ((document.cookie = a), !0);
}
wr(t) {
const e = [],
s = this._l(t) + "=",
o = document.cookie.split(";");
for (let n = 0; n < o.length; n++) {
let i = o[n];
for (; " " === i.charAt(0); ) i = i.substring(1);
if (0 === i.indexOf(s))
try {
let t;
(t = this.Ol
? i.substring(s.length, i.length)
: JSON.parse(
decodeURIComponent(i.substring(s.length, i.length))
)),
e.push(t);
} catch (e) {
return (
r.j.info("Storage retrieval failure: " + ei(e)),
this.remove(t),
null
);
}
}
return e.length > 0 ? e[e.length - 1] : null;
}
return r;
}
wr(t) {
const e = this._E[t];
return null == e ? null : e.value;
}
remove(t) {
this._E[t] = null;
}
};
O.xa = class {
constructor(t, e, s) {
(this.Ko = t),
(this.TE = []),
e && this.TE.push(new O.ee(t)),
s && this.TE.push(new O.Ma(t)),
this.TE.push(new O.Qa(t));
}
store(t, e) {
let s = !0;
for (let r = 0; r < this.TE.length; r++) s = this.TE[r].store(t, e) && s;
return s;
}
wr(t) {
for (let e = 0; e < this.TE.length; e++) {
const s = this.TE[e].wr(t);
if (null != s) return s;
remove(t) {
this.yl(this._l(t));
}
return null;
}
remove(t) {
new O.ee(this.Ko).remove(t);
for (let e = 0; e < this.TE.length; e++) this.TE[e].remove(t);
}
};
yl(t) {
const e = t + "=;expires=" + new Date(0).toUTCString();
(document.cookie = e), (document.cookie = e + ";path=/");
const s = e + ";domain=" + this.Il;
(document.cookie = s), (document.cookie = s + ";path=/");
}
}),
(O._a = class {
constructor(t, e, s) {
(this.Xr = t),
(this.Ul = []),
e && this.Ul.push(new O.ee(t)),
s && this.Ul.push(new O.Oa(t)),
this.Ul.push(new O.xa());
}
store(t, e) {
let s = !0;
for (let r = 0; r < this.Ul.length; r++) s = this.Ul[r].store(t, e) && s;
return s;
}
wr(t) {
for (let e = 0; e < this.Ul.length; e++) {
const s = this.Ul[e].wr(t);
if (null != s) return s;
}
return null;
}
remove(t) {
new O.ee(this.Xr).remove(t);
for (let e = 0; e < this.Ul.length; e++) this.Ul[e].remove(t);
}
});
import r from "../../shared-lib/braze-shared-lib.js";
export default class E {
constructor() {
this.zo = {};
this.Se = {};
}

@@ -9,18 +9,21 @@ lt(t) {

const i = r.Z.Y();
return (this.zo[i] = t), i;
return (this.Se[i] = t), i;
}
removeSubscription(t) {
delete this.zo[t];
delete this.Se[t];
}
removeAllSubscriptions() {
this.zo = {};
this.Se = {};
}
fu() {
return Object.keys(this.zo).length;
tc() {
return Object.keys(this.Se).length;
}
Et(t) {
const i = [];
for (let r in this.zo) i.push(this.zo[r](t));
for (const r in this.Se) {
const s = this.Se[r];
i.push(s(t));
}
return i;
}
}
export default {
Da: "invalid_api_key",
Sa: "blacklisted",
va: "no_device_identifier",
Ba: "invalid_json_response",
za: "empty_response",
ba: "invalid_api_key",
Aa: "blacklisted",
za: "no_device_identifier",
qa: "invalid_json_response",
ga: "empty_response",
__: "sdk_auth_error"
};

@@ -10,2 +10,7 @@ import { isObject as Ct } from "../util/code-utils.js";

(this.type = i),
(this.time = s),
(this.sessionId = r),
(this.data = e),
(this.userId = t),
(this.type = i),
(this.time = Jt(s)),

@@ -15,3 +20,3 @@ (this.sessionId = r),

}
Wi() {
Xi() {
const t = {

@@ -21,3 +26,4 @@ name: this.type,

data: this.data || {},
session_id: this.sessionId
session_id: this.sessionId,
user_id: void 0
};

@@ -38,8 +44,8 @@ return null != this.userId && (t.user_id = this.userId), t;

}
static Za(t) {
static Qa(t) {
return null != t && Ct(t) && null != t.t && "" !== t.t;
}
static Tn(t) {
static zn(t) {
return new ue(t.u, t.t, t.ts, t.s, t.d);
}
}

@@ -1,23 +0,15 @@

import DeviceProperties from "../Core/device-properties.js";
export default class ge {
export default class xt {
constructor(s) {
this.id = s;
(this.id = s), (this.id = s);
}
Wi() {
Xi() {
const s = {};
return (
null != this[DeviceProperties.BROWSER] &&
(s.browser = this[DeviceProperties.BROWSER]),
null != this[DeviceProperties.BROWSER_VERSION] &&
(s.browser_version = this[DeviceProperties.BROWSER_VERSION]),
null != this[DeviceProperties.OS] &&
(s.os_version = this[DeviceProperties.OS]),
null != this[DeviceProperties.RESOLUTION] &&
(s.resolution = this[DeviceProperties.RESOLUTION]),
null != this[DeviceProperties.LANGUAGE] &&
(s.locale = this[DeviceProperties.LANGUAGE]),
null != this[DeviceProperties.TIME_ZONE] &&
(s.time_zone = this[DeviceProperties.TIME_ZONE]),
null != this[DeviceProperties.USER_AGENT] &&
(s.user_agent = this[DeviceProperties.USER_AGENT]),
null != this.browser && (s.browser = this.browser),
null != this.Yo && (s.browser_version = this.Yo),
null != this.os && (s.os_version = this.os),
null != this.resolution && (s.resolution = this.resolution),
null != this.language && (s.locale = this.language),
null != this.timeZone && (s.time_zone = this.timeZone),
null != this.userAgent && (s.user_agent = this.userAgent),
s

@@ -24,0 +16,0 @@ );

import r from "../../shared-lib/braze-shared-lib.js";
export default class _t {
constructor(t, e, s) {
null == t && (t = r.Z.Y()),
(s = parseInt(s)),
(isNaN(s) || 0 === s) && (s = new Date().valueOf()),
constructor(t, i, s) {
(this.iu = t),
null == t && (t = r.Z.Y()),
!s || isNaN(s) ? (this.vl = new Date().valueOf()) : (this.vl = s),
(this.iu = t),
(this.Hh = s),
(this.Jh = new Date().valueOf()),
(this.Bh = e);
(this.Nl = new Date().valueOf()),
(this.Gl = i);
}
ss() {
return { g: this.iu, e: this.Bh, c: this.Hh, l: this.Jh };
return { g: this.iu, e: this.Gl, c: this.vl, l: this.Nl };
}
static Tn(t) {
static zn(t) {
if (null == t || null == t.g) return null;
const e = new _t(t.g, t.e, t.c);
return (e.Jh = t.l), e;
const i = new _t(t.g, t.e, t.c);
return (i.Nl = t.l), i;
}
}
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
export default class ti {
constructor(t, i, l, s, u) {
(this.endpoint = t || null),
(this.Nn = i || null),
(this.publicKey = l || null),
(this.zl = s || null),
(this.al = u || null);
constructor(t, i, s, l, h) {
(this.endpoint = t),
(this.Tn = i),
(this.publicKey = s),
(this.Vl = l),
(this.al = h),
(this.endpoint = t || null),
(this.Tn = i || null),
(this.publicKey = s || null),
(this.Vl = l || null),
(this.al = h || null);
}

@@ -13,11 +18,11 @@ ss() {

e: this.endpoint,
c: this.Nn,
c: this.Tn,
p: this.publicKey,
u: this.zl,
u: this.Vl,
v: this.al
};
}
static Tn(t) {
static zn(t) {
return new ti(t.e, w(t.c), t.p, t.u, t.v);
}
}
export default class t {
constructor(t, s) {
(this.O = !!t), (this.ve = s || []);
constructor(t = !1, s = []) {
(this.O = t), (this.ve = s), (this.O = t), (this.ve = s);
}

@@ -5,0 +5,0 @@ S(t) {

export default class Kt {
constructor(t, s, i, h, l, e, r, u) {
(this.hl = t || 0),
(this.cl = s || []),
(this.gl = i || []),
(this.fl = h || []),
(this.bl = l),
(null != l && "" !== l) || (this.bl = null),
(this.al = e || null),
(this.ul = r || {}),
(this.mi = u || {});
constructor(
t = 0,
i = [],
s = [],
h = [],
e = null,
l = null,
r = { enabled: !1 },
a = { enabled: !1, refresh_rate_limit: -1 }
) {
(this.ol = t),
(this.cl = i),
(this.gl = s),
(this.fl = h),
(this.bl = e),
(this.al = l),
(this.ml = r),
(this.mi = a),
(this.ol = t),
(this.cl = i),
(this.gl = s),
(this.fl = h),
(this.bl = e),
(this.al = l),
(this.ml = r),
(this.mi = a);
}
ss() {
return {
s: "4.8.0",
l: this.hl,
s: "4.8.1",
l: this.ol,
e: this.cl,

@@ -22,12 +38,12 @@ a: this.gl,

v: this.al,
c: this.ul,
c: this.ml,
f: this.mi
};
}
static Tn(t) {
let s = t.l;
static zn(t) {
let i = t.l;
return (
"4.8.0" !== t.s && (s = 0), new Kt(s, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
"4.8.1" !== t.s && (i = 0), new Kt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f)
);
}
}

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

import yt from "./utils/push-utils.js";
import { getErrorMessage as ei } from "../util/error-utils.js";
export default class na {
constructor(i, t, e, s, r, n, o, u, h, a) {
(this.Wr = i),
(this.Yr = t),
(this.Xr = e),
(this.Zr = r),
(this.sn = n),
(this.Yr = i),
(this.Xr = t),
(this.Zr = e),
(this.sn = r),
(this.rn = n),
(this.wt = o),
(this.rn = u),
(this.on = h),
(this.on = u),
(this.un = h),
(this.u = a),
(this.Wr = i),
(this.Yr = t),
(this.Xr = e),
(this.un = s + "/safari/" + t),
(this.Zr = r || "/service-worker.js"),
(this.sn = n),
(this.Yr = i),
(this.Xr = t),
(this.Zr = e),
(this.hn = s + "/safari/" + t),
(this.sn = r || "/service-worker.js"),
(this.rn = n),
(this.wt = o),
(this.rn = u || !1),
(this.on = h || !1),
(this.on = u || !1),
(this.un = h || !1),
(this.u = a),
(this.hn = yt.an()),
(this.cn = yt.fn());
(this.an = yt.cn()),
(this.fn = yt.ln());
}
ln() {
return this.on;
dn() {
return this.un;
}
dn(i, t, e, s, n) {
pn(i, t, e, s, n) {
i.unsubscribe()
.then(i => {
i
? this.pn(t, e, s, n)
? this.bn(t, e, s, n)
: (r.j.error("Failed to unsubscribe device from push."),

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

}
bn(i, t, e) {
mn(i, t, e) {
const s = (i => {

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

return (
e.mn &&
-1 === i.endpoint.indexOf(e.mn) &&
(t = i.endpoint + "/" + e.mn),
e.yn &&
-1 === i.endpoint.indexOf(e.yn) &&
(t = i.endpoint + "/" + e.yn),
t

@@ -74,3 +75,3 @@ );

} catch (i) {
if (i instanceof Error && "invalid arguments" !== i.message) throw i;
if ("invalid arguments" !== ei(i)) throw i;
}

@@ -88,12 +89,12 @@ const o = (i => {

})(i);
this.Wr && this.Wr.yn(s, t, r, n, o),
this.Yr && this.Yr.gn(s, t, r, n, o),
s && "function" == typeof e && e(s, r, n);
}
gn() {
this.Wr && this.Wr.wn(!0);
wn() {
this.Yr && this.Yr.vn(!0);
}
vn(i, t) {
this.Wr && this.Wr.wn(!1), r.j.info(i), "function" == typeof t && t(!1);
kn(i, t) {
this.Yr && this.Yr.vn(!1), r.j.info(i), "function" == typeof t && t(!1);
}
kn(i, t, e, s) {
Pn(i, t, e, s) {
var n;

@@ -103,8 +104,8 @@ if ("default" === t.permission)

window.safari.pushNotification.requestPermission(
this.un,
this.hn,
i,
{
api_key: this.Yr,
api_key: this.Xr,
device_id:
(null === (n = this.Xr) || void 0 === n ? void 0 : n.te().id) ||
(null === (n = this.Zr) || void 0 === n ? void 0 : n.te().id) ||
""

@@ -114,15 +115,15 @@ },

"granted" === t.permission &&
this.Wr &&
this.Wr.setPushNotificationSubscriptionType(
this.Yr &&
this.Yr.setPushNotificationSubscriptionType(
User.NotificationSubscriptionTypes.OPTED_IN
),
this.kn(i, t, e, s);
this.Pn(i, t, e, s);
}
);
} catch (i) {
this.vn("Could not request permission for push: " + i, s);
this.kn("Could not request permission for push: " + i, s);
}
else
"denied" === t.permission
? this.vn(
? this.kn(
"The user has blocked notifications from this site, or Safari push is not configured in the Braze dashboard.",

@@ -133,3 +134,3 @@ s

(r.j.info("Device successfully subscribed to push."),
this.bn(t.deviceToken, new Date(), e));
this.mn(t.deviceToken, new Date(), e));
}

@@ -159,3 +160,3 @@ requestPermission(i, t, e) {

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

@@ -167,3 +168,3 @@ null != t && (n.applicationServerKey = t),

r.j.info("Device successfully subscribed to push."),
this.bn(i, new Date(), e);
this.mn(i, new Date(), e);
})

@@ -178,6 +179,6 @@ .catch(i => {

}
Pn() {
return this.rn
Dn() {
return this.on
? navigator.serviceWorker.getRegistration()
: navigator.serviceWorker.register(this.Zr).then(() =>
: navigator.serviceWorker.register(this.sn).then(() =>
navigator.serviceWorker.ready.then(

@@ -195,4 +196,4 @@ i => (

}
Dn(i) {
this.rn ||
Sn(i) {
this.on ||
(i.unregister(), r.j.info("Service worker successfully unregistered."));

@@ -202,6 +203,6 @@ }

if (!yt.isPushSupported())
return r.j.info(na.Sn), void ("function" == typeof e && e(!1));
if (this.hn) {
if (!this.rn && null != window.location) {
let i = this.Zr;
return r.j.info(na.An), void ("function" == typeof e && e(!1));
if (this.an) {
if (!this.on && null != window.location) {
let i = this.sn;
-1 === i.indexOf(window.location.host) &&

@@ -212,3 +213,3 @@ (i = window.location.host + i),

const t = i.substr(0, i.lastIndexOf("/") + 1);
if (0 !== Z.An().indexOf(t))
if (0 !== Z.jn().indexOf(t))
return (

@@ -226,7 +227,7 @@ r.j.error(

if (yt.isPushBlocked())
return void this.vn(
return void this.kn(
"Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
e
);
if (this.wt && !this.wt.jn() && 0 === this.wt.oi())
if (this.wt && !this.wt.Un() && 0 === this.wt.oi())
return (

@@ -236,3 +237,3 @@ r.j.info(

),
void this.wt.Un(() => {
void this.wt.Wn(() => {
this.subscribe(t, e);

@@ -256,7 +257,7 @@ })

!o &&
this.Wr &&
this.Wr.setPushNotificationSubscriptionType(
this.Yr &&
this.Yr.setPushNotificationSubscriptionType(
User.NotificationSubscriptionTypes.OPTED_IN
),
this.Pn()
this.Dn()
.then(s => {

@@ -276,4 +277,4 @@ if (null == s)

(this.wt &&
null != this.wt.jn() &&
(o = r._n.Wn(this.wt.jn())),
null != this.wt.Un() &&
(o = r.xn._n(this.wt.Un())),
n)

@@ -284,6 +285,6 @@ ) {

a = null;
if ((this.u && (u = this.u.v(i.k.xn)), u && !p(u))) {
if ((this.u && (u = this.u.v(i.k.Nn)), u && !p(u))) {
let i;
try {
i = ti.Tn(u).Nn;
i = ti.zn(u).Tn;
} catch (t) {

@@ -312,3 +313,3 @@ i = null;

),
this.dn(n, s, o, t, e))
this.pn(n, s, o, t, e))
: n.expirationTime &&

@@ -320,5 +321,5 @@ new Date(n.expirationTime).valueOf() <=

),
this.dn(n, s, o, t, e))
this.pn(n, s, o, t, e))
: u && p(u)
? this.dn(n, s, o, t, e)
? this.pn(n, s, o, t, e)
: null == a

@@ -328,3 +329,3 @@ ? (r.j.info(

),
this.dn(n, s, o, t, e))
this.pn(n, s, o, t, e))
: a.valueOf() <= new Date().valueOf()

@@ -334,8 +335,8 @@ ? (r.j.info(

),
this.dn(n, s, o, t, e))
this.pn(n, s, o, t, e))
: (r.j.info(
"Device already subscribed to push, sending existing subscription to backend."
),
this.bn(n, h, t));
} else this.pn(s, o, t, e);
this.mn(n, h, t));
} else this.bn(s, o, t, e);
})

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

this.requestPermission(u, n, s);
} else if (this.cn) {
if (null == this.sn || "" === this.sn)
} else if (this.fn) {
if (null == this.rn || "" === this.rn)
return (

@@ -362,4 +363,4 @@ r.j.error(

);
const i = window.safari.pushNotification.permission(this.sn);
this.kn(this.sn, i, t, e);
const i = window.safari.pushNotification.permission(this.rn);
this.Pn(this.rn, i, t, e);
}

@@ -369,4 +370,4 @@ }

if (!yt.isPushSupported())
return r.j.info(na.Sn), void ("function" == typeof t && t());
this.hn
return r.j.info(na.An), void ("function" == typeof t && t());
this.an
? navigator.serviceWorker.getRegistration().then(e => {

@@ -378,3 +379,3 @@ e

s &&
(this.gn(),
(this.wn(),
s

@@ -392,3 +393,3 @@ .unsubscribe()

"function" == typeof t && t()),
this.Dn(e);
this.Sn(e);
})

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

})
: this.cn &&
(this.gn(),
: this.fn &&
(this.wn(),
r.j.info("Device unsubscribed from push."),

@@ -414,2 +415,2 @@ "function" == typeof i && i());

}
na.Sn = "Push notifications are not supported in this browser.";
na.An = "Push notifications are not supported in this browser.";
const yt = {
an: () =>
cn: () =>
"serviceWorker" in navigator &&

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

"PushManager" in window,
fn: () =>
ln: () =>
"safari" in window &&

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

"function" == typeof window.safari.pushNotification.requestPermission,
isPushSupported: () => yt.an() || yt.fn(),
isPushSupported: () => yt.cn() || yt.ln(),
isPushBlocked: () => {

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

"granted" === window.Notification.permission,
Ki: () =>
Li: () =>
!yt.isPushBlocked() && yt.isPushSupported() && !yt.isPushPermissionGranted()
};
export default yt;

@@ -13,28 +13,28 @@ import C from "./util/net.js";

constructor(t, s, i, e, n, l, h, o, r, u) {
(this.Ko = t),
(this.Ho = s),
(this.wl = 0),
(this.kl = h.eE()),
(this.yl = null),
(this.fh = i),
(this.Xo = e),
(this.Qo = n),
(this.Zo = l),
(this.Jn = h),
(this.gh = r),
(this.wh = u),
(this.vl = o),
(this.jl = new E()),
(this.Sl = 50);
(this.$l = t),
(this.Fl = s),
(this.Ll = 0),
(this.Pl = h.Wa()),
(this.Jl = null),
(this.Bl = i),
(this.Ql = e),
(this.Xl = n),
(this.Zl = l),
(this.yh = h),
(this.$h = r),
(this.qh = u),
(this.Ph = o),
(this.Jh = new E()),
(this.Kh = 50);
}
$l(t, s) {
return !t && !s && this.gh.Fu() >= this.Sl;
Wh(t, s) {
return !t && !s && this.$h.xh() >= this.Kh;
}
ql(t) {
let s = this.fh.kh();
Bh(t) {
let s = this.Bl.El();
if (t.length > 0) {
const i = this.Qo.getUserId();
const i = this.Xl.getUserId();
for (const e of t) {
const t = (!e.userId && !i) || e.userId === i;
e.type === r.q.Vh && t && (s = !0);
e.type === r.q.Wl && t && (s = !0);
}

@@ -44,12 +44,12 @@ }

}
Al(t, s, e, n, l, h, o) {
null == e && (e = !0), e && this.Cl();
const u = this.Jn.Wa(),
a = this.Jn.tE();
Gh(t, s, e, n, l, h, o) {
null == e && (e = !0), e && this.Hh();
const u = this.yh.Ja(),
a = this.yh.Ha();
let c = !1;
const m = (t, s) => {
let o = !1;
T.Xs(this.Jn, T.Qs.Xa, new Date().valueOf()),
T.Xs(this.yh, T.Qs.Sa, new Date().valueOf()),
C.Ys({
url: this.Ho + "/data/",
url: this.Fl + "/data/",
data: t,

@@ -60,13 +60,13 @@ headers: s,

t.respond_with.triggers &&
(this.wl = Math.max(this.wl - 1, 0)),
this.wh.ti(t, e, s)
? (this.gh.si(),
this.Zo.ol(e),
(this.Ll = Math.max(this.Ll - 1, 0)),
this.qh.ti(t, e, s)
? (this.$h.si(),
this.Zl.ul(e),
(null != t.respond_with &&
t.respond_with.user_id != this.Qo.getUserId()) ||
(null != t.device && this.Jn.D(i.k.ma, t.device),
t.respond_with.user_id != this.Xl.getUserId()) ||
(null != t.device && this.yh.D(i.k.la, t.device),
null != t.sdk_metadata &&
(this.Jn.D(i.k.ga, t.sdk_metadata),
this.Jn.D(i.k.qa, this.fh.ba())),
this.vl(e),
(this.yh.D(i.k.ua, t.sdk_metadata),
this.yh.D(i.k.ma, this.Bl.pa())),
this.Ph(e),
"function" == typeof n && n()))

@@ -78,4 +78,4 @@ : e.auth_error && (o = !0);

t.respond_with.triggers &&
(this.wl = Math.max(this.wl - 1, 0)),
this.wh.Aa(t.events, t.attributes),
(this.Ll = Math.max(this.Ll - 1, 0)),
this.qh.Ra(t.events, t.attributes),
"function" == typeof l && l();

@@ -85,7 +85,7 @@ },

if (("function" == typeof h && h(t), e && !c)) {
if (t && !o) this.Tl();
if (t && !o) this.Qh();
else {
let t = this.yl;
(null == t || t < 1e3 * this.kl) && (t = 1e3 * this.kl),
this.Tl(Math.min(3e5, D(1e3 * this.kl, 3 * t)));
let t = this.Jl;
(null == t || t < 1e3 * this.Pl) && (t = 1e3 * this.Pl),
this.Qh(Math.min(3e5, D(1e3 * this.Pl, 3 * t)));
}

@@ -97,28 +97,28 @@ c = !0;

},
d = this.ql(u),
d = this.Bh(u),
f = s || d;
if (this.$l(o, d))
if (this.Wh(o, d))
return void r.j.info(
"Declining to flush data due to 50 consecutive authentication failures"
);
if (e && !this.wh.ka(u, a, t, f))
return this.Tl(), void ("function" == typeof h && h(!0));
const g = this.wh.Ta(t, f, u, a);
f && this.wl++;
if (e && !this.qh.Ba(u, a, t, f))
return this.Qh(), void ("function" == typeof h && h(!0));
const g = this.qh.Da(t, f, u, a);
f && this.Ll++;
let p = !1;
if (g)
for (const t of g)
this.wh.Vs(t.requestData, () => m(t.requestData, t.headers)), (p = !0);
this.gh.Zn() && e && !p
? this.Tl()
: d && (r.j.info("Invoking new session subscriptions"), this.jl.Et());
this.qh.Vs(t.requestData, () => m(t.requestData, t.headers)), (p = !0);
this.$h.Zn() && e && !p
? this.Qh()
: d && (r.j.info("Invoking new session subscriptions"), this.Jh.Et());
}
_l() {
return this.wl > 0;
Vh() {
return this.Ll > 0;
}
Tl(t) {
this.Dl ||
(null == t && (t = 1e3 * this.kl),
this.Cl(),
(this.Fl = setTimeout(() => {
Qh(t) {
this.Xh ||
(null == t && (t = 1e3 * this.Pl),
this.Hh(),
(this.Yh = setTimeout(() => {
if (document.hidden) {

@@ -128,34 +128,34 @@ const t = "visibilitychange",

document.hidden ||
(document.removeEventListener(t, s, !1), this.Al());
(document.removeEventListener(t, s, !1), this.Gh());
};
document.addEventListener(t, s, !1);
} else this.Al();
} else this.Gh();
}, t)),
(this.yl = t));
(this.Jl = t));
}
Cl() {
null != this.Fl && (clearTimeout(this.Fl), (this.Fl = null));
Hh() {
null != this.Yh && (clearTimeout(this.Yh), (this.Yh = null));
}
initialize() {
(this.Dl = !1), this.Tl();
(this.Xh = !1), this.Qh();
}
destroy() {
this.jl.removeAllSubscriptions(),
this.gh.Au(),
this.Cl(),
(this.Dl = !0),
this.Al(null, null, !1),
(this.Fl = null);
this.Jh.removeAllSubscriptions(),
this.$h.jh(),
this.Hh(),
(this.Xh = !0),
this.Gh(null, null, !1),
(this.Yh = null);
}
pr(t) {
return this.jl.lt(t);
return this.Jh.lt(t);
}
openSession() {
const t = this.fh.ba() !== this.fh.bo();
t && (this.Jn.Ha(i.eu.oa), this.Jn.Ha(i.eu.su)),
this.Al(null, !1, null, null, null),
this.zn(),
const t = this.Bl.pa() !== this.Bl.bo();
t && (this.yh.Pa(i.eu.Xo), this.yh.Pa(i.eu.su)),
this.Gh(null, !1, null, null, null),
this.Hn(),
t &&
import("./Push/push-manager-factory.js").then(t => {
if (this.Dl) return;
if (this.Xh) return;
const s = t.default.m();

@@ -167,3 +167,3 @@ if (

const t = () => {
s.ln()
s.dn()
? r.j.info(

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

n = () => {
const s = this.Jn.v(i.k.xn);
const s = this.yh.v(i.k.Nn);
(null == s || s) && t();

@@ -188,11 +188,11 @@ },

changeUser(t, s, e) {
const n = this.Qo.getUserId();
const n = this.Xl.getUserId();
if (n !== t) {
this.fh.Xh(),
null != n && this.Al(null, !1, null, null, null),
this.Qo.ru(t),
e ? this.gh.setSdkAuthenticationSignature(e) : this.gh.du();
this.Bl.kl(),
null != n && this.Gh(null, !1, null, null, null),
this.Xl.ru(t),
e ? this.$h.setSdkAuthenticationSignature(e) : this.$h.fh();
for (let t = 0; t < s.length; t++) s[t].changeUser(null == n);
null != n && this.Jn.ri(i.k.L),
this.Jn.ri(i.k.ma),
null != n && this.yh.ri(i.k.L),
this.yh.ri(i.k.la),
this.openSession(),

@@ -203,4 +203,4 @@ r.j.info('Changed user to "' + t + '".');

e &&
this.gh.au() !== e &&
(this.gh.setSdkAuthenticationSignature(e),
this.$h.gh() !== e &&
(this.$h.setSdkAuthenticationSignature(e),
(s = "Updated SDK authentication signature")),

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

requestImmediateDataFlush(t) {
this.Cl(), this.fh.bo();
this.Al(
this.Hh(), this.Bl.bo();
this.Gh(
null,

@@ -228,11 +228,11 @@ null,

requestFeedRefresh() {
this.fh.bo(), this.Al(!0);
this.Bl.bo(), this.Gh(!0);
}
$r(t, s) {
this.fh.bo(),
this.Bl.bo(),
r.j.info("Requesting explicit trigger refresh."),
this.Al(null, !0, null, t, s);
this.Gh(null, !0, null, t, s);
}
Cn(t, i) {
const e = r.q.Ll,
const e = r.q.Zh,
n = { a: t, l: i },

@@ -243,3 +243,3 @@ l = s.N(e, n);

En(i, e, n) {
if (this.Zo.hu(e))
if (this.Zl.hu(e))
return (

@@ -261,3 +261,3 @@ r.j.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()

null != h && (o.alt_accuracy = h);
const u = s.N(r.q.Pl, o, t);
const u = s.N(r.q.au, o, t);
return (

@@ -272,12 +272,12 @@ u &&

vr(t, s) {
const i = this.fh.bo();
return new ue(this.Qo.getUserId(), r.q.Rl, t, i, { cid: s });
const i = this.Bl.bo();
return new ue(this.Xl.getUserId(), r.q.du, t, i, { cid: s });
}
zn() {
Hn() {
const t = r.zt.Ft;
new r.xt(t, r.j).setItem(t.Jt.Xa, 1, {
baseUrl: this.Ho,
data: { api_key: this.Ko, device_id: this.Xo.te().id },
userId: this.Qo.getUserId(),
sdkAuthEnabled: this.gh.Zn()
new r.xt(t, r.j).setItem(t.Jt.Sa, 1, {
baseUrl: this.Fl,
data: { api_key: this.$l, device_id: this.Ql.te().id },
userId: this.Xl.getUserId(),
sdkAuthEnabled: this.$h.Zn()
});

@@ -287,3 +287,3 @@ }

for (const s of t)
if (s.api_key === this.Ko) this.wh.Aa(s.events, s.attributes);
if (s.api_key === this.$l) this.qh.Ra(s.events, s.attributes);
else {

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

On(i, e, n) {
if (this.Zo.hu(i))
if (this.Zl.hu(i))
return (

@@ -303,4 +303,4 @@ r.j.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()

null === e && null === n
? ((l = r.q.Ml), (h = { key: i }))
: ((l = r.q.Nl), (h = { key: i, latitude: e, longitude: n })),
? ((l = r.q.fu), (h = { key: i }))
: ((l = r.q.gu), (h = { key: i, latitude: e, longitude: n })),
s.N(l, h)

@@ -311,4 +311,4 @@ );

const e = { group_id: t, status: i };
return s.N(r.q.Ol, e);
return s.N(r.q.pu, e);
}
}

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

export default class Gt {
export default class Qt {
constructor(t) {
this.xl = t;
this.wu = t;
}
Bl(t) {
return null == this.xl || this.xl === t[0];
xu(t) {
return null == this.wu || this.wu === t[0];
}
static fromJson(t) {
return new Gt(t ? t.event_name : null);
return new Qt(t ? t.event_name : null);
}
ss() {
return this.xl;
return this.wu;
}
}

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

import Qt from "./filter-set.js";
export default class Yt {
import Yt from "./filter-set.js";
export default class Zt {
constructor(t, s) {
(this.xl = t), (this.Jl = s);
(this.wu = t), (this.ju = s);
}
Bl(t) {
if (null == this.xl || null == this.Jl) return !1;
xu(t) {
if (null == this.wu || null == this.ju) return !1;
const s = t[0],
r = t[1];
return s === this.xl && this.Jl.Bl(r);
return s === this.wu && this.ju.xu(r);
}
static fromJson(t) {
return new Yt(
return new Zt(
t ? t.event_name : null,
t ? Qt.fromJson(t.property_filters) : null
t ? Yt.fromJson(t.property_filters) : null
);
}
ss() {
return { e: this.xl, pf: this.Jl.ss() };
return { e: this.wu, pf: this.ju.ss() };
}
}

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

import Zt from "./filter.js";
import sr from "./filter.js";
import { isArray as p } from "../../util/code-utils.js";
export default class Qt {
export default class Yt {
constructor(t) {
this.filters = t;
}
Bl(t) {
xu(t) {
let r = !0;

@@ -13,3 +13,3 @@ for (let e = 0; e < this.filters.length; e++) {

for (let r = 0; r < o.length; r++)
if (o[r].Bl(t)) {
if (o[r].xu(t)) {
s = !0;

@@ -31,6 +31,6 @@ break;

s = t[e];
for (let t = 0; t < s.length; t++) o.push(Zt.fromJson(s[t]));
for (let t = 0; t < s.length; t++) o.push(sr.fromJson(s[t]));
r.push(o);
}
return new Qt(r);
return new Yt(r);
}

@@ -47,3 +47,3 @@ ss() {

}
static Tn(t) {
static zn(t) {
const r = [];

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

s = t[e];
for (let t = 0; t < s.length; t++) o.push(Zt.Tn(s[t]));
for (let t = 0; t < s.length; t++) o.push(sr.zn(s[t]));
r.push(o);
}
return new Qt(r);
return new Yt(r);
}
}

@@ -8,55 +8,55 @@ import { isDate as Nt } from "../../util/code-utils.js";

} from "../../util/date-utils.js";
export default class Zt {
export default class sr {
constructor(t, s, e, i) {
(this.El = t),
(this.Hl = s),
(this.Eu = t),
(this.Tu = s),
(this.comparator = e),
(this.Il = i),
this.Hl === Zt.Ql.Ul &&
this.comparator !== Zt.Gl.Xl &&
this.comparator !== Zt.Gl.Vl &&
this.comparator !== Zt.Gl.Kl &&
this.comparator !== Zt.Gl.Wl &&
(this.Il = l(this.Il));
(this.Au = i),
this.Tu === sr.yu._u &&
this.comparator !== sr.Nu.Su &&
this.comparator !== sr.Nu.Mu &&
this.comparator !== sr.Nu.Ru &&
this.comparator !== sr.Nu.Hu &&
(this.Au = l(this.Au));
}
Bl(t) {
xu(t) {
let s = null;
switch ((null != t && (s = t[this.El]), this.comparator)) {
case Zt.Gl.Yl:
return null != s && s.valueOf() === this.Il.valueOf();
case Zt.Gl.Zl:
return null == s || s.valueOf() !== this.Il.valueOf();
case Zt.Gl.Zh:
return typeof s == typeof this.Il && s > this.Il;
case Zt.Gl.Xl:
return this.Hl === Zt.Ql.Ul
? null != s && Nt(s) && ts(s) <= this.Il
: typeof s == typeof this.Il && s >= this.Il;
case Zt.Gl.$h:
return typeof s == typeof this.Il && s < this.Il;
case Zt.Gl.Vl:
return this.Hl === Zt.Ql.Ul
? null != s && Nt(s) && ts(s) >= this.Il
: typeof s == typeof this.Il && s <= this.Il;
case Zt.Gl.Eu:
switch ((null != t && (s = t[this.Eu]), this.comparator)) {
case sr.Nu.Lu:
return null != s && s.valueOf() === this.Au.valueOf();
case sr.Nu.Iu:
return null == s || s.valueOf() !== this.Au.valueOf();
case sr.Nu.Ou:
return typeof s == typeof this.Au && s > this.Au;
case sr.Nu.Su:
return this.Tu === sr.yu._u
? null != s && Nt(s) && ts(s) <= this.Au
: typeof s == typeof this.Au && s >= this.Au;
case sr.Nu.Uu:
return typeof s == typeof this.Au && s < this.Au;
case sr.Nu.Mu:
return this.Tu === sr.yu._u
? null != s && Nt(s) && ts(s) >= this.Au
: typeof s == typeof this.Au && s <= this.Au;
case sr.Nu.Du:
return (
null != s &&
"string" == typeof s &&
typeof s == typeof this.Il &&
null != s.match(this.Il)
typeof s == typeof this.Au &&
null != s.match(this.Au)
);
case Zt.Gl.Tu:
case sr.Nu.Qu:
return null != s;
case Zt.Gl._u:
case sr.Nu.Xu:
return null == s;
case Zt.Gl.Kl:
return null != s && Nt(s) && es(s) < this.Il;
case Zt.Gl.Wl:
return null != s && Nt(s) && es(s) > this.Il;
case Zt.Gl.yu:
case sr.Nu.Ru:
return null != s && Nt(s) && es(s) < this.Au;
case sr.Nu.Hu:
return null != s && Nt(s) && es(s) > this.Au;
case sr.Nu.Bu:
return (
null == s ||
typeof s != typeof this.Il ||
typeof s != typeof this.Au ||
"string" != typeof s ||
null == s.match(this.Il)
null == s.match(this.Au)
);

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

static fromJson(t) {
return new Zt(
return new sr(
t.property_key,

@@ -76,26 +76,26 @@ t.property_type,

ss() {
let t = this.Il;
let t = this.Au;
return (
Nt(this.Il) && (t = h(t.valueOf())),
{ k: this.El, t: this.Hl, c: this.comparator, v: t }
Nt(this.Au) && (t = h(t.valueOf())),
{ k: this.Eu, t: this.Tu, c: this.comparator, v: t }
);
}
static Tn(t) {
return new Zt(t.k, t.t, t.c, t.v);
static zn(t) {
return new sr(t.k, t.t, t.c, t.v);
}
}
(Zt.Gl = {
Yl: 1,
Zl: 2,
Zh: 3,
Xl: 4,
$h: 5,
Vl: 6,
Eu: 10,
Tu: 11,
_u: 12,
Kl: 15,
Wl: 16,
yu: 17
(sr.Nu = {
Lu: 1,
Iu: 2,
Ou: 3,
Su: 4,
Uu: 5,
Mu: 6,
Du: 10,
Qu: 11,
Xu: 12,
Ru: 15,
Hu: 16,
Bu: 17
}),
(Zt.Ql = { Nu: "boolean", Mu: "number", Ru: "string", Ul: "date" });
(sr.yu = { Gu: "boolean", bu: "number", zu: "string", _u: "date" });
import ri from "./trigger-condition.js";
export default class si {
constructor(t, i) {
(this.ju = t), (this.ku = i);
(this.ku = t), (this.Ju = i);
}
Bl(t) {
if (null == this.ju) return !1;
const i = ri.wu(t[0], this.ju);
xu(t) {
if (null == this.ku) return !1;
const i = ri.qu(t[0], this.ku);
if (!i) return !1;
let r = null == this.ku || 0 === this.ku.length;
if (null != this.ku)
for (let i = 0; i < this.ku.length; i++)
if (this.ku[i] === t[1]) {
let r = null == this.Ju || 0 === this.Ju.length;
if (null != this.Ju)
for (let i = 0; i < this.Ju.length; i++)
if (this.Ju[i] === t[1]) {
r = !0;

@@ -23,4 +23,4 @@ break;

ss() {
return this.ju;
return this.ku;
}
}

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

export default class sr {
export default class lr {
constructor(t) {
this.productId = t;
}
Bl(t) {
xu(t) {
return null == this.productId || t[0] === this.productId;
}
static fromJson(t) {
return new sr(t ? t.product_id : null);
return new lr(t ? t.product_id : null);
}

@@ -11,0 +11,0 @@ ss() {

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

import Qt from "./filter-set.js";
import Yt from "./filter-set.js";
export default class is {
constructor(t, s) {
(this.productId = t), (this.Jl = s);
(this.productId = t), (this.ju = s);
}
Bl(t) {
if (null == this.productId || null == this.Jl) return !1;
xu(t) {
if (null == this.productId || null == this.ju) return !1;
const s = t[0],
i = t[1];
return s === this.productId && this.Jl.Bl(i);
return s === this.productId && this.ju.xu(i);
}

@@ -15,8 +15,8 @@ static fromJson(t) {

t ? t.product_id : null,
t ? Qt.fromJson(t.property_filters) : null
t ? Yt.fromJson(t.property_filters) : null
);
}
ss() {
return { id: this.productId, pf: this.Jl.ss() };
return { id: this.productId, pf: this.ju.ss() };
}
}
import ri from "./trigger-condition.js";
export default class lr {
export default class ur {
constructor(t) {
this.ju = t;
this.ku = t;
}
Bl(t) {
return null == this.ju || ri.wu(t[0], this.ju);
xu(t) {
return null == this.ku || ri.qu(t[0], this.ku);
}
static fromJson(t) {
return new lr(t ? t.campaign_id : null);
return new ur(t ? t.campaign_id : null);
}
ss() {
return this.ju;
return this.ku;
}
}

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

import Gt from "./custom-event-data.js";
import Yt from "./custom-event-property-data.js";
import Qt from "./filter-set.js";
import Qt from "./custom-event-data.js";
import Zt from "./custom-event-property-data.js";
import Yt from "./filter-set.js";
import si from "./in-app-message-click-data.js";
import sr from "./purchase-data.js";
import lr from "./purchase-data.js";
import is from "./purchase-property-data.js";
import lr from "./push-click-data.js";
import ur from "./push-click-data.js";
import tt from "./trigger-events.js";

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

ec(e, t) {
return ri.tc[this.type] === e && (null == this.data || this.data.Bl(t));
return ri.rc[this.type] === e && (null == this.data || this.data.xu(t));
}
static wu(e, t) {
static qu(e, t) {
let a = null;

@@ -33,24 +33,24 @@ try {

switch (t) {
case ri.rc.OPEN:
case ri.ac.OPEN:
r = null;
break;
case ri.rc.Rr:
r = sr.fromJson(e.data);
case ri.ac.Rr:
r = lr.fromJson(e.data);
break;
case ri.rc.ac:
case ri.ac.sc:
r = is.fromJson(e.data);
break;
case ri.rc.zr:
r = lr.fromJson(e.data);
case ri.ac.zr:
r = ur.fromJson(e.data);
break;
case ri.rc.be:
r = Gt.fromJson(e.data);
case ri.ac.be:
r = Qt.fromJson(e.data);
break;
case ri.rc.sc:
r = Yt.fromJson(e.data);
case ri.ac.cc:
r = Zt.fromJson(e.data);
break;
case ri.rc.Kr:
case ri.ac.Lr:
r = si.fromJson(e.data);
break;
case ri.rc.ks:
case ri.ac.ks:
r = null;

@@ -63,27 +63,27 @@ }

}
static Tn(e) {
static zn(e) {
let t, r;
switch (e.t) {
case ri.rc.OPEN:
case ri.ac.OPEN:
t = null;
break;
case ri.rc.Rr:
t = new sr(e.d);
case ri.ac.Rr:
t = new lr(e.d);
break;
case ri.rc.ac:
(r = e.d || {}), (t = new is(r.id, Qt.Tn(r.pf || [])));
case ri.ac.sc:
(r = e.d || {}), (t = new is(r.id, Yt.zn(r.pf || [])));
break;
case ri.rc.zr:
t = new lr(e.d);
case ri.ac.zr:
t = new ur(e.d);
break;
case ri.rc.be:
t = new Gt(e.d);
case ri.ac.be:
t = new Qt(e.d);
break;
case ri.rc.sc:
(r = e.d || {}), (t = new Yt(r.e, Qt.Tn(r.pf || [])));
case ri.ac.cc:
(r = e.d || {}), (t = new Zt(r.e, Yt.zn(r.pf || [])));
break;
case ri.rc.Kr:
case ri.ac.Lr:
t = new si(e.d);
break;
case ri.rc.ks:
case ri.ac.ks:
t = null;

@@ -94,20 +94,20 @@ }

}
(ri.rc = {
(ri.ac = {
OPEN: "open",
Rr: "purchase",
ac: "purchase_property",
sc: "purchase_property",
zr: "push_click",
be: "custom_event",
sc: "custom_event_property",
Kr: "iam_click",
cc: "custom_event_property",
Lr: "iam_click",
ks: "test"
}),
(ri.tc = {}),
(ri.tc[ri.rc.OPEN] = tt.OPEN),
(ri.tc[ri.rc.Rr] = tt.Rr),
(ri.tc[ri.rc.ac] = tt.Rr),
(ri.tc[ri.rc.zr] = tt.zr),
(ri.tc[ri.rc.be] = tt.be),
(ri.tc[ri.rc.sc] = tt.be),
(ri.tc[ri.rc.Kr] = tt.Kr),
(ri.tc[ri.rc.ks] = tt.ks);
(ri.rc = {}),
(ri.rc[ri.ac.OPEN] = tt.OPEN),
(ri.rc[ri.ac.Rr] = tt.Rr),
(ri.rc[ri.ac.sc] = tt.Rr),
(ri.rc[ri.ac.zr] = tt.zr),
(ri.rc[ri.ac.be] = tt.be),
(ri.rc[ri.ac.cc] = tt.be),
(ri.rc[ri.ac.Lr] = tt.Lr),
(ri.rc[ri.ac.ks] = tt.ks);

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

be: "custom_event",
Kr: "iam_click",
Lr: "iam_click",
ks: "test"
};

@@ -11,3 +11,3 @@ import {

(this.id = t),
(this.Du = i || []),
(this.Pu = i || []),
void 0 === s && (s = null),

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

(this.type = l),
(this.Pu = n || 0),
null == a && (a = 1e3 * (this.Pu + 30)),
(this.Jr = a),
(this.vu = n || 0),
null == a && (a = 1e3 * (this.vu + 30)),
(this.Kr = a),
(this.data = o),
null == h && (h = mt.vu),
(this.zu = h),
(this.Iu = u),
(this.$u = d || null);
null == h && (h = mt.$u),
(this.Cu = h),
(this.Fu = u),
(this.Vu = d || null);
}
xu(t) {
Ku(t) {
return (
null == this.$u || (this.zu !== mt.vu && t - this.$u >= 1e3 * this.zu)
null == this.Vu || (this.Cu !== mt.$u && t - this.Vu >= 1e3 * this.Cu)
);
}
Bu(t) {
this.$u = t;
Wu(t) {
this.Vu = t;
}
Cu(t) {
const i = t + 1e3 * this.Pu;
Yu(t) {
const i = t + 1e3 * this.vu;
return Math.max(i - new Date().valueOf(), 0);
}
Hu(t) {
Zu(t) {
const i = new Date().valueOf() - t,
s = null == t || isNaN(i) || null == this.Jr || i < this.Jr;
s = null == t || isNaN(i) || null == this.Kr || i < this.Kr;
return (
s ||
r.j.info(
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.Jr}ms.`
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.Kr}ms.`
),

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

return H(
mt._r,
mt.Gr,
n,

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

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

@@ -88,12 +88,12 @@ i: this.id,

da: this.data,
d: this.Pu,
r: this.zu,
tm: this.Jr,
ss: this.Iu,
ld: this.$u
d: this.vu,
r: this.Cu,
tm: this.Kr,
ss: this.Fu,
ld: this.Vu
};
}
static Tn(t) {
static zn(t) {
const i = [];
for (let s = 0; s < t.c.length; s++) i.push(ri.Tn(t.c[s]));
for (let s = 0; s < t.c.length; s++) i.push(ri.zn(t.c[s]));
return new mt(

@@ -115,2 +115,2 @@ t.i,

}
(mt.vu = -1), (mt._r = { Mr: "inapp", Ju: "templated_iam" });
(mt.$u = -1), (mt.Gr = { _r: "inapp", td: "templated_iam" });

@@ -20,78 +20,78 @@ import y from "../common/base-provider.js";

(this.ig = i),
(this.Jn = s),
(this.Ch = e),
(this.sg = r),
(this.eg = []),
(this.yh = s),
(this.sg = e),
(this.eg = r),
(this.hg = []),
(this.og = null),
(this.ng = {}),
(this.og = []),
(this.ng = null),
(this.lg = {}),
this.ag(),
this.gg();
(this.ag = {}),
this.gg(),
this.fg();
}
fg() {
(this.og = this.Jn.v(i.k.La) || this.og),
(this.ng = this.Jn.v(i.k.Fa) || this.ng),
(this.lg = this.Jn.v(i.k.Ua) || this.lg);
for (let t = 0; t < this.cg.length; t++) {
const i = this.cg[t];
null != this.lg[i.id] && i.Bu(this.lg[i.id]);
cg() {
(this.ng = this.yh.v(i.k.Ma) || this.ng),
(this.lg = this.yh.v(i.k.ya) || this.lg),
(this.ag = this.yh.v(i.k.Ga) || this.ag);
for (let t = 0; t < this.ug.length; t++) {
const i = this.ug[t];
null != this.ag[i.id] && i.Wu(this.ag[i.id]);
}
}
ag() {
this.ug = this.Jn.v(i.k.Ga) || 0;
const t = this.Jn.v(i.k.Na) || [],
gg() {
this.dg = this.yh.v(i.k.Ca) || 0;
const t = this.yh.v(i.k.Na) || [],
s = [];
for (let i = 0; i < t.length; i++) s.push(mt.Tn(t[i]));
(this.cg = s), this.fg();
for (let i = 0; i < t.length; i++) s.push(mt.zn(t[i]));
(this.ug = s), this.cg();
}
gg() {
fg() {
const t = this,
s = function(i, s, e, r, h) {
return function() {
t.dg(i, s, e, r, h);
t.mg(i, s, e, r, h);
};
},
e = {};
for (let t = 0; t < this.cg.length; t++) e[this.cg[t].id] = this.cg[t];
for (let t = 0; t < this.ug.length; t++) e[this.ug[t].id] = this.ug[t];
let r = !1;
for (let t = 0; t < this.cg.length; t++) {
const i = this.cg[t];
if (null != this.ng[i.id]) {
const t = this.ng[i.id],
for (let t = 0; t < this.ug.length; t++) {
const i = this.ug[t];
if (null != this.lg[i.id]) {
const t = this.lg[i.id],
h = [];
for (let r = 0; r < t.length; r++) {
const o = t[r],
n = i.Cu(o.Hr);
n = i.Yu(o.Jr);
if (n > 0) {
let t, r;
h.push(o),
null != o.mg && (t = o.mg),
null != o.pg && ue.Za(o.pg) && (r = ue.Tn(o.pg));
null != o.pg && (t = o.pg),
null != o.bg && ue.Qa(o.bg) && (r = ue.zn(o.bg));
const l = [];
if (p(o.bg))
for (let t = 0; t < o.bg.length; t++) {
const i = e[o.bg[t]];
if (p(o.Tg))
for (let t = 0; t < o.Tg.length; t++) {
const i = e[o.Tg[t]];
null != i && l.push(i);
}
this.hg.push(setTimeout(s(i, o.Hr, t, r, l), n));
this.og.push(setTimeout(s(i, o.Jr, t, r, l), n));
}
}
this.ng[i.id].length > h.length &&
((this.ng[i.id] = h),
this.lg[i.id].length > h.length &&
((this.lg[i.id] = h),
(r = !0),
0 === this.ng[i.id].length && delete this.ng[i.id]);
0 === this.lg[i.id].length && delete this.lg[i.id]);
}
}
r && this.Jn.D(i.k.Fa, this.ng);
r && this.yh.D(i.k.ya, this.lg);
}
Tg() {
yg() {
const t = [];
for (let i = 0; i < this.cg.length; i++) t.push(this.cg[i].ss());
(this.ug = new Date().valueOf()),
this.Jn.D(i.k.Na, t),
this.Jn.D(i.k.Ga, this.ug);
for (let i = 0; i < this.ug.length; i++) t.push(this.ug[i].ss());
(this.dg = new Date().valueOf()),
this.yh.D(i.k.Na, t),
this.yh.D(i.k.Ca, this.dg);
}
yg() {
(this.Jn.v(i.k.Ga) || 0) > this.ug ? this.ag() : this.fg();
vg() {
(this.yh.v(i.k.Ca) || 0) > this.dg ? this.gg() : this.cg();
}

@@ -101,21 +101,21 @@ Ts(t) {

if (null != t && t.triggers) {
this.fg();
this.cg();
const e = {},
h = {};
this.cg = [];
this.ug = [];
for (let i = 0; i < t.triggers.length; i++) {
const r = mt.fromJson(t.triggers[i]);
null != this.lg[r.id] &&
(r.Bu(this.lg[r.id]), (e[r.id] = this.lg[r.id])),
null != this.ng[r.id] && (h[r.id] = this.ng[r.id]);
for (let t = 0; t < r.Du.length; t++)
if (r.Du[t].ec(tt.ks, null)) {
null != this.ag[r.id] &&
(r.Wu(this.ag[r.id]), (e[r.id] = this.ag[r.id])),
null != this.lg[r.id] && (h[r.id] = this.lg[r.id]);
for (let t = 0; t < r.Pu.length; t++)
if (r.Pu[t].ec(tt.ks, null)) {
s = !0;
break;
}
null != r && this.cg.push(r);
null != r && this.ug.push(r);
}
ii(this.lg, e) || ((this.lg = e), this.Jn.D(i.k.Ua, this.lg)),
ii(this.ng, h) || ((this.ng = h), this.Jn.D(i.k.Fa, this.ng)),
this.Tg(),
ii(this.ag, e) || ((this.ag = e), this.yh.D(i.k.Ga, this.ag)),
ii(this.lg, h) || ((this.lg = h), this.yh.D(i.k.ya, this.lg)),
this.yg(),
s &&

@@ -125,39 +125,39 @@ (r.j.info("Trigger with test condition found, firing test."),

this.je(tt.OPEN);
const o = this.eg;
this.eg = [];
const o = this.hg;
this.hg = [];
for (let t = 0; t < o.length; t++) this.je.apply(this, o[t]);
}
}
dg(t, i, s, e, h) {
mg(t, i, s, e, h) {
const o = e => {
this.fg();
this.cg();
const h = new Date().valueOf();
if (!t.Hu(i))
return !1 === navigator.onLine && t.type === mt._r.Mr && e.imageUrl
if (!t.Zu(i))
return !1 === navigator.onLine && t.type === mt.Gr._r && e.imageUrl
? (r.j.info(
`Not showing ${t.type} trigger action ${t.id} due to offline state.`
),
void this.sg.Ye(t.id, InAppMessage.Me.Dh))
: void (t.xu(h) && this.vg(t, h, s)
? 0 === this.ig.fu()
void this.eg.Ye(t.id, InAppMessage.Me.Dh))
: void (t.Ku(h) && this.wg(t, h, s)
? 0 === this.ig.tc()
? r.j.info(
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`
)
: (this.ig.Et([e]), this.wg(t, h))
: (this.ig.Et([e]), this.$g(t, h))
: r.j.info(
`Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`
));
t.type === mt._r.Ju
? this.sg.Ye(t.id, InAppMessage.Me.Yi)
: this.sg.Ye(t.id, InAppMessage.Me.Mh);
t.type === mt.Gr.td
? this.eg.Ye(t.id, InAppMessage.Me.Zi)
: this.eg.Ye(t.id, InAppMessage.Me.Mh);
},
n = () => {
this.fg();
this.cg();
const o = h.pop();
if (null != o)
if ((this.$g(o, i, s, e, h), o.Hu(i))) {
if ((this.jg(o, i, s, e, h), o.Zu(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.j.info(t),
this.sg.Ye(o.id, InAppMessage.Me.Mh),
this.eg.Ye(o.id, InAppMessage.Me.Mh),
n();

@@ -168,10 +168,10 @@ } else {

);
const n = 1e3 * o.Pu - (new Date().valueOf() - i);
const n = 1e3 * o.vu - (new Date().valueOf() - i);
n > 0
? this.hg.push(
? this.og.push(
setTimeout(() => {
this.dg(o, i, s, e, h);
this.mg(o, i, s, e, h);
}, n)
)
: this.dg(o, i, s, e, h);
: this.mg(o, i, s, e, h);
}

@@ -181,3 +181,3 @@ };

switch (t.type) {
case mt._r.Mr:
case mt.Gr._r:
if (((l = pt(t.data)), null == l)) {

@@ -187,6 +187,6 @@ r.j.error(

),
this.sg.Ye(t.id, InAppMessage.Me.Gr);
this.eg.Ye(t.id, InAppMessage.Me.Or);
break;
}
if (((a = this.sg.Hi(l)), a)) {
if (((a = this.eg.Ji(l)), a)) {
r.j.error(a), n();

@@ -197,11 +197,11 @@ break;

break;
case mt._r.Ju:
if (((g = wt.fromJson(t.data, o, n, i, t.Jr)), null == g)) {
case mt.Gr.td:
if (((g = wt.fromJson(t.data, o, n, i, t.Kr)), null == g)) {
r.j.error(
`Could not parse trigger data for trigger ${t.id}, ignoring.`
),
this.sg.Ye(t.id, InAppMessage.Me.Gr);
this.eg.Ye(t.id, InAppMessage.Me.Or);
break;
}
this.sg.Qi(g, s, e);
this.eg.Vi(g, s, e);
break;

@@ -212,3 +212,3 @@ default:

),
this.sg.Ye(t.id, InAppMessage.Me.Gr);
this.eg.Ye(t.id, InAppMessage.Me.Or);
}

@@ -218,3 +218,3 @@ }

if (!H(tt, t, "Cannot fire trigger action.", "TriggerEvents")) return;
if (this.Ch._l())
if (this.sg.Vh())
return (

@@ -224,15 +224,15 @@ r.j.info(

),
void this.eg.push(arguments)
void this.hg.push(arguments)
);
this.yg();
this.vg();
const e = new Date().valueOf(),
h = e - this.og;
h = e - this.ng;
let o = !0,
n = !0;
const l = [];
for (let s = 0; s < this.cg.length; s++) {
const r = this.cg[s],
h = e + 1e3 * r.Pu;
for (let s = 0; s < this.ug.length; s++) {
const r = this.ug[s],
h = e + 1e3 * r.vu;
if (
r.xu(h) &&
r.Ku(h) &&
(null == r.startTime || r.startTime <= e) &&

@@ -242,8 +242,8 @@ (null == r.endTime || r.endTime >= e)

let s = !1;
for (let e = 0; e < r.Du.length; e++)
if (r.Du[e].ec(t, i)) {
for (let e = 0; e < r.Pu.length; e++)
if (r.Pu[e].ec(t, i)) {
s = !0;
break;
}
s && ((o = !1), this.vg(r, h, t) && ((n = !1), l.push(r)));
s && ((o = !1), this.wg(r, h, t) && ((n = !1), l.push(r)));
}

@@ -266,28 +266,28 @@ }

),
this.$g(a, e, t, s, l),
0 === a.Pu
? this.dg(a, e, t, s, l)
: this.hg.push(
this.jg(a, e, t, s, l),
0 === a.vu
? this.mg(a, e, t, s, l)
: this.og.push(
setTimeout(() => {
this.dg(a, e, t, s, l);
}, 1e3 * a.Pu)
this.mg(a, e, t, s, l);
}, 1e3 * a.vu)
));
}
changeUser(t) {
if (((this.cg = []), this.Jn.ri(i.k.Na), !t)) {
(this.eg = []), (this.og = null), (this.lg = {}), (this.ng = {});
for (let t = 0; t < this.hg.length; t++) clearTimeout(this.hg[t]);
(this.hg = []),
this.Jn.ri(i.k.La),
this.Jn.ri(i.k.Ua),
this.Jn.ri(i.k.Fa);
if (((this.ug = []), this.yh.ri(i.k.Na), !t)) {
(this.hg = []), (this.ng = null), (this.ag = {}), (this.lg = {});
for (let t = 0; t < this.og.length; t++) clearTimeout(this.og[t]);
(this.og = []),
this.yh.ri(i.k.Ma),
this.yh.ri(i.k.Ga),
this.yh.ri(i.k.ya);
}
}
clearData() {
(this.cg = []), (this.og = null), (this.lg = {}), (this.ng = {});
for (let t = 0; t < this.hg.length; t++) clearTimeout(this.hg[t]);
this.hg = [];
(this.ug = []), (this.ng = null), (this.ag = {}), (this.lg = {});
for (let t = 0; t < this.og.length; t++) clearTimeout(this.og[t]);
this.og = [];
}
vg(t, i, s) {
if (null == this.og) return !0;
wg(t, i, s) {
if (null == this.ng) return !0;
if (s === tt.ks)

@@ -300,22 +300,22 @@ return (

);
let e = t.Iu;
return null == e && (e = this.tg), i - this.og >= 1e3 * e;
let e = t.Fu;
return null == e && (e = this.tg), i - this.ng >= 1e3 * e;
}
$g(t, s, e, r, h) {
this.fg(), (this.ng[t.id] = this.ng[t.id] || []);
jg(t, s, e, r, h) {
this.cg(), (this.lg[t.id] = this.lg[t.id] || []);
const o = {};
let n;
(o.Hr = s), (o.mg = e), null != r && (n = r.ss()), (o.pg = n);
(o.Jr = s), (o.pg = e), null != r && (n = r.ss()), (o.bg = n);
const l = [];
for (let t = 0; t < h.length; t++) l.push(h[t].id);
(o.bg = l), this.ng[t.id].push(o), this.Jn.D(i.k.Fa, this.ng);
(o.Tg = l), this.lg[t.id].push(o), this.yh.D(i.k.ya, this.lg);
}
wg(t, s) {
this.fg(),
t.Bu(s),
(this.og = s),
this.Jn.D(i.k.La, s),
(this.lg[t.id] = s),
this.Jn.D(i.k.Ua, this.lg);
$g(t, s) {
this.cg(),
t.Wu(s),
(this.ng = s),
this.yh.D(i.k.Ma, s),
(this.ag[t.id] = s),
this.yh.D(i.k.Ga, this.ag);
}
}
import e, { OPTIONS as L } from "../../managers/braze-instance.js";
export function attachCSS(n, t, o) {
const c = n || document.querySelector("head"),
s = `ab-${t}-css-definitions-${"4.8.0".replace(/\./g, "-")}`,
s = `ab-${t}-css-definitions-${"4.8.1".replace(/\./g, "-")}`,
a = c.ownerDocument || document;

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

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

}
yn(t, s, e, u, o) {
gn(t, s, e, u, o) {
this.nu("push_token", t, !1, !0),

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

l = new ti(t, s, e, u, o);
this.u.D(i.k.xn, l.ss()), n.setItem(h.Jt.cu, h.se, !0);
this.u.D(i.k.Nn, l.ss()), n.setItem(h.Jt.cu, h.se, !0);
}
wn(t) {
vn(t) {
if (

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

s = new r.xt(t, r.j);
this.u.D(i.k.xn, !1), s.setItem(t.Jt.cu, t.se, !1);
this.u.D(i.k.Nn, !1), s.setItem(t.Jt.cu, t.se, !1);
}
}
}

@@ -277,7 +277,7 @@ import {

}
yn(t, e, r, s, i) {
this.ft.yn(t, e, r, s, i), this.Ci.zn();
gn(t, e, r, s, i) {
this.ft.gn(t, e, r, s, i), this.Ci.Hn();
}
wn(t) {
this.ft.wn(t);
vn(t) {
this.ft.vn(t);
}

@@ -300,4 +300,4 @@ }

(User.qn = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
(User.Hn = "user_id"),
(User.Kn = "user_id"),
(User.lu = "custom"),
(User.lr = 997);
import { isArray as p } from "./code-utils.js";
export default class Oe {
export default class ge {
constructor() {}
tf() {}
ef() {}
ua(t) {}
Zo(t) {}
static rf(t, e) {

@@ -8,0 +8,0 @@ if (t && e)

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

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

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

import ni from "./client-hints-parser.js";
import ei from "./user-agent-parser.js";
import { Browsers as ai, OperatingSystems as W } from "./device-constants.js";
class gi {
import ai from "./user-agent-parser.js";
import { Browsers as gi, OperatingSystems as W } from "./device-constants.js";
class oi {
constructor() {
const t = navigator.userAgentData ? ni : ei;
const t = navigator.userAgentData ? ni : ai;
(this.Sg = new t()),

@@ -11,3 +11,3 @@ (this.userAgent = navigator.userAgent),

(this.version = this.Sg.ef()),
this.ua().then(t => (this.OS = t)),
this.Zo().then(t => (this.OS = t)),
(this.language = (

@@ -20,17 +20,17 @@ navigator.userLanguage ||

).toLowerCase()),
(this.$o = gi.Bg(this.userAgent));
(this.Ho = oi.Bg(this.userAgent));
}
Og() {
return this.browser !== ai.Pg || this.version > 8;
return this.browser !== gi.Pg || this.version > 8;
}
rE() {
return this.browser === ai.kg;
$a() {
return this.browser === gi.kg;
}
la() {
ca() {
return this.OS || null;
}
ua() {
Zo() {
return this.OS
? Promise.resolve(this.OS)
: this.Sg.ua(gi.xg).then(t => ((this.OS = t), t));
: this.Sg.Zo(oi.xg).then(t => ((this.OS = t), t));
}

@@ -61,5 +61,5 @@ static Bg(t) {

}
gi.xg = [
oi.xg = [
{ string: navigator.platform, if: "Win", identity: W.Dg },
{ string: navigator.platform, if: "Mac", identity: W.jg },
{ string: navigator.platform, if: "Mac", identity: W.Fg },
{ string: navigator.platform, if: "BlackBerry", identity: "BlackBerry" },

@@ -82,8 +82,8 @@ { string: navigator.platform, if: "FreeBSD", identity: "FreeBSD" },

if: ["Linux armv7l", "Android"],
identity: W.Fg
identity: W.Lg
},
{ string: navigator.userAgent, if: ["Android"], identity: W.Fg },
{ string: navigator.userAgent, if: ["Android"], identity: W.Lg },
{ string: navigator.platform, if: "Linux", identity: "Linux" }
];
const V = new gi();
export { V as default, gi as BrowserDetector };
const V = new oi();
export { V as default, oi as BrowserDetector };

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

import Oe from "./base-device-parser.js";
import { Browsers as ai } from "./device-constants.js";
export default class ni extends Oe {
import ge from "./base-device-parser.js";
import { Browsers as gi } from "./device-constants.js";
export default class ni extends ge {
constructor() {

@@ -21,3 +21,3 @@ if (

}
ua(t) {
Zo(t) {
if (this.OS) return Promise.resolve(this.OS);

@@ -42,3 +42,3 @@ const r = r => {

for (const s of r) {
const r = this.oc(ai),
const r = this.oc(gi),
e = s.brand.match(r);

@@ -54,3 +54,3 @@ if (e && e.length > 0) {

const r = [];
for (const s in t) t[s] !== ai.Pg && r.push(t[s]);
for (const s in t) t[s] !== gi.Pg && r.push(t[s]);
return new RegExp("(" + r.join("|") + ")", "i");

@@ -57,0 +57,0 @@ }

export const Browsers = {
OE: "Chrome",
RE: "Edge",
rE: "Chrome",
eE: "Edge",
Pg: "Internet Explorer",
IE: "Opera",
EE: "Opera",
kg: "Safari",
AE: "Firefox"
oE: "Firefox"
};
export const OperatingSystems = {
Fg: "Android",
Lg: "Android",
fe: "iOS",
jg: "Mac",
Fg: "Mac",
Dg: "Windows"
};

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

}
export const DOMUtils = { Ou: null, eo: _isInView };
export const DOMUtils = { lc: null, eo: _isInView };
export const DIRECTIONS = { Je: "up", Ke: "down", W: "left", X: "right" };
export function supportsPassive() {
if (null == DOMUtils.Ou) {
DOMUtils.Ou = !1;
if (null == DOMUtils.lc) {
DOMUtils.lc = !1;
try {
const t = Object.defineProperty({}, "passive", {
get: () => {
DOMUtils.Ou = !0;
DOMUtils.lc = !0;
}

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

}
return DOMUtils.Ou;
return DOMUtils.lc;
}

@@ -38,0 +38,0 @@ export function addPassiveEventListener(t, n, e = () => {}) {

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

const n = {
error: "" === e.responseText ? qt.za : qt.Ba,
error: "" === e.responseText ? qt.ga : qt.qa,
response: e.responseText

@@ -34,0 +34,0 @@ };

import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
const T = {
Qs: { Xa: "d", Os: "cc", xi: "ff", Xi: "t" },
Lu: e => {
if (e) return e.v(i.k.Pa);
Qs: { Sa: "d", Os: "cc", xi: "ff", Yi: "t" },
eT: e => {
if (e) return e.v(i.k.Ua);
},
qu: (e, t) => {
e && e.D(i.k.Pa, t);
tT: (e, t) => {
e && e.D(i.k.Ua, t);
},
Ea: (e, t) => {
Xa: (e, t) => {
if (!e || !t) return -1;
const r = T.Lu(e);
const r = T.eT(e);
if (null == r) return -1;

@@ -19,6 +19,6 @@ const s = r[t];

if (!e || !t) return;
let s = T.Lu(e);
null == s && (s = {}), (s[t] = r), T.qu(e, s);
let s = T.eT(e);
null == s && (s = {}), (s[t] = r), T.tT(e, s);
}
};
export default T;

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

import Oe from "./base-device-parser.js";
import { Browsers as ai, OperatingSystems as W } from "./device-constants.js";
export default class ei extends Oe {
import ge from "./base-device-parser.js";
import { Browsers as gi, OperatingSystems as W } from "./device-constants.js";
export default class ai extends ge {
constructor() {
super(), (this.Vu = ei.Uu(navigator.userAgent || ""));
super(), (this.rd = ai.ed(navigator.userAgent || ""));
}
tf() {
return this.Vu[0] || "Unknown Browser";
return this.rd[0] || "Unknown Browser";
}
ef() {
return this.Vu[1] || "Unknown Version";
return this.rd[1] || "Unknown Version";
}
ua(r) {
Zo(r) {
for (let e = 0; e < r.length; e++) {
let n = r[e].string,
i = ei.rf(n, r[e]);
i = ai.rf(n, r[e]);
if (i)
return (
i === W.jg && navigator.maxTouchPoints > 1 && (i = W.fe),
i === W.Fg && navigator.maxTouchPoints > 1 && (i = W.fe),
Promise.resolve(i)

@@ -25,3 +25,3 @@ );

}
static Uu(r) {
static ed(r) {
let e,

@@ -34,3 +34,3 @@ n =

return (
(e = /\brv[ :]+(\.?\d+(\.\d+)*)/g.exec(r) || []), [ai.Pg, e[1] || ""]
(e = /\brv[ :]+(\.?\d+(\.\d+)*)/g.exec(r) || []), [gi.Pg, e[1] || ""]
);

@@ -50,3 +50,3 @@ if (-1 !== r.indexOf("(Web0S; Linux/SmartTV)"))

if (
n[1] === ai.OE &&
n[1] === gi.rE &&
((e = r.match(/\b(OPR|Edge|EdgA|Edg|UCBrowser)\/(\.?\d+(\.\d+)*)/)),

@@ -57,17 +57,17 @@ null != e)

(e = e.slice(1)),
(e[0] = e[0].replace("OPR", ai.IE)),
(e[0] = e[0].replace("EdgA", ai.RE)),
"Edg" === e[0] && (e[0] = ai.RE),
(e[0] = e[0].replace("OPR", gi.EE)),
(e[0] = e[0].replace("EdgA", gi.eE)),
"Edg" === e[0] && (e[0] = gi.eE),
[e[0], e[1]]
);
if (
n[1] === ai.kg &&
n[1] === gi.kg &&
((e = r.match(/\b(EdgiOS)\/(\.?\d+(\.\d+)*)/)), null != e)
)
return (
(e = e.slice(1)), (e[0] = e[0].replace("EdgiOS", ai.RE)), [e[0], e[1]]
(e = e.slice(1)), (e[0] = e[0].replace("EdgiOS", gi.eE)), [e[0], e[1]]
);
if (
((n = n[2] ? [n[1], n[2]] : [null, null]),
n[0] === ai.kg &&
n[0] === gi.kg &&
null != (e = r.match(/version\/(\.?\d+(\.\d+)*)/i)) &&

@@ -77,3 +77,3 @@ n.splice(1, 1, e[1]),

n.splice(1, 1, e[2]),
n[0] === ai.IE && null != (e = r.match(/mini\/(\.?\d+(\.\d+)*)/i)))
n[0] === gi.EE && null != (e = r.match(/mini\/(\.?\d+(\.\d+)*)/i)))
)

@@ -83,4 +83,4 @@ return ["Opera Mini", e[1] || ""];

const r = n[0].toLowerCase();
"msie" === r && (n[0] = ai.Pg),
"crios" === r && (n[0] = ai.OE),
"msie" === r && (n[0] = gi.Pg),
"crios" === r && (n[0] = gi.rE),
"tizen" === r && ((n[0] = "Samsung Smart TV"), (n[1] = null)),

@@ -87,0 +87,0 @@ "samsungbrowser" === r && (n[0] = "Samsung Browser");

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

ao: _getOrientation,
An: _getCurrentUrl
jn: _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