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