@braze/web-sdk 6.10.2 → 6.11.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 +28 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +10 -10
- package/shared-lib/indexed-db-adapter.js +51 -51
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +9 -9
- package/src/Core/logout.js +2 -2
- package/src/InAppMessage/constants.js +39 -47
- package/src/InAppMessage/display/html-message-to-html.js +1 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +38 -36
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +89 -68
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- 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 +22 -22
- package/src/InAppMessage/models/html-message.js +13 -13
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +68 -66
- package/src/InAppMessage/models/modal-message.js +20 -20
- package/src/InAppMessage/models/slide-up-message.js +25 -25
- package/src/InAppMessage/models/templated-in-app-message.js +6 -6
- 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 +27 -25
- package/src/Push/index.js +1 -0
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +222 -179
- package/src/Push/register-push.js +9 -0
- package/src/Push/unregister-push-token-on-server.js +4 -4
- package/src/Push/utils/push-utils.js +8 -8
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +35 -35
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +5 -5
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/braze-instance.js +42 -38
- package/src/managers/device-manager.js +20 -20
- package/src/managers/network-manager.js +122 -122
- package/src/managers/server-config-manager.js +76 -76
- package/src/managers/session-manager.js +8 -8
- package/src/managers/storage-manager.js +127 -127
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +2 -2
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +6 -6
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +85 -85
- package/src/triggers/models/trigger-condition.js +27 -27
- package/src/triggers/models/trigger.js +2 -2
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +37 -29
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/dom-utils.js +2 -2
- package/src/util/ecommerce-event-validation.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/request-header-utils.js +15 -15
- package/src/util/user-agent-parser.js +4 -4
- package/src/util/validation-utils.js +5 -5
- package/src/util/window-utils.js +2 -2
package/src/User/user-manager.js
CHANGED
|
@@ -11,28 +11,28 @@ export default class Ut {
|
|
|
11
11
|
getUserId() {
|
|
12
12
|
const t = this.j.$u(s.Ou.Cu);
|
|
13
13
|
if (null == t) return null;
|
|
14
|
-
let i = t.
|
|
14
|
+
let i = t.Iu,
|
|
15
15
|
e = er(i);
|
|
16
16
|
if (e > User.br) {
|
|
17
17
|
for (; e > User.br; ) (i = i.slice(0, i.length - 1)), (e = er(i));
|
|
18
|
-
(t.
|
|
18
|
+
(t.Iu = i), this.j.Ju(s.Ou.Cu, t);
|
|
19
19
|
}
|
|
20
20
|
return i;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
Lu(t) {
|
|
23
23
|
const i = null == this.getUserId();
|
|
24
|
-
this.j.
|
|
24
|
+
this.j.Ju(s.Ou.Cu, new _t(t)), i && this.j.qu(t);
|
|
25
25
|
}
|
|
26
26
|
setCustomUserAttribute(t, s) {
|
|
27
|
-
if (this.h.
|
|
27
|
+
if (this.h.zu(t))
|
|
28
28
|
return (
|
|
29
29
|
b.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1
|
|
30
30
|
);
|
|
31
31
|
const i = {};
|
|
32
|
-
return (i[t] = s), this.
|
|
32
|
+
return (i[t] = s), this.Bu(User.Eu, i, !0);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
const u = this.j.
|
|
34
|
+
Bu(t, s, i = !1, e = !1) {
|
|
35
|
+
const u = this.j.Fu(this.getUserId(), t, s);
|
|
36
36
|
let o = "",
|
|
37
37
|
r = t,
|
|
38
38
|
h = s;
|
|
@@ -47,27 +47,27 @@ export default class Ut {
|
|
|
47
47
|
u
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
50
|
+
yu(t, i, e, u, o) {
|
|
51
|
+
this.Bu("push_token", t, !1, !0),
|
|
52
|
+
this.Bu("custom_push_public_key", e, !1, !0),
|
|
53
|
+
this.Bu("custom_push_user_auth", u, !1, !0),
|
|
54
|
+
this.Bu("custom_push_vapid_public_key", o, !1, !0);
|
|
55
55
|
const r = et._s.Xs,
|
|
56
56
|
h = new et(r, b),
|
|
57
57
|
n = new ui(t, i, e, u, o);
|
|
58
|
-
this.j.Pt(s.It.
|
|
58
|
+
this.j.Pt(s.It.xu, n.qt()), h.setItem(r.Ws.Gu, r.be, !0);
|
|
59
59
|
}
|
|
60
60
|
wu(t) {
|
|
61
61
|
if (
|
|
62
|
-
(this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
62
|
+
(this.Bu("push_token", null, !1, !0),
|
|
63
|
+
this.Bu("custom_push_public_key", null, !1, !0),
|
|
64
|
+
this.Bu("custom_push_user_auth", null, !1, !0),
|
|
65
|
+
this.Bu("custom_push_vapid_public_key", null, !1, !0),
|
|
66
66
|
t)
|
|
67
67
|
) {
|
|
68
68
|
const t = et._s.Xs,
|
|
69
69
|
i = new et(t, b);
|
|
70
|
-
this.j.Pt(s.It.
|
|
70
|
+
this.j.Pt(s.It.xu, !1), i.setItem(t.Ws.Gu, t.be, !1);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|
package/src/User/user.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
8
8
|
import {
|
|
9
|
-
isValidEmail as
|
|
9
|
+
isValidEmail as Et,
|
|
10
10
|
validateCustomAttributeArrayType as Dt,
|
|
11
11
|
validateCustomAttributeKey as Ft,
|
|
12
12
|
validateCustomProperties as nt,
|
|
@@ -33,22 +33,22 @@ export default class User {
|
|
|
33
33
|
? (b.error("addAlias requires a non-empty alias"), !1)
|
|
34
34
|
: !tr(e, "add alias", "the label", !1) || e.length <= 0
|
|
35
35
|
? (b.error("addAlias requires a non-empty label"), !1)
|
|
36
|
-
: this.Ru.
|
|
36
|
+
: this.Ru.Hu(t, e).lt;
|
|
37
37
|
}
|
|
38
38
|
setFirstName(t) {
|
|
39
39
|
return (
|
|
40
40
|
!!tr(t, "set first name", "the firstName", !0) &&
|
|
41
|
-
this.Ss.
|
|
41
|
+
this.Ss.Bu("first_name", t)
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
44
|
setLastName(t) {
|
|
45
45
|
return (
|
|
46
|
-
!!tr(t, "set last name", "the lastName", !0) && this.Ss.
|
|
46
|
+
!!tr(t, "set last name", "the lastName", !0) && this.Ss.Bu("last_name", t)
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
setEmail(t) {
|
|
50
|
-
return null === t ||
|
|
51
|
-
? this.Ss.
|
|
50
|
+
return null === t || Et(t)
|
|
51
|
+
? this.Ss.Bu("email", t)
|
|
52
52
|
: (b.error(
|
|
53
53
|
`Cannot set email address - "${t}" did not pass RFC-5322 validation.`,
|
|
54
54
|
),
|
|
@@ -65,12 +65,12 @@ export default class User {
|
|
|
65
65
|
`Gender "${t}" is not a valid gender.`,
|
|
66
66
|
"User.Genders",
|
|
67
67
|
)
|
|
68
|
-
) && this.Ss.
|
|
68
|
+
) && this.Ss.Bu("gender", t)
|
|
69
69
|
);
|
|
70
70
|
}
|
|
71
71
|
setDateOfBirth(t, e, r) {
|
|
72
72
|
return null === t && null === e && null === r
|
|
73
|
-
? this.Ss.
|
|
73
|
+
? this.Ss.Bu("dob", null)
|
|
74
74
|
: ((t = null != t ? parseInt(t.toString()) : null),
|
|
75
75
|
(e = null != e ? parseInt(e.toString()) : null),
|
|
76
76
|
(r = null != r ? parseInt(r.toString()) : null),
|
|
@@ -88,21 +88,21 @@ export default class User {
|
|
|
88
88
|
"Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);",
|
|
89
89
|
),
|
|
90
90
|
!1)
|
|
91
|
-
: this.Ss.
|
|
91
|
+
: this.Ss.Bu("dob", `${t}-${e}-${r}`));
|
|
92
92
|
}
|
|
93
93
|
setCountry(t) {
|
|
94
94
|
return (
|
|
95
|
-
!!tr(t, "set country", "the country", !0) && this.Ss.
|
|
95
|
+
!!tr(t, "set country", "the country", !0) && this.Ss.Bu("country", t)
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
setHomeCity(t) {
|
|
99
99
|
return (
|
|
100
|
-
!!tr(t, "set home city", "the homeCity", !0) && this.Ss.
|
|
100
|
+
!!tr(t, "set home city", "the homeCity", !0) && this.Ss.Bu("home_city", t)
|
|
101
101
|
);
|
|
102
102
|
}
|
|
103
103
|
setLanguage(t) {
|
|
104
104
|
return (
|
|
105
|
-
!!tr(t, "set language", "the language", !0) && this.Ss.
|
|
105
|
+
!!tr(t, "set language", "the language", !0) && this.Ss.Bu("language", t)
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
setEmailNotificationSubscriptionType(t) {
|
|
@@ -112,7 +112,7 @@ export default class User {
|
|
|
112
112
|
t,
|
|
113
113
|
`Email notification setting "${t}" is not a valid subscription type.`,
|
|
114
114
|
"User.NotificationSubscriptionTypes",
|
|
115
|
-
) && this.Ss.
|
|
115
|
+
) && this.Ss.Bu("email_subscribe", t)
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
setPushNotificationSubscriptionType(t) {
|
|
@@ -122,14 +122,14 @@ export default class User {
|
|
|
122
122
|
t,
|
|
123
123
|
`Push notification setting "${t}" is not a valid subscription type.`,
|
|
124
124
|
"User.NotificationSubscriptionTypes",
|
|
125
|
-
) && this.Ss.
|
|
125
|
+
) && this.Ss.Bu("push_subscribe", t)
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
128
|
setPhoneNumber(t) {
|
|
129
129
|
return (
|
|
130
130
|
!!tr(t, "set phone number", "the phoneNumber", !0) &&
|
|
131
|
-
(null === t || t.match(User.
|
|
132
|
-
? this.Ss.
|
|
131
|
+
(null === t || t.match(User.Ku)
|
|
132
|
+
? this.Ss.Bu("phone", t)
|
|
133
133
|
: (b.error(`Cannot set phone number - "${t}" did not pass validation.`),
|
|
134
134
|
!1))
|
|
135
135
|
);
|
|
@@ -172,7 +172,7 @@ export default class User {
|
|
|
172
172
|
const s = (e) => {
|
|
173
173
|
const [r] = nt(
|
|
174
174
|
e,
|
|
175
|
-
R.
|
|
175
|
+
R.Mu,
|
|
176
176
|
"attribute value",
|
|
177
177
|
`set custom user attribute "${t}"`,
|
|
178
178
|
"custom user attribute",
|
|
@@ -182,11 +182,11 @@ export default class User {
|
|
|
182
182
|
if (g(e)) {
|
|
183
183
|
const [r, n] = Dt(t, e);
|
|
184
184
|
if (!r && !n && 0 !== e.length) return !1;
|
|
185
|
-
if (r || 0 === e.length) return this.Ru.
|
|
185
|
+
if (r || 0 === e.length) return this.Ru.Yu(p.Vu, t, e).lt;
|
|
186
186
|
for (const t of e) if (!s(t)) return !1;
|
|
187
187
|
} else if (Ct(e)) {
|
|
188
188
|
if (!s(e)) return !1;
|
|
189
|
-
if (r) return this.Ru.
|
|
189
|
+
if (r) return this.Ru.Yu(p.Qu, t, e).lt;
|
|
190
190
|
} else {
|
|
191
191
|
if (!(void 0 !== e && Lt(e))) return !1;
|
|
192
192
|
if (
|
|
@@ -209,7 +209,7 @@ export default class User {
|
|
|
209
209
|
null != e &&
|
|
210
210
|
!mt(e, "add to custom user attribute array", "the given value")
|
|
211
211
|
) &&
|
|
212
|
-
this.Ru.
|
|
212
|
+
this.Ru.Yu(p.Xu, t, e).lt
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
215
|
removeFromCustomAttributeArray(t, e) {
|
|
@@ -219,7 +219,7 @@ export default class User {
|
|
|
219
219
|
null != e &&
|
|
220
220
|
!mt(e, "remove from custom user attribute array", "the given value")
|
|
221
221
|
) &&
|
|
222
|
-
this.Ru.
|
|
222
|
+
this.Ru.Yu(p.Zu, t, e).lt
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
incrementCustomUserAttribute(t, e) {
|
|
@@ -231,7 +231,7 @@ export default class User {
|
|
|
231
231
|
`Cannot increment custom user attribute because the given incrementValue "${e}" is not an integer.`,
|
|
232
232
|
),
|
|
233
233
|
!1)
|
|
234
|
-
: this.Ru.
|
|
234
|
+
: this.Ru.Yu(p.Na, t, r).lt;
|
|
235
235
|
}
|
|
236
236
|
setCustomLocationAttribute(t, e, r) {
|
|
237
237
|
return (
|
|
@@ -247,7 +247,7 @@ export default class User {
|
|
|
247
247
|
"Received invalid values for latitude and/or longitude. Latitude and longitude are bounded by ±90 and ±180 respectively, or must both be null for removal.",
|
|
248
248
|
),
|
|
249
249
|
!1)
|
|
250
|
-
: this.Ru.
|
|
250
|
+
: this.Ru.Ia(t, e, r).lt)
|
|
251
251
|
);
|
|
252
252
|
}
|
|
253
253
|
addToSubscriptionGroup(t) {
|
|
@@ -261,7 +261,7 @@ export default class User {
|
|
|
261
261
|
"addToSubscriptionGroup requires a non-empty subscription group ID",
|
|
262
262
|
),
|
|
263
263
|
!1)
|
|
264
|
-
: this.Ru.
|
|
264
|
+
: this.Ru.Ca(t, User.Ea.SUBSCRIBED).lt;
|
|
265
265
|
}
|
|
266
266
|
removeFromSubscriptionGroup(t) {
|
|
267
267
|
return !tr(
|
|
@@ -274,21 +274,21 @@ export default class User {
|
|
|
274
274
|
"removeFromSubscriptionGroup requires a non-empty subscription group ID",
|
|
275
275
|
),
|
|
276
276
|
!1)
|
|
277
|
-
: this.Ru.
|
|
277
|
+
: this.Ru.Ca(t, User.Ea.UNSUBSCRIBED).lt;
|
|
278
278
|
}
|
|
279
279
|
setLineId(t) {
|
|
280
280
|
return tr(t, "set LINE user ID", "the ID", !0) &&
|
|
281
281
|
0 !== (null == t ? void 0 : t.length)
|
|
282
|
-
? t && t.length > User.
|
|
282
|
+
? t && t.length > User.Sa
|
|
283
283
|
? (b.error(
|
|
284
|
-
`Rejected LINE user ID ${t} because it is longer than ${User.
|
|
284
|
+
`Rejected LINE user ID ${t} because it is longer than ${User.Sa} characters.`,
|
|
285
285
|
),
|
|
286
286
|
!1)
|
|
287
|
-
: this.Ss.
|
|
287
|
+
: this.Ss.Bu("native_line_id", t)
|
|
288
288
|
: (b.error("setLineId requires a non-empty ID"), !1);
|
|
289
289
|
}
|
|
290
|
-
|
|
291
|
-
this.Ss.
|
|
290
|
+
yu(t, e, r, s, n) {
|
|
291
|
+
this.Ss.yu(t, e, r, s, n), this.Ru.Ua();
|
|
292
292
|
}
|
|
293
293
|
wu(t) {
|
|
294
294
|
this.Ss.wu(t);
|
|
@@ -307,9 +307,9 @@ export default class User {
|
|
|
307
307
|
SUBSCRIBED: "subscribed",
|
|
308
308
|
UNSUBSCRIBED: "unsubscribed",
|
|
309
309
|
}),
|
|
310
|
-
(User.
|
|
311
|
-
(User.
|
|
312
|
-
(User.
|
|
313
|
-
(User.
|
|
310
|
+
(User.Ku = /^[0-9 .\\(\\)\\+\\-]+$/),
|
|
311
|
+
(User.Ea = { SUBSCRIBED: "subscribed", UNSUBSCRIBED: "unsubscribed" }),
|
|
312
|
+
(User.Da = "user_id"),
|
|
313
|
+
(User.Eu = "custom"),
|
|
314
314
|
(User.br = 997),
|
|
315
|
-
(User.
|
|
315
|
+
(User.Sa = 33);
|
package/src/common/constants.js
CHANGED
|
@@ -13,9 +13,9 @@ import { logger as b, Guid as V } from "../../shared-lib/index.js";
|
|
|
13
13
|
import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
|
|
14
14
|
import {
|
|
15
15
|
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as bt,
|
|
16
|
-
ineligibleBrazeActionURLErrorMessage as
|
|
16
|
+
ineligibleBrazeActionURLErrorMessage as vt,
|
|
17
17
|
getDecodedBrazeAction as eo,
|
|
18
|
-
containsUnknownBrazeAction as
|
|
18
|
+
containsUnknownBrazeAction as yt,
|
|
19
19
|
} from "../util/braze-actions.js";
|
|
20
20
|
import {
|
|
21
21
|
bottomHadImpression as Ot,
|
|
@@ -63,7 +63,7 @@ export function generateContentCardsUI(t, e) {
|
|
|
63
63
|
for (const a of t.cards) {
|
|
64
64
|
const i = a instanceof ControlCard;
|
|
65
65
|
!i || t.hr()
|
|
66
|
-
? (o.appendChild(qt(a, r, e, n.
|
|
66
|
+
? (o.appendChild(qt(a, r, e, n.za())), (s = s || !i))
|
|
67
67
|
: b.error(
|
|
68
68
|
"Received a control card for a legacy news feed. Control cards are only supported with content cards.",
|
|
69
69
|
);
|
|
@@ -187,8 +187,8 @@ export function updateContentCards(t, e, n, o, s) {
|
|
|
187
187
|
if (t instanceof Card) {
|
|
188
188
|
if (t.url && to.test(t.url)) {
|
|
189
189
|
const e = eo(t.url);
|
|
190
|
-
if (
|
|
191
|
-
b.error(
|
|
190
|
+
if (yt(e)) {
|
|
191
|
+
b.error(vt(bt.Wn, "Content Card"));
|
|
192
192
|
continue;
|
|
193
193
|
}
|
|
194
194
|
}
|
package/src/l10n/l10n-manager.js
CHANGED
|
@@ -32,36 +32,36 @@ const U = {
|
|
|
32
32
|
se: "cookieExpiryInDays",
|
|
33
33
|
Oh: "noCookies",
|
|
34
34
|
Th: "devicePropertyAllowlist",
|
|
35
|
-
|
|
35
|
+
Aa: "disablePushTokenMaintenance",
|
|
36
36
|
Rh: "enableLogging",
|
|
37
37
|
Ph: "enableSdkAuthentication",
|
|
38
|
-
|
|
38
|
+
qa: "manageServiceWorkerExternally",
|
|
39
39
|
Dh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
40
40
|
Lh: "sessionTimeoutInSeconds",
|
|
41
41
|
yh: "appVersion",
|
|
42
42
|
Mh: "appVersionNumber",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
Ma: "serviceWorkerLocation",
|
|
44
|
+
ka: "safariWebsitePushId",
|
|
45
|
+
Ba: "localization",
|
|
46
46
|
sr: "contentSecurityNonce",
|
|
47
47
|
nr: "allowUserSuppliedJavascript",
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
va: "inAppMessageZIndex",
|
|
49
|
+
ya: "openInAppMessagesInNewTab",
|
|
50
50
|
tn: "openCardsInNewTab",
|
|
51
|
-
|
|
51
|
+
lh: "requireExplicitInAppMessageDismissal",
|
|
52
52
|
Uh: "doNotLoadFontAwesome",
|
|
53
53
|
Wh: "deviceId",
|
|
54
|
-
|
|
54
|
+
_a: "serviceWorkerScope",
|
|
55
55
|
Ye: "dustHost",
|
|
56
56
|
Bh: "sdkFlavor",
|
|
57
57
|
};
|
|
58
58
|
class ci {
|
|
59
59
|
constructor() {
|
|
60
|
-
(this.
|
|
60
|
+
(this.eu = ""),
|
|
61
61
|
(this.Vh = ""),
|
|
62
62
|
(this.Kh = void 0),
|
|
63
63
|
(this.Gh = null),
|
|
64
|
-
(this.
|
|
64
|
+
(this.tu = null),
|
|
65
65
|
(this.B = null),
|
|
66
66
|
(this.Ru = null),
|
|
67
67
|
(this.h = null),
|
|
@@ -77,12 +77,12 @@ class ci {
|
|
|
77
77
|
(this.Jh = []),
|
|
78
78
|
(this.Xh = []),
|
|
79
79
|
(this.In = []),
|
|
80
|
-
(this.Vh = "6.
|
|
80
|
+
(this.Vh = "6.11.0");
|
|
81
81
|
}
|
|
82
82
|
Zh(t) {
|
|
83
83
|
this.qh.Ut(t);
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
ah(t) {
|
|
86
86
|
this.Hh.Ut(t);
|
|
87
87
|
}
|
|
88
88
|
initialize(t, i) {
|
|
@@ -101,7 +101,7 @@ class ci {
|
|
|
101
101
|
null == t || "" === t || "string" != typeof t)
|
|
102
102
|
)
|
|
103
103
|
return b.error("Braze requires a valid API key to be initialized."), !1;
|
|
104
|
-
this.
|
|
104
|
+
this.eu = t;
|
|
105
105
|
let l = this.er(U.Nh);
|
|
106
106
|
if (null == l || "" === l || "string" != typeof l)
|
|
107
107
|
return b.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
@@ -121,7 +121,7 @@ class ci {
|
|
|
121
121
|
);
|
|
122
122
|
const u = this.er(U.Oh) || !1,
|
|
123
123
|
c = this.er(U.se),
|
|
124
|
-
|
|
124
|
+
d = Zt.sl();
|
|
125
125
|
if (
|
|
126
126
|
((this.j = Zt.rl(t, u, c)),
|
|
127
127
|
u && this.j.hl(t),
|
|
@@ -135,36 +135,36 @@ class ci {
|
|
|
135
135
|
for (const t of C(this.options))
|
|
136
136
|
-1 === Wt(li).indexOf(t) &&
|
|
137
137
|
b.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
138
|
-
const
|
|
138
|
+
const m = ["mparticle", "wordpress", "tealium"];
|
|
139
139
|
if (null != this.er(U.Bh)) {
|
|
140
140
|
const t = this.er(U.Bh);
|
|
141
|
-
-1 !==
|
|
141
|
+
-1 !== m.indexOf(t)
|
|
142
142
|
? (this.Kh = t)
|
|
143
143
|
: b.error("Invalid sdk flavor passed: " + t);
|
|
144
144
|
}
|
|
145
|
-
let
|
|
146
|
-
if (null !=
|
|
147
|
-
if (g(
|
|
145
|
+
let p = this.er(li.Th);
|
|
146
|
+
if (null != p)
|
|
147
|
+
if (g(p)) {
|
|
148
148
|
const t = [];
|
|
149
|
-
for (let i = 0; i <
|
|
149
|
+
for (let i = 0; i < p.length; i++)
|
|
150
150
|
ta(
|
|
151
151
|
DeviceProperties,
|
|
152
|
-
|
|
152
|
+
p[i],
|
|
153
153
|
"devicePropertyAllowlist contained an invalid value.",
|
|
154
154
|
"DeviceProperties",
|
|
155
|
-
) && t.push(
|
|
156
|
-
|
|
155
|
+
) && t.push(p[i]);
|
|
156
|
+
p = t;
|
|
157
157
|
} else
|
|
158
158
|
b.error(
|
|
159
159
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
160
160
|
),
|
|
161
|
-
(
|
|
161
|
+
(p = null);
|
|
162
162
|
const E = this.er(U.Wh);
|
|
163
163
|
if (E) {
|
|
164
164
|
const t = new _t(E);
|
|
165
|
-
this.j.
|
|
165
|
+
this.j.Ju(s.Ou.Wh, t);
|
|
166
166
|
}
|
|
167
|
-
(this.
|
|
167
|
+
(this.tu = new Pt(this.j, p)),
|
|
168
168
|
(this.h = new Yt(this.j)),
|
|
169
169
|
(this.Ss = new Ut(this.h, this.j)),
|
|
170
170
|
(this.C = new Xt(this.j, this.Ss, this.h, this.er(U.Lh)));
|
|
@@ -172,13 +172,13 @@ class ci {
|
|
|
172
172
|
(this.Gh = new Gt(this.j, this.er(U.Ph), I)),
|
|
173
173
|
this.S(I),
|
|
174
174
|
(this.B = new Vt(
|
|
175
|
-
this.
|
|
175
|
+
this.tu,
|
|
176
176
|
this.j,
|
|
177
177
|
this.Gh,
|
|
178
178
|
this.Ss,
|
|
179
179
|
this.C,
|
|
180
180
|
this.h,
|
|
181
|
-
this.
|
|
181
|
+
this.eu,
|
|
182
182
|
this.Yh,
|
|
183
183
|
this.Vh,
|
|
184
184
|
this.Kh || "",
|
|
@@ -186,10 +186,10 @@ class ci {
|
|
|
186
186
|
this.er(U.Mh),
|
|
187
187
|
)),
|
|
188
188
|
(this.Ru = new Kt(
|
|
189
|
-
this.
|
|
189
|
+
this.eu,
|
|
190
190
|
this.Yh,
|
|
191
191
|
this.C,
|
|
192
|
-
this.
|
|
192
|
+
this.tu,
|
|
193
193
|
this.Ss,
|
|
194
194
|
this.h,
|
|
195
195
|
this.j,
|
|
@@ -204,7 +204,7 @@ class ci {
|
|
|
204
204
|
b.info(
|
|
205
205
|
`Initialized for the Braze backend at "${this.er(
|
|
206
206
|
U.Nh,
|
|
207
|
-
)}" with API key "${this.
|
|
207
|
+
)}" with API key "${this.eu}".`,
|
|
208
208
|
),
|
|
209
209
|
rt.t(),
|
|
210
210
|
Qt(),
|
|
@@ -228,10 +228,14 @@ class ci {
|
|
|
228
228
|
}),
|
|
229
229
|
this.qh.A(this.options),
|
|
230
230
|
(this.isInitialized = !0),
|
|
231
|
-
window.dispatchEvent(new CustomEvent("braze.initialized"))
|
|
231
|
+
window.dispatchEvent(new CustomEvent("braze.initialized")),
|
|
232
|
+
this.ar("tgr", () => {
|
|
233
|
+
var t;
|
|
234
|
+
null === (t = this.Ru) || void 0 === t || t.Ar(void 0, void 0, "dust");
|
|
235
|
+
});
|
|
232
236
|
const _ = null === (e = this.C) || void 0 === e ? void 0 : e.al();
|
|
233
237
|
return (
|
|
234
|
-
|
|
238
|
+
d ||
|
|
235
239
|
null == _ ||
|
|
236
240
|
(null === (r = this.C) || void 0 === r
|
|
237
241
|
? void 0
|
|
@@ -255,7 +259,7 @@ class ci {
|
|
|
255
259
|
null != this.Ru && this.Ru.destroy(),
|
|
256
260
|
(this.Ru = null),
|
|
257
261
|
(this.Gh = null),
|
|
258
|
-
(this.
|
|
262
|
+
(this.tu = null),
|
|
259
263
|
(this.B = null),
|
|
260
264
|
(this.h = null),
|
|
261
265
|
(this.C = null),
|
|
@@ -270,8 +274,8 @@ class ci {
|
|
|
270
274
|
rr() {
|
|
271
275
|
return !this.cl() && (!!this.ao() || (console.warn(R.ee), !1));
|
|
272
276
|
}
|
|
273
|
-
|
|
274
|
-
return this.
|
|
277
|
+
xa() {
|
|
278
|
+
return this.eu;
|
|
275
279
|
}
|
|
276
280
|
Er() {
|
|
277
281
|
return this.Gh;
|
|
@@ -280,7 +284,7 @@ class ci {
|
|
|
280
284
|
return this.Yh;
|
|
281
285
|
}
|
|
282
286
|
ue() {
|
|
283
|
-
return this.
|
|
287
|
+
return this.tu;
|
|
284
288
|
}
|
|
285
289
|
m() {
|
|
286
290
|
return this.B;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import ro from "../util/browser-detector.js";
|
|
2
|
-
import
|
|
2
|
+
import Oe 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 b, Guid as V } from "../../shared-lib/index.js";
|
|
6
6
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
7
7
|
import { values as Wt } from "../util/code-utils.js";
|
|
8
|
-
import { getErrorMessage as
|
|
8
|
+
import { getErrorMessage as ai } from "../util/error-utils.js";
|
|
9
9
|
export default class Pt {
|
|
10
10
|
constructor(t, e) {
|
|
11
11
|
(this.j = t),
|
|
12
|
-
(this.
|
|
12
|
+
(this.Oa = e),
|
|
13
13
|
(this.j = t),
|
|
14
14
|
null == e && (e = Wt(DeviceProperties)),
|
|
15
|
-
(this.
|
|
15
|
+
(this.Oa = e);
|
|
16
16
|
}
|
|
17
17
|
ve(t = !0) {
|
|
18
18
|
let e = this.j.$u(s.Ou.Wh);
|
|
19
|
-
null == e && ((e = new _t(V.de())), t && this.j.
|
|
20
|
-
const r = new
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
19
|
+
null == e && ((e = new _t(V.de())), t && this.j.Ju(s.Ou.Wh, e));
|
|
20
|
+
const r = new Oe(e.Iu);
|
|
21
|
+
for (let t = 0; t < this.Oa.length; t++) {
|
|
22
|
+
switch (this.Oa[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.Fa = ro.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.Ga();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.Ja = 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 Pt {
|
|
|
44
44
|
}
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
if (ro.
|
|
49
|
-
const t = this.j.St(s.It.
|
|
50
|
-
return t && t.os_version ? t.os_version : ro.
|
|
47
|
+
Ga() {
|
|
48
|
+
if (ro.Ka()) return ro.Ka();
|
|
49
|
+
const t = this.j.St(s.It.La);
|
|
50
|
+
return t && t.os_version ? t.os_version : ro.Ga();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Ha(t) {
|
|
53
53
|
let e = !1;
|
|
54
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
55
55
|
try {
|
|
@@ -60,15 +60,15 @@ export default class Pt {
|
|
|
60
60
|
} catch (t) {
|
|
61
61
|
b.info(
|
|
62
62
|
"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
|
|
63
|
-
|
|
63
|
+
ai(t),
|
|
64
64
|
),
|
|
65
65
|
(e = !0);
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
68
|
const r = t.getTimezoneOffset();
|
|
69
|
-
return this.
|
|
69
|
+
return this.Pa(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Pa(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|