@braze/web-sdk 5.0.1 → 5.1.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 +10 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +29 -29
- package/shared-lib/guid.js +3 -3
- package/shared-lib/index.js +6 -0
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +21 -21
- package/src/Card/card-manager.js +43 -45
- package/src/Card/display/card-display.js +60 -60
- package/src/Card/log-card-click.js +4 -4
- package/src/Card/log-card-dismissal.js +2 -3
- package/src/Card/log-card-impressions.js +7 -7
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +19 -19
- package/src/Card/util/card-factory.js +68 -68
- package/src/ContentCards/content-cards-provider-factory.js +3 -3
- package/src/ContentCards/content-cards-provider.js +255 -245
- package/src/ContentCards/content-cards.js +2 -2
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/hide-content-cards.js +1 -1
- package/src/ContentCards/ui/show-content-cards.js +24 -24
- package/src/ContentCards/ui/toggle-content-cards.js +1 -1
- package/src/Core/add-sdk-metadata.js +21 -19
- package/src/Core/change-user.js +10 -10
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +11 -11
- package/src/Core/enable-sdk.js +7 -7
- package/src/Core/get-device-id.js +6 -6
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +41 -41
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +15 -15
- package/src/Core/log-purchase.js +31 -37
- package/src/Core/open-session.js +12 -12
- package/src/Core/remove-all-subscriptions.js +1 -1
- package/src/Core/remove-subscription.js +1 -1
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -4
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +12 -12
- package/src/FeatureFlags/feature-flag.js +10 -10
- package/src/FeatureFlags/feature-flags-provider-factory.js +3 -2
- package/src/FeatureFlags/feature-flags-provider.js +108 -80
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +15 -13
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +7 -4
- package/src/Feed/feed-provider-factory.js +2 -2
- package/src/Feed/feed-provider.js +44 -44
- package/src/Feed/feed.js +1 -1
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +4 -4
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/hide-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +28 -28
- package/src/Feed/ui/toggle-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +5 -5
- package/src/InAppMessage/display/html-message-to-html.js +54 -54
- package/src/InAppMessage/display/in-app-message-to-html.js +79 -79
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +49 -49
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +143 -138
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-impression.js +6 -6
- package/src/InAppMessage/models/full-screen-message.js +33 -33
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +6 -6
- package/src/InAppMessage/models/in-app-message.js +99 -99
- package/src/InAppMessage/models/modal-message.js +32 -32
- package/src/InAppMessage/models/slide-up-message.js +28 -28
- 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 +4 -4
- package/src/InAppMessage/ui/show-in-app-message.js +81 -81
- package/src/Push/is-push-blocked.js +1 -1
- package/src/Push/is-push-permission-granted.js +1 -1
- package/src/Push/is-push-supported.js +1 -1
- package/src/Push/push-manager-factory.js +5 -5
- package/src/Push/push-manager.js +176 -173
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +29 -29
- package/src/User/user.js +72 -74
- package/src/common/base-feed.js +7 -7
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +21 -18
- package/src/common/feed-display.js +44 -44
- package/src/l10n/l10n-manager-factory.js +3 -3
- package/src/l10n/l10n-manager.js +7 -7
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +188 -190
- package/src/managers/device-manager.js +28 -28
- package/src/managers/network-manager.js +189 -138
- package/src/managers/server-config-manager.js +69 -53
- package/src/managers/session-manager.js +34 -30
- package/src/managers/storage-manager-factory.js +16 -16
- package/src/managers/storage-manager.js +178 -163
- package/src/managers/subscription-manager.js +12 -12
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +34 -14
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +32 -23
- package/src/request-controller.js +186 -179
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +13 -13
- package/src/triggers/models/filter.js +45 -45
- package/src/triggers/models/in-app-message-click-data.js +12 -12
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +7 -7
- package/src/triggers/models/trigger-condition.js +57 -59
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +38 -38
- package/src/triggers/triggers-provider-factory.js +4 -4
- package/src/triggers/triggers-provider.js +127 -130
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +35 -35
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +8 -8
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +4 -4
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +18 -18
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +18 -18
- package/src/util/request-header-utils.js +39 -37
- package/src/util/string-utils.js +10 -10
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +37 -39
- package/src/util/window-utils.js +3 -3
- package/shared-lib/braze-shared-lib.js +0 -8
|
@@ -1,144 +1,142 @@
|
|
|
1
1
|
import kt from "./auth-manager.js";
|
|
2
2
|
import y from "../common/base-provider.js";
|
|
3
|
-
import
|
|
3
|
+
import X 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
|
|
8
|
-
keys as
|
|
9
|
-
validateValueIsFromEnum as
|
|
7
|
+
isArray as j,
|
|
8
|
+
keys as to,
|
|
9
|
+
validateValueIsFromEnum as J,
|
|
10
10
|
values as Pt,
|
|
11
11
|
} from "../util/code-utils.js";
|
|
12
12
|
import Rt from "./network-manager.js";
|
|
13
13
|
import Lt from "../request-controller.js";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import E from "./subscription-manager.js";
|
|
14
|
+
import Dt from "./server-config-manager.js";
|
|
15
|
+
import Mt from "./session-manager.js";
|
|
16
|
+
import Q, { STORAGE_KEYS as o } from "./storage-manager.js";
|
|
17
|
+
import Bt from "./storage-manager-factory.js";
|
|
18
|
+
import T from "./subscription-manager.js";
|
|
20
19
|
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
|
|
21
20
|
import bt from "../User/user-manager.js";
|
|
22
21
|
import { User } from "../User/index.js";
|
|
23
22
|
import { parseQueryStringKeyValues as ut } from "../util/url-utils.js";
|
|
24
|
-
import { WindowUtils as
|
|
25
|
-
import { BRAZE_MUST_BE_INITIALIZED_ERROR as
|
|
23
|
+
import { WindowUtils as eo } from "../util/window-utils.js";
|
|
24
|
+
import { BRAZE_MUST_BE_INITIALIZED_ERROR as _ } from "../common/constants.js";
|
|
25
|
+
import { SupportedOptions as Wt, logger as r } from "../../shared-lib/index.js";
|
|
26
26
|
const L = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
27
|
+
_o: "allowCrawlerActivity",
|
|
28
|
+
Io: "baseUrl",
|
|
29
|
+
Ao: "noCookies",
|
|
30
|
+
So: "devicePropertyAllowlist",
|
|
31
|
+
qa: "disablePushTokenMaintenance",
|
|
32
|
+
No: "enableLogging",
|
|
33
|
+
Oo: "enableSdkAuthentication",
|
|
34
|
+
ka: "manageServiceWorkerExternally",
|
|
35
|
+
Po: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
36
|
+
Ro: "sessionTimeoutInSeconds",
|
|
37
|
+
Lo: "appVersion",
|
|
38
|
+
Do: "appVersionNumber",
|
|
39
|
+
Ma: "serviceWorkerLocation",
|
|
40
|
+
_a: "safariWebsitePushId",
|
|
41
|
+
Xn: "localization",
|
|
42
|
+
wo: "contentSecurityNonce",
|
|
43
|
+
Mo: "allowUserSuppliedJavascript",
|
|
44
|
+
ho: "inAppMessageZIndex",
|
|
45
|
+
yo: "openInAppMessagesInNewTab",
|
|
46
46
|
tn: "openCardsInNewTab",
|
|
47
47
|
en: "openNewsFeedCardsInNewTab",
|
|
48
48
|
mh: "requireExplicitInAppMessageDismissal",
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Uo: "doNotLoadFontAwesome",
|
|
50
|
+
Bo: "sdkFlavor",
|
|
51
51
|
};
|
|
52
|
-
class
|
|
52
|
+
class zt {
|
|
53
53
|
constructor() {
|
|
54
|
-
(this.
|
|
55
|
-
(this.
|
|
56
|
-
(this.
|
|
57
|
-
(this.
|
|
58
|
-
(this.
|
|
59
|
-
(this
|
|
60
|
-
(this.
|
|
54
|
+
(this.an = ""),
|
|
55
|
+
(this.Wo = ""),
|
|
56
|
+
(this.Vo = void 0),
|
|
57
|
+
(this.Go = null),
|
|
58
|
+
(this.hn = null),
|
|
59
|
+
(this.qt = null),
|
|
60
|
+
(this.Ei = null),
|
|
61
61
|
(this.yt = null),
|
|
62
|
-
(this.
|
|
62
|
+
(this.di = null),
|
|
63
63
|
(this.u = null),
|
|
64
64
|
(this.wt = null),
|
|
65
|
-
(this.
|
|
66
|
-
(this
|
|
67
|
-
(this.
|
|
68
|
-
(this.
|
|
69
|
-
(this.
|
|
65
|
+
(this.Ko = ""),
|
|
66
|
+
(this.$o = !1),
|
|
67
|
+
(this.qo = !1),
|
|
68
|
+
(this.Jo = new T()),
|
|
69
|
+
(this.Yo = new T()),
|
|
70
70
|
(this.options = {}),
|
|
71
|
-
(this.
|
|
72
|
-
(this.
|
|
73
|
-
(this.
|
|
74
|
-
(this.
|
|
71
|
+
(this.Ho = []),
|
|
72
|
+
(this.Xo = []),
|
|
73
|
+
(this._e = []),
|
|
74
|
+
(this.Wo = "5.1.0");
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
this.
|
|
76
|
+
Zo(t) {
|
|
77
|
+
this.Jo.It(t);
|
|
78
78
|
}
|
|
79
79
|
Rh(t) {
|
|
80
|
-
this.
|
|
80
|
+
this.Yo.It(t);
|
|
81
81
|
}
|
|
82
|
-
initialize(t,
|
|
83
|
-
if (this.
|
|
84
|
-
return (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
let e = this.nn(L.Ao);
|
|
89
|
-
const n = ut(Y.Cn());
|
|
82
|
+
initialize(t, i) {
|
|
83
|
+
if (this.so())
|
|
84
|
+
return r.info("Braze has already been initialized with an API key."), !0;
|
|
85
|
+
this.options = i || {};
|
|
86
|
+
let s = this.nn(L.No);
|
|
87
|
+
const e = ut(eo.Tn());
|
|
90
88
|
if (
|
|
91
|
-
(
|
|
92
|
-
r.
|
|
93
|
-
r.
|
|
89
|
+
(e && "true" === e.brazeLogging && (s = !0),
|
|
90
|
+
r.init(s),
|
|
91
|
+
r.info(
|
|
94
92
|
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`,
|
|
95
93
|
),
|
|
96
94
|
null == t || "" === t || "string" != typeof t)
|
|
97
95
|
)
|
|
98
|
-
return r.
|
|
99
|
-
this.
|
|
100
|
-
let
|
|
101
|
-
if (null ==
|
|
102
|
-
return r.
|
|
103
|
-
!1 === /^https?:/.test(
|
|
104
|
-
const h =
|
|
96
|
+
return r.error("Braze requires a valid API key to be initialized."), !1;
|
|
97
|
+
this.an = t;
|
|
98
|
+
let n = this.nn(L.Io);
|
|
99
|
+
if (null == n || "" === n || "string" != typeof n)
|
|
100
|
+
return r.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
101
|
+
!1 === /^https?:/.test(n) && (n = `https://${n}`);
|
|
102
|
+
const h = n;
|
|
105
103
|
if (
|
|
106
|
-
((
|
|
107
|
-
(
|
|
108
|
-
"/" ===
|
|
109
|
-
(this.
|
|
110
|
-
|
|
104
|
+
((n = document.createElement("a")),
|
|
105
|
+
(n.href = h),
|
|
106
|
+
"/" === n.pathname && (n = `${n}api/v3`),
|
|
107
|
+
(this.Ko = n.toString()),
|
|
108
|
+
X.Qo && !this.nn(L._o))
|
|
111
109
|
)
|
|
112
110
|
return (
|
|
113
|
-
r.
|
|
114
|
-
(this.
|
|
111
|
+
r.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
112
|
+
(this.qo = !0),
|
|
115
113
|
!1
|
|
116
114
|
);
|
|
117
|
-
const a = this.nn(L.
|
|
115
|
+
const a = this.nn(L.Ao) || !1;
|
|
118
116
|
if (
|
|
119
|
-
((this.u =
|
|
117
|
+
((this.u = Bt.Wh(t, a)), a && this.u.Vh(t), new Q.ee(null, !0).br(o.se))
|
|
120
118
|
)
|
|
121
119
|
return (
|
|
122
|
-
r.
|
|
123
|
-
(this.
|
|
120
|
+
r.info("Ignoring all activity due to previous opt out"),
|
|
121
|
+
(this.qo = !0),
|
|
124
122
|
!1
|
|
125
123
|
);
|
|
126
|
-
for (const t of
|
|
127
|
-
-1 === Pt(
|
|
128
|
-
r.
|
|
124
|
+
for (const t of to(this.options))
|
|
125
|
+
-1 === Pt(Wt).indexOf(t) &&
|
|
126
|
+
r.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
129
127
|
const l = ["mparticle", "wordpress", "tealium"];
|
|
130
|
-
if (null != this.nn(L.
|
|
131
|
-
const t = this.nn(L.
|
|
128
|
+
if (null != this.nn(L.Bo)) {
|
|
129
|
+
const t = this.nn(L.Bo);
|
|
132
130
|
-1 !== l.indexOf(t)
|
|
133
|
-
? (this.
|
|
134
|
-
: r.
|
|
131
|
+
? (this.Vo = t)
|
|
132
|
+
: r.error("Invalid sdk flavor passed: " + t);
|
|
135
133
|
}
|
|
136
|
-
let u = this.nn(
|
|
134
|
+
let u = this.nn(Wt.So);
|
|
137
135
|
if (null != u)
|
|
138
|
-
if (
|
|
136
|
+
if (j(u)) {
|
|
139
137
|
const t = [];
|
|
140
138
|
for (let i = 0; i < u.length; i++)
|
|
141
|
-
|
|
139
|
+
J(
|
|
142
140
|
DeviceProperties,
|
|
143
141
|
u[i],
|
|
144
142
|
"devicePropertyAllowlist contained an invalid value.",
|
|
@@ -146,177 +144,177 @@ class Bt {
|
|
|
146
144
|
) && t.push(u[i]);
|
|
147
145
|
u = t;
|
|
148
146
|
} else
|
|
149
|
-
r.
|
|
147
|
+
r.error(
|
|
150
148
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
151
149
|
),
|
|
152
150
|
(u = null);
|
|
153
|
-
(this.
|
|
154
|
-
(this.yt = new
|
|
151
|
+
(this.hn = new Ot(this.u, u)),
|
|
152
|
+
(this.yt = new Dt(this.u)),
|
|
155
153
|
(this.wt = new bt(this.yt, this.u)),
|
|
156
|
-
(this.
|
|
157
|
-
const f = new
|
|
154
|
+
(this.di = new Mt(this.u, this.wt, this.yt, this.nn(L.Ro)));
|
|
155
|
+
const f = new T();
|
|
158
156
|
return (
|
|
159
|
-
(this.
|
|
160
|
-
this
|
|
161
|
-
(this
|
|
162
|
-
this.
|
|
157
|
+
(this.Go = new kt(this.u, this.nn(L.Oo), f)),
|
|
158
|
+
this.$t(f),
|
|
159
|
+
(this.qt = new Rt(
|
|
160
|
+
this.hn,
|
|
163
161
|
this.u,
|
|
164
|
-
this.
|
|
162
|
+
this.Go,
|
|
165
163
|
this.wt,
|
|
166
|
-
this.
|
|
164
|
+
this.di,
|
|
167
165
|
this.yt,
|
|
168
|
-
this.
|
|
169
|
-
this.
|
|
170
|
-
this.
|
|
171
|
-
this.
|
|
172
|
-
this.nn(L.
|
|
173
|
-
this.nn(L.
|
|
166
|
+
this.an,
|
|
167
|
+
this.Ko,
|
|
168
|
+
this.Wo,
|
|
169
|
+
this.Vo || "",
|
|
170
|
+
this.nn(L.Lo),
|
|
171
|
+
this.nn(L.Do),
|
|
174
172
|
)),
|
|
175
|
-
(this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
173
|
+
(this.Ei = new Lt(
|
|
174
|
+
this.an,
|
|
175
|
+
this.Ko,
|
|
176
|
+
this.di,
|
|
177
|
+
this.hn,
|
|
180
178
|
this.wt,
|
|
181
179
|
this.yt,
|
|
182
180
|
this.u,
|
|
183
181
|
(t) => {
|
|
184
|
-
if (this.
|
|
182
|
+
if (this.so()) for (const i of this.gr()) i.Rs(t);
|
|
185
183
|
},
|
|
186
|
-
this.
|
|
187
|
-
this
|
|
184
|
+
this.Go,
|
|
185
|
+
this.qt,
|
|
188
186
|
)),
|
|
189
|
-
this.
|
|
190
|
-
a || this.u.
|
|
191
|
-
r.
|
|
187
|
+
this.Ei.initialize(),
|
|
188
|
+
a || this.u.Kh(),
|
|
189
|
+
r.info(
|
|
192
190
|
`Initialized for the Braze backend at "${this.nn(
|
|
193
|
-
L.
|
|
194
|
-
)}" with API key "${this.
|
|
191
|
+
L.Io,
|
|
192
|
+
)}" with API key "${this.an}".`,
|
|
195
193
|
),
|
|
196
194
|
et.o(),
|
|
197
|
-
this.yt.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
this.yt.yi() &&
|
|
195
|
+
this.yt.xi(() => {
|
|
196
|
+
var t;
|
|
197
|
+
this.$o &&
|
|
198
|
+
(null === (t = this.yt) || void 0 === t ? void 0 : t.yi()) &&
|
|
201
199
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
202
|
-
if (!this
|
|
200
|
+
if (!this.$o) return;
|
|
203
201
|
(0, t.default)();
|
|
204
202
|
});
|
|
205
203
|
}),
|
|
206
|
-
this.
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
this.yt.yi() &&
|
|
204
|
+
this.Ei.mr(() => {
|
|
205
|
+
var t;
|
|
206
|
+
this.$o &&
|
|
207
|
+
(null === (t = this.yt) || void 0 === t ? void 0 : t.yi()) &&
|
|
210
208
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
211
|
-
if (!this
|
|
209
|
+
if (!this.$o) return;
|
|
212
210
|
(0, t.default)(void 0, void 0, !0);
|
|
213
211
|
});
|
|
214
212
|
}),
|
|
215
|
-
this.
|
|
216
|
-
(this
|
|
213
|
+
this.Jo.Dt(this.options),
|
|
214
|
+
(this.$o = !0),
|
|
217
215
|
!0
|
|
218
216
|
);
|
|
219
217
|
}
|
|
220
218
|
destroy(t) {
|
|
221
|
-
if ((r.
|
|
222
|
-
this.
|
|
223
|
-
for (const t of this.
|
|
224
|
-
this.
|
|
225
|
-
for (const t of this.
|
|
226
|
-
(this.
|
|
219
|
+
if ((r.destroy(), this.so())) {
|
|
220
|
+
this.Yo.Dt(), this.Yo.removeAllSubscriptions();
|
|
221
|
+
for (const t of this.Ho) t.destroy();
|
|
222
|
+
this.Ho = [];
|
|
223
|
+
for (const t of this.Xo) t.clearData(!1);
|
|
224
|
+
(this.Xo = []),
|
|
227
225
|
this.removeAllSubscriptions(),
|
|
228
|
-
(this.
|
|
229
|
-
null != this.
|
|
230
|
-
(this.
|
|
231
|
-
(this.
|
|
232
|
-
(this.
|
|
233
|
-
(this
|
|
226
|
+
(this._e = []),
|
|
227
|
+
null != this.Ei && this.Ei.destroy(),
|
|
228
|
+
(this.Ei = null),
|
|
229
|
+
(this.Go = null),
|
|
230
|
+
(this.hn = null),
|
|
231
|
+
(this.qt = null),
|
|
234
232
|
(this.yt = null),
|
|
235
|
-
(this.
|
|
233
|
+
(this.di = null),
|
|
236
234
|
(this.wt = null),
|
|
237
235
|
(this.options = {}),
|
|
238
|
-
(this.
|
|
239
|
-
(this
|
|
240
|
-
(this.
|
|
236
|
+
(this.Vo = void 0),
|
|
237
|
+
(this.$o = !1),
|
|
238
|
+
(this.qo = !1),
|
|
241
239
|
t && (this.u = null);
|
|
242
240
|
}
|
|
243
241
|
}
|
|
244
|
-
|
|
245
|
-
return !this
|
|
242
|
+
X() {
|
|
243
|
+
return !this.$h() && (!!this.so() || (console.warn(_), !1));
|
|
246
244
|
}
|
|
247
|
-
|
|
248
|
-
return this.
|
|
245
|
+
ba() {
|
|
246
|
+
return this.an;
|
|
249
247
|
}
|
|
250
248
|
Sr() {
|
|
251
|
-
return this.
|
|
249
|
+
return this.Go;
|
|
252
250
|
}
|
|
253
|
-
|
|
254
|
-
return this.
|
|
251
|
+
Vs() {
|
|
252
|
+
return this.Ko;
|
|
255
253
|
}
|
|
256
254
|
te() {
|
|
257
|
-
return this.
|
|
255
|
+
return this.hn;
|
|
258
256
|
}
|
|
259
|
-
|
|
260
|
-
return this
|
|
257
|
+
nr() {
|
|
258
|
+
return this.qt;
|
|
261
259
|
}
|
|
262
260
|
nn(t) {
|
|
263
261
|
return this.options[t];
|
|
264
262
|
}
|
|
265
263
|
gr() {
|
|
266
|
-
return this.
|
|
264
|
+
return this.Xo;
|
|
267
265
|
}
|
|
268
266
|
cr() {
|
|
269
|
-
return this.
|
|
267
|
+
return this.Ei;
|
|
270
268
|
}
|
|
271
|
-
|
|
269
|
+
ir() {
|
|
272
270
|
return this.yt;
|
|
273
271
|
}
|
|
274
|
-
|
|
275
|
-
return this.
|
|
272
|
+
zr() {
|
|
273
|
+
return this.di;
|
|
276
274
|
}
|
|
277
275
|
l() {
|
|
278
276
|
return this.u;
|
|
279
277
|
}
|
|
280
|
-
|
|
281
|
-
if (this.wt && this.
|
|
278
|
+
pr() {
|
|
279
|
+
if (this.wt && this.Ei) return new User(this.wt, this.Ei);
|
|
282
280
|
}
|
|
283
|
-
|
|
281
|
+
er() {
|
|
284
282
|
return this.wt;
|
|
285
283
|
}
|
|
286
|
-
|
|
287
|
-
return !0 === this.nn(L.
|
|
284
|
+
tr() {
|
|
285
|
+
return !0 === this.nn(L.Mo);
|
|
288
286
|
}
|
|
289
287
|
g(t) {
|
|
290
288
|
let i = !1;
|
|
291
|
-
for (const s of this.
|
|
292
|
-
i || this.
|
|
289
|
+
for (const s of this.Ho) s === t && (i = !0);
|
|
290
|
+
i || this.Ho.push(t);
|
|
293
291
|
}
|
|
294
|
-
|
|
292
|
+
ar(t) {
|
|
295
293
|
let i = !1;
|
|
296
|
-
for (const s of this.
|
|
297
|
-
t instanceof y && !i && this.
|
|
294
|
+
for (const s of this.Xo) s.constructor === t.constructor && (i = !0);
|
|
295
|
+
t instanceof y && !i && this.Xo.push(t);
|
|
298
296
|
}
|
|
299
|
-
|
|
300
|
-
t instanceof
|
|
297
|
+
$t(t) {
|
|
298
|
+
t instanceof T && this._e.push(t);
|
|
301
299
|
}
|
|
302
300
|
removeAllSubscriptions() {
|
|
303
|
-
if (this.
|
|
301
|
+
if (this.X()) for (const t of this._e) t.removeAllSubscriptions();
|
|
304
302
|
}
|
|
305
303
|
removeSubscription(t) {
|
|
306
|
-
if (this.
|
|
304
|
+
if (this.X()) for (const i of this._e) i.removeSubscription(t);
|
|
307
305
|
}
|
|
308
|
-
|
|
309
|
-
this.
|
|
306
|
+
oe(t) {
|
|
307
|
+
this.qo = t;
|
|
310
308
|
}
|
|
311
|
-
|
|
312
|
-
return this
|
|
309
|
+
so() {
|
|
310
|
+
return this.$o;
|
|
313
311
|
}
|
|
314
|
-
|
|
315
|
-
return this.
|
|
312
|
+
$h() {
|
|
313
|
+
return this.qo;
|
|
316
314
|
}
|
|
317
|
-
|
|
318
|
-
return this.
|
|
315
|
+
Ss() {
|
|
316
|
+
return this.Wo;
|
|
319
317
|
}
|
|
320
318
|
}
|
|
321
|
-
const e = new
|
|
322
|
-
export { e as default,
|
|
319
|
+
const e = new zt();
|
|
320
|
+
export { e as default, zt as BrazeSdkInstance, L as OPTIONS };
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import X from "../util/browser-detector.js";
|
|
2
2
|
import xt from "../models/device.js";
|
|
3
3
|
import DeviceProperties from "../Core/device-properties.js";
|
|
4
4
|
import _t from "../models/identifier.js";
|
|
5
|
-
import r from "../../shared-lib/
|
|
6
|
-
import { STORAGE_KEYS as
|
|
5
|
+
import { logger as r, Guid as p } from "../../shared-lib/index.js";
|
|
6
|
+
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
7
7
|
import { values as Pt } from "../util/code-utils.js";
|
|
8
|
-
import { getErrorMessage as
|
|
8
|
+
import { getErrorMessage as si } from "../util/error-utils.js";
|
|
9
9
|
export default class Ot {
|
|
10
10
|
constructor(t, e) {
|
|
11
11
|
(this.u = t),
|
|
12
|
-
(this.
|
|
12
|
+
(this.Ia = e),
|
|
13
13
|
(this.u = t),
|
|
14
14
|
null == e && (e = Pt(DeviceProperties)),
|
|
15
|
-
(this.
|
|
15
|
+
(this.Ia = e);
|
|
16
16
|
}
|
|
17
17
|
ce(t = !0) {
|
|
18
|
-
let e = this.u.tu(
|
|
19
|
-
null == e && ((e = new _t(
|
|
20
|
-
const
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
18
|
+
let e = this.u.tu(o.iu.Ta);
|
|
19
|
+
null == e && ((e = new _t(p.W())), t && this.u.uu(o.iu.Ta, e));
|
|
20
|
+
const r = new xt(e.eu);
|
|
21
|
+
for (let t = 0; t < this.Ia.length; t++) {
|
|
22
|
+
switch (this.Ia[t]) {
|
|
23
23
|
case DeviceProperties.BROWSER:
|
|
24
|
-
|
|
24
|
+
r.browser = X.browser;
|
|
25
25
|
break;
|
|
26
26
|
case DeviceProperties.BROWSER_VERSION:
|
|
27
|
-
|
|
27
|
+
r.Da = X.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
|
|
30
|
+
r.os = this.Oa();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
|
|
33
|
+
r.Ca = screen.width + "x" + screen.height;
|
|
34
34
|
break;
|
|
35
35
|
case DeviceProperties.LANGUAGE:
|
|
36
|
-
|
|
36
|
+
r.language = X.language;
|
|
37
37
|
break;
|
|
38
38
|
case DeviceProperties.TIME_ZONE:
|
|
39
|
-
|
|
39
|
+
r.timeZone = this.Fa(new Date());
|
|
40
40
|
break;
|
|
41
41
|
case DeviceProperties.USER_AGENT:
|
|
42
|
-
|
|
42
|
+
r.userAgent = X.userAgent;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return r;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
const t = this.u.
|
|
50
|
-
return t && t.os_version ? t.os_version :
|
|
47
|
+
Oa() {
|
|
48
|
+
if (X.Ga()) return X.Ga();
|
|
49
|
+
const t = this.u.j(o.C.Ja);
|
|
50
|
+
return t && t.os_version ? t.os_version : X.Oa();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Fa(t) {
|
|
53
53
|
let e = !1;
|
|
54
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
55
55
|
try {
|
|
@@ -58,17 +58,17 @@ export default class Ot {
|
|
|
58
58
|
if (null != t && "" !== t) return t;
|
|
59
59
|
}
|
|
60
60
|
} catch (t) {
|
|
61
|
-
r.
|
|
61
|
+
r.info(
|
|
62
62
|
"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
|
|
63
|
-
|
|
63
|
+
si(t),
|
|
64
64
|
),
|
|
65
65
|
(e = !0);
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
68
|
const s = t.getTimezoneOffset();
|
|
69
|
-
return this.
|
|
69
|
+
return this.Aa(s);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Aa(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|