@braze/web-sdk 5.1.1 → 5.3.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 +65 -10
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +22 -21
- package/src/ContentCards/content-cards-provider.js +107 -135
- 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 +2 -2
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/FeatureFlags/feature-flag.js +41 -30
- package/src/FeatureFlags/feature-flags-provider.js +88 -84
- 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 +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +24 -24
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.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/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +45 -42
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +23 -21
- package/src/InAppMessage/in-app-message-manager.js +95 -112
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +4 -2
- package/src/InAppMessage/models/full-screen-message.js +14 -11
- package/src/InAppMessage/models/html-message.js +11 -9
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +127 -120
- package/src/InAppMessage/models/modal-message.js +14 -11
- package/src/InAppMessage/models/slide-up-message.js +46 -21
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +37 -43
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +118 -110
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +19 -19
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +0 -2
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +12 -12
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +27 -27
- package/src/managers/braze-instance.js +119 -112
- package/src/managers/device-manager.js +19 -19
- package/src/managers/network-manager.js +215 -165
- package/src/managers/server-config-manager.js +46 -50
- package/src/managers/session-manager.js +21 -21
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +128 -125
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +19 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +34 -20
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +134 -124
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +56 -56
- 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 +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +84 -95
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/load-font-awesome.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 +25 -24
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +36 -37
- package/src/util/user-agent-parser.js +8 -8
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
|
@@ -11,16 +11,16 @@ import { bottomIsInView as he, topIsInView as Se } from "../util/dom-utils.js";
|
|
|
11
11
|
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
|
-
import { KeyCodes as
|
|
14
|
+
import { KeyCodes as lt } from "../util/key-codes.js";
|
|
15
15
|
import je 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";
|
|
19
19
|
import {
|
|
20
|
-
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as
|
|
21
|
-
ineligibleBrazeActionURLErrorMessage as
|
|
20
|
+
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as jt,
|
|
21
|
+
ineligibleBrazeActionURLErrorMessage as dt,
|
|
22
22
|
getDecodedBrazeAction as W,
|
|
23
|
-
containsUnknownBrazeAction as
|
|
23
|
+
containsUnknownBrazeAction as ft,
|
|
24
24
|
} from "../util/braze-actions.js";
|
|
25
25
|
export const LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE =
|
|
26
26
|
"data-last-requested-refresh";
|
|
@@ -32,7 +32,7 @@ export function destroyFeedHtml(e) {
|
|
|
32
32
|
((e.className = e.className.replace("ab-show", "ab-hide")),
|
|
33
33
|
setTimeout(() => {
|
|
34
34
|
e && e.parentNode && e.parentNode.removeChild(e);
|
|
35
|
-
}, x.
|
|
35
|
+
}, x.Ah));
|
|
36
36
|
const t = e.getAttribute("data-update-subscription-id");
|
|
37
37
|
null != t && removeSubscription(t);
|
|
38
38
|
const o = e.getAttribute("data-listener-id");
|
|
@@ -79,12 +79,12 @@ export function detectFeedImpressions(e, t) {
|
|
|
79
79
|
if (null != e && null != t) {
|
|
80
80
|
const o = [],
|
|
81
81
|
s = t.querySelectorAll(".ab-card");
|
|
82
|
-
e.
|
|
82
|
+
e.yo || (e.yo = {});
|
|
83
83
|
for (let t = 0; t < s.length; t++) {
|
|
84
84
|
const n = ye(s[t]),
|
|
85
85
|
r = Se(s[t]),
|
|
86
86
|
i = he(s[t]);
|
|
87
|
-
if (e.
|
|
87
|
+
if (e.yo[n]) {
|
|
88
88
|
r || i || Te(s[t]);
|
|
89
89
|
continue;
|
|
90
90
|
}
|
|
@@ -100,7 +100,7 @@ export function detectFeedImpressions(e, t) {
|
|
|
100
100
|
if (l && c) continue;
|
|
101
101
|
for (const t of e.cards)
|
|
102
102
|
if (t.id === n) {
|
|
103
|
-
(e.
|
|
103
|
+
(e.yo[t.id] = !0), o.push(t);
|
|
104
104
|
break;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -152,7 +152,7 @@ export function feedToHtml(e, t, o) {
|
|
|
152
152
|
destroyFeedHtml(s), e.stopPropagation();
|
|
153
153
|
};
|
|
154
154
|
r.addEventListener("keydown", (e) => {
|
|
155
|
-
(e.keyCode !==
|
|
155
|
+
(e.keyCode !== lt.Fo && e.keyCode !== lt.To) || i(e);
|
|
156
156
|
}),
|
|
157
157
|
(r.onclick = i);
|
|
158
158
|
const a = document.createElement("i");
|
|
@@ -165,7 +165,7 @@ export function feedToHtml(e, t, o) {
|
|
|
165
165
|
refreshFeed(e, s), t.stopPropagation();
|
|
166
166
|
};
|
|
167
167
|
a.addEventListener("keydown", (e) => {
|
|
168
|
-
(e.keyCode !==
|
|
168
|
+
(e.keyCode !== lt.Fo && e.keyCode !== lt.To) || d(e);
|
|
169
169
|
}),
|
|
170
170
|
(a.onclick = d),
|
|
171
171
|
n.appendChild(a),
|
|
@@ -186,8 +186,8 @@ export function updateFeedCards(e, t, o, s, n) {
|
|
|
186
186
|
if (e instanceof Card) {
|
|
187
187
|
if (e.url && Z.test(e.url)) {
|
|
188
188
|
const t = W(e.url);
|
|
189
|
-
if (
|
|
190
|
-
r.error(
|
|
189
|
+
if (ft(t)) {
|
|
190
|
+
r.error(dt(jt.Qi, "Content Card"));
|
|
191
191
|
continue;
|
|
192
192
|
}
|
|
193
193
|
}
|
package/src/l10n/l10n-manager.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { logger as r } from "../../shared-lib/index.js";
|
|
2
|
-
import
|
|
2
|
+
import xt from "../common/translations.js";
|
|
3
3
|
export default class nr {
|
|
4
4
|
constructor(t, l = !1) {
|
|
5
5
|
if (
|
|
6
6
|
((this.language = t),
|
|
7
7
|
null != t && (t = t.toLowerCase()),
|
|
8
|
-
null != t && null ==
|
|
8
|
+
null != t && null == xt[t])
|
|
9
9
|
) {
|
|
10
10
|
const l = t.indexOf("-");
|
|
11
11
|
l > 0 && (t = t.substring(0, l));
|
|
12
12
|
}
|
|
13
|
-
if (null ==
|
|
13
|
+
if (null == xt[t]) {
|
|
14
14
|
const n =
|
|
15
15
|
"Braze does not yet have a localization for language " +
|
|
16
16
|
t +
|
|
@@ -20,6 +20,6 @@ export default class nr {
|
|
|
20
20
|
this.language = t;
|
|
21
21
|
}
|
|
22
22
|
get(t) {
|
|
23
|
-
return
|
|
23
|
+
return xt[this.language][t];
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -4,48 +4,48 @@ import { logger as r, IndexedDBAdapter as A } from "../../shared-lib/index.js";
|
|
|
4
4
|
export default class kt {
|
|
5
5
|
constructor(t, i, s) {
|
|
6
6
|
(this.u = t),
|
|
7
|
-
(this.
|
|
8
|
-
(this.
|
|
7
|
+
(this.Jn = i),
|
|
8
|
+
(this.Qn = s),
|
|
9
9
|
(this.u = t),
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
10
|
+
(this.Jn = i || !1),
|
|
11
|
+
(this.Qn = s),
|
|
12
|
+
(this.Xn = new T()),
|
|
13
|
+
(this.Zn = 0),
|
|
14
|
+
(this.gh = 1);
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
return this.
|
|
16
|
+
Fh() {
|
|
17
|
+
return this.Jn;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
return this.u.j(o.C.
|
|
19
|
+
kh() {
|
|
20
|
+
return this.u.j(o.C.wh);
|
|
21
21
|
}
|
|
22
22
|
setSdkAuthenticationSignature(t) {
|
|
23
|
-
const i = this.
|
|
24
|
-
this.u.k(o.C.
|
|
23
|
+
const i = this.kh();
|
|
24
|
+
this.u.k(o.C.wh, t);
|
|
25
25
|
const s = A.Yt.Qt;
|
|
26
|
-
new A(s, r).setItem(s.ss.
|
|
26
|
+
new A(s, r).setItem(s.ss.jh, this.gh, t), i !== t && this.Os();
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
this.u.
|
|
28
|
+
xh() {
|
|
29
|
+
this.u.ti(o.C.wh);
|
|
30
30
|
const t = A.Yt.Qt;
|
|
31
|
-
new A(t, r).re(t.ss.
|
|
31
|
+
new A(t, r).re(t.ss.jh, this.gh);
|
|
32
32
|
}
|
|
33
33
|
subscribeToSdkAuthenticationFailures(t) {
|
|
34
|
-
return this.
|
|
34
|
+
return this.Qn.It(t);
|
|
35
|
+
}
|
|
36
|
+
qh(t) {
|
|
37
|
+
this.Qn.Dt(t);
|
|
35
38
|
}
|
|
36
|
-
yh(
|
|
37
|
-
this.
|
|
39
|
+
yh() {
|
|
40
|
+
this.Xn.removeAllSubscriptions();
|
|
38
41
|
}
|
|
39
42
|
Bh() {
|
|
40
|
-
this.
|
|
43
|
+
this.Zn += 1;
|
|
41
44
|
}
|
|
42
45
|
Gh() {
|
|
43
|
-
this.
|
|
44
|
-
}
|
|
45
|
-
Hh() {
|
|
46
|
-
return this.Fh;
|
|
46
|
+
return this.Zn;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
this.
|
|
48
|
+
Os() {
|
|
49
|
+
this.Zn = 0;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -23,68 +23,70 @@ 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
25
|
import { SupportedOptions as Wt, logger as r } from "../../shared-lib/index.js";
|
|
26
|
+
import _t from "../models/identifier.js";
|
|
26
27
|
const L = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
28
|
+
Eo: "allowCrawlerActivity",
|
|
29
|
+
_o: "baseUrl",
|
|
30
|
+
Io: "noCookies",
|
|
31
|
+
Ao: "devicePropertyAllowlist",
|
|
32
|
+
_a: "disablePushTokenMaintenance",
|
|
33
|
+
So: "enableLogging",
|
|
34
|
+
No: "enableSdkAuthentication",
|
|
35
|
+
Ma: "manageServiceWorkerExternally",
|
|
36
|
+
Oo: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
37
|
+
Po: "sessionTimeoutInSeconds",
|
|
38
|
+
Ro: "appVersion",
|
|
39
|
+
Lo: "appVersionNumber",
|
|
40
|
+
wa: "serviceWorkerLocation",
|
|
41
|
+
ya: "safariWebsitePushId",
|
|
42
|
+
zn: "localization",
|
|
43
|
+
bo: "contentSecurityNonce",
|
|
44
|
+
Do: "allowUserSuppliedJavascript",
|
|
45
|
+
jo: "inAppMessageZIndex",
|
|
46
|
+
ho: "openInAppMessagesInNewTab",
|
|
46
47
|
tn: "openCardsInNewTab",
|
|
47
48
|
en: "openNewsFeedCardsInNewTab",
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
Lh: "requireExplicitInAppMessageDismissal",
|
|
50
|
+
Mo: "doNotLoadFontAwesome",
|
|
51
|
+
Uo: "deviceId",
|
|
50
52
|
Bo: "sdkFlavor",
|
|
51
53
|
};
|
|
52
|
-
class
|
|
54
|
+
class Vt {
|
|
53
55
|
constructor() {
|
|
54
|
-
(this.
|
|
56
|
+
(this.rn = ""),
|
|
55
57
|
(this.Wo = ""),
|
|
56
58
|
(this.Vo = void 0),
|
|
57
|
-
(this.
|
|
58
|
-
(this.
|
|
59
|
+
(this.zo = null),
|
|
60
|
+
(this.on = null),
|
|
59
61
|
(this.qt = null),
|
|
60
|
-
(this.
|
|
62
|
+
(this.zi = null),
|
|
61
63
|
(this.yt = null),
|
|
62
|
-
(this.
|
|
64
|
+
(this.ri = null),
|
|
63
65
|
(this.u = null),
|
|
64
66
|
(this.wt = null),
|
|
65
|
-
(this.
|
|
67
|
+
(this.Go = ""),
|
|
68
|
+
(this.Ko = !1),
|
|
66
69
|
(this.$o = !1),
|
|
67
|
-
(this.qo =
|
|
70
|
+
(this.qo = new T()),
|
|
68
71
|
(this.Jo = new T()),
|
|
69
|
-
(this.Yo = new T()),
|
|
70
72
|
(this.options = {}),
|
|
73
|
+
(this.Yo = []),
|
|
71
74
|
(this.Ho = []),
|
|
72
|
-
(this.Xo = []),
|
|
73
75
|
(this._e = []),
|
|
74
|
-
(this.Wo = "5.
|
|
76
|
+
(this.Wo = "5.3.0");
|
|
75
77
|
}
|
|
76
|
-
|
|
77
|
-
this.
|
|
78
|
+
Xo(t) {
|
|
79
|
+
this.qo.It(t);
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
+
Sh(t) {
|
|
82
|
+
this.Jo.It(t);
|
|
81
83
|
}
|
|
82
84
|
initialize(t, i) {
|
|
83
85
|
if (this.so())
|
|
84
86
|
return r.info("Braze has already been initialized with an API key."), !0;
|
|
85
87
|
this.options = i || {};
|
|
86
|
-
let s = this.nn(L.
|
|
87
|
-
const e = ut(eo.
|
|
88
|
+
let s = this.nn(L.So);
|
|
89
|
+
const e = ut(eo.Un());
|
|
88
90
|
if (
|
|
89
91
|
(e && "true" === e.brazeLogging && (s = !0),
|
|
90
92
|
r.init(s),
|
|
@@ -94,8 +96,8 @@ class zt {
|
|
|
94
96
|
null == t || "" === t || "string" != typeof t)
|
|
95
97
|
)
|
|
96
98
|
return r.error("Braze requires a valid API key to be initialized."), !1;
|
|
97
|
-
this.
|
|
98
|
-
let n = this.nn(L.
|
|
99
|
+
this.rn = t;
|
|
100
|
+
let n = this.nn(L._o);
|
|
99
101
|
if (null == n || "" === n || "string" != typeof n)
|
|
100
102
|
return r.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
101
103
|
!1 === /^https?:/.test(n) && (n = `https://${n}`);
|
|
@@ -104,21 +106,21 @@ class zt {
|
|
|
104
106
|
((n = document.createElement("a")),
|
|
105
107
|
(n.href = h),
|
|
106
108
|
"/" === n.pathname && (n = `${n}api/v3`),
|
|
107
|
-
(this.
|
|
108
|
-
X.
|
|
109
|
+
(this.Go = n.toString()),
|
|
110
|
+
X.Zo && !this.nn(L.Eo))
|
|
109
111
|
)
|
|
110
112
|
return (
|
|
111
113
|
r.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
112
|
-
(this
|
|
114
|
+
(this.$o = !0),
|
|
113
115
|
!1
|
|
114
116
|
);
|
|
115
|
-
const a = this.nn(L.
|
|
117
|
+
const a = this.nn(L.Io) || !1;
|
|
116
118
|
if (
|
|
117
|
-
((this.u = Bt.
|
|
119
|
+
((this.u = Bt.Qo(t, a)), a && this.u.Wh(t), new Q.ee(null, !0).br(o.se))
|
|
118
120
|
)
|
|
119
121
|
return (
|
|
120
122
|
r.info("Ignoring all activity due to previous opt out"),
|
|
121
|
-
(this
|
|
123
|
+
(this.$o = !0),
|
|
122
124
|
!1
|
|
123
125
|
);
|
|
124
126
|
for (const t of to(this.options))
|
|
@@ -131,7 +133,7 @@ class zt {
|
|
|
131
133
|
? (this.Vo = t)
|
|
132
134
|
: r.error("Invalid sdk flavor passed: " + t);
|
|
133
135
|
}
|
|
134
|
-
let u = this.nn(Wt.
|
|
136
|
+
let u = this.nn(Wt.Ao);
|
|
135
137
|
if (null != u)
|
|
136
138
|
if (j(u)) {
|
|
137
139
|
const t = [];
|
|
@@ -148,111 +150,116 @@ class zt {
|
|
|
148
150
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
149
151
|
),
|
|
150
152
|
(u = null);
|
|
151
|
-
|
|
153
|
+
const f = this.nn(L.Uo);
|
|
154
|
+
if (f) {
|
|
155
|
+
const t = new _t(f);
|
|
156
|
+
this.u.uu(o.iu.Uo, t);
|
|
157
|
+
}
|
|
158
|
+
(this.on = new Ot(this.u, u)),
|
|
152
159
|
(this.yt = new Dt(this.u)),
|
|
153
160
|
(this.wt = new bt(this.yt, this.u)),
|
|
154
|
-
(this.
|
|
155
|
-
const
|
|
161
|
+
(this.ri = new Mt(this.u, this.wt, this.yt, this.nn(L.Po)));
|
|
162
|
+
const c = new T();
|
|
156
163
|
return (
|
|
157
|
-
(this.
|
|
158
|
-
this.$t(
|
|
164
|
+
(this.zo = new kt(this.u, this.nn(L.No), c)),
|
|
165
|
+
this.$t(c),
|
|
159
166
|
(this.qt = new Rt(
|
|
160
|
-
this.
|
|
167
|
+
this.on,
|
|
161
168
|
this.u,
|
|
162
|
-
this.
|
|
169
|
+
this.zo,
|
|
163
170
|
this.wt,
|
|
164
|
-
this.
|
|
171
|
+
this.ri,
|
|
165
172
|
this.yt,
|
|
166
|
-
this.
|
|
167
|
-
this.
|
|
173
|
+
this.rn,
|
|
174
|
+
this.Go,
|
|
168
175
|
this.Wo,
|
|
169
176
|
this.Vo || "",
|
|
177
|
+
this.nn(L.Ro),
|
|
170
178
|
this.nn(L.Lo),
|
|
171
|
-
this.nn(L.Do),
|
|
172
179
|
)),
|
|
173
|
-
(this.
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
180
|
+
(this.zi = new Lt(
|
|
181
|
+
this.rn,
|
|
182
|
+
this.Go,
|
|
183
|
+
this.ri,
|
|
184
|
+
this.on,
|
|
178
185
|
this.wt,
|
|
179
186
|
this.yt,
|
|
180
187
|
this.u,
|
|
181
188
|
(t) => {
|
|
182
|
-
if (this.so()) for (const i of this.gr()) i.
|
|
189
|
+
if (this.so()) for (const i of this.gr()) i.Ns(t);
|
|
183
190
|
},
|
|
184
|
-
this.
|
|
191
|
+
this.zo,
|
|
185
192
|
this.qt,
|
|
186
193
|
)),
|
|
187
|
-
this.
|
|
188
|
-
a || this.u.
|
|
194
|
+
this.zi.initialize(),
|
|
195
|
+
a || this.u.Vh(),
|
|
189
196
|
r.info(
|
|
190
197
|
`Initialized for the Braze backend at "${this.nn(
|
|
191
|
-
L.
|
|
192
|
-
)}" with API key "${this.
|
|
198
|
+
L._o,
|
|
199
|
+
)}" with API key "${this.rn}".`,
|
|
193
200
|
),
|
|
194
201
|
et.o(),
|
|
195
|
-
this.yt.
|
|
202
|
+
this.yt.ji(() => {
|
|
196
203
|
var t;
|
|
197
|
-
this
|
|
198
|
-
(null === (t = this.yt) || void 0 === t ? void 0 : t.
|
|
204
|
+
this.Ko &&
|
|
205
|
+
(null === (t = this.yt) || void 0 === t ? void 0 : t.ci()) &&
|
|
199
206
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
200
|
-
if (!this
|
|
207
|
+
if (!this.Ko) return;
|
|
201
208
|
(0, t.default)();
|
|
202
209
|
});
|
|
203
210
|
}),
|
|
204
|
-
this.
|
|
211
|
+
this.zi.mr(() => {
|
|
205
212
|
var t;
|
|
206
|
-
this
|
|
207
|
-
(null === (t = this.yt) || void 0 === t ? void 0 : t.
|
|
213
|
+
this.Ko &&
|
|
214
|
+
(null === (t = this.yt) || void 0 === t ? void 0 : t.ci()) &&
|
|
208
215
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
209
|
-
if (!this
|
|
216
|
+
if (!this.Ko) return;
|
|
210
217
|
(0, t.default)(void 0, void 0, !0);
|
|
211
218
|
});
|
|
212
219
|
}),
|
|
213
|
-
this.
|
|
214
|
-
(this
|
|
220
|
+
this.qo.Dt(this.options),
|
|
221
|
+
(this.Ko = !0),
|
|
215
222
|
!0
|
|
216
223
|
);
|
|
217
224
|
}
|
|
218
225
|
destroy(t) {
|
|
219
226
|
if ((r.destroy(), this.so())) {
|
|
220
|
-
this.
|
|
221
|
-
for (const t of this.
|
|
222
|
-
this.
|
|
223
|
-
for (const t of this.
|
|
224
|
-
(this.
|
|
227
|
+
this.Jo.Dt(), this.Jo.removeAllSubscriptions();
|
|
228
|
+
for (const t of this.Yo) t.destroy();
|
|
229
|
+
this.Yo = [];
|
|
230
|
+
for (const t of this.Ho) t.clearData(!1);
|
|
231
|
+
(this.Ho = []),
|
|
225
232
|
this.removeAllSubscriptions(),
|
|
226
233
|
(this._e = []),
|
|
227
|
-
null != this.
|
|
228
|
-
(this.
|
|
229
|
-
(this.
|
|
230
|
-
(this.
|
|
234
|
+
null != this.zi && this.zi.destroy(),
|
|
235
|
+
(this.zi = null),
|
|
236
|
+
(this.zo = null),
|
|
237
|
+
(this.on = null),
|
|
231
238
|
(this.qt = null),
|
|
232
239
|
(this.yt = null),
|
|
233
|
-
(this.
|
|
240
|
+
(this.ri = null),
|
|
234
241
|
(this.wt = null),
|
|
235
242
|
(this.options = {}),
|
|
236
243
|
(this.Vo = void 0),
|
|
244
|
+
(this.Ko = !1),
|
|
237
245
|
(this.$o = !1),
|
|
238
|
-
(this.qo = !1),
|
|
239
246
|
t && (this.u = null);
|
|
240
247
|
}
|
|
241
248
|
}
|
|
242
249
|
X() {
|
|
243
|
-
return !this
|
|
250
|
+
return !this.Kh() && (!!this.so() || (console.warn(_), !1));
|
|
244
251
|
}
|
|
245
252
|
ba() {
|
|
246
|
-
return this.
|
|
253
|
+
return this.rn;
|
|
247
254
|
}
|
|
248
255
|
Sr() {
|
|
249
|
-
return this.
|
|
256
|
+
return this.zo;
|
|
250
257
|
}
|
|
251
|
-
|
|
252
|
-
return this.
|
|
258
|
+
Hs() {
|
|
259
|
+
return this.Go;
|
|
253
260
|
}
|
|
254
261
|
te() {
|
|
255
|
-
return this.
|
|
262
|
+
return this.on;
|
|
256
263
|
}
|
|
257
264
|
nr() {
|
|
258
265
|
return this.qt;
|
|
@@ -261,38 +268,38 @@ class zt {
|
|
|
261
268
|
return this.options[t];
|
|
262
269
|
}
|
|
263
270
|
gr() {
|
|
264
|
-
return this.
|
|
271
|
+
return this.Ho;
|
|
265
272
|
}
|
|
266
273
|
cr() {
|
|
267
|
-
return this.
|
|
274
|
+
return this.zi;
|
|
268
275
|
}
|
|
269
276
|
ir() {
|
|
270
277
|
return this.yt;
|
|
271
278
|
}
|
|
272
279
|
zr() {
|
|
273
|
-
return this.
|
|
280
|
+
return this.ri;
|
|
274
281
|
}
|
|
275
282
|
l() {
|
|
276
283
|
return this.u;
|
|
277
284
|
}
|
|
278
285
|
pr() {
|
|
279
|
-
if (this.wt && this.
|
|
286
|
+
if (this.wt && this.zi) return new User(this.wt, this.zi);
|
|
280
287
|
}
|
|
281
288
|
er() {
|
|
282
289
|
return this.wt;
|
|
283
290
|
}
|
|
284
291
|
tr() {
|
|
285
|
-
return !0 === this.nn(L.
|
|
292
|
+
return !0 === this.nn(L.Do);
|
|
286
293
|
}
|
|
287
294
|
g(t) {
|
|
288
295
|
let i = !1;
|
|
289
|
-
for (const s of this.
|
|
290
|
-
i || this.
|
|
296
|
+
for (const s of this.Yo) s === t && (i = !0);
|
|
297
|
+
i || this.Yo.push(t);
|
|
291
298
|
}
|
|
292
299
|
ar(t) {
|
|
293
300
|
let i = !1;
|
|
294
|
-
for (const s of this.
|
|
295
|
-
t instanceof y && !i && this.
|
|
301
|
+
for (const s of this.Ho) s.constructor === t.constructor && (i = !0);
|
|
302
|
+
t instanceof y && !i && this.Ho.push(t);
|
|
296
303
|
}
|
|
297
304
|
$t(t) {
|
|
298
305
|
t instanceof T && this._e.push(t);
|
|
@@ -304,17 +311,17 @@ class zt {
|
|
|
304
311
|
if (this.X()) for (const i of this._e) i.removeSubscription(t);
|
|
305
312
|
}
|
|
306
313
|
oe(t) {
|
|
307
|
-
this
|
|
314
|
+
this.$o = t;
|
|
308
315
|
}
|
|
309
316
|
so() {
|
|
310
|
-
return this
|
|
317
|
+
return this.Ko;
|
|
311
318
|
}
|
|
312
|
-
|
|
313
|
-
return this
|
|
319
|
+
Kh() {
|
|
320
|
+
return this.$o;
|
|
314
321
|
}
|
|
315
|
-
|
|
322
|
+
Ds() {
|
|
316
323
|
return this.Wo;
|
|
317
324
|
}
|
|
318
325
|
}
|
|
319
|
-
const e = new
|
|
320
|
-
export { e as default,
|
|
326
|
+
const e = new Vt();
|
|
327
|
+
export { e as default, Vt as BrazeSdkInstance, L as OPTIONS };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import X from "../util/browser-detector.js";
|
|
2
|
-
import
|
|
2
|
+
import zt from "../models/device.js";
|
|
3
3
|
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";
|
|
@@ -9,34 +9,34 @@ 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.ka = e),
|
|
13
13
|
(this.u = t),
|
|
14
14
|
null == e && (e = Pt(DeviceProperties)),
|
|
15
|
-
(this.
|
|
15
|
+
(this.ka = e);
|
|
16
16
|
}
|
|
17
17
|
ce(t = !0) {
|
|
18
|
-
let e = this.u.tu(o.iu.
|
|
19
|
-
null == e && ((e = new _t(p.W())), t && this.u.uu(o.iu.
|
|
20
|
-
const r = new
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
18
|
+
let e = this.u.tu(o.iu.Uo);
|
|
19
|
+
null == e && ((e = new _t(p.W())), t && this.u.uu(o.iu.Uo, e));
|
|
20
|
+
const r = new zt(e.eu);
|
|
21
|
+
for (let t = 0; t < this.ka.length; t++) {
|
|
22
|
+
switch (this.ka[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.Ia = X.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.Ta();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.Da = 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.Sa(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
|
+
Ta() {
|
|
48
|
+
if (X.Oa()) return X.Oa();
|
|
49
|
+
const t = this.u.j(o.C.Ca);
|
|
50
|
+
return t && t.os_version ? t.os_version : X.Ta();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Sa(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.Fa(s);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Fa(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|