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