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