@braze/web-sdk
Advanced tools
Comparing version 5.0.1 to 5.1.0
{ | ||
"name": "@braze/web-sdk", | ||
"version": "5.0.1", | ||
"version": "5.1.0", | ||
"description": "Braze SDK for web sites and other JS platforms.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -11,3 +11,3 @@ # Braze Web SDK | ||
(c) Braze, Inc. 2023 - http://braze.com | ||
(c) Braze, Inc. 2024 - http://braze.com | ||
License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE |
@@ -1,3 +0,3 @@ | ||
const ve = { | ||
Fn: function (t) { | ||
const ei = { | ||
qn: function (t) { | ||
const r = (t + "=".repeat((4 - (t.length % 4)) % 4)) | ||
@@ -12,2 +12,2 @@ .replace(/\-/g, "+") | ||
}; | ||
export default ve; | ||
export default ei; |
@@ -1,34 +0,34 @@ | ||
const De = { | ||
const i = { | ||
CustomEvent: "ce", | ||
Pr: "p", | ||
Mu: "pc", | ||
cc: "ca", | ||
Ka: "i", | ||
qs: "ie", | ||
P: "cci", | ||
T: "ccic", | ||
$: "ccc", | ||
H: "ccd", | ||
Wl: "ss", | ||
Iu: "pc", | ||
vc: "ca", | ||
Za: "i", | ||
Ms: "ie", | ||
M: "cci", | ||
R: "ccic", | ||
I: "ccc", | ||
F: "ccd", | ||
kl: "ss", | ||
xl: "se", | ||
Vi: "si", | ||
Li: "sc", | ||
Qi: "sbc", | ||
Ki: "sfe", | ||
eo: "iec", | ||
Lu: "lr", | ||
Tu: "uae", | ||
R: "ci", | ||
B: "cc", | ||
Ru: "lcaa", | ||
Pu: "lcar", | ||
Xn: "inc", | ||
Jn: "add", | ||
Qn: "rem", | ||
Hn: "set", | ||
Kn: "ncam", | ||
Nu: "sgu", | ||
Ze: "si", | ||
Xe: "sc", | ||
Ye: "sbc", | ||
We: "sfe", | ||
fo: "iec", | ||
xu: "lr", | ||
Pu: "uae", | ||
O: "ci", | ||
$: "cc", | ||
Uu: "lcaa", | ||
Ou: "lcar", | ||
Hn: "inc", | ||
On: "add", | ||
Gn: "rem", | ||
Ln: "set", | ||
Rn: "ncam", | ||
_u: "sgu", | ||
Fr: "ffi", | ||
}, | ||
Be = { Br: "feed_displayed", dc: "content_cards_displayed" }; | ||
export { De as EventTypes, Be as InternalEventTypes }; | ||
or = { Br: "feed_displayed", Cc: "content_cards_displayed" }; | ||
export { i as EventTypes, or as InternalEventTypes }; |
@@ -1,3 +0,3 @@ | ||
const Ge = { | ||
Y: function () { | ||
const p = { | ||
W: function () { | ||
const t = (t = !1) => { | ||
@@ -10,2 +10,2 @@ const n = (Math.random().toString(16) + "000000000").substr(2, 8); | ||
}; | ||
export default Ge; | ||
export default p; |
@@ -1,10 +0,10 @@ | ||
export default class Oe { | ||
export default class A { | ||
constructor(t, e) { | ||
(this.database = t), | ||
(this.j = e), | ||
(this.dd = e), | ||
(this.parent = "undefined" == typeof window ? self : window), | ||
(this.database = t), | ||
(this.j = e); | ||
(this.dd = e); | ||
} | ||
td() { | ||
fd() { | ||
if ("indexedDB" in this.parent) return this.parent.indexedDB; | ||
@@ -15,6 +15,6 @@ } | ||
try { | ||
if (null == this.td()) return !1; | ||
if (null == this.fd()) return !1; | ||
{ | ||
const e = | ||
null === (t = this.td()) || void 0 === t | ||
null === (t = this.fd()) || void 0 === t | ||
? void 0 | ||
@@ -29,6 +29,6 @@ : t.open("Braze IndexedDB Support Test"); | ||
const t = window, | ||
e = t.chrome || t.browser || t.ed; | ||
e = t.chrome || t.browser || t.ad; | ||
if (e && e.runtime && e.runtime.id) | ||
return ( | ||
this.j.info( | ||
this.dd.info( | ||
"Not using IndexedDB for storage because we are running inside an extension", | ||
@@ -43,3 +43,3 @@ ), | ||
return ( | ||
this.j.info( | ||
this.dd.info( | ||
"Not using IndexedDB for storage due to following error: " + t, | ||
@@ -51,8 +51,8 @@ ), | ||
} | ||
nd(t, e) { | ||
vd(t, e) { | ||
var n; | ||
const o = | ||
null === (n = this.td()) || void 0 === n | ||
null === (n = this.fd()) || void 0 === n | ||
? void 0 | ||
: n.open(this.database.od, this.database.VERSION); | ||
: n.open(this.database.Dd, this.database.VERSION); | ||
if (null == o) return "function" == typeof e && e(), !1; | ||
@@ -63,5 +63,5 @@ const i = this; | ||
var e; | ||
i.j.info( | ||
i.dd.info( | ||
"Upgrading indexedDB " + | ||
i.database.od + | ||
i.database.Dd + | ||
" to v" + | ||
@@ -72,7 +72,7 @@ i.database.VERSION + | ||
const n = null === (e = t.target) || void 0 === e ? void 0 : e.result; | ||
for (const t in i.database.rs) { | ||
for (const t in i.database.ss) { | ||
const e = t; | ||
i.database.rs.hasOwnProperty(t) && | ||
!n.objectStoreNames.contains(i.database.rs[e]) && | ||
n.createObjectStore(i.database.rs[e]); | ||
i.database.ss.hasOwnProperty(t) && | ||
!n.objectStoreNames.contains(i.database.ss[e]) && | ||
n.createObjectStore(i.database.ss[e]); | ||
} | ||
@@ -86,3 +86,3 @@ }), | ||
"function" == typeof e && e(), | ||
i.j.error( | ||
i.dd.error( | ||
"Needed to close the database unexpectedly because of an upgrade in another tab", | ||
@@ -97,5 +97,5 @@ ); | ||
return ( | ||
i.j.info( | ||
i.dd.info( | ||
"Could not open indexedDB " + | ||
i.database.od + | ||
i.database.Dd + | ||
" v" + | ||
@@ -116,6 +116,6 @@ i.database.VERSION + | ||
const r = this; | ||
return this.nd((d) => { | ||
return this.vd((d) => { | ||
if (!d.objectStoreNames.contains(t)) | ||
return ( | ||
r.j.error( | ||
r.dd.error( | ||
"Could not store object " + | ||
@@ -126,3 +126,3 @@ e + | ||
" on indexedDB " + | ||
r.database.od + | ||
r.database.Dd + | ||
" - " + | ||
@@ -139,3 +139,3 @@ t + | ||
(u.onerror = () => { | ||
r.j.error( | ||
r.dd.error( | ||
"Could not store object " + | ||
@@ -146,3 +146,3 @@ e + | ||
" on indexedDB " + | ||
r.database.od, | ||
r.database.Dd, | ||
), | ||
@@ -159,6 +159,6 @@ "function" == typeof i && i(); | ||
const o = this; | ||
return this.nd((i) => { | ||
return this.vd((i) => { | ||
if (!i.objectStoreNames.contains(t)) | ||
return ( | ||
o.j.error( | ||
o.dd.error( | ||
"Could not retrieve object " + | ||
@@ -169,3 +169,3 @@ e + | ||
" on indexedDB " + | ||
o.database.od + | ||
o.database.Dd + | ||
" - " + | ||
@@ -181,3 +181,3 @@ t + | ||
(d.onerror = () => { | ||
o.j.error( | ||
o.dd.error( | ||
"Could not retrieve object " + | ||
@@ -188,3 +188,3 @@ e + | ||
" on indexedDB " + | ||
o.database.od, | ||
o.database.Dd, | ||
); | ||
@@ -199,13 +199,13 @@ }), | ||
} | ||
hr(t, e, n) { | ||
jr(t, e, n) { | ||
if (!this.isSupported()) return "function" == typeof n && n(), !1; | ||
const o = this; | ||
return this.nd((i) => { | ||
return this.vd((i) => { | ||
if (!i.objectStoreNames.contains(t)) | ||
return ( | ||
o.j.error( | ||
o.dd.error( | ||
"Could not retrieve last record from " + | ||
t + | ||
" on indexedDB " + | ||
o.database.od + | ||
o.database.Dd + | ||
" - " + | ||
@@ -222,4 +222,4 @@ t + | ||
(d.onerror = () => { | ||
o.j.error( | ||
"Could not open cursor for " + t + " on indexedDB " + o.database.od, | ||
o.dd.error( | ||
"Could not open cursor for " + t + " on indexedDB " + o.database.Dd, | ||
), | ||
@@ -237,9 +237,9 @@ "function" == typeof n && n(); | ||
} | ||
oe(t, e) { | ||
re(t, e) { | ||
if (!this.isSupported()) return !1; | ||
const n = this; | ||
return this.nd((o) => { | ||
return this.vd((o) => { | ||
if (!o.objectStoreNames.contains(t)) | ||
return ( | ||
n.j.error( | ||
n.dd.error( | ||
"Could not delete record " + | ||
@@ -250,3 +250,3 @@ e + | ||
" on indexedDB " + | ||
n.database.od + | ||
n.database.Dd + | ||
" - " + | ||
@@ -261,3 +261,3 @@ t + | ||
i.objectStore(t).delete(e).onerror = () => { | ||
n.j.error( | ||
n.dd.error( | ||
"Could not delete record " + | ||
@@ -268,3 +268,3 @@ e + | ||
" on indexedDB " + | ||
n.database.od, | ||
n.database.Dd, | ||
); | ||
@@ -274,13 +274,13 @@ }; | ||
} | ||
ss(t, e) { | ||
Zt(t, e) { | ||
if (!this.isSupported()) return !1; | ||
const n = this; | ||
return this.nd((o) => { | ||
return this.vd((o) => { | ||
if (!o.objectStoreNames.contains(t)) | ||
return ( | ||
n.j.error( | ||
n.dd.error( | ||
"Could not retrieve objects from " + | ||
t + | ||
" on indexedDB " + | ||
n.database.od + | ||
n.database.Dd + | ||
" - " + | ||
@@ -299,14 +299,14 @@ t + | ||
s.length > 0 | ||
? (n.j.info( | ||
? (n.dd.info( | ||
"Cursor closed midway through for " + | ||
t + | ||
" on indexedDB " + | ||
n.database.od, | ||
n.database.Dd, | ||
), | ||
e(s)) | ||
: n.j.error( | ||
: n.dd.error( | ||
"Could not open cursor for " + | ||
t + | ||
" on indexedDB " + | ||
n.database.od, | ||
n.database.Dd, | ||
); | ||
@@ -331,10 +331,10 @@ }), | ||
const t = []; | ||
for (const e in this.database.rs) { | ||
for (const e in this.database.ss) { | ||
const n = e; | ||
this.database.rs.hasOwnProperty(e) && | ||
this.database.rs[n] !== this.database.rs.se && | ||
t.push(this.database.rs[n]); | ||
this.database.ss.hasOwnProperty(e) && | ||
this.database.ss[n] !== this.database.ss.ae && | ||
t.push(this.database.ss[n]); | ||
} | ||
const e = this; | ||
return this.nd(function (n) { | ||
return this.vd(function (n) { | ||
const o = n.transaction(t, "readwrite"); | ||
@@ -345,7 +345,7 @@ o.oncomplete = () => n.close(); | ||
o.objectStore(i).clear().onerror = function () { | ||
e.j.error( | ||
e.dd.error( | ||
"Could not clear " + | ||
this.source.name + | ||
" on indexedDB " + | ||
e.database.od, | ||
e.database.Dd, | ||
); | ||
@@ -355,4 +355,4 @@ }; | ||
o.onerror = function () { | ||
e.j.error( | ||
"Could not clear object stores on indexedDB " + e.database.od, | ||
e.dd.error( | ||
"Could not clear object stores on indexedDB " + e.database.Dd, | ||
); | ||
@@ -363,15 +363,15 @@ }; | ||
} | ||
Oe.ep = { | ||
Zt: { | ||
od: "AppboyServiceWorkerAsyncStorage", | ||
A.Yt = { | ||
Qt: { | ||
Dd: "AppboyServiceWorkerAsyncStorage", | ||
VERSION: 6, | ||
rs: { | ||
Na: "data", | ||
kr: "pushClicks", | ||
ss: { | ||
Qa: "data", | ||
hr: "pushClicks", | ||
cu: "pushSubscribed", | ||
dd: "fallbackDevice", | ||
hs: "cardUpdates", | ||
se: "optOut", | ||
pd: "fallbackDevice", | ||
ts: "cardUpdates", | ||
ae: "optOut", | ||
wr: "pendingData", | ||
qh: "sdkAuthenticationSignature", | ||
xh: "sdkAuthenticationSignature", | ||
}, | ||
@@ -378,0 +378,0 @@ ie: 1, |
@@ -1,38 +0,38 @@ | ||
const Ue = { | ||
const r = { | ||
init: function (n) { | ||
(void 0 === n && void 0 !== Ue.zg) || (Ue.zg = !!n), Ue.t || (Ue.t = !0); | ||
(void 0 === n && void 0 !== r.zg) || (r.zg = !!n), r.t || (r.t = !0); | ||
}, | ||
destroy: function () { | ||
(Ue.t = !1), (Ue.zg = void 0), (Ue.j = void 0); | ||
(r.t = !1), (r.zg = void 0), (r.dd = void 0); | ||
}, | ||
setLogger: function (n) { | ||
"function" == typeof n | ||
? (Ue.init(), (Ue.j = n)) | ||
: Ue.info("Ignoring setLogger call since logger is not a function"); | ||
? (r.init(), (r.dd = n)) | ||
: r.info("Ignoring setLogger call since logger is not a function"); | ||
}, | ||
toggleLogging: function () { | ||
Ue.init(), | ||
Ue.zg | ||
? (console.log("Disabling Braze logging"), (Ue.zg = !1)) | ||
: (console.log("Enabled Braze logging"), (Ue.zg = !0)); | ||
r.init(), | ||
r.zg | ||
? (console.log("Disabling Braze logging"), (r.zg = !1)) | ||
: (console.log("Enabled Braze logging"), (r.zg = !0)); | ||
}, | ||
info: function (n) { | ||
if (Ue.zg) { | ||
if (r.zg) { | ||
const o = "Braze: " + n; | ||
null != Ue.j ? Ue.j(o) : console.log(o); | ||
null != r.dd ? r.dd(o) : console.log(o); | ||
} | ||
}, | ||
warn: function (n) { | ||
if (Ue.zg) { | ||
const o = "Braze SDK Warning: " + n + " (v5.0.1)"; | ||
null != Ue.j ? Ue.j(o) : console.warn(o); | ||
if (r.zg) { | ||
const o = "Braze SDK Warning: " + n + " (v5.1.0)"; | ||
null != r.dd ? r.dd(o) : console.warn(o); | ||
} | ||
}, | ||
error: function (n) { | ||
if (Ue.zg) { | ||
const o = "Braze SDK Error: " + n + " (v5.0.1)"; | ||
null != Ue.j ? Ue.j(o) : console.error(o); | ||
if (r.zg) { | ||
const o = "Braze SDK Error: " + n + " (v5.1.0)"; | ||
null != r.dd ? r.dd(o) : console.error(o); | ||
} | ||
}, | ||
}; | ||
export default Ue; | ||
export default r; |
export default { | ||
ho: "allowCrawlerActivity", | ||
_o: "baseUrl", | ||
Eo: "noCookies", | ||
Io: "devicePropertyAllowlist", | ||
Aa: "disablePushTokenMaintenance", | ||
Ao: "enableLogging", | ||
So: "enableSdkAuthentication", | ||
qa: "manageServiceWorkerExternally", | ||
No: "minimumIntervalBetweenTriggerActionsInSeconds", | ||
Oo: "sessionTimeoutInSeconds", | ||
wo: "appVersion", | ||
Po: "appVersionNumber", | ||
_a: "serviceWorkerLocation", | ||
ka: "safariWebsitePushId", | ||
Ba: "localization", | ||
po: "contentSecurityNonce", | ||
Ro: "allowUserSuppliedJavascript", | ||
lo: "inAppMessageZIndex", | ||
fo: "openInAppMessagesInNewTab", | ||
_o: "allowCrawlerActivity", | ||
Io: "baseUrl", | ||
Ao: "noCookies", | ||
So: "devicePropertyAllowlist", | ||
qa: "disablePushTokenMaintenance", | ||
No: "enableLogging", | ||
Oo: "enableSdkAuthentication", | ||
ka: "manageServiceWorkerExternally", | ||
Po: "minimumIntervalBetweenTriggerActionsInSeconds", | ||
Ro: "sessionTimeoutInSeconds", | ||
Lo: "appVersion", | ||
Do: "appVersionNumber", | ||
Ma: "serviceWorkerLocation", | ||
_a: "safariWebsitePushId", | ||
Xn: "localization", | ||
wo: "contentSecurityNonce", | ||
Mo: "allowUserSuppliedJavascript", | ||
ho: "inAppMessageZIndex", | ||
yo: "openInAppMessagesInNewTab", | ||
en: "openNewsFeedCardsInNewTab", | ||
mh: "requireExplicitInAppMessageDismissal", | ||
Co: "doNotLoadFontAwesome", | ||
Lo: "sdkFlavor", | ||
Uo: "doNotLoadFontAwesome", | ||
Bo: "sdkFlavor", | ||
tn: "openCardsInNewTab", | ||
}; |
import { ControlCard } from "./models/index.js"; | ||
import s from "../common/event-logger.js"; | ||
import t from "../models/request-result.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
export default class a { | ||
@@ -10,70 +10,68 @@ constructor(s) { | ||
} | ||
h(n, o) { | ||
const e = new t(); | ||
h(n, e) { | ||
const l = new t(); | ||
if ((n.p(), null == n.url || "" === n.url)) | ||
return ( | ||
r.j.info( | ||
`Card ${n.id} has no url. Not logging click to Braze servers.`, | ||
), | ||
e | ||
r.info(`Card ${n.id} has no url. Not logging click to Braze servers.`), | ||
l | ||
); | ||
if (o && n.id && this.u) { | ||
const s = this.u.v(i.k.C) || {}; | ||
(s[n.id] = !0), this.u.D(i.k.C, s); | ||
if (e && n.id && this.u) { | ||
const s = this.u.j(o.C.v) || {}; | ||
(s[n.id] = !0), this.u.k(o.C.v, s); | ||
} | ||
const l = this.I([n]); | ||
if (null == l) return e; | ||
const u = o ? r.q.$ : r.q.B; | ||
return s.N(u, l); | ||
const u = this.D([n]); | ||
if (null == u) return l; | ||
const c = e ? i.I : i.$; | ||
return s.q(c, u); | ||
} | ||
A(n) { | ||
const o = new t(); | ||
if (!n.F()) | ||
B(n) { | ||
const e = new t(); | ||
if (!n.N()) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
`Card ${n.id} refused this dismissal. Ignoring analytics event.`, | ||
), | ||
o | ||
e | ||
); | ||
if (n.id && this.u) { | ||
const s = this.u.v(i.k.G) || {}; | ||
(s[n.id] = !0), this.u.D(i.k.G, s); | ||
const s = this.u.j(o.C.A) || {}; | ||
(s[n.id] = !0), this.u.k(o.C.A, s); | ||
} | ||
const e = this.I([n]); | ||
return null == e ? o : s.N(r.q.H, e); | ||
const l = this.D([n]); | ||
return null == l ? e : s.q(i.F, l); | ||
} | ||
J(n, o) { | ||
G(n, r) { | ||
const e = new t(!0), | ||
l = [], | ||
u = []; | ||
let a = {}; | ||
this.u && (a = o ? this.u.v(i.k.K) || {} : this.u.v(i.k.L) || {}); | ||
let c = {}; | ||
this.u && (c = r ? this.u.j(o.C.H) || {} : this.u.j(o.C.J) || {}); | ||
for (const s of n) | ||
s.M(), | ||
s.K(), | ||
s instanceof ControlCard ? u.push(s) : l.push(s), | ||
s.id && (a[s.id] = !0); | ||
const h = this.I(l), | ||
c = this.I(u); | ||
if (null == h && null == c) return (e.O = !1), e; | ||
if ((this.u && (o ? this.u.D(i.k.K, a) : this.u.D(i.k.L, a)), null != h)) { | ||
const t = o ? r.q.P : r.q.R, | ||
n = s.N(t, h); | ||
e.S(n); | ||
s.id && (c[s.id] = !0); | ||
const h = this.D(l), | ||
a = this.D(u); | ||
if (null == h && null == a) return (e.L = !1), e; | ||
if ((this.u && (r ? this.u.k(o.C.H, c) : this.u.k(o.C.J, c)), null != h)) { | ||
const t = r ? i.M : i.O, | ||
n = s.q(t, h); | ||
e.P(n); | ||
} | ||
if (null != c && o) { | ||
const t = s.N(r.q.T, c); | ||
e.S(t); | ||
if (null != a && r) { | ||
const t = s.q(i.R, a); | ||
e.P(t); | ||
} | ||
return e; | ||
} | ||
I(s) { | ||
D(s) { | ||
let t, | ||
r = null; | ||
for (let n = 0; n < s.length; n++) | ||
(t = s[n].id), | ||
n = null; | ||
for (let r = 0; r < s.length; r++) | ||
(t = s[r].id), | ||
null != t && | ||
"" !== t && | ||
((r = r || {}), (r.ids = r.ids || []), r.ids.push(t)); | ||
return r; | ||
((n = n || {}), (n.ids = n.ids || []), n.ids.push(t)); | ||
return n; | ||
} | ||
} |
@@ -1,6 +0,6 @@ | ||
import { createCloseButton as o } from "../../util/component-utils.js"; | ||
import { detectSwipe as d, DIRECTIONS as c } from "../../util/dom-utils.js"; | ||
import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js"; | ||
import { createCloseButton as d } from "../../util/component-utils.js"; | ||
import { detectSwipe as c, DIRECTIONS as m } from "../../util/dom-utils.js"; | ||
import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js"; | ||
import { logCardDismissal } from "../index.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { Guid as p } from "../../../shared-lib/index.js"; | ||
export const TOP_IMPRESSION_DATA_ATTRIBUTE = "data-ab-had-top-impression"; | ||
@@ -39,3 +39,3 @@ export const BOTTOM_IMPRESSION_DATA_ATTRIBUTE = "data-ab-had-bottom-impression"; | ||
for (const o of t) | ||
if (((a = o._), a && o.imageUrl && "number" == typeof o.aspectRatio)) { | ||
if (((a = o.T), a && o.imageUrl && "number" == typeof o.aspectRatio)) { | ||
const t = n / o.aspectRatio; | ||
@@ -45,13 +45,13 @@ t && (a.style.height = `${t}px`); | ||
} | ||
export function cardToHtml(t, logCardClick, e) { | ||
const a = document.createElement("div"); | ||
(a.className = "ab-card ab-effect-card " + t.U), | ||
export function cardToHtml(t, logCardClick, o) { | ||
const e = document.createElement("div"); | ||
(e.className = "ab-card ab-effect-card " + t._), | ||
t.id && | ||
(a.setAttribute("data-ab-card-id", t.id), a.setAttribute("id", t.id)), | ||
a.setAttribute("role", "article"), | ||
a.setAttribute("tabindex", "0"); | ||
let n = "", | ||
i = !1; | ||
t.url && "" !== t.url && ((n = t.url), (i = !0)); | ||
const s = (o) => (markCardAsRead(a), i && (logCardClick(t), m(n, e, o)), !1); | ||
(e.setAttribute("data-ab-card-id", t.id), e.setAttribute("id", t.id)), | ||
e.setAttribute("role", "article"), | ||
e.setAttribute("tabindex", "0"); | ||
let a = "", | ||
n = !1; | ||
t.url && "" !== t.url && ((a = t.url), (n = !0)); | ||
const i = (i) => (markCardAsRead(e), n && (logCardClick(t), u(a, o, i)), !1); | ||
if (t.pinned) { | ||
@@ -61,3 +61,3 @@ const t = document.createElement("div"); | ||
const o = document.createElement("i"); | ||
(o.className = "fa fa-star"), t.appendChild(o), a.appendChild(t); | ||
(o.className = "fa fa-star"), t.appendChild(o), e.appendChild(t); | ||
} | ||
@@ -67,57 +67,57 @@ if (t.imageUrl && "" !== t.imageUrl) { | ||
o.className = "ab-image-area"; | ||
const e = document.createElement("img"); | ||
const r = document.createElement("img"); | ||
if ( | ||
(e.setAttribute("src", t.imageUrl), | ||
(e.onload = () => { | ||
a.style.height = "auto"; | ||
(r.setAttribute("src", t.imageUrl), | ||
(r.onload = () => { | ||
e.style.height = "auto"; | ||
}), | ||
_setImageAltText(t, e), | ||
o.appendChild(e), | ||
(a.className += " with-image"), | ||
i && !t.V) | ||
_setImageAltText(t, r), | ||
o.appendChild(r), | ||
(e.className += " with-image"), | ||
n && !t.S) | ||
) { | ||
const t = document.createElement("a"); | ||
t.setAttribute("href", n), | ||
(t.onclick = s), | ||
t.setAttribute("href", a), | ||
(t.onclick = i), | ||
t.appendChild(o), | ||
a.appendChild(t); | ||
} else a.appendChild(o); | ||
e.appendChild(t); | ||
} else e.appendChild(o); | ||
} | ||
const u = document.createElement("div"); | ||
if (((u.className = "ab-card-body"), t.dismissible)) { | ||
const r = document.createElement("div"); | ||
if (((r.className = "ab-card-body"), t.dismissible)) { | ||
t.logCardDismissal = () => logCardDismissal(t); | ||
const e = o("Dismiss Card", void 0, t.dismissCard.bind(t)); | ||
a.appendChild(e), | ||
d(u, c.W, (t) => { | ||
(a.className += " ab-swiped-left"), e.onclick(t); | ||
const o = d("Dismiss Card", void 0, t.dismissCard.bind(t)); | ||
e.appendChild(o), | ||
c(r, m.U, (t) => { | ||
(e.className += " ab-swiped-left"), o.onclick(t); | ||
}), | ||
d(u, c.X, (t) => { | ||
(a.className += " ab-swiped-right"), e.onclick(t); | ||
c(r, m.V, (t) => { | ||
(e.className += " ab-swiped-right"), o.onclick(t); | ||
}); | ||
} | ||
let p = "", | ||
b = !1; | ||
if ((t.title && "" !== t.title && ((p = t.title), (b = !0)), b)) { | ||
let s = "", | ||
l = !1; | ||
if ((t.title && "" !== t.title && ((s = t.title), (l = !0)), l)) { | ||
const t = document.createElement("h1"); | ||
if ( | ||
((t.className = "ab-title"), | ||
(t.id = r.Z.Y()), | ||
a.setAttribute("aria-labelledby", t.id), | ||
i) | ||
(t.id = p.W()), | ||
e.setAttribute("aria-labelledby", t.id), | ||
n) | ||
) { | ||
const o = document.createElement("a"); | ||
o.setAttribute("href", n), | ||
(o.onclick = s), | ||
o.appendChild(document.createTextNode(p)), | ||
o.setAttribute("href", a), | ||
(o.onclick = i), | ||
o.appendChild(document.createTextNode(s)), | ||
t.appendChild(o); | ||
} else t.appendChild(document.createTextNode(p)); | ||
u.appendChild(t); | ||
} else t.appendChild(document.createTextNode(s)); | ||
r.appendChild(t); | ||
} | ||
const l = document.createElement("div"); | ||
const b = document.createElement("div"); | ||
if ( | ||
((l.className = b ? "ab-description" : "ab-description ab-no-title"), | ||
(l.id = r.Z.Y()), | ||
a.setAttribute("aria-describedby", l.id), | ||
t.description && l.appendChild(document.createTextNode(t.description)), | ||
i) | ||
((b.className = l ? "ab-description" : "ab-description ab-no-title"), | ||
(b.id = p.W()), | ||
e.setAttribute("aria-describedby", b.id), | ||
t.description && b.appendChild(document.createTextNode(t.description)), | ||
n) | ||
) { | ||
@@ -127,9 +127,9 @@ const o = document.createElement("div"); | ||
const e = document.createElement("a"); | ||
e.setAttribute("href", n), | ||
e.setAttribute("href", a), | ||
t.linkText && e.appendChild(document.createTextNode(t.linkText)), | ||
(e.onclick = s), | ||
(e.onclick = i), | ||
o.appendChild(e), | ||
l.appendChild(o); | ||
b.appendChild(o); | ||
} | ||
u.appendChild(l), a.appendChild(u); | ||
r.appendChild(b), e.appendChild(r); | ||
const f = document.createElement("div"); | ||
@@ -139,6 +139,6 @@ return ( | ||
t.viewed && (f.className += " read"), | ||
a.appendChild(f), | ||
(t._ = a), | ||
a | ||
e.appendChild(f), | ||
(t.T = e), | ||
e | ||
); | ||
} |
@@ -5,8 +5,8 @@ import { Card } from "./models/index.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
export function logCardClick(o, a) { | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function logCardClick(o, m) { | ||
return ( | ||
!!e.rr() && | ||
(o instanceof Card ? n.m().h(o, a).O : (r.j.error("card " + f), !1)) | ||
!!e.X() && | ||
(o instanceof Card ? n.m().h(o, m).L : (r.error("card " + f), !1)) | ||
); | ||
} |
@@ -5,8 +5,7 @@ import { Card } from "./models/index.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function logCardDismissal(o) { | ||
return ( | ||
!!e.rr() && | ||
(o instanceof Card ? n.m().A(o).O : (r.j.error("card " + f), !1)) | ||
!!e.X() && (o instanceof Card ? n.m().B(o).L : (r.error("card " + f), !1)) | ||
); | ||
} |
import { Card } from "./models/index.js"; | ||
import n from "./card-manager-factory.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import { isArray as p } from "../util/code-utils.js"; | ||
import { isArray as j } from "../util/code-utils.js"; | ||
import { MUST_BE_CARD_WARNING_SUFFIX as f } from "../common/constants.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function logCardImpressions(o, s) { | ||
if (!e.rr()) return !1; | ||
if (!p(o)) return r.j.error("cards must be an array"), !1; | ||
for (const s of o) | ||
if (!(s instanceof Card)) return r.j.error(`Each card in cards ${f}`), !1; | ||
return n.m().J(o, s).O; | ||
if (!e.X()) return !1; | ||
if (!j(o)) return r.error("cards must be an array"), !1; | ||
for (const n of o) | ||
if (!(n instanceof Card)) return r.error(`Each card in cards ${f}`), !1; | ||
return n.m().G(o, s).L; | ||
} |
@@ -5,27 +5,27 @@ import Card from "./card.js"; | ||
super(t, s, i, h, e, r, a, o, c, n, d, p, u, l, m, f), | ||
(this.U = "ab-captioned-image"), | ||
(this.V = !0), | ||
(this._ = "ab-captioned-image"), | ||
(this.S = !0), | ||
(this.test = !1); | ||
} | ||
tt() { | ||
Y() { | ||
const t = {}; | ||
return ( | ||
(t[Card.it.st] = Card.et.ht), | ||
(t[Card.it.rt] = this.id), | ||
(t[Card.it.ot] = this.viewed), | ||
(t[Card.it.ct] = this.title), | ||
(t[Card.it.nt] = this.imageUrl), | ||
(t[Card.it.dt] = this.description), | ||
(t[Card.it.ut] = this.updated), | ||
(t[Card.it.lt] = this.created), | ||
(t[Card.it.ft] = this.categories), | ||
(t[Card.it.xt] = this.expiresAt), | ||
(t[Card.it.URL] = this.url), | ||
(t[Card.it.bt] = this.linkText), | ||
(t[Card.it.gt] = this.aspectRatio), | ||
(t[Card.it.jt] = this.extras), | ||
(t[Card.it.zt] = this.pinned), | ||
(t[Card.it.kt] = this.dismissible), | ||
(t[Card.it.qt] = this.clicked), | ||
(t[Card.it.vt] = this.test), | ||
(t[Card.tt.Z] = Card.it.st), | ||
(t[Card.tt.ht] = this.id), | ||
(t[Card.tt.et] = this.viewed), | ||
(t[Card.tt.rt] = this.title), | ||
(t[Card.tt.ot] = this.imageUrl), | ||
(t[Card.tt.ct] = this.description), | ||
(t[Card.tt.nt] = this.updated), | ||
(t[Card.tt.dt] = this.created), | ||
(t[Card.tt.ut] = this.categories), | ||
(t[Card.tt.lt] = this.expiresAt), | ||
(t[Card.tt.URL] = this.url), | ||
(t[Card.tt.ft] = this.linkText), | ||
(t[Card.tt.xt] = this.aspectRatio), | ||
(t[Card.tt.bt] = this.extras), | ||
(t[Card.tt.gt] = this.pinned), | ||
(t[Card.tt.jt] = this.dismissible), | ||
(t[Card.tt.zt] = this.clicked), | ||
(t[Card.tt.kt] = this.test), | ||
t | ||
@@ -32,0 +32,0 @@ ); |
@@ -5,7 +5,7 @@ import { | ||
} from "../../util/date-utils.js"; | ||
import { FEED_ANIMATION_DURATION as u } from "../../common/constants.js"; | ||
import E from "../../managers/subscription-manager.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { FEED_ANIMATION_DURATION as E } from "../../common/constants.js"; | ||
import T from "../../managers/subscription-manager.js"; | ||
import r from "../../../shared-lib/logger.js"; | ||
export default class Card { | ||
constructor(t, i, s, h, l, n, e, r, u, E, o, T, a, I, N, c) { | ||
constructor(t, i, s, h, l, n, e, r, u, E, o, T, I, a, N, c) { | ||
(this.id = t), | ||
@@ -23,4 +23,4 @@ (this.viewed = i), | ||
(this.aspectRatio = T), | ||
(this.extras = a), | ||
(this.pinned = I), | ||
(this.extras = I), | ||
(this.pinned = a), | ||
(this.dismissible = N), | ||
@@ -43,4 +43,4 @@ (this.clicked = c), | ||
(this.aspectRatio = isNaN(T) ? null : T)), | ||
(this.extras = a || {}), | ||
(this.pinned = I || !1), | ||
(this.extras = I || {}), | ||
(this.pinned = a || !1), | ||
(this.dismissible = N || !1), | ||
@@ -69,3 +69,3 @@ (this.dismissed = !1), | ||
"function" == typeof this.logCardDismissal && this.logCardDismissal(); | ||
let t = this._; | ||
let t = this.T; | ||
!t && this.id && (t = document.getElementById(this.id)), | ||
@@ -83,11 +83,11 @@ t && | ||
}, Card.At)); | ||
}, u)); | ||
}, E)); | ||
} | ||
Nt() { | ||
return null == this.Et && (this.Et = new E()), this.Et; | ||
return null == this.Et && (this.Et = new T()), this.Et; | ||
} | ||
St() { | ||
return null == this.Tt && (this.Tt = new E()), this.Tt; | ||
return null == this.Tt && (this.Tt = new T()), this.Tt; | ||
} | ||
M() { | ||
K() { | ||
this.viewed = !0; | ||
@@ -98,3 +98,3 @@ } | ||
} | ||
F() { | ||
N() { | ||
return ( | ||
@@ -106,24 +106,24 @@ !(!this.dismissible || this.dismissed) && | ||
Ct(t) { | ||
if (null == t || t[Card.Rt.rt] !== this.id) return !0; | ||
if (null == t || t[Card.Rt.ht] !== this.id) return !0; | ||
if (t[Card.Rt.Lt]) return !1; | ||
if ( | ||
null != t[Card.Rt.ut] && | ||
null != t[Card.Rt.nt] && | ||
null != this.updated && | ||
parseInt(t[Card.Rt.ut]) < h(this.updated.valueOf()) | ||
parseInt(t[Card.Rt.nt]) < h(this.updated.valueOf()) | ||
) | ||
return !0; | ||
if ( | ||
(t[Card.Rt.ot] && !this.viewed && (this.viewed = !0), | ||
t[Card.Rt.qt] && !this.clicked && (this.clicked = t[Card.Rt.qt]), | ||
null != t[Card.Rt.ct] && (this.title = t[Card.Rt.ct]), | ||
null != t[Card.Rt.nt] && (this.imageUrl = t[Card.Rt.nt]), | ||
null != t[Card.Rt.dt] && (this.description = t[Card.Rt.dt]), | ||
null != t[Card.Rt.ut]) | ||
(t[Card.Rt.et] && !this.viewed && (this.viewed = !0), | ||
t[Card.Rt.zt] && !this.clicked && (this.clicked = t[Card.Rt.zt]), | ||
null != t[Card.Rt.rt] && (this.title = t[Card.Rt.rt]), | ||
null != t[Card.Rt.ot] && (this.imageUrl = t[Card.Rt.ot]), | ||
null != t[Card.Rt.ct] && (this.description = t[Card.Rt.ct]), | ||
null != t[Card.Rt.nt]) | ||
) { | ||
const i = l(t[Card.Rt.ut]); | ||
const i = l(t[Card.Rt.nt]); | ||
null != i && (this.updated = i); | ||
} | ||
if (null != t[Card.Rt.xt]) { | ||
if (null != t[Card.Rt.lt]) { | ||
let i; | ||
(i = t[Card.Rt.xt] === Card._t ? null : l(t[Card.Rt.xt])), | ||
(i = t[Card.Rt.lt] === Card._t ? null : l(t[Card.Rt.lt])), | ||
(this.expiresAt = i); | ||
@@ -133,18 +133,18 @@ } | ||
(null != t[Card.Rt.URL] && (this.url = t[Card.Rt.URL]), | ||
null != t[Card.Rt.bt] && (this.linkText = t[Card.Rt.bt]), | ||
null != t[Card.Rt.gt]) | ||
null != t[Card.Rt.ft] && (this.linkText = t[Card.Rt.ft]), | ||
null != t[Card.Rt.xt]) | ||
) { | ||
const i = parseFloat(t[Card.Rt.gt].toString()); | ||
const i = parseFloat(t[Card.Rt.xt].toString()); | ||
this.aspectRatio = isNaN(i) ? null : i; | ||
} | ||
return ( | ||
null != t[Card.Rt.jt] && (this.extras = t[Card.Rt.jt]), | ||
null != t[Card.Rt.zt] && (this.pinned = t[Card.Rt.zt]), | ||
null != t[Card.Rt.kt] && (this.dismissible = t[Card.Rt.kt]), | ||
null != t[Card.Rt.vt] && (this.test = t[Card.Rt.vt]), | ||
null != t[Card.Rt.bt] && (this.extras = t[Card.Rt.bt]), | ||
null != t[Card.Rt.gt] && (this.pinned = t[Card.Rt.gt]), | ||
null != t[Card.Rt.jt] && (this.dismissible = t[Card.Rt.jt]), | ||
null != t[Card.Rt.kt] && (this.test = t[Card.Rt.kt]), | ||
!0 | ||
); | ||
} | ||
tt() { | ||
r.j.error("Must be implemented in a subclass"); | ||
Y() { | ||
r.error("Must be implemented in a subclass"); | ||
} | ||
@@ -154,22 +154,22 @@ } | ||
(Card.Rt = { | ||
rt: "id", | ||
ot: "v", | ||
kt: "db", | ||
ht: "id", | ||
et: "v", | ||
jt: "db", | ||
Lt: "r", | ||
ut: "ca", | ||
zt: "p", | ||
xt: "ea", | ||
jt: "e", | ||
st: "tp", | ||
nt: "i", | ||
ct: "tt", | ||
dt: "ds", | ||
nt: "ca", | ||
gt: "p", | ||
lt: "ea", | ||
bt: "e", | ||
Z: "tp", | ||
ot: "i", | ||
rt: "tt", | ||
ct: "ds", | ||
URL: "u", | ||
bt: "dm", | ||
gt: "ar", | ||
qt: "cl", | ||
vt: "t", | ||
ft: "dm", | ||
xt: "ar", | ||
zt: "cl", | ||
kt: "t", | ||
}), | ||
(Card.et = { | ||
ht: "captioned_image", | ||
(Card.it = { | ||
st: "captioned_image", | ||
Ot: "text_announcement", | ||
@@ -180,28 +180,28 @@ Mt: "short_news", | ||
}), | ||
(Card.it = { | ||
rt: "id", | ||
ot: "v", | ||
kt: "db", | ||
lt: "cr", | ||
ut: "ca", | ||
zt: "p", | ||
ft: "t", | ||
xt: "ea", | ||
jt: "e", | ||
st: "tp", | ||
nt: "i", | ||
ct: "tt", | ||
dt: "ds", | ||
(Card.tt = { | ||
ht: "id", | ||
et: "v", | ||
jt: "db", | ||
dt: "cr", | ||
nt: "ca", | ||
gt: "p", | ||
ut: "t", | ||
lt: "ea", | ||
bt: "e", | ||
Z: "tp", | ||
ot: "i", | ||
rt: "tt", | ||
ct: "ds", | ||
URL: "u", | ||
bt: "dm", | ||
gt: "ar", | ||
qt: "cl", | ||
vt: "s", | ||
ft: "dm", | ||
xt: "ar", | ||
zt: "cl", | ||
kt: "s", | ||
}), | ||
(Card.Gt = { | ||
Xt: "ADVERTISING", | ||
Vt: "ANNOUNCEMENTS", | ||
Wt: "NEWS", | ||
Ft: "SOCIAL", | ||
vt: "ANNOUNCEMENTS", | ||
Vt: "NEWS", | ||
Wt: "SOCIAL", | ||
}), | ||
(Card.At = 400); |
@@ -5,26 +5,26 @@ import Card from "./card.js"; | ||
super(s, t, i, h, r, c, e, a, o, d, l, n, u, p, f, m), | ||
(this.U = "ab-classic-card"), | ||
(this.V = !0); | ||
(this._ = "ab-classic-card"), | ||
(this.S = !0); | ||
} | ||
tt() { | ||
Y() { | ||
const s = {}; | ||
return ( | ||
(s[Card.it.st] = Card.et.Mt), | ||
(s[Card.it.rt] = this.id), | ||
(s[Card.it.ot] = this.viewed), | ||
(s[Card.it.ct] = this.title), | ||
(s[Card.it.nt] = this.imageUrl), | ||
(s[Card.it.dt] = this.description), | ||
(s[Card.it.ut] = this.updated), | ||
(s[Card.it.lt] = this.created), | ||
(s[Card.it.ft] = this.categories), | ||
(s[Card.it.xt] = this.expiresAt), | ||
(s[Card.it.URL] = this.url), | ||
(s[Card.it.bt] = this.linkText), | ||
(s[Card.it.gt] = this.aspectRatio), | ||
(s[Card.it.jt] = this.extras), | ||
(s[Card.it.zt] = this.pinned), | ||
(s[Card.it.kt] = this.dismissible), | ||
(s[Card.it.qt] = this.clicked), | ||
(s[Card.it.vt] = this.test), | ||
(s[Card.tt.Z] = Card.it.Mt), | ||
(s[Card.tt.ht] = this.id), | ||
(s[Card.tt.et] = this.viewed), | ||
(s[Card.tt.rt] = this.title), | ||
(s[Card.tt.ot] = this.imageUrl), | ||
(s[Card.tt.ct] = this.description), | ||
(s[Card.tt.nt] = this.updated), | ||
(s[Card.tt.dt] = this.created), | ||
(s[Card.tt.ut] = this.categories), | ||
(s[Card.tt.lt] = this.expiresAt), | ||
(s[Card.tt.URL] = this.url), | ||
(s[Card.tt.ft] = this.linkText), | ||
(s[Card.tt.xt] = this.aspectRatio), | ||
(s[Card.tt.bt] = this.extras), | ||
(s[Card.tt.gt] = this.pinned), | ||
(s[Card.tt.jt] = this.dismissible), | ||
(s[Card.tt.zt] = this.clicked), | ||
(s[Card.tt.kt] = this.test), | ||
s | ||
@@ -31,0 +31,0 @@ ); |
@@ -6,16 +6,16 @@ import Card from "./card.js"; | ||
(this.isControl = !0), | ||
(this.U = "ab-control-card"), | ||
(this.V = !1); | ||
(this._ = "ab-control-card"), | ||
(this.S = !1); | ||
} | ||
tt() { | ||
Y() { | ||
const l = {}; | ||
return ( | ||
(l[Card.it.st] = Card.et.Ut), | ||
(l[Card.it.rt] = this.id), | ||
(l[Card.it.ot] = this.viewed), | ||
(l[Card.it.ut] = this.updated), | ||
(l[Card.it.xt] = this.expiresAt), | ||
(l[Card.it.jt] = this.extras), | ||
(l[Card.it.zt] = this.pinned), | ||
(l[Card.it.vt] = this.test), | ||
(l[Card.tt.Z] = Card.it.Ut), | ||
(l[Card.tt.ht] = this.id), | ||
(l[Card.tt.et] = this.viewed), | ||
(l[Card.tt.nt] = this.updated), | ||
(l[Card.tt.lt] = this.expiresAt), | ||
(l[Card.tt.bt] = this.extras), | ||
(l[Card.tt.gt] = this.pinned), | ||
(l[Card.tt.kt] = this.test), | ||
l | ||
@@ -22,0 +22,0 @@ ); |
@@ -5,25 +5,25 @@ import Card from "./card.js"; | ||
super(s, t, null, i, null, h, r, e, l, n, o, a, u, c, d, m), | ||
(this.U = "ab-image-only"), | ||
(this.V = !1), | ||
(this._ = "ab-image-only"), | ||
(this.S = !1), | ||
(this.test = !1); | ||
} | ||
tt() { | ||
Y() { | ||
const s = {}; | ||
return ( | ||
(s[Card.it.st] = Card.et.Pt), | ||
(s[Card.it.rt] = this.id), | ||
(s[Card.it.ot] = this.viewed), | ||
(s[Card.it.nt] = this.imageUrl), | ||
(s[Card.it.ut] = this.updated), | ||
(s[Card.it.lt] = this.created), | ||
(s[Card.it.ft] = this.categories), | ||
(s[Card.it.xt] = this.expiresAt), | ||
(s[Card.it.URL] = this.url), | ||
(s[Card.it.bt] = this.linkText), | ||
(s[Card.it.gt] = this.aspectRatio), | ||
(s[Card.it.jt] = this.extras), | ||
(s[Card.it.zt] = this.pinned), | ||
(s[Card.it.kt] = this.dismissible), | ||
(s[Card.it.qt] = this.clicked), | ||
(s[Card.it.vt] = this.test), | ||
(s[Card.tt.Z] = Card.it.Pt), | ||
(s[Card.tt.ht] = this.id), | ||
(s[Card.tt.et] = this.viewed), | ||
(s[Card.tt.ot] = this.imageUrl), | ||
(s[Card.tt.nt] = this.updated), | ||
(s[Card.tt.dt] = this.created), | ||
(s[Card.tt.ut] = this.categories), | ||
(s[Card.tt.lt] = this.expiresAt), | ||
(s[Card.tt.URL] = this.url), | ||
(s[Card.tt.ft] = this.linkText), | ||
(s[Card.tt.xt] = this.aspectRatio), | ||
(s[Card.tt.bt] = this.extras), | ||
(s[Card.tt.gt] = this.pinned), | ||
(s[Card.tt.jt] = this.dismissible), | ||
(s[Card.tt.zt] = this.clicked), | ||
(s[Card.tt.kt] = this.test), | ||
s | ||
@@ -30,0 +30,0 @@ ); |
@@ -12,32 +12,32 @@ import { | ||
} from "../../util/date-utils.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
export function newCard(e, n, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x, F) { | ||
let b; | ||
if (n === Card.et.Ot || n === Card.et.Mt) | ||
b = new ClassicCard(e, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x); | ||
else if (n === Card.et.ht) | ||
b = new CaptionedImage(e, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x); | ||
else if (n === Card.et.Pt) | ||
b = new ImageOnly(e, t, i, u, d, a, s, w, f, m, C, p, c, x); | ||
import { logger as r } from "../../../shared-lib/index.js"; | ||
export function newCard(n, e, t, o, i, l, u, d, a, w, f, s, m, C, p, c, x, F) { | ||
let j; | ||
if (e === Card.it.Ot || e === Card.it.Mt) | ||
j = new ClassicCard(n, t, o, i, l, u, d, a, w, f, s, m, C, p, c, x); | ||
else if (e === Card.it.st) | ||
j = new CaptionedImage(n, t, o, i, l, u, d, a, w, f, s, m, C, p, c, x); | ||
else if (e === Card.it.Pt) | ||
j = new ImageOnly(n, t, i, u, d, a, w, f, s, m, C, p, c, x); | ||
else { | ||
if (n !== Card.et.Ut) | ||
return r.j.error("Ignoring card with unknown type " + n), null; | ||
b = new ControlCard(e, t, d, s, C, p); | ||
if (e !== Card.it.Ut) | ||
return r.error("Ignoring card with unknown type " + e), null; | ||
j = new ControlCard(n, t, d, w, C, p); | ||
} | ||
return F && (b.test = F), b; | ||
return F && (j.test = F), j; | ||
} | ||
export function newCardFromContentCardsJson(e) { | ||
if (e[Card.Rt.Lt]) return null; | ||
const n = e[Card.Rt.rt], | ||
r = e[Card.Rt.st], | ||
t = e[Card.Rt.ot], | ||
o = e[Card.Rt.ct], | ||
i = e[Card.Rt.nt], | ||
u = e[Card.Rt.dt], | ||
d = l(e[Card.Rt.ut]), | ||
export function newCardFromContentCardsJson(n) { | ||
if (n[Card.Rt.Lt]) return null; | ||
const e = n[Card.Rt.ht], | ||
r = n[Card.Rt.Z], | ||
t = n[Card.Rt.et], | ||
o = n[Card.Rt.rt], | ||
i = n[Card.Rt.ot], | ||
u = n[Card.Rt.ct], | ||
d = l(n[Card.Rt.nt]), | ||
a = d; | ||
let s; | ||
s = e[Card.Rt.xt] === Card._t ? null : l(e[Card.Rt.xt]); | ||
let w; | ||
w = n[Card.Rt.lt] === Card._t ? null : l(n[Card.Rt.lt]); | ||
return newCard( | ||
n, | ||
e, | ||
r, | ||
@@ -51,29 +51,29 @@ t, | ||
null, | ||
s, | ||
e[Card.Rt.URL], | ||
e[Card.Rt.bt], | ||
e[Card.Rt.gt], | ||
e[Card.Rt.jt], | ||
e[Card.Rt.zt], | ||
e[Card.Rt.kt], | ||
e[Card.Rt.qt], | ||
e[Card.Rt.vt] || !1, | ||
w, | ||
n[Card.Rt.URL], | ||
n[Card.Rt.ft], | ||
n[Card.Rt.xt], | ||
n[Card.Rt.bt], | ||
n[Card.Rt.gt], | ||
n[Card.Rt.jt], | ||
n[Card.Rt.zt], | ||
n[Card.Rt.kt] || !1, | ||
); | ||
} | ||
export function newCardFromFeedJson(e) { | ||
export function newCardFromFeedJson(n) { | ||
return newCard( | ||
e.id, | ||
e.type, | ||
e.viewed, | ||
e.title, | ||
e.image, | ||
e.description, | ||
l(e.created), | ||
l(e.updated), | ||
e.categories, | ||
l(e.expires_at), | ||
e.url, | ||
e.domain, | ||
e.aspect_ratio, | ||
e.extras, | ||
n.id, | ||
n.type, | ||
n.viewed, | ||
n.title, | ||
n.image, | ||
n.description, | ||
l(n.created), | ||
l(n.updated), | ||
n.categories, | ||
l(n.expires_at), | ||
n.url, | ||
n.domain, | ||
n.aspect_ratio, | ||
n.extras, | ||
!1, | ||
@@ -83,25 +83,25 @@ !1, | ||
} | ||
export function newCardFromSerializedValue(e) { | ||
export function newCardFromSerializedValue(n) { | ||
return ( | ||
newCard( | ||
e[Card.it.rt], | ||
e[Card.it.st], | ||
e[Card.it.ot], | ||
e[Card.it.ct], | ||
e[Card.it.nt], | ||
e[Card.it.dt], | ||
w(e[Card.it.lt]), | ||
w(e[Card.it.ut]), | ||
e[Card.it.ft], | ||
w(e[Card.it.xt]), | ||
e[Card.it.URL], | ||
e[Card.it.bt], | ||
e[Card.it.gt], | ||
e[Card.it.jt], | ||
e[Card.it.zt], | ||
e[Card.it.kt], | ||
e[Card.it.qt], | ||
e[Card.it.vt] || !1, | ||
n[Card.tt.ht], | ||
n[Card.tt.Z], | ||
n[Card.tt.et], | ||
n[Card.tt.rt], | ||
n[Card.tt.ot], | ||
n[Card.tt.ct], | ||
w(n[Card.tt.dt]), | ||
w(n[Card.tt.nt]), | ||
n[Card.tt.ut], | ||
w(n[Card.tt.lt]), | ||
n[Card.tt.URL], | ||
n[Card.tt.ft], | ||
n[Card.tt.xt], | ||
n[Card.tt.bt], | ||
n[Card.tt.gt], | ||
n[Card.tt.jt], | ||
n[Card.tt.zt], | ||
n[Card.tt.kt] || !1, | ||
) || void 0 | ||
); | ||
} |
@@ -1,2 +0,2 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import { ControlCard } from "../Card/index.js"; | ||
@@ -16,15 +16,15 @@ export const FEED_ANIMATION_DURATION = 500; | ||
} | ||
ur() { | ||
r.j.error("Must be implemented in a subclass"); | ||
dr() { | ||
r.error("Must be implemented in a subclass"); | ||
} | ||
logCardImpressions(s) { | ||
r.j.error("Must be implemented in a subclass"); | ||
r.error("Must be implemented in a subclass"); | ||
} | ||
logCardClick(s) { | ||
r.j.error("Must be implemented in a subclass"); | ||
r.error("Must be implemented in a subclass"); | ||
} | ||
sr() { | ||
r.j.error("Must be implemented in a subclass"); | ||
r.error("Must be implemented in a subclass"); | ||
} | ||
} | ||
(x.mr = 6e4), (x.Oh = 500), (x.uo = 1e4); | ||
(x.ur = 6e4), (x.Oh = 500), (x.Co = 1e4); |
export default class y { | ||
constructor() {} | ||
Ss(a) {} | ||
Rs(a) {} | ||
changeUser(a = !1) {} | ||
clearData(a = !1) {} | ||
} |
@@ -12,4 +12,6 @@ export const MAX_PURCHASE_QUANTITY = 100; | ||
export const CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT = 90; | ||
export const GLOBAL_RATE_LIMIT_CAPACITY_DEFAULT = 30; | ||
export const GLOBAL_RATE_LIMIT_REFILL_RATE_DEFAULT = 30; | ||
export const LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT = 72e5; | ||
export const MAX_ERROR_RETRIES_CONTENT_CARDS = 3; | ||
export const REQUEST_ATTEMPT_DEFAULT = 1; |
@@ -1,2 +0,2 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import e from "../managers/braze-instance.js"; | ||
@@ -6,27 +6,30 @@ import ue from "../models/braze-event.js"; | ||
const s = { | ||
N: (o, n, s) => { | ||
var i; | ||
const a = new t(), | ||
l = e.aa(); | ||
if (!l) | ||
q: (o, n, s) => { | ||
var i, l; | ||
const d = new t(), | ||
m = e.zr(); | ||
if (!m) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
`Not logging event with type "${o}" because the current session ID could not be found.`, | ||
), | ||
a | ||
d | ||
); | ||
const m = l.co(); | ||
a.ve.push( | ||
new ue( | ||
s || (null === (i = e.ir()) || void 0 === i ? void 0 : i.getUserId()), | ||
o, | ||
new Date().valueOf(), | ||
m, | ||
n, | ||
const u = m.xo(); | ||
return ( | ||
d.ge.push( | ||
new ue( | ||
s || (null === (i = e.er()) || void 0 === i ? void 0 : i.getUserId()), | ||
o, | ||
new Date().valueOf(), | ||
u, | ||
n, | ||
), | ||
), | ||
(d.L = | ||
(null === (l = e.l()) || void 0 === l ? void 0 : l.zo(d.ge)) || !1), | ||
d | ||
); | ||
const u = e.l(); | ||
return u && (a.O = u.bo(a.ve)), a; | ||
}, | ||
}; | ||
export default s; |
@@ -6,4 +6,4 @@ import x from "./base-feed.js"; | ||
impressOnBottom as Fe, | ||
impressOnTop as Te, | ||
markCardAsRead as xe, | ||
impressOnTop as xe, | ||
markCardAsRead as Te, | ||
topHadImpression as Ee, | ||
@@ -14,12 +14,12 @@ } from "../Card/display/card-display.js"; | ||
import { cardToHtml as _e } from "../Card/display/card-display.js"; | ||
import { isArray as p } from "../util/code-utils.js"; | ||
import { isArray as j } from "../util/code-utils.js"; | ||
import { KeyCodes as at } from "../util/key-codes.js"; | ||
import je from "../l10n/l10n-manager-factory.js"; | ||
import { removeSubscription } from "../Core/remove-subscription.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { BRAZE_ACTION_URI_REGEX as W } from "../util/validation-utils.js"; | ||
import { logger as r, Guid as p } from "../../shared-lib/index.js"; | ||
import { BRAZE_ACTION_URI_REGEX as Z } from "../util/validation-utils.js"; | ||
import { | ||
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as dt, | ||
ineligibleBrazeActionURLErrorMessage as ft, | ||
getDecodedBrazeAction as O, | ||
getDecodedBrazeAction as W, | ||
containsUnknownBrazeAction as gt, | ||
@@ -64,5 +64,5 @@ } from "../util/braze-actions.js"; | ||
const i = n instanceof ControlCard; | ||
!i || e.ur() | ||
!i || e.dr() | ||
? (o.appendChild(_e(n, logCardClick, t)), (s = s || !i)) | ||
: r.j.error( | ||
: r.error( | ||
"Received a control card for a legacy news feed. Control cards are only supported with content cards.", | ||
@@ -85,3 +85,3 @@ ); | ||
s = t.querySelectorAll(".ab-card"); | ||
e.yo || (e.yo = {}); | ||
e.Fo || (e.Fo = {}); | ||
for (let t = 0; t < s.length; t++) { | ||
@@ -91,4 +91,4 @@ const n = ye(s[t]), | ||
i = he(s[t]); | ||
if (e.yo[n]) { | ||
r || i || xe(s[t]); | ||
if (e.Fo[n]) { | ||
r || i || Te(s[t]); | ||
continue; | ||
@@ -101,3 +101,3 @@ } | ||
if ( | ||
(!a && r && ((a = !0), Te(s[t])), | ||
(!a && r && ((a = !0), xe(s[t])), | ||
!d && i && ((d = !0), Fe(s[t])), | ||
@@ -109,3 +109,3 @@ a && d) | ||
if (t.id === n) { | ||
(e.yo[t.id] = !0), o.push(t); | ||
(e.Fo[t.id] = !0), o.push(t); | ||
break; | ||
@@ -140,3 +140,3 @@ } | ||
} | ||
}, x.uo), | ||
}, x.Co), | ||
e.sr(); | ||
@@ -154,35 +154,35 @@ } | ||
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) => { | ||
const r = document.createElement("i"); | ||
(r.className = "fa fa-times ab-close-button"), | ||
r.setAttribute("aria-label", "Close Feed"), | ||
r.setAttribute("tabindex", "0"), | ||
r.setAttribute("role", "button"); | ||
const i = (e) => { | ||
destroyFeedHtml(s), e.stopPropagation(); | ||
}; | ||
i.addEventListener("keydown", (e) => { | ||
(e.keyCode !== at.Fo && e.keyCode !== at.To) || a(e); | ||
r.addEventListener("keydown", (e) => { | ||
(e.keyCode !== at.To && e.keyCode !== at.Eo) || i(e); | ||
}), | ||
(i.onclick = a); | ||
const d = document.createElement("i"); | ||
(d.className = "fa fa-refresh ab-refresh-button"), | ||
e && null == e.lastUpdated && (d.className += " fa-spin"), | ||
d.setAttribute("aria-label", "Refresh Feed"), | ||
d.setAttribute("tabindex", "0"), | ||
d.setAttribute("role", "button"); | ||
const l = (t) => { | ||
(r.onclick = i); | ||
const a = document.createElement("i"); | ||
(a.className = "fa fa-refresh ab-refresh-button"), | ||
e && null == e.lastUpdated && (a.className += " fa-spin"), | ||
a.setAttribute("aria-label", "Refresh Feed"), | ||
a.setAttribute("tabindex", "0"), | ||
a.setAttribute("role", "button"); | ||
const d = (t) => { | ||
refreshFeed(e, s), t.stopPropagation(); | ||
}; | ||
d.addEventListener("keydown", (e) => { | ||
(e.keyCode !== at.Fo && e.keyCode !== at.To) || l(e); | ||
a.addEventListener("keydown", (e) => { | ||
(e.keyCode !== at.To && e.keyCode !== at.Eo) || d(e); | ||
}), | ||
(d.onclick = l), | ||
n.appendChild(d), | ||
n.appendChild(i), | ||
(a.onclick = d), | ||
n.appendChild(a), | ||
n.appendChild(r), | ||
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); | ||
const l = () => detectFeedImpressions(e, s); | ||
if ((s.addEventListener("scroll", l), !o)) { | ||
window.addEventListener("scroll", l); | ||
const e = p.W(); | ||
(scrollListeners[e] = l), s.setAttribute("data-listener-id", e); | ||
} | ||
@@ -192,10 +192,10 @@ return s; | ||
export function updateFeedCards(e, t, o, s, n) { | ||
if (!p(t)) return; | ||
if (!j(t)) return; | ||
const i = []; | ||
for (const e of t) | ||
if (e instanceof Card) { | ||
if (e.url && W.test(e.url)) { | ||
const t = O(e.url); | ||
if (e.url && Z.test(e.url)) { | ||
const t = W(e.url); | ||
if (gt(t)) { | ||
r.j.error(ft(dt._r, "Content Card")); | ||
r.error(ft(dt.Xi, "Content Card")); | ||
continue; | ||
@@ -202,0 +202,0 @@ } |
@@ -6,7 +6,7 @@ import e from "../managers/braze-instance.js"; | ||
provider: null, | ||
er: () => ( | ||
rr: () => ( | ||
g.o(), | ||
g.provider || | ||
((g.provider = new v(e.ir(), e.l(), e.tr(), e.nr(), e.ar())), | ||
e.dr(g.provider)), | ||
((g.provider = new v(e.er(), e.l(), e.ir(), e.tr(), e.nr())), | ||
e.ar(g.provider)), | ||
g.provider | ||
@@ -13,0 +13,0 @@ ), |
@@ -8,12 +8,16 @@ import C, { readResponseHeaders as b } from "../util/net.js"; | ||
import { | ||
newCardFromContentCardsJson as j, | ||
newCardFromSerializedValue as R, | ||
newCardFromContentCardsJson as R, | ||
newCardFromSerializedValue as D, | ||
} from "../Card/util/card-factory.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import E from "../managers/subscription-manager.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import T from "../managers/subscription-manager.js"; | ||
import s from "../common/event-logger.js"; | ||
import T from "../util/request-header-utils.js"; | ||
import { randomInclusive as D } from "../util/math.js"; | ||
import { MAX_ERROR_RETRIES_CONTENT_CARDS as S } from "../common/constants.js"; | ||
import S from "../util/request-header-utils.js"; | ||
import { randomInclusive as k } from "../util/math.js"; | ||
import { MAX_ERROR_RETRIES_CONTENT_CARDS as U } from "../common/constants.js"; | ||
import { | ||
logger as r, | ||
IndexedDBAdapter as A, | ||
EventTypes as i, | ||
} from "../../shared-lib/index.js"; | ||
export default class v extends y { | ||
@@ -25,76 +29,76 @@ constructor(t, s, i, h, n) { | ||
(this.yt = i), | ||
(this.Jt = h), | ||
(this.$t = n), | ||
(this.Ft = h), | ||
(this.qt = n), | ||
(this.wt = t), | ||
(this.u = s), | ||
(this.yt = i), | ||
(this.Jt = h), | ||
(this.$t = n), | ||
(this.Bt = new E()), | ||
e.Ht(this.Bt), | ||
(this.Kt = 0), | ||
(this.Qt = 0), | ||
(this.Ft = h), | ||
(this.qt = n), | ||
(this.Jt = new T()), | ||
e.$t(this.Jt), | ||
(this.Bt = 0), | ||
(this.Ht = 0), | ||
(this.cards = []), | ||
this.Yt(); | ||
const o = r.ts.Zt; | ||
new r.es(o, r.j).ss(o.rs.hs, (t) => { | ||
this.ns(t); | ||
this.Kt(); | ||
const o = A.Yt.Qt; | ||
new A(o, r).Zt(o.ss.ts, (t) => { | ||
this.es(t); | ||
}), | ||
(this.hs = null), | ||
(this.rs = null), | ||
(this.ns = null), | ||
(this.os = null), | ||
(this.ls = null), | ||
(this.us = null), | ||
(this.cs = null), | ||
(this.fs = null), | ||
(this.ds = 10), | ||
(this.ps = 0); | ||
(this.us = 10), | ||
(this.cs = 0); | ||
} | ||
Cs() { | ||
return this.os; | ||
fs() { | ||
return this.hs; | ||
} | ||
ws(t) { | ||
this.os = t; | ||
ds(t) { | ||
this.hs = t; | ||
} | ||
bs() { | ||
return this.ls; | ||
ps() { | ||
return this.rs; | ||
} | ||
vs(t) { | ||
this.ls = t; | ||
this.rs = t; | ||
} | ||
Yt() { | ||
Kt() { | ||
if (!this.u) return; | ||
const t = this.u.v(i.k.gs) || [], | ||
const t = this.u.j(o.C.Cs) || [], | ||
s = []; | ||
for (let i = 0; i < t.length; i++) { | ||
const e = R(t[i]); | ||
const e = D(t[i]); | ||
null != e && s.push(e); | ||
} | ||
(this.cards = this.ys(this.Ns(s, !1))), | ||
(this.Kt = this.u.v(i.k.js) || this.Kt), | ||
(this.Qt = this.u.v(i.k.Rs) || this.Qt); | ||
(this.cards = this.ws(this.bs(s, !1))), | ||
(this.Bt = this.u.j(o.C.gs) || this.Bt), | ||
(this.Ht = this.u.j(o.C.ys) || this.Ht); | ||
} | ||
Ts(t, s = !1, e = 0, h = 0) { | ||
let r; | ||
Ns(t, s = !1, i = 0, e = 0) { | ||
let h; | ||
if (s) { | ||
r = []; | ||
for (const t of this.cards) t.test && r.push(t); | ||
} else r = this.cards.slice(); | ||
h = []; | ||
for (const t of this.cards) t.test && h.push(t); | ||
} else h = this.cards.slice(); | ||
for (let i = 0; i < t.length; i++) { | ||
const e = t[i]; | ||
let h = null; | ||
let r = null; | ||
for (let t = 0; t < this.cards.length; t++) | ||
if (e.id === this.cards[t].id) { | ||
h = this.cards[t]; | ||
r = this.cards[t]; | ||
break; | ||
} | ||
if (s) { | ||
const t = j(e); | ||
null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t); | ||
} else if (null == h) { | ||
const t = j(e); | ||
null != t && r.push(t); | ||
const t = R(e); | ||
null != r && r.viewed && t && (t.viewed = !0), null != t && h.push(t); | ||
} else if (null == r) { | ||
const t = R(e); | ||
null != t && h.push(t); | ||
} else { | ||
if (!h.Ct(e)) | ||
for (let t = 0; t < r.length; t++) | ||
if (e.id === r[t].id) { | ||
r.splice(t, 1); | ||
if (!r.Ct(e)) | ||
for (let t = 0; t < h.length; t++) | ||
if (e.id === h[t].id) { | ||
h.splice(t, 1); | ||
break; | ||
@@ -104,30 +108,30 @@ } | ||
} | ||
(this.cards = this.ys(this.Ns(r, s))), | ||
this.Ds(), | ||
(this.Kt = e), | ||
(this.Qt = h), | ||
this.u && (this.u.D(i.k.js, this.Kt), this.u.D(i.k.Rs, this.Qt)); | ||
(this.cards = this.ws(this.bs(h, s))), | ||
this.js(), | ||
(this.Bt = i), | ||
(this.Ht = e), | ||
this.u && (this.u.k(o.C.gs, this.Bt), this.u.k(o.C.ys, this.Ht)); | ||
} | ||
Ss(t) { | ||
if (this.ks() && null != t && t.cards) { | ||
this.u && this.u.D(i.k.Us, e.As()); | ||
Rs(t) { | ||
if (this.Ts() && null != t && t.cards) { | ||
this.u && this.u.k(o.C.Ds, e.Ss()); | ||
const s = t.full_sync; | ||
s || this.Yt(), | ||
this.Ts(t.cards, s, t.last_full_sync_at, t.last_card_updated_at), | ||
this.Bt.Dt(this.Ls(!0)); | ||
s || this.Kt(), | ||
this.Ns(t.cards, s, t.last_full_sync_at, t.last_card_updated_at), | ||
this.Jt.Dt(this.ks(!0)); | ||
} | ||
} | ||
Fs(t) { | ||
this.u && this.u.D(i.k.zs, t); | ||
Us(t) { | ||
this.u && this.u.k(o.C.As, t); | ||
} | ||
Ms(t, e, h) { | ||
const n = () => { | ||
this.xs(e, h, !0); | ||
Ls(t, e, h) { | ||
const r = () => { | ||
this.Fs(e, h, !0); | ||
}, | ||
o = t ? b(t) : null; | ||
n = t ? b(t) : null; | ||
let l; | ||
if ((this.Es(), !o || !o["retry-after"])) return void this.Fs(0); | ||
const a = o["retry-after"]; | ||
if ((this.xs(), !n || !n["retry-after"])) return void this.Us(0); | ||
const a = n["retry-after"]; | ||
if (isNaN(a) && !isNaN(Date.parse(a))) | ||
(l = Date.parse(a) - new Date().getTime()), l < 0 && n(); | ||
(l = Date.parse(a) - new Date().getTime()), l < 0 && r(); | ||
else { | ||
@@ -137,26 +141,27 @@ if (isNaN(parseFloat(a.toString()))) { | ||
"Received unexpected value for retry-after header in /sync response"; | ||
return s.N(r.q.qs, { e: t + ": " + a }), void this.Fs(0); | ||
return s.q(i.Ms, { e: t + ": " + a }), void this.Us(0); | ||
} | ||
l = 1e3 * parseFloat(a.toString()); | ||
} | ||
this.us = window.setTimeout(() => { | ||
n(); | ||
this.ns = window.setTimeout(() => { | ||
r(); | ||
}, l); | ||
let u = 0; | ||
this.u && (u = this.u.v(i.k.zs)), | ||
this.u && (u = this.u.j(o.C.As)), | ||
(null == u || isNaN(parseInt(u.toString()))) && (u = 0), | ||
this.Fs(parseInt(u.toString()) + 1); | ||
this.Us(parseInt(u.toString()) + 1); | ||
} | ||
ns(t) { | ||
if (!this.ks()) return; | ||
this.Yt(); | ||
const s = this.cards.slice(); | ||
let i = null; | ||
this.wt && (i = this.wt.getUserId()); | ||
for (let e = 0; e < t.length; e++) | ||
if (i === t[e].userId || (null == i && null == t[e].userId)) { | ||
const i = t[e].card; | ||
es(t) { | ||
var s; | ||
if (!this.Ts()) return; | ||
this.Kt(); | ||
const i = this.cards.slice(); | ||
let e = null; | ||
e = null === (s = this.wt) || void 0 === s ? void 0 : s.getUserId(); | ||
for (let s = 0; s < t.length; s++) | ||
if (e === t[s].userId || (null == e && null == t[s].userId)) { | ||
const e = t[s].card; | ||
let h = null; | ||
for (let t = 0; t < this.cards.length; t++) | ||
if (i.id === this.cards[t].id) { | ||
if (e.id === this.cards[t].id) { | ||
h = this.cards[t]; | ||
@@ -166,9 +171,9 @@ break; | ||
if (null == h) { | ||
const t = j(i); | ||
null != t && s.push(t); | ||
const t = R(e); | ||
null != t && i.push(t); | ||
} else { | ||
if (!h.Ct(i)) | ||
for (let t = 0; t < s.length; t++) | ||
if (i.id === s[t].id) { | ||
s.splice(t, 1); | ||
if (!h.Ct(e)) | ||
for (let t = 0; t < i.length; t++) | ||
if (e.id === i[t].id) { | ||
i.splice(t, 1); | ||
break; | ||
@@ -178,21 +183,21 @@ } | ||
} | ||
(this.cards = this.ys(this.Ns(s, !1))), this.Ds(), this.Bt.Dt(this.Ls(!0)); | ||
(this.cards = this.ws(this.bs(i, !1))), this.js(), this.Jt.Dt(this.ks(!0)); | ||
} | ||
Ns(t, s) { | ||
let e = {}, | ||
h = {}, | ||
r = {}; | ||
bs(t, s) { | ||
let i = {}, | ||
e = {}, | ||
h = {}; | ||
this.u && | ||
((e = this.u.v(i.k.C) || {}), | ||
(h = this.u.v(i.k.K) || {}), | ||
(r = this.u.v(i.k.G) || {})); | ||
const n = {}, | ||
o = {}, | ||
((i = this.u.j(o.C.v) || {}), | ||
(e = this.u.j(o.C.H) || {}), | ||
(h = this.u.j(o.C.A) || {})); | ||
const r = {}, | ||
n = {}, | ||
l = {}; | ||
for (let s = 0; s < t.length; s++) { | ||
const i = t[s].id; | ||
i && | ||
(e[i] && ((t[s].clicked = !0), (n[i] = !0)), | ||
h[i] && ((t[s].viewed = !0), (o[i] = !0)), | ||
r[i] && ((t[s].dismissed = !0), (l[i] = !0))); | ||
const o = t[s].id; | ||
o && | ||
(i[o] && ((t[s].clicked = !0), (r[o] = !0)), | ||
e[o] && ((t[s].viewed = !0), (n[o] = !0)), | ||
h[o] && ((t[s].dismissed = !0), (l[o] = !0))); | ||
} | ||
@@ -202,16 +207,16 @@ return ( | ||
this.u && | ||
(this.u.D(i.k.C, n), this.u.D(i.k.K, o), this.u.D(i.k.G, l)), | ||
(this.u.k(o.C.v, r), this.u.k(o.C.H, n), this.u.k(o.C.A, l)), | ||
t | ||
); | ||
} | ||
ys(t) { | ||
ws(t) { | ||
const s = [], | ||
e = new Date(); | ||
let h = {}; | ||
this.u && (h = this.u.v(i.k.G) || {}); | ||
let n = !1; | ||
for (let i = 0; i < t.length; i++) { | ||
const o = t[i].url; | ||
if (!this.Jt && o && N(o)) { | ||
r.j.error( | ||
i = new Date(); | ||
let e = {}; | ||
this.u && (e = this.u.j(o.C.A) || {}); | ||
let h = !1; | ||
for (let n = 0; n < t.length; n++) { | ||
const o = t[n].url; | ||
if (!this.Ft && o && N(o)) { | ||
r.error( | ||
`Card with url ${o} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`, | ||
@@ -221,99 +226,104 @@ ); | ||
} | ||
const l = t[i].expiresAt; | ||
const l = t[n].expiresAt; | ||
let a = !0; | ||
if ((null != l && (a = l >= e), (a = a && !t[i].dismissed), a)) | ||
s.push(t[i]); | ||
if ((null != l && (a = l >= i), (a = a && !t[n].dismissed), a)) | ||
s.push(t[n]); | ||
else { | ||
const s = t[i].id; | ||
s && (h[s] = !0), (n = !0); | ||
const s = t[n].id; | ||
s && (e[s] = !0), (h = !0); | ||
} | ||
} | ||
return n && this.u && this.u.D(i.k.G, h), s; | ||
return h && this.u && this.u.k(o.C.A, e), s; | ||
} | ||
Ds() { | ||
if (!this.u) return; | ||
const t = []; | ||
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].tt()); | ||
this.u.D(i.k.gs, t); | ||
js() { | ||
var t; | ||
const s = []; | ||
for (let t = 0; t < this.cards.length; t++) s.push(this.cards[t].Y()); | ||
null === (t = this.u) || void 0 === t || t.k(o.C.Cs, s); | ||
} | ||
Es() { | ||
this.us && (clearTimeout(this.us), (this.us = null)); | ||
xs() { | ||
this.ns && (clearTimeout(this.ns), (this.ns = null)); | ||
} | ||
Is() { | ||
null != this.cs && (clearTimeout(this.cs), (this.cs = null)); | ||
zs() { | ||
null != this.os && (clearTimeout(this.os), (this.os = null)); | ||
} | ||
Js(t = 1e3 * this.ds, s, i) { | ||
this.Is(), | ||
(this.cs = window.setTimeout(() => { | ||
this.xs(s, i, !0); | ||
Es(t = 1e3 * this.us, s, i) { | ||
this.zs(), | ||
(this.os = window.setTimeout(() => { | ||
this.Fs(s, i, !0); | ||
}, t)), | ||
(this.fs = t); | ||
(this.ls = t); | ||
} | ||
xs(t, s, h = !1, n = !0) { | ||
var o; | ||
const l = this.$t, | ||
a = this.u; | ||
if (!l || !a) return void ("function" == typeof s && s()); | ||
const u = !h; | ||
if ((u && (this.Es(), this.Fs(0)), !this.ks())) | ||
Fs(t, s, i = !1, h = !0) { | ||
var n, l; | ||
const a = this.qt, | ||
u = this.u; | ||
if (!a || !u) return void ("function" == typeof s && s()); | ||
const c = !i; | ||
if ((c && (this.xs(), this.Us(0)), !this.Ts())) | ||
return void ( | ||
this.yt && | ||
this.yt.Ps(() => { | ||
this.xs(t, s); | ||
null === (n = this.yt) || | ||
void 0 === n || | ||
n.qs(() => { | ||
this.Fs(t, s); | ||
}) | ||
); | ||
let c = !0; | ||
let f = !0; | ||
if ( | ||
(u && | ||
(null === (o = this.yt) || void 0 === o ? void 0 : o.$s()) && | ||
(c = this._s()), | ||
!c) | ||
(c && | ||
(null === (l = this.yt) || void 0 === l ? void 0 : l.Is()) && | ||
(f = this.Js()), | ||
!f) | ||
) | ||
return void r.j.info("Content card sync being throttled."); | ||
n && this.Is(); | ||
const f = l.Bs({}, !0); | ||
a.v(i.k.Us) !== e.As() && this.Gs(), | ||
(f.last_full_sync_at = this.Kt), | ||
(f.last_card_updated_at = this.Qt); | ||
const d = l.Hs(f, T.Os.Ks, h); | ||
let m = !1; | ||
l.Qs(f, () => { | ||
if (this.u) { | ||
const t = new Date().valueOf(); | ||
u && this.u.D(i.k.Vs, t), T.Ws(this.u, T.Os.Ks, t); | ||
} | ||
C.Xs({ | ||
url: l.Ys() + "/content_cards/sync", | ||
data: f, | ||
headers: d, | ||
O: (i, e) => { | ||
if (!l.Zs(f, i, d)) | ||
return (m = !0), void ("function" == typeof s && s()); | ||
l.ti(), | ||
this.Ms(e, t, s), | ||
this.Ss(i), | ||
(m = !1), | ||
T.si(this.u, T.Os.Ks, 1), | ||
"function" == typeof t && t(); | ||
}, | ||
error: (t) => { | ||
l.ii(t, "retrieving content cards"), | ||
(m = !0), | ||
"function" == typeof s && s(); | ||
}, | ||
ei: () => { | ||
if (m && n && !this.cs && this.ps + 1 < S) { | ||
T.hi(this.u, T.Os.Ks); | ||
let i = this.fs; | ||
(null == i || i < 1e3 * this.ds) && (i = 1e3 * this.ds), | ||
this.Js(Math.min(3e5, D(1e3 * this.ds, 3 * i)), t, s), | ||
(this.ps = this.ps + 1); | ||
} | ||
}, | ||
}); | ||
}); | ||
return void r.info("Content card sync being throttled."); | ||
h && this.zs(); | ||
const d = a.Ps({}, !0); | ||
u.j(o.C.Ds) !== e.Ss() && this.$s(), | ||
(d.last_full_sync_at = this.Bt), | ||
(d.last_card_updated_at = this.Ht); | ||
const m = a._s(d, S.Gs.Bs, i); | ||
let p = !1; | ||
a.Hs( | ||
d, | ||
() => { | ||
if (this.u) { | ||
const t = new Date().valueOf(); | ||
c && this.u.k(o.C.Ks, t), S.Os(this.u, S.Gs.Bs, t); | ||
} | ||
C.Qs({ | ||
url: a.Vs() + "/content_cards/sync", | ||
data: d, | ||
headers: m, | ||
L: (i, e) => { | ||
if (!a.Ws(d, i, m)) | ||
return (p = !0), void ("function" == typeof s && s()); | ||
a.Xs(), | ||
this.Ls(e, t, s), | ||
this.Rs(i), | ||
(p = !1), | ||
S.Ys(this.u, S.Gs.Bs, 1), | ||
"function" == typeof t && t(); | ||
}, | ||
error: (t) => { | ||
a.Zs(t, "retrieving content cards"), | ||
(p = !0), | ||
"function" == typeof s && s(); | ||
}, | ||
ti: () => { | ||
if (p && h && !this.os && this.cs + 1 < U) { | ||
S.si(this.u, S.Gs.Bs); | ||
let i = this.ls; | ||
(null == i || i < 1e3 * this.us) && (i = 1e3 * this.us), | ||
this.Es(Math.min(3e5, k(1e3 * this.us, 3 * i)), t, s), | ||
(this.cs = this.cs + 1); | ||
} | ||
}, | ||
}); | ||
}, | ||
S.ii.Bs, | ||
); | ||
} | ||
Ls(t) { | ||
t || this.Yt(); | ||
const s = this.ys(this.cards); | ||
ks(t) { | ||
t || this.Kt(); | ||
const s = this.ws(this.cards); | ||
s.sort((t, s) => | ||
@@ -330,16 +340,16 @@ t.pinned && !s.pinned | ||
); | ||
let e = Math.max(this.Qt || 0, this.Kt || 0); | ||
let i = Math.max(this.Ht || 0, this.Bt || 0); | ||
return ( | ||
0 === e && (e = void 0), | ||
this.u && this.u.v(i.k.Rs) === this.Qt && void 0 === e && (e = this.Qt), | ||
new ContentCards(s, l(e)) | ||
0 === i && (i = void 0), | ||
this.u && this.u.j(o.C.ys) === this.Ht && void 0 === i && (i = this.Ht), | ||
new ContentCards(s, l(i)) | ||
); | ||
} | ||
ri(t) { | ||
return this.Bt.It(t); | ||
ei(t) { | ||
return this.Jt.It(t); | ||
} | ||
Gs() { | ||
(this.Kt = 0), | ||
(this.Qt = 0), | ||
this.u && (this.u.ni(i.k.js), this.u.ni(i.k.Rs)); | ||
$s() { | ||
(this.Bt = 0), | ||
(this.Ht = 0), | ||
this.u && (this.u.hi(o.C.gs), this.u.hi(o.C.ys)); | ||
} | ||
@@ -349,53 +359,53 @@ changeUser(t) { | ||
((this.cards = []), | ||
this.Bt.Dt(new ContentCards(this.cards.slice(), null)), | ||
this.Jt.Dt(new ContentCards(this.cards.slice(), null)), | ||
this.u && | ||
(this.u.ni(i.k.gs), | ||
this.u.ni(i.k.C), | ||
this.u.ni(i.k.K), | ||
this.u.ni(i.k.G))), | ||
this.Gs(); | ||
(this.u.hi(o.C.Cs), | ||
this.u.hi(o.C.v), | ||
this.u.hi(o.C.H), | ||
this.u.hi(o.C.A))), | ||
this.$s(); | ||
} | ||
clearData(t) { | ||
(this.Kt = 0), | ||
(this.Qt = 0), | ||
(this.Bt = 0), | ||
(this.Ht = 0), | ||
(this.cards = []), | ||
this.Bt.Dt(new ContentCards(this.cards.slice(), null)), | ||
this.Jt.Dt(new ContentCards(this.cards.slice(), null)), | ||
t && | ||
this.u && | ||
(this.u.ni(i.k.gs), | ||
this.u.ni(i.k.C), | ||
this.u.ni(i.k.K), | ||
this.u.ni(i.k.G), | ||
this.u.ni(i.k.js), | ||
this.u.ni(i.k.Rs)); | ||
(this.u.hi(o.C.Cs), | ||
this.u.hi(o.C.v), | ||
this.u.hi(o.C.H), | ||
this.u.hi(o.C.A), | ||
this.u.hi(o.C.gs), | ||
this.u.hi(o.C.ys)); | ||
} | ||
ks() { | ||
return !(this.yt && !this.yt.oi()) || (0 !== this.yt.li() && this.ai(), !1); | ||
Ts() { | ||
return ( | ||
!!this.yt && (!!this.yt.ri() || (0 !== this.yt.ni() && this.oi(), !1)) | ||
); | ||
} | ||
ui(t) { | ||
this.u && this.u.D(i.k.ci, t); | ||
li(t) { | ||
this.u && this.u.k(o.C.ai, t); | ||
} | ||
fi() { | ||
return this.u ? this.u.v(i.k.ci) : null; | ||
ui() { | ||
return this.u ? this.u.j(o.C.ai) : null; | ||
} | ||
_s() { | ||
const t = this.u, | ||
s = this.yt; | ||
if (!t || !s) return !0; | ||
const e = t.v(i.k.Vs); | ||
Js() { | ||
var t, s, i; | ||
const e = null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ks); | ||
if (null == e || isNaN(e)) return !0; | ||
const h = s.di(), | ||
r = s.mi(); | ||
const h = (null === (s = this.yt) || void 0 === s ? void 0 : s.ci()) || -1, | ||
r = (null === (i = this.yt) || void 0 === i ? void 0 : i.fi()) || -1; | ||
if (-1 === h || -1 === r) return !0; | ||
let n = this.fi(); | ||
let n = this.ui(); | ||
(null == n || isNaN(n)) && (n = h); | ||
const o = (new Date().valueOf() - e) / 1e3; | ||
const l = (new Date().valueOf() - e) / 1e3; | ||
return ( | ||
(n = Math.min(n + o / r, h)), | ||
!(n < 1) && ((n = Math.trunc(n) - 1), this.ui(n), !0) | ||
(n = Math.min(n + l / r, h)), | ||
!(n < 1) && ((n = Math.trunc(n) - 1), this.li(n), !0) | ||
); | ||
} | ||
ai() { | ||
this.Bt.Dt(new ContentCards([], new Date())), this.u && this.u.ni(i.k.gs); | ||
oi() { | ||
this.Jt.Dt(new ContentCards([], new Date())), this.u && this.u.hi(o.C.Cs); | ||
} | ||
} |
@@ -20,6 +20,6 @@ import x from "../common/base-feed.js"; | ||
} | ||
ur() { | ||
dr() { | ||
return !0; | ||
} | ||
} | ||
ContentCards.mr = 6e4; | ||
ContentCards.ur = 6e4; |
import g from "./content-cards-provider-factory.js"; | ||
import e from "../managers/braze-instance.js"; | ||
export function getCachedContentCards() { | ||
if (e.rr()) return g.er().Ls(!1); | ||
if (e.X()) return g.rr().ks(!1); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import g from "./content-cards-provider-factory.js"; | ||
export function requestContentCardsRefresh(r, t) { | ||
if (e.rr()) return g.er().xs(r, t); | ||
if (e.X()) return g.rr().Fs(r, t); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import g from "./content-cards-provider-factory.js"; | ||
export function subscribeToContentCardsUpdates(r) { | ||
if (!e.rr()) return; | ||
const t = g.er(), | ||
n = t.ri(r); | ||
if (!t.bs()) { | ||
if (!e.X()) return; | ||
const t = g.rr(), | ||
n = t.ei(r); | ||
if (!t.ps()) { | ||
const r = e.cr(); | ||
if (r) { | ||
const n = r.pr(() => { | ||
t.xs(); | ||
const n = r.mr(() => { | ||
t.Fs(); | ||
}); | ||
@@ -13,0 +13,0 @@ n && t.vs(n); |
import e from "../../managers/braze-instance.js"; | ||
import { destroyFeedHtml as z } from "../../common/feed-display.js"; | ||
export function hideContentCards(n) { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
const o = document.querySelectorAll(".ab-feed"); | ||
@@ -6,0 +6,0 @@ for (let e = 0; e < o.length; e++) |
@@ -10,27 +10,27 @@ import e, { OPTIONS as L } from "../../managers/braze-instance.js"; | ||
refreshFeed as $, | ||
registerFeedSubscriptionId as k, | ||
updateFeedCards as A, | ||
registerFeedSubscriptionId as B, | ||
updateFeedCards as F, | ||
} from "../../common/feed-display.js"; | ||
import { setCardHeight as B } from "../../Card/display/card-display.js"; | ||
import { setupFeedUI as F } from "../../ui/js/index.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { setCardHeight as G } from "../../Card/display/card-display.js"; | ||
import { setupFeedUI as H } from "../../ui/js/index.js"; | ||
import { logger as r } from "../../../shared-lib/index.js"; | ||
export function showContentCards(n, t) { | ||
if (!e.rr()) return; | ||
F(); | ||
if (!e.X()) return; | ||
H(); | ||
let o = !1; | ||
null == n && ((n = document.body), (o = !0)); | ||
const a = e.nn(L.tn) || e.nn(L.en) || !1, | ||
i = g.er().Ls(!1); | ||
"function" == typeof t && A(i, t(i.cards.slice()), i.lastUpdated, null, a); | ||
const s = I(i, a, o), | ||
l = g.er(), | ||
f = l.Cs(); | ||
(null == i.lastUpdated || | ||
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.mr) && | ||
(null == f || new Date().valueOf() - f > ContentCards.mr) && | ||
(r.j.info( | ||
`Cached content cards were older than max TTL of ${ContentCards.mr} ms, requesting an update from the server.`, | ||
const i = e.nn(L.tn) || e.nn(L.en) || !1, | ||
a = g.rr().ks(!1); | ||
"function" == typeof t && F(a, t(a.cards.slice()), a.lastUpdated, null, i); | ||
const s = I(a, i, o), | ||
f = g.rr(), | ||
l = f.fs(); | ||
(null == a.lastUpdated || | ||
new Date().valueOf() - a.lastUpdated.valueOf() > ContentCards.ur) && | ||
(null == l || new Date().valueOf() - l > ContentCards.ur) && | ||
(r.info( | ||
`Cached content cards were older than max TTL of ${ContentCards.ur} ms, requesting an update from the server.`, | ||
), | ||
$(i, s), | ||
l.ws(new Date().valueOf())); | ||
$(a, s), | ||
f.ds(new Date().valueOf())); | ||
const c = new Date().valueOf(), | ||
@@ -53,5 +53,5 @@ u = subscribeToContentCardsUpdates(function (n) { | ||
"function" == typeof t && (o = t(o.slice())), | ||
A(i, o, n.lastUpdated, s, a); | ||
F(a, o, n.lastUpdated, s, i); | ||
}); | ||
k(u, s); | ||
B(u, s); | ||
const d = function (n) { | ||
@@ -68,4 +68,4 @@ const t = n.querySelectorAll(".ab-feed"); | ||
o && s.focus(), | ||
q(i, s), | ||
B(i.cards, n); | ||
q(a, s), | ||
G(a.cards, n); | ||
}; | ||
@@ -72,0 +72,0 @@ var m; |
import e from "../../managers/braze-instance.js"; | ||
import { hideContentCards, showContentCards } from "../index.js"; | ||
export function toggleContentCards(n, o) { | ||
e.rr() && | ||
e.X() && | ||
(document.querySelectorAll(".ab-feed").length > 0 | ||
@@ -6,0 +6,0 @@ ? hideContentCards() |
import K from "../managers/braze-instance.js"; | ||
import BrazeSdkMetadata from "./braze-sdk-metadata.js"; | ||
import { | ||
isArray as p, | ||
validateValueIsFromEnum as G, | ||
isArray as j, | ||
validateValueIsFromEnum as J, | ||
} from "../util/code-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function addSdkMetadata(a) { | ||
if (!K.rr()) return; | ||
if (!p(a)) | ||
return ( | ||
r.j.error("Cannot set SDK metadata because metadata is not an array."), !1 | ||
); | ||
for (const t of a) | ||
if ( | ||
!G( | ||
BrazeSdkMetadata, | ||
t, | ||
"sdkMetadata contained an invalid value.", | ||
"BrazeSdkMetadata", | ||
if (!K.X()) return; | ||
const t = K.nr(); | ||
if (t) { | ||
if (!j(a)) | ||
return ( | ||
r.error("Cannot set SDK metadata because metadata is not an array."), !1 | ||
); | ||
for (const t of a) | ||
if ( | ||
!J( | ||
BrazeSdkMetadata, | ||
t, | ||
"sdkMetadata contained an invalid value.", | ||
"BrazeSdkMetadata", | ||
) | ||
) | ||
) | ||
return !1; | ||
const t = K.ar(); | ||
return t && t.addSdkMetadata(a), !0; | ||
return !1; | ||
return t.addSdkMetadata(a), !0; | ||
} | ||
} |
import e from "../managers/braze-instance.js"; | ||
import { getByteLength as U } from "../util/string-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { getByteLength as O } from "../util/string-utils.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import { User } from "../User/index.js"; | ||
import { validateStandardString as H } from "../util/validation-utils.js"; | ||
import { validateStandardString as P } from "../util/validation-utils.js"; | ||
export function changeUser(i, t) { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
if (null == i || 0 === i.length || i != i) | ||
return void r.j.error("changeUser requires a non-empty userId."); | ||
if (U(i) > User.lr) | ||
return void r.j.error( | ||
return void r.error("changeUser requires a non-empty userId."); | ||
if (O(i) > User.lr) | ||
return void r.error( | ||
`Rejected user id "${i}" because it is longer than ${User.lr} bytes.`, | ||
); | ||
if (null != t && !H(t, "set signature for new user", "signature")) return; | ||
const s = e.cr(); | ||
s && s.changeUser(i.toString(), e.gr(), t); | ||
if (null != t && !P(t, "set signature for new user", "signature")) return; | ||
const n = e.cr(); | ||
n && n.changeUser(i.toString(), e.gr(), t); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function destroy() { | ||
r.j.info("Destroying Braze instance"), e.destroy(!0); | ||
r.info("Destroying Braze instance"), e.destroy(!0); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import J, { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js"; | ||
import Q, { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
export function disableSDK() { | ||
const a = e.cr(); | ||
a && a.requestImmediateDataFlush(); | ||
const s = new J.ee(null, !0), | ||
n = "This-cookie-will-expire-in-" + s.ae(); | ||
s.store(i.re, n); | ||
const o = r.ts.Zt; | ||
new r.es(o, r.j).setItem(o.rs.se, o.ie, !0), | ||
r.j.info("disableSDK was called"), | ||
const n = e.cr(); | ||
n && n.requestImmediateDataFlush(); | ||
const s = new Q.ee(null, !0), | ||
a = "This-cookie-will-expire-in-" + s.ne(); | ||
s.store(o.se, a); | ||
const i = A.Yt.Qt; | ||
new A(i, r).setItem(i.ss.ae, i.ie, !0), | ||
r.info("disableSDK was called"), | ||
e.destroy(!1), | ||
e.ne(!0); | ||
e.oe(!0); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import J, { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js"; | ||
import Q, { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
export function enableSDK() { | ||
new J.ee(null, !0).remove(i.re); | ||
const a = r.ts.Zt; | ||
new r.es(a, r.j).oe(a.rs.se, a.ie), | ||
r.j.info("enableSDK was called"), | ||
new Q.ee(null, !0).remove(o.se); | ||
const a = A.Yt.Qt; | ||
new A(a, r).re(a.ss.ae, a.ie), | ||
r.info("enableSDK was called"), | ||
e.destroy(!1), | ||
e.ne(!1); | ||
e.oe(!1); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function getDeviceId(t) { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
const i = e.te(); | ||
if (!i) return; | ||
const c = i.ce().id; | ||
if ("function" != typeof t) return c; | ||
r.j.warn( | ||
const n = i.ce().id; | ||
if ("function" != typeof t) return n; | ||
r.warn( | ||
"The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)", | ||
), | ||
t(c); | ||
t(n); | ||
} |
import e from "../managers/braze-instance.js"; | ||
export function getUser() { | ||
if (e.rr()) return e.br(); | ||
if (e.X()) return e.pr(); | ||
} |
@@ -1,24 +0,24 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import { | ||
BRAZE_ACTIONS as _, | ||
getDecodedBrazeAction as O, | ||
BRAZE_ACTIONS as V, | ||
getDecodedBrazeAction as W, | ||
} from "../util/braze-actions.js"; | ||
import Q from "../util/browser-detector.js"; | ||
import { OperatingSystems as V } from "../util/device-constants.js"; | ||
import X from "../util/browser-detector.js"; | ||
import { OperatingSystems as Y } from "../util/device-constants.js"; | ||
import { | ||
BRAZE_ACTION_URI_REGEX as W, | ||
isValidBrazeActionJson as X, | ||
BRAZE_ACTION_URI_REGEX as Z, | ||
isValidBrazeActionJson as oo, | ||
} from "../util/validation-utils.js"; | ||
import { WindowUtils as Y } from "../util/window-utils.js"; | ||
import { getUser as Z } from "./get-user.js"; | ||
import { WindowUtils as eo } from "../util/window-utils.js"; | ||
import { getUser as ro } from "./get-user.js"; | ||
export function _handleBrazeAction(o, s, t) { | ||
if (e.rr()) | ||
if (W.test(o)) { | ||
const s = O(o); | ||
if (e.X()) | ||
if (Z.test(o)) { | ||
const s = W(o); | ||
if (!s) return; | ||
const t = (o) => { | ||
if (!X(o)) | ||
return void r.j.error( | ||
if (!oo(o)) | ||
return void r.error( | ||
`Decoded Braze Action json is invalid: ${JSON.stringify( | ||
@@ -30,7 +30,7 @@ o, | ||
); | ||
const s = _.properties.type, | ||
i = _.properties.me, | ||
n = _.properties.le, | ||
const s = V.properties.type, | ||
i = V.properties.oo, | ||
n = V.properties.eo, | ||
a = o[s]; | ||
if (a === _.types.ue) { | ||
if (a === V.types.ro) { | ||
const e = o[i]; | ||
@@ -42,40 +42,40 @@ for (const o of e) t(o); | ||
switch (a) { | ||
case _.types.logCustomEvent: | ||
case V.types.logCustomEvent: | ||
import("./log-custom-event.js").then( | ||
({ logCustomEvent: logCustomEvent }) => { | ||
e.fe() | ||
e.so() | ||
? ((i = Array.prototype.slice.call(s)), | ||
logCustomEvent(...i)) | ||
: r.j.error(P); | ||
: r.error(_); | ||
}, | ||
); | ||
break; | ||
case _.types.requestPushPermission: | ||
case V.types.requestPushPermission: | ||
import("../Push/request-push-permission.js").then( | ||
({ requestPushPermission: requestPushPermission }) => { | ||
e.fe() | ||
? "Safari" === Q.browser && Q.OS === V.de | ||
e.so() | ||
? "Safari" === X.browser && X.OS === Y.io | ||
? window.navigator.standalone && requestPushPermission() | ||
: requestPushPermission() | ||
: r.j.error(P); | ||
: r.error(_); | ||
}, | ||
); | ||
break; | ||
case _.types.setEmailNotificationSubscriptionType: | ||
case _.types.setPushNotificationSubscriptionType: | ||
case _.types.setCustomUserAttribute: | ||
case _.types.addToSubscriptionGroup: | ||
case _.types.removeFromSubscriptionGroup: | ||
case _.types.addToCustomAttributeArray: | ||
case _.types.removeFromCustomAttributeArray: | ||
if (((t = Z()), t)) { | ||
case V.types.setEmailNotificationSubscriptionType: | ||
case V.types.setPushNotificationSubscriptionType: | ||
case V.types.setCustomUserAttribute: | ||
case V.types.addToSubscriptionGroup: | ||
case V.types.removeFromSubscriptionGroup: | ||
case V.types.addToCustomAttributeArray: | ||
case V.types.removeFromCustomAttributeArray: | ||
if (((t = ro()), t)) { | ||
t[a](...Array.prototype.slice.call(s)); | ||
} | ||
break; | ||
case _.types.pe: | ||
case _.types.je: | ||
(i = Array.prototype.slice.call(s)), Y.openUri(...i); | ||
case V.types.no: | ||
case V.types.ao: | ||
(i = Array.prototype.slice.call(s)), eo.openUri(...i); | ||
break; | ||
default: | ||
r.j.info(`Ignoring unknown Braze Action: ${a}`); | ||
r.info(`Ignoring unknown Braze Action: ${a}`); | ||
} | ||
@@ -85,6 +85,6 @@ } | ||
t(s); | ||
} else Y.openUri(o, s, t); | ||
} else eo.openUri(o, s, t); | ||
} | ||
export function handleBrazeAction(e, o) { | ||
_handleBrazeAction(e, o); | ||
export function handleBrazeAction(o, e) { | ||
_handleBrazeAction(o, e); | ||
} |
@@ -1,4 +0,4 @@ | ||
import J, { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import Q, { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
export function isDisabled() { | ||
return !!new J.ee(null, !0).jr(i.re); | ||
return !!new Q.ee(null, !0).br(o.se); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import s from "../common/event-logger.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import tt from "../triggers/models/trigger-events.js"; | ||
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js"; | ||
import { | ||
validateCustomProperties as rt, | ||
validateCustomString as ot, | ||
validateCustomProperties as ot, | ||
validateCustomString as rt, | ||
} from "../util/validation-utils.js"; | ||
import { LOG_CUSTOM_EVENT_STRING as nt } from "../common/constants.js"; | ||
export function logCustomEvent(t, o) { | ||
if (!e.rr()) return !1; | ||
if (!e.X()) return !1; | ||
if (null == t || t.length <= 0) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
`logCustomEvent requires a non-empty eventName, got "${t}". Ignoring event.`, | ||
@@ -20,4 +20,4 @@ ), | ||
); | ||
if (!ot(t, "log custom event", "the event name")) return !1; | ||
const [n, i] = rt( | ||
if (!rt(t, "log custom event", "the event name")) return !1; | ||
const [n, m] = ot( | ||
o, | ||
@@ -30,11 +30,11 @@ nt, | ||
if (!n) return !1; | ||
const m = e.tr(); | ||
if (m && m.ge(t)) | ||
return r.j.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1; | ||
const g = s.N(r.q.CustomEvent, { n: t, p: i }); | ||
if (g.O) { | ||
r.j.info(`Logged custom event "${t}".`); | ||
for (const e of g.ve) et.er().be(tt.$e, [t, o], e); | ||
const g = e.ir(); | ||
if (g && g.me(t)) | ||
return r.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1; | ||
const f = s.q(i.CustomEvent, { n: t, p: m }); | ||
if (f.L) { | ||
r.info(`Logged custom event "${t}".`); | ||
for (const e of f.ge) et.rr().fe(tt.ue, [t, o], e); | ||
} | ||
return g.O; | ||
return f.L; | ||
} |
import e from "../managers/braze-instance.js"; | ||
import { MAX_PURCHASE_QUANTITY as rr } from "../common/constants.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import tt from "../triggers/models/trigger-events.js"; | ||
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js"; | ||
import { | ||
validateCustomProperties as rt, | ||
validateCustomString as ot, | ||
validateCustomProperties as ot, | ||
validateCustomString as rt, | ||
} from "../util/validation-utils.js"; | ||
import s from "../common/event-logger.js"; | ||
export function logPurchase(o, i, n, t, D) { | ||
if (!e.rr()) return !1; | ||
export function logPurchase(o, n, t, D, u) { | ||
if (!e.X()) return !1; | ||
if ( | ||
(null == n && (n = "USD"), null == t && (t = 1), null == o || o.length <= 0) | ||
(null == t && (t = "USD"), null == D && (D = 1), null == o || o.length <= 0) | ||
) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
`logPurchase requires a non-empty productId, got "${o}", ignoring.`, | ||
@@ -22,24 +22,22 @@ ), | ||
); | ||
if (!ot(o, "log purchase", "the purchase name")) return !1; | ||
if (null == i || isNaN(parseFloat(i.toString()))) | ||
if (!rt(o, "log purchase", "the purchase name")) return !1; | ||
if (null == n || isNaN(parseFloat(n.toString()))) | ||
return ( | ||
r.j.error(`logPurchase requires a numeric price, got ${i}, ignoring.`), !1 | ||
r.error(`logPurchase requires a numeric price, got ${n}, ignoring.`), !1 | ||
); | ||
const a = parseFloat(i.toString()).toFixed(2); | ||
if (null == t || isNaN(parseInt(t.toString()))) | ||
const a = parseFloat(n.toString()).toFixed(2); | ||
if (null == D || isNaN(parseInt(D.toString()))) | ||
return ( | ||
r.j.error( | ||
`logPurchase requires an integer quantity, got ${t}, ignoring.`, | ||
), | ||
r.error(`logPurchase requires an integer quantity, got ${D}, ignoring.`), | ||
!1 | ||
); | ||
const u = parseInt(t.toString()); | ||
if (u < 1 || u > rr) | ||
const g = parseInt(D.toString()); | ||
if (g < 1 || g > rr) | ||
return ( | ||
r.j.error( | ||
`logPurchase requires a quantity >1 and <${rr}, got ${u}, ignoring.`, | ||
r.error( | ||
`logPurchase requires a quantity >1 and <${rr}, got ${g}, ignoring.`, | ||
), | ||
!1 | ||
); | ||
n = null != n ? n.toUpperCase() : n; | ||
t = null != t ? t.toUpperCase() : t; | ||
if ( | ||
@@ -219,12 +217,10 @@ -1 === | ||
"ZWL", | ||
].indexOf(n) | ||
].indexOf(t) | ||
) | ||
return ( | ||
r.j.error( | ||
`logPurchase requires a valid currencyCode, got ${n}, ignoring.`, | ||
), | ||
r.error(`logPurchase requires a valid currencyCode, got ${t}, ignoring.`), | ||
!1 | ||
); | ||
const [g, P] = rt( | ||
D, | ||
const [P, R] = ot( | ||
u, | ||
"logPurchase", | ||
@@ -235,14 +231,12 @@ "purchaseProperties", | ||
); | ||
if (!g) return !1; | ||
const R = e.tr(); | ||
if (R && R.Dr(o)) | ||
return r.j.info(`Purchase "${o}" is blocklisted, ignoring.`), !1; | ||
const c = s.N(r.q.Pr, { pid: o, c: n, p: a, q: u, pr: P }); | ||
if (c.O) { | ||
r.j.info( | ||
`Logged ${u} purchase${u > 1 ? "s" : ""} of "${o}" for ${n} ${a}.`, | ||
); | ||
for (const r of c.ve) et.er().be(tt.Rr, [o, D], r); | ||
if (!P) return !1; | ||
const c = e.ir(); | ||
if (c && c.Dr(o)) | ||
return r.info(`Purchase "${o}" is blocklisted, ignoring.`), !1; | ||
const l = s.q(i.Pr, { pid: o, c: t, p: a, q: g, pr: R }); | ||
if (l.L) { | ||
r.info(`Logged ${g} purchase${g > 1 ? "s" : ""} of "${o}" for ${t} ${a}.`); | ||
for (const r of l.ge) et.rr().fe(tt.Rr, [o, u], r); | ||
} | ||
return c.O; | ||
return l.L; | ||
} |
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js"; | ||
import tt from "../triggers/models/trigger-events.js"; | ||
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js"; | ||
export function openSession() { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
const i = e.cr(); | ||
if (!i) return; | ||
i.openSession(); | ||
const t = r.ts.Zt, | ||
o = new r.es(t, r.j); | ||
o.hr(t.rs.kr, (e, s) => { | ||
const n = s.lastClick, | ||
c = s.trackingString; | ||
r.j.info(`Firing push click trigger from ${c} push click at ${n}`); | ||
const g = i.vr(n, c), | ||
const t = A.Yt.Qt, | ||
o = new A(t, r); | ||
o.jr(t.ss.hr, (n, e) => { | ||
const s = e.lastClick, | ||
c = e.trackingString; | ||
r.info(`Firing push click trigger from ${c} push click at ${s}`); | ||
const g = i.kr(s, c), | ||
f = function () { | ||
et.er().be(tt.zr, [c], g); | ||
et.rr().fe(tt.vr, [c], g); | ||
}; | ||
i.$r(f, f), o.oe(t.rs.kr, e); | ||
i.$r(f, f), o.re(t.ss.hr, n); | ||
}), | ||
o.ss(t.rs.wr, function (r) { | ||
o.Zt(t.ss.wr, function (r) { | ||
i.yr(r); | ||
}); | ||
} |
import e from "../managers/braze-instance.js"; | ||
export function removeAllSubscriptions() { | ||
e.rr() && e.removeAllSubscriptions(); | ||
e.X() && e.removeAllSubscriptions(); | ||
} |
import e from "../managers/braze-instance.js"; | ||
export function removeSubscription(r) { | ||
e.rr() && e.removeSubscription(r); | ||
e.X() && e.removeSubscription(r); | ||
} |
import e from "../managers/braze-instance.js"; | ||
export function requestImmediateDataFlush(t) { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
const r = e.cr(); | ||
r && r.requestImmediateDataFlush(t); | ||
} |
@@ -1,4 +0,4 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function setLogger(e) { | ||
r.j.setLogger(e); | ||
r.setLogger(e); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import { validateStandardString as H } from "../util/validation-utils.js"; | ||
import { validateStandardString as P } from "../util/validation-utils.js"; | ||
export function setSdkAuthenticationSignature(t) { | ||
if (!e.rr()) return !1; | ||
if ("" === t || !H(t, "set signature", "signature", !1)) return !1; | ||
if (!e.X()) return !1; | ||
if ("" === t || !P(t, "set signature", "signature", !1)) return !1; | ||
const r = e.Sr(); | ||
return !!r && (r.setSdkAuthenticationSignature(t), !0); | ||
} |
import e from "../managers/braze-instance.js"; | ||
export function subscribeToSdkAuthenticationFailures(r) { | ||
if (!e.rr()) return; | ||
const n = e.Sr(); | ||
return n ? n.subscribeToSdkAuthenticationFailures(r) : void 0; | ||
export function subscribeToSdkAuthenticationFailures(i) { | ||
var r; | ||
if (e.X()) | ||
return null === (r = e.Sr()) || void 0 === r | ||
? void 0 | ||
: r.subscribeToSdkAuthenticationFailures(i); | ||
} |
@@ -1,4 +0,4 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function toggleLogging() { | ||
r.j.toggleLogging(); | ||
r.toggleLogging(); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import { keys as oo } from "../util/code-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js"; | ||
import { keys as to } from "../util/code-utils.js"; | ||
import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js"; | ||
export function wipeData() { | ||
if (null == e.l()) return void r.j.warn(P); | ||
const o = e.l(); | ||
o && o.clearData(); | ||
const t = oo(r.ts); | ||
if (null == o) return void r.warn(_); | ||
o.clearData(); | ||
const t = to(A.Yt); | ||
for (let o = 0; o < t.length; o++) { | ||
const n = t[o], | ||
s = r.ts[n]; | ||
new r.es(s, r.j).clearData(); | ||
i = A.Yt[n]; | ||
new A(i, r).clearData(); | ||
} | ||
if (e.rr()) for (const o of e.gr()) o.clearData(!0); | ||
if (e.X()) for (const o of e.gr()) o.clearData(!0); | ||
} |
@@ -1,24 +0,24 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import FeatureFlag from "./feature-flag.js"; | ||
export function newFeatureFlagFromJson(e) { | ||
if (e[FeatureFlag.Rt.rt] && "boolean" == typeof e[FeatureFlag.Rt.Fe]) | ||
if (e[FeatureFlag.Rt.ht] && "boolean" == typeof e[FeatureFlag.Rt.le]) | ||
return new FeatureFlag( | ||
e[FeatureFlag.Rt.rt], | ||
e[FeatureFlag.Rt.ht], | ||
e[FeatureFlag.Rt.le], | ||
e[FeatureFlag.Rt.pe], | ||
e[FeatureFlag.Rt.Fe], | ||
e[FeatureFlag.Rt.we], | ||
e[FeatureFlag.Rt.ze], | ||
); | ||
r.j.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`); | ||
r.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`); | ||
} | ||
export function newFeatureFlagFromSerializedValue(e) { | ||
if (e[FeatureFlag.it.rt] && "boolean" == typeof e[FeatureFlag.it.Fe]) | ||
if (e[FeatureFlag.tt.ht] && "boolean" == typeof e[FeatureFlag.tt.le]) | ||
return new FeatureFlag( | ||
e[FeatureFlag.it.rt], | ||
e[FeatureFlag.it.Fe], | ||
e[FeatureFlag.it.we], | ||
e[FeatureFlag.it.ze], | ||
e[FeatureFlag.tt.ht], | ||
e[FeatureFlag.tt.le], | ||
e[FeatureFlag.tt.pe], | ||
e[FeatureFlag.tt.Fe], | ||
); | ||
r.j.info( | ||
r.info( | ||
`Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`, | ||
); | ||
} |
@@ -1,2 +0,2 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export default class FeatureFlag { | ||
@@ -37,9 +37,9 @@ constructor(t, r = !1, e = {}, s) { | ||
} | ||
tt() { | ||
Y() { | ||
const t = {}; | ||
return ( | ||
(t[FeatureFlag.it.rt] = this.id), | ||
(t[FeatureFlag.it.Fe] = this.enabled), | ||
(t[FeatureFlag.it.we] = this.properties), | ||
(t[FeatureFlag.it.ze] = this.trackingString), | ||
(t[FeatureFlag.tt.ht] = this.id), | ||
(t[FeatureFlag.tt.le] = this.enabled), | ||
(t[FeatureFlag.tt.pe] = this.properties), | ||
(t[FeatureFlag.tt.Fe] = this.trackingString), | ||
t | ||
@@ -49,6 +49,6 @@ ); | ||
Nr(t) { | ||
r.j.info(`Property is not of type ${t}.`); | ||
r.info(`Property is not of type ${t}.`); | ||
} | ||
Er(t) { | ||
r.j.info(`${t} not found in feature flag properties.`); | ||
r.info(`${t} not found in feature flag properties.`); | ||
} | ||
@@ -65,3 +65,3 @@ Ir(t) { | ||
} | ||
(FeatureFlag.it = { rt: "id", Fe: "e", we: "pr", ze: "fts" }), | ||
(FeatureFlag.Rt = { rt: "id", Fe: "enabled", we: "properties", ze: "fts" }); | ||
(FeatureFlag.tt = { ht: "id", le: "e", pe: "pr", Fe: "fts" }), | ||
(FeatureFlag.Rt = { ht: "id", le: "enabled", pe: "properties", Fe: "fts" }); |
@@ -6,6 +6,7 @@ import e from "../managers/braze-instance.js"; | ||
provider: null, | ||
er: () => ( | ||
rr: () => ( | ||
ir.o(), | ||
ir.provider || | ||
((ir.provider = new er(e.tr(), e.ar(), e.l())), e.dr(ir.provider)), | ||
((ir.provider = new er(e.ir(), e.nr(), e.l(), e.zr())), | ||
e.ar(ir.provider)), | ||
ir.provider | ||
@@ -12,0 +13,0 @@ ), |
@@ -1,7 +0,7 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import y from "../common/base-provider.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import E from "../managers/subscription-manager.js"; | ||
import { randomInclusive as D } from "../util/math.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import T from "../managers/subscription-manager.js"; | ||
import { randomInclusive as k } from "../util/math.js"; | ||
import C from "../util/net.js"; | ||
@@ -12,34 +12,41 @@ import { | ||
} from "./feature-flag-factory.js"; | ||
import T from "../util/request-header-utils.js"; | ||
import S from "../util/request-header-utils.js"; | ||
export default class er extends y { | ||
constructor(t, s, i) { | ||
constructor(t, s, i, r) { | ||
super(), | ||
(this.yt = t), | ||
(this.$t = s), | ||
(this.qt = s), | ||
(this.u = i), | ||
(this.gi = []), | ||
(this.pi = 0), | ||
(this.di = r), | ||
(this.mi = []), | ||
(this.gi = 0), | ||
(this.yt = t), | ||
(this.$t = s), | ||
(this.qt = s), | ||
(this.u = i), | ||
(this.di = r), | ||
(this.Fi = null), | ||
(this.wi = new E()), | ||
(this.ji = 10), | ||
(this.bi = null), | ||
(this.vi = null), | ||
e.Ht(this.wi); | ||
(this.vi = new T()), | ||
(this.pi = 10), | ||
(this.wi = null), | ||
(this.ji = null), | ||
e.$t(this.vi); | ||
} | ||
Ss(t) { | ||
if ((!this.yt || this.yt.yi()) && null != t && t.feature_flags) { | ||
this.gi = []; | ||
Rs(t) { | ||
var s; | ||
if ( | ||
(null === (s = this.yt) || void 0 === s ? void 0 : s.yi()) && | ||
null != t && | ||
t.feature_flags | ||
) { | ||
this.mi = []; | ||
for (const s of t.feature_flags) { | ||
const t = st(s); | ||
t && this.gi.push(t); | ||
t && this.mi.push(t); | ||
} | ||
(this.pi = new Date().getTime()), this.Ti(), this.wi.Dt(this.gi); | ||
(this.gi = new Date().getTime()), this.bi(), this.vi.Dt(this.mi); | ||
} | ||
} | ||
Di() { | ||
Ci() { | ||
let t = {}; | ||
this.u && (t = this.u.v(i.k.Ri)); | ||
this.u && (t = this.u.j(o.C.Ti)); | ||
const s = {}; | ||
@@ -52,21 +59,21 @@ for (const i in t) { | ||
} | ||
Ni() { | ||
Di() { | ||
var t; | ||
return (null === (t = this.u) || void 0 === t ? void 0 : t.v(i.k.qi)) || {}; | ||
return (null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ii)) || {}; | ||
} | ||
xi(t) { | ||
this.u && this.u.D(i.k.qi, t); | ||
Ri(t) { | ||
this.u && this.u.k(o.C.Ii, t); | ||
} | ||
ri(t) { | ||
return this.wi.It(t); | ||
ei(t) { | ||
return this.vi.It(t); | ||
} | ||
refreshFeatureFlags(t, s, i = !1, e = !0) { | ||
const r = () => { | ||
"function" == typeof s && s(), this.wi.Dt(this.gi); | ||
"function" == typeof s && s(), this.vi.Dt(this.mi); | ||
}; | ||
if (!this.zi(i)) | ||
if (!this.Si(i)) | ||
return ( | ||
!this.Fi && | ||
this.yt && | ||
(this.Fi = this.yt.Ci(() => { | ||
(this.Fi = this.yt.xi(() => { | ||
this.refreshFeatureFlags(t, s); | ||
@@ -76,60 +83,63 @@ })), | ||
); | ||
if ((e && this.Ii(), !this.$t)) return void r(); | ||
const h = this.$t.Bs({}, !0), | ||
a = this.$t.Hs(h, T.Os.Si); | ||
let o = !1; | ||
this.$t.Qs(h, () => { | ||
this.$t | ||
? (T.Ws(this.u, T.Os.Si, new Date().valueOf()), | ||
C.Xs({ | ||
url: `${this.$t.Ys()}/feature_flags/sync`, | ||
headers: a, | ||
data: h, | ||
O: (s) => { | ||
if (!this.$t.Zs(h, s, a)) return (o = !0), void r(); | ||
this.$t.ti(), | ||
this.Ss(s), | ||
(o = !1), | ||
T.si(this.u, T.Os.Si, 1), | ||
"function" == typeof t && t(); | ||
}, | ||
error: (t) => { | ||
this.$t.ii(t, "retrieving feature flags"), (o = !0), r(); | ||
}, | ||
ei: () => { | ||
if (e && o && !this.vi) { | ||
T.hi(this.u, T.Os.Si); | ||
let e = this.bi; | ||
(null == e || e < 1e3 * this.ji) && (e = 1e3 * this.ji), | ||
this.$i(Math.min(3e5, D(1e3 * this.ji, 3 * e)), t, s, i); | ||
} | ||
}, | ||
})) | ||
: r(); | ||
}); | ||
if ((e && this.Ni(), !this.qt)) return void r(); | ||
const h = this.qt.Ps({}, !0), | ||
o = this.qt._s(h, S.Gs.qi); | ||
let a = !1; | ||
this.qt.Hs( | ||
h, | ||
() => { | ||
this.qt | ||
? (S.Os(this.u, S.Gs.qi, new Date().valueOf()), | ||
C.Qs({ | ||
url: `${this.qt.Vs()}/feature_flags/sync`, | ||
headers: o, | ||
data: h, | ||
L: (s) => { | ||
if (!this.qt.Ws(h, s, o)) return (a = !0), void r(); | ||
this.qt.Xs(), | ||
this.Rs(s), | ||
(a = !1), | ||
S.Ys(this.u, S.Gs.qi, 1), | ||
"function" == typeof t && t(); | ||
}, | ||
error: (t) => { | ||
this.qt.Zs(t, "retrieving feature flags"), (a = !0), r(); | ||
}, | ||
ti: () => { | ||
if (e && a && !this.ji) { | ||
S.si(this.u, S.Gs.qi); | ||
let e = this.wi; | ||
(null == e || e < 1e3 * this.pi) && (e = 1e3 * this.pi), | ||
this.$i(Math.min(3e5, k(1e3 * this.pi, 3 * e)), t, s, i); | ||
} | ||
}, | ||
})) | ||
: r(); | ||
}, | ||
S.ii.qi, | ||
); | ||
} | ||
Ii() { | ||
null != this.vi && (clearTimeout(this.vi), (this.vi = null)); | ||
Ni() { | ||
null != this.ji && (clearTimeout(this.ji), (this.ji = null)); | ||
} | ||
$i(t = 1e3 * this.ji, s, i, e = !1) { | ||
this.Ii(), | ||
(this.vi = window.setTimeout(() => { | ||
$i(t = 1e3 * this.pi, s, i, e = !1) { | ||
this.Ni(), | ||
(this.ji = window.setTimeout(() => { | ||
this.refreshFeatureFlags(s, i, e); | ||
}, t)), | ||
(this.bi = t); | ||
(this.wi = t); | ||
} | ||
zi(t) { | ||
Si(t) { | ||
if (!this.yt) return !1; | ||
if (!t) { | ||
const t = this.yt.Mi(); | ||
const t = this.yt.zi(); | ||
if (null == t) return !1; | ||
let s = !1; | ||
if (!isNaN(t)) { | ||
if (-1 === t) return r.j.info("Feature flag refreshes not allowed"), !1; | ||
s = new Date().getTime() >= (this.pi || 0) + 1e3 * t; | ||
if (-1 === t) return r.info("Feature flag refreshes not allowed"), !1; | ||
s = new Date().getTime() >= (this.gi || 0) + 1e3 * t; | ||
} | ||
if (!s) | ||
return ( | ||
r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`), | ||
!1 | ||
r.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1 | ||
); | ||
@@ -139,11 +149,29 @@ } | ||
} | ||
Ti() { | ||
Mi() { | ||
var t; | ||
return ( | ||
(null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ui)) || null | ||
); | ||
} | ||
_i() { | ||
var t, s; | ||
null === (t = this.u) || | ||
void 0 === t || | ||
t.k(o.C.Ui, null === (s = this.di) || void 0 === s ? void 0 : s.ki()); | ||
} | ||
Ai() { | ||
var t; | ||
const s = null === (t = this.di) || void 0 === t ? void 0 : t.ki(), | ||
i = this.Mi(); | ||
return null == i || s === i; | ||
} | ||
bi() { | ||
if (!this.u) return; | ||
const t = {}; | ||
for (const s of this.gi) { | ||
const i = s.tt(); | ||
for (const s of this.mi) { | ||
const i = s.Y(); | ||
t[s.id] = i; | ||
} | ||
this.u.D(i.k.Ri, t), this.u.D(i.k.Ui, this.pi); | ||
this.u.k(o.C.Ti, t), this.u.k(o.C.Bi, this.gi), this._i(); | ||
} | ||
} |
@@ -1,12 +0,12 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import ir from "./feature-flags-provider-factory.js"; | ||
export function getAllFeatureFlags() { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
const t = [], | ||
a = e.tr(); | ||
if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), t; | ||
const o = ir.er().Di(); | ||
n = e.ir(); | ||
if (n && !n.yi()) return r.info("Feature flags are not enabled."), t; | ||
const o = ir.rr().Ci(); | ||
for (const r in o) t.push(o[r]); | ||
return t; | ||
} |
@@ -1,10 +0,10 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import ir from "./feature-flags-provider-factory.js"; | ||
export function getFeatureFlag(t) { | ||
if (!e.rr()) return; | ||
const a = e.tr(); | ||
if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), null; | ||
const n = ir.er().Di(); | ||
return n[t] ? n[t] : null; | ||
if (!e.X()) return; | ||
const n = e.ir(); | ||
if (n && !n.yi()) return r.info("Feature flags are not enabled."), null; | ||
const a = ir.rr().Ci(); | ||
return a[t] ? a[t] : null; | ||
} |
@@ -1,2 +0,2 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import s from "../common/event-logger.js"; | ||
@@ -6,19 +6,21 @@ import e from "../managers/braze-instance.js"; | ||
export function logFeatureFlagImpression(t) { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
if (!t) return !1; | ||
const o = ir.er().Di(); | ||
if (!o[t]) return !1; | ||
const n = o[t].trackingString; | ||
if (!n) | ||
const o = | ||
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.", | ||
n = ir.rr().Ci(); | ||
if (!n[t]) return r.info(o), !1; | ||
const a = n[t].trackingString; | ||
if (!a) return r.info(o), !1; | ||
const f = ir.rr().Di(); | ||
if (f[a]) | ||
return ( | ||
r.j.info( | ||
"Not logging a feature flag impression. The feature flag was not part of any matching campaign.", | ||
r.info( | ||
"Not logging another feature flag impression. This ID was already logged this session.", | ||
), | ||
!1 | ||
); | ||
const a = ir.er().Ni(); | ||
if (a[n]) return !1; | ||
(a[n] = !0), ir.er().xi(a); | ||
const i = { fid: t, fts: n }; | ||
return s.N(r.q.Fr, i).O; | ||
(f[a] = !0), ir.rr().Ri(f); | ||
const g = { fid: t, fts: a }; | ||
return s.q(i.Fr, g).L; | ||
} |
import e from "../managers/braze-instance.js"; | ||
import ir from "./feature-flags-provider-factory.js"; | ||
function tr(r, t, a = !1) { | ||
if (e.rr()) return ir.er().refreshFeatureFlags(r, t, a); | ||
if (e.X()) return ir.rr().refreshFeatureFlags(r, t, a); | ||
} | ||
@@ -6,0 +6,0 @@ export function refreshFeatureFlags(r, e) { |
@@ -5,6 +5,9 @@ import e from "../managers/braze-instance.js"; | ||
export function subscribeToFeatureFlagsUpdates(r) { | ||
if (!e.rr()) return; | ||
const t = getAllFeatureFlags(); | ||
t && "function" == typeof r && r(t); | ||
return ir.er().ri(r); | ||
if (!e.X()) return; | ||
const t = ir.rr(); | ||
if (t.Ai()) { | ||
const t = getAllFeatureFlags(); | ||
t && "function" == typeof r && r(t); | ||
} | ||
return t.ei(r); | ||
} |
@@ -6,5 +6,5 @@ import e from "../managers/braze-instance.js"; | ||
provider: null, | ||
er: () => ( | ||
rr: () => ( | ||
re.o(), | ||
re.provider || ((re.provider = new ee(e.l(), e.cr())), e.dr(re.provider)), | ||
re.provider || ((re.provider = new ee(e.l(), e.cr())), e.ar(re.provider)), | ||
re.provider | ||
@@ -11,0 +11,0 @@ ), |
@@ -6,7 +6,7 @@ import y from "../common/base-provider.js"; | ||
newCardFromFeedJson as ht, | ||
newCardFromSerializedValue as R, | ||
newCardFromSerializedValue as D, | ||
} from "../Card/util/card-factory.js"; | ||
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import E from "../managers/subscription-manager.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import T from "../managers/subscription-manager.js"; | ||
export default class ee extends y { | ||
@@ -16,55 +16,55 @@ constructor(t, s) { | ||
(this.u = t), | ||
(this.ki = s), | ||
(this.Ei = s), | ||
(this.cards = []), | ||
(this.Ai = null), | ||
(this.Gi = null), | ||
(this.u = t), | ||
(this.ki = s), | ||
(this.Bt = new E()), | ||
e.Ht(this.Bt), | ||
this.Yt(); | ||
(this.Ei = s), | ||
(this.Jt = new T()), | ||
e.$t(this.Jt), | ||
this.Kt(); | ||
} | ||
Yt() { | ||
Kt() { | ||
let t = []; | ||
this.u && (t = this.u.v(i.k.Bi) || []); | ||
this.u && (t = this.u.j(o.C.Hi) || []); | ||
const s = []; | ||
for (let i = 0; i < t.length; i++) { | ||
const e = R(t[i]); | ||
const e = D(t[i]); | ||
null != e && s.push(e); | ||
} | ||
(this.cards = s), this.u && (this.Ai = w(this.u.v(i.k.Ei))); | ||
(this.cards = s), this.u && (this.Gi = w(this.u.j(o.C.Ji))); | ||
} | ||
Gi(t) { | ||
Ki(t) { | ||
const s = []; | ||
let e = null, | ||
r = {}; | ||
this.u && (r = this.u.v(i.k.L) || {}); | ||
const h = {}; | ||
for (let i = 0; i < t.length; i++) { | ||
e = t[i]; | ||
const o = ht(e); | ||
let i = null, | ||
e = {}; | ||
this.u && (e = this.u.j(o.C.J) || {}); | ||
const r = {}; | ||
for (let h = 0; h < t.length; h++) { | ||
i = t[h]; | ||
const o = ht(i); | ||
if (null != o) { | ||
const t = o.id; | ||
t && r[t] && ((o.viewed = !0), (h[t] = !0)), s.push(o); | ||
t && e[t] && ((o.viewed = !0), (r[t] = !0)), s.push(o); | ||
} | ||
} | ||
(this.cards = s), | ||
this.Ds(), | ||
(this.Ai = new Date()), | ||
this.u && (this.u.D(i.k.L, h), this.u.D(i.k.Ei, this.Ai)); | ||
this.js(), | ||
(this.Gi = new Date()), | ||
this.u && (this.u.k(o.C.J, r), this.u.k(o.C.Ji, this.Gi)); | ||
} | ||
Ds() { | ||
if (!this.u) return; | ||
const t = []; | ||
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].tt()); | ||
this.u.D(i.k.Bi, t); | ||
js() { | ||
var t; | ||
const s = []; | ||
for (let t = 0; t < this.cards.length; t++) s.push(this.cards[t].Y()); | ||
null === (t = this.u) || void 0 === t || t.k(o.C.Hi, s); | ||
} | ||
Ss(t) { | ||
Rs(t) { | ||
null != t && | ||
t.feed && | ||
(this.Yt(), | ||
this.Gi(t.feed), | ||
this.Bt.Dt(new Feed(this.cards.slice(), this.Ai))); | ||
(this.Kt(), | ||
this.Ki(t.feed), | ||
this.Jt.Dt(new Feed(this.cards.slice(), this.Gi))); | ||
} | ||
Hi() { | ||
this.Yt(); | ||
Li() { | ||
this.Kt(); | ||
const t = [], | ||
@@ -77,9 +77,9 @@ s = new Date(); | ||
} | ||
return new Feed(t, this.Ai); | ||
return new Feed(t, this.Gi); | ||
} | ||
xs() { | ||
this.ki && this.ki.requestFeedRefresh(); | ||
Fs() { | ||
this.Ei && this.Ei.requestFeedRefresh(); | ||
} | ||
ri(t) { | ||
return this.Bt.It(t); | ||
ei(t) { | ||
return this.Jt.It(t); | ||
} | ||
@@ -89,6 +89,6 @@ clearData(t) { | ||
(this.cards = []), | ||
(this.Ai = null), | ||
t && this.u && (this.u.ni(i.k.Bi), this.u.ni(i.k.Ei)), | ||
this.Bt.Dt(new Feed(this.cards.slice(), this.Ai)); | ||
(this.Gi = null), | ||
t && this.u && (this.u.hi(o.C.Hi), this.u.hi(o.C.Ji)), | ||
this.Jt.Dt(new Feed(this.cards.slice(), this.Gi)); | ||
} | ||
} |
@@ -17,5 +17,5 @@ import x from "../common/base-feed.js"; | ||
} | ||
ur() { | ||
dr() { | ||
return !1; | ||
} | ||
} |
import e from "../managers/braze-instance.js"; | ||
import re from "./feed-provider-factory.js"; | ||
export function getCachedFeed() { | ||
if (e.rr()) return re.er().Hi(); | ||
if (e.X()) return re.rr().Li(); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { InternalEventTypes as or } from "../../shared-lib/index.js"; | ||
export function logFeedDisplayed() { | ||
if (!e.rr()) return; | ||
const i = e.ar(); | ||
return i ? i.qr(r.Cr.Br).O : void 0; | ||
var r; | ||
if (e.X()) | ||
return null === (r = e.nr()) || void 0 === r ? void 0 : r.qr(or.Br).L; | ||
} |
import e from "../managers/braze-instance.js"; | ||
import re from "./feed-provider-factory.js"; | ||
export function requestFeedRefresh() { | ||
if (e.rr()) return re.er().xs(); | ||
if (e.X()) return re.rr().Fs(); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import re from "./feed-provider-factory.js"; | ||
export function subscribeToFeedUpdates(r) { | ||
if (e.rr()) return re.er().ri(r); | ||
if (e.X()) return re.rr().ei(r); | ||
} |
import e from "../../managers/braze-instance.js"; | ||
import { destroyFeedHtml as z } from "../../common/feed-display.js"; | ||
export function destroyFeed() { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
const o = document.querySelectorAll(".ab-feed"); | ||
for (let e = 0; e < o.length; e++) z(o[e]); | ||
} |
@@ -8,4 +8,4 @@ import e, { OPTIONS as L } from "../../managers/braze-instance.js"; | ||
refreshFeed as $, | ||
registerFeedSubscriptionId as k, | ||
updateFeedCards as A, | ||
registerFeedSubscriptionId as B, | ||
updateFeedCards as F, | ||
} from "../../common/feed-display.js"; | ||
@@ -15,9 +15,9 @@ import { Feed, logFeedDisplayed, subscribeToFeedUpdates } from "../index.js"; | ||
import { intersection as te } from "../../util/code-utils.js"; | ||
import { setCardHeight as B } from "../../Card/display/card-display.js"; | ||
import { setupFeedUI as F } from "../../ui/js/index.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { setCardHeight as G } from "../../Card/display/card-display.js"; | ||
import { setupFeedUI as H } from "../../ui/js/index.js"; | ||
import { logger as r } from "../../../shared-lib/index.js"; | ||
export function showFeed(t, n, o) { | ||
if (!e.rr()) return; | ||
F(); | ||
const s = (e, t) => { | ||
if (!e.X()) return; | ||
H(); | ||
const i = (e, t) => { | ||
if (null == t) return e; | ||
@@ -29,4 +29,4 @@ const n = []; | ||
const r = [], | ||
s = e[t].categories || []; | ||
for (let e = 0; e < s.length; e++) r.push(s[e].toLowerCase()); | ||
i = e[t].categories || []; | ||
for (let e = 0; e < i.length; e++) r.push(i[e].toLowerCase()); | ||
te(r, n).length > 0 && o.push(e[t]); | ||
@@ -36,20 +36,20 @@ } | ||
}, | ||
i = e.nn(L.tn) || e.nn(L.en) || !1; | ||
s = e.nn(L.tn) || e.nn(L.en) || !1; | ||
let l = !1; | ||
null == t && ((t = document.body), (l = !0)); | ||
let a, | ||
f = !1; | ||
let f, | ||
a = !1; | ||
null == n | ||
? ((a = re.er().Hi()), | ||
A(a, s(a.cards, o), a.lastUpdated, null, i), | ||
(f = !0)) | ||
: (a = new Feed(s(n, o), new Date())); | ||
const u = I(a, i, l); | ||
if (f) { | ||
(null == a.lastUpdated || | ||
new Date().valueOf() - a.lastUpdated.valueOf() > Feed.mr) && | ||
(r.j.info( | ||
`Cached feed was older than max TTL of ${Feed.mr} ms, requesting an update from the server.`, | ||
? ((f = re.rr().Li()), | ||
F(f, i(f.cards, o), f.lastUpdated, null, s), | ||
(a = !0)) | ||
: (f = new Feed(i(n, o), new Date())); | ||
const u = I(f, s, l); | ||
if (a) { | ||
(null == f.lastUpdated || | ||
new Date().valueOf() - f.lastUpdated.valueOf() > Feed.ur) && | ||
(r.info( | ||
`Cached feed was older than max TTL of ${Feed.ur} ms, requesting an update from the server.`, | ||
), | ||
$(a, u)); | ||
$(f, u)); | ||
const e = new Date().valueOf(), | ||
@@ -73,5 +73,5 @@ t = subscribeToFeedUpdates(function (t) { | ||
} | ||
A(a, s(t.cards, o), t.lastUpdated, u, i); | ||
F(f, i(t.cards, o), t.lastUpdated, u, s); | ||
}); | ||
k(t, u); | ||
B(t, u); | ||
} | ||
@@ -90,4 +90,4 @@ const d = (e) => { | ||
logFeedDisplayed(), | ||
q(a, u), | ||
a && B(a.cards, e); | ||
q(f, u), | ||
f && G(f.cards, e); | ||
}; | ||
@@ -94,0 +94,0 @@ var m; |
import e from "../../managers/braze-instance.js"; | ||
import { destroyFeed, showFeed } from "../index.js"; | ||
export function toggleFeed(o, n, r) { | ||
e.rr() && | ||
e.X() && | ||
(document.querySelectorAll(".ab-feed").length > 0 | ||
@@ -6,0 +6,0 @@ ? destroyFeed() |
import InAppMessage from "./models/in-app-message.js"; | ||
import e from "../managers/braze-instance.js"; | ||
import ControlMessage from "./models/control-message.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import se from "./in-app-message-manager-factory.js"; | ||
export function deferInAppMessage(s) { | ||
if (e.rr()) | ||
if (e.X()) | ||
return s instanceof ControlMessage | ||
? (r.j.info("Not deferring since this is a ControlMessage."), !1) | ||
? (r.info("Not deferring since this is a ControlMessage."), !1) | ||
: s instanceof InAppMessage | ||
? se.m().he(s) | ||
: (r.j.info("Not an instance of InAppMessage, ignoring."), !1); | ||
? se.m().de(s) | ||
: (r.info("Not an instance of InAppMessage, ignoring."), !1); | ||
} |
@@ -1,12 +0,12 @@ | ||
import Q from "../../util/browser-detector.js"; | ||
import X from "../../util/browser-detector.js"; | ||
import { logInAppMessageHtmlClick } from "../log-in-app-message-html-click.js"; | ||
import { getUser as Z } from "../../Core/get-user.js"; | ||
import { getUser as ro } from "../../Core/get-user.js"; | ||
import { InAppMessage } from "../index.js"; | ||
import { keys as oo } from "../../util/code-utils.js"; | ||
import { OperatingSystems as V } from "../../util/device-constants.js"; | ||
import { keys as to } from "../../util/code-utils.js"; | ||
import { OperatingSystems as Y } from "../../util/device-constants.js"; | ||
import { parseQueryStringKeyValues as ut } from "../../util/url-utils.js"; | ||
import { WindowUtils as Y } from "../../util/window-utils.js"; | ||
import { WindowUtils as eo } from "../../util/window-utils.js"; | ||
import e from "../../managers/braze-instance.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../../common/constants.js"; | ||
import { logger as r } from "../../../shared-lib/index.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../../common/constants.js"; | ||
export default function ct(t, o, n, s, i, u) { | ||
@@ -18,5 +18,5 @@ const c = document.createElement("iframe"); | ||
const o = e.getAttribute("href"), | ||
r = e.onclick; | ||
return (n) => { | ||
if (null != r && "function" == typeof r && !1 === r.bind(e)(n)) return; | ||
n = e.onclick; | ||
return (r) => { | ||
if (null != n && "function" == typeof n && !1 === n.bind(e)(r)) return; | ||
let i = ut(o).abButtonId; | ||
@@ -27,21 +27,21 @@ if ( | ||
) { | ||
const r = | ||
const n = | ||
"blank" === | ||
(e.getAttribute("target") || "").toLowerCase().replace("_", ""), | ||
u = s || t.openTarget === InAppMessage.OpenTarget.BLANK || r, | ||
u = s || t.openTarget === InAppMessage.OpenTarget.BLANK || n, | ||
a = () => { | ||
logInAppMessageHtmlClick(t, i, o), Y.openUri(o, u, n); | ||
logInAppMessageHtmlClick(t, i, o), eo.openUri(o, u, r); | ||
}; | ||
u ? a() : t.ye(c, a); | ||
u ? a() : t.he(c, a); | ||
} else logInAppMessageHtmlClick(t, i, o || void 0); | ||
return n.stopPropagation(), !1; | ||
return r.stopPropagation(), !1; | ||
}; | ||
}, | ||
m = (t, e, o) => { | ||
const r = `([\\w]+)\\s*=\\s*document.createElement\\(['"]${o}['"]\\)`, | ||
n = t.match(new RegExp(r)); | ||
if (n) { | ||
const o = `${n[1]}.setAttribute("nonce", "${e}")`; | ||
return `${t.slice(0, n.index + n[0].length)};${o};${t.slice( | ||
n.index + n[0].length, | ||
const n = `([\\w]+)\\s*=\\s*document.createElement\\(['"]${o}['"]\\)`, | ||
r = t.match(new RegExp(n)); | ||
if (r) { | ||
const o = `${r[1]}.setAttribute("nonce", "${e}")`; | ||
return `${t.slice(0, r.index + r[0].length)};${o};${t.slice( | ||
r.index + r[0].length, | ||
)}`; | ||
@@ -67,4 +67,4 @@ } | ||
e && (o[t].innerHTML = e); | ||
const r = m(o[t].innerHTML, u, "style"); | ||
r && (o[t].innerHTML = r); | ||
const n = m(o[t].innerHTML, u, "style"); | ||
n && (o[t].innerHTML = n); | ||
} | ||
@@ -76,6 +76,6 @@ } | ||
if (null != l) { | ||
if (t.Ae()) { | ||
if (t.be()) { | ||
const e = document.createElement("style"); | ||
(e.innerHTML = t.css || ""), | ||
(e.id = t.Ce() || ""), | ||
(e.id = t.ye() || ""), | ||
null != u && e.setAttribute("nonce", u), | ||
@@ -91,3 +91,3 @@ l.appendChild(e); | ||
closeMessage: function () { | ||
t.ye(c); | ||
t.he(c); | ||
}, | ||
@@ -104,5 +104,5 @@ logClick: function () { | ||
import("../../Push/request-push-permission.js").then((o) => { | ||
e.fe() | ||
e.so() | ||
? o.requestPushPermission(...Array.prototype.slice.call(t)) | ||
: r.j.error(P); | ||
: r.error(_); | ||
}); | ||
@@ -116,5 +116,5 @@ }; | ||
({ requestImmediateDataFlush: requestImmediateDataFlush }) => { | ||
e.fe() | ||
e.so() | ||
? requestImmediateDataFlush(...Array.prototype.slice.call(t)) | ||
: r.j.error(P); | ||
: r.error(_); | ||
}, | ||
@@ -127,3 +127,3 @@ ); | ||
({ logCustomEvent: logCustomEvent }) => { | ||
if (!e.fe()) return void r.j.error(P); | ||
if (!e.so()) return void r.error(_); | ||
logCustomEvent(...Array.prototype.slice.call(t)); | ||
@@ -137,3 +137,3 @@ }, | ||
({ logPurchase: logPurchase }) => { | ||
if (!e.fe()) return void r.j.error(P); | ||
if (!e.so()) return void r.error(_); | ||
logPurchase(...Array.prototype.slice.call(t)); | ||
@@ -147,5 +147,5 @@ }, | ||
({ unregisterPush: unregisterPush }) => { | ||
e.fe() | ||
e.so() | ||
? unregisterPush(...Array.prototype.slice.call(t)) | ||
: r.j.error(P); | ||
: r.error(_); | ||
}, | ||
@@ -159,3 +159,3 @@ ); | ||
({ changeUser: changeUser }) => { | ||
if (!e.fe()) return void r.j.error(P); | ||
if (!e.so()) return void r.error(_); | ||
changeUser(...Array.prototype.slice.call(t)); | ||
@@ -166,3 +166,3 @@ }, | ||
}, | ||
h = function (t) { | ||
g = function (t) { | ||
return function () { | ||
@@ -172,4 +172,4 @@ p[t](...Array.prototype.slice.call(arguments)); | ||
}; | ||
for (const t of oo(p)) d[t] = h(t); | ||
const b = [ | ||
for (const t of to(p)) d[t] = g(t); | ||
const h = [ | ||
"setFirstName", | ||
@@ -195,5 +195,5 @@ "setLastName", | ||
], | ||
g = function (t) { | ||
b = function (t) { | ||
return function () { | ||
const e = Z(); | ||
const e = ro(); | ||
e && e[t](...Array.prototype.slice.call(arguments)); | ||
@@ -203,3 +203,3 @@ }; | ||
y = {}; | ||
for (let t = 0; t < b.length; t++) y[b[t]] = g(b[t]); | ||
for (let t = 0; t < h.length; t++) y[h[t]] = b(h[t]); | ||
d.getUser = function () { | ||
@@ -212,3 +212,3 @@ return y; | ||
const o = arguments; | ||
t.ye(c, function () { | ||
t.he(c, function () { | ||
A[e](...Array.prototype.slice.call(o)); | ||
@@ -219,5 +219,5 @@ }); | ||
C = d.display; | ||
for (const t of oo(A)) C[t] = j(t); | ||
for (const t of to(A)) C[t] = j(t); | ||
const v = { registerAppboyPushMessages: requestPushPermission() }, | ||
w = function (t) { | ||
P = function (t) { | ||
return function () { | ||
@@ -227,6 +227,6 @@ v[t](...Array.prototype.slice.call(arguments)); | ||
}, | ||
E = d.web; | ||
for (const t of oo(v)) E[t] = w(t); | ||
w = d.web; | ||
for (const t of to(v)) w[t] = P(t); | ||
if ( | ||
((i.appboyBridge = d), (i.brazeBridge = d), t.Pe !== InAppMessage.qe.Ee) | ||
((i.appboyBridge = d), (i.brazeBridge = d), t.Ae !== InAppMessage.Ce.je) | ||
) { | ||
@@ -238,9 +238,9 @@ const t = i.document.getElementsByTagName("a"); | ||
} | ||
const $ = i.document.body; | ||
if (null != $) { | ||
t.Ne() && ($.id = t.htmlId || ""); | ||
const E = i.document.body; | ||
if (null != E) { | ||
t.ve() && (E.id = t.htmlId || ""); | ||
const e = document.createElement("hidden"); | ||
(e.onclick = d.closeMessage), | ||
(e.className = "ab-programmatic-close-button"), | ||
$.appendChild(e); | ||
E.appendChild(e); | ||
} | ||
@@ -254,10 +254,10 @@ i.dispatchEvent(new CustomEvent("ab.BridgeReady")), | ||
"ab-in-app-message ab-start-hidden ab-html-message ab-modal-interactions"), | ||
Q.OS === V.de) | ||
X.OS === Y.io) | ||
) { | ||
const e = document.createElement("div"); | ||
return ( | ||
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(c), (t.Me = e), e | ||
(e.className = "ab-ios-scroll-wrapper"), e.appendChild(c), (t.Pe = e), e | ||
); | ||
} | ||
return (t.Me = c), c; | ||
return (t.Pe = c), c; | ||
} |
import { | ||
addPassiveEventListener as oe, | ||
buildSvg as ae, | ||
detectSwipe as d, | ||
DIRECTIONS as c, | ||
detectSwipe as c, | ||
DIRECTIONS as m, | ||
} from "../../util/dom-utils.js"; | ||
import { createCloseButton as o } from "../../util/component-utils.js"; | ||
import { createCloseButton as d } from "../../util/component-utils.js"; | ||
import { isTransparent as ne, toRgba as ie } from "../../util/color-utils.js"; | ||
@@ -15,41 +15,41 @@ import FullScreenMessage from "../models/full-screen-message.js"; | ||
import { logInAppMessageClick } from "../log-in-app-message-click.js"; | ||
import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js"; | ||
import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js"; | ||
import ct from "./html-message-to-html.js"; | ||
import le from "./modal-utils.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
export default function ce(e, a, t, n, s, i, l, u = document.body) { | ||
if (((e.ke = document.activeElement), e instanceof HtmlMessage)) | ||
return ct(e, a, t, s, i, l); | ||
const b = (function (e, a, t, n, s, i, l = document.body) { | ||
let c = null; | ||
const d = document.createElement("div"); | ||
(d.className = "ab-in-app-message ab-start-hidden ab-background"), | ||
i && (d.style.zIndex = (i + 1).toString()), | ||
import { logger as r, Guid as p } from "../../../shared-lib/index.js"; | ||
export default function ce(e, o, a, t, n, s, i, l = document.body) { | ||
if (((e.we = document.activeElement), e instanceof HtmlMessage)) | ||
return ct(e, o, a, n, s, i); | ||
const b = (function (e, o, a, t, n, s, i = document.body) { | ||
let m = null; | ||
const l = document.createElement("div"); | ||
(l.className = "ab-in-app-message ab-start-hidden ab-background"), | ||
s && (l.style.zIndex = (s + 1).toString()), | ||
e.xe() && | ||
((d.className += " ab-modal-interactions"), | ||
d.setAttribute("tabindex", "-1")), | ||
e.Ae() || | ||
((d.style.color = ie(e.textColor)), | ||
(d.style.backgroundColor = ie(e.backgroundColor)), | ||
ne(e.backgroundColor) && (d.className += " ab-no-shadow")); | ||
const u = () => { | ||
-1 !== d.className.indexOf("ab-start-hidden") && | ||
((d.className = d.className.replace("ab-start-hidden", "")), | ||
((l.className += " ab-modal-interactions"), | ||
l.setAttribute("tabindex", "-1")), | ||
e.be() || | ||
((l.style.color = ie(e.textColor)), | ||
(l.style.backgroundColor = ie(e.backgroundColor)), | ||
ne(e.backgroundColor) && (l.className += " ab-no-shadow")); | ||
const c = () => { | ||
-1 !== l.className.indexOf("ab-start-hidden") && | ||
((l.className = l.className.replace("ab-start-hidden", "")), | ||
document.querySelectorAll(".ab-iam-img-loading").length > 0 | ||
? n( | ||
? t( | ||
`Cannot show in-app message ${e.message} because another message is being shown.`, | ||
InAppMessage.Ie.Le, | ||
InAppMessage.Me.ke, | ||
) | ||
: t(d)); | ||
: a(l)); | ||
}, | ||
b = (o = !0) => { | ||
let a = document.querySelectorAll(".ab-iam-root"); | ||
(a && 0 !== a.length) || (a = l.querySelectorAll(".ab-iam-root")), | ||
(a && 0 !== a.length) || (a = i.querySelectorAll(".ab-iam-root")), | ||
a && | ||
a.length > 0 && | ||
(a[0].classList.remove("ab-iam-img-loading"), | ||
c && (clearTimeout(c), (c = null)), | ||
m && (clearTimeout(m), (m = null)), | ||
o | ||
? u() | ||
: r.j.error( | ||
? c() | ||
: r.error( | ||
`Cannot show in-app message ${e.message} because the image failed to load.`, | ||
@@ -59,38 +59,38 @@ )); | ||
e.imageStyle === InAppMessage.ImageStyle.GRAPHIC && | ||
(d.className += " graphic"), | ||
(l.className += " graphic"), | ||
e.orientation === InAppMessage.Orientation.LANDSCAPE && | ||
(d.className += " landscape"), | ||
(l.className += " landscape"), | ||
null != e.buttons && | ||
0 === e.buttons.length && | ||
(e.clickAction !== InAppMessage.ClickAction.NONE && | ||
(d.className += " ab-clickable"), | ||
(d.onclick = (o) => ( | ||
e.ye(d, () => { | ||
(l.className += " ab-clickable"), | ||
(l.onclick = (a) => ( | ||
e.he(l, () => { | ||
logInAppMessageClick(e), | ||
e.clickAction === InAppMessage.ClickAction.URI | ||
? m( | ||
? u( | ||
e.uri || "", | ||
s || e.openTarget === InAppMessage.OpenTarget.BLANK, | ||
o, | ||
n || e.openTarget === InAppMessage.OpenTarget.BLANK, | ||
a, | ||
) | ||
: e.clickAction === InAppMessage.ClickAction.NEWS_FEED && a(); | ||
: e.clickAction === InAppMessage.ClickAction.NEWS_FEED && o(); | ||
}), | ||
o.stopPropagation(), | ||
a.stopPropagation(), | ||
!1 | ||
))); | ||
const p = o( | ||
const g = d( | ||
"Close Message", | ||
e.Ae() ? void 0 : ie(e.closeButtonColor), | ||
e.be() ? void 0 : ie(e.closeButtonColor), | ||
() => { | ||
e.ye(d); | ||
e.he(l); | ||
}, | ||
); | ||
d.appendChild(p), i && (p.style.zIndex = (i + 2).toString()); | ||
const g = document.createElement("div"); | ||
g.className = "ab-message-text"; | ||
const f = (e.messageAlignment || e.Te).toLowerCase(); | ||
g.className += " " + f + "-aligned"; | ||
let h = !1; | ||
const j = document.createElement("div"); | ||
if (((j.className = "ab-image-area"), e.imageUrl)) { | ||
l.appendChild(g), s && (g.style.zIndex = (s + 2).toString()); | ||
const f = document.createElement("div"); | ||
f.className = "ab-message-text"; | ||
const h = (e.messageAlignment || e.$e).toLowerCase(); | ||
f.className += " " + h + "-aligned"; | ||
let j = !1; | ||
const w = document.createElement("div"); | ||
if (((w.className = "ab-image-area"), e.imageUrl)) { | ||
if (e.cropType === InAppMessage.CropType.CENTER_CROP) { | ||
@@ -102,4 +102,4 @@ const o = document.createElement("span"); | ||
o.setAttribute("aria-label", "Modal Image"), | ||
e.Be(o), | ||
j.appendChild(o); | ||
e.ze(o), | ||
w.appendChild(o); | ||
} else { | ||
@@ -109,9 +109,9 @@ const o = document.createElement("img"); | ||
(o.setAttribute("src", e.imageUrl), | ||
e.Be(o), | ||
e.ze(o), | ||
0 === document.querySelectorAll(".ab-iam-img-loading").length) | ||
) { | ||
h = !0; | ||
j = !0; | ||
const e = document.querySelectorAll(".ab-iam-root"); | ||
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"), | ||
(c = window.setTimeout(() => { | ||
(m = window.setTimeout(() => { | ||
b(!1); | ||
@@ -126,10 +126,10 @@ }, 6e4)), | ||
} | ||
j.appendChild(o); | ||
w.appendChild(o); | ||
} | ||
d.appendChild(j), (g.className += " ab-with-image"); | ||
l.appendChild(w), (f.className += " ab-with-image"); | ||
} else if (e.icon) { | ||
j.className += " ab-icon-area"; | ||
w.className += " ab-icon-area"; | ||
const o = document.createElement("span"); | ||
(o.className = "ab-icon"), | ||
e.Ae() || | ||
e.be() || | ||
((o.style.backgroundColor = ie(e.iconBackgroundColor)), | ||
@@ -142,9 +142,9 @@ (o.style.color = ie(e.iconColor))); | ||
o.appendChild(a), | ||
j.appendChild(o), | ||
d.appendChild(j), | ||
(g.className += " ab-with-icon"); | ||
w.appendChild(o), | ||
l.appendChild(w), | ||
(f.className += " ab-with-icon"); | ||
} | ||
if ((oe(g, "touchstart"), e.header && e.header.length > 0)) { | ||
if ((oe(f, "touchstart"), e.header && e.header.length > 0)) { | ||
const o = document.createElement("h1"); | ||
(o.className = "ab-message-header"), (e.De = r.Z.Y()), (o.id = e.De); | ||
(o.className = "ab-message-header"), (e.Le = p.W()), (o.id = e.Le); | ||
const a = ( | ||
@@ -154,14 +154,14 @@ e.headerAlignment || InAppMessage.TextAlignment.CENTER | ||
(o.className += " " + a + "-aligned"), | ||
e.Ae() || (o.style.color = ie(e.headerTextColor)), | ||
e.be() || (o.style.color = ie(e.headerTextColor)), | ||
o.appendChild(document.createTextNode(e.header)), | ||
g.appendChild(o); | ||
f.appendChild(o); | ||
} | ||
return g.appendChild(e.Ge()), d.appendChild(g), h || u(), (e.Me = d), d; | ||
})(e, a, t, n, s, i, u); | ||
return f.appendChild(e.Ie()), l.appendChild(f), j || c(), (e.Pe = l), l; | ||
})(e, o, a, t, n, s, l); | ||
if (e instanceof FullScreenMessage || e instanceof ModalMessage) { | ||
const o = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal"; | ||
(b.className += ` ${o} ab-centered`), | ||
le.He(e, a, b, s), | ||
le.Je(b), | ||
le.Ke(e.De, b); | ||
const a = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal"; | ||
(b.className += ` ${a} ab-centered`), | ||
le.Te(e, o, b, n), | ||
le.qe(b), | ||
le.Be(e.Le, b); | ||
} else if (e instanceof SlideUpMessage) { | ||
@@ -174,3 +174,3 @@ b.className += " ab-slideup"; | ||
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z", | ||
e.Ae() ? void 0 : ie(e.closeButtonColor), | ||
e.be() ? void 0 : ie(e.closeButtonColor), | ||
); | ||
@@ -180,7 +180,7 @@ a.setAttribute("class", "ab-chevron"), o.appendChild(a); | ||
let a, t; | ||
d(b, c.W, (e) => { | ||
c(b, m.U, (e) => { | ||
(b.className += " ab-swiped-left"), | ||
null != o && null != o.onclick && o.onclick(e); | ||
}), | ||
d(b, c.X, (e) => { | ||
c(b, m.V, (e) => { | ||
(b.className += " ab-swiped-right"), | ||
@@ -190,5 +190,5 @@ null != o && null != o.onclick && o.onclick(e); | ||
e.slideFrom === InAppMessage.SlideFrom.TOP | ||
? ((a = c.Oe), (t = " ab-swiped-up")) | ||
: ((a = c.Qe), (t = " ab-swiped-down")), | ||
d(b, a, (e) => { | ||
? ((a = m.De), (t = " ab-swiped-up")) | ||
: ((a = m.Ee), (t = " ab-swiped-down")), | ||
c(b, a, (e) => { | ||
(b.className += t), null != o && null != o.onclick && o.onclick(e); | ||
@@ -195,0 +195,0 @@ }); |
import InAppMessage from "../models/in-app-message.js"; | ||
import { _handleBrazeAction as m } from "../../Core/handle-braze-action.js"; | ||
import { _handleBrazeAction as u } from "../../Core/handle-braze-action.js"; | ||
import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.js"; | ||
@@ -8,3 +8,3 @@ import { toRgba as ie } from "../../util/color-utils.js"; | ||
const le = { | ||
Je: (t) => { | ||
qe: (t) => { | ||
const o = t.querySelectorAll( | ||
@@ -20,3 +20,3 @@ ".ab-close-button, .ab-message-text, .ab-message-button", | ||
const a = document.activeElement; | ||
o.keyCode === at.oo && | ||
o.keyCode === at.lo && | ||
(o.shiftKey || (a !== s && a !== t) | ||
@@ -30,3 +30,3 @@ ? !o.shiftKey || | ||
}, | ||
Ke: (t, o) => { | ||
Be: (t, o) => { | ||
o.setAttribute("role", "dialog"), | ||
@@ -37,3 +37,3 @@ o.setAttribute("aria-modal", "true"), | ||
}, | ||
He: (t, o, e, s) => { | ||
Te: (t, o, e, s) => { | ||
if (t.buttons && t.buttons.length > 0) { | ||
@@ -45,6 +45,6 @@ const a = document.createElement("div"); | ||
const n = (a) => (l) => ( | ||
t.ye(e, () => { | ||
t.he(e, () => { | ||
logInAppMessageButtonClick(a, t), | ||
a.clickAction === InAppMessage.ClickAction.URI | ||
? m( | ||
? u( | ||
a.uri || "", | ||
@@ -68,3 +68,3 @@ s || t.openTarget === InAppMessage.OpenTarget.BLANK, | ||
s.appendChild(document.createTextNode(l)), | ||
t.Ae() || | ||
t.be() || | ||
((s.style.backgroundColor = ie(e.backgroundColor)), | ||
@@ -71,0 +71,0 @@ (s.style.color = ie(e.textColor)), |
import e from "../managers/braze-instance.js"; | ||
import se from "./in-app-message-manager-factory.js"; | ||
export function getDeferredInAppMessage() { | ||
if (e.rr()) return se.m().Re(); | ||
if (e.X()) return se.m().Ge(); | ||
} |
@@ -8,9 +8,9 @@ import InAppMessage from "./models/in-app-message.js"; | ||
import SlideUpMessage from "./models/slide-up-message.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function newInAppMessageFromJson(e) { | ||
if (!e) return null; | ||
if (e.is_control) return ControlMessage.fromJson(e); | ||
let s = e.type; | ||
null != s && (s = s.toUpperCase()); | ||
const o = e.message, | ||
let o = e.type; | ||
null != o && (o = o.toUpperCase()); | ||
const s = e.message, | ||
n = e.text_align_message, | ||
@@ -23,4 +23,4 @@ m = e.slide_from, | ||
p = e.open_target, | ||
a = e.message_close, | ||
u = e.duration, | ||
u = e.message_close, | ||
a = e.duration, | ||
d = e.icon, | ||
@@ -34,12 +34,12 @@ g = e.image_url, | ||
v = e.close_btn_color, | ||
I = e.header, | ||
x = e.text_align_header, | ||
z = e.header_text_color, | ||
A = e.frame_color, | ||
F = []; | ||
let M = e.btns; | ||
null == M && (M = []); | ||
for (let e = 0; e < M.length; e++) F.push(InAppMessageButton.fromJson(M[e])); | ||
const k = e.crop_type, | ||
y = e.orientation, | ||
x = e.header, | ||
I = e.text_align_header, | ||
A = e.header_text_color, | ||
F = e.frame_color, | ||
M = []; | ||
let k = e.btns; | ||
null == k && (k = []); | ||
for (let e = 0; e < k.length; e++) M.push(InAppMessageButton.fromJson(k[e])); | ||
const y = e.crop_type, | ||
z = e.orientation, | ||
J = e.animate_in, | ||
@@ -53,6 +53,6 @@ S = e.animate_out; | ||
((B = void 0), (C = void 0)), | ||
s === ModalMessage.et || s === InAppMessage.qe.Se) | ||
o === ModalMessage.it || o === InAppMessage.Ce.Je) | ||
) | ||
q = new ModalMessage( | ||
o, | ||
s, | ||
n, | ||
@@ -64,4 +64,4 @@ t, | ||
p, | ||
u, | ||
a, | ||
u, | ||
d, | ||
@@ -77,14 +77,14 @@ g, | ||
S, | ||
x, | ||
I, | ||
x, | ||
z, | ||
A, | ||
F, | ||
k, | ||
M, | ||
y, | ||
B, | ||
C, | ||
); | ||
else if (s === FullScreenMessage.et) | ||
else if (o === FullScreenMessage.it) | ||
q = new FullScreenMessage( | ||
o, | ||
s, | ||
n, | ||
@@ -96,4 +96,4 @@ t, | ||
p, | ||
u, | ||
a, | ||
u, | ||
d, | ||
@@ -109,15 +109,15 @@ g, | ||
S, | ||
x, | ||
I, | ||
x, | ||
z, | ||
A, | ||
F, | ||
k, | ||
M, | ||
y, | ||
z, | ||
B, | ||
C, | ||
); | ||
else if (s === SlideUpMessage.et) | ||
else if (o === SlideUpMessage.it) | ||
q = new SlideUpMessage( | ||
o, | ||
s, | ||
n, | ||
@@ -130,4 +130,4 @@ m, | ||
p, | ||
u, | ||
a, | ||
u, | ||
d, | ||
@@ -147,30 +147,30 @@ g, | ||
if ( | ||
s !== HtmlMessage.et && | ||
s !== InAppMessage.qe.Ee && | ||
s !== InAppMessage.qe.Ue | ||
o !== HtmlMessage.it && | ||
o !== InAppMessage.Ce.je && | ||
o !== InAppMessage.Ce.Se | ||
) | ||
return void r.j.error("Ignoring message with unknown type " + s); | ||
return void r.error("Ignoring message with unknown type " + o); | ||
{ | ||
const s = e.message_fields; | ||
(q = new HtmlMessage(o, t, l, a, u, J, S, A, B, C, s)), | ||
const o = e.message_fields; | ||
(q = new HtmlMessage(s, t, l, u, a, J, S, F, B, C, o)), | ||
(q.trusted = e.trusted || !1); | ||
} | ||
} | ||
return (q.Pe = s), q; | ||
return (q.Ae = o), q; | ||
} | ||
export function buttonsFromSerializedInAppMessage(e) { | ||
const s = []; | ||
for (const o of e) | ||
s.push( | ||
const o = []; | ||
for (const s of e) | ||
o.push( | ||
new InAppMessageButton( | ||
o.text, | ||
o.backgroundColor, | ||
o.textColor, | ||
o.borderColor, | ||
o.clickAction, | ||
o.uri, | ||
o.id, | ||
s.text, | ||
s.backgroundColor, | ||
s.textColor, | ||
s.borderColor, | ||
s.clickAction, | ||
s.uri, | ||
s.id, | ||
), | ||
); | ||
return s; | ||
return o; | ||
} |
@@ -7,3 +7,3 @@ import aa from "./in-app-message-manager.js"; | ||
m: () => ( | ||
se.o(), se.i || (se.i = new aa(e.ar(), e.aa(), e.l(), e.ir())), se.i | ||
se.o(), se.i || (se.i = new aa(e.nr(), e.zr(), e.l(), e.er())), se.i | ||
), | ||
@@ -10,0 +10,0 @@ o: () => { |
@@ -9,13 +9,13 @@ import C from "../util/net.js"; | ||
import { newInAppMessageFromJson as lt } from "./in-app-message-factory.js"; | ||
import { randomInclusive as D } from "../util/math.js"; | ||
import { randomInclusive as k } from "../util/math.js"; | ||
import t from "../models/request-result.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import E from "../managers/subscription-manager.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import T from "../managers/subscription-manager.js"; | ||
import pt from "../triggers/models/trigger.js"; | ||
import { validateValueIsFromEnum as G } from "../util/code-utils.js"; | ||
import { BRAZE_ACTION_URI_REGEX as W } from "../util/validation-utils.js"; | ||
import { validateValueIsFromEnum as J } from "../util/code-utils.js"; | ||
import { BRAZE_ACTION_URI_REGEX as Z } from "../util/validation-utils.js"; | ||
import { | ||
containsPushPrimerBrazeAction as mt, | ||
containsUnknownBrazeAction as gt, | ||
getDecodedBrazeAction as O, | ||
getDecodedBrazeAction as W, | ||
ineligibleBrazeActionURLErrorMessage as ft, | ||
@@ -25,40 +25,40 @@ INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as dt, | ||
import vt from "../Push/utils/push-utils.js"; | ||
import T from "../util/request-header-utils.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import S from "../util/request-header-utils.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js"; | ||
export default class aa { | ||
constructor(t, s, i, r) { | ||
(this.$t = t), | ||
(this._e = s), | ||
(this.qt = t), | ||
(this.di = s), | ||
(this.u = i), | ||
(this.wt = r), | ||
(this.$t = t), | ||
(this._e = s), | ||
(this.qt = t), | ||
(this.di = s), | ||
(this.u = i), | ||
(this.wt = r), | ||
(this.Ve = new E()), | ||
e.Ht(this.Ve), | ||
(this.We = 1e3), | ||
(this.Xe = 6e4), | ||
(this.Ye = null); | ||
(this._e = new T()), | ||
e.$t(this._e), | ||
(this.Ne = 1e3), | ||
(this.Oe = 6e4), | ||
(this.Re = null); | ||
} | ||
Ze() { | ||
return this.Ve; | ||
He() { | ||
return this._e; | ||
} | ||
_i(t) { | ||
return this.Ve.It(t); | ||
Ke(t) { | ||
return this._e.It(t); | ||
} | ||
Pi() { | ||
return this.Ye; | ||
Qe() { | ||
return this.Re; | ||
} | ||
Oi(t) { | ||
this.Ye = t; | ||
Ue(t) { | ||
this.Re = t; | ||
} | ||
Ji(e, i) { | ||
Ve(e, r) { | ||
if (!e) return new t(); | ||
if ( | ||
!G( | ||
InAppMessage.Ie, | ||
i, | ||
`${i} is not a valid in-app message display failure`, | ||
!J( | ||
InAppMessage.Me, | ||
r, | ||
`${r} is not a valid in-app message display failure`, | ||
"InAppMessage.DisplayFailures", | ||
@@ -68,66 +68,66 @@ ) | ||
return new t(); | ||
const n = { trigger_ids: [e], error_code: i }; | ||
return s.N(r.q.Ki, n); | ||
const n = { trigger_ids: [e], error_code: r }; | ||
return s.q(i.We, n); | ||
} | ||
N(e, i, n, o) { | ||
const a = new t(); | ||
let l; | ||
if (e instanceof ControlMessage) l = { trigger_ids: [e.triggerId] }; | ||
q(e, n, o, a) { | ||
const l = new t(); | ||
let u; | ||
if (e instanceof ControlMessage) u = { trigger_ids: [e.triggerId] }; | ||
else { | ||
if (i === r.q.Li || (e instanceof HtmlMessage && i === r.q.Qi)) { | ||
if (!e.p(o)) | ||
if (n === i.Xe || (e instanceof HtmlMessage && n === i.Ye)) { | ||
if (!e.p(a)) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"This in-app message has already received a click. Ignoring analytics event.", | ||
), | ||
a | ||
l | ||
); | ||
} else if (i === r.q.Vi) { | ||
if (!e.M()) | ||
} else if (n === i.Ze) { | ||
if (!e.K()) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"This in-app message has already received an impression. Ignoring analytics event.", | ||
), | ||
a | ||
l | ||
); | ||
} | ||
l = this.Wi(e); | ||
u = this.Pi(e); | ||
} | ||
return null == l ? a : (null != n && (l.bid = n), s.N(i, l)); | ||
return null == u ? l : (null != o && (u.bid = o), s.q(n, u)); | ||
} | ||
Xi(e, i) { | ||
const n = new t(); | ||
Oi(e, n) { | ||
const o = new t(); | ||
if (!e.p()) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"This in-app message button has already received a click. Ignoring analytics event.", | ||
), | ||
n | ||
o | ||
); | ||
const o = this.Wi(i); | ||
return null == o | ||
? n | ||
: e.id === InAppMessageButton.Yi | ||
? (r.j.info( | ||
const a = this.Pi(n); | ||
return null == a | ||
? o | ||
: e.id === InAppMessageButton.Qi | ||
? (r.info( | ||
"This in-app message button does not have a tracking id. Not logging event to Braze servers.", | ||
), | ||
n) | ||
: (null != e.id && (o.bid = e.id), s.N(r.q.Qi, o)); | ||
o) | ||
: (null != e.id && (a.bid = e.id), s.q(i.Ye, a)); | ||
} | ||
Zi(t) { | ||
Vi(t) { | ||
const e = t.messageFields; | ||
return (null != e && e.is_push_primer) || !1; | ||
} | ||
Mr(t) { | ||
Wi(t) { | ||
if (!(t instanceof InAppMessage)) return; | ||
const e = (t) => { | ||
if (!t) return; | ||
const e = O(t); | ||
const e = W(t); | ||
return gt(e) | ||
? ft(dt._r, "In-App Message") | ||
: mt(e) && !vt.Gr() | ||
? ft(dt.Or, "In-App Message") | ||
? ft(dt.Xi, "In-App Message") | ||
: mt(e) && !vt.Yi() | ||
? ft(dt.Zi, "In-App Message") | ||
: void 0; | ||
}; | ||
if (this.Zi(t) && !vt.Gr()) | ||
if (this.Vi(t) && !vt.Yi()) | ||
return "In-App Message contains a push prompt, but is not eligible for a push prompt. Ignoring."; | ||
@@ -140,3 +140,3 @@ const s = t.buttons || []; | ||
t.uri && | ||
W.test(t.uri) && | ||
Z.test(t.uri) && | ||
((i = e(t.uri)), i) | ||
@@ -147,64 +147,69 @@ ) | ||
t.uri && | ||
W.test(t.uri) | ||
Z.test(t.uri) | ||
? e(t.uri) | ||
: void 0; | ||
} | ||
Hr(t, e, s, i) { | ||
if (!this.$t) return; | ||
const n = this.$t.Jr(!1, !1), | ||
o = this.$t.Bs(n); | ||
Mr(t, e, s, i) { | ||
if (!this.qt) return; | ||
const n = this.qt._r(!1, !1), | ||
o = this.qt.Ps(n); | ||
(o.template = { trigger_id: t.triggerId, trigger_event_type: e }), | ||
null != s && (o.template.data = s.Kr()); | ||
const a = this.$t.Hs(o, T.Os.Lr); | ||
this.$t.Qs(o, () => { | ||
this.$t && | ||
(T.Ws(this.u, T.Os.Lr, new Date().valueOf()), | ||
C.Xs({ | ||
url: `${this.$t.Ys()}/template/`, | ||
data: o, | ||
headers: a, | ||
O: (e) => { | ||
if ((T.si(this.u, T.Os.Lr, 1), !this.$t.Zs(o, e, a))) | ||
return ( | ||
this.Ji(t.triggerId, InAppMessage.Ie.Qr), | ||
void ("function" == typeof t.Ur && t.Ur()) | ||
); | ||
if ((this.$t.ti(), null == e || null == e.templated_message)) | ||
return void this.Ji(t.triggerId, InAppMessage.Ie.Qr); | ||
const s = e.templated_message; | ||
if (s.type !== pt.Wr.Vr) | ||
return void this.Ji(t.triggerId, InAppMessage.Ie.Xr); | ||
const i = lt(s.data); | ||
if (null == i) return void this.Ji(t.triggerId, InAppMessage.Ie.Xr); | ||
const n = this.Mr(i); | ||
if (n) | ||
return r.j.error(n), void ("function" == typeof t.Ur && t.Ur()); | ||
"function" == typeof t.Yr | ||
? t.Yr(i) | ||
: this.Ji(t.triggerId, InAppMessage.Ie.Qr); | ||
}, | ||
error: (r) => { | ||
let n = `getting user personalization for message ${t.triggerId}`; | ||
if (new Date().valueOf() - t.Zr > t.sn) | ||
this.Ji(t.triggerId, InAppMessage.Ie.Qr); | ||
else { | ||
T.hi(this.u, T.Os.Lr); | ||
const r = Math.min(t.sn, this.Xe), | ||
o = this.We; | ||
null == i && (i = o); | ||
const a = Math.min(r, D(o, 3 * i)); | ||
(n += `. Retrying in ${a} ms`), | ||
setTimeout(() => { | ||
this.Hr(t, e, s, a); | ||
}, a); | ||
} | ||
this.$t.ii(r, n); | ||
}, | ||
})); | ||
}); | ||
null != s && (o.template.data = s.Gr()); | ||
const a = this.qt._s(o, S.Gs.Cr); | ||
this.qt.Hs( | ||
o, | ||
() => { | ||
this.qt && | ||
(S.Os(this.u, S.Gs.Cr, new Date().valueOf()), | ||
C.Qs({ | ||
url: `${this.qt.Vs()}/template/`, | ||
data: o, | ||
headers: a, | ||
L: (e) => { | ||
if ((S.Ys(this.u, S.Gs.Cr, 1), !this.qt.Ws(o, e, a))) | ||
return ( | ||
this.Ve(t.triggerId, InAppMessage.Me.Or), | ||
void ("function" == typeof t.Hr && t.Hr()) | ||
); | ||
if ((this.qt.Xs(), null == e || null == e.templated_message)) | ||
return void this.Ve(t.triggerId, InAppMessage.Me.Or); | ||
const s = e.templated_message; | ||
if (s.type !== pt.Kr.Jr) | ||
return void this.Ve(t.triggerId, InAppMessage.Me.Lr); | ||
const i = lt(s.data); | ||
if (null == i) | ||
return void this.Ve(t.triggerId, InAppMessage.Me.Lr); | ||
const n = this.Wi(i); | ||
if (n) | ||
return r.error(n), void ("function" == typeof t.Hr && t.Hr()); | ||
"function" == typeof t.Qr | ||
? t.Qr(i) | ||
: this.Ve(t.triggerId, InAppMessage.Me.Or); | ||
}, | ||
error: (r) => { | ||
let n = `getting user personalization for message ${t.triggerId}`; | ||
if (new Date().valueOf() - t.Ur > t.Vr) | ||
this.Ve(t.triggerId, InAppMessage.Me.Or); | ||
else { | ||
S.si(this.u, S.Gs.Cr); | ||
const r = Math.min(t.Vr, this.Oe), | ||
o = this.Ne; | ||
null == i && (i = o); | ||
const a = Math.min(r, k(o, 3 * i)); | ||
(n += `. Retrying in ${a} ms`), | ||
setTimeout(() => { | ||
this.Mr(t, e, s, a); | ||
}, a); | ||
} | ||
this.qt.Zs(r, n); | ||
}, | ||
})); | ||
}, | ||
S.ii.Cr, | ||
); | ||
} | ||
Wi(t) { | ||
Pi(t) { | ||
if (null == t.triggerId) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"The in-app message has no analytics id. Not logging event to Braze servers.", | ||
@@ -217,3 +222,3 @@ ), | ||
} | ||
he(t) { | ||
de(t) { | ||
return ( | ||
@@ -225,31 +230,31 @@ !!this.u && | ||
) && | ||
this.u.D(i.k.rn, t.tt()) | ||
this.u.k(o.C.Wr, t.Y()) | ||
); | ||
} | ||
Re() { | ||
Ge() { | ||
if (!this.u) return null; | ||
const t = this.u.v(i.k.rn); | ||
const t = this.u.j(o.C.Wr); | ||
if (!t) return null; | ||
let e; | ||
switch (t.type) { | ||
case InAppMessage.qe.on: | ||
e = FullScreenMessage.an(t); | ||
case InAppMessage.Ce.Xr: | ||
e = FullScreenMessage.Yr(t); | ||
break; | ||
case InAppMessage.qe.ln: | ||
case InAppMessage.qe.Ee: | ||
case InAppMessage.qe.Ue: | ||
e = HtmlMessage.an(t); | ||
case InAppMessage.Ce.Zr: | ||
case InAppMessage.Ce.je: | ||
case InAppMessage.Ce.Se: | ||
e = HtmlMessage.Yr(t); | ||
break; | ||
case InAppMessage.qe.un: | ||
case InAppMessage.qe.Se: | ||
e = ModalMessage.an(t); | ||
case InAppMessage.Ce.sn: | ||
case InAppMessage.Ce.Je: | ||
e = ModalMessage.Yr(t); | ||
break; | ||
case InAppMessage.qe.pn: | ||
e = SlideUpMessage.an(t); | ||
case InAppMessage.Ce.rn: | ||
e = SlideUpMessage.Yr(t); | ||
} | ||
return e && this.mn(), e; | ||
return e && this.on(), e; | ||
} | ||
mn() { | ||
this.u && this.u.ni(i.k.rn); | ||
on() { | ||
this.u && this.u.hi(o.C.Wr); | ||
} | ||
} |
import e from "../managers/braze-instance.js"; | ||
import { MUST_BE_IN_APP_MESSAGE_WARNING as or } from "../common/constants.js"; | ||
import { MUST_BE_IN_APP_MESSAGE_WARNING as sr } from "../common/constants.js"; | ||
import InAppMessage from "./models/in-app-message.js"; | ||
import InAppMessageButton from "./models/in-app-message-button.js"; | ||
import se from "./in-app-message-manager-factory.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import tt from "../triggers/models/trigger-events.js"; | ||
@@ -11,11 +11,11 @@ import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js"; | ||
var s; | ||
if (!e.rr()) return !1; | ||
if (!e.X()) return !1; | ||
if (!(o instanceof InAppMessageButton)) | ||
return r.j.error("button must be an InAppMessageButton object"), !1; | ||
if (!(t instanceof InAppMessage)) return r.j.error(or), !1; | ||
const n = se.m().Xi(o, t); | ||
if (n.O) | ||
for (let r = 0; r < n.ve.length; r++) | ||
et.er().be( | ||
tt.ro, | ||
return r.error("button must be an InAppMessageButton object"), !1; | ||
if (!(t instanceof InAppMessage)) return r.error(sr), !1; | ||
const n = se.m().Oi(o, t); | ||
if (n.L) | ||
for (let r = 0; r < n.ge.length; r++) | ||
et.rr().fe( | ||
tt.mo, | ||
[ | ||
@@ -25,5 +25,5 @@ t.triggerId, | ||
], | ||
n.ve[r], | ||
n.ge[r], | ||
); | ||
return n.O; | ||
return n.L; | ||
} |
@@ -5,16 +5,16 @@ import e from "../managers/braze-instance.js"; | ||
import { logInAppMessageImpression } from "./log-in-app-message-impression.js"; | ||
import { MUST_BE_IN_APP_MESSAGE_WARNING as or } from "../common/constants.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { MUST_BE_IN_APP_MESSAGE_WARNING as sr } from "../common/constants.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import tt from "../triggers/models/trigger-events.js"; | ||
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js"; | ||
export function logInAppMessageClick(o) { | ||
if (!e.rr()) return !1; | ||
if (!(o instanceof InAppMessage)) return r.j.error(or), !1; | ||
const s = se.m().N(o, r.q.Li); | ||
if (!e.X()) return !1; | ||
if (!(o instanceof InAppMessage)) return r.error(sr), !1; | ||
const s = se.m().q(o, i.Xe); | ||
if (s) { | ||
o.so() || logInAppMessageImpression(o); | ||
for (let r = 0; r < s.ve.length; r++) | ||
et.er().be(tt.ro, [o.triggerId], s.ve[r]); | ||
o.po() || logInAppMessageImpression(o); | ||
for (let r = 0; r < s.ge.length; r++) | ||
et.rr().fe(tt.mo, [o.triggerId], s.ge[r]); | ||
} | ||
return s.O; | ||
return s.L; | ||
} |
import e from "../managers/braze-instance.js"; | ||
import HtmlMessage from "./models/html-message.js"; | ||
import se from "./in-app-message-manager-factory.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import tt from "../triggers/models/trigger-events.js"; | ||
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js"; | ||
export function logInAppMessageHtmlClick(s, t, o) { | ||
if (!e.rr()) return !1; | ||
if (!(s instanceof HtmlMessage)) | ||
export function logInAppMessageHtmlClick(t, s, o) { | ||
if (!e.X()) return !1; | ||
if (!(t instanceof HtmlMessage)) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
"inAppMessage argument to logInAppMessageHtmlClick must be an HtmlMessage object.", | ||
@@ -16,9 +16,9 @@ ), | ||
); | ||
let m = r.q.Li; | ||
null != t && (m = r.q.Qi); | ||
const i = se.m().N(s, m, t, o); | ||
if (i.O) | ||
for (let r = 0; r < i.ve.length; r++) | ||
et.er().be(tt.ro, [s.triggerId, t], i.ve[r]); | ||
return i.O; | ||
let m = i.Xe; | ||
null != s && (m = i.Ye); | ||
const n = se.m().q(t, m, s, o); | ||
if (n.L) | ||
for (let e = 0; e < n.ge.length; e++) | ||
et.rr().fe(tt.mo, [t.triggerId, s], n.ge[e]); | ||
return n.L; | ||
} |
@@ -5,10 +5,10 @@ import e from "../managers/braze-instance.js"; | ||
import se from "./in-app-message-manager-factory.js"; | ||
import { MUST_BE_IN_APP_MESSAGE_WARNING as or } from "../common/constants.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { MUST_BE_IN_APP_MESSAGE_WARNING as sr } from "../common/constants.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
export function logInAppMessageImpression(o) { | ||
if (!e.rr()) return !1; | ||
if (!e.X()) return !1; | ||
if (!(o instanceof InAppMessage || o instanceof ControlMessage)) | ||
return r.j.error(or), !1; | ||
const s = o instanceof ControlMessage ? r.q.eo : r.q.Vi; | ||
return se.m().N(o, s).O; | ||
return r.error(sr), !1; | ||
const s = o instanceof ControlMessage ? i.fo : i.Ze; | ||
return se.m().q(o, s).L; | ||
} |
@@ -67,40 +67,40 @@ import { buttonsFromSerializedInAppMessage as pe } from "../in-app-message-factory.js"; | ||
), | ||
(this.Te = InAppMessage.TextAlignment.CENTER); | ||
(this.$e = InAppMessage.TextAlignment.CENTER); | ||
} | ||
tt() { | ||
return super.tt(FullScreenMessage.et); | ||
Y() { | ||
return super.Y(FullScreenMessage.it); | ||
} | ||
static an(e) { | ||
static Yr(e) { | ||
return new FullScreenMessage( | ||
e[InAppMessage.it.ea], | ||
e[InAppMessage.it.ra], | ||
e[InAppMessage.it.jt], | ||
e[InAppMessage.it.sa], | ||
e[InAppMessage.it.ta], | ||
e[InAppMessage.it.URI], | ||
e[InAppMessage.it.ia], | ||
e[InAppMessage.it.oa], | ||
e[InAppMessage.it.pa], | ||
e[InAppMessage.it.ma], | ||
e[InAppMessage.it.nt], | ||
e[InAppMessage.it.na], | ||
e[InAppMessage.it.ua], | ||
e[InAppMessage.it.ca], | ||
e[InAppMessage.it.fa], | ||
e[InAppMessage.it.da], | ||
e[InAppMessage.it.la], | ||
e[InAppMessage.it.ga], | ||
e[InAppMessage.it.ja], | ||
e[InAppMessage.it.xa], | ||
e[InAppMessage.it.za], | ||
e[InAppMessage.it.ha], | ||
e[InAppMessage.it.va], | ||
pe(e[InAppMessage.it.wa]), | ||
e[InAppMessage.it.ya], | ||
e[InAppMessage.it.Sa], | ||
e[InAppMessage.it.ba], | ||
e[InAppMessage.it.CSS], | ||
e[InAppMessage.tt.ea], | ||
e[InAppMessage.tt.ra], | ||
e[InAppMessage.tt.bt], | ||
e[InAppMessage.tt.sa], | ||
e[InAppMessage.tt.ta], | ||
e[InAppMessage.tt.URI], | ||
e[InAppMessage.tt.ia], | ||
e[InAppMessage.tt.aa], | ||
e[InAppMessage.tt.oa], | ||
e[InAppMessage.tt.pa], | ||
e[InAppMessage.tt.ot], | ||
e[InAppMessage.tt.ma], | ||
e[InAppMessage.tt.na], | ||
e[InAppMessage.tt.ua], | ||
e[InAppMessage.tt.ca], | ||
e[InAppMessage.tt.fa], | ||
e[InAppMessage.tt.da], | ||
e[InAppMessage.tt.la], | ||
e[InAppMessage.tt.ga], | ||
e[InAppMessage.tt.ja], | ||
e[InAppMessage.tt.xa], | ||
e[InAppMessage.tt.za], | ||
e[InAppMessage.tt.ha], | ||
pe(e[InAppMessage.tt.va]), | ||
e[InAppMessage.tt.wa], | ||
e[InAppMessage.tt.ya], | ||
e[InAppMessage.tt.Sa], | ||
e[InAppMessage.tt.CSS], | ||
); | ||
} | ||
} | ||
FullScreenMessage.et = InAppMessage.qe.on; | ||
FullScreenMessage.it = InAppMessage.Ce.Xr; |
@@ -38,32 +38,32 @@ import InAppMessage from "./in-app-message.js"; | ||
} | ||
io() { | ||
do() { | ||
return !1; | ||
} | ||
p(i) { | ||
if (this.Pe === InAppMessage.qe.ln) { | ||
if (this.do) return !1; | ||
this.do = !0; | ||
if (this.Ae === InAppMessage.Ce.Zr) { | ||
if (this.vo) return !1; | ||
this.vo = !0; | ||
} | ||
return this.Et.Dt(i), !0; | ||
} | ||
tt() { | ||
const i = super.tt(HtmlMessage.et); | ||
return (i[InAppMessage.it.vo] = this.messageFields), i; | ||
Y() { | ||
const i = super.Y(HtmlMessage.it); | ||
return (i[InAppMessage.tt.uo] = this.messageFields), i; | ||
} | ||
static an(i) { | ||
static Yr(i) { | ||
return new HtmlMessage( | ||
i[InAppMessage.it.ea], | ||
i[InAppMessage.it.jt], | ||
i[InAppMessage.it.sa], | ||
i[InAppMessage.it.oa], | ||
i[InAppMessage.it.pa], | ||
i[InAppMessage.it.ga], | ||
i[InAppMessage.it.ja], | ||
i[InAppMessage.it.va], | ||
i[InAppMessage.it.ba], | ||
i[InAppMessage.it.CSS], | ||
i[InAppMessage.it.vo], | ||
i[InAppMessage.tt.ea], | ||
i[InAppMessage.tt.bt], | ||
i[InAppMessage.tt.sa], | ||
i[InAppMessage.tt.aa], | ||
i[InAppMessage.tt.oa], | ||
i[InAppMessage.tt.la], | ||
i[InAppMessage.tt.ga], | ||
i[InAppMessage.tt.ha], | ||
i[InAppMessage.tt.Sa], | ||
i[InAppMessage.tt.CSS], | ||
i[InAppMessage.tt.uo], | ||
); | ||
} | ||
} | ||
HtmlMessage.et = InAppMessage.qe.ln; | ||
HtmlMessage.it = InAppMessage.Ce.Zr; |
import InAppMessage from "./in-app-message.js"; | ||
import E from "../../managers/subscription-manager.js"; | ||
import T from "../../managers/subscription-manager.js"; | ||
export default class InAppMessageButton { | ||
@@ -18,6 +18,6 @@ constructor(s, t, i, r, h, e, n) { | ||
(this.uri = e), | ||
null == n && (n = InAppMessageButton.Yi), | ||
null == n && (n = InAppMessageButton.Qi), | ||
(this.id = n), | ||
(this.do = !1), | ||
(this.Et = new E()); | ||
(this.vo = !1), | ||
(this.Et = new T()); | ||
} | ||
@@ -34,3 +34,3 @@ subscribeToClickedEvent(s) { | ||
p() { | ||
return !this.do && ((this.do = !0), this.Et.Dt(), !0); | ||
return !this.vo && ((this.vo = !0), this.Et.Dt(), !0); | ||
} | ||
@@ -49,2 +49,2 @@ static fromJson(s) { | ||
} | ||
InAppMessageButton.Yi = -1; | ||
InAppMessageButton.Qi = -1; |
import e, { OPTIONS as L } from "../../managers/braze-instance.js"; | ||
import Q from "../../util/browser-detector.js"; | ||
import X from "../../util/browser-detector.js"; | ||
import { | ||
@@ -8,3 +8,3 @@ clickElement as Et, | ||
import { KeyCodes as at } from "../../util/key-codes.js"; | ||
import E from "../../managers/subscription-manager.js"; | ||
import T from "../../managers/subscription-manager.js"; | ||
import { isIFrame as It } from "../utils/in-app-message-utils.js"; | ||
@@ -18,4 +18,4 @@ export default class InAppMessage { | ||
e, | ||
E, | ||
n, | ||
T, | ||
o, | ||
@@ -49,4 +49,4 @@ r, | ||
(this.triggerId = e), | ||
(this.clickAction = n), | ||
(this.uri = T), | ||
(this.clickAction = E), | ||
(this.uri = n), | ||
(this.openTarget = o), | ||
@@ -80,4 +80,4 @@ (this.dismissType = r), | ||
(this.triggerId = e), | ||
(this.clickAction = n || InAppMessage.ClickAction.NONE), | ||
(this.uri = T), | ||
(this.clickAction = E || InAppMessage.ClickAction.NONE), | ||
(this.uri = n), | ||
(this.openTarget = o || InAppMessage.OpenTarget.NONE), | ||
@@ -109,9 +109,9 @@ (this.dismissType = r || InAppMessage.DismissType.AUTO_DISMISS), | ||
(this.Th = !1), | ||
(this.do = !1), | ||
(this.vo = !1), | ||
(this.oh = !1), | ||
(this.Me = null), | ||
(this.ke = null), | ||
(this.Et = new E()), | ||
(this.rh = new E()), | ||
(this.Te = InAppMessage.TextAlignment.CENTER); | ||
(this.Pe = null), | ||
(this.we = null), | ||
(this.Et = new T()), | ||
(this.rh = new T()), | ||
(this.$e = InAppMessage.TextAlignment.CENTER); | ||
} | ||
@@ -131,3 +131,3 @@ subscribeToClickedEvent(t) { | ||
closeMessage() { | ||
this.ye(this.Me); | ||
this.he(this.Pe); | ||
} | ||
@@ -137,24 +137,24 @@ xe() { | ||
} | ||
io() { | ||
do() { | ||
return this.xe(); | ||
} | ||
Ne() { | ||
ve() { | ||
return null != this.htmlId && this.htmlId.length > 4; | ||
} | ||
Ae() { | ||
return this.Ne() && null != this.css && this.css.length > 0; | ||
be() { | ||
return this.ve() && null != this.css && this.css.length > 0; | ||
} | ||
Ce() { | ||
if (this.Ne() && this.Ae()) return this.htmlId + "-css"; | ||
ye() { | ||
if (this.ve() && this.be()) return this.htmlId + "-css"; | ||
} | ||
M() { | ||
K() { | ||
return !this.Th && ((this.Th = !0), !0); | ||
} | ||
so() { | ||
po() { | ||
return this.Th; | ||
} | ||
p(t) { | ||
return !this.do && ((this.do = !0), this.Et.Dt(), !0); | ||
return !this.vo && ((this.vo = !0), this.Et.Dt(), !0); | ||
} | ||
F() { | ||
N() { | ||
return !this.oh && ((this.oh = !0), this.rh.Dt(), !0); | ||
@@ -174,6 +174,6 @@ } | ||
} | ||
ye(t, s) { | ||
he(t, s) { | ||
if (null == t) return; | ||
let i; | ||
(this.Me = null), | ||
(this.Pe = null), | ||
(i = | ||
@@ -193,3 +193,3 @@ -1 === t.className.indexOf("ab-in-app-message") | ||
} | ||
const i = this.Ce(); | ||
const i = this.ye(); | ||
if (null != i) { | ||
@@ -199,11 +199,11 @@ const t = document.getElementById(i); | ||
} | ||
null != e && "Safari" === Q.browser && (e.scrollTop = E), | ||
s ? s() : this.F(); | ||
null != e && "Safari" === X.browser && (e.scrollTop = E), | ||
s ? s() : this.N(); | ||
}; | ||
h ? setTimeout(n, InAppMessage.Oh) : n(), this.ke && this.ke.focus(); | ||
h ? setTimeout(n, InAppMessage.Oh) : n(), this.we && this.we.focus(); | ||
} | ||
Ge() { | ||
Ie() { | ||
return document.createTextNode(this.message || ""); | ||
} | ||
Be(t) { | ||
ze(t) { | ||
let s = ""; | ||
@@ -269,35 +269,35 @@ this.message || this.header || !this.xe() || (s = "Modal Image"), | ||
} | ||
tt(t) { | ||
Y(t) { | ||
const s = {}; | ||
return t | ||
? ((s[InAppMessage.it.ea] = this.message), | ||
(s[InAppMessage.it.ra] = this.messageAlignment), | ||
(s[InAppMessage.it.Sh] = this.slideFrom), | ||
(s[InAppMessage.it.jt] = this.extras), | ||
(s[InAppMessage.it.sa] = this.triggerId), | ||
(s[InAppMessage.it.ta] = this.clickAction), | ||
(s[InAppMessage.it.URI] = this.uri), | ||
(s[InAppMessage.it.ia] = this.openTarget), | ||
(s[InAppMessage.it.oa] = this.dismissType), | ||
(s[InAppMessage.it.pa] = this.duration), | ||
(s[InAppMessage.it.ma] = this.icon), | ||
(s[InAppMessage.it.nt] = this.imageUrl), | ||
(s[InAppMessage.it.na] = this.imageStyle), | ||
(s[InAppMessage.it.ua] = this.iconColor), | ||
(s[InAppMessage.it.ca] = this.iconBackgroundColor), | ||
(s[InAppMessage.it.fa] = this.backgroundColor), | ||
(s[InAppMessage.it.da] = this.textColor), | ||
(s[InAppMessage.it.la] = this.closeButtonColor), | ||
(s[InAppMessage.it.ga] = this.animateIn), | ||
(s[InAppMessage.it.ja] = this.animateOut), | ||
(s[InAppMessage.it.xa] = this.header), | ||
(s[InAppMessage.it.za] = this.headerAlignment), | ||
(s[InAppMessage.it.ha] = this.headerTextColor), | ||
(s[InAppMessage.it.va] = this.frameColor), | ||
(s[InAppMessage.it.wa] = this.buttons), | ||
(s[InAppMessage.it.ya] = this.cropType), | ||
(s[InAppMessage.it.Sa] = this.orientation), | ||
(s[InAppMessage.it.ba] = this.htmlId), | ||
(s[InAppMessage.it.CSS] = this.css), | ||
(s[InAppMessage.it.st] = t), | ||
? ((s[InAppMessage.tt.ea] = this.message), | ||
(s[InAppMessage.tt.ra] = this.messageAlignment), | ||
(s[InAppMessage.tt.Sh] = this.slideFrom), | ||
(s[InAppMessage.tt.bt] = this.extras), | ||
(s[InAppMessage.tt.sa] = this.triggerId), | ||
(s[InAppMessage.tt.ta] = this.clickAction), | ||
(s[InAppMessage.tt.URI] = this.uri), | ||
(s[InAppMessage.tt.ia] = this.openTarget), | ||
(s[InAppMessage.tt.aa] = this.dismissType), | ||
(s[InAppMessage.tt.oa] = this.duration), | ||
(s[InAppMessage.tt.pa] = this.icon), | ||
(s[InAppMessage.tt.ot] = this.imageUrl), | ||
(s[InAppMessage.tt.ma] = this.imageStyle), | ||
(s[InAppMessage.tt.na] = this.iconColor), | ||
(s[InAppMessage.tt.ua] = this.iconBackgroundColor), | ||
(s[InAppMessage.tt.ca] = this.backgroundColor), | ||
(s[InAppMessage.tt.fa] = this.textColor), | ||
(s[InAppMessage.tt.da] = this.closeButtonColor), | ||
(s[InAppMessage.tt.la] = this.animateIn), | ||
(s[InAppMessage.tt.ga] = this.animateOut), | ||
(s[InAppMessage.tt.ja] = this.header), | ||
(s[InAppMessage.tt.xa] = this.headerAlignment), | ||
(s[InAppMessage.tt.za] = this.headerTextColor), | ||
(s[InAppMessage.tt.ha] = this.frameColor), | ||
(s[InAppMessage.tt.va] = this.buttons), | ||
(s[InAppMessage.tt.wa] = this.cropType), | ||
(s[InAppMessage.tt.ya] = this.orientation), | ||
(s[InAppMessage.tt.Sa] = this.htmlId), | ||
(s[InAppMessage.tt.CSS] = this.css), | ||
(s[InAppMessage.tt.Z] = t), | ||
s) | ||
@@ -316,9 +316,9 @@ : s; | ||
}), | ||
(InAppMessage.Ie = { | ||
(InAppMessage.Me = { | ||
Ch: "hd", | ||
Le: "ias", | ||
ke: "ias", | ||
dh: "of", | ||
Uh: "do", | ||
Xr: "umt", | ||
Qr: "tf", | ||
Lr: "umt", | ||
Or: "tf", | ||
bh: "te", | ||
@@ -348,10 +348,10 @@ }), | ||
}), | ||
(InAppMessage.qe = { | ||
pn: "SLIDEUP", | ||
un: "MODAL", | ||
Se: "MODAL_STYLED", | ||
on: "FULL", | ||
ln: "WEB_HTML", | ||
Ee: "HTML", | ||
Ue: "HTML_FULL", | ||
(InAppMessage.Ce = { | ||
rn: "SLIDEUP", | ||
sn: "MODAL", | ||
Je: "MODAL_STYLED", | ||
Xr: "FULL", | ||
Zr: "WEB_HTML", | ||
je: "HTML", | ||
Se: "HTML_FULL", | ||
}), | ||
@@ -363,7 +363,7 @@ (InAppMessage.Oh = 500), | ||
(InAppMessage.lh = "ab-pause-scrolling"), | ||
(InAppMessage.it = { | ||
(InAppMessage.tt = { | ||
ea: "m", | ||
ra: "ma", | ||
Sh: "sf", | ||
jt: "e", | ||
bt: "e", | ||
sa: "ti", | ||
@@ -373,25 +373,25 @@ ta: "ca", | ||
ia: "oa", | ||
oa: "dt", | ||
pa: "d", | ||
ma: "i", | ||
nt: "iu", | ||
na: "is", | ||
ua: "ic", | ||
ca: "ibc", | ||
fa: "bc", | ||
da: "tc", | ||
la: "cbc", | ||
ga: "ai", | ||
ja: "ao", | ||
xa: "h", | ||
za: "ha", | ||
ha: "htc", | ||
va: "fc", | ||
wa: "b", | ||
ya: "ct", | ||
Sa: "o", | ||
ba: "hi", | ||
aa: "dt", | ||
oa: "d", | ||
pa: "i", | ||
ot: "iu", | ||
ma: "is", | ||
na: "ic", | ||
ua: "ibc", | ||
ca: "bc", | ||
fa: "tc", | ||
da: "cbc", | ||
la: "ai", | ||
ga: "ao", | ||
ja: "h", | ||
xa: "ha", | ||
za: "htc", | ||
ha: "fc", | ||
va: "b", | ||
wa: "ct", | ||
ya: "o", | ||
Sa: "hi", | ||
CSS: "css", | ||
st: "type", | ||
vo: "messageFields", | ||
Z: "type", | ||
uo: "messageFields", | ||
}); |
@@ -64,39 +64,39 @@ import { buttonsFromSerializedInAppMessage as pe } from "../in-app-message-factory.js"; | ||
), | ||
(this.Te = InAppMessage.TextAlignment.CENTER); | ||
(this.$e = InAppMessage.TextAlignment.CENTER); | ||
} | ||
tt() { | ||
return super.tt(ModalMessage.et); | ||
Y() { | ||
return super.Y(ModalMessage.it); | ||
} | ||
static an(e) { | ||
static Yr(e) { | ||
return new ModalMessage( | ||
e[InAppMessage.it.ea], | ||
e[InAppMessage.it.ra], | ||
e[InAppMessage.it.jt], | ||
e[InAppMessage.it.sa], | ||
e[InAppMessage.it.ta], | ||
e[InAppMessage.it.URI], | ||
e[InAppMessage.it.ia], | ||
e[InAppMessage.it.oa], | ||
e[InAppMessage.it.pa], | ||
e[InAppMessage.it.ma], | ||
e[InAppMessage.it.nt], | ||
e[InAppMessage.it.na], | ||
e[InAppMessage.it.ua], | ||
e[InAppMessage.it.ca], | ||
e[InAppMessage.it.fa], | ||
e[InAppMessage.it.da], | ||
e[InAppMessage.it.la], | ||
e[InAppMessage.it.ga], | ||
e[InAppMessage.it.ja], | ||
e[InAppMessage.it.xa], | ||
e[InAppMessage.it.za], | ||
e[InAppMessage.it.ha], | ||
e[InAppMessage.it.va], | ||
pe(e[InAppMessage.it.wa]), | ||
e[InAppMessage.it.ya], | ||
e[InAppMessage.it.ba], | ||
e[InAppMessage.it.CSS], | ||
e[InAppMessage.tt.ea], | ||
e[InAppMessage.tt.ra], | ||
e[InAppMessage.tt.bt], | ||
e[InAppMessage.tt.sa], | ||
e[InAppMessage.tt.ta], | ||
e[InAppMessage.tt.URI], | ||
e[InAppMessage.tt.ia], | ||
e[InAppMessage.tt.aa], | ||
e[InAppMessage.tt.oa], | ||
e[InAppMessage.tt.pa], | ||
e[InAppMessage.tt.ot], | ||
e[InAppMessage.tt.ma], | ||
e[InAppMessage.tt.na], | ||
e[InAppMessage.tt.ua], | ||
e[InAppMessage.tt.ca], | ||
e[InAppMessage.tt.fa], | ||
e[InAppMessage.tt.da], | ||
e[InAppMessage.tt.la], | ||
e[InAppMessage.tt.ga], | ||
e[InAppMessage.tt.ja], | ||
e[InAppMessage.tt.xa], | ||
e[InAppMessage.tt.za], | ||
e[InAppMessage.tt.ha], | ||
pe(e[InAppMessage.tt.va]), | ||
e[InAppMessage.tt.wa], | ||
e[InAppMessage.tt.Sa], | ||
e[InAppMessage.tt.CSS], | ||
); | ||
} | ||
} | ||
ModalMessage.et = InAppMessage.qe.un; | ||
ModalMessage.it = InAppMessage.Ce.sn; |
@@ -38,3 +38,3 @@ import InAppMessage from "./in-app-message.js"; | ||
), | ||
(this.Te = InAppMessage.TextAlignment.START); | ||
(this.$e = InAppMessage.TextAlignment.START); | ||
} | ||
@@ -44,3 +44,3 @@ xe() { | ||
} | ||
Ge() { | ||
Ie() { | ||
const e = document.createElement("span"); | ||
@@ -51,3 +51,3 @@ return e.appendChild(document.createTextNode(this.message || "")), e; | ||
const t = e.getElementsByClassName("ab-in-app-message")[0]; | ||
de.no(t, !0, !0) || | ||
de.co(t, !0, !0) || | ||
(this.slideFrom === InAppMessage.SlideFrom.TOP | ||
@@ -58,31 +58,31 @@ ? (t.style.top = "0px") | ||
} | ||
tt() { | ||
return super.tt(SlideUpMessage.et); | ||
Y() { | ||
return super.Y(SlideUpMessage.it); | ||
} | ||
static an(e) { | ||
static Yr(e) { | ||
return new SlideUpMessage( | ||
e[InAppMessage.it.ea], | ||
e[InAppMessage.it.ra], | ||
e[InAppMessage.it.Sh], | ||
e[InAppMessage.it.jt], | ||
e[InAppMessage.it.sa], | ||
e[InAppMessage.it.ta], | ||
e[InAppMessage.it.URI], | ||
e[InAppMessage.it.ia], | ||
e[InAppMessage.it.oa], | ||
e[InAppMessage.it.pa], | ||
e[InAppMessage.it.ma], | ||
e[InAppMessage.it.nt], | ||
e[InAppMessage.it.ua], | ||
e[InAppMessage.it.ca], | ||
e[InAppMessage.it.fa], | ||
e[InAppMessage.it.da], | ||
e[InAppMessage.it.la], | ||
e[InAppMessage.it.ga], | ||
e[InAppMessage.it.ja], | ||
e[InAppMessage.it.ba], | ||
e[InAppMessage.it.CSS], | ||
e[InAppMessage.tt.ea], | ||
e[InAppMessage.tt.ra], | ||
e[InAppMessage.tt.Sh], | ||
e[InAppMessage.tt.bt], | ||
e[InAppMessage.tt.sa], | ||
e[InAppMessage.tt.ta], | ||
e[InAppMessage.tt.URI], | ||
e[InAppMessage.tt.ia], | ||
e[InAppMessage.tt.aa], | ||
e[InAppMessage.tt.oa], | ||
e[InAppMessage.tt.pa], | ||
e[InAppMessage.tt.ot], | ||
e[InAppMessage.tt.na], | ||
e[InAppMessage.tt.ua], | ||
e[InAppMessage.tt.ca], | ||
e[InAppMessage.tt.fa], | ||
e[InAppMessage.tt.da], | ||
e[InAppMessage.tt.la], | ||
e[InAppMessage.tt.ga], | ||
e[InAppMessage.tt.Sa], | ||
e[InAppMessage.tt.CSS], | ||
); | ||
} | ||
} | ||
SlideUpMessage.et = InAppMessage.qe.pn; | ||
SlideUpMessage.it = InAppMessage.Ce.rn; |
export default class wt { | ||
constructor(t, s, i, h, l) { | ||
(this.triggerId = t), | ||
(this.Yr = s), | ||
(this.Ur = i), | ||
(this.Zr = h), | ||
(this.sn = l), | ||
(this.Qr = s), | ||
(this.Hr = i), | ||
(this.Ur = h), | ||
(this.Vr = l), | ||
(this.triggerId = t), | ||
(this.Yr = s), | ||
(this.Ur = i), | ||
(this.Zr = h), | ||
(this.sn = l); | ||
(this.Qr = s), | ||
(this.Hr = i), | ||
(this.Ur = h), | ||
(this.Vr = l); | ||
} | ||
@@ -14,0 +14,0 @@ static fromJson(t, s, i, h, l) { |
import e from "../managers/braze-instance.js"; | ||
import se from "./in-app-message-manager-factory.js"; | ||
export function subscribeToInAppMessage(n) { | ||
if (e.rr()) | ||
if (e.X()) | ||
return "function" != typeof n | ||
? null | ||
: se.m()._i(function (r) { | ||
: se.m().Ke(function (r) { | ||
return n(r[0]), r.slice(1); | ||
}); | ||
} |
@@ -7,10 +7,10 @@ import se from "../in-app-message-manager-factory.js"; | ||
export function automaticallyShowInAppMessages() { | ||
if (!e.rr()) return; | ||
if (!e.X()) return; | ||
ss(); | ||
const s = se.m(); | ||
if (null == s.Pi()) { | ||
if (null == s.Qe()) { | ||
const r = subscribeToInAppMessage((s) => showInAppMessage(s)); | ||
s.Oi(r); | ||
s.Ue(r); | ||
} | ||
return s.Pi(); | ||
return s.Qe(); | ||
} |
@@ -12,3 +12,3 @@ import e, { OPTIONS as L } from "../../managers/braze-instance.js"; | ||
ORIENTATION as fe, | ||
WindowUtils as Y, | ||
WindowUtils as eo, | ||
} from "../../util/window-utils.js"; | ||
@@ -18,58 +18,58 @@ import { isURIJavascriptOrData as N } from "../../util/url-utils.js"; | ||
import { setupInAppMessageUI as ss } from "../../ui/js/index.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../../shared-lib/index.js"; | ||
import { toRgba as ie } from "../../util/color-utils.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../../common/constants.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../../common/constants.js"; | ||
import { isIFrame as It } from "../utils/in-app-message-utils.js"; | ||
export function showInAppMessage(s, t, o) { | ||
if (!e.rr()) return; | ||
if ((ss(), null == s)) return !1; | ||
if (s instanceof ControlMessage) | ||
export function showInAppMessage(t, s, o) { | ||
if (!e.X()) return; | ||
if ((ss(), null == t)) return !1; | ||
if (t instanceof ControlMessage) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"User received control for a multivariate test, logging to Braze servers.", | ||
), | ||
logInAppMessageImpression(s), | ||
logInAppMessageImpression(t), | ||
!0 | ||
); | ||
if (!(s instanceof InAppMessage)) return !1; | ||
if (s.constructor === InAppMessage) return !1; | ||
if (!(t instanceof InAppMessage)) return !1; | ||
if (t.constructor === InAppMessage) return !1; | ||
const i = se.m(); | ||
s.Nh(); | ||
const n = s instanceof HtmlMessage; | ||
if (n && !s.trusted && !e.nr()) | ||
t.Nh(); | ||
const n = t instanceof HtmlMessage; | ||
if (n && !t.trusted && !e.tr()) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
'HTML in-app messages are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these messages.', | ||
), | ||
i.Ji(s.triggerId, InAppMessage.Ie.Ch), | ||
i.Ve(t.triggerId, InAppMessage.Me.Ch), | ||
!1 | ||
); | ||
if ((null == t && (t = document.body), s.xe())) { | ||
if (t.querySelectorAll(".ab-modal-interactions").length > 0) | ||
if ((null == s && (s = document.body), t.xe())) { | ||
if (s.querySelectorAll(".ab-modal-interactions").length > 0) | ||
return ( | ||
r.j.info( | ||
`Cannot show in-app message ${s.message} because another message is being shown.`, | ||
r.info( | ||
`Cannot show in-app message ${t.message} because another message is being shown.`, | ||
), | ||
i.Ji(s.triggerId, InAppMessage.Ie.Le), | ||
i.Ve(t.triggerId, InAppMessage.Me.ke), | ||
!1 | ||
); | ||
} | ||
if (Y.ao()) { | ||
const e = Y.mo(); | ||
if (eo.jo()) { | ||
const e = eo.bo(); | ||
if ( | ||
(e === fe.PORTRAIT && | ||
s.orientation === InAppMessage.Orientation.LANDSCAPE) || | ||
t.orientation === InAppMessage.Orientation.LANDSCAPE) || | ||
(e === fe.LANDSCAPE && | ||
s.orientation === InAppMessage.Orientation.PORTRAIT) | ||
t.orientation === InAppMessage.Orientation.PORTRAIT) | ||
) { | ||
const t = e === fe.PORTRAIT ? "portrait" : "landscape", | ||
const s = e === fe.PORTRAIT ? "portrait" : "landscape", | ||
o = | ||
s.orientation === InAppMessage.Orientation.PORTRAIT | ||
t.orientation === InAppMessage.Orientation.PORTRAIT | ||
? "portrait" | ||
: "landscape"; | ||
return ( | ||
r.j.info( | ||
`Not showing ${o} in-app message ${s.message} because the screen is currently ${t}`, | ||
r.info( | ||
`Not showing ${o} in-app message ${t.message} because the screen is currently ${s}`, | ||
), | ||
i.Ji(s.triggerId, InAppMessage.Ie.dh), | ||
i.Ve(t.triggerId, InAppMessage.Me.dh), | ||
!1 | ||
@@ -79,18 +79,18 @@ ); | ||
} | ||
if (!e.nr()) { | ||
if (!e.tr()) { | ||
let e = !1; | ||
if (s.buttons && s.buttons.length > 0) { | ||
const t = s.buttons; | ||
for (let s = 0; s < t.length; s++) | ||
if (t[s].clickAction === InAppMessage.ClickAction.URI) { | ||
const o = t[s].uri; | ||
if (t.buttons && t.buttons.length > 0) { | ||
const s = t.buttons; | ||
for (let t = 0; t < s.length; t++) | ||
if (s[t].clickAction === InAppMessage.ClickAction.URI) { | ||
const o = s[t].uri; | ||
e = N(o); | ||
} | ||
} else s.clickAction === InAppMessage.ClickAction.URI && (e = N(s.uri)); | ||
} else t.clickAction === InAppMessage.ClickAction.URI && (e = N(t.uri)); | ||
if (e) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
'Javascript click actions are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable these actions.', | ||
), | ||
i.Ji(s.triggerId, InAppMessage.Ie.Ch), | ||
i.Ve(t.triggerId, InAppMessage.Me.Ch), | ||
!1 | ||
@@ -102,30 +102,30 @@ ); | ||
((a.className = "ab-iam-root v3"), | ||
(a.className += me(s)), | ||
(a.className += me(t)), | ||
a.setAttribute("role", "complementary"), | ||
s.Ne() && (a.id = s.htmlId), | ||
e.nn(L.lo) && (a.style.zIndex = (e.nn(L.lo) + 1).toString()), | ||
t.appendChild(a), | ||
s.Ae()) | ||
t.ve() && (a.id = t.htmlId), | ||
e.nn(L.ho) && (a.style.zIndex = (e.nn(L.ho) + 1).toString()), | ||
s.appendChild(a), | ||
t.be()) | ||
) { | ||
const t = document.createElement("style"); | ||
(t.innerHTML = s.css), | ||
(t.id = s.Ce()), | ||
null != e.nn(L.po) && t.setAttribute("nonce", e.nn(L.po)), | ||
document.getElementsByTagName("head")[0].appendChild(t); | ||
const s = document.createElement("style"); | ||
(s.innerHTML = t.css), | ||
(s.id = t.ye()), | ||
null != e.nn(L.wo) && s.setAttribute("nonce", e.nn(L.wo)), | ||
document.getElementsByTagName("head")[0].appendChild(s); | ||
} | ||
const m = s instanceof SlideUpMessage, | ||
const m = t instanceof SlideUpMessage, | ||
l = ce( | ||
s, | ||
t, | ||
() => { | ||
import("../../Feed/ui/show-feed.js").then((s) => { | ||
e.fe() ? s.showFeed() : r.j.error(P); | ||
import("../../Feed/ui/show-feed.js").then((t) => { | ||
e.so() ? t.showFeed() : r.error(_); | ||
}); | ||
}, | ||
(t) => { | ||
if (s.xe() && s.io()) { | ||
(s) => { | ||
if (t.xe() && t.do()) { | ||
const o = document.createElement("div"); | ||
if ( | ||
((o.className = "ab-page-blocker"), | ||
s.Ae() || (o.style.backgroundColor = ie(s.frameColor)), | ||
e.nn(L.lo) && (o.style.zIndex = e.nn(L.lo).toString()), | ||
t.be() || (o.style.backgroundColor = ie(t.frameColor)), | ||
e.nn(L.ho) && (o.style.zIndex = e.nn(L.ho).toString()), | ||
a.appendChild(o), | ||
@@ -137,18 +137,18 @@ !e.nn(L.mh)) | ||
new Date().valueOf() - e > InAppMessage.Ph && | ||
(s.ye(t), o.stopPropagation()); | ||
(t.he(s), o.stopPropagation()); | ||
}; | ||
} | ||
a.appendChild(t), t.focus(), s.Ah(a); | ||
a.appendChild(s), s.focus(), t.Ah(a); | ||
} else if (m) { | ||
const e = document.querySelectorAll(".ab-slideup"); | ||
let o = null; | ||
for (let s = e.length - 1; s >= 0; s--) | ||
if (e[s] !== t) { | ||
o = e[s]; | ||
for (let t = e.length - 1; t >= 0; t--) | ||
if (e[t] !== s) { | ||
o = e[t]; | ||
break; | ||
} | ||
if (s.slideFrom === InAppMessage.SlideFrom.TOP) { | ||
if (t.slideFrom === InAppMessage.SlideFrom.TOP) { | ||
let e = 0; | ||
null != o && (e = o.offsetTop + o.offsetHeight), | ||
(t.style.top = Math.max(e, 0) + "px"); | ||
(s.style.top = Math.max(e, 0) + "px"); | ||
} else { | ||
@@ -160,28 +160,28 @@ let e = 0; | ||
o.offsetTop), | ||
(t.style.bottom = Math.max(e, 0) + "px"); | ||
(s.style.bottom = Math.max(e, 0) + "px"); | ||
} | ||
} else if (n && !e.nn(L.mh)) { | ||
const e = s; | ||
It(t) && | ||
t.contentWindow && | ||
t.contentWindow.addEventListener("keydown", function (s) { | ||
s.keyCode === at._h && e.closeMessage(); | ||
const e = t; | ||
It(s) && | ||
s.contentWindow && | ||
s.contentWindow.addEventListener("keydown", function (t) { | ||
t.keyCode === at._h && e.closeMessage(); | ||
}); | ||
} | ||
logInAppMessageImpression(s), | ||
s.dismissType === InAppMessage.DismissType.AUTO_DISMISS && | ||
logInAppMessageImpression(t), | ||
t.dismissType === InAppMessage.DismissType.AUTO_DISMISS && | ||
setTimeout(() => { | ||
a.contains(t) && s.ye(t); | ||
}, s.duration), | ||
a.contains(s) && t.he(s); | ||
}, t.duration), | ||
"function" == typeof o && o(); | ||
}, | ||
(e, t) => { | ||
r.j.info(e), i.Ji(s.triggerId, t); | ||
(e, s) => { | ||
r.info(e), i.Ve(t.triggerId, s); | ||
}, | ||
e.nn(L.fo), | ||
e.nn(L.lo), | ||
e.nn(L.po), | ||
t, | ||
e.nn(L.yo), | ||
e.nn(L.ho), | ||
e.nn(L.wo), | ||
s, | ||
); | ||
return (n || m) && (a.appendChild(l), s.Ah(a)), !0; | ||
return (n || m) && (a.appendChild(l), t.Ah(a)), !0; | ||
} |
import e, { OPTIONS as L } from "../managers/braze-instance.js"; | ||
import Q from "../util/browser-detector.js"; | ||
import X from "../util/browser-detector.js"; | ||
import nr from "./l10n-manager.js"; | ||
@@ -9,5 +9,5 @@ const je = { | ||
if ((je.o(), !je.i)) { | ||
let r = Q.language, | ||
let r = X.language, | ||
t = !1; | ||
e.nn(L.Ba) && ((r = e.nn(L.Ba)), (t = !0)), (je.i = new nr(r, t)); | ||
e.nn(L.Xn) && ((r = e.nn(L.Xn)), (t = !0)), (je.i = new nr(r, t)); | ||
} | ||
@@ -14,0 +14,0 @@ return je.i; |
@@ -1,3 +0,3 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import zt from "../common/translations.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import jt from "../common/translations.js"; | ||
export default class nr { | ||
@@ -8,3 +8,3 @@ constructor(t, l = !1) { | ||
null != t && (t = t.toLowerCase()), | ||
null != t && null == zt[t]) | ||
null != t && null == jt[t]) | ||
) { | ||
@@ -14,8 +14,8 @@ const l = t.indexOf("-"); | ||
} | ||
if (null == zt[t]) { | ||
const a = | ||
if (null == jt[t]) { | ||
const n = | ||
"Braze does not yet have a localization for language " + | ||
t + | ||
", defaulting to English. Please contact us if you are willing and able to help us translate our SDK into this language."; | ||
l ? r.j.error(a) : r.j.info(a), (t = "en"); | ||
l ? r.error(n) : r.info(n), (t = "en"); | ||
} | ||
@@ -25,4 +25,4 @@ this.language = t; | ||
get(t) { | ||
return zt[this.language][t]; | ||
return jt[this.language][t]; | ||
} | ||
} |
@@ -1,51 +0,51 @@ | ||
import { STORAGE_KEYS as i } from "./storage-manager.js"; | ||
import E from "./subscription-manager.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as o } from "./storage-manager.js"; | ||
import T from "./subscription-manager.js"; | ||
import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js"; | ||
export default class kt { | ||
constructor(t, i, s) { | ||
(this.u = t), | ||
(this.gh = i), | ||
(this.ph = s), | ||
(this.Zn = i), | ||
(this.gh = s), | ||
(this.u = t), | ||
(this.gh = i || !1), | ||
(this.ph = s), | ||
(this.Fh = new E()), | ||
(this.kh = 0), | ||
(this.fh = 1); | ||
(this.Zn = i || !1), | ||
(this.gh = s), | ||
(this.ph = new T()), | ||
(this.Fh = 0), | ||
(this.kh = 1); | ||
} | ||
fh() { | ||
return this.Zn; | ||
} | ||
wh() { | ||
return this.gh; | ||
return this.u.j(o.C.jh); | ||
} | ||
jh() { | ||
return this.u.v(i.k.xh); | ||
} | ||
setSdkAuthenticationSignature(t) { | ||
const s = this.jh(); | ||
this.u.D(i.k.xh, t); | ||
const e = r.ts.Zt; | ||
new r.es(e, r.j).setItem(e.rs.qh, this.fh, t), s !== t && this.ti(); | ||
const i = this.wh(); | ||
this.u.k(o.C.jh, t); | ||
const s = A.Yt.Qt; | ||
new A(s, r).setItem(s.ss.xh, this.kh, t), i !== t && this.Xs(); | ||
} | ||
yh() { | ||
this.u.ni(i.k.xh); | ||
const t = r.ts.Zt; | ||
new r.es(t, r.j).oe(t.rs.qh, this.fh); | ||
qh() { | ||
this.u.hi(o.C.jh); | ||
const t = A.Yt.Qt; | ||
new A(t, r).re(t.ss.xh, this.kh); | ||
} | ||
subscribeToSdkAuthenticationFailures(t) { | ||
return this.ph.It(t); | ||
return this.gh.It(t); | ||
} | ||
Bh(t) { | ||
this.ph.Dt(t); | ||
yh(t) { | ||
this.gh.Dt(t); | ||
} | ||
Bh() { | ||
this.ph.removeAllSubscriptions(); | ||
} | ||
Gh() { | ||
this.Fh.removeAllSubscriptions(); | ||
this.Fh += 1; | ||
} | ||
Hh() { | ||
this.kh += 1; | ||
return this.Fh; | ||
} | ||
Jh() { | ||
return this.kh; | ||
Xs() { | ||
this.Fh = 0; | ||
} | ||
ti() { | ||
this.kh = 0; | ||
} | ||
} |
import kt from "./auth-manager.js"; | ||
import y from "../common/base-provider.js"; | ||
import Q from "../util/browser-detector.js"; | ||
import X from "../util/browser-detector.js"; | ||
import Ot from "./device-manager.js"; | ||
import DeviceProperties from "../Core/device-properties.js"; | ||
import { | ||
isArray as p, | ||
keys as oo, | ||
validateValueIsFromEnum as G, | ||
isArray as j, | ||
keys as to, | ||
validateValueIsFromEnum as J, | ||
values as Pt, | ||
@@ -14,8 +14,7 @@ } from "../util/code-utils.js"; | ||
import Lt from "../request-controller.js"; | ||
import jt from "./server-config-manager.js"; | ||
import Dt from "./session-manager.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import J, { STORAGE_KEYS as i } from "./storage-manager.js"; | ||
import Mt from "./storage-manager-factory.js"; | ||
import E from "./subscription-manager.js"; | ||
import Dt from "./server-config-manager.js"; | ||
import Mt from "./session-manager.js"; | ||
import Q, { STORAGE_KEYS as o } from "./storage-manager.js"; | ||
import Bt from "./storage-manager-factory.js"; | ||
import T from "./subscription-manager.js"; | ||
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js"; | ||
@@ -25,72 +24,71 @@ import bt from "../User/user-manager.js"; | ||
import { parseQueryStringKeyValues as ut } from "../util/url-utils.js"; | ||
import { WindowUtils as Y } from "../util/window-utils.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js"; | ||
import { WindowUtils as eo } from "../util/window-utils.js"; | ||
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js"; | ||
import { SupportedOptions as Wt, logger as r } from "../../shared-lib/index.js"; | ||
const L = { | ||
ho: "allowCrawlerActivity", | ||
_o: "baseUrl", | ||
Eo: "noCookies", | ||
Io: "devicePropertyAllowlist", | ||
Aa: "disablePushTokenMaintenance", | ||
Ao: "enableLogging", | ||
So: "enableSdkAuthentication", | ||
qa: "manageServiceWorkerExternally", | ||
No: "minimumIntervalBetweenTriggerActionsInSeconds", | ||
Oo: "sessionTimeoutInSeconds", | ||
wo: "appVersion", | ||
Po: "appVersionNumber", | ||
_a: "serviceWorkerLocation", | ||
ka: "safariWebsitePushId", | ||
Ba: "localization", | ||
po: "contentSecurityNonce", | ||
Ro: "allowUserSuppliedJavascript", | ||
lo: "inAppMessageZIndex", | ||
fo: "openInAppMessagesInNewTab", | ||
_o: "allowCrawlerActivity", | ||
Io: "baseUrl", | ||
Ao: "noCookies", | ||
So: "devicePropertyAllowlist", | ||
qa: "disablePushTokenMaintenance", | ||
No: "enableLogging", | ||
Oo: "enableSdkAuthentication", | ||
ka: "manageServiceWorkerExternally", | ||
Po: "minimumIntervalBetweenTriggerActionsInSeconds", | ||
Ro: "sessionTimeoutInSeconds", | ||
Lo: "appVersion", | ||
Do: "appVersionNumber", | ||
Ma: "serviceWorkerLocation", | ||
_a: "safariWebsitePushId", | ||
Xn: "localization", | ||
wo: "contentSecurityNonce", | ||
Mo: "allowUserSuppliedJavascript", | ||
ho: "inAppMessageZIndex", | ||
yo: "openInAppMessagesInNewTab", | ||
tn: "openCardsInNewTab", | ||
en: "openNewsFeedCardsInNewTab", | ||
mh: "requireExplicitInAppMessageDismissal", | ||
Co: "doNotLoadFontAwesome", | ||
Lo: "sdkFlavor", | ||
Uo: "doNotLoadFontAwesome", | ||
Bo: "sdkFlavor", | ||
}; | ||
class Bt { | ||
class zt { | ||
constructor() { | ||
(this.cn = ""), | ||
(this.jo = ""), | ||
(this.Do = void 0), | ||
(this.Mo = null), | ||
(this.fn = null), | ||
(this.$t = null), | ||
(this.ki = null), | ||
(this.an = ""), | ||
(this.Wo = ""), | ||
(this.Vo = void 0), | ||
(this.Go = null), | ||
(this.hn = null), | ||
(this.qt = null), | ||
(this.Ei = null), | ||
(this.yt = null), | ||
(this._e = null), | ||
(this.di = null), | ||
(this.u = null), | ||
(this.wt = null), | ||
(this.Uo = ""), | ||
(this.Bo = !1), | ||
(this.Wo = !1), | ||
(this.zo = new E()), | ||
(this.Vo = new E()), | ||
(this.Ko = ""), | ||
(this.$o = !1), | ||
(this.qo = !1), | ||
(this.Jo = new T()), | ||
(this.Yo = new T()), | ||
(this.options = {}), | ||
(this.Go = []), | ||
(this.Ko = []), | ||
(this.Ve = []), | ||
(this.jo = "5.0.1"); | ||
(this.Ho = []), | ||
(this.Xo = []), | ||
(this._e = []), | ||
(this.Wo = "5.1.0"); | ||
} | ||
$o(t) { | ||
this.zo.It(t); | ||
Zo(t) { | ||
this.Jo.It(t); | ||
} | ||
Rh(t) { | ||
this.Vo.It(t); | ||
this.Yo.It(t); | ||
} | ||
initialize(t, s) { | ||
if (this.fe()) | ||
return ( | ||
r.j.info("Braze has already been initialized with an API key."), !0 | ||
); | ||
this.options = s || {}; | ||
let e = this.nn(L.Ao); | ||
const n = ut(Y.Cn()); | ||
initialize(t, i) { | ||
if (this.so()) | ||
return r.info("Braze has already been initialized with an API key."), !0; | ||
this.options = i || {}; | ||
let s = this.nn(L.No); | ||
const e = ut(eo.Tn()); | ||
if ( | ||
(n && "true" === n.brazeLogging && (e = !0), | ||
r.j.init(e), | ||
r.j.info( | ||
(e && "true" === e.brazeLogging && (s = !0), | ||
r.init(s), | ||
r.info( | ||
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`, | ||
@@ -100,46 +98,46 @@ ), | ||
) | ||
return r.j.error("Braze requires a valid API key to be initialized."), !1; | ||
this.cn = t; | ||
let o = this.nn(L._o); | ||
if (null == o || "" === o || "string" != typeof o) | ||
return r.j.error("Braze requires a valid baseUrl to be initialized."), !1; | ||
!1 === /^https?:/.test(o) && (o = `https://${o}`); | ||
const h = o; | ||
return r.error("Braze requires a valid API key to be initialized."), !1; | ||
this.an = t; | ||
let n = this.nn(L.Io); | ||
if (null == n || "" === n || "string" != typeof n) | ||
return r.error("Braze requires a valid baseUrl to be initialized."), !1; | ||
!1 === /^https?:/.test(n) && (n = `https://${n}`); | ||
const h = n; | ||
if ( | ||
((o = document.createElement("a")), | ||
(o.href = h), | ||
"/" === o.pathname && (o = `${o}api/v3`), | ||
(this.Uo = o.toString()), | ||
Q.qo && !this.nn(L.ho)) | ||
((n = document.createElement("a")), | ||
(n.href = h), | ||
"/" === n.pathname && (n = `${n}api/v3`), | ||
(this.Ko = n.toString()), | ||
X.Qo && !this.nn(L._o)) | ||
) | ||
return ( | ||
r.j.info("Ignoring activity from crawler bot " + navigator.userAgent), | ||
(this.Wo = !0), | ||
r.info("Ignoring activity from crawler bot " + navigator.userAgent), | ||
(this.qo = !0), | ||
!1 | ||
); | ||
const a = this.nn(L.Eo) || !1; | ||
const a = this.nn(L.Ao) || !1; | ||
if ( | ||
((this.u = Mt.xo(t, a)), a && this.u.Jo(t), new J.ee(null, !0).jr(i.re)) | ||
((this.u = Bt.Wh(t, a)), a && this.u.Vh(t), new Q.ee(null, !0).br(o.se)) | ||
) | ||
return ( | ||
r.j.info("Ignoring all activity due to previous opt out"), | ||
(this.Wo = !0), | ||
r.info("Ignoring all activity due to previous opt out"), | ||
(this.qo = !0), | ||
!1 | ||
); | ||
for (const t of oo(this.options)) | ||
-1 === Pt(r.Yo).indexOf(t) && | ||
r.j.warn(`Ignoring unknown initialization option '${t}'.`); | ||
for (const t of to(this.options)) | ||
-1 === Pt(Wt).indexOf(t) && | ||
r.warn(`Ignoring unknown initialization option '${t}'.`); | ||
const l = ["mparticle", "wordpress", "tealium"]; | ||
if (null != this.nn(L.Lo)) { | ||
const t = this.nn(L.Lo); | ||
if (null != this.nn(L.Bo)) { | ||
const t = this.nn(L.Bo); | ||
-1 !== l.indexOf(t) | ||
? (this.Do = t) | ||
: r.j.error("Invalid sdk flavor passed: " + t); | ||
? (this.Vo = t) | ||
: r.error("Invalid sdk flavor passed: " + t); | ||
} | ||
let u = this.nn(r.Yo.Io); | ||
let u = this.nn(Wt.So); | ||
if (null != u) | ||
if (p(u)) { | ||
if (j(u)) { | ||
const t = []; | ||
for (let i = 0; i < u.length; i++) | ||
G( | ||
J( | ||
DeviceProperties, | ||
@@ -152,33 +150,33 @@ u[i], | ||
} else | ||
r.j.error( | ||
r.error( | ||
"devicePropertyAllowlist must be an array. Defaulting to all properties.", | ||
), | ||
(u = null); | ||
(this.fn = new Ot(this.u, u)), | ||
(this.yt = new jt(this.u)), | ||
(this.hn = new Ot(this.u, u)), | ||
(this.yt = new Dt(this.u)), | ||
(this.wt = new bt(this.yt, this.u)), | ||
(this._e = new Dt(this.u, this.wt, this.yt, this.nn(L.Oo))); | ||
const f = new E(); | ||
(this.di = new Mt(this.u, this.wt, this.yt, this.nn(L.Ro))); | ||
const f = new T(); | ||
return ( | ||
(this.Mo = new kt(this.u, this.nn(L.So), f)), | ||
this.Ht(f), | ||
(this.$t = new Rt( | ||
this.fn, | ||
(this.Go = new kt(this.u, this.nn(L.Oo), f)), | ||
this.$t(f), | ||
(this.qt = new Rt( | ||
this.hn, | ||
this.u, | ||
this.Mo, | ||
this.Go, | ||
this.wt, | ||
this._e, | ||
this.di, | ||
this.yt, | ||
this.cn, | ||
this.Uo, | ||
this.jo, | ||
this.Do || "", | ||
this.nn(L.wo), | ||
this.nn(L.Po), | ||
this.an, | ||
this.Ko, | ||
this.Wo, | ||
this.Vo || "", | ||
this.nn(L.Lo), | ||
this.nn(L.Do), | ||
)), | ||
(this.ki = new Lt( | ||
this.cn, | ||
this.Uo, | ||
this._e, | ||
this.fn, | ||
(this.Ei = new Lt( | ||
this.an, | ||
this.Ko, | ||
this.di, | ||
this.hn, | ||
this.wt, | ||
@@ -188,35 +186,35 @@ this.yt, | ||
(t) => { | ||
if (this.fe()) for (const i of this.gr()) i.Ss(t); | ||
if (this.so()) for (const i of this.gr()) i.Rs(t); | ||
}, | ||
this.Mo, | ||
this.$t, | ||
this.Go, | ||
this.qt, | ||
)), | ||
this.ki.initialize(), | ||
a || this.u.Ho(), | ||
r.j.info( | ||
this.Ei.initialize(), | ||
a || this.u.Kh(), | ||
r.info( | ||
`Initialized for the Braze backend at "${this.nn( | ||
L._o, | ||
)}" with API key "${this.cn}".`, | ||
L.Io, | ||
)}" with API key "${this.an}".`, | ||
), | ||
et.o(), | ||
this.yt.Ci(() => { | ||
this.Bo && | ||
this.yt && | ||
this.yt.yi() && | ||
this.yt.xi(() => { | ||
var t; | ||
this.$o && | ||
(null === (t = this.yt) || void 0 === t ? void 0 : t.yi()) && | ||
import("../FeatureFlags/refresh-feature-flags.js").then((t) => { | ||
if (!this.Bo) return; | ||
if (!this.$o) return; | ||
(0, t.default)(); | ||
}); | ||
}), | ||
this.ki.pr(() => { | ||
this.Bo && | ||
this.yt && | ||
this.yt.yi() && | ||
this.Ei.mr(() => { | ||
var t; | ||
this.$o && | ||
(null === (t = this.yt) || void 0 === t ? void 0 : t.yi()) && | ||
import("../FeatureFlags/refresh-feature-flags.js").then((t) => { | ||
if (!this.Bo) return; | ||
if (!this.$o) return; | ||
(0, t.default)(void 0, void 0, !0); | ||
}); | ||
}), | ||
this.zo.Dt(this.options), | ||
(this.Bo = !0), | ||
this.Jo.Dt(this.options), | ||
(this.$o = !0), | ||
!0 | ||
@@ -226,42 +224,42 @@ ); | ||
destroy(t) { | ||
if ((r.j.destroy(), this.fe())) { | ||
this.Vo.Dt(), this.Vo.removeAllSubscriptions(); | ||
for (const t of this.Go) t.destroy(); | ||
this.Go = []; | ||
for (const t of this.Ko) t.clearData(!1); | ||
(this.Ko = []), | ||
if ((r.destroy(), this.so())) { | ||
this.Yo.Dt(), this.Yo.removeAllSubscriptions(); | ||
for (const t of this.Ho) t.destroy(); | ||
this.Ho = []; | ||
for (const t of this.Xo) t.clearData(!1); | ||
(this.Xo = []), | ||
this.removeAllSubscriptions(), | ||
(this.Ve = []), | ||
null != this.ki && this.ki.destroy(), | ||
(this.ki = null), | ||
(this.Mo = null), | ||
(this.fn = null), | ||
(this.$t = null), | ||
(this._e = []), | ||
null != this.Ei && this.Ei.destroy(), | ||
(this.Ei = null), | ||
(this.Go = null), | ||
(this.hn = null), | ||
(this.qt = null), | ||
(this.yt = null), | ||
(this._e = null), | ||
(this.di = null), | ||
(this.wt = null), | ||
(this.options = {}), | ||
(this.Do = void 0), | ||
(this.Bo = !1), | ||
(this.Wo = !1), | ||
(this.Vo = void 0), | ||
(this.$o = !1), | ||
(this.qo = !1), | ||
t && (this.u = null); | ||
} | ||
} | ||
rr() { | ||
return !this.Xo() && (!!this.fe() || (console.warn(P), !1)); | ||
X() { | ||
return !this.$h() && (!!this.so() || (console.warn(_), !1)); | ||
} | ||
Ma() { | ||
return this.cn; | ||
ba() { | ||
return this.an; | ||
} | ||
Sr() { | ||
return this.Mo; | ||
return this.Go; | ||
} | ||
Ys() { | ||
return this.Uo; | ||
Vs() { | ||
return this.Ko; | ||
} | ||
te() { | ||
return this.fn; | ||
return this.hn; | ||
} | ||
ar() { | ||
return this.$t; | ||
nr() { | ||
return this.qt; | ||
} | ||
@@ -272,12 +270,12 @@ nn(t) { | ||
gr() { | ||
return this.Ko; | ||
return this.Xo; | ||
} | ||
cr() { | ||
return this.ki; | ||
return this.Ei; | ||
} | ||
tr() { | ||
ir() { | ||
return this.yt; | ||
} | ||
aa() { | ||
return this._e; | ||
zr() { | ||
return this.di; | ||
} | ||
@@ -287,44 +285,44 @@ l() { | ||
} | ||
br() { | ||
if (this.wt && this.ki) return new User(this.wt, this.ki); | ||
pr() { | ||
if (this.wt && this.Ei) return new User(this.wt, this.Ei); | ||
} | ||
ir() { | ||
er() { | ||
return this.wt; | ||
} | ||
nr() { | ||
return !0 === this.nn(L.Ro); | ||
tr() { | ||
return !0 === this.nn(L.Mo); | ||
} | ||
g(t) { | ||
let i = !1; | ||
for (const s of this.Go) s === t && (i = !0); | ||
i || this.Go.push(t); | ||
for (const s of this.Ho) s === t && (i = !0); | ||
i || this.Ho.push(t); | ||
} | ||
dr(t) { | ||
ar(t) { | ||
let i = !1; | ||
for (const s of this.Ko) s.constructor === t.constructor && (i = !0); | ||
t instanceof y && !i && this.Ko.push(t); | ||
for (const s of this.Xo) s.constructor === t.constructor && (i = !0); | ||
t instanceof y && !i && this.Xo.push(t); | ||
} | ||
Ht(t) { | ||
t instanceof E && this.Ve.push(t); | ||
$t(t) { | ||
t instanceof T && this._e.push(t); | ||
} | ||
removeAllSubscriptions() { | ||
if (this.rr()) for (const t of this.Ve) t.removeAllSubscriptions(); | ||
if (this.X()) for (const t of this._e) t.removeAllSubscriptions(); | ||
} | ||
removeSubscription(t) { | ||
if (this.rr()) for (const i of this.Ve) i.removeSubscription(t); | ||
if (this.X()) for (const i of this._e) i.removeSubscription(t); | ||
} | ||
ne(t) { | ||
this.Wo = t; | ||
oe(t) { | ||
this.qo = t; | ||
} | ||
fe() { | ||
return this.Bo; | ||
so() { | ||
return this.$o; | ||
} | ||
Xo() { | ||
$h() { | ||
return this.qo; | ||
} | ||
Ss() { | ||
return this.Wo; | ||
} | ||
As() { | ||
return this.jo; | ||
} | ||
} | ||
const e = new Bt(); | ||
export { e as default, Bt as BrazeSdkInstance, L as OPTIONS }; | ||
const e = new zt(); | ||
export { e as default, zt as BrazeSdkInstance, L as OPTIONS }; |
@@ -1,53 +0,53 @@ | ||
import Q from "../util/browser-detector.js"; | ||
import X from "../util/browser-detector.js"; | ||
import xt from "../models/device.js"; | ||
import DeviceProperties from "../Core/device-properties.js"; | ||
import _t from "../models/identifier.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { logger as r, Guid as p } from "../../shared-lib/index.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import { values as Pt } from "../util/code-utils.js"; | ||
import { getErrorMessage as ei } from "../util/error-utils.js"; | ||
import { getErrorMessage as si } from "../util/error-utils.js"; | ||
export default class Ot { | ||
constructor(t, e) { | ||
(this.u = t), | ||
(this.Qo = e), | ||
(this.Ia = e), | ||
(this.u = t), | ||
null == e && (e = Pt(DeviceProperties)), | ||
(this.Qo = e); | ||
(this.Ia = e); | ||
} | ||
ce(t = !0) { | ||
let e = this.u.tu(i.eu.Zo); | ||
null == e && ((e = new _t(r.Z.Y())), t && this.u.uu(i.eu.Zo, e)); | ||
const s = new xt(e.iu); | ||
for (let t = 0; t < this.Qo.length; t++) { | ||
switch (this.Qo[t]) { | ||
let e = this.u.tu(o.iu.Ta); | ||
null == e && ((e = new _t(p.W())), t && this.u.uu(o.iu.Ta, e)); | ||
const r = new xt(e.eu); | ||
for (let t = 0; t < this.Ia.length; t++) { | ||
switch (this.Ia[t]) { | ||
case DeviceProperties.BROWSER: | ||
s.browser = Q.browser; | ||
r.browser = X.browser; | ||
break; | ||
case DeviceProperties.BROWSER_VERSION: | ||
s.Ia = Q.version; | ||
r.Da = X.version; | ||
break; | ||
case DeviceProperties.OS: | ||
s.os = this.Ta(); | ||
r.os = this.Oa(); | ||
break; | ||
case DeviceProperties.RESOLUTION: | ||
s.Da = screen.width + "x" + screen.height; | ||
r.Ca = screen.width + "x" + screen.height; | ||
break; | ||
case DeviceProperties.LANGUAGE: | ||
s.language = Q.language; | ||
r.language = X.language; | ||
break; | ||
case DeviceProperties.TIME_ZONE: | ||
s.timeZone = this.Oa(new Date()); | ||
r.timeZone = this.Fa(new Date()); | ||
break; | ||
case DeviceProperties.USER_AGENT: | ||
s.userAgent = Q.userAgent; | ||
r.userAgent = X.userAgent; | ||
} | ||
} | ||
return s; | ||
return r; | ||
} | ||
Ta() { | ||
if (Q.Ca()) return Q.Ca(); | ||
const t = this.u.v(i.k.Fa); | ||
return t && t.os_version ? t.os_version : Q.Ta(); | ||
Oa() { | ||
if (X.Ga()) return X.Ga(); | ||
const t = this.u.j(o.C.Ja); | ||
return t && t.os_version ? t.os_version : X.Oa(); | ||
} | ||
Oa(t) { | ||
Fa(t) { | ||
let e = !1; | ||
@@ -61,5 +61,5 @@ if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat) | ||
} catch (t) { | ||
r.j.info( | ||
r.info( | ||
"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" + | ||
ei(t), | ||
si(t), | ||
), | ||
@@ -70,5 +70,5 @@ (e = !0); | ||
const s = t.getTimezoneOffset(); | ||
return this.Ga(s); | ||
return this.Aa(s); | ||
} | ||
Ga(t) { | ||
Aa(t) { | ||
const e = Math.trunc(t / 60), | ||
@@ -75,0 +75,0 @@ r = Math.trunc(t % 60); |
@@ -8,53 +8,54 @@ import qt from "../models/backend-errors.js"; | ||
import s from "../common/event-logger.js"; | ||
import { isArray as p, isEqual as ii } from "../util/code-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as i } from "./storage-manager.js"; | ||
import T from "../util/request-header-utils.js"; | ||
import { LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT as Ht } from "../common/constants.js"; | ||
import { isArray as j, isEqual as ii } from "../util/code-utils.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import { STORAGE_KEYS as o } from "./storage-manager.js"; | ||
import S from "../util/request-header-utils.js"; | ||
import { LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT as Kt } from "../common/constants.js"; | ||
export default class Rt { | ||
constructor(t, e, s, i, r, o, n, h, a, u, c, l) { | ||
(this.fn = t), | ||
constructor(t, e, s, i, r, n, o, a, h, u, l, c) { | ||
(this.hn = t), | ||
(this.u = e), | ||
(this.Mo = s), | ||
(this.Go = s), | ||
(this.wt = i), | ||
(this._e = r), | ||
(this.yt = o), | ||
(this.cn = n), | ||
(this.Uo = h), | ||
(this.jo = a), | ||
(this.Do = u), | ||
(this.appVersion = c), | ||
(this.Xh = l), | ||
(this.fn = t), | ||
(this.di = r), | ||
(this.yt = n), | ||
(this.an = o), | ||
(this.Ko = a), | ||
(this.Wo = h), | ||
(this.Vo = u), | ||
(this.appVersion = l), | ||
(this.Ra = c), | ||
(this.Ba = (t) => (null == t ? "" : `${t} `)), | ||
(this.hn = t), | ||
(this.u = e), | ||
(this.Mo = s), | ||
(this.Go = s), | ||
(this.wt = i), | ||
(this._e = r), | ||
(this.yt = o), | ||
(this.cn = n), | ||
(this.Uo = h), | ||
(this.jo = a), | ||
(this.Do = u), | ||
(this.appVersion = c), | ||
(this.Xh = l), | ||
(this.$h = ["npm"]); | ||
(this.di = r), | ||
(this.yt = n), | ||
(this.an = o), | ||
(this.Ko = a), | ||
(this.Wo = h), | ||
(this.Vo = u), | ||
(this.appVersion = l), | ||
(this.Ra = c), | ||
(this.Xa = ["npm"]); | ||
} | ||
Bs(t, e = !1, s = !1) { | ||
const r = this.fn.ce(!s), | ||
o = r.Kr(), | ||
n = this.u.v(i.k.Fa); | ||
ii(n, o) || (t.device = o), | ||
(t.api_key = this.cn), | ||
Ps(t, e = !1, s = !1) { | ||
const i = this.hn.ce(!s), | ||
r = i.Gr(), | ||
n = this.u.j(o.C.Ja); | ||
ii(n, r) || (t.device = r), | ||
(t.api_key = this.an), | ||
(t.time = h(new Date().valueOf(), !0)); | ||
const a = this.u.v(i.k.Kh) || [], | ||
u = this.u.v(i.k.Wh) || ""; | ||
const a = this.u.j(o.C.Na) || [], | ||
u = this.u.j(o.C.$a) || ""; | ||
if ( | ||
(this.$h.length > 0 && | ||
(!ii(a, this.$h) || u !== this._e.Yh()) && | ||
(t.sdk_metadata = this.$h), | ||
(t.sdk_version = this.jo), | ||
this.Do && (t.sdk_flavor = this.Do), | ||
(this.Xa.length > 0 && | ||
(!ii(a, this.Xa) || u !== this.di.ki()) && | ||
(t.sdk_metadata = this.Xa), | ||
(t.sdk_version = this.Wo), | ||
this.Vo && (t.sdk_flavor = this.Vo), | ||
(t.app_version = this.appVersion), | ||
(t.app_version_code = this.Xh), | ||
(t.device_id = r.id), | ||
(t.app_version_code = this.Ra), | ||
(t.device_id = i.id), | ||
e) | ||
@@ -67,89 +68,89 @@ ) { | ||
} | ||
Zs(t, e, i) { | ||
Ws(t, e, n) { | ||
const o = e.auth_error, | ||
n = e.error; | ||
if (!o && !n) return !0; | ||
a = e.error; | ||
if (!o && !a) return !0; | ||
if (o) { | ||
let e; | ||
this.Mo.Hh(); | ||
this.Go.Gh(); | ||
const s = { errorCode: o.error_code }; | ||
for (const t of i) | ||
p(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]); | ||
for (const t of n) | ||
j(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]); | ||
t.respond_with && t.respond_with.user_id | ||
? (s.userId = t.respond_with.user_id) | ||
: t.user_id && (s.userId = t.user_id); | ||
const n = o.reason; | ||
const i = o.reason; | ||
return ( | ||
n | ||
? ((s.reason = n), (e = `due to ${n}`)) | ||
i | ||
? ((s.reason = i), (e = `due to ${i}`)) | ||
: (e = `with error code ${o.error_code}.`), | ||
this.Mo.wh() || | ||
this.Go.fh() || | ||
(e += | ||
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'), | ||
r.j.error(`SDK Authentication failed ${e}`), | ||
this.Qh(t.events || [], t.attributes || []), | ||
this.Mo.Bh(s), | ||
r.error(`SDK Authentication failed ${e}`), | ||
this.Ea(t.events || [], t.attributes || []), | ||
this.Go.yh(s), | ||
!1 | ||
); | ||
} | ||
if (n) { | ||
let i, | ||
o = n; | ||
if (a) { | ||
let n, | ||
o = a; | ||
switch (o) { | ||
case qt.Vh: | ||
case qt.Ka: | ||
return ( | ||
(i = "Received successful response with empty body."), | ||
s.N(r.q.qs, { e: i }), | ||
r.j.info(i), | ||
(n = "Received successful response with empty body."), | ||
s.q(i.Ms, { e: n }), | ||
r.info(n), | ||
!1 | ||
); | ||
case qt.Zh: | ||
case qt.La: | ||
return ( | ||
(i = "Received successful response with invalid JSON"), | ||
s.N(r.q.qs, { e: i + ": " + e.response }), | ||
r.j.info(i), | ||
(n = "Received successful response with invalid JSON"), | ||
s.q(i.Ms, { e: n + ": " + e.response }), | ||
r.info(n), | ||
!1 | ||
); | ||
case qt.Ra: | ||
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Uo}`; | ||
case qt.Pa: | ||
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Ko}`; | ||
break; | ||
case qt.Xa: | ||
case qt.Ua: | ||
o = | ||
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us."; | ||
break; | ||
case qt.Ea: | ||
case qt.Ha: | ||
o = "No device identifier. Please contact support@braze.com"; | ||
} | ||
r.j.error("Backend error: " + o); | ||
r.error("Backend error: " + o); | ||
} | ||
return !1; | ||
} | ||
Pa(t, e, s, i) { | ||
Wa(t, e, s, i) { | ||
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i); | ||
} | ||
$a(t, e, s, i, r = !1) { | ||
const o = [], | ||
n = (t) => t || "", | ||
h = n(this.wt.getUserId()); | ||
let a = this.Jr(t, e); | ||
Ya(t, e, s, i, r = !1) { | ||
const n = [], | ||
o = (t) => t || "", | ||
a = o(this.wt.getUserId()); | ||
let h = this._r(t, e); | ||
const u = [], | ||
c = []; | ||
let l, | ||
f = null; | ||
l = []; | ||
let c, | ||
d = null; | ||
if (s.length > 0) { | ||
const t = []; | ||
for (const e of s) { | ||
if (((l = e.Kr()), this.Mo.wh())) { | ||
if (h && !l.user_id) { | ||
f || (f = {}), f.events || (f.events = []), f.events.push(l); | ||
if (((c = e.Gr()), this.Go.fh())) { | ||
if (a && !c.user_id) { | ||
d || (d = {}), d.events || (d.events = []), d.events.push(c); | ||
continue; | ||
} | ||
if (n(l.user_id) !== h) { | ||
c.push(l); | ||
if (o(c.user_id) !== a) { | ||
l.push(c); | ||
continue; | ||
} | ||
} | ||
t.push(l); | ||
t.push(c); | ||
} | ||
t.length > 0 && (a.events = t); | ||
t.length > 0 && (h.events = t); | ||
} | ||
@@ -159,15 +160,15 @@ if (i.length > 0) { | ||
for (const e of i) | ||
e && (this.Mo.wh() && n(e.user_id) !== h ? u.push(e) : t.push(e)); | ||
t.length > 0 && (a.attributes = t); | ||
e && (this.Go.fh() && o(e.user_id) !== a ? u.push(e) : t.push(e)); | ||
t.length > 0 && (h.attributes = t); | ||
} | ||
if ((this.Qh(c, u), (a = this.Bs(a, !0, r)), f)) { | ||
f = this.Bs(f, !1, r); | ||
const t = { requestData: f, headers: this.Hs(f, T.Os.Na) }; | ||
o.push(t); | ||
if ((this.Ea(l, u), (h = this.Ps(h, !0, r)), d)) { | ||
d = this.Ps(d, !1, r); | ||
const t = { requestData: d, headers: this._s(d, S.Gs.Qa) }; | ||
n.push(t); | ||
} | ||
if (a && !this.Pa(a.events, a.attributes, t, e)) return f ? o : null; | ||
const d = { requestData: a, headers: this.Hs(a, T.Os.Na) }; | ||
return o.push(d), o; | ||
if (h && !this.Wa(h.events, h.attributes, t, e)) return d ? n : null; | ||
const f = { requestData: h, headers: this._s(h, S.Gs.Qa) }; | ||
return n.push(f), n; | ||
} | ||
Qh(t, e) { | ||
Ea(t, e) { | ||
if (t) { | ||
@@ -179,14 +180,14 @@ const e = []; | ||
} | ||
this.u.bo(e); | ||
this.u.zo(e); | ||
} | ||
if (e) for (const t of e) this.u.Ha(t); | ||
if (e) for (const t of e) this.u.Va(t); | ||
} | ||
ii(t, e) { | ||
Zs(t, e) { | ||
let s = "HTTP error "; | ||
null != t && (s += t + " "), (s += e), r.j.error(s); | ||
null != t && (s += t + " "), (s += e), r.error(s); | ||
} | ||
qr(t) { | ||
return s.N(r.q.Ka, { n: t }); | ||
return s.q(i.Za, { n: t }); | ||
} | ||
Jr(t, e, s) { | ||
_r(t, e, s) { | ||
const i = {}; | ||
@@ -197,10 +198,10 @@ t && (i.feed = !0), e && (i.triggers = !0); | ||
r && (i.user_id = r), | ||
(i.config = { config_time: this.yt.li() }), | ||
(i.config = { config_time: this.yt.ni() }), | ||
{ respond_with: i } | ||
); | ||
} | ||
Ua(t) { | ||
Xh(t) { | ||
const e = new Date().valueOf(); | ||
let s = Ht.toString(); | ||
const i = T.La(this.u, t); | ||
let s = Kt.toString(); | ||
const i = S.Yh(this.u, t); | ||
if (-1 !== i) { | ||
@@ -211,39 +212,58 @@ s = (e - i).toString(); | ||
} | ||
Hs(t, e, s = !1) { | ||
const r = [["X-Braze-Api-Key", this.cn]], | ||
o = this.Ua(e); | ||
r.push(["X-Braze-Last-Req-Ms-Ago", o]); | ||
const n = T.Wa(this.u, e).toString(); | ||
r.push(["X-Braze-Req-Attempt", n]); | ||
let h = !1; | ||
_s(t, e, s = !1) { | ||
const i = [["X-Braze-Api-Key", this.an]], | ||
r = this.Xh(e); | ||
i.push(["X-Braze-Last-Req-Ms-Ago", r]); | ||
const n = S.Jh(this.u, e).toString(); | ||
i.push(["X-Braze-Req-Attempt", n]); | ||
let a = !1; | ||
if ( | ||
(null != t.respond_with && | ||
t.respond_with.triggers && | ||
(r.push(["X-Braze-TriggersRequest", "true"]), (h = !0)), | ||
(i.push(["X-Braze-TriggersRequest", "true"]), (a = !0)), | ||
null != t.respond_with && | ||
t.respond_with.feed && | ||
(r.push(["X-Braze-FeedRequest", "true"]), (h = !0)), | ||
e === T.Os.Ks) | ||
(i.push(["X-Braze-FeedRequest", "true"]), (a = !0)), | ||
e === S.Gs.Bs) | ||
) { | ||
r.push(["X-Braze-ContentCardsRequest", "true"]); | ||
let t = this.u.v(i.k.zs); | ||
(t && s) || ((t = 0), this.u.D(i.k.zs, t)), | ||
r.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]), | ||
(h = !0); | ||
i.push(["X-Braze-ContentCardsRequest", "true"]); | ||
let t = this.u.j(o.C.As); | ||
(t && s) || ((t = 0), this.u.k(o.C.As, t)), | ||
i.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]), | ||
(a = !0); | ||
} | ||
if ( | ||
(e === T.Os.Si && | ||
(r.push(["X-Braze-FeatureFlagsRequest", "true"]), (h = !0)), | ||
h && r.push(["X-Braze-DataRequest", "true"]), | ||
this.Mo.wh()) | ||
(e === S.Gs.qi && | ||
(i.push(["X-Braze-FeatureFlagsRequest", "true"]), (a = !0)), | ||
a && i.push(["X-Braze-DataRequest", "true"]), | ||
this.Go.fh()) | ||
) { | ||
const t = this.Mo.jh(); | ||
null != t && r.push(["X-Braze-Auth-Signature", t]); | ||
const t = this.Go.wh(); | ||
null != t && i.push(["X-Braze-Auth-Signature", t]); | ||
} | ||
return r; | ||
return i; | ||
} | ||
Qs(t, e) { | ||
const s = t.device; | ||
s && s.os_version instanceof Promise | ||
? s.os_version.then((s) => { | ||
Qh(t, e, s, i) { | ||
window.setTimeout(() => { | ||
r.info(`Retrying rate limited ${this.Ba(i)}SDK request.`), | ||
this.Hs(e, s, i); | ||
}, t); | ||
} | ||
Hs(t, e, s) { | ||
const i = this.Zh(); | ||
if (!i.au) | ||
return ( | ||
r.info( | ||
`${this.Ba( | ||
s, | ||
)}SDK request being rate limited. Request will be retried in ${Math.trunc( | ||
i.du / 1e3, | ||
)} seconds.`, | ||
), | ||
void this.Qh(i.du, t, e, s) | ||
); | ||
this.u.k(o.C.fu, new Date().valueOf()); | ||
const n = t.device; | ||
n && n.os_version instanceof Promise | ||
? n.os_version.then((s) => { | ||
(t.device.os_version = s), e(); | ||
@@ -253,11 +273,42 @@ }) | ||
} | ||
ti() { | ||
this.Mo.ti(); | ||
li(t) { | ||
var e; | ||
null === (e = this.u) || void 0 === e || e.k(o.C.Ru, t); | ||
} | ||
Ys() { | ||
return this.Uo; | ||
ui() { | ||
var t; | ||
return null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ru); | ||
} | ||
vu(t, e, s, i) { | ||
let r = this.ui(); | ||
(null == r || isNaN(r)) && (r = e); | ||
const n = (t - i) / 1e3; | ||
return (r = Math.min(r + n / s, e)), r; | ||
} | ||
gu(t, e) { | ||
return Math.max(0, (1 - t) * e * 1e3); | ||
} | ||
Zh() { | ||
var t, e, s; | ||
const i = { au: !0, du: 0 }, | ||
r = null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.fu); | ||
if (null == r || isNaN(r)) return i; | ||
const n = (null === (e = this.yt) || void 0 === e ? void 0 : e.pu()) || -1, | ||
a = (null === (s = this.yt) || void 0 === s ? void 0 : s.qu()) || -1; | ||
if (-1 === n || -1 === a) return i; | ||
const h = new Date().valueOf(); | ||
let u = this.vu(h, n, a, r); | ||
return u < 1 | ||
? ((i.au = !1), (i.du = this.gu(u, a)), i) | ||
: ((u = Math.trunc(u) - 1), this.li(u), i); | ||
} | ||
Xs() { | ||
this.Go.Xs(); | ||
} | ||
Vs() { | ||
return this.Ko; | ||
} | ||
addSdkMetadata(t) { | ||
for (const e of t) -1 === this.$h.indexOf(e) && this.$h.push(e); | ||
for (const e of t) -1 === this.Xa.indexOf(e) && this.Xa.push(e); | ||
} | ||
} |
@@ -1,18 +0,18 @@ | ||
import { STORAGE_KEYS as i } from "./storage-manager.js"; | ||
import E from "./subscription-manager.js"; | ||
import Kt from "../models/server-config.js"; | ||
import { STORAGE_KEYS as o } from "./storage-manager.js"; | ||
import T from "./subscription-manager.js"; | ||
import Gt from "../models/server-config.js"; | ||
import s from "../common/event-logger.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { EventTypes as i } from "../../shared-lib/index.js"; | ||
import { | ||
CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT as Vt, | ||
CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Gt, | ||
CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Ht, | ||
} from "../common/constants.js"; | ||
export default class jt { | ||
export default class Dt { | ||
constructor(t) { | ||
(this.u = t), | ||
(this.u = t), | ||
(this.tl = new E()), | ||
(this.el = new E()), | ||
(this.sl = new E()), | ||
(this.il = null), | ||
(this.tl = new T()), | ||
(this.el = new T()), | ||
(this.il = new T()), | ||
(this.sl = null), | ||
(this.rl = null); | ||
@@ -22,8 +22,8 @@ } | ||
if (null == this.rl) { | ||
const t = this.u.v(i.k.hl); | ||
this.rl = null != t ? Kt.Yn(t) : new Kt(); | ||
const t = this.u.j(o.C.hl); | ||
this.rl = null != t ? Gt.En(t) : new Gt(); | ||
} | ||
return this.rl; | ||
} | ||
li() { | ||
ni() { | ||
return this.ll().ol; | ||
@@ -35,76 +35,92 @@ } | ||
if (e.time > this.ll().ol) { | ||
const t = new Kt( | ||
e.time, | ||
e.events_blacklist, | ||
e.attributes_blacklist, | ||
e.purchases_blacklist, | ||
e.messaging_session_timeout, | ||
e.vapid_public_key, | ||
e.content_cards, | ||
e.feature_flags, | ||
); | ||
const t = (t) => (null == t ? this.ll().al : t), | ||
i = new Gt( | ||
e.time, | ||
e.events_blacklist, | ||
e.attributes_blacklist, | ||
e.purchases_blacklist, | ||
e.messaging_session_timeout, | ||
e.vapid_public_key, | ||
e.content_cards, | ||
e.feature_flags, | ||
t(e.global_request_rate_limit), | ||
); | ||
let s = !1; | ||
null != t.al && this.En() !== t.al && (s = !0); | ||
null != i.cl && this.In() !== i.cl && (s = !0); | ||
let r = !1; | ||
null != t.ml.enabled && this.oi() !== t.ml.enabled && (r = !0); | ||
null != i.ml.enabled && this.ri() !== i.ml.enabled && (r = !0); | ||
let n = !1; | ||
null != t.gi.enabled && this.yi() !== t.gi.enabled && (n = !0), | ||
(this.rl = t), | ||
this.u.D(i.k.hl, t.tt()), | ||
null != i.mi.enabled && this.yi() !== i.mi.enabled && (n = !0), | ||
(this.rl = i), | ||
this.u.k(o.C.hl, i.Y()), | ||
s && this.tl.Dt(), | ||
r && this.el.Dt(), | ||
n && this.sl.Dt(); | ||
n && this.il.Dt(); | ||
} | ||
} | ||
} | ||
Rn(t) { | ||
Vn(t) { | ||
const e = this.tl.It(t); | ||
return this.il && this.tl.removeSubscription(this.il), (this.il = e), e; | ||
return this.sl && this.tl.removeSubscription(this.sl), (this.sl = e), e; | ||
} | ||
Ps(t) { | ||
qs(t) { | ||
return this.el.It(t); | ||
} | ||
Ci(t) { | ||
return this.sl.It(t); | ||
xi(t) { | ||
return this.il.It(t); | ||
} | ||
ge(t) { | ||
return -1 !== this.ll().cl.indexOf(t); | ||
me(t) { | ||
return -1 !== this.ll().gl.indexOf(t); | ||
} | ||
hu(t) { | ||
return -1 !== this.ll().gl.indexOf(t); | ||
return -1 !== this.ll().fl.indexOf(t); | ||
} | ||
Dr(t) { | ||
return -1 !== this.ll().fl.indexOf(t); | ||
return -1 !== this.ll().bl.indexOf(t); | ||
} | ||
dl() { | ||
return this.ll().bl; | ||
return this.ll().Cl; | ||
} | ||
En() { | ||
return this.ll().al; | ||
In() { | ||
return this.ll().cl; | ||
} | ||
oi() { | ||
ri() { | ||
return this.ll().ml.enabled || !1; | ||
} | ||
$s() { | ||
Is() { | ||
const t = this.ll().ml.rate_limit; | ||
return !(!t || null == t.enabled) && t.enabled; | ||
} | ||
di() { | ||
if (!this.$s()) return -1; | ||
ci() { | ||
if (!this.Is()) return -1; | ||
const t = this.ll().ml.rate_limit; | ||
return null == t.capacity ? Vt : t.capacity <= 0 ? -1 : t.capacity; | ||
} | ||
mi() { | ||
if (!this.$s()) return -1; | ||
fi() { | ||
if (!this.Is()) return -1; | ||
const t = this.ll().ml.rate_limit; | ||
return null == t.refill_rate ? Gt : t.refill_rate <= 0 ? -1 : t.refill_rate; | ||
return null == t.refill_rate ? Ht : t.refill_rate <= 0 ? -1 : t.refill_rate; | ||
} | ||
Rl() { | ||
const t = this.ll().al; | ||
return !(!t || null == t.enabled) && t.enabled; | ||
} | ||
pu() { | ||
if (!this.Rl()) return -1; | ||
const t = this.ll().al; | ||
return null == t.capacity || t.capacity < 10 ? -1 : t.capacity; | ||
} | ||
qu() { | ||
if (!this.Rl()) return -1; | ||
const t = this.ll().al; | ||
return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate; | ||
} | ||
yi() { | ||
return this.ll().gi.enabled && null == this.Mi() | ||
? (s.N(r.q.qs, { e: "Missing feature flag refresh_rate_limit." }), !1) | ||
: this.ll().gi.enabled || !1; | ||
return this.ll().mi.enabled && null == this.zi() | ||
? (s.q(i.Ms, { e: "Missing feature flag refresh_rate_limit." }), !1) | ||
: this.ll().mi.enabled || !1; | ||
} | ||
Mi() { | ||
return this.ll().gi.refresh_rate_limit; | ||
zi() { | ||
return this.ll().mi.refresh_rate_limit; | ||
} | ||
} |
@@ -1,7 +0,11 @@ | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import ue from "../models/braze-event.js"; | ||
import _t from "../models/identifier.js"; | ||
import { convertMsToSeconds as h } from "../util/date-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
export default class Dt { | ||
import { | ||
logger as r, | ||
Guid as p, | ||
EventTypes as i, | ||
} from "../../shared-lib/index.js"; | ||
export default class Mt { | ||
constructor(s, t, i, e) { | ||
@@ -18,3 +22,3 @@ (this.u = s), | ||
e < this.Sl / 1e3 && | ||
(r.j.info( | ||
(r.info( | ||
"Specified session timeout of " + | ||
@@ -30,7 +34,7 @@ e + | ||
jl(s, t) { | ||
return new ue(this.wt.getUserId(), r.q.xl, s, t.iu, { d: h(s - t.vl) }); | ||
return new ue(this.wt.getUserId(), i.xl, s, t.eu, { d: h(s - t.vl) }); | ||
} | ||
Yh() { | ||
const s = this.u.tu(i.eu.Dl); | ||
return null == s ? null : s.iu; | ||
ki() { | ||
const s = this.u.tu(o.iu.Dl); | ||
return null == s ? null : s.eu; | ||
} | ||
@@ -40,39 +44,39 @@ El() { | ||
t = this.yt.dl(), | ||
e = this.u.v(i.k.zl); | ||
if (null != e && null == t) return !1; | ||
let n = !1; | ||
i = this.u.j(o.C.Gl); | ||
if (null != i && null == t) return !1; | ||
let e = !1; | ||
return ( | ||
null == e ? (n = !0) : null != t && (n = s - e > 1e3 * t), | ||
n && this.u.D(i.k.zl, s), | ||
n | ||
null == i ? (e = !0) : null != t && (e = s - i > 1e3 * t), | ||
e && this.u.k(o.C.Gl, s), | ||
e | ||
); | ||
} | ||
Cl(s, t) { | ||
return null == t || null == t.Gl || (!(s - t.vl < this.Sl) && t.Gl < s); | ||
Nl(s, t) { | ||
return null == t || null == t.zl || (!(s - t.vl < this.Sl) && t.zl < s); | ||
} | ||
co() { | ||
xo() { | ||
const s = new Date().valueOf(), | ||
t = s + 1e3 * this.wl, | ||
e = this.u.tu(i.eu.Dl); | ||
if (this.Cl(s, e)) { | ||
e = this.u.tu(o.iu.Dl); | ||
if (this.Nl(s, e)) { | ||
let n = "Generating session start event with time " + s; | ||
if (null != e) { | ||
let s = e.Nl; | ||
let s = e.Hl; | ||
s - e.vl < this.Sl && (s = e.vl + this.Sl), | ||
this.u.Hl(this.jl(s, e)), | ||
this.u.Wl(this.jl(s, e)), | ||
(n += " (old session ended " + s + ")"); | ||
} | ||
(n += ". Will expire " + t.valueOf()), r.j.info(n); | ||
const l = new _t(r.Z.Y(), t); | ||
this.u.Hl(new ue(this.wt.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; | ||
(n += ". Will expire " + t.valueOf()), r.info(n); | ||
const l = new _t(p.W(), t); | ||
this.u.Wl(new ue(this.wt.getUserId(), i.kl, s, l.eu)), | ||
this.u.uu(o.iu.Dl, l); | ||
return null == this.u.j(o.C.Gl) && this.u.k(o.C.Gl, s), l.eu; | ||
} | ||
if (null != e) return (e.Nl = s), (e.Gl = t), this.u.uu(i.eu.Dl, e), e.iu; | ||
if (null != e) return (e.Hl = s), (e.zl = t), this.u.uu(o.iu.Dl, e), e.eu; | ||
} | ||
kl() { | ||
const s = this.u.tu(i.eu.Dl); | ||
ql() { | ||
const s = this.u.tu(o.iu.Dl); | ||
null != s && | ||
(this.u.ql(i.eu.Dl), this.u.Hl(this.jl(new Date().valueOf(), s))); | ||
(this.u.yl(o.iu.Dl), this.u.Wl(this.jl(new Date().valueOf(), s))); | ||
} | ||
} |
@@ -1,12 +0,12 @@ | ||
import J, { STORAGE_KEYS as i } from "./storage-manager.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
const Mt = { | ||
xo: function (e, o = !1) { | ||
let t = !1; | ||
import Q, { STORAGE_KEYS as o } from "./storage-manager.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
const Bt = { | ||
Wh: function (e, t = !1) { | ||
let a = !1; | ||
try { | ||
if (localStorage && localStorage.getItem) | ||
try { | ||
localStorage.setItem(i.k.Qa, "true"), | ||
localStorage.getItem(i.k.Qa) && | ||
(localStorage.removeItem(i.k.Qa), (t = !0)); | ||
localStorage.setItem(o.C.ec, "true"), | ||
localStorage.getItem(o.C.ec) && | ||
(localStorage.removeItem(o.C.ec), (a = !0)); | ||
} catch (e) { | ||
@@ -22,13 +22,13 @@ if ( | ||
throw e; | ||
t = !0; | ||
a = !0; | ||
} | ||
} catch (e) { | ||
r.j.info("Local Storage not supported!"); | ||
r.info("Local Storage not supported!"); | ||
} | ||
const a = Mt.Ja(), | ||
n = new J.Va(e, a && !o, t); | ||
let c; | ||
return (c = t ? new J.Ya(e) : new J.Za()), new J(n, c); | ||
const n = Bt.oc(), | ||
c = new Q.tc(e, n && !t, a); | ||
let l; | ||
return (l = a ? new Q.rc(e) : new Q.ac()), new Q(c, l); | ||
}, | ||
Ja: function () { | ||
oc: function () { | ||
return ( | ||
@@ -43,2 +43,2 @@ navigator.cookieEnabled || | ||
}; | ||
export default Mt; | ||
export default Bt; |
import ue from "../models/braze-event.js"; | ||
import _t from "../models/identifier.js"; | ||
import { | ||
isArray as p, | ||
keys as oo, | ||
validateValueIsFromEnum as G, | ||
isArray as j, | ||
keys as to, | ||
validateValueIsFromEnum as J, | ||
values as Pt, | ||
} from "../util/code-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import { User } from "../User/index.js"; | ||
import Q from "../util/browser-detector.js"; | ||
import { getErrorMessage as ei } from "../util/error-utils.js"; | ||
import X from "../util/browser-detector.js"; | ||
import { getErrorMessage as si } from "../util/error-utils.js"; | ||
export const STORAGE_KEYS = { | ||
eu: { | ||
iu: { | ||
su: "ab.storage.userId", | ||
Zo: "ab.storage.deviceId", | ||
Ta: "ab.storage.deviceId", | ||
Dl: "ab.storage.sessionId", | ||
}, | ||
k: { | ||
Qa: "ab.test", | ||
C: { | ||
ec: "ab.test", | ||
tE: "ab.storage.events", | ||
eE: "ab.storage.attributes", | ||
sE: "ab.storage.attributes.anonymous_user", | ||
Fa: "ab.storage.device", | ||
Kh: "ab.storage.sdk_metadata", | ||
Wh: "ab.storage.session_id_for_cached_metadata", | ||
Bn: "ab.storage.pushToken", | ||
Bi: "ab.storage.newsFeed", | ||
Ei: "ab.storage.lastNewsFeedRefresh", | ||
L: "ab.storage.cardImpressions", | ||
Ja: "ab.storage.device", | ||
Na: "ab.storage.sdk_metadata", | ||
$a: "ab.storage.session_id_for_cached_metadata", | ||
zn: "ab.storage.pushToken", | ||
Hi: "ab.storage.newsFeed", | ||
Ji: "ab.storage.lastNewsFeedRefresh", | ||
J: "ab.storage.cardImpressions", | ||
hl: "ab.storage.serverConfig", | ||
rE: "ab.storage.triggers", | ||
oE: "ab.storage.triggers.ts", | ||
zl: "ab.storage.messagingSessionStart", | ||
gs: "ab.storage.cc", | ||
js: "ab.storage.ccLastFullSync", | ||
Rs: "ab.storage.ccLastCardUpdated", | ||
Vs: "ab.storage.ccLastClientRequest", | ||
ci: "ab.storage.ccRateLimitCurrentTokenCount", | ||
C: "ab.storage.ccClicks", | ||
K: "ab.storage.ccImpressions", | ||
G: "ab.storage.ccDismissals", | ||
Gl: "ab.storage.messagingSessionStart", | ||
Cs: "ab.storage.cc", | ||
gs: "ab.storage.ccLastFullSync", | ||
ys: "ab.storage.ccLastCardUpdated", | ||
Ks: "ab.storage.ccLastClientRequest", | ||
ai: "ab.storage.ccRateLimitCurrentTokenCount", | ||
Ru: "ab.storage.globalRateLimitCurrentTokenCount", | ||
v: "ab.storage.ccClicks", | ||
H: "ab.storage.ccImpressions", | ||
A: "ab.storage.ccDismissals", | ||
nE: "ab.storage.lastDisplayedTriggerTimesById", | ||
iE: "ab.storage.lastDisplayedTriggerTime", | ||
aE: "ab.storage.triggerFireInstancesById", | ||
xh: "ab.storage.signature", | ||
zs: "ab.storage.brazeSyncRetryCount", | ||
Us: "ab.storage.sdkVersion", | ||
Ri: "ab.storage.ff", | ||
qi: "ab.storage.ffImpressions", | ||
Ui: "ab.storage.ffLastRefreshAt", | ||
aE: "ab.storage.lastDisplayedTriggerTime", | ||
iE: "ab.storage.triggerFireInstancesById", | ||
jh: "ab.storage.signature", | ||
As: "ab.storage.brazeSyncRetryCount", | ||
Ds: "ab.storage.sdkVersion", | ||
Ti: "ab.storage.ff", | ||
Ii: "ab.storage.ffImpressions", | ||
Bi: "ab.storage.ffLastRefreshAt", | ||
Ui: "ab.storage.ff.sessionId", | ||
EE: "ab.storage.lastReqToEndpoint", | ||
lE: "ab.storage.requestAttempts", | ||
rn: "ab.storage.deferredIam", | ||
Wr: "ab.storage.deferredIam", | ||
fu: "ab.storage.lastSdkReq", | ||
}, | ||
re: "ab.optOut", | ||
se: "ab.optOut", | ||
}; | ||
export default class J { | ||
export default class Q { | ||
constructor(t, e) { | ||
(this.SE = t), (this._E = e), (this.SE = t), (this._E = e); | ||
} | ||
Jo(t) { | ||
const e = oo(STORAGE_KEYS.eu), | ||
s = new J.ee(t); | ||
for (const t of e) s.remove(STORAGE_KEYS.eu[t]); | ||
Vh(t) { | ||
const e = to(STORAGE_KEYS.iu), | ||
s = new Q.ee(t); | ||
for (const t of e) s.remove(STORAGE_KEYS.iu[t]); | ||
} | ||
uu(t, e) { | ||
let s = null; | ||
null != e && e instanceof _t && (s = e.tt()), this.SE.store(t, s); | ||
null != e && e instanceof _t && (s = e.Y()), this.SE.store(t, s); | ||
} | ||
uE(t) { | ||
const e = this.tu(t); | ||
null != e && ((e.Nl = new Date().valueOf()), this.uu(t, e)); | ||
null != e && ((e.Hl = new Date().valueOf()), this.uu(t, e)); | ||
} | ||
tu(t) { | ||
return _t.Yn(this.SE.jr(t)); | ||
const e = this.SE.br(t), | ||
s = ((t) => { | ||
let e; | ||
try { | ||
e = JSON.parse(t); | ||
} catch (t) { | ||
e = null; | ||
} | ||
return e; | ||
})(e); | ||
let r; | ||
return ( | ||
s ? ((r = _t.En(s) || null), r && this.uu(t, r)) : (r = _t.En(e) || null), | ||
r | ||
); | ||
} | ||
ql(t) { | ||
yl(t) { | ||
this.SE.remove(t); | ||
} | ||
Ho() { | ||
const t = oo(STORAGE_KEYS.eu); | ||
Kh() { | ||
const t = to(STORAGE_KEYS.iu); | ||
let e; | ||
for (const s of t) | ||
(e = this.tu(STORAGE_KEYS.eu[s])), | ||
null != e && this.uu(STORAGE_KEYS.eu[s], e); | ||
(e = this.tu(STORAGE_KEYS.iu[s])), | ||
null != e && this.uu(STORAGE_KEYS.iu[s], e); | ||
} | ||
bo(t) { | ||
zo(t) { | ||
let e; | ||
if (null == t || 0 === t.length) return !1; | ||
e = p(t) ? t : [t]; | ||
let s = this._E.jr(STORAGE_KEYS.k.tE); | ||
(null != s && p(s)) || (s = []); | ||
for (let t = 0; t < e.length; t++) s.push(e[t].tt()); | ||
return this._E.store(STORAGE_KEYS.k.tE, s); | ||
e = j(t) ? t : [t]; | ||
let s = this._E.br(STORAGE_KEYS.C.tE); | ||
(null != s && j(s)) || (s = []); | ||
for (let t = 0; t < e.length; t++) s.push(e[t].Y()); | ||
return this._E.store(STORAGE_KEYS.C.tE, s); | ||
} | ||
Hl(t) { | ||
return null != t && this.bo([t]); | ||
Wl(t) { | ||
return null != t && this.zo([t]); | ||
} | ||
cE() { | ||
let t = this._E.jr(STORAGE_KEYS.k.tE); | ||
this._E.remove(STORAGE_KEYS.k.tE), null == t && (t = []); | ||
TE() { | ||
let t = this._E.br(STORAGE_KEYS.C.tE); | ||
this._E.remove(STORAGE_KEYS.C.tE), null == t && (t = []); | ||
const e = []; | ||
let s = !1, | ||
o = null; | ||
if (p(t)) | ||
r = null; | ||
if (j(t)) | ||
for (let s = 0; s < t.length; s++) | ||
ue.TE(t[s]) ? e.push(ue.Yn(t[s])) : (o = s); | ||
ue.cE(t[s]) ? e.push(ue.En(t[s])) : (r = s); | ||
else s = !0; | ||
if (s || null != o) { | ||
let n = "Stored events could not be deserialized as Events"; | ||
if (s || null != r) { | ||
let o = "Stored events could not be deserialized as Events"; | ||
s && | ||
(n += ", was " + Object.prototype.toString.call(t) + " not an array"), | ||
null != o && | ||
(n += ", value at index " + o + " does not look like an event"), | ||
(n += | ||
(o += ", was " + Object.prototype.toString.call(t) + " not an array"), | ||
null != r && | ||
(o += ", value at index " + r + " does not look like an event"), | ||
(o += | ||
", serialized values were of type " + | ||
@@ -121,10 +138,10 @@ typeof t + | ||
JSON.stringify(t)), | ||
e.push(new ue(null, r.q.qs, new Date().valueOf(), null, { e: n })); | ||
e.push(new ue(null, i.Ms, new Date().valueOf(), null, { e: o })); | ||
} | ||
return e; | ||
} | ||
D(t, e) { | ||
k(t, e) { | ||
return ( | ||
!!G( | ||
STORAGE_KEYS.k, | ||
!!J( | ||
STORAGE_KEYS.C, | ||
t, | ||
@@ -136,16 +153,16 @@ "StorageManager cannot store object.", | ||
} | ||
v(t) { | ||
j(t) { | ||
return ( | ||
!!G( | ||
STORAGE_KEYS.k, | ||
!!J( | ||
STORAGE_KEYS.C, | ||
t, | ||
"StorageManager cannot retrieve object.", | ||
"STORAGE_KEYS.OBJECTS", | ||
) && this._E.jr(t) | ||
) && this._E.br(t) | ||
); | ||
} | ||
ni(t) { | ||
hi(t) { | ||
return ( | ||
!!G( | ||
STORAGE_KEYS.k, | ||
!!J( | ||
STORAGE_KEYS.C, | ||
t, | ||
@@ -158,28 +175,28 @@ "StorageManager cannot remove object.", | ||
clearData() { | ||
const t = oo(STORAGE_KEYS.eu), | ||
e = oo(STORAGE_KEYS.k); | ||
const t = to(STORAGE_KEYS.iu), | ||
e = to(STORAGE_KEYS.C); | ||
for (let e = 0; e < t.length; e++) { | ||
const s = t[e]; | ||
this.SE.remove(STORAGE_KEYS.eu[s]); | ||
this.SE.remove(STORAGE_KEYS.iu[s]); | ||
} | ||
for (let t = 0; t < e.length; t++) { | ||
const s = e[t]; | ||
this._E.remove(STORAGE_KEYS.k[s]); | ||
this._E.remove(STORAGE_KEYS.C[s]); | ||
} | ||
} | ||
hE(t) { | ||
return t || STORAGE_KEYS.k.sE; | ||
return t || STORAGE_KEYS.C.sE; | ||
} | ||
Ha(t) { | ||
let e = this._E.jr(STORAGE_KEYS.k.eE); | ||
Va(t) { | ||
let e = this._E.br(STORAGE_KEYS.C.eE); | ||
null == e && (e = {}); | ||
const s = this.hE(t[User.bu]), | ||
const s = this.hE(t[User.Qn]), | ||
r = e[s]; | ||
for (const o in t) | ||
o !== User.bu && | ||
o !== User.Qn && | ||
(null == e[s] || (r && null == r[o])) && | ||
this.mu(t[User.bu], o, t[o]); | ||
this.mu(t[User.Qn], o, t[o]); | ||
} | ||
mu(t, e, s) { | ||
let r = this._E.jr(STORAGE_KEYS.k.eE); | ||
let r = this._E.br(STORAGE_KEYS.C.eE); | ||
null == r && (r = {}); | ||
@@ -189,3 +206,3 @@ const o = this.hE(t); | ||
if ( | ||
(null == n && ((n = {}), null != t && (n[User.bu] = t)), e === User.lu) | ||
(null == n && ((n = {}), null != t && (n[User.Qn] = t)), e === User.lu) | ||
) { | ||
@@ -195,7 +212,7 @@ null == n[e] && (n[e] = {}); | ||
} else n[e] = s; | ||
return (r[o] = n), this._E.store(STORAGE_KEYS.k.eE, r); | ||
return (r[o] = n), this._E.store(STORAGE_KEYS.C.eE, r); | ||
} | ||
AE() { | ||
const t = this._E.jr(STORAGE_KEYS.k.eE); | ||
this._E.remove(STORAGE_KEYS.k.eE); | ||
const t = this._E.br(STORAGE_KEYS.C.eE); | ||
this._E.remove(STORAGE_KEYS.C.eE); | ||
const e = []; | ||
@@ -205,4 +222,4 @@ for (const s in t) null != t[s] && e.push(t[s]); | ||
} | ||
ou(t) { | ||
const e = this._E.jr(STORAGE_KEYS.k.eE); | ||
ru(t) { | ||
const e = this._E.br(STORAGE_KEYS.C.eE); | ||
if (null != e) { | ||
@@ -213,26 +230,26 @@ const s = this.hE(null), | ||
((e[s] = void 0), | ||
this._E.store(STORAGE_KEYS.k.eE, e), | ||
(r[User.bu] = t), | ||
this.Ha(r)); | ||
this._E.store(STORAGE_KEYS.C.eE, e), | ||
(r[User.Qn] = t), | ||
this.Va(r)); | ||
} | ||
const s = this.tu(STORAGE_KEYS.eu.Dl); | ||
const s = this.tu(STORAGE_KEYS.iu.Dl); | ||
let r = null; | ||
null != s && (r = s.iu); | ||
const o = this.cE(); | ||
null != s && (r = s.eu); | ||
const o = this.TE(); | ||
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.Hl(s); | ||
null == s.userId && s.sessionId == r && (s.userId = t), this.Wl(s); | ||
} | ||
} | ||
RE() { | ||
return this._E.OE; | ||
return this._E.gE; | ||
} | ||
} | ||
(J.Ya = class { | ||
(Q.rc = class { | ||
constructor(t) { | ||
(this.cn = t), (this.cn = t), (this.OE = Q.gE() ? 3 : 10); | ||
(this.an = t), (this.an = t), (this.gE = X.OE() ? 3 : 10); | ||
} | ||
dE(t) { | ||
return t + "." + this.cn; | ||
return t + "." + this.an; | ||
} | ||
@@ -244,6 +261,6 @@ store(t, e) { | ||
} catch (t) { | ||
return r.j.info("Storage failure: " + ei(t)), !1; | ||
return r.info("Storage failure: " + si(t)), !1; | ||
} | ||
} | ||
jr(t) { | ||
br(t) { | ||
try { | ||
@@ -254,3 +271,3 @@ let e = null; | ||
} catch (t) { | ||
return r.j.info("Storage retrieval failure: " + ei(t)), null; | ||
return r.info("Storage retrieval failure: " + si(t)), null; | ||
} | ||
@@ -262,19 +279,19 @@ } | ||
} catch (t) { | ||
return r.j.info("Storage removal failure: " + ei(t)), !1; | ||
return r.info("Storage removal failure: " + si(t)), !1; | ||
} | ||
} | ||
}), | ||
(J.Za = class { | ||
(Q.ac = class { | ||
constructor() { | ||
(this.fE = {}), (this.bE = 5242880), (this.OE = 3); | ||
(this.fE = {}), (this.IE = 5242880), (this.gE = 3); | ||
} | ||
store(t, e) { | ||
const s = { value: e }, | ||
o = this.IE(e); | ||
return o > this.bE | ||
? (r.j.info( | ||
o = this.bE(e); | ||
return o > this.IE | ||
? (r.info( | ||
"Storage failure: object is ≈" + | ||
o + | ||
" bytes which is greater than the max of " + | ||
this.bE, | ||
this.IE, | ||
), | ||
@@ -284,3 +301,3 @@ !1) | ||
} | ||
IE(t) { | ||
bE(t) { | ||
const e = [], | ||
@@ -302,3 +319,3 @@ s = [t]; | ||
} | ||
jr(t) { | ||
br(t) { | ||
const e = this.fE[t]; | ||
@@ -311,13 +328,13 @@ return null == e ? null : e.value; | ||
}), | ||
(J.ee = class { | ||
(Q.ee = class { | ||
constructor(t, e) { | ||
(this.cn = t), | ||
(this.mE = e), | ||
(this.cn = t), | ||
(this.KE = this.YE()), | ||
(this.an = t), | ||
(this.KE = e), | ||
(this.an = t), | ||
(this.mE = this.YE()), | ||
(this.NE = 576e3), | ||
(this.mE = !!e); | ||
(this.KE = !!e); | ||
} | ||
dE(t) { | ||
return null != this.cn ? t + "." + this.cn : t; | ||
return null != this.an ? t + "." + this.an : t; | ||
} | ||
@@ -339,8 +356,8 @@ YE() { | ||
} | ||
ae() { | ||
ne() { | ||
const t = new Date(); | ||
return t.setTime(t.getTime() + 60 * this.NE * 1e3), t.getFullYear(); | ||
} | ||
DE() { | ||
const t = Pt(STORAGE_KEYS.eu), | ||
CE() { | ||
const t = Pt(STORAGE_KEYS.iu), | ||
e = document.cookie.split(";"); | ||
@@ -358,3 +375,3 @@ for (let s = 0; s < e.length; s++) { | ||
const t = r.split("=")[0]; | ||
-1 === t.indexOf("." + this.cn) && this.GE(t); | ||
-1 === t.indexOf("." + this.an) && this.GE(t); | ||
} | ||
@@ -364,20 +381,20 @@ } | ||
store(t, e) { | ||
this.DE(); | ||
this.CE(); | ||
const s = new Date(); | ||
s.setTime(s.getTime() + 60 * this.NE * 1e3); | ||
const o = "expires=" + s.toUTCString(), | ||
n = "domain=" + this.KE; | ||
let i; | ||
i = this.mE ? e : encodeURIComponent(JSON.stringify(e)); | ||
const a = this.dE(t) + "=" + i + ";" + o + ";" + n + ";path=/"; | ||
return a.length >= 4093 | ||
? (r.j.info( | ||
n = "domain=" + this.mE; | ||
let a; | ||
a = this.KE ? e : encodeURIComponent(e); | ||
const i = this.dE(t) + "=" + a + ";" + o + ";" + n + ";path=/"; | ||
return i.length >= 4093 | ||
? (r.info( | ||
"Storage failure: string is " + | ||
a.length + | ||
i.length + | ||
" chars which is too large to store as a cookie.", | ||
), | ||
!1) | ||
: ((document.cookie = a), !0); | ||
: ((document.cookie = i), !0); | ||
} | ||
jr(t) { | ||
br(t) { | ||
const e = [], | ||
@@ -387,16 +404,14 @@ s = this.dE(t) + "=", | ||
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)) | ||
let a = o[n]; | ||
for (; " " === a.charAt(0); ) a = a.substring(1); | ||
if (0 === a.indexOf(s)) | ||
try { | ||
let t; | ||
(t = this.mE | ||
? i.substring(s.length, i.length) | ||
: JSON.parse( | ||
decodeURIComponent(i.substring(s.length, i.length)), | ||
)), | ||
(t = this.KE | ||
? a.substring(s.length, a.length) | ||
: decodeURIComponent(a.substring(s.length, a.length))), | ||
e.push(t); | ||
} catch (e) { | ||
return ( | ||
r.j.info("Storage retrieval failure: " + ei(e)), | ||
r.info("Storage retrieval failure: " + si(e)), | ||
this.remove(t), | ||
@@ -415,22 +430,22 @@ null | ||
(document.cookie = e), (document.cookie = e + ";path=/"); | ||
const s = e + ";domain=" + this.KE; | ||
const s = e + ";domain=" + this.mE; | ||
(document.cookie = s), (document.cookie = s + ";path=/"); | ||
} | ||
}), | ||
(J.Va = class { | ||
(Q.tc = class { | ||
constructor(t, e, s) { | ||
(this.cn = t), | ||
(this.CE = []), | ||
e && this.CE.push(new J.ee(t)), | ||
s && this.CE.push(new J.Ya(t)), | ||
this.CE.push(new J.Za()); | ||
(this.an = t), | ||
(this.DE = []), | ||
e && this.DE.push(new Q.ee(t)), | ||
s && this.DE.push(new Q.rc(t)), | ||
this.DE.push(new Q.ac()); | ||
} | ||
store(t, e) { | ||
let s = !0; | ||
for (let r = 0; r < this.CE.length; r++) s = this.CE[r].store(t, e) && s; | ||
for (let r = 0; r < this.DE.length; r++) s = this.DE[r].store(t, e) && s; | ||
return s; | ||
} | ||
jr(t) { | ||
for (let e = 0; e < this.CE.length; e++) { | ||
const s = this.CE[e].jr(t); | ||
br(t) { | ||
for (let e = 0; e < this.DE.length; e++) { | ||
const s = this.DE[e].br(t); | ||
if (null != s) return s; | ||
@@ -441,5 +456,5 @@ } | ||
remove(t) { | ||
new J.ee(this.cn).remove(t); | ||
for (let e = 0; e < this.CE.length; e++) this.CE[e].remove(t); | ||
new Q.ee(this.an).remove(t); | ||
for (let e = 0; e < this.DE.length; e++) this.DE[e].remove(t); | ||
} | ||
}); |
@@ -1,25 +0,25 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
export default class E { | ||
import { Guid as p } from "../../shared-lib/index.js"; | ||
export default class T { | ||
constructor() { | ||
this.Ve = {}; | ||
this._e = {}; | ||
} | ||
It(t) { | ||
if ("function" != typeof t) return null; | ||
const i = r.Z.Y(); | ||
return (this.Ve[i] = t), i; | ||
const i = p.W(); | ||
return (this._e[i] = t), i; | ||
} | ||
removeSubscription(t) { | ||
delete this.Ve[t]; | ||
delete this._e[t]; | ||
} | ||
removeAllSubscriptions() { | ||
this.Ve = {}; | ||
this._e = {}; | ||
} | ||
tc() { | ||
return Object.keys(this.Ve).length; | ||
ic() { | ||
return Object.keys(this._e).length; | ||
} | ||
Dt(t) { | ||
const i = []; | ||
for (const r in this.Ve) { | ||
const s = this.Ve[r]; | ||
i.push(s(t)); | ||
for (const s in this._e) { | ||
const r = this._e[s]; | ||
i.push(r(t)); | ||
} | ||
@@ -26,0 +26,0 @@ return i; |
export default { | ||
Ra: "invalid_api_key", | ||
Xa: "blacklisted", | ||
Ea: "no_device_identifier", | ||
Zh: "invalid_json_response", | ||
Vh: "empty_response", | ||
Pa: "invalid_api_key", | ||
Ua: "blacklisted", | ||
Ha: "no_device_identifier", | ||
La: "invalid_json_response", | ||
Ka: "empty_response", | ||
__: "sdk_auth_error", | ||
}; |
@@ -19,3 +19,3 @@ import { isObject as Nt } from "../util/code-utils.js"; | ||
} | ||
Kr() { | ||
Gr() { | ||
const t = { | ||
@@ -30,3 +30,3 @@ name: this.type, | ||
} | ||
tt() { | ||
Y() { | ||
return { | ||
@@ -43,8 +43,8 @@ u: this.userId, | ||
} | ||
static TE(t) { | ||
static cE(t) { | ||
return null != t && Nt(t) && null != t.t && "" !== t.t; | ||
} | ||
static Yn(t) { | ||
static En(t) { | ||
return new ue(t.u, t.t, t.ts, t.s, t.d); | ||
} | ||
} |
@@ -5,7 +5,7 @@ export default class xt { | ||
} | ||
Kr() { | ||
Gr() { | ||
const s = {}; | ||
return ( | ||
null != this.browser && (s.browser = this.browser), | ||
null != this.Ia && (s.browser_version = this.Ia), | ||
null != this.Da && (s.browser_version = this.Da), | ||
null != this.os && (s.os_version = this.os), | ||
@@ -12,0 +12,0 @@ null != this.resolution && (s.resolution = this.resolution), |
@@ -1,19 +0,39 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { Guid as p, logger as r } from "../../shared-lib/index.js"; | ||
import { isArray as j } from "../util/code-utils.js"; | ||
import { getErrorMessage as si } from "../util/error-utils.js"; | ||
export default class _t { | ||
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.Nl = new Date().valueOf()), | ||
(this.Gl = i); | ||
constructor(t, i, r) { | ||
(this.eu = t), | ||
null == t && (t = p.W()), | ||
!r || isNaN(r) ? (this.vl = new Date().valueOf()) : (this.vl = r), | ||
(this.eu = t), | ||
(this.Hl = new Date().valueOf()), | ||
(this.zl = i); | ||
} | ||
tt() { | ||
return { g: this.iu, e: this.Gl, c: this.vl, l: this.Nl }; | ||
Y() { | ||
return `g:${this.eu}|e:${this.zl}|c:${this.vl}|l:${this.Hl}`; | ||
} | ||
static Yn(t) { | ||
if (null == t || null == t.g) return null; | ||
const i = new _t(t.g, t.e, t.c); | ||
return (i.Nl = t.l), i; | ||
static En(t) { | ||
let i; | ||
if ("string" == typeof t) { | ||
const e = t.split("|"); | ||
if (!j(e) || 4 !== e.length) return null; | ||
try { | ||
const t = (t) => t.split(":")[1], | ||
r = (i) => { | ||
const r = parseInt(t(i)); | ||
if (!isNaN(r)) return r; | ||
}; | ||
(i = new _t(t(e[0]), r(e[1]), r(e[2]))), (i.Hl = r(e[3])); | ||
} catch (i) { | ||
r.info( | ||
`Unable to parse cookie string ${t}, failed with error: ${si(i)}`, | ||
); | ||
} | ||
} else { | ||
if (null == t || null == t.g) return null; | ||
(i = new _t(t.g, t.e, t.c)), (i.Hl = t.l); | ||
} | ||
return i; | ||
} | ||
} |
@@ -5,24 +5,24 @@ import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js"; | ||
(this.endpoint = t), | ||
(this.Mn = i), | ||
(this.Cn = i), | ||
(this.publicKey = s), | ||
(this.Vl = l), | ||
(this.al = h), | ||
(this.cl = h), | ||
(this.endpoint = t || null), | ||
(this.Mn = i || null), | ||
(this.Cn = i || null), | ||
(this.publicKey = s || null), | ||
(this.Vl = l || null), | ||
(this.al = h || null); | ||
(this.cl = h || null); | ||
} | ||
tt() { | ||
Y() { | ||
return { | ||
e: this.endpoint, | ||
c: this.Mn, | ||
c: this.Cn, | ||
p: this.publicKey, | ||
u: this.Vl, | ||
v: this.al, | ||
v: this.cl, | ||
}; | ||
} | ||
static Yn(t) { | ||
static En(t) { | ||
return new ti(t.e, w(t.c), t.p, t.u, t.v); | ||
} | ||
} |
export default class t { | ||
constructor(t = !1, s = []) { | ||
(this.O = t), (this.ve = s), (this.O = t), (this.ve = s); | ||
(this.L = t), (this.ge = s), (this.L = t), (this.ge = s); | ||
} | ||
S(t) { | ||
(this.O = this.O && t.O), this.ve.push(...t.ve); | ||
P(t) { | ||
(this.L = this.L && t.L), this.ge.push(...t.ge); | ||
} | ||
} |
@@ -1,2 +0,6 @@ | ||
export default class Kt { | ||
import { | ||
GLOBAL_RATE_LIMIT_CAPACITY_DEFAULT as Qt, | ||
GLOBAL_RATE_LIMIT_REFILL_RATE_DEFAULT as Yt, | ||
} from "../common/constants.js"; | ||
export default class Gt { | ||
constructor( | ||
@@ -11,39 +15,44 @@ t = 0, | ||
a = { enabled: !1, refresh_rate_limit: void 0 }, | ||
n = { enabled: !0, capacity: Qt, refill_rate: Yt }, | ||
) { | ||
(this.ol = t), | ||
(this.cl = i), | ||
(this.gl = s), | ||
(this.fl = h), | ||
(this.bl = e), | ||
(this.al = l), | ||
(this.gl = i), | ||
(this.fl = s), | ||
(this.bl = h), | ||
(this.Cl = e), | ||
(this.cl = l), | ||
(this.ml = r), | ||
(this.gi = a), | ||
(this.mi = a), | ||
(this.al = n), | ||
(this.ol = t), | ||
(this.cl = i), | ||
(this.gl = s), | ||
(this.fl = h), | ||
(this.bl = e), | ||
(this.al = l), | ||
(this.gl = i), | ||
(this.fl = s), | ||
(this.bl = h), | ||
(this.Cl = e), | ||
(this.cl = l), | ||
(this.ml = r), | ||
(this.gi = a); | ||
(this.mi = a), | ||
(this.al = n); | ||
} | ||
tt() { | ||
Y() { | ||
return { | ||
s: "5.0.1", | ||
s: "5.1.0", | ||
l: this.ol, | ||
e: this.cl, | ||
a: this.gl, | ||
p: this.fl, | ||
m: this.bl, | ||
v: this.al, | ||
e: this.gl, | ||
a: this.fl, | ||
p: this.bl, | ||
m: this.Cl, | ||
v: this.cl, | ||
c: this.ml, | ||
f: this.gi, | ||
f: this.mi, | ||
grl: this.al, | ||
}; | ||
} | ||
static Yn(t) { | ||
static En(t) { | ||
let i = t.l; | ||
return ( | ||
"5.0.1" !== t.s && (i = 0), new Kt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f) | ||
"5.1.0" !== t.s && (i = 0), | ||
new Gt(i, t.e, t.a, t.p, t.m, t.v, t.c, t.f, t.grl) | ||
); | ||
} | ||
} |
import e from "../managers/braze-instance.js"; | ||
import vt from "./utils/push-utils.js"; | ||
export function isPushBlocked() { | ||
if (e.rr()) return vt.isPushBlocked(); | ||
if (e.X()) return vt.isPushBlocked(); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import vt from "./utils/push-utils.js"; | ||
export function isPushPermissionGranted() { | ||
if (e.rr()) return vt.isPushPermissionGranted(); | ||
if (e.X()) return vt.isPushPermissionGranted(); | ||
} |
import e from "../managers/braze-instance.js"; | ||
import vt from "./utils/push-utils.js"; | ||
export function isPushSupported() { | ||
if (e.rr()) return vt.isPushSupported(); | ||
if (e.X()) return vt.isPushSupported(); | ||
} |
@@ -10,11 +10,11 @@ import e, { OPTIONS as L } from "../managers/braze-instance.js"; | ||
(na.i = new ea( | ||
e.br(), | ||
e.Ma(), | ||
e.pr(), | ||
e.ba(), | ||
e.te(), | ||
e.Ys(), | ||
e.Vs(), | ||
e.nn(L.Ma), | ||
e.nn(L._a), | ||
e.ir(), | ||
e.nn(L.ka), | ||
e.tr(), | ||
e.nn(L.qa), | ||
e.nn(L.Aa), | ||
e.l(), | ||
@@ -21,0 +21,0 @@ )), |
@@ -1,51 +0,52 @@ | ||
import { isArray as p, isEqual as ii } from "../util/code-utils.js"; | ||
import { isArray as j, isEqual as ii } from "../util/code-utils.js"; | ||
import ti from "../models/push-token.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { logger as r, EncodingUtils as ei } from "../../shared-lib/index.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import { User } from "../User/index.js"; | ||
import { WindowUtils as Y } from "../util/window-utils.js"; | ||
import { WindowUtils as eo } from "../util/window-utils.js"; | ||
import vt from "./utils/push-utils.js"; | ||
import { getErrorMessage as ei } from "../util/error-utils.js"; | ||
import { getErrorMessage as si } from "../util/error-utils.js"; | ||
export default class ea { | ||
constructor(i, t, e, s, r, n, o, u, h, a) { | ||
(this.hn = i), | ||
(this.cn = t), | ||
(this.fn = e), | ||
(this.dn = r), | ||
(this.bn = n), | ||
constructor(i, t, e, s, r, n, o, u, a, h) { | ||
(this.un = i), | ||
(this.an = t), | ||
(this.hn = e), | ||
(this.cn = r), | ||
(this.fn = n), | ||
(this.yt = o), | ||
(this.yn = u), | ||
(this.gn = h), | ||
(this.u = a), | ||
(this.hn = i), | ||
(this.cn = t), | ||
(this.fn = e), | ||
(this.wn = s + "/safari/" + t), | ||
(this.dn = r || "/service-worker.js"), | ||
(this.bn = n), | ||
(this.ln = u), | ||
(this.dn = a), | ||
(this.u = h), | ||
(this.un = i), | ||
(this.an = t), | ||
(this.hn = e), | ||
(this.pn = s + "/safari/" + t), | ||
(this.cn = r || "/service-worker.js"), | ||
(this.fn = n), | ||
(this.yt = o), | ||
(this.yn = u || !1), | ||
(this.gn = h || !1), | ||
(this.u = a), | ||
(this.vn = vt.kn()), | ||
(this.Pn = vt.Dn()); | ||
(this.ln = u || !1), | ||
(this.dn = a || !1), | ||
(this.u = h), | ||
(this.bn = vt.mn()), | ||
(this.yn = vt.gn()); | ||
} | ||
Sn() { | ||
return this.gn; | ||
vn() { | ||
return this.dn; | ||
} | ||
An(i, t, e, s, n) { | ||
wn(i, t, e, s, n) { | ||
i.unsubscribe() | ||
.then((i) => { | ||
i | ||
? this.jn(t, e, s, n) | ||
: (r.j.error("Failed to unsubscribe device from push."), | ||
? this.kn(t, e, s, n) | ||
: (r.error("Failed to unsubscribe device from push."), | ||
"function" == typeof n && n(!1)); | ||
}) | ||
.catch((i) => { | ||
r.j.error("Push unsubscription error: " + i), | ||
r.error("Push unsubscription error: " + i), | ||
"function" == typeof n && n(!1); | ||
}); | ||
} | ||
Un(i, t, e) { | ||
const s = ((i) => { | ||
Pn(i, t, e) { | ||
var s; | ||
const n = ((i) => { | ||
if ("string" == typeof i) return i; | ||
@@ -57,19 +58,19 @@ if (0 !== i.endpoint.indexOf("https://android.googleapis.com/gcm/send")) | ||
return ( | ||
e.Wn && | ||
-1 === i.endpoint.indexOf(e.Wn) && | ||
(t = i.endpoint + "/" + e.Wn), | ||
e.Dn && | ||
-1 === i.endpoint.indexOf(e.Dn) && | ||
(t = i.endpoint + "/" + e.Dn), | ||
t | ||
); | ||
})(i); | ||
let n = null, | ||
o = null; | ||
const u = i; | ||
if (null != u.getKey) | ||
let o = null, | ||
u = null; | ||
const a = i; | ||
if (null != a.getKey) | ||
try { | ||
const i = Array.from(new Uint8Array(u.getKey("p256dh"))), | ||
t = Array.from(new Uint8Array(u.getKey("auth"))); | ||
(n = btoa(String.fromCharCode.apply(null, i))), | ||
(o = btoa(String.fromCharCode.apply(null, t))); | ||
const i = Array.from(new Uint8Array(a.getKey("p256dh"))), | ||
t = Array.from(new Uint8Array(a.getKey("auth"))); | ||
(o = btoa(String.fromCharCode.apply(null, i))), | ||
(u = btoa(String.fromCharCode.apply(null, t))); | ||
} catch (i) { | ||
r.j.error(ei(i)); | ||
r.error(si(i)); | ||
} | ||
@@ -86,13 +87,17 @@ const h = ((i) => { | ||
: null; | ||
})(u); | ||
this.hn && this.hn._n(s, t, n, o, h), | ||
s && "function" == typeof e && e(s, n, o); | ||
})(a); | ||
null === (s = this.un) || void 0 === s || s.Sn(n, t, o, u, h), | ||
n && "function" == typeof e && e(n, o, u); | ||
} | ||
xn() { | ||
this.hn && this.hn.Nn(!0); | ||
An() { | ||
var i; | ||
null === (i = this.un) || void 0 === i || i.jn(!0); | ||
} | ||
Tn(i, t) { | ||
this.hn && this.hn.Nn(!1), r.j.info(i), "function" == typeof t && t(!1); | ||
xn(i, t) { | ||
var e; | ||
null === (e = this.un) || void 0 === e || e.jn(!1), | ||
r.info(i), | ||
"function" == typeof t && t(!1); | ||
} | ||
zn(i, t, e, s) { | ||
Un(i, t, e, s) { | ||
var n; | ||
@@ -102,8 +107,8 @@ if ("default" === t.permission) | ||
window.safari.pushNotification.requestPermission( | ||
this.wn, | ||
this.pn, | ||
i, | ||
{ | ||
api_key: this.cn, | ||
api_key: this.an, | ||
device_id: | ||
(null === (n = this.fn) || void 0 === n ? void 0 : n.ce().id) || | ||
(null === (n = this.hn) || void 0 === n ? void 0 : n.ce().id) || | ||
"", | ||
@@ -113,15 +118,15 @@ }, | ||
"granted" === t.permission && | ||
this.hn && | ||
this.hn.setPushNotificationSubscriptionType( | ||
this.un && | ||
this.un.setPushNotificationSubscriptionType( | ||
User.NotificationSubscriptionTypes.OPTED_IN, | ||
), | ||
this.zn(i, t, e, s); | ||
this.Un(i, t, e, s); | ||
}, | ||
); | ||
} catch (i) { | ||
this.Tn("Could not request permission for push: " + i, s); | ||
this.xn("Could not request permission for push: " + i, s); | ||
} | ||
else | ||
"denied" === t.permission | ||
? this.Tn( | ||
? this.xn( | ||
"The user has blocked notifications from this site, or Safari push is not configured in the Braze dashboard.", | ||
@@ -131,4 +136,4 @@ s, | ||
: "granted" === t.permission && | ||
(r.j.info("Device successfully subscribed to push."), | ||
this.Un(t.deviceToken, new Date(), e)); | ||
(r.info("Device successfully subscribed to push."), | ||
this.Pn(t.deviceToken, new Date(), e)); | ||
} | ||
@@ -145,3 +150,3 @@ requestPermission(i, t, e) { | ||
default: | ||
r.j.error("Received unexpected permission result " + s); | ||
r.error("Received unexpected permission result " + s); | ||
} | ||
@@ -159,3 +164,3 @@ }; | ||
} | ||
jn(i, t, e, s) { | ||
kn(i, t, e, s) { | ||
const n = { userVisibleOnly: !0 }; | ||
@@ -166,17 +171,17 @@ null != t && (n.applicationServerKey = t), | ||
.then((i) => { | ||
r.j.info("Device successfully subscribed to push."), | ||
this.Un(i, new Date(), e); | ||
r.info("Device successfully subscribed to push."), | ||
this.Pn(i, new Date(), e); | ||
}) | ||
.catch((i) => { | ||
vt.isPushBlocked() | ||
? (r.j.info("Permission for push notifications was denied."), | ||
? (r.info("Permission for push notifications was denied."), | ||
"function" == typeof s && s(!1)) | ||
: (r.j.error("Push subscription failed: " + i), | ||
: (r.error("Push subscription failed: " + i), | ||
"function" == typeof s && s(!0)); | ||
}); | ||
} | ||
In() { | ||
return this.yn | ||
? navigator.serviceWorker.getRegistration(this.dn) | ||
: navigator.serviceWorker.register(this.dn).then(() => | ||
Wn() { | ||
return this.ln | ||
? navigator.serviceWorker.getRegistration(this.cn) | ||
: navigator.serviceWorker.register(this.cn).then(() => | ||
navigator.serviceWorker.ready.then( | ||
@@ -187,3 +192,3 @@ (i) => ( | ||
i.update().catch((i) => { | ||
r.j.info("ServiceWorker update failed: " + i); | ||
r.info("ServiceWorker update failed: " + i); | ||
}), | ||
@@ -195,12 +200,12 @@ i | ||
} | ||
Vn(i) { | ||
this.yn || | ||
(i.unregister(), r.j.info("Service worker successfully unregistered.")); | ||
_n(i) { | ||
this.ln || | ||
(i.unregister(), r.info("Service worker successfully unregistered.")); | ||
} | ||
subscribe(t, e) { | ||
subscribe(i, t) { | ||
if (!vt.isPushSupported()) | ||
return r.j.info(ea.qn), void ("function" == typeof e && e(!1)); | ||
if (this.vn) { | ||
if (!this.yn && null != window.location) { | ||
let i = this.dn; | ||
return r.info(ea.Nn), void ("function" == typeof t && t(!1)); | ||
if (this.bn) { | ||
if (!this.ln && null != window.location) { | ||
let i = this.cn; | ||
-1 === i.indexOf(window.location.host) && | ||
@@ -210,6 +215,6 @@ (i = window.location.host + i), | ||
(i = window.location.protocol + "//" + i); | ||
const t = i.substr(0, i.lastIndexOf("/") + 1); | ||
if (0 !== Y.Cn().indexOf(t)) | ||
const e = i.substr(0, i.lastIndexOf("/") + 1); | ||
if (0 !== eo.Tn().indexOf(e)) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
"Cannot subscribe to push from a path higher than the service worker location (tried to subscribe from " + | ||
@@ -221,24 +226,24 @@ window.location.pathname + | ||
), | ||
void ("function" == typeof e && e(!0)) | ||
void ("function" == typeof t && t(!0)) | ||
); | ||
} | ||
if (vt.isPushBlocked()) | ||
return void this.Tn( | ||
return void this.xn( | ||
"Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.", | ||
e, | ||
t, | ||
); | ||
if (this.yt && !this.yt.En() && 0 === this.yt.li()) | ||
if (this.yt && !this.yt.In() && 0 === this.yt.ni()) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"Waiting for VAPID key from server config before subscribing to push.", | ||
), | ||
void this.yt.Rn(() => { | ||
this.subscribe(t, e); | ||
void this.yt.Vn(() => { | ||
this.subscribe(i, t); | ||
}) | ||
); | ||
const s = () => { | ||
r.j.info("Permission for push notifications was denied."), | ||
"function" == typeof e && e(!1); | ||
const e = () => { | ||
r.info("Permission for push notifications was denied."), | ||
"function" == typeof t && t(!1); | ||
}, | ||
n = () => { | ||
s = () => { | ||
let i = "Permission for push notifications was ignored."; | ||
@@ -248,38 +253,40 @@ vt.isPushBlocked() && | ||
" The browser has automatically blocked further permission requests for a period (probably 1 week)."), | ||
r.j.info(i), | ||
"function" == typeof e && e(!0); | ||
r.info(i), | ||
"function" == typeof t && t(!0); | ||
}, | ||
o = vt.isPushPermissionGranted(), | ||
n = vt.isPushPermissionGranted(), | ||
u = () => { | ||
!o && | ||
this.hn && | ||
this.hn.setPushNotificationSubscriptionType( | ||
!n && | ||
this.un && | ||
this.un.setPushNotificationSubscriptionType( | ||
User.NotificationSubscriptionTypes.OPTED_IN, | ||
), | ||
this.In() | ||
.then((s) => { | ||
if (null == s) | ||
this.Wn() | ||
.then((e) => { | ||
if (null == e) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
"No service worker registration. Set the `manageServiceWorkerExternally` initialization option to false or ensure that your service worker is registered before calling registerPush.", | ||
), | ||
void ("function" == typeof e && e(!0)) | ||
void ("function" == typeof t && t(!0)) | ||
); | ||
s.pushManager | ||
e.pushManager | ||
.getSubscription() | ||
.then((n) => { | ||
let o = null; | ||
.then((s) => { | ||
var n; | ||
let u = null; | ||
if ( | ||
(this.yt && | ||
null != this.yt.En() && | ||
(o = r.On.Fn(this.yt.En())), | ||
n) | ||
(null != | ||
(null === (n = this.yt) || void 0 === n | ||
? void 0 | ||
: n.In()) && (u = ei.qn(this.yt.In())), | ||
s) | ||
) { | ||
let u, | ||
h = null, | ||
a = null; | ||
if ((this.u && (u = this.u.v(i.k.Bn)), u && !p(u))) { | ||
let n, | ||
a = null, | ||
h = null; | ||
if ((this.u && (n = this.u.j(o.C.zn)), n && !j(n))) { | ||
let i; | ||
try { | ||
i = ti.Yn(u).Mn; | ||
i = ti.En(n).Cn; | ||
} catch (t) { | ||
@@ -291,66 +298,64 @@ i = null; | ||
0 === i.getTime() || | ||
((h = i), | ||
(a = new Date(h)), | ||
a.setMonth(h.getMonth() + 6)); | ||
((a = i), | ||
(h = new Date(a)), | ||
h.setMonth(a.getMonth() + 6)); | ||
} | ||
null != o && | ||
n.options && | ||
n.options.applicationServerKey && | ||
n.options.applicationServerKey.byteLength && | ||
n.options.applicationServerKey.byteLength > 0 && | ||
!ii(o, new Uint8Array(n.options.applicationServerKey)) | ||
? (n.options.applicationServerKey.byteLength > 12 | ||
? r.j.info( | ||
null != u && | ||
s.options && | ||
s.options.applicationServerKey && | ||
s.options.applicationServerKey.byteLength && | ||
s.options.applicationServerKey.byteLength > 0 && | ||
!ii(u, new Uint8Array(s.options.applicationServerKey)) | ||
? (s.options.applicationServerKey.byteLength > 12 | ||
? r.info( | ||
"Device was already subscribed to push using a different VAPID provider, creating new subscription.", | ||
) | ||
: r.j.info( | ||
: r.info( | ||
"Attempting to upgrade a gcm_sender_id-based push registration to VAPID - depending on the browser this may or may not result in the same gcm_sender_id-based subscription.", | ||
), | ||
this.An(n, s, o, t, e)) | ||
: n.expirationTime && | ||
new Date(n.expirationTime).valueOf() <= | ||
this.wn(s, e, u, i, t)) | ||
: s.expirationTime && | ||
new Date(s.expirationTime).valueOf() <= | ||
new Date().valueOf() | ||
? (r.j.info( | ||
? (r.info( | ||
"Push subscription is expired, creating new subscription.", | ||
), | ||
this.An(n, s, o, t, e)) | ||
: u && p(u) | ||
? this.An(n, s, o, t, e) | ||
: null == a | ||
? (r.j.info( | ||
this.wn(s, e, u, i, t)) | ||
: n && j(n) | ||
? this.wn(s, e, u, i, t) | ||
: null == h | ||
? (r.info( | ||
"No push subscription creation date found, creating new subscription.", | ||
), | ||
this.An(n, s, o, t, e)) | ||
: a.valueOf() <= new Date().valueOf() | ||
? (r.j.info( | ||
this.wn(s, e, u, i, t)) | ||
: h.valueOf() <= new Date().valueOf() | ||
? (r.info( | ||
"Push subscription older than 6 months, creating new subscription.", | ||
), | ||
this.An(n, s, o, t, e)) | ||
: (r.j.info( | ||
this.wn(s, e, u, i, t)) | ||
: (r.info( | ||
"Device already subscribed to push, sending existing subscription to backend.", | ||
), | ||
this.Un(n, h, t)); | ||
} else this.jn(s, o, t, e); | ||
this.Pn(s, a, i)); | ||
} else this.kn(e, u, i, t); | ||
}) | ||
.catch((i) => { | ||
r.j.error( | ||
"Error checking current push subscriptions: " + i, | ||
); | ||
r.error("Error checking current push subscriptions: " + i); | ||
}); | ||
}) | ||
.catch((i) => { | ||
r.j.error("ServiceWorker registration failed: " + i); | ||
r.error("ServiceWorker registration failed: " + i); | ||
}); | ||
}; | ||
this.requestPermission(u, n, s); | ||
} else if (this.Pn) { | ||
if (null == this.bn || "" === this.bn) | ||
this.requestPermission(u, s, e); | ||
} else if (this.yn) { | ||
if (null == this.fn || "" === this.fn) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
"You must supply the safariWebsitePushId initialization option in order to use registerPush on Safari", | ||
), | ||
void ("function" == typeof e && e(!0)) | ||
void ("function" == typeof t && t(!0)) | ||
); | ||
const i = window.safari.pushNotification.permission(this.bn); | ||
this.zn(this.bn, i, t, e); | ||
const e = window.safari.pushNotification.permission(this.fn); | ||
this.Un(this.fn, e, i, t); | ||
} | ||
@@ -360,4 +365,4 @@ } | ||
if (!vt.isPushSupported()) | ||
return r.j.info(ea.qn), void ("function" == typeof t && t()); | ||
this.vn | ||
return r.info(ea.Nn), void ("function" == typeof t && t()); | ||
this.bn | ||
? navigator.serviceWorker.getRegistration().then((e) => { | ||
@@ -369,3 +374,3 @@ e | ||
s && | ||
(this.xn(), | ||
(this.An(), | ||
s | ||
@@ -375,14 +380,12 @@ .unsubscribe() | ||
s | ||
? (r.j.info( | ||
? (r.info( | ||
"Device successfully unsubscribed from push.", | ||
), | ||
"function" == typeof i && i()) | ||
: (r.j.error( | ||
"Failed to unsubscribe device from push.", | ||
), | ||
: (r.error("Failed to unsubscribe device from push."), | ||
"function" == typeof t && t()), | ||
this.Vn(e); | ||
this._n(e); | ||
}) | ||
.catch((i) => { | ||
r.j.error("Push unsubscription error: " + i), | ||
r.error("Push unsubscription error: " + i), | ||
"function" == typeof t && t(); | ||
@@ -392,14 +395,14 @@ })); | ||
.catch((i) => { | ||
r.j.error("Error unsubscribing from push: " + i), | ||
r.error("Error unsubscribing from push: " + i), | ||
"function" == typeof t && t(); | ||
}) | ||
: (r.j.info("Device already unsubscribed from push."), | ||
: (r.info("Device already unsubscribed from push."), | ||
"function" == typeof i && i()); | ||
}) | ||
: this.Pn && | ||
(this.xn(), | ||
r.j.info("Device unsubscribed from push."), | ||
: this.yn && | ||
(this.An(), | ||
r.info("Device unsubscribed from push."), | ||
"function" == typeof i && i()); | ||
} | ||
} | ||
ea.qn = "Push notifications are not supported in this browser."; | ||
ea.Nn = "Push notifications are not supported in this browser."; |
import e from "../managers/braze-instance.js"; | ||
import na from "./push-manager-factory.js"; | ||
export function requestPushPermission(r, n) { | ||
if (e.rr()) | ||
if (e.X()) | ||
return na.m().subscribe((n, o, t) => { | ||
@@ -6,0 +6,0 @@ const s = e.cr(); |
import e from "../managers/braze-instance.js"; | ||
import na from "./push-manager-factory.js"; | ||
export function unregisterPush(r, n) { | ||
if (e.rr()) return na.m().unsubscribe(r, n); | ||
if (e.X()) return na.m().unsubscribe(r, n); | ||
} |
const vt = { | ||
kn: () => | ||
mn: () => | ||
"serviceWorker" in navigator && | ||
@@ -7,3 +7,3 @@ "undefined" != typeof ServiceWorkerRegistration && | ||
"PushManager" in window, | ||
Dn: () => | ||
gn: () => | ||
"safari" in window && | ||
@@ -13,3 +13,3 @@ "pushNotification" in window.safari && | ||
"function" == typeof window.safari.pushNotification.requestPermission, | ||
isPushSupported: () => vt.kn() || vt.Dn(), | ||
isPushSupported: () => vt.mn() || vt.gn(), | ||
isPushBlocked: () => { | ||
@@ -33,3 +33,3 @@ const i = | ||
"granted" === window.Notification.permission, | ||
Gr: () => | ||
Yi: () => | ||
!vt.isPushBlocked() && | ||
@@ -36,0 +36,0 @@ vt.isPushSupported() && |
import C from "./util/net.js"; | ||
import ue from "./models/braze-event.js"; | ||
import s from "./common/event-logger.js"; | ||
import { randomInclusive as D } from "./util/math.js"; | ||
import { randomInclusive as k } from "./util/math.js"; | ||
import t from "./models/request-result.js"; | ||
import r from "../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as i } from "./managers/storage-manager.js"; | ||
import E from "./managers/subscription-manager.js"; | ||
import { | ||
logger as r, | ||
IndexedDBAdapter as A, | ||
Guid as p, | ||
EventTypes as i, | ||
} from "../shared-lib/index.js"; | ||
import { STORAGE_KEYS as o } from "./managers/storage-manager.js"; | ||
import T from "./managers/subscription-manager.js"; | ||
import vt from "./Push/utils/push-utils.js"; | ||
import T from "./util/request-header-utils.js"; | ||
import S from "./util/request-header-utils.js"; | ||
export default class Lt { | ||
constructor(t, i, s, e, h, o, n, r, u, l) { | ||
(this.cn = t), | ||
(this.an = t), | ||
(this.baseUrl = i), | ||
(this._e = s), | ||
(this.fn = e), | ||
(this.di = s), | ||
(this.hn = e), | ||
(this.wt = h), | ||
(this.yt = o), | ||
(this.u = n), | ||
(this.fu = r), | ||
(this.Mo = u), | ||
(this.$t = l), | ||
(this.cn = t), | ||
(this.bu = r), | ||
(this.Go = u), | ||
(this.qt = l), | ||
(this.an = t), | ||
(this.baseUrl = i), | ||
(this.gu = 0), | ||
(this.OE = n.RE() || 0), | ||
(this.vu = null), | ||
(this._e = s), | ||
(this.fn = e), | ||
(this.wu = 0), | ||
(this.gE = n.RE() || 0), | ||
(this.ku = null), | ||
(this.di = s), | ||
(this.hn = e), | ||
(this.wt = h), | ||
(this.yt = o), | ||
(this.u = n), | ||
(this.Mo = u), | ||
(this.$t = l), | ||
(this.fu = r), | ||
(this.wu = new E()), | ||
(this.ku = null), | ||
(this.yu = 50), | ||
(this.ju = !1); | ||
(this.Go = u), | ||
(this.qt = l), | ||
(this.bu = r), | ||
(this.yu = new T()), | ||
(this.ju = null), | ||
(this.Su = 50), | ||
(this.Au = !1); | ||
} | ||
Su(t, i) { | ||
return !t && !i && this.Mo.Jh() >= this.yu; | ||
$u(t, i) { | ||
return !t && !i && this.Go.Hh() >= this.Su; | ||
} | ||
$u(t) { | ||
let i = this._e.El(); | ||
Cu(t) { | ||
let s = this.di.El(); | ||
if (t.length > 0) { | ||
const s = this.wt.getUserId(); | ||
for (const e of t) { | ||
const t = (!e.userId && !s) || e.userId === s; | ||
e.type === r.q.Wl && t && (i = !0); | ||
const e = this.wt.getUserId(); | ||
for (const h of t) { | ||
const t = (!h.userId && !e) || h.userId === e; | ||
h.type === i.kl && t && (s = !0); | ||
} | ||
} | ||
return i; | ||
return s; | ||
} | ||
qu(t = !1, s = !1, e = !0, h, o, n, u = !1, l = !1) { | ||
e && this.Au(); | ||
const a = this.u.cE(), | ||
Du(t = !1, i = !1, s = !0, e, h, n, u = !1, l = !1) { | ||
s && this.Fu(); | ||
const a = this.u.TE(), | ||
c = this.u.AE(); | ||
let d = !1; | ||
const f = (t, s) => { | ||
const f = (t, i) => { | ||
let r = !1; | ||
T.Ws(this.u, T.Os.Na, new Date().valueOf()), | ||
C.Xs({ | ||
S.Os(this.u, S.Gs.Qa, new Date().valueOf()), | ||
C.Qs({ | ||
url: this.baseUrl + "/data/", | ||
data: t, | ||
headers: s, | ||
O: (e) => { | ||
headers: i, | ||
L: (s) => { | ||
null != t.respond_with && | ||
t.respond_with.triggers && | ||
(this.gu = Math.max(this.gu - 1, 0)), | ||
this.$t.Zs(t, e, s) | ||
? (this.Mo.ti(), | ||
this.yt.ul(e), | ||
(this.wu = Math.max(this.wu - 1, 0)), | ||
this.qt.Ws(t, s, i) | ||
? (this.Go.Xs(), | ||
this.yt.ul(s), | ||
(null != t.respond_with && | ||
t.respond_with.user_id != this.wt.getUserId()) || | ||
(null != t.device && this.u.D(i.k.Fa, t.device), | ||
(null != t.device && this.u.k(o.C.Ja, t.device), | ||
null != t.sdk_metadata && | ||
(this.u.D(i.k.Kh, t.sdk_metadata), | ||
this.u.D(i.k.Wh, this._e.Yh())), | ||
this.fu(e), | ||
T.si(this.u, T.Os.Na, 1), | ||
"function" == typeof h && h())) | ||
: e.auth_error && (r = !0); | ||
(this.u.k(o.C.Na, t.sdk_metadata), | ||
this.u.k(o.C.$a, this.di.ki())), | ||
this.bu(s), | ||
S.Ys(this.u, S.Gs.Qa, 1), | ||
"function" == typeof e && e())) | ||
: s.auth_error && (r = !0); | ||
}, | ||
@@ -88,14 +93,14 @@ error: () => { | ||
t.respond_with.triggers && | ||
(this.gu = Math.max(this.gu - 1, 0)), | ||
this.$t.Qh(t.events, t.attributes), | ||
"function" == typeof o && o(); | ||
(this.wu = Math.max(this.wu - 1, 0)), | ||
this.qt.Ea(t.events, t.attributes), | ||
"function" == typeof h && h(); | ||
}, | ||
ei: (t) => { | ||
if (("function" == typeof n && n(t), e && !d)) { | ||
if (t && !r) this.Cu(); | ||
ti: (t) => { | ||
if (("function" == typeof n && n(t), s && !d)) { | ||
if (t && !r) this.Tu(); | ||
else { | ||
T.hi(this.u, T.Os.Na); | ||
let t = this.vu; | ||
(null == t || t < 1e3 * this.OE) && (t = 1e3 * this.OE), | ||
this.Cu(Math.min(3e5, D(1e3 * this.OE, 3 * t))); | ||
S.si(this.u, S.Gs.Qa); | ||
let t = this.ku; | ||
(null == t || t < 1e3 * this.gE) && (t = 1e3 * this.gE), | ||
this.Tu(Math.min(3e5, k(1e3 * this.gE, 3 * t))); | ||
} | ||
@@ -107,27 +112,28 @@ d = !0; | ||
}, | ||
m = this.$u(a), | ||
g = s || m; | ||
if (this.Su(u, m)) | ||
return void r.j.info( | ||
m = this.Cu(a), | ||
g = i || m; | ||
if (this.$u(u, m)) | ||
return void r.info( | ||
"Declining to flush data due to 50 consecutive authentication failures", | ||
); | ||
if (e && !this.$t.Pa(a, c, t, g)) | ||
return this.Cu(), void ("function" == typeof n && n(!0)); | ||
const v = this.$t.$a(t, g, a, c, l); | ||
g && this.gu++; | ||
if (s && !this.qt.Wa(a, c, t, g)) | ||
return this.Tu(), void ("function" == typeof n && n(!0)); | ||
const v = this.qt.Ya(t, g, a, c, l); | ||
g && this.wu++; | ||
let p = !1; | ||
if (v) | ||
for (const t of v) | ||
this.$t.Qs(t.requestData, () => f(t.requestData, t.headers)), (p = !0); | ||
this.Mo.wh() && e && !p | ||
? this.Cu() | ||
: m && (r.j.info("Invoking new session subscriptions"), this.wu.Dt()); | ||
this.qt.Hs(t.requestData, () => f(t.requestData, t.headers), S.ii.Qa), | ||
(p = !0); | ||
this.Go.fh() && s && !p | ||
? this.Tu() | ||
: m && (r.info("Invoking new session subscriptions"), this.yu.Dt()); | ||
} | ||
Du() { | ||
return this.gu > 0; | ||
Lu() { | ||
return this.wu > 0; | ||
} | ||
Cu(t = 1e3 * this.OE) { | ||
this.ju || | ||
(this.Au(), | ||
(this.ku = window.setTimeout(() => { | ||
Tu(t = 1e3 * this.gE) { | ||
this.Au || | ||
(this.Fu(), | ||
(this.ju = window.setTimeout(() => { | ||
if (document.hidden) { | ||
@@ -137,86 +143,88 @@ const t = "visibilitychange", | ||
document.hidden || | ||
(document.removeEventListener(t, i, !1), this.qu()); | ||
(document.removeEventListener(t, i, !1), this.Du()); | ||
}; | ||
document.addEventListener(t, i, !1); | ||
} else this.qu(); | ||
} else this.Du(); | ||
}, t)), | ||
(this.vu = t)); | ||
(this.ku = t)); | ||
} | ||
Au() { | ||
null != this.ku && (clearTimeout(this.ku), (this.ku = null)); | ||
Fu() { | ||
null != this.ju && (clearTimeout(this.ju), (this.ju = null)); | ||
} | ||
initialize() { | ||
(this.ju = !1), this.Cu(); | ||
(this.Au = !1), this.Tu(); | ||
} | ||
destroy() { | ||
this.wu.removeAllSubscriptions(), | ||
this.Mo.Gh(), | ||
this.Au(), | ||
(this.ju = !0), | ||
this.qu(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0), | ||
(this.ku = null); | ||
this.yu.removeAllSubscriptions(), | ||
this.Go.Bh(), | ||
this.Fu(), | ||
(this.Au = !0), | ||
this.Du(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0), | ||
(this.ju = null); | ||
} | ||
pr(t) { | ||
return this.wu.It(t); | ||
mr(t) { | ||
return this.yu.It(t); | ||
} | ||
openSession() { | ||
const t = this._e.Yh() !== this._e.co(); | ||
t && (this.u.uE(i.eu.Zo), this.u.uE(i.eu.su)), | ||
this.qu(void 0, !1, void 0, void 0, void 0), | ||
this.pu(), | ||
const t = this.di.ki() !== this.di.xo(); | ||
t && (this.u.uE(o.iu.Ta), this.u.uE(o.iu.su)), | ||
this.Du(void 0, !1, void 0, () => { | ||
this.u.hi(o.C.Ii); | ||
}), | ||
this.Jn(), | ||
t && | ||
import("./Push/push-manager-factory.js").then((t) => { | ||
if (this.ju) return; | ||
const s = t.default.m(); | ||
if (this.Au) return; | ||
const i = t.default.m(); | ||
if ( | ||
null != s && | ||
null != i && | ||
(vt.isPushPermissionGranted() || vt.isPushBlocked()) | ||
) { | ||
const t = () => { | ||
s.Sn() | ||
? r.j.info( | ||
i.vn() | ||
? r.info( | ||
"Push token maintenance is disabled, not refreshing token for backend.", | ||
) | ||
: s.subscribe(); | ||
: i.subscribe(); | ||
}, | ||
e = (i, s) => { | ||
s = (i, s) => { | ||
s && t(); | ||
}, | ||
h = () => { | ||
const s = this.u.v(i.k.Bn); | ||
(null == s || s) && t(); | ||
e = () => { | ||
const i = this.u.j(o.C.zn); | ||
(null == i || i) && t(); | ||
}, | ||
o = r.ts.Zt; | ||
new r.es(o, r.j).hr(o.rs.cu, e, h); | ||
h = A.Yt.Qt; | ||
new A(h, r).jr(h.ss.cu, s, e); | ||
} | ||
}); | ||
} | ||
Fu() { | ||
this.u.ni(i.k.Ri), this.u.ni(i.k.gs), this.u.ni(i.k.rn); | ||
Mu() { | ||
this.u.hi(o.C.Ti), this.u.hi(o.C.Cs), this.u.hi(o.C.Wr); | ||
} | ||
changeUser(t, s, e) { | ||
const h = this.wt.getUserId(); | ||
if (h !== t) { | ||
this._e.kl(), | ||
this.Fu(), | ||
null != h && this.qu(void 0, !1, void 0, void 0, void 0), | ||
this.wt.ru(t), | ||
e ? this.Mo.setSdkAuthenticationSignature(e) : this.Mo.yh(); | ||
for (let t = 0; t < s.length; t++) s[t].changeUser(null == h); | ||
null != h && this.u.ni(i.k.L), | ||
this.u.ni(i.k.Fa), | ||
changeUser(t, i, s) { | ||
const e = this.wt.getUserId(); | ||
if (e !== t) { | ||
this.di.ql(), | ||
this.Mu(), | ||
null != e && this.Du(void 0, !1, void 0, void 0, void 0), | ||
this.wt.ou(t), | ||
s ? this.Go.setSdkAuthenticationSignature(s) : this.Go.qh(); | ||
for (let t = 0; t < i.length; t++) i[t].changeUser(null == e); | ||
null != e && this.u.hi(o.C.J), | ||
this.u.hi(o.C.Ja), | ||
this.openSession(), | ||
r.j.info('Changed user to "' + t + '".'); | ||
r.info('Changed user to "' + t + '".'); | ||
} else { | ||
let i = "Doing nothing."; | ||
e && | ||
this.Mo.jh() !== e && | ||
(this.Mo.setSdkAuthenticationSignature(e), | ||
s && | ||
this.Go.wh() !== s && | ||
(this.Go.setSdkAuthenticationSignature(s), | ||
(i = "Updated SDK authentication signature")), | ||
r.j.info(`Current user is already ${t}. ${i}`); | ||
r.info(`Current user is already ${t}. ${i}`); | ||
} | ||
} | ||
requestImmediateDataFlush(t) { | ||
this.Au(), this._e.co(); | ||
this.qu( | ||
this.Fu(), this.di.xo(); | ||
this.Du( | ||
void 0, | ||
@@ -227,5 +235,3 @@ void 0, | ||
() => { | ||
r.j.error( | ||
"Failed to flush data, request will be retried automatically.", | ||
); | ||
r.error("Failed to flush data, request will be retried automatically."); | ||
}, | ||
@@ -237,53 +243,54 @@ t, | ||
requestFeedRefresh() { | ||
this._e.co(), this.qu(!0); | ||
this.di.xo(), this.Du(!0); | ||
} | ||
$r(t, i) { | ||
this._e.co(), | ||
r.j.info("Requesting explicit trigger refresh."), | ||
this.qu(void 0, !0, void 0, t, i); | ||
this.di.xo(), | ||
r.info("Requesting explicit trigger refresh."), | ||
this.Du(void 0, !0, void 0, t, i); | ||
} | ||
$n(t, i) { | ||
const e = r.q.Tu, | ||
h = { a: t, l: i }, | ||
o = s.N(e, h); | ||
return o && r.j.info(`Logged alias ${t} with label ${i}`), o; | ||
Fn(t, e) { | ||
const h = i.Pu, | ||
o = { a: t, l: e }, | ||
n = s.q(h, o); | ||
return n && r.info(`Logged alias ${t} with label ${e}`), n; | ||
} | ||
Gn(i, e, h) { | ||
Bn(i, e, h) { | ||
if (this.yt.hu(e)) | ||
return ( | ||
r.j.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t() | ||
r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t() | ||
); | ||
const o = { key: e, value: h }, | ||
n = s.N(i, o); | ||
n = s.q(i, o); | ||
if (n) { | ||
const t = "object" == typeof h ? JSON.stringify(h, null, 2) : h; | ||
r.j.info(`Logged custom attribute: ${e} with value: ${t}`); | ||
r.info(`Logged custom attribute: ${e} with value: ${t}`); | ||
} | ||
return n; | ||
} | ||
setLastKnownLocation(t, i, e, h, o, n) { | ||
const u = { latitude: i, longitude: e }; | ||
null != h && (u.altitude = h), | ||
null != o && (u.ll_accuracy = o), | ||
null != n && (u.alt_accuracy = n); | ||
const l = s.N(r.q.Lu, u, t || void 0); | ||
setLastKnownLocation(t, e, h, o, n, u) { | ||
const l = { latitude: e, longitude: h }; | ||
null != o && (l.altitude = o), | ||
null != n && (l.ll_accuracy = n), | ||
null != u && (l.alt_accuracy = u); | ||
const a = s.q(i.xu, l, t || void 0); | ||
return ( | ||
l && | ||
r.j.info( | ||
`Set user last known location as ${JSON.stringify(u, null, 2)}`, | ||
), | ||
l | ||
a && | ||
r.info(`Set user last known location as ${JSON.stringify(l, null, 2)}`), | ||
a | ||
); | ||
} | ||
vr(t, i) { | ||
const s = this._e.co(); | ||
return new ue(this.wt.getUserId(), r.q.Mu, t, s, { cid: i }); | ||
kr(t, s) { | ||
const e = this.di.xo(); | ||
return new ue(this.wt.getUserId(), i.Iu, t, e, { cid: s }); | ||
} | ||
pu() { | ||
const t = r.ts.Zt; | ||
new r.es(t, r.j).setItem(t.rs.Na, 1, { | ||
Nu(t, i) { | ||
return new A(t, i); | ||
} | ||
Jn() { | ||
const t = A.Yt.Qt; | ||
this.Nu(t, r).setItem(t.ss.Qa, 1, { | ||
baseUrl: this.baseUrl, | ||
data: { api_key: this.cn, device_id: this.fn.ce().id }, | ||
data: { api_key: this.an, device_id: this.hn.ce().id }, | ||
userId: this.wt.getUserId(), | ||
sdkAuthEnabled: this.Mo.wh(), | ||
sdkAuthEnabled: this.Go.fh(), | ||
}); | ||
@@ -293,25 +300,25 @@ } | ||
for (const i of t) | ||
if (i.api_key === this.cn) this.$t.Qh(i.events, i.attributes); | ||
if (i.api_key === this.an) this.qt.Ea(i.events, i.attributes); | ||
else { | ||
const t = r.ts.Zt; | ||
new r.es(t, r.j).setItem(t.rs.wr, r.Z.Y(), i); | ||
const t = A.Yt.Qt; | ||
new A(t, r).setItem(t.ss.wr, p.W(), i); | ||
} | ||
} | ||
Zn(i, e, h) { | ||
if (this.yt.hu(i)) | ||
Kn(e, h, o) { | ||
if (this.yt.hu(e)) | ||
return ( | ||
r.j.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t() | ||
r.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t() | ||
); | ||
let o, n; | ||
let n, u; | ||
return ( | ||
null === e && null === h | ||
? ((o = r.q.Pu), (n = { key: i })) | ||
: ((o = r.q.Ru), (n = { key: i, latitude: e, longitude: h })), | ||
s.N(o, n) | ||
null === h && null === o | ||
? ((n = i.Ou), (u = { key: e })) | ||
: ((n = i.Uu), (u = { key: e, latitude: h, longitude: o })), | ||
s.q(n, u) | ||
); | ||
} | ||
au(t, i) { | ||
const e = { group_id: t, status: i }; | ||
return s.N(r.q.Nu, e); | ||
Mn(t, e) { | ||
const h = { group_id: t, status: e }; | ||
return s.q(i._u, h); | ||
} | ||
} |
@@ -1,14 +0,14 @@ | ||
export default class Qt { | ||
export default class Zt { | ||
constructor(t) { | ||
(this.yl = t), (this.yl = t); | ||
(this.Bl = t), (this.Bl = t); | ||
} | ||
Bl(t) { | ||
return null == this.yl || this.yl === t[0]; | ||
Jl(t) { | ||
return null == this.Bl || this.Bl === t[0]; | ||
} | ||
static fromJson(t) { | ||
return new Qt(t ? t.event_name : null); | ||
return new Zt(t ? t.event_name : null); | ||
} | ||
tt() { | ||
return this.yl; | ||
Y() { | ||
return this.Bl; | ||
} | ||
} |
@@ -1,21 +0,21 @@ | ||
import Wt from "./filter-set.js"; | ||
export default class Yt { | ||
import ts from "./filter-set.js"; | ||
export default class is { | ||
constructor(t, s) { | ||
(this.yl = t), (this.Jl = s), (this.yl = t), (this.Jl = s); | ||
(this.Bl = t), (this.Ml = s), (this.Bl = t), (this.Ml = s); | ||
} | ||
Bl(t) { | ||
if (null == this.yl || null == this.Jl) return !1; | ||
Jl(t) { | ||
if (null == this.Bl || null == this.Ml) return !1; | ||
const s = t[0], | ||
i = t[1]; | ||
return s === this.yl && this.Jl.Bl(i); | ||
return s === this.Bl && this.Ml.Jl(i); | ||
} | ||
static fromJson(t) { | ||
return new Yt( | ||
return new is( | ||
t ? t.event_name : null, | ||
t ? Wt.fromJson(t.property_filters) : null, | ||
t ? ts.fromJson(t.property_filters) : null, | ||
); | ||
} | ||
tt() { | ||
return { e: this.yl, pf: this.Jl ? this.Jl.tt() : null }; | ||
Y() { | ||
return { e: this.Bl, pf: this.Ml ? this.Ml.Y() : null }; | ||
} | ||
} |
@@ -1,8 +0,8 @@ | ||
import Zt from "./filter.js"; | ||
import { isArray as p } from "../../util/code-utils.js"; | ||
export default class Wt { | ||
import lr from "./filter.js"; | ||
import { isArray as j } from "../../util/code-utils.js"; | ||
export default class ts { | ||
constructor(t) { | ||
(this.filters = t), (this.filters = t); | ||
} | ||
Bl(t) { | ||
Jl(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].Jl(t)) { | ||
s = !0; | ||
@@ -26,3 +26,3 @@ break; | ||
static fromJson(t) { | ||
if (null == t || !p(t)) return null; | ||
if (null == t || !j(t)) return null; | ||
const r = []; | ||
@@ -32,8 +32,8 @@ for (let e = 0; e < t.length; e++) { | ||
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(lr.fromJson(s[t])); | ||
r.push(o); | ||
} | ||
return new Wt(r); | ||
return new ts(r); | ||
} | ||
tt() { | ||
Y() { | ||
const t = []; | ||
@@ -43,3 +43,3 @@ for (let r = 0; r < this.filters.length; r++) { | ||
o = []; | ||
for (let t = 0; t < e.length; t++) o.push(e[t].tt()); | ||
for (let t = 0; t < e.length; t++) o.push(e[t].Y()); | ||
t.push(o); | ||
@@ -49,3 +49,3 @@ } | ||
} | ||
static Yn(t) { | ||
static En(t) { | ||
const r = []; | ||
@@ -55,7 +55,7 @@ for (let e = 0; e < t.length; e++) { | ||
s = t[e]; | ||
for (let t = 0; t < s.length; t++) o.push(Zt.Yn(s[t])); | ||
for (let t = 0; t < s.length; t++) o.push(lr.En(s[t])); | ||
r.push(o); | ||
} | ||
return new Wt(r); | ||
return new ts(r); | ||
} | ||
} |
@@ -5,6 +5,6 @@ import { isDate as yt } from "../../util/code-utils.js"; | ||
dateFromUnixTimestamp as l, | ||
secondsAgo as ts, | ||
secondsInTheFuture as es, | ||
secondsAgo as es, | ||
secondsInTheFuture as ls, | ||
} from "../../util/date-utils.js"; | ||
export default class Zt { | ||
export default class lr { | ||
constructor(t, s, e, i) { | ||
@@ -19,29 +19,29 @@ (this.Tl = t), | ||
(this._l = i), | ||
this.Al === Zt.Rl.Ml && | ||
this.comparator !== Zt.Il.Ll && | ||
this.comparator !== Zt.Il.Ol && | ||
this.comparator !== Zt.Il.Ul && | ||
this.comparator !== Zt.Il.Ql && | ||
this.Al === lr.Il.Ll && | ||
this.comparator !== lr.Ul.Ol && | ||
this.comparator !== lr.Ul.Ql && | ||
this.comparator !== lr.Ul.Xl && | ||
this.comparator !== lr.Ul.Fl && | ||
(this._l = l(this._l)); | ||
} | ||
Bl(t) { | ||
Jl(t) { | ||
let s = null; | ||
switch ((null != t && (s = t[this.Tl]), this.comparator)) { | ||
case Zt.Il.Xl: | ||
case lr.Ul.Kl: | ||
return null != s && s.valueOf() === this._l.valueOf(); | ||
case Zt.Il.Fl: | ||
case lr.Ul.Pl: | ||
return null == s || s.valueOf() !== this._l.valueOf(); | ||
case Zt.Il.Kl: | ||
case lr.Ul.Yl: | ||
return null != s && typeof s == typeof this._l && s > this._l; | ||
case Zt.Il.Ll: | ||
return this.Al === Zt.Rl.Ml | ||
? null != s && yt(s) && ts(s) <= this._l.valueOf() | ||
case lr.Ul.Ol: | ||
return this.Al === lr.Il.Ll | ||
? null != s && yt(s) && es(s) <= this._l.valueOf() | ||
: null != s && typeof s == typeof this._l && s >= this._l; | ||
case Zt.Il.Pl: | ||
case lr.Ul.Zl: | ||
return null != s && typeof s == typeof this._l && s < this._l; | ||
case Zt.Il.Ol: | ||
return this.Al === Zt.Rl.Ml | ||
? null != s && yt(s) && ts(s) >= this._l.valueOf() | ||
case lr.Ul.Ql: | ||
return this.Al === lr.Il.Ll | ||
? null != s && yt(s) && es(s) >= this._l.valueOf() | ||
: null != s && typeof s == typeof this._l && s <= this._l; | ||
case Zt.Il.Yl: | ||
case lr.Ul.$l: | ||
return ( | ||
@@ -53,11 +53,11 @@ null != s && | ||
); | ||
case Zt.Il.Zl: | ||
case lr.Ul.Eu: | ||
return null != s; | ||
case Zt.Il.$l: | ||
case lr.Ul.Hu: | ||
return null == s; | ||
case Zt.Il.Ul: | ||
return null != s && yt(s) && es(s) < this._l; | ||
case Zt.Il.Ql: | ||
return null != s && yt(s) && es(s) > this._l; | ||
case Zt.Il.Eu: | ||
case lr.Ul.Xl: | ||
return null != s && yt(s) && ls(s) < this._l; | ||
case lr.Ul.Fl: | ||
return null != s && yt(s) && ls(s) > this._l; | ||
case lr.Ul.Qu: | ||
return ( | ||
@@ -73,3 +73,3 @@ null == s || | ||
static fromJson(t) { | ||
return new Zt( | ||
return new lr( | ||
t.property_key, | ||
@@ -81,3 +81,3 @@ t.property_type, | ||
} | ||
tt() { | ||
Y() { | ||
let t = this._l; | ||
@@ -89,20 +89,20 @@ return ( | ||
} | ||
static Yn(t) { | ||
return new Zt(t.k, t.t, t.c, t.v); | ||
static En(t) { | ||
return new lr(t.k, t.t, t.c, t.v); | ||
} | ||
} | ||
(Zt.Rl = { _u: "boolean", Hu: "number", Iu: "string", Ml: "date" }), | ||
(Zt.Il = { | ||
Xl: 1, | ||
Fl: 2, | ||
Kl: 3, | ||
Ll: 4, | ||
Pl: 5, | ||
Ol: 6, | ||
Yl: 10, | ||
Zl: 11, | ||
$l: 12, | ||
Ul: 15, | ||
Ql: 16, | ||
Eu: 17, | ||
(lr.Il = { Xu: "boolean", Bu: "number", Gu: "string", Ll: "date" }), | ||
(lr.Ul = { | ||
Kl: 1, | ||
Pl: 2, | ||
Yl: 3, | ||
Ol: 4, | ||
Zl: 5, | ||
Ql: 6, | ||
$l: 10, | ||
Eu: 11, | ||
Hu: 12, | ||
Xl: 15, | ||
Fl: 16, | ||
Qu: 17, | ||
}); |
import ri from "./trigger-condition.js"; | ||
export default class si { | ||
export default class ni { | ||
constructor(t, i) { | ||
(this.xu = t), (this.zu = i), (this.xu = t), (this.zu = i); | ||
(this.zu = t), (this.Ju = i), (this.zu = t), (this.Ju = i); | ||
} | ||
Bl(t) { | ||
if (null == this.xu) return !1; | ||
const i = ri.Bu(t[0], this.xu); | ||
Jl(t) { | ||
if (null == this.zu) return !1; | ||
const i = ri.Ku(t[0], this.zu); | ||
if (!i) return !1; | ||
let r = null == this.zu || 0 === this.zu.length; | ||
if (null != this.zu) | ||
for (let i = 0; i < this.zu.length; i++) | ||
if (this.zu[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; | ||
@@ -20,7 +20,7 @@ break; | ||
static fromJson(t) { | ||
return new si(t ? t.id : null, t ? t.buttons : null); | ||
return new ni(t ? t.id : null, t ? t.buttons : null); | ||
} | ||
tt() { | ||
return this.xu; | ||
Y() { | ||
return this.zu; | ||
} | ||
} |
@@ -5,3 +5,3 @@ export default class rs { | ||
} | ||
Bl(t) { | ||
Jl(t) { | ||
return null == this.productId || t[0] === this.productId; | ||
@@ -12,5 +12,5 @@ } | ||
} | ||
tt() { | ||
Y() { | ||
return this.productId; | ||
} | ||
} |
@@ -1,21 +0,21 @@ | ||
import Wt from "./filter-set.js"; | ||
export default class is { | ||
import ts from "./filter-set.js"; | ||
export default class ns { | ||
constructor(t, s) { | ||
(this.productId = t), (this.Jl = s), (this.productId = t), (this.Jl = s); | ||
(this.productId = t), (this.Ml = s), (this.productId = t), (this.Ml = s); | ||
} | ||
Bl(t) { | ||
if (null == this.productId || null == this.Jl) return !1; | ||
Jl(t) { | ||
if (null == this.productId || null == this.Ml) return !1; | ||
const s = t[0], | ||
i = t[1]; | ||
return s === this.productId && this.Jl.Bl(i); | ||
return s === this.productId && this.Ml.Jl(i); | ||
} | ||
static fromJson(t) { | ||
return new is( | ||
return new ns( | ||
t ? t.product_id : null, | ||
t ? Wt.fromJson(t.property_filters) : null, | ||
t ? ts.fromJson(t.property_filters) : null, | ||
); | ||
} | ||
tt() { | ||
return { id: this.productId, pf: this.Jl ? this.Jl.tt() : null }; | ||
Y() { | ||
return { id: this.productId, pf: this.Ml ? this.Ml.Y() : null }; | ||
} | ||
} |
import ri from "./trigger-condition.js"; | ||
export default class sr { | ||
export default class ur { | ||
constructor(t) { | ||
(this.xu = t), (this.xu = t); | ||
(this.zu = t), (this.zu = t); | ||
} | ||
Bl(t) { | ||
return null == this.xu || ri.Bu(t[0], this.xu); | ||
Jl(t) { | ||
return null == this.zu || ri.Ku(t[0], this.zu); | ||
} | ||
static fromJson(t) { | ||
return new sr(t ? t.campaign_id : null); | ||
return new ur(t ? t.campaign_id : null); | ||
} | ||
tt() { | ||
return this.xu; | ||
Y() { | ||
return this.zu; | ||
} | ||
} |
@@ -1,11 +0,11 @@ | ||
import Qt from "./custom-event-data.js"; | ||
import Yt from "./custom-event-property-data.js"; | ||
import Wt from "./filter-set.js"; | ||
import si from "./in-app-message-click-data.js"; | ||
import Zt from "./custom-event-data.js"; | ||
import is from "./custom-event-property-data.js"; | ||
import ts from "./filter-set.js"; | ||
import ni from "./in-app-message-click-data.js"; | ||
import rs from "./purchase-data.js"; | ||
import is from "./purchase-property-data.js"; | ||
import sr from "./push-click-data.js"; | ||
import ns from "./purchase-property-data.js"; | ||
import ur from "./push-click-data.js"; | ||
import tt from "./trigger-events.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { getErrorMessage as ei } from "../../util/error-utils.js"; | ||
import { logger as r } from "../../../shared-lib/index.js"; | ||
import { getErrorMessage as si } from "../../util/error-utils.js"; | ||
export default class ri { | ||
@@ -15,6 +15,6 @@ constructor(e, t) { | ||
} | ||
ec(e, t) { | ||
return ri.rc[this.type] === e && (null == this.data || this.data.Bl(t)); | ||
sc(e, t) { | ||
return ri.cc[this.type] === e && (null == this.data || this.data.Jl(t)); | ||
} | ||
static Bu(e, t) { | ||
static Ku(e, t) { | ||
let s = null; | ||
@@ -24,5 +24,3 @@ try { | ||
} catch (t) { | ||
return ( | ||
r.j.info("Failed to unencode analytics id " + e + ": " + ei(t)), !1 | ||
); | ||
return r.info("Failed to unencode analytics id " + e + ": " + si(t)), !1; | ||
} | ||
@@ -35,52 +33,52 @@ return t === s.split("_")[0]; | ||
switch (t) { | ||
case ri.Wr.OPEN: | ||
case ri.Wr.vt: | ||
case ri.Kr.OPEN: | ||
case ri.Kr.kt: | ||
break; | ||
case ri.Wr.Rr: | ||
case ri.Kr.Rr: | ||
r = rs.fromJson(e.data); | ||
break; | ||
case ri.Wr.sc: | ||
r = is.fromJson(e.data); | ||
case ri.Kr.nc: | ||
r = ns.fromJson(e.data); | ||
break; | ||
case ri.Wr.zr: | ||
r = sr.fromJson(e.data); | ||
case ri.Kr.vr: | ||
r = ur.fromJson(e.data); | ||
break; | ||
case ri.Wr.$e: | ||
r = Qt.fromJson(e.data); | ||
case ri.Kr.ue: | ||
r = Zt.fromJson(e.data); | ||
break; | ||
case ri.Wr.ac: | ||
r = Yt.fromJson(e.data); | ||
case ri.Kr.lc: | ||
r = is.fromJson(e.data); | ||
break; | ||
case ri.Wr.ro: | ||
r = si.fromJson(e.data); | ||
case ri.Kr.mo: | ||
r = ni.fromJson(e.data); | ||
} | ||
return new ri(t, r); | ||
} | ||
tt() { | ||
return { t: this.type, d: this.data ? this.data.tt() : null }; | ||
Y() { | ||
return { t: this.type, d: this.data ? this.data.Y() : null }; | ||
} | ||
static Yn(e) { | ||
static En(e) { | ||
let t, | ||
r = null; | ||
switch (e.t) { | ||
case ri.Wr.OPEN: | ||
case ri.Wr.vt: | ||
case ri.Kr.OPEN: | ||
case ri.Kr.kt: | ||
break; | ||
case ri.Wr.Rr: | ||
case ri.Kr.Rr: | ||
r = new rs(e.d); | ||
break; | ||
case ri.Wr.sc: | ||
(t = e.d || {}), (r = new is(t.id, Wt.Yn(t.pf || []))); | ||
case ri.Kr.nc: | ||
(t = e.d || {}), (r = new ns(t.id, ts.En(t.pf || []))); | ||
break; | ||
case ri.Wr.zr: | ||
r = new sr(e.d); | ||
case ri.Kr.vr: | ||
r = new ur(e.d); | ||
break; | ||
case ri.Wr.$e: | ||
r = new Qt(e.d); | ||
case ri.Kr.ue: | ||
r = new Zt(e.d); | ||
break; | ||
case ri.Wr.ac: | ||
(t = e.d || {}), (r = new Yt(t.e, Wt.Yn(t.pf || []))); | ||
case ri.Kr.lc: | ||
(t = e.d || {}), (r = new is(t.e, ts.En(t.pf || []))); | ||
break; | ||
case ri.Wr.ro: | ||
r = new si(e.d); | ||
case ri.Kr.mo: | ||
r = new ni(e.d); | ||
} | ||
@@ -90,20 +88,20 @@ return new ri(e.t, r); | ||
} | ||
(ri.Wr = { | ||
(ri.Kr = { | ||
OPEN: "open", | ||
Rr: "purchase", | ||
sc: "purchase_property", | ||
zr: "push_click", | ||
$e: "custom_event", | ||
ac: "custom_event_property", | ||
ro: "iam_click", | ||
vt: "test", | ||
nc: "purchase_property", | ||
vr: "push_click", | ||
ue: "custom_event", | ||
lc: "custom_event_property", | ||
mo: "iam_click", | ||
kt: "test", | ||
}), | ||
(ri.rc = {}), | ||
(ri.rc[ri.Wr.OPEN] = tt.OPEN), | ||
(ri.rc[ri.Wr.Rr] = tt.Rr), | ||
(ri.rc[ri.Wr.sc] = tt.Rr), | ||
(ri.rc[ri.Wr.zr] = tt.zr), | ||
(ri.rc[ri.Wr.$e] = tt.$e), | ||
(ri.rc[ri.Wr.ac] = tt.$e), | ||
(ri.rc[ri.Wr.ro] = tt.ro), | ||
(ri.rc[ri.Wr.vt] = tt.vt); | ||
(ri.cc = {}), | ||
(ri.cc[ri.Kr.OPEN] = tt.OPEN), | ||
(ri.cc[ri.Kr.Rr] = tt.Rr), | ||
(ri.cc[ri.Kr.nc] = tt.Rr), | ||
(ri.cc[ri.Kr.vr] = tt.vr), | ||
(ri.cc[ri.Kr.ue] = tt.ue), | ||
(ri.cc[ri.Kr.lc] = tt.ue), | ||
(ri.cc[ri.Kr.mo] = tt.mo), | ||
(ri.cc[ri.Kr.kt] = tt.kt); |
export default { | ||
OPEN: "open", | ||
Rr: "purchase", | ||
zr: "push_click", | ||
$e: "custom_event", | ||
ro: "iam_click", | ||
vt: "test", | ||
vr: "push_click", | ||
ue: "custom_event", | ||
mo: "iam_click", | ||
kt: "test", | ||
}; |
@@ -5,9 +5,9 @@ import { | ||
} from "../../util/date-utils.js"; | ||
import r from "../../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../../shared-lib/index.js"; | ||
import ri from "./trigger-condition.js"; | ||
import { validateValueIsFromEnum as G } from "../../util/code-utils.js"; | ||
import { validateValueIsFromEnum as J } from "../../util/code-utils.js"; | ||
export default class pt { | ||
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = pt.Ju, a, u, d) { | ||
constructor(t, i = [], s, e, r = 0, h, l, o = 0, n = pt.Vu, a, u, d) { | ||
(this.id = t), | ||
(this.Vu = i), | ||
(this.Wu = i), | ||
(this.startTime = s), | ||
@@ -18,9 +18,9 @@ (this.endTime = e), | ||
(this.data = l), | ||
(this.Gu = o), | ||
(this.Ku = n), | ||
(this.sn = a), | ||
(this.Ou = u), | ||
(this.Qu = d), | ||
(this.Yu = o), | ||
(this.Zu = n), | ||
(this.Vr = a), | ||
(this.td = u), | ||
(this.sd = d), | ||
(this.id = t), | ||
(this.Vu = i || []), | ||
(this.Wu = i || []), | ||
void 0 === s && (s = null), | ||
@@ -32,29 +32,29 @@ (this.startTime = s), | ||
(this.type = h), | ||
(this.Gu = o || 0), | ||
null == a && (a = 1e3 * (this.Gu + 30)), | ||
(this.sn = a), | ||
(this.Yu = o || 0), | ||
null == a && (a = 1e3 * (this.Yu + 30)), | ||
(this.Vr = a), | ||
(this.data = l), | ||
null != n && (this.Ku = n), | ||
(this.Ou = u), | ||
(this.Qu = d || null); | ||
null != n && (this.Zu = n), | ||
(this.td = u), | ||
(this.sd = d || null); | ||
} | ||
Uu(t) { | ||
ed(t) { | ||
return ( | ||
null == this.Qu || (this.Ku !== pt.Ju && t - this.Qu >= 1e3 * this.Ku) | ||
null == this.sd || (this.Zu !== pt.Vu && t - this.sd >= 1e3 * this.Zu) | ||
); | ||
} | ||
Wu(t) { | ||
this.Qu = t; | ||
rd(t) { | ||
this.sd = t; | ||
} | ||
Xu(t) { | ||
const i = t + 1e3 * this.Gu; | ||
hd(t) { | ||
const i = t + 1e3 * this.Yu; | ||
return Math.max(i - new Date().valueOf(), 0); | ||
} | ||
Yu(t) { | ||
od(t) { | ||
const i = new Date().valueOf() - t, | ||
s = null == t || isNaN(i) || null == this.sn || i < this.sn; | ||
s = null == t || isNaN(i) || null == this.Vr || i < this.Vr; | ||
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.sn}ms.`, | ||
r.info( | ||
`Trigger action ${this.type} is no longer eligible for display - fired ${i}ms ago and has a timeout of ${this.Vr}ms.`, | ||
), | ||
@@ -78,4 +78,4 @@ !s | ||
m = t.min_seconds_since_last_trigger; | ||
return G( | ||
pt.Wr, | ||
return J( | ||
pt.Kr, | ||
o, | ||
@@ -88,5 +88,5 @@ "Could not construct Trigger from server data", | ||
} | ||
tt() { | ||
Y() { | ||
const t = []; | ||
for (let i = 0; i < this.Vu.length; i++) t.push(this.Vu[i].tt()); | ||
for (let i = 0; i < this.Wu.length; i++) t.push(this.Wu[i].Y()); | ||
return { | ||
@@ -100,13 +100,13 @@ i: this.id, | ||
da: this.data, | ||
d: this.Gu, | ||
r: this.Ku, | ||
tm: this.sn, | ||
ss: this.Ou, | ||
ld: this.Qu, | ||
d: this.Yu, | ||
r: this.Zu, | ||
tm: this.Vr, | ||
ss: this.td, | ||
ld: this.sd, | ||
}; | ||
} | ||
static Yn(t) { | ||
static En(t) { | ||
const i = [], | ||
s = t.c || []; | ||
for (let t = 0; t < s.length; t++) i.push(ri.Yn(s[t])); | ||
for (let t = 0; t < s.length; t++) i.push(ri.En(s[t])); | ||
return new pt( | ||
@@ -128,2 +128,2 @@ t.i, | ||
} | ||
(pt.Wr = { Vr: "inapp", Zu: "templated_iam" }), (pt.Ju = -1); | ||
(pt.Kr = { Jr: "inapp", nd: "templated_iam" }), (pt.Vu = -1); |
@@ -7,3 +7,3 @@ import se from "../InAppMessage/in-app-message-manager-factory.js"; | ||
provider: null, | ||
er: () => ( | ||
rr: () => ( | ||
TriggersProviderFactory.o(), | ||
@@ -15,6 +15,6 @@ TriggersProviderFactory.provider || TriggersProviderFactory.rg(), | ||
if (!TriggersProviderFactory.provider) { | ||
const r = e.nn(L.No); | ||
const r = e.nn(L.Po); | ||
(TriggersProviderFactory.provider = new gr( | ||
null != r ? r : 30, | ||
se.m().Ze(), | ||
se.m().He(), | ||
e.l(), | ||
@@ -24,3 +24,3 @@ e.cr(), | ||
)), | ||
e.dr(TriggersProviderFactory.provider); | ||
e.ar(TriggersProviderFactory.provider); | ||
} | ||
@@ -27,0 +27,0 @@ }, |
@@ -6,11 +6,11 @@ import y from "../common/base-provider.js"; | ||
import { | ||
isArray as p, | ||
isArray as j, | ||
isEqual as ii, | ||
validateValueIsFromEnum as G, | ||
validateValueIsFromEnum as J, | ||
} from "../util/code-utils.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import wt from "../InAppMessage/models/templated-in-app-message.js"; | ||
import pt from "./models/trigger.js"; | ||
import tt from "./models/trigger-events.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export default class gr extends y { | ||
@@ -20,10 +20,10 @@ constructor(t, i, s, e, r) { | ||
(this.tg = t), | ||
(this.Bt = i), | ||
(this.Jt = i), | ||
(this.u = s), | ||
(this.ki = e), | ||
(this.Ei = e), | ||
(this.ig = r), | ||
(this.tg = t), | ||
(this.Bt = i), | ||
(this.Jt = i), | ||
(this.u = s), | ||
(this.ki = e), | ||
(this.Ei = e), | ||
(this.ig = r), | ||
@@ -42,8 +42,8 @@ (this.sg = []), | ||
if (this.u) { | ||
(this.hg = this.u.v(i.k.iE) || this.hg), | ||
(this.ng = this.u.v(i.k.aE) || this.ng), | ||
(this.og = this.u.v(i.k.nE) || this.og); | ||
(this.hg = this.u.j(o.C.aE) || this.hg), | ||
(this.ng = this.u.j(o.C.iE) || this.ng), | ||
(this.og = this.u.j(o.C.nE) || this.og); | ||
for (let t = 0; t < this.triggers.length; t++) { | ||
const i = this.triggers[t]; | ||
i.id && null != this.og[i.id] && i.Wu(this.og[i.id]); | ||
i.id && null != this.og[i.id] && i.rd(this.og[i.id]); | ||
} | ||
@@ -54,11 +54,11 @@ } | ||
if (!this.u) return; | ||
this.ag = this.u.v(i.k.oE) || 0; | ||
const t = this.u.v(i.k.rE) || [], | ||
s = []; | ||
for (let i = 0; i < t.length; i++) s.push(pt.Yn(t[i])); | ||
(this.triggers = s), this.fg(); | ||
this.ag = this.u.j(o.C.oE) || 0; | ||
const t = this.u.j(o.C.rE) || [], | ||
i = []; | ||
for (let s = 0; s < t.length; s++) i.push(pt.En(t[s])); | ||
(this.triggers = i), this.fg(); | ||
} | ||
gg() { | ||
const t = this, | ||
s = function (i, s, e, r, h) { | ||
i = function (i, s, e, r, h) { | ||
return function () { | ||
@@ -68,34 +68,34 @@ t.cg(i, s, e, r, h); | ||
}, | ||
e = {}; | ||
for (const t of this.triggers) t.id && (e[t.id] = t); | ||
let r = !1; | ||
s = {}; | ||
for (const t of this.triggers) t.id && (s[t.id] = t); | ||
let e = !1; | ||
for (let t = 0; t < this.triggers.length; t++) { | ||
const i = this.triggers[t]; | ||
if (i.id && null != this.ng[i.id]) { | ||
const t = this.ng[i.id], | ||
const r = this.triggers[t]; | ||
if (r.id && null != this.ng[r.id]) { | ||
const t = this.ng[r.id], | ||
h = []; | ||
for (let r = 0; r < t.length; r++) { | ||
const n = t[r], | ||
o = i.Xu(n.Zr || 0); | ||
for (let e = 0; e < t.length; e++) { | ||
const n = t[e], | ||
o = r.hd(n.Ur || 0); | ||
if (o > 0) { | ||
let t, r; | ||
let t, e; | ||
h.push(n), | ||
null != n.ug && (t = n.ug), | ||
null != n.dg && ue.TE(n.dg) && (r = ue.Yn(n.dg)); | ||
null != n.dg && ue.cE(n.dg) && (e = ue.En(n.dg)); | ||
const a = []; | ||
if (n.pg && p(n.pg)) | ||
if (n.pg && j(n.pg)) | ||
for (let t = 0; t < n.pg.length; t++) { | ||
const i = e[n.pg[t]]; | ||
const i = s[n.pg[t]]; | ||
null != i && a.push(i); | ||
} | ||
this.eg.push(window.setTimeout(s(i, n.Zr || 0, t, r, a), o)); | ||
this.eg.push(window.setTimeout(i(r, n.Ur || 0, t, e, a), o)); | ||
} | ||
} | ||
this.ng[i.id].length > h.length && | ||
((this.ng[i.id] = h), | ||
(r = !0), | ||
0 === this.ng[i.id].length && delete this.ng[i.id]); | ||
this.ng[r.id].length > h.length && | ||
((this.ng[r.id] = h), | ||
(e = !0), | ||
0 === this.ng[r.id].length && delete this.ng[r.id]); | ||
} | ||
} | ||
r && this.u && this.u.D(i.k.aE, this.ng); | ||
e && this.u && this.u.k(o.C.iE, this.ng); | ||
} | ||
@@ -105,46 +105,45 @@ mg() { | ||
const t = []; | ||
for (let i = 0; i < this.triggers.length; i++) | ||
t.push(this.triggers[i].tt()); | ||
for (let i = 0; i < this.triggers.length; i++) t.push(this.triggers[i].Y()); | ||
(this.ag = new Date().valueOf()), | ||
this.u.D(i.k.rE, t), | ||
this.u.D(i.k.oE, this.ag); | ||
this.u.k(o.C.rE, t), | ||
this.u.k(o.C.oE, this.ag); | ||
} | ||
bg() { | ||
if (!this.u) return; | ||
(this.u.v(i.k.oE) || 0) > this.ag ? this.lg() : this.fg(); | ||
(this.u.j(o.C.oE) || 0) > this.ag ? this.lg() : this.fg(); | ||
} | ||
Ss(t) { | ||
let s = !1; | ||
Rs(t) { | ||
let i = !1; | ||
if (null != t && t.triggers) { | ||
this.ig.mn(), this.fg(); | ||
const e = {}, | ||
h = {}; | ||
this.ig.on(), this.fg(); | ||
const s = {}, | ||
e = {}; | ||
this.triggers = []; | ||
for (let i = 0; i < t.triggers.length; i++) { | ||
const r = pt.fromJson(t.triggers[i]); | ||
if (r) { | ||
r.id && | ||
null != this.og[r.id] && | ||
(r.Wu(this.og[r.id]), (e[r.id] = this.og[r.id])), | ||
r.id && null != this.ng[r.id] && (h[r.id] = this.ng[r.id]); | ||
for (let t = 0; t < r.Vu.length; t++) | ||
if (r.Vu[t].ec(tt.vt, null)) { | ||
s = !0; | ||
for (let r = 0; r < t.triggers.length; r++) { | ||
const h = pt.fromJson(t.triggers[r]); | ||
if (h) { | ||
h.id && | ||
null != this.og[h.id] && | ||
(h.rd(this.og[h.id]), (s[h.id] = this.og[h.id])), | ||
h.id && null != this.ng[h.id] && (e[h.id] = this.ng[h.id]); | ||
for (let t = 0; t < h.Wu.length; t++) | ||
if (h.Wu[t].sc(tt.kt, null)) { | ||
i = !0; | ||
break; | ||
} | ||
this.triggers.push(r); | ||
this.triggers.push(h); | ||
} | ||
} | ||
ii(this.og, e) || ((this.og = e), this.u && this.u.D(i.k.nE, this.og)), | ||
ii(this.ng, h) || ((this.ng = h), this.u && this.u.D(i.k.aE, this.ng)), | ||
ii(this.og, s) || ((this.og = s), this.u && this.u.k(o.C.nE, this.og)), | ||
ii(this.ng, e) || ((this.ng = e), this.u && this.u.k(o.C.iE, this.ng)), | ||
this.mg(), | ||
s && | ||
(r.j.info("Trigger with test condition found, firing test."), | ||
this.be(tt.vt)), | ||
this.be(tt.OPEN); | ||
const n = this.sg; | ||
let o; | ||
i && | ||
(r.info("Trigger with test condition found, firing test."), | ||
this.fe(tt.kt)), | ||
this.fe(tt.OPEN); | ||
const h = this.sg; | ||
let n; | ||
this.sg = []; | ||
for (let t = 0; t < n.length; t++) | ||
(o = Array.prototype.slice.call(n[t])), this.be(...o); | ||
for (let t = 0; t < h.length; t++) | ||
(n = Array.prototype.slice.call(h[t])), this.fe(...n); | ||
} | ||
@@ -156,20 +155,20 @@ } | ||
const h = new Date().valueOf(); | ||
if (!t.Yu(i)) | ||
return !1 === navigator.onLine && t.type === pt.Wr.Vr && e.imageUrl | ||
? (r.j.info( | ||
if (!t.od(i)) | ||
return !1 === navigator.onLine && t.type === pt.Kr.Jr && e.imageUrl | ||
? (r.info( | ||
`Not showing ${t.type} trigger action ${t.id} due to offline state.`, | ||
), | ||
void this.ig.Ji(t.id, InAppMessage.Ie.Uh)) | ||
: void (t.Uu(h) && this.wg(t, h, s) | ||
? 0 === this.Bt.tc() | ||
? r.j.info( | ||
void this.ig.Ve(t.id, InAppMessage.Me.Uh)) | ||
: void (t.ed(h) && this.wg(t, h, s) | ||
? 0 === this.Jt.ic() | ||
? r.info( | ||
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`, | ||
) | ||
: (this.Bt.Dt([e]), this.yg(t, h)) | ||
: r.j.info( | ||
: (this.Jt.Dt([e]), this.yg(t, h)) | ||
: r.info( | ||
`Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`, | ||
)); | ||
t.type === pt.Wr.Zu | ||
? this.ig.Ji(t.id, InAppMessage.Ie.Qr) | ||
: this.ig.Ji(t.id, InAppMessage.Ie.bh); | ||
t.type === pt.Kr.nd | ||
? this.ig.Ve(t.id, InAppMessage.Me.Or) | ||
: this.ig.Ve(t.id, InAppMessage.Me.bh); | ||
}, | ||
@@ -180,13 +179,13 @@ o = () => { | ||
if (null != n) | ||
if ((this.Tg(n, i, s, e, h), n.Yu(i))) { | ||
if ((this.Tg(n, i, s, e, h), n.od(i))) { | ||
let t = `Server aborted in-app message display, but the timeout on fallback trigger ${n.id} has already elapsed.`; | ||
h.length > 0 && (t += " Continuing to fall back."), | ||
r.j.info(t), | ||
this.ig.Ji(n.id, InAppMessage.Ie.bh), | ||
r.info(t), | ||
this.ig.Ve(n.id, InAppMessage.Me.bh), | ||
o(); | ||
} else { | ||
r.j.info( | ||
r.info( | ||
`Server aborted in-app message display. Falling back to lower priority ${n.type} trigger action ${t.id}.`, | ||
); | ||
const o = 1e3 * n.Gu - (new Date().valueOf() - i); | ||
const o = 1e3 * n.Yu - (new Date().valueOf() - i); | ||
o > 0 | ||
@@ -203,12 +202,12 @@ ? this.eg.push( | ||
switch (t.type) { | ||
case pt.Wr.Vr: | ||
case pt.Kr.Jr: | ||
if (((a = lt(t.data)), null == a)) { | ||
r.j.error( | ||
r.error( | ||
`Could not parse trigger data for trigger ${t.id}, ignoring.`, | ||
), | ||
this.ig.Ji(t.id, InAppMessage.Ie.Xr); | ||
this.ig.Ve(t.id, InAppMessage.Me.Lr); | ||
break; | ||
} | ||
if (((l = this.ig.Mr(a)), l)) { | ||
r.j.error(l), o(); | ||
if (((l = this.ig.Wi(a)), l)) { | ||
r.error(l), o(); | ||
break; | ||
@@ -218,24 +217,22 @@ } | ||
break; | ||
case pt.Wr.Zu: | ||
if (((g = wt.fromJson(t.data, n, o, i, t.sn || 0)), null == g)) { | ||
r.j.error( | ||
case pt.Kr.nd: | ||
if (((g = wt.fromJson(t.data, n, o, i, t.Vr || 0)), null == g)) { | ||
r.error( | ||
`Could not parse trigger data for trigger ${t.id}, ignoring.`, | ||
), | ||
this.ig.Ji(t.id, InAppMessage.Ie.Xr); | ||
this.ig.Ve(t.id, InAppMessage.Me.Lr); | ||
break; | ||
} | ||
this.ig.Hr(g, s, e); | ||
this.ig.Mr(g, s, e); | ||
break; | ||
default: | ||
r.j.error( | ||
`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`, | ||
), | ||
this.ig.Ji(t.id, InAppMessage.Ie.Xr); | ||
r.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`), | ||
this.ig.Ve(t.id, InAppMessage.Me.Lr); | ||
} | ||
} | ||
be(t, i = null, s) { | ||
if (!G(tt, t, "Cannot fire trigger action.", "TriggerEvents")) return; | ||
if (this.ki && this.ki.Du()) | ||
fe(t, i = null, s) { | ||
if (!J(tt, t, "Cannot fire trigger action.", "TriggerEvents")) return; | ||
if (this.Ei && this.Ei.Lu()) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event.", | ||
@@ -253,5 +250,5 @@ ), | ||
const r = this.triggers[s], | ||
h = e + 1e3 * r.Gu; | ||
h = e + 1e3 * r.Yu; | ||
if ( | ||
r.Uu(h) && | ||
r.ed(h) && | ||
(null == r.startTime || r.startTime.valueOf() <= e) && | ||
@@ -261,4 +258,4 @@ (null == r.endTime || r.endTime.valueOf() >= e) | ||
let s = !1; | ||
for (let e = 0; e < r.Vu.length; e++) | ||
if (r.Vu[e].ec(t, i)) { | ||
for (let e = 0; e < r.Wu.length; e++) | ||
if (r.Wu[e].sc(t, i)) { | ||
s = !0; | ||
@@ -271,7 +268,7 @@ break; | ||
if (n) | ||
return void r.j.info( | ||
return void r.info( | ||
`Trigger event ${t} did not match any trigger conditions.`, | ||
); | ||
if (o) | ||
return void r.j.info( | ||
return void r.info( | ||
`Ignoring ${t} trigger event because a trigger was displayed ${ | ||
@@ -284,7 +281,7 @@ h / 1e3 | ||
null != l && | ||
(r.j.info( | ||
(r.info( | ||
`Firing ${l.type} trigger action ${l.id} from trigger event ${t}.`, | ||
), | ||
this.Tg(l, e, t, s, a), | ||
0 === l.Gu | ||
0 === l.Yu | ||
? this.cg(l, e, t, s, a) | ||
@@ -294,11 +291,11 @@ : this.eg.push( | ||
this.cg(l, e, t, s, a); | ||
}, 1e3 * l.Gu), | ||
}, 1e3 * l.Yu), | ||
)); | ||
} | ||
changeUser(t = !1) { | ||
if (((this.triggers = []), this.u && this.u.ni(i.k.rE), !t)) { | ||
if (((this.triggers = []), this.u && this.u.hi(o.C.rE), !t)) { | ||
(this.sg = []), (this.hg = null), (this.og = {}), (this.ng = {}); | ||
for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]); | ||
(this.eg = []), | ||
this.u && (this.u.ni(i.k.iE), this.u.ni(i.k.nE), this.u.ni(i.k.aE)); | ||
this.u && (this.u.hi(o.C.aE), this.u.hi(o.C.nE), this.u.hi(o.C.iE)); | ||
} | ||
@@ -313,5 +310,5 @@ } | ||
if (null == this.hg) return !0; | ||
if (s === tt.vt) | ||
if (s === tt.kt) | ||
return ( | ||
r.j.info( | ||
r.info( | ||
"Ignoring minimum interval between trigger because it is a test type.", | ||
@@ -321,23 +318,23 @@ ), | ||
); | ||
let e = t.Ou; | ||
let e = t.td; | ||
return null == e && (e = this.tg), i - this.hg >= 1e3 * e; | ||
} | ||
Tg(t, s, e, r, h) { | ||
Tg(t, i, s, e, r) { | ||
this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []); | ||
const n = {}; | ||
let o; | ||
(n.Zr = s), (n.ug = e), null != r && (o = r.tt()), (n.dg = o); | ||
const h = {}; | ||
let n; | ||
(h.Ur = i), (h.ug = s), null != e && (n = e.Y()), (h.dg = n); | ||
const a = []; | ||
for (const t of h) t.id && a.push(t.id); | ||
(n.pg = a), | ||
t.id && this.ng[t.id].push(n), | ||
this.u && this.u.D(i.k.aE, this.ng); | ||
for (const t of r) t.id && a.push(t.id); | ||
(h.pg = a), | ||
t.id && this.ng[t.id].push(h), | ||
this.u && this.u.k(o.C.iE, this.ng); | ||
} | ||
yg(t, s) { | ||
yg(t, i) { | ||
this.fg(), | ||
t.Wu(s), | ||
(this.hg = s), | ||
t.id && (this.og[t.id] = s), | ||
this.u && (this.u.D(i.k.iE, s), this.u.D(i.k.nE, this.og)); | ||
t.rd(i), | ||
(this.hg = i), | ||
t.id && (this.og[t.id] = i), | ||
this.u && (this.u.k(o.C.aE, i), this.u.k(o.C.nE, this.og)); | ||
} | ||
} |
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-${"5.0.1".replace(/\./g, "-")}`; | ||
s = `ab-${t}-css-definitions-${"5.1.0".replace(/\./g, "-")}`; | ||
if (!c) return; | ||
@@ -10,5 +10,5 @@ const a = c.ownerDocument || document; | ||
(n.innerHTML = o || ""), (n.id = s); | ||
const t = e.nn(L.po); | ||
const t = e.nn(L.wo); | ||
null != t && n.setAttribute("nonce", t), c.appendChild(n); | ||
} | ||
} |
@@ -7,3 +7,3 @@ import { attachCSS as Ce } from "./attach-css.js"; | ||
"iam", | ||
".ab-pause-scrolling,body.ab-pause-scrolling,html.ab-pause-scrolling{overflow:hidden;touch-action:none}.ab-iam-root.v3{position:fixed;top:0;right:0;bottom:0;left:0;pointer-events:none;z-index:9011;-webkit-tap-highlight-color:transparent}.ab-iam-root.v3:focus{outline:0}.ab-iam-root.v3.ab-effect-fullscreen,.ab-iam-root.v3.ab-effect-html,.ab-iam-root.v3.ab-effect-modal{opacity:0}.ab-iam-root.v3.ab-effect-fullscreen.ab-show,.ab-iam-root.v3.ab-effect-html.ab-show,.ab-iam-root.v3.ab-effect-modal.ab-show{opacity:1}.ab-iam-root.v3.ab-effect-fullscreen.ab-show.ab-animate-in,.ab-iam-root.v3.ab-effect-html.ab-show.ab-animate-in,.ab-iam-root.v3.ab-effect-modal.ab-show.ab-animate-in{-webkit-transition:opacity .5s;-moz-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s}.ab-iam-root.v3.ab-effect-fullscreen.ab-hide,.ab-iam-root.v3.ab-effect-html.ab-hide,.ab-iam-root.v3.ab-effect-modal.ab-hide{opacity:0}.ab-iam-root.v3.ab-effect-fullscreen.ab-hide.ab-animate-out,.ab-iam-root.v3.ab-effect-html.ab-hide.ab-animate-out,.ab-iam-root.v3.ab-effect-modal.ab-hide.ab-animate-out{-webkit-transition:opacity .5s;-moz-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s}.ab-iam-root.v3.ab-effect-slide .ab-in-app-message{-webkit-transform:translateX(535px);-moz-transform:translateX(535px);-ms-transform:translateX(535px);transform:translateX(535px)}.ab-iam-root.v3.ab-effect-slide.ab-show .ab-in-app-message{-webkit-transform:translateX(0);-moz-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.ab-iam-root.v3.ab-effect-slide.ab-show.ab-animate-in .ab-in-app-message{-webkit-transition:transform .5s ease-in-out;-moz-transition:transform .5s ease-in-out;-o-transition:transform .5s ease-in-out;transition:transform .5s ease-in-out}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message{-webkit-transform:translateX(535px);-moz-transform:translateX(535px);-ms-transform:translateX(535px);transform:translateX(535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message.ab-swiped-left{-webkit-transform:translateX(-535px);-moz-transform:translateX(-535px);-ms-transform:translateX(-535px);transform:translateX(-535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message.ab-swiped-up{-webkit-transform:translateY(-535px);-moz-transform:translateY(-535px);-ms-transform:translateY(-535px);transform:translateY(-535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message.ab-swiped-down{-webkit-transform:translateY(535px);-moz-transform:translateY(535px);-ms-transform:translateY(535px);transform:translateY(535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide.ab-animate-out .ab-in-app-message{-webkit-transition:transform .5s ease-in-out;-moz-transition:transform .5s ease-in-out;-o-transition:transform .5s ease-in-out;transition:transform .5s ease-in-out}.ab-iam-root.v3 .ab-ios-scroll-wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;pointer-events:all;touch-action:auto;-webkit-overflow-scrolling:touch}.ab-iam-root.v3 .ab-in-app-message{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:fixed;text-align:center;-webkit-box-shadow:0 0 4px rgba(0,0,0,.3);-moz-box-shadow:0 0 4px rgba(0,0,0,.3);box-shadow:0 0 4px rgba(0,0,0,.3);line-height:normal;letter-spacing:normal;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;z-index:9011;max-width:100%;overflow:hidden;display:inline-block;pointer-events:all;color:#333}.ab-iam-root.v3 .ab-in-app-message.ab-no-shadow{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.ab-iam-root.v3 .ab-in-app-message :focus,.ab-iam-root.v3 .ab-in-app-message:focus{outline:0}.ab-iam-root.v3 .ab-in-app-message.ab-clickable{cursor:pointer}.ab-iam-root.v3 .ab-in-app-message.ab-background{background-color:#fff}.ab-iam-root.v3 .ab-in-app-message .ab-close-button{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:transparent;background-size:15px;border:none;width:15px;min-width:15px;height:15px;cursor:pointer;display:block;font-size:15px;line-height:0;padding-top:15px;padding-right:15px;padding-left:15px;padding-bottom:15px;position:absolute;right:0;top:0;z-index:9021}.ab-iam-root.v3 .ab-in-app-message .ab-close-button svg{-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease;fill:#9b9b9b;height:auto;width:100%}.ab-iam-root.v3 .ab-in-app-message .ab-close-button svg.ab-chevron{display:none}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:active{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:focus{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:hover{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:hover svg{fill-opacity:.8}.ab-iam-root.v3 .ab-in-app-message .ab-message-text{float:none;line-height:1.5;margin:20px 25px;max-width:100%;overflow:hidden;overflow-y:auto;vertical-align:text-bottom;word-wrap:break-word;white-space:pre-wrap;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif}.ab-iam-root.v3 .ab-in-app-message .ab-message-text.start-aligned{text-align:start}.ab-iam-root.v3 .ab-in-app-message .ab-message-text.end-aligned{text-align:end}.ab-iam-root.v3 .ab-in-app-message .ab-message-text.center-aligned{text-align:center}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar{-webkit-appearance:none;width:14px}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar-thumb{-webkit-appearance:none;border:4px solid transparent;background-clip:padding-box;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px;background-color:rgba(0,0,0,.2)}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar-button{width:0;height:0;display:none}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar-corner{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-message-header{float:none;letter-spacing:0;margin:0;font-weight:700;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;display:block;font-size:20px;margin-bottom:10px;line-height:1.3}.ab-iam-root.v3 .ab-in-app-message .ab-message-header.start-aligned{text-align:start}.ab-iam-root.v3 .ab-in-app-message .ab-message-header.end-aligned{text-align:end}.ab-iam-root.v3 .ab-in-app-message .ab-message-header.center-aligned{text-align:center}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen,.ab-iam-root.v3 .ab-in-app-message.ab-modal,.ab-iam-root.v3 .ab-in-app-message.ab-slideup{-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;cursor:pointer;overflow:hidden;word-wrap:break-word;text-overflow:ellipsis;font-size:14px;font-weight:700;margin:20px;margin-top:calc(constant(safe-area-inset-top,0) + 20px);margin-right:calc(constant(safe-area-inset-right,0) + 20px);margin-bottom:calc(constant(safe-area-inset-bottom,0) + 20px);margin-left:calc(constant(safe-area-inset-left,0) + 20px);margin-top:calc(env(safe-area-inset-top,0) + 20px);margin-right:calc(env(safe-area-inset-right,0) + 20px);margin-bottom:calc(env(safe-area-inset-bottom,0) + 20px);margin-left:calc(env(safe-area-inset-left,0) + 20px);max-height:150px;padding:10px;right:0;background-color:#efefef}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone{max-height:66px;margin:10px;margin-top:calc(constant(safe-area-inset-top,0) + 10px);margin-right:calc(constant(safe-area-inset-right,0) + 10px);margin-bottom:calc(constant(safe-area-inset-bottom,0) + 10px);margin-left:calc(constant(safe-area-inset-left,0) + 10px);margin-top:calc(env(safe-area-inset-top,0) + 10px);margin-right:calc(env(safe-area-inset-right,0) + 10px);margin-bottom:calc(env(safe-area-inset-bottom,0) + 10px);margin-left:calc(env(safe-area-inset-left,0) + 10px);max-width:90%;max-width:calc(100% - 40px);min-width:90%;min-width:calc(100% - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-close-button{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-close-button svg:not(.ab-chevron){display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone.ab-clickable .ab-close-button{display:block;height:20px;padding:0 20px 0 18px;pointer-events:none;top:50%;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:12px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone.ab-clickable .ab-close-button svg.ab-chevron{display:inline}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone.ab-clickable .ab-message-text{border-right-width:40px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text{max-width:100%;border-right-width:10px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text span{max-height:66px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text.ab-with-icon,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text.ab-with-image{max-width:80%;max-width:calc(100% - 50px - 5px - 10px - 25px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-image-area{width:50px;height:50px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-image-area img{max-width:100%;max-height:100%;width:auto;height:auto}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:active .ab-message-text,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:focus .ab-message-text,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:hover .ab-message-text{opacity:.8}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:active .ab-close-button svg.ab-chevron,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:focus .ab-close-button svg.ab-chevron,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:hover .ab-close-button svg.ab-chevron{fill-opacity:.8}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:table-cell;border-color:transparent;border-style:solid;border-width:5px 25px 5px 10px;max-width:430px;vertical-align:middle;margin:0}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text span{display:block;max-height:150px;overflow:auto}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-icon,.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-image{max-width:365px;border-top:0;border-bottom:0}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:transparent;background-size:15px;border:none;width:15px;min-width:15px;height:15px;cursor:pointer;display:block;font-size:15px;line-height:0;padding-top:15px;padding-right:15px;padding-left:15px;padding-bottom:15px;position:absolute;right:0;top:0;z-index:9021}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button svg{-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease;fill:#9b9b9b;height:auto;width:100%}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button svg.ab-chevron{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:active{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:focus{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:hover{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:hover svg{fill-opacity:.8}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area{float:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:table-cell;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;vertical-align:top;width:60px;margin:0}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area.ab-icon-area{width:auto}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area img{float:none;width:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen,.ab-iam-root.v3 .ab-in-app-message.ab-modal{font-size:14px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area{float:none;position:relative;display:block;overflow:hidden}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area .ab-center-cropped-img,.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area .ab-center-cropped-img{background-size:cover;background-repeat:no-repeat;background-position:50% 50%;position:absolute;top:0;right:0;bottom:0;left:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-icon,.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-icon{margin-top:20px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic{padding:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-message-text,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-message-text{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-message-buttons,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-message-buttons{bottom:0;left:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area{float:none;height:auto;margin:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-image-area img,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area img{display:block;top:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none}.ab-iam-root.v3 .ab-in-app-message.ab-modal{padding-top:20px;width:450px;max-width:450px;max-height:720px}.ab-iam-root.v3 .ab-in-app-message.ab-modal.simulate-phone{max-width:91%;max-width:calc(100% - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal.simulate-phone.graphic .ab-image-area img{max-width:91vw;max-width:calc(100vw - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text{max-height:660px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-image{max-height:524.82758621px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-icon{max-height:610px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-buttons{margin-bottom:93px;max-height:587px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-buttons.ab-with-image{max-height:451.82758621px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-buttons.ab-with-icon{max-height:537px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area{margin-top:-20px;max-height:155.17241379px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area img{max-width:100%;max-height:155.17241379px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area.ab-icon-area{height:auto}.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic{width:auto;overflow:hidden}.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area{display:inline}.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area img{width:auto;max-height:720px;max-width:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen{width:450px;max-height:720px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape{width:720px;max-height:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape .ab-image-area{height:225px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape.graphic .ab-image-area{height:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape .ab-message-text{max-height:112px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-message-text{max-height:247px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-message-text.ab-with-buttons{margin-bottom:93px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area{height:360px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-image-area{height:720px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone{-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone:not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone:not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-html-message{background-color:transparent;border:none;height:100%;overflow:auto;position:relative;touch-action:auto;width:100%}.ab-iam-root.v3 .ab-in-app-message .ab-message-buttons{position:absolute;bottom:0;width:100%;padding:17px 25px 30px 25px;z-index:inherit;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ab-iam-root.v3 .ab-in-app-message .ab-message-button{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;cursor:pointer;display:inline-block;font-size:14px;font-weight:700;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;height:44px;line-height:normal;letter-spacing:normal;margin:0;max-width:100%;min-width:80px;padding:0 12px;position:relative;text-transform:none;width:48%;width:calc(50% - 5px);border:1px solid #1b78cf;-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease;overflow:hidden;word-wrap:break-word;text-overflow:ellipsis;word-wrap:normal;white-space:nowrap}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:first-of-type{float:left;background-color:#fff;color:#1b78cf}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:last-of-type{float:right;background-color:#1b78cf;color:#fff}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:first-of-type:last-of-type{float:none;width:auto}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:after{-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:hover{opacity:.8}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:active:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.08)}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:focus:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.15)}.ab-iam-root.v3 .ab-in-app-message .ab-message-button a{color:inherit;text-decoration:inherit}.ab-iam-root.v3 .ab-in-app-message img{float:none;display:inline-block}.ab-iam-root.v3 .ab-in-app-message .ab-icon{float:none;display:inline-block;padding:10px;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px}.ab-iam-root.v3 .ab-in-app-message .ab-icon .fa{float:none;font-size:30px;width:30px}.ab-iam-root.v3 .ab-start-hidden{visibility:hidden}.ab-iam-root.v3 .ab-centered{margin:auto;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.ab-iam-root.v3{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.ab-iam-root.v3 .ab-page-blocker{position:fixed;top:0;left:0;width:100%;height:100%;z-index:9001;pointer-events:all;background-color:rgba(51,51,51,.75)}@media (max-width:600px){.ab-iam-root.v3 .ab-in-app-message.ab-slideup{max-height:66px;margin:10px;margin-top:calc(constant(safe-area-inset-top,0) + 10px);margin-right:calc(constant(safe-area-inset-right,0) + 10px);margin-bottom:calc(constant(safe-area-inset-bottom,0) + 10px);margin-left:calc(constant(safe-area-inset-left,0) + 10px);margin-top:calc(env(safe-area-inset-top,0) + 10px);margin-right:calc(env(safe-area-inset-right,0) + 10px);margin-bottom:calc(env(safe-area-inset-bottom,0) + 10px);margin-left:calc(env(safe-area-inset-left,0) + 10px);max-width:90%;max-width:calc(100% - 40px);min-width:90%;min-width:calc(100% - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button svg:not(.ab-chevron){display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable .ab-close-button{display:block;height:20px;padding:0 20px 0 18px;pointer-events:none;top:50%;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:12px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable .ab-close-button svg.ab-chevron{display:inline}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable .ab-message-text{border-right-width:40px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text{max-width:100%;border-right-width:10px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text span{max-height:66px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-icon,.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-image{max-width:80%;max-width:calc(100% - 50px - 5px - 10px - 25px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area{width:50px;height:50px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area img{max-width:100%;max-height:100%;width:auto;height:auto}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape{-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-close-button,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen .ab-image-area,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-image-area,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen .ab-message-text,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen .ab-message-text.ab-with-buttons,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-message-text.ab-with-buttons,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape:not(.graphic),.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen:not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape:not(.graphic) .ab-message-buttons,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen:not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.graphic,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.graphic{display:block}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.graphic .ab-image-area,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.graphic .ab-message-button,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}@media (max-width:480px){.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop){max-width:91%;max-width:calc(100% - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop).graphic .ab-image-area img{max-width:91vw;max-width:calc(100vw - 30px)}}@media (max-height:750px){.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop){max-height:91%;max-height:calc(100% - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop).graphic .ab-image-area img{max-height:91vh;max-height:calc(100vh - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text{max-height:65vh;max-height:calc(100vh - 30px - 60px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-image{max-height:45vh;max-height:calc(100vh - 30px - 155.17241379310346px - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-icon{max-height:45vh;max-height:calc(100vh - 30px - 70px - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-buttons{max-height:50vh;max-height:calc(100vh - 30px - 93px - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-buttons.ab-with-image{max-height:30vh;max-height:calc(100vh - 30px - 155.17241379310346px - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-buttons.ab-with-icon{max-height:30vh;max-height:calc(100vh - 30px - 70px - 93px - 20px)}}@media (min-width:601px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area img{max-height:100%;max-width:100%}}@media (max-height:750px) and (min-width:601px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop){-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important;width:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop) .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop) .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop) .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop):not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop):not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}@media (max-height:480px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop){-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}@media (max-width:750px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop){-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}", | ||
".ab-pause-scrolling,body.ab-pause-scrolling,html.ab-pause-scrolling{overflow:hidden;touch-action:none}.ab-iam-root.v3{position:fixed;top:0;right:0;bottom:0;left:0;pointer-events:none;z-index:9011;-webkit-tap-highlight-color:transparent}.ab-iam-root.v3:focus{outline:0}.ab-iam-root.v3.ab-effect-fullscreen,.ab-iam-root.v3.ab-effect-html,.ab-iam-root.v3.ab-effect-modal{opacity:0}.ab-iam-root.v3.ab-effect-fullscreen.ab-show,.ab-iam-root.v3.ab-effect-html.ab-show,.ab-iam-root.v3.ab-effect-modal.ab-show{opacity:1}.ab-iam-root.v3.ab-effect-fullscreen.ab-show.ab-animate-in,.ab-iam-root.v3.ab-effect-html.ab-show.ab-animate-in,.ab-iam-root.v3.ab-effect-modal.ab-show.ab-animate-in{-webkit-transition:opacity .5s;-moz-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s}.ab-iam-root.v3.ab-effect-fullscreen.ab-hide,.ab-iam-root.v3.ab-effect-html.ab-hide,.ab-iam-root.v3.ab-effect-modal.ab-hide{opacity:0}.ab-iam-root.v3.ab-effect-fullscreen.ab-hide.ab-animate-out,.ab-iam-root.v3.ab-effect-html.ab-hide.ab-animate-out,.ab-iam-root.v3.ab-effect-modal.ab-hide.ab-animate-out{-webkit-transition:opacity .5s;-moz-transition:opacity .5s;-o-transition:opacity .5s;transition:opacity .5s}.ab-iam-root.v3.ab-effect-slide .ab-in-app-message{-webkit-transform:translateX(535px);-moz-transform:translateX(535px);-ms-transform:translateX(535px);transform:translateX(535px)}.ab-iam-root.v3.ab-effect-slide.ab-show .ab-in-app-message{-webkit-transform:translateX(0);-moz-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}.ab-iam-root.v3.ab-effect-slide.ab-show.ab-animate-in .ab-in-app-message{-webkit-transition:transform .5s ease-in-out;-moz-transition:transform .5s ease-in-out;-o-transition:transform .5s ease-in-out;transition:transform .5s ease-in-out}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message{-webkit-transform:translateX(535px);-moz-transform:translateX(535px);-ms-transform:translateX(535px);transform:translateX(535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message.ab-swiped-left{-webkit-transform:translateX(-535px);-moz-transform:translateX(-535px);-ms-transform:translateX(-535px);transform:translateX(-535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message.ab-swiped-up{-webkit-transform:translateY(-535px);-moz-transform:translateY(-535px);-ms-transform:translateY(-535px);transform:translateY(-535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide .ab-in-app-message.ab-swiped-down{-webkit-transform:translateY(535px);-moz-transform:translateY(535px);-ms-transform:translateY(535px);transform:translateY(535px)}.ab-iam-root.v3.ab-effect-slide.ab-hide.ab-animate-out .ab-in-app-message{-webkit-transition:transform .5s ease-in-out;-moz-transition:transform .5s ease-in-out;-o-transition:transform .5s ease-in-out;transition:transform .5s ease-in-out}.ab-iam-root.v3 .ab-ios-scroll-wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;pointer-events:all;touch-action:auto;-webkit-overflow-scrolling:touch}.ab-iam-root.v3 .ab-in-app-message{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:fixed;text-align:center;-webkit-box-shadow:0 0 4px rgba(0,0,0,.3);-moz-box-shadow:0 0 4px rgba(0,0,0,.3);box-shadow:0 0 4px rgba(0,0,0,.3);line-height:normal;letter-spacing:normal;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;z-index:9011;max-width:100%;overflow:hidden;display:inline-block;pointer-events:all;color:#333;color-scheme:normal}.ab-iam-root.v3 .ab-in-app-message.ab-no-shadow{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.ab-iam-root.v3 .ab-in-app-message :focus,.ab-iam-root.v3 .ab-in-app-message:focus{outline:0}.ab-iam-root.v3 .ab-in-app-message.ab-clickable{cursor:pointer}.ab-iam-root.v3 .ab-in-app-message.ab-background{background-color:#fff}.ab-iam-root.v3 .ab-in-app-message .ab-close-button{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:transparent;background-size:15px;border:none;width:15px;min-width:15px;height:15px;cursor:pointer;display:block;font-size:15px;line-height:0;padding-top:15px;padding-right:15px;padding-left:15px;padding-bottom:15px;position:absolute;right:0;top:0;z-index:9021}.ab-iam-root.v3 .ab-in-app-message .ab-close-button svg{-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease;fill:#9b9b9b;height:auto;width:100%}.ab-iam-root.v3 .ab-in-app-message .ab-close-button svg.ab-chevron{display:none}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:active{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:focus{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:hover{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-close-button:hover svg{fill-opacity:.8}.ab-iam-root.v3 .ab-in-app-message .ab-message-text{float:none;line-height:1.5;margin:20px 25px;max-width:100%;overflow:hidden;overflow-y:auto;vertical-align:text-bottom;word-wrap:break-word;white-space:pre-wrap;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif}.ab-iam-root.v3 .ab-in-app-message .ab-message-text.start-aligned{text-align:start}.ab-iam-root.v3 .ab-in-app-message .ab-message-text.end-aligned{text-align:end}.ab-iam-root.v3 .ab-in-app-message .ab-message-text.center-aligned{text-align:center}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar{-webkit-appearance:none;width:14px}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar-thumb{-webkit-appearance:none;border:4px solid transparent;background-clip:padding-box;-webkit-border-radius:7px;-moz-border-radius:7px;border-radius:7px;background-color:rgba(0,0,0,.2)}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar-button{width:0;height:0;display:none}.ab-iam-root.v3 .ab-in-app-message .ab-message-text::-webkit-scrollbar-corner{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-message-header{float:none;letter-spacing:0;margin:0;font-weight:700;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;display:block;font-size:20px;margin-bottom:10px;line-height:1.3}.ab-iam-root.v3 .ab-in-app-message .ab-message-header.start-aligned{text-align:start}.ab-iam-root.v3 .ab-in-app-message .ab-message-header.end-aligned{text-align:end}.ab-iam-root.v3 .ab-in-app-message .ab-message-header.center-aligned{text-align:center}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen,.ab-iam-root.v3 .ab-in-app-message.ab-modal,.ab-iam-root.v3 .ab-in-app-message.ab-slideup{-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;cursor:pointer;overflow:hidden;word-wrap:break-word;text-overflow:ellipsis;font-size:14px;font-weight:700;margin:20px;margin-top:calc(constant(safe-area-inset-top,0) + 20px);margin-right:calc(constant(safe-area-inset-right,0) + 20px);margin-bottom:calc(constant(safe-area-inset-bottom,0) + 20px);margin-left:calc(constant(safe-area-inset-left,0) + 20px);margin-top:calc(env(safe-area-inset-top,0) + 20px);margin-right:calc(env(safe-area-inset-right,0) + 20px);margin-bottom:calc(env(safe-area-inset-bottom,0) + 20px);margin-left:calc(env(safe-area-inset-left,0) + 20px);max-height:150px;padding:10px;right:0;background-color:#efefef}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone{max-height:66px;margin:10px;margin-top:calc(constant(safe-area-inset-top,0) + 10px);margin-right:calc(constant(safe-area-inset-right,0) + 10px);margin-bottom:calc(constant(safe-area-inset-bottom,0) + 10px);margin-left:calc(constant(safe-area-inset-left,0) + 10px);margin-top:calc(env(safe-area-inset-top,0) + 10px);margin-right:calc(env(safe-area-inset-right,0) + 10px);margin-bottom:calc(env(safe-area-inset-bottom,0) + 10px);margin-left:calc(env(safe-area-inset-left,0) + 10px);max-width:90%;max-width:calc(100% - 40px);min-width:90%;min-width:calc(100% - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-close-button{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-close-button svg:not(.ab-chevron){display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone.ab-clickable .ab-close-button{display:block;height:20px;padding:0 20px 0 18px;pointer-events:none;top:50%;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:12px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone.ab-clickable .ab-close-button svg.ab-chevron{display:inline}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone.ab-clickable .ab-message-text{border-right-width:40px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text{max-width:100%;border-right-width:10px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text span{max-height:66px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text.ab-with-icon,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-message-text.ab-with-image{max-width:80%;max-width:calc(100% - 50px - 5px - 10px - 25px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-image-area{width:50px;height:50px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.simulate-phone .ab-image-area img{max-width:100%;max-height:100%;width:auto;height:auto}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:active .ab-message-text,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:focus .ab-message-text,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:hover .ab-message-text{opacity:.8}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:active .ab-close-button svg.ab-chevron,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:focus .ab-close-button svg.ab-chevron,.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable:hover .ab-close-button svg.ab-chevron{fill-opacity:.8}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:table-cell;border-color:transparent;border-style:solid;border-width:5px 25px 5px 10px;max-width:430px;vertical-align:middle;margin:0}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text span{display:block;max-height:150px;overflow:auto}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-icon,.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-image{max-width:365px;border-top:0;border-bottom:0}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;background-color:transparent;background-size:15px;border:none;width:15px;min-width:15px;height:15px;cursor:pointer;display:block;font-size:15px;line-height:0;padding-top:15px;padding-right:15px;padding-left:15px;padding-bottom:15px;position:absolute;right:0;top:0;z-index:9021}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button svg{-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease;fill:#9b9b9b;height:auto;width:100%}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button svg.ab-chevron{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:active{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:focus{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:hover{background-color:transparent}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button:hover svg{fill-opacity:.8}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area{float:none;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:table-cell;border-color:transparent;border-style:solid;border-width:5px 0 5px 5px;vertical-align:top;width:60px;margin:0}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area.ab-icon-area{width:auto}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area img{float:none;width:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen,.ab-iam-root.v3 .ab-in-app-message.ab-modal{font-size:14px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area{float:none;position:relative;display:block;overflow:hidden}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area .ab-center-cropped-img,.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area .ab-center-cropped-img{background-size:cover;background-repeat:no-repeat;background-position:50% 50%;position:absolute;top:0;right:0;bottom:0;left:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-icon,.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-icon{margin-top:20px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic{padding:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-message-text,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-message-text{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-message-buttons,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-message-buttons{bottom:0;left:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area{float:none;height:auto;margin:0}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-image-area img,.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area img{display:block;top:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none}.ab-iam-root.v3 .ab-in-app-message.ab-modal{padding-top:20px;width:450px;max-width:450px;max-height:720px}.ab-iam-root.v3 .ab-in-app-message.ab-modal.simulate-phone{max-width:91%;max-width:calc(100% - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal.simulate-phone.graphic .ab-image-area img{max-width:91vw;max-width:calc(100vw - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text{max-height:660px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-image{max-height:524.82758621px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-icon{max-height:610px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-buttons{margin-bottom:93px;max-height:587px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-buttons.ab-with-image{max-height:451.82758621px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-message-text.ab-with-buttons.ab-with-icon{max-height:537px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area{margin-top:-20px;max-height:155.17241379px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area img{max-width:100%;max-height:155.17241379px}.ab-iam-root.v3 .ab-in-app-message.ab-modal .ab-image-area.ab-icon-area{height:auto}.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic{width:auto;overflow:hidden}.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area{display:inline}.ab-iam-root.v3 .ab-in-app-message.ab-modal.graphic .ab-image-area img{width:auto;max-height:720px;max-width:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen{width:450px;max-height:720px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape{width:720px;max-height:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape .ab-image-area{height:225px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape.graphic .ab-image-area{height:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape .ab-message-text{max-height:112px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-message-text{max-height:247px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-message-text.ab-with-buttons{margin-bottom:93px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area{height:360px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.graphic .ab-image-area{height:720px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone{-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone:not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone:not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.simulate-phone.graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-html-message{background-color:transparent;border:none;height:100%;overflow:auto;position:relative;touch-action:auto;width:100%}.ab-iam-root.v3 .ab-in-app-message .ab-message-buttons{position:absolute;bottom:0;width:100%;padding:17px 25px 30px 25px;z-index:inherit;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.ab-iam-root.v3 .ab-in-app-message .ab-message-button{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;cursor:pointer;display:inline-block;font-size:14px;font-weight:700;font-family:'Helvetica Neue Light','Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;height:44px;line-height:normal;letter-spacing:normal;margin:0;max-width:100%;min-width:80px;padding:0 12px;position:relative;text-transform:none;width:48%;width:calc(50% - 5px);border:1px solid #1b78cf;-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease;overflow:hidden;word-wrap:break-word;text-overflow:ellipsis;word-wrap:normal;white-space:nowrap}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:first-of-type{float:left;background-color:#fff;color:#1b78cf}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:last-of-type{float:right;background-color:#1b78cf;color:#fff}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:first-of-type:last-of-type{float:none;width:auto}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:transparent}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:after{-webkit-transition:.2s ease;-moz-transition:.2s ease;-o-transition:.2s ease;transition:.2s ease}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:hover{opacity:.8}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:active:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.08)}.ab-iam-root.v3 .ab-in-app-message .ab-message-button:focus:after{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,.15)}.ab-iam-root.v3 .ab-in-app-message .ab-message-button a{color:inherit;text-decoration:inherit}.ab-iam-root.v3 .ab-in-app-message img{float:none;display:inline-block}.ab-iam-root.v3 .ab-in-app-message .ab-icon{float:none;display:inline-block;padding:10px;-webkit-border-radius:8px;-moz-border-radius:8px;border-radius:8px}.ab-iam-root.v3 .ab-in-app-message .ab-icon .fa{float:none;font-size:30px;width:30px}.ab-iam-root.v3 .ab-start-hidden{visibility:hidden}.ab-iam-root.v3 .ab-centered{margin:auto;position:absolute;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}.ab-iam-root.v3{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.ab-iam-root.v3 .ab-page-blocker{position:fixed;top:0;left:0;width:100%;height:100%;z-index:9001;pointer-events:all;background-color:rgba(51,51,51,.75)}@media (max-width:600px){.ab-iam-root.v3 .ab-in-app-message.ab-slideup{max-height:66px;margin:10px;margin-top:calc(constant(safe-area-inset-top,0) + 10px);margin-right:calc(constant(safe-area-inset-right,0) + 10px);margin-bottom:calc(constant(safe-area-inset-bottom,0) + 10px);margin-left:calc(constant(safe-area-inset-left,0) + 10px);margin-top:calc(env(safe-area-inset-top,0) + 10px);margin-right:calc(env(safe-area-inset-right,0) + 10px);margin-bottom:calc(env(safe-area-inset-bottom,0) + 10px);margin-left:calc(env(safe-area-inset-left,0) + 10px);max-width:90%;max-width:calc(100% - 40px);min-width:90%;min-width:calc(100% - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button{display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-close-button svg:not(.ab-chevron){display:none}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable .ab-close-button{display:block;height:20px;padding:0 20px 0 18px;pointer-events:none;top:50%;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);width:12px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable .ab-close-button svg.ab-chevron{display:inline}.ab-iam-root.v3 .ab-in-app-message.ab-slideup.ab-clickable .ab-message-text{border-right-width:40px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text{max-width:100%;border-right-width:10px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text span{max-height:66px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-icon,.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-message-text.ab-with-image{max-width:80%;max-width:calc(100% - 50px - 5px - 10px - 25px)}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area{width:50px;height:50px}.ab-iam-root.v3 .ab-in-app-message.ab-slideup .ab-image-area img{max-width:100%;max-height:100%;width:auto;height:auto}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape{-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-close-button,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen .ab-image-area,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-image-area,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen .ab-message-text,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen .ab-message-text.ab-with-buttons,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape .ab-message-text.ab-with-buttons,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape:not(.graphic),.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen:not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape:not(.graphic) .ab-message-buttons,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen:not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.graphic,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.graphic{display:block}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.graphic .ab-image-area,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.graphic .ab-message-button,.ab-iam-root.v3 .ab-in-app-message:not(.force-desktop).ab-fullscreen.landscape.graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}@media (max-width:480px){.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop){max-width:91%;max-width:calc(100% - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop).graphic .ab-image-area img{max-width:91vw;max-width:calc(100vw - 30px)}}@media (max-height:750px){.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop){max-height:91%;max-height:calc(100% - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop).graphic .ab-image-area img{max-height:91vh;max-height:calc(100vh - 30px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text{max-height:65vh;max-height:calc(100vh - 30px - 60px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-image{max-height:45vh;max-height:calc(100vh - 30px - 155.17241379310346px - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-icon{max-height:45vh;max-height:calc(100vh - 30px - 70px - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-buttons{max-height:50vh;max-height:calc(100vh - 30px - 93px - 40px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-buttons.ab-with-image{max-height:30vh;max-height:calc(100vh - 30px - 155.17241379310346px - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-modal:not(.force-desktop) .ab-message-text.ab-with-buttons.ab-with-icon{max-height:30vh;max-height:calc(100vh - 30px - 70px - 93px - 20px)}}@media (min-width:601px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen .ab-image-area img{max-height:100%;max-width:100%}}@media (max-height:750px) and (min-width:601px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop){-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important;width:450px}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop) .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop) .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop) .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop):not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop):not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen:not(.landscape):not(.force-desktop).graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}@media (max-height:480px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop){-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}@media (max-width:750px){.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop){-webkit-transition:top none;-moz-transition:top none;-o-transition:top none;transition:top none;top:0;right:0;bottom:0;left:0;height:100%;width:100%;max-height:none;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-transform:none;-moz-transform:none;-ms-transform:none;transform:none;height:auto!important}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-close-button{margin-right:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-right:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0));margin-left:calc(constant(safe-area-inset-bottom,0) + constant(safe-area-inset-top,0));margin-left:calc(env(safe-area-inset-bottom,0) + env(safe-area-inset-top,0))}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-image-area,.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-image-area{height:50%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text{max-height:48%;max-height:calc(50% - 20px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop) .ab-message-text.ab-with-buttons{margin-bottom:20px;max-height:30%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).landscape .ab-message-text.ab-with-buttons{max-height:20%;max-height:calc(50% - 93px - 20px)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic){padding-bottom:0;padding-bottom:constant(safe-area-inset-bottom,0);padding-bottom:env(safe-area-inset-bottom,0)}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop):not(.graphic) .ab-message-buttons{padding-top:0;position:relative}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic{display:block}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-image-area{height:100%}.ab-iam-root.v3 .ab-in-app-message.ab-fullscreen.landscape:not(.force-desktop).graphic .ab-message-button{margin-bottom:0;margin-bottom:constant(safe-area-inset-bottom,0);margin-bottom:env(safe-area-inset-bottom,0)}}", | ||
); | ||
@@ -10,0 +10,0 @@ } |
import e, { OPTIONS as L } from "../../managers/braze-instance.js"; | ||
export function loadFontAwesome() { | ||
if (e.nn(L.Co)) return; | ||
if (e.nn(L.Uo)) return; | ||
const t = "https://use.fontawesome.com/7f85a56ba4.css"; | ||
@@ -5,0 +5,0 @@ if ( |
import _t from "../models/identifier.js"; | ||
import { getByteLength as U } from "../util/string-utils.js"; | ||
import { getByteLength as O } from "../util/string-utils.js"; | ||
import ti from "../models/push-token.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js"; | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
import { User } from "../User/index.js"; | ||
@@ -12,15 +12,15 @@ export default class bt { | ||
getUserId() { | ||
const t = this.u.tu(i.eu.su); | ||
const t = this.u.tu(o.iu.su); | ||
if (null == t) return null; | ||
let s = t.iu, | ||
e = U(s); | ||
if (e > User.lr) { | ||
for (; e > User.lr; ) (s = s.slice(0, s.length - 1)), (e = U(s)); | ||
(t.iu = s), this.u.uu(i.eu.su, t); | ||
let s = t.eu, | ||
i = O(s); | ||
if (i > User.lr) { | ||
for (; i > User.lr; ) (s = s.slice(0, s.length - 1)), (i = O(s)); | ||
(t.eu = s), this.u.uu(o.iu.su, t); | ||
} | ||
return s; | ||
} | ||
ru(t) { | ||
ou(t) { | ||
const s = null == this.getUserId(); | ||
this.u.uu(i.eu.su, new _t(t)), s && this.u.ou(t); | ||
this.u.uu(o.iu.su, new _t(t)), s && this.u.ru(t); | ||
} | ||
@@ -30,8 +30,8 @@ setCustomUserAttribute(t, s) { | ||
return ( | ||
r.j.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1 | ||
r.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1 | ||
); | ||
const e = {}; | ||
return (e[t] = s), this.nu(User.lu, e, !0); | ||
const i = {}; | ||
return (i[t] = s), this.nu(User.lu, i, !0); | ||
} | ||
nu(t, s, e = !1, i = !1) { | ||
nu(t, s, i = !1, e = !1) { | ||
const u = this.u.mu(this.getUserId(), t, s); | ||
@@ -42,3 +42,3 @@ let o = "", | ||
return ( | ||
e && | ||
i && | ||
((o = " custom"), | ||
@@ -49,17 +49,17 @@ "object" == typeof s && | ||
"object" == typeof n && (n = JSON.stringify(n, null, 2)))), | ||
!i && u && r.j.info(`Logged${o} attribute ${h} with value ${n}`), | ||
!e && u && r.info(`Logged${o} attribute ${h} with value ${n}`), | ||
u | ||
); | ||
} | ||
_n(t, s, e, u, o) { | ||
Sn(t, s, i, e, u) { | ||
this.nu("push_token", t, !1, !0), | ||
this.nu("custom_push_public_key", e, !1, !0), | ||
this.nu("custom_push_user_auth", u, !1, !0), | ||
this.nu("custom_push_vapid_public_key", o, !1, !0); | ||
const h = r.ts.Zt, | ||
n = new r.es(h, r.j), | ||
l = new ti(t, s, e, u, o); | ||
this.u.D(i.k.Bn, l.tt()), n.setItem(h.rs.cu, h.ie, !0); | ||
this.nu("custom_push_public_key", i, !1, !0), | ||
this.nu("custom_push_user_auth", e, !1, !0), | ||
this.nu("custom_push_vapid_public_key", u, !1, !0); | ||
const h = A.Yt.Qt, | ||
n = new A(h, r), | ||
l = new ti(t, s, i, e, u); | ||
this.u.k(o.C.zn, l.Y()), n.setItem(h.ss.cu, h.ie, !0); | ||
} | ||
Nn(t) { | ||
jn(t) { | ||
if ( | ||
@@ -72,7 +72,7 @@ (this.nu("push_token", null, !1, !0), | ||
) { | ||
const t = r.ts.Zt, | ||
s = new r.es(t, r.j); | ||
this.u.D(i.k.Bn, !1), s.setItem(t.rs.cu, t.ie, !1); | ||
const t = A.Yt.Qt, | ||
s = new A(t, r); | ||
this.u.k(o.C.zn, !1), s.setItem(t.ss.cu, t.ie, !1); | ||
} | ||
} | ||
} |
import { | ||
isArray as p, | ||
isArray as j, | ||
isDate as yt, | ||
isObject as Nt, | ||
validateValueIsFromEnum as G, | ||
validateValueIsFromEnum as J, | ||
} from "../util/code-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r, EventTypes as i } from "../../shared-lib/index.js"; | ||
import { | ||
@@ -12,6 +12,6 @@ isValidEmail as Ct, | ||
validateCustomAttributeKey as At, | ||
validateCustomProperties as rt, | ||
validateCustomString as ot, | ||
validateCustomProperties as ot, | ||
validateCustomString as rt, | ||
validatePropertyType as Ut, | ||
validateStandardString as H, | ||
validateStandardString as P, | ||
} from "../util/validation-utils.js"; | ||
@@ -22,3 +22,3 @@ import { SET_CUSTOM_USER_ATTRIBUTE_STRING as Ft } from "../common/constants.js"; | ||
constructor(t, e) { | ||
(this.wt = t), (this.ki = e), (this.wt = t), (this.ki = e); | ||
(this.wt = t), (this.Ei = e), (this.wt = t), (this.Ei = e); | ||
} | ||
@@ -28,3 +28,3 @@ getUserId(t) { | ||
if ("function" != typeof t) return e; | ||
r.j.warn( | ||
r.warn( | ||
"The callback for getUserId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getUser().getUserId()`)", | ||
@@ -35,11 +35,11 @@ ), | ||
addAlias(t, e) { | ||
return !H(t, "add alias", "the alias", !1) || t.length <= 0 | ||
? (r.j.error("addAlias requires a non-empty alias"), !1) | ||
: !H(e, "add alias", "the label", !1) || e.length <= 0 | ||
? (r.j.error("addAlias requires a non-empty label"), !1) | ||
: this.ki.$n(t, e).O; | ||
return !P(t, "add alias", "the alias", !1) || t.length <= 0 | ||
? (r.error("addAlias requires a non-empty alias"), !1) | ||
: !P(e, "add alias", "the label", !1) || e.length <= 0 | ||
? (r.error("addAlias requires a non-empty label"), !1) | ||
: this.Ei.Fn(t, e).L; | ||
} | ||
setFirstName(t) { | ||
return ( | ||
!!H(t, "set first name", "the firstName", !0) && | ||
!!P(t, "set first name", "the firstName", !0) && | ||
this.wt.nu("first_name", t) | ||
@@ -50,3 +50,3 @@ ); | ||
return ( | ||
!!H(t, "set last name", "the lastName", !0) && this.wt.nu("last_name", t) | ||
!!P(t, "set last name", "the lastName", !0) && this.wt.nu("last_name", t) | ||
); | ||
@@ -57,3 +57,3 @@ } | ||
? this.wt.nu("email", t) | ||
: (r.j.error( | ||
: (r.error( | ||
`Cannot set email address - "${t}" did not pass RFC-5322 validation.`, | ||
@@ -68,3 +68,3 @@ ), | ||
null !== t && | ||
!G( | ||
!J( | ||
User.Genders, | ||
@@ -94,3 +94,3 @@ t, | ||
s < 1 | ||
? (r.j.error( | ||
? (r.error( | ||
"Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);", | ||
@@ -102,7 +102,7 @@ ), | ||
setCountry(t) { | ||
return !!H(t, "set country", "the country", !0) && this.wt.nu("country", t); | ||
return !!P(t, "set country", "the country", !0) && this.wt.nu("country", t); | ||
} | ||
setHomeCity(t) { | ||
return ( | ||
!!H(t, "set home city", "the homeCity", !0) && this.wt.nu("home_city", t) | ||
!!P(t, "set home city", "the homeCity", !0) && this.wt.nu("home_city", t) | ||
); | ||
@@ -112,3 +112,3 @@ } | ||
return ( | ||
!!H(t, "set language", "the language", !0) && this.wt.nu("language", t) | ||
!!P(t, "set language", "the language", !0) && this.wt.nu("language", t) | ||
); | ||
@@ -118,3 +118,3 @@ } | ||
return ( | ||
!!G( | ||
!!J( | ||
User.NotificationSubscriptionTypes, | ||
@@ -129,3 +129,3 @@ t, | ||
return ( | ||
!!G( | ||
!!J( | ||
User.NotificationSubscriptionTypes, | ||
@@ -140,14 +140,12 @@ t, | ||
return ( | ||
!!H(t, "set phone number", "the phoneNumber", !0) && | ||
(null === t || t.match(User.Ln) | ||
!!P(t, "set phone number", "the phoneNumber", !0) && | ||
(null === t || t.match(User.$n) | ||
? this.wt.nu("phone", t) | ||
: (r.j.error( | ||
`Cannot set phone number - "${t}" did not pass validation.`, | ||
), | ||
: (r.error(`Cannot set phone number - "${t}" did not pass validation.`), | ||
!1)) | ||
); | ||
} | ||
setLastKnownLocation(t, e, s, i, n) { | ||
setLastKnownLocation(t, e, s, n, i) { | ||
return null == t || null == e | ||
? (r.j.error( | ||
? (r.error( | ||
"Cannot set last-known location - latitude and longitude are required.", | ||
@@ -159,10 +157,10 @@ ), | ||
null != s && (s = parseFloat(s.toString())), | ||
null != n && (n = parseFloat(n.toString())), | ||
null != i && (i = parseFloat(i.toString())), | ||
null != n && (n = parseFloat(n.toString())), | ||
isNaN(t) || | ||
isNaN(e) || | ||
(null != s && isNaN(s)) || | ||
(null != i && isNaN(i)) || | ||
(null != n && isNaN(n)) | ||
? (r.j.error( | ||
(null != n && isNaN(n)) || | ||
(null != i && isNaN(i)) | ||
? (r.error( | ||
"Cannot set last-known location - all supplied parameters must be numeric.", | ||
@@ -172,17 +170,17 @@ ), | ||
: t > 90 || t < -90 || e > 180 || e < -180 | ||
? (r.j.error( | ||
? (r.error( | ||
"Cannot set last-known location - latitude and longitude are bounded by ±90 and ±180 respectively.", | ||
), | ||
!1) | ||
: (null != s && s < 0) || (null != n && n < 0) | ||
? (r.j.error( | ||
: (null != s && s < 0) || (null != i && i < 0) | ||
? (r.error( | ||
"Cannot set last-known location - accuracy and altitudeAccuracy may not be negative.", | ||
), | ||
!1) | ||
: this.ki.setLastKnownLocation(this.wt.getUserId(), t, e, i, s, n).O); | ||
: this.Ei.setLastKnownLocation(this.wt.getUserId(), t, e, n, s, i).L); | ||
} | ||
setCustomUserAttribute(t, e, s) { | ||
setCustomUserAttribute(t, e, r) { | ||
if (!At(t)) return !1; | ||
const i = (e) => { | ||
const [r] = rt( | ||
const s = (e) => { | ||
const [r] = ot( | ||
e, | ||
@@ -196,10 +194,10 @@ Ft, | ||
}; | ||
if (p(e)) { | ||
const [s, n] = St(t, e); | ||
if (!s && !n && 0 !== e.length) return !1; | ||
if (s || 0 === e.length) return this.ki.Gn(r.q.Hn, t, e).O; | ||
for (const t of e) if (!i(t)) return !1; | ||
if (j(e)) { | ||
const [r, n] = St(t, e); | ||
if (!r && !n && 0 !== e.length) return !1; | ||
if (r || 0 === e.length) return this.Ei.Bn(i.Ln, t, e).L; | ||
for (const t of e) if (!s(t)) return !1; | ||
} else if (Nt(e)) { | ||
if (!i(e)) return !1; | ||
if (s) return this.ki.Gn(r.q.Kn, t, e).O; | ||
if (!s(e)) return !1; | ||
if (r) return this.Ei.Bn(i.Rn, t, e).L; | ||
} else { | ||
@@ -210,3 +208,3 @@ if (!(void 0 !== e && Ut(e))) return !1; | ||
"string" == typeof e && | ||
!ot( | ||
!rt( | ||
e, | ||
@@ -223,8 +221,8 @@ `set custom user attribute "${t}"`, | ||
return ( | ||
!!ot(t, "add to custom user attribute array", "the given key") && | ||
!!rt(t, "add to custom user attribute array", "the given key") && | ||
!( | ||
null != e && | ||
!ot(e, "add to custom user attribute array", "the given value") | ||
!rt(e, "add to custom user attribute array", "the given value") | ||
) && | ||
this.ki.Gn(r.q.Jn, t, e).O | ||
this.Ei.Bn(i.On, t, e).L | ||
); | ||
@@ -234,24 +232,24 @@ } | ||
return ( | ||
!!ot(t, "remove from custom user attribute array", "the given key") && | ||
!!rt(t, "remove from custom user attribute array", "the given key") && | ||
!( | ||
null != e && | ||
!ot(e, "remove from custom user attribute array", "the given value") | ||
!rt(e, "remove from custom user attribute array", "the given value") | ||
) && | ||
this.ki.Gn(r.q.Qn, t, e).O | ||
this.Ei.Bn(i.Gn, t, e).L | ||
); | ||
} | ||
incrementCustomUserAttribute(t, e) { | ||
if (!ot(t, "increment custom user attribute", "the given key")) return !1; | ||
if (!rt(t, "increment custom user attribute", "the given key")) return !1; | ||
null == e && (e = 1); | ||
const s = parseInt(e.toString()); | ||
return isNaN(s) || s !== parseFloat(e.toString()) | ||
? (r.j.error( | ||
? (r.error( | ||
`Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`, | ||
), | ||
!1) | ||
: this.ki.Gn(r.q.Xn, t, s).O; | ||
: this.Ei.Bn(i.Hn, t, s).L; | ||
} | ||
setCustomLocationAttribute(t, e, s) { | ||
return ( | ||
!!ot(t, "set custom location attribute", "the given key") && | ||
!!rt(t, "set custom location attribute", "the given key") && | ||
((null !== e || null !== s) && | ||
@@ -264,11 +262,11 @@ ((e = null != e ? parseFloat(e.toString()) : null), | ||
(null != s && (isNaN(s) || s > 180 || s < -180))) | ||
? (r.j.error( | ||
? (r.error( | ||
"Received invalid values for latitude and/or longitude. Latitude and longitude are bounded by ±90 and ±180 respectively, or must both be null for removal.", | ||
), | ||
!1) | ||
: this.ki.Zn(t, e, s).O) | ||
: this.Ei.Kn(t, e, s).L) | ||
); | ||
} | ||
addToSubscriptionGroup(t) { | ||
return !H( | ||
return !P( | ||
t, | ||
@@ -279,10 +277,10 @@ "add user to subscription group", | ||
) || t.length <= 0 | ||
? (r.j.error( | ||
? (r.error( | ||
"addToSubscriptionGroup requires a non-empty subscription group ID", | ||
), | ||
!1) | ||
: this.ki.au(t, User.du.SUBSCRIBED).O; | ||
: this.Ei.Mn(t, User.Yn.SUBSCRIBED).L; | ||
} | ||
removeFromSubscriptionGroup(t) { | ||
return !H( | ||
return !P( | ||
t, | ||
@@ -293,13 +291,13 @@ "remove user from subscription group", | ||
) || t.length <= 0 | ||
? (r.j.error( | ||
? (r.error( | ||
"removeFromSubscriptionGroup requires a non-empty subscription group ID", | ||
), | ||
!1) | ||
: this.ki.au(t, User.du.UNSUBSCRIBED).O; | ||
: this.Ei.Mn(t, User.Yn.UNSUBSCRIBED).L; | ||
} | ||
_n(t, e, r, s, i) { | ||
this.wt._n(t, e, r, s, i), this.ki.pu(); | ||
Sn(t, e, r, s, n) { | ||
this.wt.Sn(t, e, r, s, n), this.Ei.Jn(); | ||
} | ||
Nn(t) { | ||
this.wt.Nn(t); | ||
jn(t) { | ||
this.wt.jn(t); | ||
} | ||
@@ -320,6 +318,6 @@ } | ||
}), | ||
(User.Ln = /^[0-9 .\\(\\)\\+\\-]+$/), | ||
(User.du = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }), | ||
(User.bu = "user_id"), | ||
(User.$n = /^[0-9 .\\(\\)\\+\\-]+$/), | ||
(User.Yn = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }), | ||
(User.Qn = "user_id"), | ||
(User.lu = "custom"), | ||
(User.lr = 997); |
@@ -1,2 +0,2 @@ | ||
import { isArray as p } from "./code-utils.js"; | ||
import { isArray as j } from "./code-utils.js"; | ||
export default class ge { | ||
@@ -6,6 +6,6 @@ constructor() {} | ||
ef() {} | ||
Ta(t) {} | ||
Oa(t) {} | ||
static rf(t, e) { | ||
if (t && e) | ||
if (((t = t.toLowerCase()), p(e.if))) { | ||
if (((t = t.toLowerCase()), j(e.if))) { | ||
for (let r = 0; r < e.if.length; r++) | ||
@@ -12,0 +12,0 @@ if (-1 !== t.indexOf(e.if[r].toLowerCase())) return e.identity; |
@@ -1,12 +0,12 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { getErrorMessage as ei } from "./error-utils.js"; | ||
import { decodeBrazeActions as to } from "./string-utils.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import { getErrorMessage as si } from "./error-utils.js"; | ||
import { decodeBrazeActions as no } from "./string-utils.js"; | ||
import { | ||
BRAZE_ACTION_URI_REGEX as W, | ||
isValidBrazeActionType as ro, | ||
isValidBrazeActionJson as X, | ||
BRAZE_ACTION_URI_REGEX as Z, | ||
isValidBrazeActionType as io, | ||
isValidBrazeActionJson as oo, | ||
} from "./validation-utils.js"; | ||
export const BRAZE_ACTIONS = { | ||
types: { | ||
ue: "container", | ||
ro: "container", | ||
logCustomEvent: "logCustomEvent", | ||
@@ -22,16 +22,16 @@ setEmailNotificationSubscriptionType: | ||
removeFromCustomAttributeArray: "removeFromCustomAttributeArray", | ||
pe: "openLink", | ||
je: "openLinkInWebView", | ||
no: "openLink", | ||
ao: "openLinkInWebView", | ||
}, | ||
properties: { type: "type", me: "steps", le: "args" }, | ||
properties: { type: "type", oo: "steps", eo: "args" }, | ||
}; | ||
export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = { | ||
_r: "unknownBrazeAction", | ||
Or: "noPushPrompt", | ||
Xi: "unknownBrazeAction", | ||
Zi: "noPushPrompt", | ||
}; | ||
export const ineligibleBrazeActionURLErrorMessage = (t, o) => { | ||
switch (t) { | ||
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES._r: | ||
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Xi: | ||
return `${o} contains an unknown braze action type and will not be displayed.`; | ||
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Or: | ||
case INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Zi: | ||
return `${o} contains a push prompt braze action, but is not eligible for a push prompt. Ignoring.`; | ||
@@ -44,20 +44,20 @@ default: | ||
try { | ||
const o = t.match(W), | ||
e = o ? o[0].length : null, | ||
n = e ? t.substring(e) : null; | ||
if (null == e || e > t.length - 1 || !n) | ||
return void r.j.error( | ||
const o = t.match(Z), | ||
n = o ? o[0].length : null, | ||
e = n ? t.substring(n) : null; | ||
if (null == n || n > t.length - 1 || !e) | ||
return void r.error( | ||
`Did not find base64 encoded brazeAction in url to process : ${t}`, | ||
); | ||
const i = to(n); | ||
const i = no(e); | ||
return i | ||
? JSON.parse(i) | ||
: void r.j.error(`Failed to decode base64 encoded brazeAction: ${n}`); | ||
: void r.error(`Failed to decode base64 encoded brazeAction: ${e}`); | ||
} catch (o) { | ||
return void r.j.error(`Failed to process brazeAction URL ${t} : ${ei(o)}`); | ||
return void r.error(`Failed to process brazeAction URL ${t} : ${si(o)}`); | ||
} | ||
} | ||
function eo(t, o) { | ||
function so(t, o) { | ||
let r = !1; | ||
if (o) for (const e of o) if (((r = r || t(e)), r)) return !0; | ||
if (o) for (const n of o) if (((r = r || t(n)), r)) return !0; | ||
return !1; | ||
@@ -67,9 +67,9 @@ } | ||
const o = BRAZE_ACTIONS.properties.type, | ||
r = BRAZE_ACTIONS.properties.me; | ||
r = BRAZE_ACTIONS.properties.oo; | ||
try { | ||
if (null == t) return !0; | ||
const e = t[o]; | ||
return e === BRAZE_ACTIONS.types.ue | ||
? eo(containsUnknownBrazeAction, t[r]) | ||
: !ro(e); | ||
const n = t[o]; | ||
return n === BRAZE_ACTIONS.types.ro | ||
? so(containsUnknownBrazeAction, t[r]) | ||
: !io(n); | ||
} catch (t) { | ||
@@ -80,9 +80,9 @@ return !0; | ||
export function containsPushPrimerBrazeAction(t) { | ||
if (!t || !X(t)) return !1; | ||
if (!t || !oo(t)) return !1; | ||
const o = BRAZE_ACTIONS.properties.type, | ||
r = BRAZE_ACTIONS.properties.me, | ||
e = t[o]; | ||
return e === BRAZE_ACTIONS.types.ue | ||
? eo(containsPushPrimerBrazeAction, t[r]) | ||
: e === BRAZE_ACTIONS.types.requestPushPermission; | ||
r = BRAZE_ACTIONS.properties.oo, | ||
n = t[o]; | ||
return n === BRAZE_ACTIONS.types.ro | ||
? so(containsPushPrimerBrazeAction, t[r]) | ||
: n === BRAZE_ACTIONS.types.requestPushPermission; | ||
} |
@@ -1,7 +0,7 @@ | ||
import ni from "./client-hints-parser.js"; | ||
import ai from "./user-agent-parser.js"; | ||
import { Browsers as oi, OperatingSystems as V } from "./device-constants.js"; | ||
class gi { | ||
import ai from "./client-hints-parser.js"; | ||
import oi from "./user-agent-parser.js"; | ||
import { Browsers as gi, OperatingSystems as Y } from "./device-constants.js"; | ||
class ui { | ||
constructor() { | ||
const t = navigator.userAgentData ? ni : ai; | ||
const t = navigator.userAgentData ? ai : oi; | ||
(this.Sg = new t()), | ||
@@ -12,3 +12,3 @@ (this.userAgent = navigator.userAgent), | ||
(this.OS = null), | ||
this.Ta().then((t) => (this.OS = t)); | ||
this.Oa().then((t) => (this.OS = t)); | ||
const i = navigator; | ||
@@ -22,14 +22,14 @@ (this.language = ( | ||
).toLowerCase()), | ||
(this.qo = gi.vg(this.userAgent)); | ||
(this.Qo = ui.vg(this.userAgent)); | ||
} | ||
gE() { | ||
return this.browser === oi.Bg; | ||
OE() { | ||
return this.browser === gi.Bg; | ||
} | ||
Ca() { | ||
Ga() { | ||
return this.OS || null; | ||
} | ||
Ta() { | ||
Oa() { | ||
return this.OS | ||
? Promise.resolve(this.OS) | ||
: this.Sg.Ta(gi.Og).then((t) => ((this.OS = t), t)); | ||
: this.Sg.Oa(ui.Og).then((t) => ((this.OS = t), t)); | ||
} | ||
@@ -60,5 +60,5 @@ static vg(t) { | ||
} | ||
gi.Og = [ | ||
{ string: navigator.platform, if: "Win", identity: V.Pg }, | ||
{ string: navigator.platform, if: "Mac", identity: V.kg }, | ||
ui.Og = [ | ||
{ string: navigator.platform, if: "Win", identity: Y.Pg }, | ||
{ string: navigator.platform, if: "Mac", identity: Y.kg }, | ||
{ string: navigator.platform, if: "BlackBerry", identity: "BlackBerry" }, | ||
@@ -74,5 +74,5 @@ { string: navigator.platform, if: "FreeBSD", identity: "FreeBSD" }, | ||
if: ["iPhone", "iPad", "iPod"], | ||
identity: V.de, | ||
identity: Y.io, | ||
}, | ||
{ string: navigator.platform, if: "Pike v", identity: V.de }, | ||
{ string: navigator.platform, if: "Pike v", identity: Y.io }, | ||
{ string: navigator.userAgent, if: ["Web0S"], identity: "WebOS" }, | ||
@@ -82,8 +82,8 @@ { | ||
if: ["Linux armv7l", "Android"], | ||
identity: V.xg, | ||
identity: Y.xg, | ||
}, | ||
{ string: navigator.userAgent, if: ["Android"], identity: V.xg }, | ||
{ string: navigator.userAgent, if: ["Android"], identity: Y.xg }, | ||
{ string: navigator.platform, if: "Linux", identity: "Linux" }, | ||
]; | ||
const Q = new gi(); | ||
export { Q as default, gi as BrowserDetector }; | ||
const X = new ui(); | ||
export { X as default, ui as BrowserDetector }; |
import ge from "./base-device-parser.js"; | ||
import { Browsers as oi } from "./device-constants.js"; | ||
export default class ni extends ge { | ||
import { Browsers as gi } from "./device-constants.js"; | ||
export default class ai extends ge { | ||
constructor() { | ||
@@ -12,3 +12,3 @@ if ( | ||
) { | ||
const t = this.ic(); | ||
const t = this.hc(); | ||
(this.browser = t.browser || "Unknown Browser"), | ||
@@ -25,7 +25,7 @@ (this.version = t.version || "Unknown Version"); | ||
} | ||
Ta(t) { | ||
Oa(t) { | ||
if (this.OS) return Promise.resolve(this.OS); | ||
const s = (s) => { | ||
for (let r = 0; r < t.length; r++) { | ||
const i = ni.rf(s, t[r]); | ||
const i = ai.rf(s, t[r]); | ||
if (i) return (this.OS = i), this.OS; | ||
@@ -41,3 +41,3 @@ } | ||
} | ||
ic() { | ||
hc() { | ||
const t = {}, | ||
@@ -47,3 +47,3 @@ s = this.userAgentData.brands; | ||
for (const r of s) { | ||
const s = this.nc(oi), | ||
const s = this.uc(gi), | ||
i = r.brand.match(s); | ||
@@ -57,3 +57,3 @@ if (i && i.length > 0) { | ||
} | ||
nc(t) { | ||
uc(t) { | ||
const s = []; | ||
@@ -60,0 +60,0 @@ for (const r in t) { |
@@ -1,2 +0,2 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function values(t) { | ||
@@ -16,3 +16,3 @@ const e = []; | ||
-1 !== c.indexOf(e) || | ||
(r.j.error(`${n} Valid values from ${o} are "${c.join('"/"')}".`), !1) | ||
(r.error(`${n} Valid values from ${o} are "${c.join('"/"')}".`), !1) | ||
); | ||
@@ -19,0 +19,0 @@ } |
@@ -18,3 +18,3 @@ import { addPassiveEventListener as oe, buildSvg as ae } from "./dom-utils.js"; | ||
n.addEventListener("keydown", (t) => { | ||
(t.keyCode !== at.Fo && t.keyCode !== at.To) || | ||
(t.keyCode !== at.To && t.keyCode !== at.Eo) || | ||
(e(), t.stopPropagation()); | ||
@@ -21,0 +21,0 @@ }), |
@@ -1,5 +0,5 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
export function logDeprecationWarning(e, a, i) { | ||
let s = `The '${e}' ${a} is deprecated.`; | ||
i && (s += ` Please use '${i}' instead.`), r.j.warn(s); | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function logDeprecationWarning(e, i, n) { | ||
let t = `The '${e}' ${i} is deprecated.`; | ||
n && (t += ` Please use '${n}' instead.`), r.warn(t); | ||
} |
@@ -10,5 +10,5 @@ export const Browsers = { | ||
xg: "Android", | ||
de: "iOS", | ||
io: "iOS", | ||
kg: "Mac", | ||
Pg: "Windows", | ||
}; |
@@ -1,3 +0,3 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { getErrorMessage as ei } from "./error-utils.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import { getErrorMessage as si } from "./error-utils.js"; | ||
export function _isInView(t, n = !1, e = !1, s = !1) { | ||
@@ -21,11 +21,11 @@ if (null == t) return !1; | ||
} | ||
export const DOMUtils = { oc: null, no: _isInView }; | ||
export const DIRECTIONS = { Oe: "up", Qe: "down", W: "left", X: "right" }; | ||
export const DOMUtils = { dc: null, co: _isInView }; | ||
export const DIRECTIONS = { De: "up", Ee: "down", U: "left", V: "right" }; | ||
export function supportsPassive() { | ||
if (null == DOMUtils.oc) { | ||
DOMUtils.oc = !1; | ||
if (null == DOMUtils.dc) { | ||
DOMUtils.dc = !1; | ||
try { | ||
const t = Object.defineProperty({}, "passive", { | ||
get: () => { | ||
DOMUtils.oc = !0; | ||
DOMUtils.dc = !0; | ||
}, | ||
@@ -36,6 +36,6 @@ }); | ||
} catch (t) { | ||
r.j.error(ei(t)); | ||
r.error(si(t)); | ||
} | ||
} | ||
return DOMUtils.oc; | ||
return DOMUtils.dc; | ||
} | ||
@@ -46,6 +46,6 @@ export function addPassiveEventListener(t, n, e = () => {}) { | ||
export function topIsInView(t) { | ||
return DOMUtils.no(t, !0, !1, !1); | ||
return DOMUtils.co(t, !0, !1, !1); | ||
} | ||
export function bottomIsInView(t) { | ||
return DOMUtils.no(t, !1, !0, !1); | ||
return DOMUtils.co(t, !1, !0, !1); | ||
} | ||
@@ -67,13 +67,13 @@ export function clickElement(t) { | ||
const l = s - o.touches[0].clientX, | ||
r = i - o.touches[0].clientY; | ||
Math.abs(l) > Math.abs(r) && Math.abs(l) >= 25 | ||
? (((l > 0 && n === DIRECTIONS.W) || (l < 0 && n === DIRECTIONS.X)) && | ||
u = i - o.touches[0].clientY; | ||
Math.abs(l) > Math.abs(u) && Math.abs(l) >= 25 | ||
? (((l > 0 && n === DIRECTIONS.U) || (l < 0 && n === DIRECTIONS.V)) && | ||
e(o), | ||
(s = null), | ||
(i = null)) | ||
: Math.abs(r) >= 25 && | ||
(((r > 0 && | ||
n === DIRECTIONS.Oe && | ||
: Math.abs(u) >= 25 && | ||
(((u > 0 && | ||
n === DIRECTIONS.De && | ||
t.scrollTop === t.scrollHeight - t.offsetHeight) || | ||
(r < 0 && n === DIRECTIONS.Qe && 0 === t.scrollTop)) && | ||
(u < 0 && n === DIRECTIONS.Ee && 0 === t.scrollTop)) && | ||
e(o), | ||
@@ -80,0 +80,0 @@ (s = null), |
@@ -1,1 +0,1 @@ | ||
export const KeyCodes = { Fo: 32, oo: 9, To: 13, _h: 27 }; | ||
export const KeyCodes = { To: 32, lo: 9, Eo: 13, _h: 27 }; |
@@ -1,17 +0,17 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import qt from "../models/backend-errors.js"; | ||
import { getErrorMessage as ei } from "./error-utils.js"; | ||
import { getErrorMessage as si } from "./error-utils.js"; | ||
const C = { | ||
Xs: (t) => { | ||
Qs: (t) => { | ||
let e, o; | ||
try { | ||
const s = () => { | ||
r.j.error("This browser does not have any supported ajax options!"); | ||
const n = () => { | ||
r.error("This browser does not have any supported ajax options!"); | ||
}; | ||
let n = !1; | ||
if ((window.XMLHttpRequest && (n = !0), !n)) return void s(); | ||
let s = !1; | ||
if ((window.XMLHttpRequest && (s = !0), !s)) return void n(); | ||
e = new XMLHttpRequest(); | ||
const i = () => { | ||
"function" == typeof t.error && t.error(e.status), | ||
"function" == typeof t.ei && t.ei(!1); | ||
"function" == typeof t.ti && t.ti(!1); | ||
}; | ||
@@ -24,3 +24,3 @@ (e.onload = () => { | ||
) { | ||
if ("function" == typeof t.O) { | ||
if ("function" == typeof t.L) { | ||
let o, r; | ||
@@ -31,11 +31,11 @@ try { | ||
} catch (o) { | ||
const s = { | ||
error: "" === e.responseText ? qt.Vh : qt.Zh, | ||
const n = { | ||
error: "" === e.responseText ? qt.Ka : qt.La, | ||
response: e.responseText, | ||
}; | ||
(0, t.O)(s, r); | ||
(0, t.L)(n, r); | ||
} | ||
o && t.O(o, r); | ||
o && t.L(o, r); | ||
} | ||
"function" == typeof t.ei && t.ei(!0); | ||
"function" == typeof t.ti && t.ti(!0); | ||
} else i(); | ||
@@ -57,3 +57,3 @@ }), | ||
} catch (t) { | ||
r.j.error(`Network request error: ${ei(t)}`); | ||
r.error(`Network request error: ${si(t)}`); | ||
} | ||
@@ -66,10 +66,10 @@ }, | ||
if (!o) return e; | ||
let r, s; | ||
let r, n; | ||
for (const t of o) | ||
t && | ||
((r = t.slice(0, t.indexOf(":")).toLowerCase().trim()), | ||
(s = t.slice(t.indexOf(":") + 1).trim()), | ||
(e[r] = s)); | ||
(n = t.slice(t.indexOf(":") + 1).trim()), | ||
(e[r] = n)); | ||
return e; | ||
}; | ||
export default C; |
import { REQUEST_ATTEMPT_DEFAULT as Ae } from "../common/constants.js"; | ||
import { STORAGE_KEYS as i } from "../managers/storage-manager.js"; | ||
const T = { | ||
Os: { Na: "d", Ks: "cc", Si: "ff", Lr: "t" }, | ||
rm: (e) => { | ||
if (e) return e.v(i.k.EE); | ||
import { STORAGE_KEYS as o } from "../managers/storage-manager.js"; | ||
const S = { | ||
Gs: { Qa: "d", Bs: "cc", qi: "ff", Cr: "t" }, | ||
ii: { | ||
Qa: "/data", | ||
Bs: "/content_cards/sync", | ||
qi: "/feature_flags/sync", | ||
Cr: "/template", | ||
}, | ||
sm: (e) => { | ||
if (e) return e.v(i.k.lE); | ||
mc: (e) => (null == e ? void 0 : e.j(o.C.EE)), | ||
Ac: (e) => (null == e ? void 0 : e.j(o.C.lE)), | ||
Tc: (e, t) => { | ||
null == e || e.k(o.C.EE, t); | ||
}, | ||
nm: (e, t) => { | ||
e && e.D(i.k.EE, t); | ||
Rc: (e, t) => { | ||
null == e || e.k(o.C.lE, t); | ||
}, | ||
um: (e, t) => { | ||
e && e.D(i.k.lE, t); | ||
}, | ||
La: (e, t) => { | ||
Yh: (e, t) => { | ||
if (!e || !t) return -1; | ||
const r = T.rm(e); | ||
if (null == r) return -1; | ||
const s = r[t]; | ||
return null == s || isNaN(s) ? -1 : s; | ||
const s = S.mc(e); | ||
if (null == s) return -1; | ||
const n = s[t]; | ||
return null == n || isNaN(n) ? -1 : n; | ||
}, | ||
Wa: (e, t) => { | ||
let r = Ae; | ||
if (!e || !t) return r; | ||
const s = T.sm(e); | ||
return null == s ? r : ((r = s[t]), null == r || isNaN(r) ? Ae : r); | ||
Jh: (e, t) => { | ||
let s = Ae; | ||
if (!e || !t) return s; | ||
const n = S.Ac(e); | ||
return null == n ? s : ((s = n[t]), null == s || isNaN(s) ? Ae : s); | ||
}, | ||
Ws: (e, t, r) => { | ||
Os: (e, t, s) => { | ||
if (!e || !t) return; | ||
let s = T.rm(e); | ||
null == s && (s = {}), (s[t] = r), T.nm(e, s); | ||
let n = S.mc(e); | ||
null == n && (n = {}), (n[t] = s), S.Tc(e, n); | ||
}, | ||
si: (e, t, r) => { | ||
Ys: (e, t, s) => { | ||
if (!e || !t) return; | ||
let s = T.sm(e); | ||
null == s && (s = {}), (s[t] = r), T.um(e, s); | ||
let n = S.Ac(e); | ||
null == n && (n = {}), (n[t] = s), S.Rc(e, n); | ||
}, | ||
hi: (e, t) => { | ||
si: (e, t) => { | ||
if (!e || !t) return; | ||
const r = T.Wa(e, t); | ||
T.si(e, t, r + 1); | ||
const s = S.Jh(e, t); | ||
S.Ys(e, t, s + 1); | ||
}, | ||
}; | ||
export default T; | ||
export default S; |
@@ -1,8 +0,8 @@ | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
export function getByteLength(t) { | ||
let e = t.length; | ||
for (let r = t.length - 1; r >= 0; r--) { | ||
const n = t.charCodeAt(r); | ||
n > 127 && n <= 2047 ? e++ : n > 2047 && n <= 65535 && (e += 2), | ||
n >= 56320 && n <= 57343 && r--; | ||
for (let n = t.length - 1; n >= 0; n--) { | ||
const r = t.charCodeAt(n); | ||
r > 127 && r <= 2047 ? e++ : r > 2047 && r <= 65535 && (e += 2), | ||
r >= 56320 && r <= 57343 && n--; | ||
} | ||
@@ -15,9 +15,9 @@ return e; | ||
const e = window.atob(t), | ||
r = new Uint8Array(e.length); | ||
for (let t = 0; t < e.length; t++) r[t] = e.charCodeAt(t); | ||
const n = new Uint16Array(r.buffer); | ||
return String.fromCharCode(...n); | ||
n = new Uint8Array(e.length); | ||
for (let t = 0; t < e.length; t++) n[t] = e.charCodeAt(t); | ||
const r = new Uint16Array(n.buffer); | ||
return String.fromCharCode(...r); | ||
} catch (t) { | ||
return r.j.error("Unable to decode Base64: " + t), null; | ||
return r.error("Unable to decode Base64: " + t), null; | ||
} | ||
} |
import ge from "./base-device-parser.js"; | ||
import { Browsers as oi, OperatingSystems as V } from "./device-constants.js"; | ||
export default class ai extends ge { | ||
import { Browsers as gi, OperatingSystems as Y } from "./device-constants.js"; | ||
export default class oi extends ge { | ||
constructor() { | ||
super(), (this.rd = ai.ic(navigator.userAgent || "")); | ||
super(), (this.ud = oi.hc(navigator.userAgent || "")); | ||
} | ||
tf() { | ||
return this.rd[0] || "Unknown Browser"; | ||
return this.ud[0] || "Unknown Browser"; | ||
} | ||
ef() { | ||
return this.rd[1] || "Unknown Version"; | ||
return this.ud[1] || "Unknown Version"; | ||
} | ||
Ta(r) { | ||
Oa(r) { | ||
for (let n = 0; n < r.length; n++) { | ||
const e = r[n].string; | ||
let i = ai.rf(e, r[n]); | ||
let i = oi.rf(e, r[n]); | ||
if (i) | ||
return ( | ||
i === V.kg && navigator.maxTouchPoints > 1 && (i = V.de), | ||
i === Y.kg && navigator.maxTouchPoints > 1 && (i = Y.io), | ||
Promise.resolve(i) | ||
@@ -25,3 +25,3 @@ ); | ||
} | ||
static ic(r) { | ||
static hc(r) { | ||
let n, | ||
@@ -45,3 +45,3 @@ e = | ||
if ( | ||
e[1] === oi.rO && | ||
e[1] === gi.rO && | ||
((n = r.match(/\b(OPR|Edge|EdgA|Edg|UCBrowser)\/(\.?\d+(\.\d+)*)/)), | ||
@@ -52,17 +52,17 @@ null != n) | ||
(n = n.slice(1)), | ||
(n[0] = n[0].replace("OPR", oi.oO)), | ||
(n[0] = n[0].replace("EdgA", oi.eO)), | ||
"Edg" === n[0] && (n[0] = oi.eO), | ||
(n[0] = n[0].replace("OPR", gi.oO)), | ||
(n[0] = n[0].replace("EdgA", gi.eO)), | ||
"Edg" === n[0] && (n[0] = gi.eO), | ||
[n[0], n[1]] | ||
); | ||
if ( | ||
e[1] === oi.Bg && | ||
e[1] === gi.Bg && | ||
((n = r.match(/\b(EdgiOS)\/(\.?\d+(\.\d+)*)/)), null != n) | ||
) | ||
return ( | ||
(n = n.slice(1)), (n[0] = n[0].replace("EdgiOS", oi.eO)), [n[0], n[1]] | ||
(n = n.slice(1)), (n[0] = n[0].replace("EdgiOS", gi.eO)), [n[0], n[1]] | ||
); | ||
if ( | ||
((e = e[2] ? [e[1], e[2]] : [null, null]), | ||
e[0] === oi.Bg && | ||
e[0] === gi.Bg && | ||
null != (n = r.match(/version\/(\.?\d+(\.\d+)*)/i)) && | ||
@@ -72,3 +72,3 @@ e.splice(1, 1, n[1]), | ||
e.splice(1, 1, n[2]), | ||
e[0] === oi.oO && null != (n = r.match(/mini\/(\.?\d+(\.\d+)*)/i))) | ||
e[0] === gi.oO && null != (n = r.match(/mini\/(\.?\d+(\.\d+)*)/i))) | ||
) | ||
@@ -78,3 +78,3 @@ return ["Opera Mini", n[1] || ""]; | ||
const r = e[0].toLowerCase(); | ||
"crios" === r && (e[0] = oi.rO), | ||
"crios" === r && (e[0] = gi.rO), | ||
"tizen" === r && ((e[0] = "Samsung Smart TV"), (e[1] = null)), | ||
@@ -81,0 +81,0 @@ "samsungbrowser" === r && (e[0] = "Samsung Browser"); |
import { | ||
isArray as p, | ||
isArray as j, | ||
isDate as yt, | ||
isObject as Nt, | ||
keys as oo, | ||
keys as to, | ||
} from "./code-utils.js"; | ||
import { getByteLength as U } from "./string-utils.js"; | ||
import r from "../../shared-lib/braze-shared-lib.js"; | ||
import { getByteLength as O } from "./string-utils.js"; | ||
import { logger as r } from "../../shared-lib/index.js"; | ||
import { toValidBackendTimeString as $t } from "./date-utils.js"; | ||
import { BRAZE_ACTIONS as _ } from "./braze-actions.js"; | ||
import { BRAZE_ACTIONS as V } from "./braze-actions.js"; | ||
import { SET_CUSTOM_USER_ATTRIBUTE_STRING as Ft } from "../common/constants.js"; | ||
@@ -35,3 +35,3 @@ export const CUSTOM_DATA_REGEX = /^[^\x00-\x1F\x22]+$/; | ||
("" === t || null != t.match(CUSTOM_DATA_REGEX)); | ||
return o || r.j.error(`Cannot ${e} because ${n} "${t}" is invalid.`), o; | ||
return o || r.error(`Cannot ${e} because ${n} "${t}" is invalid.`), o; | ||
} | ||
@@ -43,3 +43,3 @@ export function validateCustomAttributeKey(t) { | ||
-1 === CUSTOM_ATTRIBUTE_RESERVED_OPERATORS.indexOf(t) && | ||
r.j.warn("Custom attribute keys cannot contain '$' or '.'"), | ||
r.warn("Custom attribute keys cannot contain '$' or '.'"), | ||
validateCustomString(t, "set custom user attribute", "the given key") | ||
@@ -57,7 +57,5 @@ ); | ||
if (o && n > 50) | ||
return ( | ||
r.j.error("Nested attributes cannot be more than 50 levels deep."), !1 | ||
); | ||
return r.error("Nested attributes cannot be more than 50 levels deep."), !1; | ||
const i = o ? n + 1 : -1; | ||
if (p(t) && p(e)) { | ||
if (j(t) && j(e)) { | ||
for (let r = 0; r < t.length && r < e.length; r++) | ||
@@ -71,3 +69,3 @@ if ( | ||
if (!Nt(t)) return validatePropertyType(t); | ||
for (const r of oo(t)) { | ||
for (const r of to(t)) { | ||
const n = t[r]; | ||
@@ -87,6 +85,6 @@ if (o && !validateCustomAttributeKey(r)) return !1; | ||
(a = | ||
Nt(t) || p(t) | ||
Nt(t) || j(t) | ||
? _validateNestedProperties(t, e, i ? 1 : -1) | ||
: validatePropertyType(t)), | ||
a || r.j.error(`Cannot ${n} because ${o} "${t}" is invalid.`), | ||
a || r.error(`Cannot ${n} because ${o} "${t}" is invalid.`), | ||
a | ||
@@ -97,8 +95,8 @@ ); | ||
const i = "string" == typeof t || (null === t && o); | ||
return i || r.j.error(`Cannot ${e} because ${n} "${t}" is invalid.`), i; | ||
return i || r.error(`Cannot ${e} because ${n} "${t}" is invalid.`), i; | ||
} | ||
export function validateCustomProperties(t, e, n, o, i) { | ||
if ((null == t && (t = {}), "object" != typeof t || p(t))) | ||
if ((null == t && (t = {}), "object" != typeof t || j(t))) | ||
return ( | ||
r.j.error(`${e} requires that ${n} be an object. Ignoring ${i}.`), | ||
r.error(`${e} requires that ${n} be an object. Ignoring ${i}.`), | ||
[!1, null] | ||
@@ -109,5 +107,5 @@ ); | ||
const u = JSON.stringify(t); | ||
if (U(u) > a) | ||
if (O(u) > a) | ||
return ( | ||
r.j.error( | ||
r.error( | ||
`Could not ${o} because ${n} was greater than the max size of ${s}.`, | ||
@@ -122,3 +120,3 @@ ), | ||
return ( | ||
r.j.error(`Could not ${o} because ${n} did not contain valid JSON.`), | ||
r.error(`Could not ${o} because ${n} did not contain valid JSON.`), | ||
[!1, null] | ||
@@ -154,3 +152,3 @@ ); | ||
const i = () => { | ||
r.j.error( | ||
r.error( | ||
"Custom attribute arrays must be either string arrays or object arrays.", | ||
@@ -194,20 +192,20 @@ ); | ||
export function isValidBrazeActionJson(t) { | ||
if (!(_.properties.type in t)) return !1; | ||
switch (t[_.properties.type]) { | ||
case _.types.ue: | ||
if (_.properties.me in t) return !0; | ||
if (!(V.properties.type in t)) return !1; | ||
switch (t[V.properties.type]) { | ||
case V.types.ro: | ||
if (V.properties.oo in t) return !0; | ||
break; | ||
case _.types.logCustomEvent: | ||
case _.types.setEmailNotificationSubscriptionType: | ||
case _.types.setPushNotificationSubscriptionType: | ||
case _.types.setCustomUserAttribute: | ||
case _.types.addToSubscriptionGroup: | ||
case _.types.removeFromSubscriptionGroup: | ||
case _.types.addToCustomAttributeArray: | ||
case _.types.removeFromCustomAttributeArray: | ||
case _.types.pe: | ||
case _.types.je: | ||
if (_.properties.le in t) return !0; | ||
case V.types.logCustomEvent: | ||
case V.types.setEmailNotificationSubscriptionType: | ||
case V.types.setPushNotificationSubscriptionType: | ||
case V.types.setCustomUserAttribute: | ||
case V.types.addToSubscriptionGroup: | ||
case V.types.removeFromSubscriptionGroup: | ||
case V.types.addToCustomAttributeArray: | ||
case V.types.removeFromCustomAttributeArray: | ||
case V.types.no: | ||
case V.types.ao: | ||
if (V.properties.eo in t) return !0; | ||
break; | ||
case _.types.requestPushPermission: | ||
case V.types.requestPushPermission: | ||
return !0; | ||
@@ -222,4 +220,4 @@ default: | ||
return ( | ||
Object.keys(_.types).forEach((r) => { | ||
_.types[r] !== t.toString() || (e = !0); | ||
Object.keys(V.types).forEach((r) => { | ||
V.types[r] !== t.toString() || (e = !0); | ||
}), | ||
@@ -226,0 +224,0 @@ e |
@@ -31,5 +31,5 @@ export const ORIENTATION = { PORTRAIT: 0, LANDSCAPE: 1 }; | ||
openUri: _openUri, | ||
ao: _isPhone, | ||
mo: _getOrientation, | ||
Cn: _getCurrentUrl, | ||
jo: _isPhone, | ||
bo: _getOrientation, | ||
Tn: _getCurrentUrl, | ||
}; |
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
453563
12809