@braze/web-sdk 6.0.0 → 6.2.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 +103 -33
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +22 -22
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +19 -19
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +15 -15
- package/src/Banner/banner-factory.js +2 -1
- package/src/Banner/banner-provider-factory.js +7 -7
- package/src/Banner/banner-provider.js +92 -98
- package/src/Banner/banner.js +21 -18
- package/src/Banner/display/banner-to-html.js +9 -9
- package/src/Banner/display/destroy-banner-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +2 -2
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +7 -7
- package/src/Banner/log-banner-click.js +7 -7
- package/src/Banner/log-banner-impressions.js +9 -9
- package/src/Banner/request-banners-refresh.js +16 -20
- package/src/Banner/subscribe-to-banners-updates.js +7 -7
- package/src/Banner/ui/insert-banner.js +6 -6
- package/src/Card/card-manager-factory.js +7 -7
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +4 -4
- package/src/Card/log-content-card-click.js +4 -4
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +68 -68
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +18 -18
- package/src/Card/util/card-factory.js +35 -35
- package/src/ContentCards/content-cards-provider-factory.js +13 -13
- package/src/ContentCards/content-cards-provider.js +136 -136
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/show-content-cards.js +7 -7
- package/src/Core/add-sdk-metadata.js +3 -3
- package/src/Core/change-user.js +7 -7
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +8 -8
- package/src/Core/enable-sdk.js +6 -6
- package/src/Core/get-device-id.js +4 -4
- package/src/Core/handle-braze-action.js +5 -5
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +10 -10
- package/src/Core/log-purchase.js +13 -13
- package/src/Core/open-session.js +10 -10
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +20 -71
- package/src/FeatureFlags/feature-flags-provider-factory.js +12 -12
- package/src/FeatureFlags/feature-flags-provider.js +87 -87
- package/src/FeatureFlags/get-all-feature-flags.js +4 -4
- package/src/FeatureFlags/get-feature-flag.js +4 -4
- package/src/FeatureFlags/log-feature-flag-impression.js +9 -9
- package/src/FeatureFlags/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +28 -28
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +15 -15
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +100 -100
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-impression.js +4 -4
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +35 -35
- package/src/InAppMessage/models/html-message.js +21 -21
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +75 -75
- package/src/InAppMessage/models/modal-message.js +34 -34
- package/src/InAppMessage/models/slide-up-message.js +31 -31
- 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 +19 -19
- package/src/Push/push-manager-factory.js +9 -9
- package/src/Push/push-manager.js +118 -118
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +20 -20
- package/src/User/user.js +44 -45
- package/src/common/base-provider.js +1 -1
- package/src/common/content-cards-display.js +18 -18
- package/src/common/event-logger.js +10 -10
- package/src/common/properties-base.js +56 -0
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +143 -143
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +172 -168
- package/src/managers/server-config-manager.js +73 -73
- package/src/managers/session-manager.js +40 -40
- package/src/managers/storage-manager-factory.js +6 -6
- package/src/managers/storage-manager.js +97 -97
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +13 -13
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +159 -159
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +26 -26
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +37 -37
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +16 -16
- package/src/triggers/triggers-provider-factory.js +12 -12
- package/src/triggers/triggers-provider.js +61 -61
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +6 -6
- package/src/util/browser-detector.js +22 -13
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/device-constants.js +4 -4
- package/src/util/dom-utils.js +9 -9
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +12 -12
- package/src/util/request-header-utils.js +22 -22
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +16 -16
- package/src/util/validation-utils.js +12 -12
- package/src/util/window-utils.js +2 -2
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import u from "./subscription-manager.js";
|
|
3
|
-
import { logger as
|
|
3
|
+
import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
4
4
|
export default class Bt {
|
|
5
5
|
constructor(t, i, s) {
|
|
6
|
-
(this.
|
|
7
|
-
(this.
|
|
8
|
-
(this.
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
6
|
+
(this.j = t),
|
|
7
|
+
(this.Zn = i),
|
|
8
|
+
(this.gh = s),
|
|
9
|
+
(this.j = t),
|
|
10
|
+
(this.Zn = i || !1),
|
|
11
|
+
(this.gh = s),
|
|
12
|
+
(this.ph = new u()),
|
|
13
|
+
(this.Fh = 0),
|
|
14
|
+
(this.kh = 1);
|
|
15
|
+
}
|
|
16
|
+
fh() {
|
|
17
|
+
return this.Zn;
|
|
15
18
|
}
|
|
16
19
|
wh() {
|
|
17
|
-
return this.
|
|
18
|
-
}
|
|
19
|
-
jh() {
|
|
20
|
-
return this.C.ft(s.gt.xh);
|
|
20
|
+
return this.j.lt(s.ct.jh);
|
|
21
21
|
}
|
|
22
22
|
setSdkAuthenticationSignature(t) {
|
|
23
|
-
const i = this.
|
|
24
|
-
this.
|
|
25
|
-
const e = et.
|
|
26
|
-
new et(e,
|
|
23
|
+
const i = this.wh();
|
|
24
|
+
this.j.ft(s.ct.jh, t);
|
|
25
|
+
const e = et.Us.Rs;
|
|
26
|
+
new et(e, E).setItem(e.Fs.xh, this.kh, t), i !== t && this.Z();
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
const t = et.
|
|
31
|
-
new et(t,
|
|
28
|
+
qh() {
|
|
29
|
+
this.j.Nt(s.ct.jh);
|
|
30
|
+
const t = et.Us.Rs;
|
|
31
|
+
new et(t, E).be(t.Fs.xh, this.kh);
|
|
32
32
|
}
|
|
33
33
|
subscribeToSdkAuthenticationFailures(t) {
|
|
34
|
-
return this.
|
|
34
|
+
return this.gh.wt(t);
|
|
35
|
+
}
|
|
36
|
+
yh(t) {
|
|
37
|
+
this.gh.L(t);
|
|
35
38
|
}
|
|
36
|
-
Bh(
|
|
37
|
-
this.ph.
|
|
39
|
+
Bh() {
|
|
40
|
+
this.ph.removeAllSubscriptions();
|
|
38
41
|
}
|
|
39
42
|
Gh() {
|
|
40
|
-
this.Fh
|
|
43
|
+
this.Fh += 1;
|
|
41
44
|
}
|
|
42
45
|
Hh() {
|
|
43
|
-
this.
|
|
44
|
-
}
|
|
45
|
-
Jh() {
|
|
46
|
-
return this.kh;
|
|
46
|
+
return this.Fh;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
this.
|
|
48
|
+
Z() {
|
|
49
|
+
this.Fh = 0;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -22,118 +22,118 @@ import { User } from "../User/index.js";
|
|
|
22
22
|
import { parseQueryStringKeyValues as ll } from "../util/url-utils.js";
|
|
23
23
|
import { WindowUtils as no } from "../util/window-utils.js";
|
|
24
24
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as w } from "../common/constants.js";
|
|
25
|
-
import { SupportedOptions as $t, logger as
|
|
25
|
+
import { SupportedOptions as $t, logger as E } from "../../shared-lib/index.js";
|
|
26
26
|
import _t from "../models/identifier.js";
|
|
27
27
|
const z = {
|
|
28
28
|
_o: "allowCrawlerActivity",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
Ro: "baseUrl",
|
|
30
|
+
Wo: "noCookies",
|
|
31
|
+
Vo: "devicePropertyAllowlist",
|
|
32
32
|
Aa: "disablePushTokenMaintenance",
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
Yo: "enableLogging",
|
|
34
|
+
Xo: "enableSdkAuthentication",
|
|
35
35
|
qa: "manageServiceWorkerExternally",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
Zo: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
37
|
+
Wh: "sessionTimeoutInSeconds",
|
|
38
|
+
Vh: "appVersion",
|
|
39
|
+
Kh: "appVersionNumber",
|
|
40
40
|
Ma: "serviceWorkerLocation",
|
|
41
41
|
ka: "safariWebsitePushId",
|
|
42
|
-
|
|
42
|
+
Xn: "localization",
|
|
43
43
|
er: "contentSecurityNonce",
|
|
44
44
|
re: "allowUserSuppliedJavascript",
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
Jo: "inAppMessageZIndex",
|
|
46
|
+
Do: "openInAppMessagesInNewTab",
|
|
47
47
|
tn: "openCardsInNewTab",
|
|
48
48
|
Lh: "requireExplicitInAppMessageDismissal",
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
$h: "doNotLoadFontAwesome",
|
|
50
|
+
Jh: "deviceId",
|
|
51
51
|
_a: "serviceWorkerScope",
|
|
52
|
-
|
|
52
|
+
Yh: "sdkFlavor",
|
|
53
53
|
};
|
|
54
54
|
class Jt {
|
|
55
55
|
constructor() {
|
|
56
|
-
(this.
|
|
57
|
-
(this.
|
|
58
|
-
(this.
|
|
59
|
-
(this.
|
|
60
|
-
(this.
|
|
61
|
-
(this.S = null),
|
|
62
|
-
(this.Cn = null),
|
|
56
|
+
(this.sn = ""),
|
|
57
|
+
(this.Xh = ""),
|
|
58
|
+
(this.Zh = void 0),
|
|
59
|
+
(this.Qh = null),
|
|
60
|
+
(this.on = null),
|
|
63
61
|
(this.B = null),
|
|
64
|
-
(this.
|
|
62
|
+
(this.Cn = null),
|
|
63
|
+
(this.h = null),
|
|
65
64
|
(this.C = null),
|
|
65
|
+
(this.j = null),
|
|
66
66
|
(this.Cs = null),
|
|
67
|
-
(this.
|
|
67
|
+
(this.Ea = ""),
|
|
68
68
|
(this.isInitialized = !1),
|
|
69
|
-
(this.
|
|
70
|
-
(this.
|
|
71
|
-
(this.
|
|
69
|
+
(this.Ia = !1),
|
|
70
|
+
(this.Sa = new u()),
|
|
71
|
+
(this.Na = new u()),
|
|
72
72
|
(this.options = {}),
|
|
73
|
-
(this.
|
|
74
|
-
(this.
|
|
75
|
-
(this.
|
|
76
|
-
(this.
|
|
73
|
+
(this.Oa = []),
|
|
74
|
+
(this.Ta = []),
|
|
75
|
+
(this.yi = []),
|
|
76
|
+
(this.Xh = "6.2.0");
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
this.
|
|
78
|
+
Ra(t) {
|
|
79
|
+
this.Sa.wt(t);
|
|
80
80
|
}
|
|
81
81
|
mh(t) {
|
|
82
|
-
this.
|
|
82
|
+
this.Na.wt(t);
|
|
83
83
|
}
|
|
84
84
|
initialize(t, i) {
|
|
85
85
|
if (this.ao())
|
|
86
|
-
return
|
|
86
|
+
return E.info("Braze has already been initialized with an API key."), !0;
|
|
87
87
|
this.options = i || {};
|
|
88
|
-
let e = this.ee(z.
|
|
89
|
-
const r = ll(no.
|
|
88
|
+
let e = this.ee(z.Yo);
|
|
89
|
+
const r = ll(no.Ca());
|
|
90
90
|
if (
|
|
91
91
|
(r && "true" === r.brazeLogging && (e = !0),
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
E.init(e),
|
|
93
|
+
E.info(
|
|
94
94
|
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`,
|
|
95
95
|
),
|
|
96
96
|
null == t || "" === t || "string" != typeof t)
|
|
97
97
|
)
|
|
98
|
-
return
|
|
99
|
-
this.
|
|
100
|
-
let n = this.ee(z.
|
|
98
|
+
return E.error("Braze requires a valid API key to be initialized."), !1;
|
|
99
|
+
this.sn = t;
|
|
100
|
+
let n = this.ee(z.Ro);
|
|
101
101
|
if (null == n || "" === n || "string" != typeof n)
|
|
102
|
-
return
|
|
102
|
+
return E.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
103
103
|
!1 === /^https?:/.test(n) && (n = `https://${n}`);
|
|
104
104
|
const o = n;
|
|
105
105
|
if (
|
|
106
106
|
((n = document.createElement("a")),
|
|
107
107
|
(n.href = o),
|
|
108
108
|
"/" === n.pathname && (n = `${n}api/v3`),
|
|
109
|
-
(this.
|
|
110
|
-
ro.
|
|
109
|
+
(this.Ea = n.toString()),
|
|
110
|
+
ro.Pa && !this.ee(z._o))
|
|
111
111
|
)
|
|
112
112
|
return (
|
|
113
|
-
|
|
114
|
-
(this.
|
|
113
|
+
E.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
114
|
+
(this.Ia = !0),
|
|
115
115
|
!1
|
|
116
116
|
);
|
|
117
|
-
const h = this.ee(z.
|
|
117
|
+
const h = this.ee(z.Wo) || !1;
|
|
118
118
|
if (
|
|
119
|
-
((this.
|
|
119
|
+
((this.j = Gt.La(t, h)), h && this.j.Da(t), new ee.ne(null, !0).br(s.ie))
|
|
120
120
|
)
|
|
121
121
|
return (
|
|
122
|
-
|
|
123
|
-
(this.
|
|
122
|
+
E.info("Ignoring all activity due to previous opt out"),
|
|
123
|
+
(this.Ia = !0),
|
|
124
124
|
!1
|
|
125
125
|
);
|
|
126
126
|
for (const t of C(this.options))
|
|
127
127
|
-1 === Pt($t).indexOf(t) &&
|
|
128
|
-
|
|
128
|
+
E.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
129
129
|
const a = ["mparticle", "wordpress", "tealium"];
|
|
130
|
-
if (null != this.ee(z.
|
|
131
|
-
const t = this.ee(z.
|
|
130
|
+
if (null != this.ee(z.Yh)) {
|
|
131
|
+
const t = this.ee(z.Yh);
|
|
132
132
|
-1 !== a.indexOf(t)
|
|
133
|
-
? (this.
|
|
134
|
-
:
|
|
133
|
+
? (this.Zh = t)
|
|
134
|
+
: E.error("Invalid sdk flavor passed: " + t);
|
|
135
135
|
}
|
|
136
|
-
let l = this.ee($t.
|
|
136
|
+
let l = this.ee($t.Vo);
|
|
137
137
|
if (null != l)
|
|
138
138
|
if (D(l)) {
|
|
139
139
|
const t = [];
|
|
@@ -146,63 +146,63 @@ class Jt {
|
|
|
146
146
|
) && t.push(l[i]);
|
|
147
147
|
l = t;
|
|
148
148
|
} else
|
|
149
|
-
|
|
149
|
+
E.error(
|
|
150
150
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
151
151
|
),
|
|
152
152
|
(l = null);
|
|
153
|
-
const c = this.ee(z.
|
|
153
|
+
const c = this.ee(z.Jh);
|
|
154
154
|
if (c) {
|
|
155
155
|
const t = new _t(c);
|
|
156
|
-
this.
|
|
156
|
+
this.j.uu(s.iu.Jh, t);
|
|
157
157
|
}
|
|
158
|
-
(this.
|
|
159
|
-
(this.
|
|
160
|
-
(this.Cs = new bt(this.
|
|
161
|
-
(this.
|
|
158
|
+
(this.on = new Ot(this.j, l)),
|
|
159
|
+
(this.h = new Vt(this.j)),
|
|
160
|
+
(this.Cs = new bt(this.h, this.j)),
|
|
161
|
+
(this.C = new Kt(this.j, this.Cs, this.h, this.ee(z.Wh)));
|
|
162
162
|
const f = new u();
|
|
163
163
|
return (
|
|
164
|
-
(this.
|
|
165
|
-
this.
|
|
166
|
-
(this.
|
|
167
|
-
this.un,
|
|
168
|
-
this.C,
|
|
169
|
-
this.Na,
|
|
170
|
-
this.Cs,
|
|
171
|
-
this.T,
|
|
172
|
-
this.B,
|
|
164
|
+
(this.Qh = new Bt(this.j, this.ee(z.Xo), f)),
|
|
165
|
+
this.q(f),
|
|
166
|
+
(this.B = new Mt(
|
|
173
167
|
this.on,
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
168
|
+
this.j,
|
|
169
|
+
this.Qh,
|
|
170
|
+
this.Cs,
|
|
171
|
+
this.C,
|
|
172
|
+
this.h,
|
|
173
|
+
this.sn,
|
|
174
|
+
this.Ea,
|
|
175
|
+
this.Xh,
|
|
176
|
+
this.Zh || "",
|
|
177
|
+
this.ee(z.Vh),
|
|
178
|
+
this.ee(z.Kh),
|
|
179
179
|
)),
|
|
180
180
|
(this.Cn = new Wt(
|
|
181
|
+
this.sn,
|
|
182
|
+
this.Ea,
|
|
183
|
+
this.C,
|
|
181
184
|
this.on,
|
|
182
|
-
this.Oa,
|
|
183
|
-
this.T,
|
|
184
|
-
this.un,
|
|
185
185
|
this.Cs,
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
186
|
+
this.h,
|
|
187
|
+
this.j,
|
|
188
188
|
(t) => {
|
|
189
|
-
if (this.ao()) for (const i of this.lr()) i.
|
|
189
|
+
if (this.ao()) for (const i of this.lr()) i.N(t);
|
|
190
190
|
},
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
191
|
+
this.Qh,
|
|
192
|
+
this.B,
|
|
193
193
|
)),
|
|
194
194
|
this.Cn.initialize(),
|
|
195
|
-
h || this.
|
|
196
|
-
|
|
195
|
+
h || this.j.Ua(),
|
|
196
|
+
E.info(
|
|
197
197
|
`Initialized for the Braze backend at "${this.ee(
|
|
198
|
-
z.
|
|
199
|
-
)}" with API key "${this.
|
|
198
|
+
z.Ro,
|
|
199
|
+
)}" with API key "${this.sn}".`,
|
|
200
200
|
),
|
|
201
|
-
rt.
|
|
202
|
-
this.
|
|
201
|
+
rt.t(),
|
|
202
|
+
this.h.Ue(() => {
|
|
203
203
|
var t;
|
|
204
204
|
this.isInitialized &&
|
|
205
|
-
(null === (t = this.
|
|
205
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Re()) &&
|
|
206
206
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
207
207
|
if (!this.isInitialized) return;
|
|
208
208
|
(0, t.default)();
|
|
@@ -211,79 +211,79 @@ class Jt {
|
|
|
211
211
|
this.Cn.rn(() => {
|
|
212
212
|
var t;
|
|
213
213
|
this.isInitialized &&
|
|
214
|
-
(null === (t = this.
|
|
214
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Re()) &&
|
|
215
215
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
216
216
|
if (!this.isInitialized) return;
|
|
217
217
|
(0, t.default)(void 0, void 0, !0);
|
|
218
218
|
});
|
|
219
219
|
}),
|
|
220
|
-
this.
|
|
220
|
+
this.Sa.L(this.options),
|
|
221
221
|
(this.isInitialized = !0),
|
|
222
222
|
window.dispatchEvent(new CustomEvent("braze.initialized")),
|
|
223
223
|
!0
|
|
224
224
|
);
|
|
225
225
|
}
|
|
226
226
|
destroy(t) {
|
|
227
|
-
if ((
|
|
228
|
-
this.
|
|
229
|
-
for (const t of this.
|
|
230
|
-
this.
|
|
231
|
-
for (const t of this.
|
|
232
|
-
this.
|
|
233
|
-
(this.
|
|
227
|
+
if ((E.destroy(), this.ao())) {
|
|
228
|
+
this.Na.L(), this.Na.removeAllSubscriptions();
|
|
229
|
+
for (const t of this.Oa) t.destroy();
|
|
230
|
+
this.Oa = [];
|
|
231
|
+
for (const t of this.Ta) t.clearData(!1);
|
|
232
|
+
this.B && this.B.fo(),
|
|
233
|
+
(this.Ta = []),
|
|
234
234
|
this.removeAllSubscriptions(),
|
|
235
|
-
(this.
|
|
235
|
+
(this.yi = []),
|
|
236
236
|
null != this.Cn && this.Cn.destroy(),
|
|
237
237
|
(this.Cn = null),
|
|
238
|
-
(this.
|
|
239
|
-
(this.
|
|
240
|
-
(this.S = null),
|
|
238
|
+
(this.Qh = null),
|
|
239
|
+
(this.on = null),
|
|
241
240
|
(this.B = null),
|
|
242
|
-
(this.
|
|
241
|
+
(this.h = null),
|
|
242
|
+
(this.C = null),
|
|
243
243
|
(this.Cs = null),
|
|
244
244
|
(this.options = {}),
|
|
245
|
-
(this.
|
|
245
|
+
(this.Zh = void 0),
|
|
246
246
|
(this.isInitialized = !1),
|
|
247
|
-
(this.
|
|
248
|
-
t && (this.
|
|
247
|
+
(this.Ia = !1),
|
|
248
|
+
t && (this.j = null);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
rr() {
|
|
252
|
-
return !this.
|
|
252
|
+
return !this.Wa() && (!!this.ao() || (console.warn(w), !1));
|
|
253
253
|
}
|
|
254
254
|
ba() {
|
|
255
|
-
return this.
|
|
255
|
+
return this.sn;
|
|
256
256
|
}
|
|
257
257
|
Sr() {
|
|
258
|
-
return this.
|
|
258
|
+
return this.Qh;
|
|
259
259
|
}
|
|
260
|
-
|
|
261
|
-
return this.
|
|
260
|
+
V() {
|
|
261
|
+
return this.Ea;
|
|
262
262
|
}
|
|
263
|
-
|
|
264
|
-
return this.
|
|
263
|
+
de() {
|
|
264
|
+
return this.on;
|
|
265
265
|
}
|
|
266
|
-
|
|
267
|
-
return this.
|
|
266
|
+
m() {
|
|
267
|
+
return this.B;
|
|
268
268
|
}
|
|
269
269
|
ee(t) {
|
|
270
270
|
return this.options[t];
|
|
271
271
|
}
|
|
272
272
|
lr() {
|
|
273
|
-
return this.
|
|
273
|
+
return this.Ta;
|
|
274
274
|
}
|
|
275
275
|
nn() {
|
|
276
276
|
return this.Cn;
|
|
277
277
|
}
|
|
278
|
-
|
|
279
|
-
return this.
|
|
280
|
-
}
|
|
281
|
-
P() {
|
|
282
|
-
return this.T;
|
|
278
|
+
l() {
|
|
279
|
+
return this.h;
|
|
283
280
|
}
|
|
284
|
-
|
|
281
|
+
u() {
|
|
285
282
|
return this.C;
|
|
286
283
|
}
|
|
284
|
+
p() {
|
|
285
|
+
return this.j;
|
|
286
|
+
}
|
|
287
287
|
gr() {
|
|
288
288
|
if (this.Cs && this.Cn) return new User(this.Cs, this.Cn);
|
|
289
289
|
}
|
|
@@ -293,37 +293,37 @@ class Jt {
|
|
|
293
293
|
tr() {
|
|
294
294
|
return !0 === this.ee(z.re);
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
g(t) {
|
|
297
297
|
let i = !1;
|
|
298
|
-
for (const s of this.
|
|
299
|
-
i || this.
|
|
298
|
+
for (const s of this.Oa) s === t && (i = !0);
|
|
299
|
+
i || this.Oa.push(t);
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
v(i) {
|
|
302
302
|
let s = !1;
|
|
303
|
-
for (const t of this.
|
|
304
|
-
i instanceof t && !s && this.
|
|
303
|
+
for (const t of this.Ta) t.constructor === i.constructor && (s = !0);
|
|
304
|
+
i instanceof t && !s && this.Ta.push(i);
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
t instanceof u && this.
|
|
306
|
+
q(t) {
|
|
307
|
+
t instanceof u && this.yi.push(t);
|
|
308
308
|
}
|
|
309
309
|
removeAllSubscriptions() {
|
|
310
|
-
if (this.rr()) for (const t of this.
|
|
310
|
+
if (this.rr()) for (const t of this.yi) t.removeAllSubscriptions();
|
|
311
311
|
}
|
|
312
312
|
removeSubscription(t) {
|
|
313
|
-
if (this.rr()) for (const i of this.
|
|
313
|
+
if (this.rr()) for (const i of this.yi) i.removeSubscription(t);
|
|
314
314
|
}
|
|
315
|
-
|
|
316
|
-
this.
|
|
315
|
+
ce(t) {
|
|
316
|
+
this.Ia = t;
|
|
317
317
|
}
|
|
318
318
|
ao() {
|
|
319
319
|
return this.isInitialized;
|
|
320
320
|
}
|
|
321
|
-
|
|
322
|
-
return this.Ta;
|
|
323
|
-
}
|
|
324
|
-
Ws() {
|
|
321
|
+
Wa() {
|
|
325
322
|
return this.Ia;
|
|
326
323
|
}
|
|
324
|
+
Vs() {
|
|
325
|
+
return this.Xh;
|
|
326
|
+
}
|
|
327
327
|
}
|
|
328
328
|
const r = new Jt();
|
|
329
329
|
export { r as default, Jt as BrazeSdkInstance, z as OPTIONS };
|
|
@@ -2,41 +2,41 @@ import ro from "../util/browser-detector.js";
|
|
|
2
2
|
import Qt from "../models/device.js";
|
|
3
3
|
import DeviceProperties from "../Core/device-properties.js";
|
|
4
4
|
import _t from "../models/identifier.js";
|
|
5
|
-
import { logger as
|
|
5
|
+
import { logger as E, Guid as P } from "../../shared-lib/index.js";
|
|
6
6
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
7
7
|
import { values as Pt } 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
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
11
|
+
(this.j = t),
|
|
12
|
+
(this.Fa = e),
|
|
13
|
+
(this.j = t),
|
|
14
14
|
null == e && (e = Pt(DeviceProperties)),
|
|
15
|
-
(this.
|
|
15
|
+
(this.Fa = e);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
let e = this.
|
|
19
|
-
null == e && ((e = new _t(
|
|
17
|
+
fe(t = !0) {
|
|
18
|
+
let e = this.j.tu(s.iu.Jh);
|
|
19
|
+
null == e && ((e = new _t(P.oe())), t && this.j.uu(s.iu.Jh, e));
|
|
20
20
|
const r = new Qt(e.eu);
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
21
|
+
for (let t = 0; t < this.Fa.length; t++) {
|
|
22
|
+
switch (this.Fa[t]) {
|
|
23
23
|
case DeviceProperties.BROWSER:
|
|
24
24
|
r.browser = ro.browser;
|
|
25
25
|
break;
|
|
26
26
|
case DeviceProperties.BROWSER_VERSION:
|
|
27
|
-
r.
|
|
27
|
+
r.Ga = ro.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.Ja();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.Ba = screen.width + "x" + screen.height;
|
|
34
34
|
break;
|
|
35
35
|
case DeviceProperties.LANGUAGE:
|
|
36
36
|
r.language = ro.language;
|
|
37
37
|
break;
|
|
38
38
|
case DeviceProperties.TIME_ZONE:
|
|
39
|
-
r.timeZone = this.
|
|
39
|
+
r.timeZone = this.Ha(new Date());
|
|
40
40
|
break;
|
|
41
41
|
case DeviceProperties.USER_AGENT:
|
|
42
42
|
r.userAgent = ro.userAgent;
|
|
@@ -44,12 +44,12 @@ export default class Ot {
|
|
|
44
44
|
}
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
if (ro.
|
|
49
|
-
const t = this.
|
|
50
|
-
return t && t.os_version ? t.os_version : ro.
|
|
47
|
+
Ja() {
|
|
48
|
+
if (ro.Ka()) return ro.Ka();
|
|
49
|
+
const t = this.j.lt(s.ct.Qa);
|
|
50
|
+
return t && t.os_version ? t.os_version : ro.Ja();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Ha(t) {
|
|
53
53
|
let e = !1;
|
|
54
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
55
55
|
try {
|
|
@@ -58,7 +58,7 @@ export default class Ot {
|
|
|
58
58
|
if (null != t && "" !== t) return t;
|
|
59
59
|
}
|
|
60
60
|
} catch (t) {
|
|
61
|
-
|
|
61
|
+
E.info(
|
|
62
62
|
"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
|
|
63
63
|
si(t),
|
|
64
64
|
),
|
|
@@ -66,9 +66,9 @@ export default class Ot {
|
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
68
|
const r = t.getTimezoneOffset();
|
|
69
|
-
return this
|
|
69
|
+
return this.Va(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Va(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|