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