@braze/web-sdk 5.3.2 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +20 -4
- package/package.json +1 -1
- package/shared-lib/event-types.js +12 -12
- package/shared-lib/indexed-db-adapter.js +14 -14
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +10 -9
- package/src/Card/card-manager.js +46 -42
- package/src/Card/display/card-display.js +59 -58
- package/src/Card/models/card.js +61 -55
- package/src/Card/models/classic-card.js +1 -1
- package/src/Card/models/control-card.js +1 -1
- package/src/Card/models/image-only.js +1 -1
- package/src/Card/util/card-factory.js +20 -20
- package/src/ContentCards/content-cards-provider.js +140 -140
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/disable-sdk.js +2 -2
- package/src/Core/enable-sdk.js +2 -2
- package/src/Core/index.js +1 -0
- package/src/Core/is-initialized.js +4 -0
- package/src/Core/log-custom-event.js +14 -14
- package/src/Core/log-purchase.js +8 -8
- package/src/Core/open-session.js +4 -4
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag-factory.js +5 -5
- package/src/FeatureFlags/feature-flag.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +12 -12
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +29 -29
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +64 -62
- package/src/InAppMessage/in-app-message-manager.js +63 -63
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +10 -10
- package/src/InAppMessage/models/html-message.js +13 -13
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +59 -59
- package/src/InAppMessage/models/modal-message.js +9 -9
- package/src/InAppMessage/models/slide-up-message.js +11 -11
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +42 -40
- package/src/Push/push-manager-factory.js +5 -4
- package/src/Push/push-manager.js +77 -89
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +8 -8
- package/src/User/user.js +29 -29
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +11 -11
- package/src/common/feed-display.js +18 -17
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +15 -5
- package/src/managers/auth-manager.js +9 -9
- package/src/managers/braze-instance.js +89 -87
- package/src/managers/device-manager.js +17 -17
- package/src/managers/network-manager.js +130 -130
- package/src/managers/server-config-manager.js +24 -24
- package/src/managers/session-manager.js +12 -12
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +31 -31
- package/src/managers/subscription-manager.js +2 -2
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +5 -5
- package/src/request-controller.js +130 -130
- package/src/triggers/models/filter.js +9 -9
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +27 -27
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +7 -7
- package/src/triggers/triggers-provider.js +29 -29
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/component-utils.js +13 -12
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +17 -17
- package/src/util/user-agent-parser.js +3 -3
- package/src/util/window-utils.js +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { logger as r } from "../../shared-lib/index.js";
|
|
2
2
|
import e from "../managers/braze-instance.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
q: (o,
|
|
3
|
+
import ve from "../models/braze-event.js";
|
|
4
|
+
import s from "../models/request-result.js";
|
|
5
|
+
const t = {
|
|
6
|
+
q: (o, t, n) => {
|
|
7
7
|
var i, l;
|
|
8
|
-
const d = new
|
|
8
|
+
const d = new s(),
|
|
9
9
|
m = e.zr();
|
|
10
10
|
if (!m)
|
|
11
11
|
return (
|
|
@@ -14,21 +14,21 @@ const s = {
|
|
|
14
14
|
),
|
|
15
15
|
d
|
|
16
16
|
);
|
|
17
|
-
const u = m.
|
|
17
|
+
const u = m.xo();
|
|
18
18
|
return (
|
|
19
19
|
d.ge.push(
|
|
20
|
-
new
|
|
21
|
-
|
|
20
|
+
new ve(
|
|
21
|
+
n || (null === (i = e.er()) || void 0 === i ? void 0 : i.getUserId()),
|
|
22
22
|
o,
|
|
23
23
|
new Date().valueOf(),
|
|
24
24
|
u,
|
|
25
|
-
|
|
25
|
+
t,
|
|
26
26
|
),
|
|
27
27
|
),
|
|
28
28
|
(d.L =
|
|
29
|
-
(null === (l = e.l()) || void 0 === l ? void 0 : l.
|
|
29
|
+
(null === (l = e.l()) || void 0 === l ? void 0 : l.zo(d.ge)) || !1),
|
|
30
30
|
d
|
|
31
31
|
);
|
|
32
32
|
},
|
|
33
33
|
};
|
|
34
|
-
export default
|
|
34
|
+
export default t;
|
|
@@ -12,7 +12,7 @@ import { Card, ControlCard } from "../Card/index.js";
|
|
|
12
12
|
import { cardToHtml as _e } from "../Card/display/card-display.js";
|
|
13
13
|
import { isArray as j } from "../util/code-utils.js";
|
|
14
14
|
import { KeyCodes as mt } from "../util/key-codes.js";
|
|
15
|
-
import
|
|
15
|
+
import ue from "../l10n/l10n-manager-factory.js";
|
|
16
16
|
import { removeSubscription } from "../Core/remove-subscription.js";
|
|
17
17
|
import { logger as r, Guid as p } from "../../shared-lib/index.js";
|
|
18
18
|
import { BRAZE_ACTION_URI_REGEX as Z } from "../util/validation-utils.js";
|
|
@@ -41,11 +41,12 @@ export function destroyFeedHtml(e) {
|
|
|
41
41
|
delete scrollListeners[o]);
|
|
42
42
|
}
|
|
43
43
|
export function generateFeedBody(e, t) {
|
|
44
|
-
const o =
|
|
44
|
+
const o = ue.m(),
|
|
45
|
+
s = document.createElement("div");
|
|
45
46
|
if (
|
|
46
|
-
((
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
((s.className = "ab-feed-body"),
|
|
48
|
+
s.setAttribute("aria-label", "Feed"),
|
|
49
|
+
s.setAttribute("role", "feed"),
|
|
49
50
|
null == e.lastUpdated)
|
|
50
51
|
) {
|
|
51
52
|
const e = document.createElement("div");
|
|
@@ -53,27 +54,27 @@ export function generateFeedBody(e, t) {
|
|
|
53
54
|
const t = document.createElement("i");
|
|
54
55
|
(t.className = "fa fa-spinner fa-spin fa-4x ab-initial-spinner"),
|
|
55
56
|
e.appendChild(t),
|
|
56
|
-
|
|
57
|
+
s.appendChild(e);
|
|
57
58
|
} else {
|
|
58
|
-
let
|
|
59
|
+
let n = !1;
|
|
59
60
|
const logCardClick = (t) => e.logCardClick(t);
|
|
60
|
-
for (const
|
|
61
|
-
const
|
|
62
|
-
!
|
|
63
|
-
? (
|
|
61
|
+
for (const i of e.cards) {
|
|
62
|
+
const a = i instanceof ControlCard;
|
|
63
|
+
!a || e.dr()
|
|
64
|
+
? (s.appendChild(_e(i, logCardClick, t, o.wo())), (n = n || !a))
|
|
64
65
|
: r.error(
|
|
65
66
|
"Received a control card for a legacy news feed. Control cards are only supported with content cards.",
|
|
66
67
|
);
|
|
67
68
|
}
|
|
68
|
-
if (!
|
|
69
|
+
if (!n) {
|
|
69
70
|
const e = document.createElement("div");
|
|
70
71
|
(e.className = "ab-no-cards-message"),
|
|
71
|
-
(e.innerHTML =
|
|
72
|
+
(e.innerHTML = o.get("NO_CARDS_MESSAGE") || ""),
|
|
72
73
|
e.setAttribute("role", "article"),
|
|
73
|
-
|
|
74
|
+
s.appendChild(e);
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
return
|
|
77
|
+
return s;
|
|
77
78
|
}
|
|
78
79
|
export function detectFeedImpressions(e, t) {
|
|
79
80
|
if (null != e && null != t) {
|
|
@@ -123,7 +124,7 @@ export function refreshFeed(e, t) {
|
|
|
123
124
|
const o = t.querySelectorAll(".ab-initial-spinner")[0];
|
|
124
125
|
if (null != o) {
|
|
125
126
|
const e = document.createElement("span");
|
|
126
|
-
(e.innerHTML =
|
|
127
|
+
(e.innerHTML = ue.m().get("FEED_TIMEOUT_MESSAGE") || ""),
|
|
127
128
|
null != o.parentNode &&
|
|
128
129
|
(o.parentNode.appendChild(e), o.parentNode.removeChild(o));
|
|
129
130
|
}
|
|
@@ -187,7 +188,7 @@ export function updateFeedCards(e, t, o, s, n) {
|
|
|
187
188
|
if (e.url && Z.test(e.url)) {
|
|
188
189
|
const t = W(e.url);
|
|
189
190
|
if (jt(t)) {
|
|
190
|
-
r.error(vt(bt.
|
|
191
|
+
r.error(vt(bt.Vi, "Content Card"));
|
|
191
192
|
continue;
|
|
192
193
|
}
|
|
193
194
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import e, { OPTIONS as L } from "../managers/braze-instance.js";
|
|
2
2
|
import X from "../util/browser-detector.js";
|
|
3
3
|
import nr from "./l10n-manager.js";
|
|
4
|
-
const
|
|
4
|
+
const ue = {
|
|
5
5
|
t: !1,
|
|
6
6
|
i: null,
|
|
7
7
|
m: () => {
|
|
8
|
-
if ((
|
|
8
|
+
if ((ue.o(), !ue.i)) {
|
|
9
9
|
let r = X.language,
|
|
10
10
|
t = !1;
|
|
11
|
-
e.nn(L.zn) && ((r = e.nn(L.zn)), (t = !0)), (
|
|
11
|
+
e.nn(L.zn) && ((r = e.nn(L.zn)), (t = !0)), (ue.i = new nr(r, t));
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return ue.i;
|
|
14
14
|
},
|
|
15
15
|
o: () => {
|
|
16
|
-
|
|
16
|
+
ue.t || (e.g(ue), (ue.t = !0));
|
|
17
17
|
},
|
|
18
18
|
destroy: () => {
|
|
19
|
-
(
|
|
19
|
+
(ue.i = null), (ue.t = !1);
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
-
export default
|
|
22
|
+
export default ue;
|
package/src/l10n/l10n-manager.js
CHANGED
|
@@ -1,25 +1,35 @@
|
|
|
1
1
|
import { logger as r } from "../../shared-lib/index.js";
|
|
2
2
|
import xt from "../common/translations.js";
|
|
3
3
|
export default class nr {
|
|
4
|
-
constructor(t,
|
|
4
|
+
constructor(t, e = !1) {
|
|
5
5
|
if (
|
|
6
6
|
((this.language = t),
|
|
7
7
|
null != t && (t = t.toLowerCase()),
|
|
8
8
|
null != t && null == xt[t])
|
|
9
9
|
) {
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
const e = t.indexOf("-");
|
|
11
|
+
e > 0 && (t = t.substring(0, e));
|
|
12
12
|
}
|
|
13
13
|
if (null == xt[t]) {
|
|
14
|
-
const
|
|
14
|
+
const a =
|
|
15
15
|
"Braze does not yet have a localization for language " +
|
|
16
16
|
t +
|
|
17
17
|
", defaulting to English. Please contact us if you are willing and able to help us translate our SDK into this language.";
|
|
18
|
-
|
|
18
|
+
e ? r.error(a) : r.info(a), (t = "en");
|
|
19
19
|
}
|
|
20
20
|
this.language = t;
|
|
21
21
|
}
|
|
22
22
|
get(t) {
|
|
23
23
|
return xt[this.language][t];
|
|
24
24
|
}
|
|
25
|
+
wo() {
|
|
26
|
+
switch (this.language) {
|
|
27
|
+
case "ar":
|
|
28
|
+
case "he":
|
|
29
|
+
case "fa":
|
|
30
|
+
return "rtl";
|
|
31
|
+
default:
|
|
32
|
+
return "ltr";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
25
35
|
}
|
|
@@ -21,20 +21,20 @@ export default class qt {
|
|
|
21
21
|
}
|
|
22
22
|
setSdkAuthenticationSignature(t) {
|
|
23
23
|
const i = this.kh();
|
|
24
|
-
this.u.
|
|
25
|
-
const s = A.
|
|
26
|
-
new A(s, r).setItem(s.
|
|
24
|
+
this.u.I(o.C.wh, t);
|
|
25
|
+
const s = A.ts.Zt;
|
|
26
|
+
new A(s, r).setItem(s.hs.jh, this.gh, t), i !== t && this.Vs();
|
|
27
27
|
}
|
|
28
28
|
xh() {
|
|
29
|
-
this.u.
|
|
30
|
-
const t = A.
|
|
31
|
-
new A(t, r).re(t.
|
|
29
|
+
this.u.ii(o.C.wh);
|
|
30
|
+
const t = A.ts.Zt;
|
|
31
|
+
new A(t, r).re(t.hs.jh, this.gh);
|
|
32
32
|
}
|
|
33
33
|
subscribeToSdkAuthenticationFailures(t) {
|
|
34
|
-
return this.Qn.
|
|
34
|
+
return this.Qn.Nt(t);
|
|
35
35
|
}
|
|
36
36
|
qh(t) {
|
|
37
|
-
this.Qn.
|
|
37
|
+
this.Qn.Rt(t);
|
|
38
38
|
}
|
|
39
39
|
yh() {
|
|
40
40
|
this.Xn.removeAllSubscriptions();
|
|
@@ -45,7 +45,7 @@ export default class qt {
|
|
|
45
45
|
Gh() {
|
|
46
46
|
return this.Zn;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
Vs() {
|
|
49
49
|
this.Zn = 0;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
isArray as j,
|
|
8
8
|
keys as to,
|
|
9
9
|
validateValueIsFromEnum as J,
|
|
10
|
-
values as
|
|
10
|
+
values as Rt,
|
|
11
11
|
} from "../util/code-utils.js";
|
|
12
|
-
import
|
|
12
|
+
import Pt from "./network-manager.js";
|
|
13
13
|
import Lt from "../request-controller.js";
|
|
14
14
|
import Dt from "./server-config-manager.js";
|
|
15
15
|
import Mt from "./session-manager.js";
|
|
@@ -22,23 +22,23 @@ import { User } from "../User/index.js";
|
|
|
22
22
|
import { parseQueryStringKeyValues as ut } from "../util/url-utils.js";
|
|
23
23
|
import { WindowUtils as eo } from "../util/window-utils.js";
|
|
24
24
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js";
|
|
25
|
-
import { SupportedOptions as
|
|
25
|
+
import { SupportedOptions as zt, logger as r } from "../../shared-lib/index.js";
|
|
26
26
|
import _t from "../models/identifier.js";
|
|
27
27
|
const L = {
|
|
28
28
|
Eo: "allowCrawlerActivity",
|
|
29
29
|
_o: "baseUrl",
|
|
30
30
|
Io: "noCookies",
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
So: "devicePropertyAllowlist",
|
|
32
|
+
Aa: "disablePushTokenMaintenance",
|
|
33
|
+
Ao: "enableLogging",
|
|
34
34
|
No: "enableSdkAuthentication",
|
|
35
|
-
|
|
35
|
+
qa: "manageServiceWorkerExternally",
|
|
36
36
|
Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
Ro: "sessionTimeoutInSeconds",
|
|
38
|
+
Po: "appVersion",
|
|
39
39
|
Lo: "appVersionNumber",
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
Ma: "serviceWorkerLocation",
|
|
41
|
+
ka: "safariWebsitePushId",
|
|
42
42
|
zn: "localization",
|
|
43
43
|
bo: "contentSecurityNonce",
|
|
44
44
|
Do: "allowUserSuppliedJavascript",
|
|
@@ -49,23 +49,24 @@ const L = {
|
|
|
49
49
|
Lh: "requireExplicitInAppMessageDismissal",
|
|
50
50
|
Mo: "doNotLoadFontAwesome",
|
|
51
51
|
Uo: "deviceId",
|
|
52
|
-
|
|
52
|
+
_a: "serviceWorkerScope",
|
|
53
|
+
Wo: "sdkFlavor",
|
|
53
54
|
};
|
|
54
|
-
class
|
|
55
|
+
class Vt {
|
|
55
56
|
constructor() {
|
|
56
57
|
(this.rn = ""),
|
|
57
|
-
(this.
|
|
58
|
+
(this.Bo = ""),
|
|
58
59
|
(this.Vo = void 0),
|
|
59
|
-
(this.
|
|
60
|
+
(this.Ko = null),
|
|
60
61
|
(this.on = null),
|
|
62
|
+
(this.$t = null),
|
|
63
|
+
(this.Ui = null),
|
|
61
64
|
(this.qt = null),
|
|
62
|
-
(this.
|
|
63
|
-
(this.yt = null),
|
|
64
|
-
(this.ri = null),
|
|
65
|
+
(this.oi = null),
|
|
65
66
|
(this.u = null),
|
|
66
|
-
(this.
|
|
67
|
+
(this.yt = null),
|
|
67
68
|
(this.Go = ""),
|
|
68
|
-
(this.
|
|
69
|
+
(this.isInitialized = !1),
|
|
69
70
|
(this.$o = !1),
|
|
70
71
|
(this.qo = new T()),
|
|
71
72
|
(this.Jo = new T()),
|
|
@@ -73,20 +74,20 @@ class zt {
|
|
|
73
74
|
(this.Yo = []),
|
|
74
75
|
(this.Ho = []),
|
|
75
76
|
(this._e = []),
|
|
76
|
-
(this.
|
|
77
|
+
(this.Bo = "5.5.0");
|
|
77
78
|
}
|
|
78
79
|
Xo(t) {
|
|
79
|
-
this.qo.
|
|
80
|
+
this.qo.Nt(t);
|
|
80
81
|
}
|
|
81
82
|
Sh(t) {
|
|
82
|
-
this.Jo.
|
|
83
|
+
this.Jo.Nt(t);
|
|
83
84
|
}
|
|
84
85
|
initialize(t, i) {
|
|
85
86
|
if (this.so())
|
|
86
87
|
return r.info("Braze has already been initialized with an API key."), !0;
|
|
87
88
|
this.options = i || {};
|
|
88
|
-
let s = this.nn(L.
|
|
89
|
-
const e = ut(eo.
|
|
89
|
+
let s = this.nn(L.Ao);
|
|
90
|
+
const e = ut(eo.Zo());
|
|
90
91
|
if (
|
|
91
92
|
(e && "true" === e.brazeLogging && (s = !0),
|
|
92
93
|
r.init(s),
|
|
@@ -107,7 +108,7 @@ class zt {
|
|
|
107
108
|
(n.href = h),
|
|
108
109
|
"/" === n.pathname && (n = `${n}api/v3`),
|
|
109
110
|
(this.Go = n.toString()),
|
|
110
|
-
X.
|
|
111
|
+
X.Qo && !this.nn(L.Eo))
|
|
111
112
|
)
|
|
112
113
|
return (
|
|
113
114
|
r.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
@@ -116,7 +117,7 @@ class zt {
|
|
|
116
117
|
);
|
|
117
118
|
const a = this.nn(L.Io) || !1;
|
|
118
119
|
if (
|
|
119
|
-
((this.u = Wt.
|
|
120
|
+
((this.u = Wt.Wh(t, a)), a && this.u.Vh(t), new Q.ee(null, !0).br(o.se))
|
|
120
121
|
)
|
|
121
122
|
return (
|
|
122
123
|
r.info("Ignoring all activity due to previous opt out"),
|
|
@@ -124,16 +125,16 @@ class zt {
|
|
|
124
125
|
!1
|
|
125
126
|
);
|
|
126
127
|
for (const t of to(this.options))
|
|
127
|
-
-1 ===
|
|
128
|
+
-1 === Rt(zt).indexOf(t) &&
|
|
128
129
|
r.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
129
130
|
const l = ["mparticle", "wordpress", "tealium"];
|
|
130
|
-
if (null != this.nn(L.
|
|
131
|
-
const t = this.nn(L.
|
|
131
|
+
if (null != this.nn(L.Wo)) {
|
|
132
|
+
const t = this.nn(L.Wo);
|
|
132
133
|
-1 !== l.indexOf(t)
|
|
133
134
|
? (this.Vo = t)
|
|
134
135
|
: r.error("Invalid sdk flavor passed: " + t);
|
|
135
136
|
}
|
|
136
|
-
let u = this.nn(
|
|
137
|
+
let u = this.nn(zt.So);
|
|
137
138
|
if (null != u)
|
|
138
139
|
if (j(u)) {
|
|
139
140
|
const t = [];
|
|
@@ -150,119 +151,120 @@ class zt {
|
|
|
150
151
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
151
152
|
),
|
|
152
153
|
(u = null);
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
const t = new _t(
|
|
154
|
+
const c = this.nn(L.Uo);
|
|
155
|
+
if (c) {
|
|
156
|
+
const t = new _t(c);
|
|
156
157
|
this.u.uu(o.iu.Uo, t);
|
|
157
158
|
}
|
|
158
159
|
(this.on = new Ot(this.u, u)),
|
|
159
|
-
(this.
|
|
160
|
-
(this.
|
|
161
|
-
(this.
|
|
162
|
-
const
|
|
160
|
+
(this.qt = new Dt(this.u)),
|
|
161
|
+
(this.yt = new kt(this.qt, this.u)),
|
|
162
|
+
(this.oi = new Mt(this.u, this.yt, this.qt, this.nn(L.Ro)));
|
|
163
|
+
const f = new T();
|
|
163
164
|
return (
|
|
164
|
-
(this.
|
|
165
|
-
this
|
|
166
|
-
(this
|
|
165
|
+
(this.Ko = new qt(this.u, this.nn(L.No), f)),
|
|
166
|
+
this.Ht(f),
|
|
167
|
+
(this.$t = new Pt(
|
|
167
168
|
this.on,
|
|
168
169
|
this.u,
|
|
169
|
-
this.
|
|
170
|
-
this.wt,
|
|
171
|
-
this.ri,
|
|
170
|
+
this.Ko,
|
|
172
171
|
this.yt,
|
|
172
|
+
this.oi,
|
|
173
|
+
this.qt,
|
|
173
174
|
this.rn,
|
|
174
175
|
this.Go,
|
|
175
|
-
this.
|
|
176
|
+
this.Bo,
|
|
176
177
|
this.Vo || "",
|
|
177
|
-
this.nn(L.
|
|
178
|
+
this.nn(L.Po),
|
|
178
179
|
this.nn(L.Lo),
|
|
179
180
|
)),
|
|
180
|
-
(this.
|
|
181
|
+
(this.Ui = new Lt(
|
|
181
182
|
this.rn,
|
|
182
183
|
this.Go,
|
|
183
|
-
this.
|
|
184
|
+
this.oi,
|
|
184
185
|
this.on,
|
|
185
|
-
this.wt,
|
|
186
186
|
this.yt,
|
|
187
|
+
this.qt,
|
|
187
188
|
this.u,
|
|
188
189
|
(t) => {
|
|
189
|
-
if (this.so()) for (const i of this.gr()) i.
|
|
190
|
+
if (this.so()) for (const i of this.gr()) i.Ss(t);
|
|
190
191
|
},
|
|
191
|
-
this.
|
|
192
|
-
this
|
|
192
|
+
this.Ko,
|
|
193
|
+
this.$t,
|
|
193
194
|
)),
|
|
194
|
-
this.
|
|
195
|
-
a || this.u.
|
|
195
|
+
this.Ui.initialize(),
|
|
196
|
+
a || this.u.Kh(),
|
|
196
197
|
r.info(
|
|
197
198
|
`Initialized for the Braze backend at "${this.nn(
|
|
198
199
|
L._o,
|
|
199
200
|
)}" with API key "${this.rn}".`,
|
|
200
201
|
),
|
|
201
202
|
et.o(),
|
|
202
|
-
this.
|
|
203
|
+
this.qt.bi(() => {
|
|
203
204
|
var t;
|
|
204
|
-
this.
|
|
205
|
-
(null === (t = this.
|
|
205
|
+
this.isInitialized &&
|
|
206
|
+
(null === (t = this.qt) || void 0 === t ? void 0 : t.mi()) &&
|
|
206
207
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
207
|
-
if (!this.
|
|
208
|
+
if (!this.isInitialized) return;
|
|
208
209
|
(0, t.default)();
|
|
209
210
|
});
|
|
210
211
|
}),
|
|
211
|
-
this.
|
|
212
|
+
this.Ui.mr(() => {
|
|
212
213
|
var t;
|
|
213
|
-
this.
|
|
214
|
-
(null === (t = this.
|
|
214
|
+
this.isInitialized &&
|
|
215
|
+
(null === (t = this.qt) || void 0 === t ? void 0 : t.mi()) &&
|
|
215
216
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
216
|
-
if (!this.
|
|
217
|
+
if (!this.isInitialized) return;
|
|
217
218
|
(0, t.default)(void 0, void 0, !0);
|
|
218
219
|
});
|
|
219
220
|
}),
|
|
220
|
-
this.qo.
|
|
221
|
-
(this.
|
|
221
|
+
this.qo.Rt(this.options),
|
|
222
|
+
(this.isInitialized = !0),
|
|
223
|
+
window.dispatchEvent(new CustomEvent("braze.initialized")),
|
|
222
224
|
!0
|
|
223
225
|
);
|
|
224
226
|
}
|
|
225
227
|
destroy(t) {
|
|
226
228
|
if ((r.destroy(), this.so())) {
|
|
227
|
-
this.Jo.
|
|
229
|
+
this.Jo.Rt(), this.Jo.removeAllSubscriptions();
|
|
228
230
|
for (const t of this.Yo) t.destroy();
|
|
229
231
|
this.Yo = [];
|
|
230
232
|
for (const t of this.Ho) t.clearData(!1);
|
|
231
233
|
(this.Ho = []),
|
|
232
234
|
this.removeAllSubscriptions(),
|
|
233
235
|
(this._e = []),
|
|
234
|
-
null != this.
|
|
235
|
-
(this.
|
|
236
|
-
(this.
|
|
236
|
+
null != this.Ui && this.Ui.destroy(),
|
|
237
|
+
(this.Ui = null),
|
|
238
|
+
(this.Ko = null),
|
|
237
239
|
(this.on = null),
|
|
240
|
+
(this.$t = null),
|
|
238
241
|
(this.qt = null),
|
|
242
|
+
(this.oi = null),
|
|
239
243
|
(this.yt = null),
|
|
240
|
-
(this.ri = null),
|
|
241
|
-
(this.wt = null),
|
|
242
244
|
(this.options = {}),
|
|
243
245
|
(this.Vo = void 0),
|
|
244
|
-
(this.
|
|
246
|
+
(this.isInitialized = !1),
|
|
245
247
|
(this.$o = !1),
|
|
246
248
|
t && (this.u = null);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
X() {
|
|
250
|
-
return !this
|
|
252
|
+
return !this.$h() && (!!this.so() || (console.warn(_), !1));
|
|
251
253
|
}
|
|
252
254
|
ba() {
|
|
253
255
|
return this.rn;
|
|
254
256
|
}
|
|
255
257
|
Sr() {
|
|
256
|
-
return this.
|
|
258
|
+
return this.Ko;
|
|
257
259
|
}
|
|
258
|
-
|
|
260
|
+
Os() {
|
|
259
261
|
return this.Go;
|
|
260
262
|
}
|
|
261
263
|
te() {
|
|
262
264
|
return this.on;
|
|
263
265
|
}
|
|
264
266
|
nr() {
|
|
265
|
-
return this
|
|
267
|
+
return this.$t;
|
|
266
268
|
}
|
|
267
269
|
nn(t) {
|
|
268
270
|
return this.options[t];
|
|
@@ -271,22 +273,22 @@ class zt {
|
|
|
271
273
|
return this.Ho;
|
|
272
274
|
}
|
|
273
275
|
cr() {
|
|
274
|
-
return this.
|
|
276
|
+
return this.Ui;
|
|
275
277
|
}
|
|
276
278
|
ir() {
|
|
277
|
-
return this.
|
|
279
|
+
return this.qt;
|
|
278
280
|
}
|
|
279
281
|
zr() {
|
|
280
|
-
return this.
|
|
282
|
+
return this.oi;
|
|
281
283
|
}
|
|
282
284
|
l() {
|
|
283
285
|
return this.u;
|
|
284
286
|
}
|
|
285
287
|
pr() {
|
|
286
|
-
if (this.
|
|
288
|
+
if (this.yt && this.Ui) return new User(this.yt, this.Ui);
|
|
287
289
|
}
|
|
288
290
|
er() {
|
|
289
|
-
return this.
|
|
291
|
+
return this.yt;
|
|
290
292
|
}
|
|
291
293
|
tr() {
|
|
292
294
|
return !0 === this.nn(L.Do);
|
|
@@ -301,7 +303,7 @@ class zt {
|
|
|
301
303
|
for (const s of this.Ho) s.constructor === t.constructor && (i = !0);
|
|
302
304
|
t instanceof y && !i && this.Ho.push(t);
|
|
303
305
|
}
|
|
304
|
-
|
|
306
|
+
Ht(t) {
|
|
305
307
|
t instanceof T && this._e.push(t);
|
|
306
308
|
}
|
|
307
309
|
removeAllSubscriptions() {
|
|
@@ -314,14 +316,14 @@ class zt {
|
|
|
314
316
|
this.$o = t;
|
|
315
317
|
}
|
|
316
318
|
so() {
|
|
317
|
-
return this.
|
|
319
|
+
return this.isInitialized;
|
|
318
320
|
}
|
|
319
|
-
|
|
321
|
+
$h() {
|
|
320
322
|
return this.$o;
|
|
321
323
|
}
|
|
322
|
-
|
|
323
|
-
return this.
|
|
324
|
+
ks() {
|
|
325
|
+
return this.Bo;
|
|
324
326
|
}
|
|
325
327
|
}
|
|
326
|
-
const e = new
|
|
327
|
-
export { e as default,
|
|
328
|
+
const e = new Vt();
|
|
329
|
+
export { e as default, Vt as BrazeSdkInstance, L as OPTIONS };
|
|
@@ -4,39 +4,39 @@ import DeviceProperties from "../Core/device-properties.js";
|
|
|
4
4
|
import _t from "../models/identifier.js";
|
|
5
5
|
import { logger as r, Guid as p } from "../../shared-lib/index.js";
|
|
6
6
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
7
|
-
import { values as
|
|
7
|
+
import { values as Rt } from "../util/code-utils.js";
|
|
8
8
|
import { getErrorMessage as si } from "../util/error-utils.js";
|
|
9
9
|
export default class Ot {
|
|
10
10
|
constructor(t, e) {
|
|
11
11
|
(this.u = t),
|
|
12
|
-
(this.
|
|
12
|
+
(this.Ia = e),
|
|
13
13
|
(this.u = t),
|
|
14
|
-
null == e && (e =
|
|
15
|
-
(this.
|
|
14
|
+
null == e && (e = Rt(DeviceProperties)),
|
|
15
|
+
(this.Ia = e);
|
|
16
16
|
}
|
|
17
17
|
ce(t = !0) {
|
|
18
18
|
let e = this.u.tu(o.iu.Uo);
|
|
19
19
|
null == e && ((e = new _t(p.W())), t && this.u.uu(o.iu.Uo, e));
|
|
20
20
|
const r = new Gt(e.eu);
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
21
|
+
for (let t = 0; t < this.Ia.length; t++) {
|
|
22
|
+
switch (this.Ia[t]) {
|
|
23
23
|
case DeviceProperties.BROWSER:
|
|
24
24
|
r.browser = X.browser;
|
|
25
25
|
break;
|
|
26
26
|
case DeviceProperties.BROWSER_VERSION:
|
|
27
|
-
r.
|
|
27
|
+
r.Ta = X.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.Da();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.Sa = screen.width + "x" + screen.height;
|
|
34
34
|
break;
|
|
35
35
|
case DeviceProperties.LANGUAGE:
|
|
36
36
|
r.language = X.language;
|
|
37
37
|
break;
|
|
38
38
|
case DeviceProperties.TIME_ZONE:
|
|
39
|
-
r.timeZone = this.
|
|
39
|
+
r.timeZone = this.Oa(new Date());
|
|
40
40
|
break;
|
|
41
41
|
case DeviceProperties.USER_AGENT:
|
|
42
42
|
r.userAgent = X.userAgent;
|
|
@@ -44,12 +44,12 @@ export default class Ot {
|
|
|
44
44
|
}
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
if (X.
|
|
49
|
-
const t = this.u.j(o.C.
|
|
50
|
-
return t && t.os_version ? t.os_version : X.
|
|
47
|
+
Da() {
|
|
48
|
+
if (X.Ca()) return X.Ca();
|
|
49
|
+
const t = this.u.j(o.C.Fa);
|
|
50
|
+
return t && t.os_version ? t.os_version : X.Da();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Oa(t) {
|
|
53
53
|
let e = !1;
|
|
54
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
55
55
|
try {
|
|
@@ -66,9 +66,9 @@ export default class Ot {
|
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
68
|
const s = t.getTimezoneOffset();
|
|
69
|
-
return this.
|
|
69
|
+
return this.Ga(s);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Ga(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|