@braze/web-sdk 6.4.0 → 6.5.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 +6 -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 +14 -14
- 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 +7 -7
- 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 +17 -17
- 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 +17 -17
- package/src/InAppMessage/models/slide-up-message.js +22 -22
- 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 +152 -152
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +153 -153
- package/src/managers/server-config-manager.js +116 -88
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +137 -135
- 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 +5 -5
- 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,95 @@
|
|
|
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 $t, 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
32
|
Vh: "noCookies",
|
|
33
33
|
Kh: "devicePropertyAllowlist",
|
|
34
|
-
|
|
34
|
+
La: "disablePushTokenMaintenance",
|
|
35
35
|
$h: "enableLogging",
|
|
36
36
|
Yh: "enableSdkAuthentication",
|
|
37
|
-
|
|
37
|
+
Ka: "manageServiceWorkerExternally",
|
|
38
38
|
Xh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
39
39
|
Zh: "sessionTimeoutInSeconds",
|
|
40
40
|
Qh: "appVersion",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
Xa: "appVersionNumber",
|
|
42
|
+
Ga: "serviceWorkerLocation",
|
|
43
|
+
Ia: "safariWebsitePushId",
|
|
44
|
+
Wa: "localization",
|
|
45
45
|
er: "contentSecurityNonce",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
te: "allowUserSuppliedJavascript",
|
|
47
|
+
$a: "inAppMessageZIndex",
|
|
48
|
+
Ja: "openInAppMessagesInNewTab",
|
|
49
49
|
tn: "openCardsInNewTab",
|
|
50
50
|
Oh: "requireExplicitInAppMessageDismissal",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
Za: "doNotLoadFontAwesome",
|
|
52
|
+
tl: "deviceId",
|
|
53
|
+
Ha: "serviceWorkerScope",
|
|
54
|
+
Ne: "dustHost",
|
|
55
|
+
il: "sdkFlavor",
|
|
56
56
|
};
|
|
57
|
-
class
|
|
57
|
+
class qt {
|
|
58
58
|
constructor() {
|
|
59
|
-
(this.
|
|
60
|
-
(this.
|
|
61
|
-
(this.
|
|
62
|
-
(this.
|
|
63
|
-
(this.
|
|
64
|
-
(this.
|
|
65
|
-
(this.
|
|
59
|
+
(this.tu = ""),
|
|
60
|
+
(this.sl = ""),
|
|
61
|
+
(this.rl = void 0),
|
|
62
|
+
(this.hl = null),
|
|
63
|
+
(this.eu = null),
|
|
64
|
+
(this.j = null),
|
|
65
|
+
(this.Ru = null),
|
|
66
66
|
(this.h = null),
|
|
67
67
|
(this.C = null),
|
|
68
|
-
(this.
|
|
69
|
-
(this.
|
|
70
|
-
(this.
|
|
68
|
+
(this.B = null),
|
|
69
|
+
(this.vs = null),
|
|
70
|
+
(this.al = ""),
|
|
71
71
|
(this.isInitialized = !1),
|
|
72
|
-
(this.
|
|
73
|
-
(this.
|
|
74
|
-
(this.
|
|
72
|
+
(this.ul = !1),
|
|
73
|
+
(this.cl = new m()),
|
|
74
|
+
(this.fl = new m()),
|
|
75
75
|
(this.options = {}),
|
|
76
|
-
(this.
|
|
77
|
-
(this.
|
|
78
|
-
(this.
|
|
79
|
-
(this.
|
|
76
|
+
(this.ml = []),
|
|
77
|
+
(this.dl = []),
|
|
78
|
+
(this.jn = []),
|
|
79
|
+
(this.sl = "6.5.0");
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
this.
|
|
81
|
+
El(t) {
|
|
82
|
+
this.cl.Rt(t);
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
this.
|
|
84
|
+
mh(t) {
|
|
85
|
+
this.fl.Rt(t);
|
|
86
86
|
}
|
|
87
87
|
initialize(t, i) {
|
|
88
88
|
if (this.ao())
|
|
89
89
|
return E.info("Braze has already been initialized with an API key."), !0;
|
|
90
90
|
this.options = i || {};
|
|
91
|
-
let e = this.
|
|
92
|
-
const r = ll(no.
|
|
91
|
+
let e = this.re(D.$h);
|
|
92
|
+
const r = ll(no.gl());
|
|
93
93
|
if (
|
|
94
94
|
(r && "true" === r.brazeLogging && (e = !0),
|
|
95
95
|
E.init(e),
|
|
@@ -99,8 +99,8 @@ class Yt {
|
|
|
99
99
|
null == t || "" === t || "string" != typeof t)
|
|
100
100
|
)
|
|
101
101
|
return E.error("Braze requires a valid API key to be initialized."), !1;
|
|
102
|
-
this.
|
|
103
|
-
let o = this.
|
|
102
|
+
this.tu = t;
|
|
103
|
+
let o = this.re(D.Wh);
|
|
104
104
|
if (null == o || "" === o || "string" != typeof o)
|
|
105
105
|
return E.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
106
106
|
!1 === /^https?:/.test(o) && (o = `https://${o}`);
|
|
@@ -109,36 +109,36 @@ class Yt {
|
|
|
109
109
|
((o = document.createElement("a")),
|
|
110
110
|
(o.href = n),
|
|
111
111
|
"/" === o.pathname && (o = `${o}api/v3`),
|
|
112
|
-
(this.
|
|
113
|
-
ro.
|
|
112
|
+
(this.al = o.toString()),
|
|
113
|
+
ro.Il && !this.re(D.Ph))
|
|
114
114
|
)
|
|
115
115
|
return (
|
|
116
116
|
E.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
117
|
-
(this.
|
|
117
|
+
(this.ul = !0),
|
|
118
118
|
!1
|
|
119
119
|
);
|
|
120
|
-
const h = this.
|
|
120
|
+
const h = this.re(D.Vh) || !1;
|
|
121
121
|
if (
|
|
122
|
-
((this.
|
|
122
|
+
((this.B = Kt._l(t, h)), h && this.B.Sl(t), new ee.le(null, !0).jr(s.pe))
|
|
123
123
|
)
|
|
124
124
|
return (
|
|
125
125
|
E.info("Ignoring all activity due to previous opt out"),
|
|
126
|
-
(this.
|
|
126
|
+
(this.ul = !0),
|
|
127
127
|
!1
|
|
128
128
|
);
|
|
129
129
|
for (const t of C(this.options))
|
|
130
|
-
-1 === Pt(
|
|
130
|
+
-1 === Pt($t).indexOf(t) &&
|
|
131
131
|
E.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
132
132
|
const a = ["mparticle", "wordpress", "tealium"];
|
|
133
|
-
if (null != this.
|
|
134
|
-
const t = this.
|
|
133
|
+
if (null != this.re(D.il)) {
|
|
134
|
+
const t = this.re(D.il);
|
|
135
135
|
-1 !== a.indexOf(t)
|
|
136
|
-
? (this.
|
|
136
|
+
? (this.rl = t)
|
|
137
137
|
: E.error("Invalid sdk flavor passed: " + t);
|
|
138
138
|
}
|
|
139
|
-
let l = this.
|
|
139
|
+
let l = this.re($t.Kh);
|
|
140
140
|
if (null != l)
|
|
141
|
-
if (
|
|
141
|
+
if (R(l)) {
|
|
142
142
|
const t = [];
|
|
143
143
|
for (let i = 0; i < l.length; i++)
|
|
144
144
|
ta(
|
|
@@ -153,75 +153,75 @@ class Yt {
|
|
|
153
153
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
154
154
|
),
|
|
155
155
|
(l = null);
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
const t = new _t(
|
|
159
|
-
this.
|
|
156
|
+
const u = this.re(D.tl);
|
|
157
|
+
if (u) {
|
|
158
|
+
const t = new _t(u);
|
|
159
|
+
this.B.Iu(s.Ou.tl, t);
|
|
160
160
|
}
|
|
161
|
-
(this.
|
|
162
|
-
(this.h = new
|
|
163
|
-
(this.
|
|
164
|
-
(this.C = new
|
|
165
|
-
const
|
|
161
|
+
(this.eu = new Ot(this.B, l)),
|
|
162
|
+
(this.h = new Bt(this.B)),
|
|
163
|
+
(this.vs = new bt(this.h, this.B)),
|
|
164
|
+
(this.C = new Vt(this.B, this.vs, this.h, this.re(D.Zh)));
|
|
165
|
+
const c = new m();
|
|
166
166
|
return (
|
|
167
|
-
(this.
|
|
168
|
-
this.q(
|
|
169
|
-
(this.
|
|
170
|
-
this.
|
|
171
|
-
this.
|
|
172
|
-
this.
|
|
173
|
-
this.
|
|
167
|
+
(this.hl = new kt(this.B, this.re(D.Yh), c)),
|
|
168
|
+
this.q(c),
|
|
169
|
+
(this.j = new Mt(
|
|
170
|
+
this.eu,
|
|
171
|
+
this.B,
|
|
172
|
+
this.hl,
|
|
173
|
+
this.vs,
|
|
174
174
|
this.C,
|
|
175
175
|
this.h,
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
this.
|
|
176
|
+
this.tu,
|
|
177
|
+
this.al,
|
|
178
|
+
this.sl,
|
|
179
|
+
this.rl || "",
|
|
180
|
+
this.re(D.Qh),
|
|
181
|
+
this.re(D.Xa),
|
|
182
182
|
)),
|
|
183
|
-
(this.
|
|
184
|
-
this.
|
|
185
|
-
this.
|
|
183
|
+
(this.Ru = new Wt(
|
|
184
|
+
this.tu,
|
|
185
|
+
this.al,
|
|
186
186
|
this.C,
|
|
187
|
-
this.
|
|
188
|
-
this.
|
|
187
|
+
this.eu,
|
|
188
|
+
this.vs,
|
|
189
189
|
this.h,
|
|
190
|
-
this.
|
|
190
|
+
this.B,
|
|
191
191
|
(t) => {
|
|
192
192
|
if (this.ao()) for (const i of this.gr()) i.N(t);
|
|
193
193
|
},
|
|
194
|
-
this.
|
|
195
|
-
this.
|
|
194
|
+
this.hl,
|
|
195
|
+
this.j,
|
|
196
196
|
)),
|
|
197
|
-
this.
|
|
198
|
-
h || this.
|
|
197
|
+
this.Ru.initialize(),
|
|
198
|
+
h || this.B.Al(),
|
|
199
199
|
E.info(
|
|
200
|
-
`Initialized for the Braze backend at "${this.
|
|
201
|
-
|
|
202
|
-
)}" with API key "${this.
|
|
200
|
+
`Initialized for the Braze backend at "${this.re(
|
|
201
|
+
D.Wh,
|
|
202
|
+
)}" with API key "${this.tu}".`,
|
|
203
203
|
),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
this.h
|
|
204
|
+
rt.t(),
|
|
205
|
+
Gt(),
|
|
206
|
+
this.h.jo(() => {
|
|
207
207
|
var t;
|
|
208
208
|
this.isInitialized &&
|
|
209
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
209
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Yr()) &&
|
|
210
210
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
211
211
|
if (!this.isInitialized) return;
|
|
212
212
|
(0, t.default)();
|
|
213
213
|
});
|
|
214
214
|
}),
|
|
215
|
-
this.
|
|
215
|
+
this.Ru.rn(() => {
|
|
216
216
|
var t;
|
|
217
217
|
this.isInitialized &&
|
|
218
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
218
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Yr()) &&
|
|
219
219
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
220
220
|
if (!this.isInitialized) return;
|
|
221
221
|
(0, t.default)(void 0, void 0, !0);
|
|
222
222
|
});
|
|
223
223
|
}),
|
|
224
|
-
this.
|
|
224
|
+
this.cl.L(this.options),
|
|
225
225
|
(this.isInitialized = !0),
|
|
226
226
|
window.dispatchEvent(new CustomEvent("braze.initialized")),
|
|
227
227
|
!0
|
|
@@ -229,55 +229,55 @@ class Yt {
|
|
|
229
229
|
}
|
|
230
230
|
destroy(t) {
|
|
231
231
|
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.
|
|
232
|
+
this.fl.L(), this.fl.removeAllSubscriptions();
|
|
233
|
+
for (const t of this.ml) t.destroy();
|
|
234
|
+
this.ml = [];
|
|
235
|
+
for (const t of this.dl) t.clearData(!1);
|
|
236
|
+
this.j && this.j.fo(),
|
|
237
|
+
(this.dl = []),
|
|
238
238
|
this.removeAllSubscriptions(),
|
|
239
|
-
(this.
|
|
240
|
-
null != this.
|
|
241
|
-
(this.
|
|
242
|
-
(this.
|
|
243
|
-
(this.
|
|
244
|
-
(this.
|
|
239
|
+
(this.jn = []),
|
|
240
|
+
null != this.Ru && this.Ru.destroy(),
|
|
241
|
+
(this.Ru = null),
|
|
242
|
+
(this.hl = null),
|
|
243
|
+
(this.eu = null),
|
|
244
|
+
(this.j = null),
|
|
245
245
|
(this.h = null),
|
|
246
246
|
(this.C = null),
|
|
247
|
-
(this.
|
|
247
|
+
(this.vs = null),
|
|
248
248
|
(this.options = {}),
|
|
249
|
-
(this.
|
|
249
|
+
(this.rl = void 0),
|
|
250
250
|
(this.isInitialized = !1),
|
|
251
|
-
(this.
|
|
252
|
-
t && (this.
|
|
251
|
+
(this.ul = !1),
|
|
252
|
+
t && (this.B = null);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
rr() {
|
|
256
|
-
return !this.
|
|
256
|
+
return !this.Nl() && (!!this.ao() || (console.warn(z.ee), !1));
|
|
257
257
|
}
|
|
258
|
-
|
|
259
|
-
return this.
|
|
258
|
+
_a() {
|
|
259
|
+
return this.tu;
|
|
260
260
|
}
|
|
261
261
|
Sr() {
|
|
262
|
-
return this.
|
|
262
|
+
return this.hl;
|
|
263
263
|
}
|
|
264
264
|
V() {
|
|
265
|
-
return this.
|
|
265
|
+
return this.al;
|
|
266
266
|
}
|
|
267
|
-
|
|
268
|
-
return this.
|
|
267
|
+
ue() {
|
|
268
|
+
return this.eu;
|
|
269
269
|
}
|
|
270
270
|
m() {
|
|
271
|
-
return this.
|
|
271
|
+
return this.j;
|
|
272
272
|
}
|
|
273
|
-
|
|
273
|
+
re(t) {
|
|
274
274
|
return this.options[t];
|
|
275
275
|
}
|
|
276
276
|
gr() {
|
|
277
|
-
return this.
|
|
277
|
+
return this.dl;
|
|
278
278
|
}
|
|
279
279
|
nn() {
|
|
280
|
-
return this.
|
|
280
|
+
return this.Ru;
|
|
281
281
|
}
|
|
282
282
|
l() {
|
|
283
283
|
return this.h;
|
|
@@ -286,52 +286,52 @@ class Yt {
|
|
|
286
286
|
return this.C;
|
|
287
287
|
}
|
|
288
288
|
p() {
|
|
289
|
-
return this.
|
|
289
|
+
return this.B;
|
|
290
290
|
}
|
|
291
291
|
br() {
|
|
292
|
-
if (this.
|
|
292
|
+
if (this.vs && this.Ru) return new User(this.vs, this.Ru);
|
|
293
293
|
}
|
|
294
294
|
ir() {
|
|
295
|
-
return this.
|
|
295
|
+
return this.vs;
|
|
296
296
|
}
|
|
297
297
|
nr() {
|
|
298
|
-
return !0 === this.
|
|
298
|
+
return !0 === this.re(D.te);
|
|
299
299
|
}
|
|
300
300
|
g(t) {
|
|
301
301
|
let i = !1;
|
|
302
|
-
for (const s of this.
|
|
303
|
-
i || this.
|
|
302
|
+
for (const s of this.ml) s === t && (i = !0);
|
|
303
|
+
i || this.ml.push(t);
|
|
304
304
|
}
|
|
305
305
|
v(i) {
|
|
306
306
|
let s = !1;
|
|
307
|
-
for (const t of this.
|
|
308
|
-
i instanceof t && !s && this.
|
|
307
|
+
for (const t of this.dl) t.constructor === i.constructor && (s = !0);
|
|
308
|
+
i instanceof t && !s && this.dl.push(i);
|
|
309
309
|
}
|
|
310
310
|
q(t) {
|
|
311
|
-
t instanceof
|
|
311
|
+
t instanceof m && this.jn.push(t);
|
|
312
312
|
}
|
|
313
313
|
removeAllSubscriptions() {
|
|
314
|
-
if (this.rr()) for (const t of this.
|
|
314
|
+
if (this.rr()) for (const t of this.jn) t.removeAllSubscriptions();
|
|
315
315
|
}
|
|
316
316
|
removeSubscription(t) {
|
|
317
|
-
if (this.rr()) for (const i of this.
|
|
317
|
+
if (this.rr()) for (const i of this.jn) i.removeSubscription(t);
|
|
318
318
|
}
|
|
319
|
-
|
|
320
|
-
this.
|
|
319
|
+
ge(t) {
|
|
320
|
+
this.ul = t;
|
|
321
321
|
}
|
|
322
322
|
ao() {
|
|
323
323
|
return this.isInitialized;
|
|
324
324
|
}
|
|
325
|
-
|
|
326
|
-
return this.
|
|
325
|
+
Nl() {
|
|
326
|
+
return this.ul;
|
|
327
327
|
}
|
|
328
328
|
tr(t, i) {
|
|
329
329
|
if (!this.rr()) return null;
|
|
330
|
-
return
|
|
330
|
+
return nr.o().Be(t, i);
|
|
331
331
|
}
|
|
332
332
|
Vs() {
|
|
333
|
-
return this.
|
|
333
|
+
return this.sl;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
const r = new
|
|
337
|
-
export { r as default,
|
|
336
|
+
const r = new qt();
|
|
337
|
+
export { r as default, qt 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.tl);
|
|
19
|
+
null == e && ((e = new _t(P.se())), t && this.B.Iu(s.Ou.tl, 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
|
}
|