@braze/web-sdk 6.11.0 → 6.12.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 +36 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +4 -4
- 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/DUST/dust-config-store.js +89 -0
- package/src/DUST/dust-connection-core.js +7 -21
- package/src/DUST/dust-message-dedup.js +33 -0
- package/src/DUST/dust-provider.js +367 -397
- package/src/DUST/dust-tab-identity.js +30 -0
- package/src/DUST/index.js +7 -9
- package/src/DUST/subscribe-to-dust.js +5 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +5 -5
- package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +42 -42
- package/src/InAppMessage/display/modal-utils.js +14 -14
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +73 -73
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/full-screen-message.js +9 -9
- package/src/InAppMessage/models/html-message.js +4 -4
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +52 -52
- package/src/InAppMessage/models/modal-message.js +7 -7
- package/src/InAppMessage/models/slide-up-message.js +11 -11
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/show-in-app-message.js +36 -36
- 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 +6 -6
- package/src/Push/push-manager.js +14 -14
- package/src/Push/unregister-push-token-on-server.js +3 -3
- package/src/Push/utils/push-utils.js +10 -10
- package/src/User/user.js +19 -19
- package/src/common/content-cards-display.js +21 -21
- package/src/common/event-logger.js +2 -2
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +5 -5
- package/src/managers/auth-manager.js +1 -1
- package/src/managers/braze-instance.js +41 -41
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +108 -108
- package/src/managers/server-config-manager.js +83 -83
- package/src/managers/session-manager.js +6 -6
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +127 -125
- package/src/managers/subscription-manager.js +1 -1
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +39 -39
- package/src/triggers/models/filter.js +58 -58
- package/src/triggers/models/in-app-message-click-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger.js +37 -37
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +50 -50
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +2 -2
- package/src/util/browser-detector.js +15 -15
- package/src/util/client-hints-parser.js +5 -5
- package/src/util/component-utils.js +4 -4
- package/src/util/dom-utils.js +5 -5
- package/src/util/ecommerce-event-validation.js +77 -48
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +20 -20
- package/src/util/string-utils.js +5 -0
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +4 -4
- package/src/util/window-utils.js +2 -2
- package/src/DUST/dust-shared-worker-code.js +0 -2
- package/src/DUST/dust-shared-worker-impl.js +0 -234
- package/src/DUST/dust-worker-bridge.js +0 -151
package/src/l10n/l10n-manager.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { logger as b } from "../../shared-lib/index.js";
|
|
2
|
-
import
|
|
2
|
+
import Pt from "../common/translations.js";
|
|
3
3
|
export default class jr {
|
|
4
4
|
constructor(t, e = !1) {
|
|
5
5
|
if (
|
|
6
6
|
((this.language = t),
|
|
7
7
|
null != t && (t = t.toLowerCase()),
|
|
8
|
-
null != t && null ==
|
|
8
|
+
null != t && null == Pt[t])
|
|
9
9
|
) {
|
|
10
10
|
const e = t.indexOf("-");
|
|
11
11
|
e > 0 && (t = t.substring(0, e));
|
|
12
12
|
}
|
|
13
|
-
if (null ==
|
|
13
|
+
if (null == Pt[t]) {
|
|
14
14
|
const a =
|
|
15
15
|
"Braze does not yet have a localization for language " +
|
|
16
16
|
t +
|
|
@@ -20,9 +20,9 @@ export default class jr {
|
|
|
20
20
|
this.language = t;
|
|
21
21
|
}
|
|
22
22
|
get(t) {
|
|
23
|
-
return
|
|
23
|
+
return Pt[this.language][t];
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
ga() {
|
|
26
26
|
switch (this.language) {
|
|
27
27
|
case "ar":
|
|
28
28
|
case "he":
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import f from "./subscription-manager.js";
|
|
3
3
|
import { logger as b, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
4
|
-
export default class
|
|
4
|
+
export default class Vt {
|
|
5
5
|
constructor(t, i, s) {
|
|
6
6
|
(this.j = t),
|
|
7
7
|
(this.gh = i),
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Vt from "./auth-manager.js";
|
|
2
2
|
import t from "../common/base-provider.js";
|
|
3
3
|
import ro from "../util/browser-detector.js";
|
|
4
|
-
import
|
|
4
|
+
import Wt from "./device-manager.js";
|
|
5
5
|
import DeviceProperties from "../Core/device-properties.js";
|
|
6
6
|
import {
|
|
7
7
|
isArray as g,
|
|
8
8
|
keys as C,
|
|
9
9
|
validateValueIsFromEnum as ta,
|
|
10
|
-
values as
|
|
10
|
+
values as Yt,
|
|
11
11
|
} from "../util/code-utils.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
12
|
+
import Xt from "./network-manager.js";
|
|
13
|
+
import Zt from "../request-controller.js";
|
|
14
|
+
import li from "./server-config-manager.js";
|
|
15
|
+
import fi from "./session-manager.js";
|
|
16
16
|
import ne, { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
17
|
-
import
|
|
17
|
+
import di from "./storage-manager-factory.js";
|
|
18
18
|
import f from "./subscription-manager.js";
|
|
19
19
|
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
20
20
|
import dr from "../DUST/dust-provider-factory.js";
|
|
21
|
-
import { subscribeToDust as
|
|
21
|
+
import { subscribeToDust as mi } from "../DUST/subscribe-to-dust.js";
|
|
22
22
|
import Ut from "../User/user-manager.js";
|
|
23
23
|
import { User } from "../User/index.js";
|
|
24
|
-
import { parseQueryStringKeyValues as
|
|
24
|
+
import { parseQueryStringKeyValues as pt } from "../util/url-utils.js";
|
|
25
25
|
import { WindowUtils as no } from "../util/window-utils.js";
|
|
26
26
|
import { CoreStrings as R } from "../common/constants.js";
|
|
27
|
-
import { SupportedOptions as
|
|
27
|
+
import { SupportedOptions as pi, logger as b } from "../../shared-lib/index.js";
|
|
28
28
|
import _t from "../models/identifier.js";
|
|
29
29
|
const U = {
|
|
30
30
|
_h: "allowCrawlerActivity",
|
|
@@ -32,30 +32,30 @@ const U = {
|
|
|
32
32
|
se: "cookieExpiryInDays",
|
|
33
33
|
Oh: "noCookies",
|
|
34
34
|
Th: "devicePropertyAllowlist",
|
|
35
|
-
|
|
35
|
+
xa: "disablePushTokenMaintenance",
|
|
36
36
|
Rh: "enableLogging",
|
|
37
37
|
Ph: "enableSdkAuthentication",
|
|
38
|
-
|
|
38
|
+
wa: "manageServiceWorkerExternally",
|
|
39
39
|
Dh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
40
40
|
Lh: "sessionTimeoutInSeconds",
|
|
41
41
|
yh: "appVersion",
|
|
42
42
|
Mh: "appVersionNumber",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
za: "serviceWorkerLocation",
|
|
44
|
+
ha: "safariWebsitePushId",
|
|
45
|
+
Ma: "localization",
|
|
46
46
|
sr: "contentSecurityNonce",
|
|
47
47
|
nr: "allowUserSuppliedJavascript",
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
ca: "inAppMessageZIndex",
|
|
49
|
+
da: "openInAppMessagesInNewTab",
|
|
50
50
|
tn: "openCardsInNewTab",
|
|
51
51
|
lh: "requireExplicitInAppMessageDismissal",
|
|
52
52
|
Uh: "doNotLoadFontAwesome",
|
|
53
53
|
Wh: "deviceId",
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
ba: "serviceWorkerScope",
|
|
55
|
+
Oi: "dustHost",
|
|
56
56
|
Bh: "sdkFlavor",
|
|
57
57
|
};
|
|
58
|
-
class
|
|
58
|
+
class Ei {
|
|
59
59
|
constructor() {
|
|
60
60
|
(this.eu = ""),
|
|
61
61
|
(this.Vh = ""),
|
|
@@ -77,7 +77,7 @@ class ci {
|
|
|
77
77
|
(this.Jh = []),
|
|
78
78
|
(this.Xh = []),
|
|
79
79
|
(this.In = []),
|
|
80
|
-
(this.Vh = "6.
|
|
80
|
+
(this.Vh = "6.12.0");
|
|
81
81
|
}
|
|
82
82
|
Zh(t) {
|
|
83
83
|
this.qh.Ut(t);
|
|
@@ -91,7 +91,7 @@ class ci {
|
|
|
91
91
|
return b.info("Braze has already been initialized with an API key."), !0;
|
|
92
92
|
this.options = i || {};
|
|
93
93
|
let n = this.er(U.Rh);
|
|
94
|
-
const h =
|
|
94
|
+
const h = pt(no.Qh());
|
|
95
95
|
if (
|
|
96
96
|
(h && "true" === h.brazeLogging && (n = !0),
|
|
97
97
|
b.init(n),
|
|
@@ -121,9 +121,9 @@ class ci {
|
|
|
121
121
|
);
|
|
122
122
|
const u = this.er(U.Oh) || !1,
|
|
123
123
|
c = this.er(U.se),
|
|
124
|
-
d =
|
|
124
|
+
d = di.sl();
|
|
125
125
|
if (
|
|
126
|
-
((this.j =
|
|
126
|
+
((this.j = di.rl(t, u, c)),
|
|
127
127
|
u && this.j.hl(t),
|
|
128
128
|
new ne.le(null, !0).wr(s.ce))
|
|
129
129
|
)
|
|
@@ -133,7 +133,7 @@ class ci {
|
|
|
133
133
|
!1
|
|
134
134
|
);
|
|
135
135
|
for (const t of C(this.options))
|
|
136
|
-
-1 ===
|
|
136
|
+
-1 === Yt(pi).indexOf(t) &&
|
|
137
137
|
b.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
138
138
|
const m = ["mparticle", "wordpress", "tealium"];
|
|
139
139
|
if (null != this.er(U.Bh)) {
|
|
@@ -142,7 +142,7 @@ class ci {
|
|
|
142
142
|
? (this.Kh = t)
|
|
143
143
|
: b.error("Invalid sdk flavor passed: " + t);
|
|
144
144
|
}
|
|
145
|
-
let p = this.er(
|
|
145
|
+
let p = this.er(pi.Th);
|
|
146
146
|
if (null != p)
|
|
147
147
|
if (g(p)) {
|
|
148
148
|
const t = [];
|
|
@@ -164,14 +164,14 @@ class ci {
|
|
|
164
164
|
const t = new _t(E);
|
|
165
165
|
this.j.Ju(s.Ou.Wh, t);
|
|
166
166
|
}
|
|
167
|
-
(this.tu = new
|
|
168
|
-
(this.h = new
|
|
167
|
+
(this.tu = new Wt(this.j, p)),
|
|
168
|
+
(this.h = new li(this.j)),
|
|
169
169
|
(this.Ss = new Ut(this.h, this.j)),
|
|
170
|
-
(this.C = new
|
|
170
|
+
(this.C = new fi(this.j, this.Ss, this.h, this.er(U.Lh)));
|
|
171
171
|
const I = new f();
|
|
172
|
-
(this.Gh = new
|
|
172
|
+
(this.Gh = new Vt(this.j, this.er(U.Ph), I)),
|
|
173
173
|
this.S(I),
|
|
174
|
-
(this.B = new
|
|
174
|
+
(this.B = new Xt(
|
|
175
175
|
this.tu,
|
|
176
176
|
this.j,
|
|
177
177
|
this.Gh,
|
|
@@ -185,7 +185,7 @@ class ci {
|
|
|
185
185
|
this.er(U.yh),
|
|
186
186
|
this.er(U.Mh),
|
|
187
187
|
)),
|
|
188
|
-
(this.Ru = new
|
|
188
|
+
(this.Ru = new Zt(
|
|
189
189
|
this.eu,
|
|
190
190
|
this.Yh,
|
|
191
191
|
this.C,
|
|
@@ -207,11 +207,11 @@ class ci {
|
|
|
207
207
|
)}" with API key "${this.eu}".`,
|
|
208
208
|
),
|
|
209
209
|
rt.t(),
|
|
210
|
-
|
|
211
|
-
this.h.
|
|
210
|
+
mi(),
|
|
211
|
+
this.h.do(() => {
|
|
212
212
|
var t;
|
|
213
213
|
this.isInitialized &&
|
|
214
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
214
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Kr()) &&
|
|
215
215
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
216
216
|
if (!this.isInitialized) return;
|
|
217
217
|
(0, t.default)();
|
|
@@ -220,7 +220,7 @@ class ci {
|
|
|
220
220
|
this.Ru.rn(() => {
|
|
221
221
|
var t;
|
|
222
222
|
this.isInitialized &&
|
|
223
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
223
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Kr()) &&
|
|
224
224
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
225
225
|
if (!this.isInitialized) return;
|
|
226
226
|
(0, t.default)(void 0, void 0, !0);
|
|
@@ -274,7 +274,7 @@ class ci {
|
|
|
274
274
|
rr() {
|
|
275
275
|
return !this.cl() && (!!this.ao() || (console.warn(R.ee), !1));
|
|
276
276
|
}
|
|
277
|
-
|
|
277
|
+
ja() {
|
|
278
278
|
return this.eu;
|
|
279
279
|
}
|
|
280
280
|
Er() {
|
|
@@ -346,11 +346,11 @@ class ci {
|
|
|
346
346
|
}
|
|
347
347
|
ar(t, i) {
|
|
348
348
|
if (!this.rr()) return null;
|
|
349
|
-
return dr.o().
|
|
349
|
+
return dr.o().mn(t, i);
|
|
350
350
|
}
|
|
351
351
|
qi() {
|
|
352
352
|
return this.Vh;
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
const r = new
|
|
356
|
-
export { r as default,
|
|
355
|
+
const r = new Ei();
|
|
356
|
+
export { r as default, Ei as BrazeSdkInstance, U as OPTIONS };
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import ro from "../util/browser-detector.js";
|
|
2
|
-
import
|
|
2
|
+
import ke 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
|
-
import { values as
|
|
8
|
-
import { getErrorMessage as
|
|
9
|
-
export default class
|
|
7
|
+
import { values as Yt } from "../util/code-utils.js";
|
|
8
|
+
import { getErrorMessage as ci } from "../util/error-utils.js";
|
|
9
|
+
export default class Wt {
|
|
10
10
|
constructor(t, e) {
|
|
11
11
|
(this.j = t),
|
|
12
|
-
(this.
|
|
12
|
+
(this.Da = e),
|
|
13
13
|
(this.j = t),
|
|
14
|
-
null == e && (e =
|
|
15
|
-
(this.
|
|
14
|
+
null == e && (e = Yt(DeviceProperties)),
|
|
15
|
+
(this.Da = e);
|
|
16
16
|
}
|
|
17
17
|
ve(t = !0) {
|
|
18
18
|
let e = this.j.$u(s.Ou.Wh);
|
|
19
19
|
null == e && ((e = new _t(V.de())), t && this.j.Ju(s.Ou.Wh, e));
|
|
20
|
-
const r = new
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
20
|
+
const r = new ke(e.Iu);
|
|
21
|
+
for (let t = 0; t < this.Da.length; t++) {
|
|
22
|
+
switch (this.Da[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.Oa = ro.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.Fa();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.Ga = 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.Ja(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
|
+
Fa() {
|
|
48
|
+
if (ro.qa()) return ro.qa();
|
|
49
|
+
const t = this.j.St(s.It.Aa);
|
|
50
|
+
return t && t.os_version ? t.os_version : ro.Fa();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Ja(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
|
+
ci(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.Ba(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Ba(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|