@braze/web-sdk 6.12.0 → 6.13.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 +240 -3
- package/package.json +1 -1
- package/shared-lib/event-types.js +18 -18
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +25 -24
- package/src/ConversationalChat/automatically-manage-chat.js +5 -0
- package/src/ConversationalChat/chat-message-factory.js +25 -0
- package/src/ConversationalChat/chat-message.js +33 -0
- package/src/ConversationalChat/constants.js +1 -0
- package/src/ConversationalChat/conversational-chat-provider-factory.js +26 -0
- package/src/ConversationalChat/conversational-chat-provider.js +372 -0
- package/src/ConversationalChat/display/chat-widget-manager.js +113 -0
- package/src/ConversationalChat/display/chat-widget-to-html.js +58 -0
- package/src/ConversationalChat/get-chat-messages.js +7 -0
- package/src/ConversationalChat/index.js +12 -0
- package/src/ConversationalChat/is-chat-conversation-ended.js +7 -0
- package/src/ConversationalChat/is-chat-turn-errored.js +7 -0
- package/src/ConversationalChat/is-chat-turn-in-progress.js +7 -0
- package/src/ConversationalChat/register-chat-action-handler.js +10 -0
- package/src/ConversationalChat/reset-chat-conversation.js +5 -0
- package/src/ConversationalChat/retrieve-chat-config.js +7 -0
- package/src/ConversationalChat/send-chat-message.js +17 -0
- package/src/ConversationalChat/subscribe-to-chat-action.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-conversation-updated.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-message-received.js +5 -0
- package/src/ConversationalChat/trigger-chat-action.js +11 -0
- package/src/ConversationalChat/types.js +1 -0
- package/src/Core/add-sdk-metadata.js +5 -5
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +6 -6
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +20 -13
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-ecommerce-event.js +4 -4
- package/src/Core/log-purchase.js +14 -14
- package/src/Core/open-session.js +8 -8
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/Core/wipe-data.js +1 -1
- package/src/DUST/dust-config-store.js +35 -35
- package/src/DUST/dust-message-dedup.js +3 -3
- package/src/DUST/dust-provider-factory.js +10 -10
- package/src/DUST/dust-provider.js +234 -234
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +2 -2
- package/src/FeatureFlags/feature-flag.js +4 -4
- package/src/FeatureFlags/feature-flags-provider-factory.js +11 -11
- package/src/FeatureFlags/feature-flags-provider.js +38 -38
- 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 +4 -4
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +13 -13
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +92 -92
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +39 -39
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +102 -102
- package/src/InAppMessage/models/modal-message.js +38 -38
- package/src/InAppMessage/models/slide-up-message.js +34 -34
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +27 -24
- 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 +15 -15
- package/src/Push/push-manager.js +13 -13
- package/src/Push/register-push.js +2 -2
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push-token-on-server.js +3 -3
- package/src/Push/unregister-push.js +3 -3
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +9 -9
- package/src/User/user.js +50 -50
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +22 -22
- package/src/common/event-logger.js +3 -3
- package/src/index.js +2 -9
- package/src/l10n/l10n-manager-factory.js +4 -4
- package/src/l10n/l10n-manager.js +6 -6
- package/src/managers/auth-manager.js +28 -28
- package/src/managers/braze-action-manager.js +14 -0
- package/src/managers/braze-instance.js +159 -151
- package/src/managers/device-manager.js +26 -26
- package/src/managers/network-manager.js +120 -120
- package/src/managers/server-config-manager.js +95 -86
- package/src/managers/session-manager.js +25 -25
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +129 -124
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +8 -8
- package/src/models/push-token.js +6 -6
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +27 -27
- package/src/request-controller.js +117 -117
- package/src/standard-index.js +9 -0
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +31 -31
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +5 -5
- package/src/triggers/models/push-click-data.js +4 -4
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +128 -128
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/chat-widget-css.js +11 -0
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +41 -41
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +8 -8
- package/src/util/ecommerce-event-validation.js +13 -13
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +82 -44
- package/src/util/request-header-utils.js +26 -24
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/validation-utils.js +29 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,66 +1,69 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mi from "./auth-manager.js";
|
|
2
2
|
import t from "../common/base-provider.js";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import He from "./braze-action-manager.js";
|
|
4
|
+
import eo from "../util/browser-detector.js";
|
|
5
|
+
import li from "./device-manager.js";
|
|
5
6
|
import DeviceProperties from "../Core/device-properties.js";
|
|
6
7
|
import {
|
|
7
8
|
isArray as g,
|
|
8
9
|
keys as C,
|
|
9
|
-
validateValueIsFromEnum as
|
|
10
|
-
values as
|
|
10
|
+
validateValueIsFromEnum as ra,
|
|
11
|
+
values as fi,
|
|
11
12
|
} from "../util/code-utils.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import di from "./network-manager.js";
|
|
14
|
+
import pi from "../request-controller.js";
|
|
15
|
+
import Ei from "./server-config-manager.js";
|
|
16
|
+
import Ii from "./session-manager.js";
|
|
16
17
|
import ne, { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
17
|
-
import
|
|
18
|
+
import _i from "./storage-manager-factory.js";
|
|
18
19
|
import f from "./subscription-manager.js";
|
|
19
|
-
import { TriggersProviderFactory as
|
|
20
|
-
import
|
|
21
|
-
import { subscribeToDust as
|
|
22
|
-
import
|
|
20
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
21
|
+
import nt from "../DUST/dust-provider-factory.js";
|
|
22
|
+
import { subscribeToDust as gi } from "../DUST/subscribe-to-dust.js";
|
|
23
|
+
import Nt from "../User/user-manager.js";
|
|
23
24
|
import { User } from "../User/index.js";
|
|
24
|
-
import { parseQueryStringKeyValues as
|
|
25
|
+
import { parseQueryStringKeyValues as kt } from "../util/url-utils.js";
|
|
25
26
|
import { WindowUtils as no } from "../util/window-utils.js";
|
|
26
27
|
import { CoreStrings as R } from "../common/constants.js";
|
|
27
|
-
import { SupportedOptions as
|
|
28
|
-
import
|
|
28
|
+
import { SupportedOptions as Si, logger as b } from "../../shared-lib/index.js";
|
|
29
|
+
import Ut from "../models/identifier.js";
|
|
29
30
|
const U = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
hl: "allowCrawlerActivity",
|
|
32
|
+
cl: "baseUrl",
|
|
33
|
+
xe: "cookieExpiryInDays",
|
|
34
|
+
ml: "noCookies",
|
|
35
|
+
fl: "devicePropertyAllowlist",
|
|
36
|
+
Oa: "disablePushTokenMaintenance",
|
|
37
|
+
El: "enableLogging",
|
|
38
|
+
Il: "enableSdkAuthentication",
|
|
39
|
+
Na: "manageServiceWorkerExternally",
|
|
40
|
+
_l: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
41
|
+
gl: "sessionTimeoutInSeconds",
|
|
42
|
+
Sl: "appVersion",
|
|
43
|
+
Al: "appVersionNumber",
|
|
44
|
+
Ha: "serviceWorkerLocation",
|
|
45
|
+
La: "safariWebsitePushId",
|
|
46
|
+
al: "localization",
|
|
46
47
|
sr: "contentSecurityNonce",
|
|
47
48
|
nr: "allowUserSuppliedJavascript",
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
Ee: "inAppMessageZIndex",
|
|
50
|
+
Te: "conversationalChatZIndex",
|
|
51
|
+
Ja: "openInAppMessagesInNewTab",
|
|
50
52
|
tn: "openCardsInNewTab",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
Zh: "requireExplicitInAppMessageDismissal",
|
|
54
|
+
vl: "doNotLoadFontAwesome",
|
|
55
|
+
Nl: "deviceId",
|
|
56
|
+
Ka: "serviceWorkerScope",
|
|
57
|
+
_e: "dustHost",
|
|
58
|
+
Ol: "sdkFlavor",
|
|
57
59
|
};
|
|
58
|
-
class
|
|
60
|
+
class Ai {
|
|
59
61
|
constructor() {
|
|
60
62
|
(this.eu = ""),
|
|
61
|
-
(this.
|
|
62
|
-
(this.
|
|
63
|
-
(this.
|
|
63
|
+
(this.Tl = ""),
|
|
64
|
+
(this.wl = void 0),
|
|
65
|
+
(this.Cl = null),
|
|
66
|
+
(this.bl = null),
|
|
64
67
|
(this.tu = null),
|
|
65
68
|
(this.B = null),
|
|
66
69
|
(this.Ru = null),
|
|
@@ -68,30 +71,30 @@ class Ei {
|
|
|
68
71
|
(this.C = null),
|
|
69
72
|
(this.j = null),
|
|
70
73
|
(this.Ss = null),
|
|
71
|
-
(this.
|
|
74
|
+
(this.Rl = ""),
|
|
72
75
|
(this.isInitialized = !1),
|
|
73
|
-
(this
|
|
74
|
-
(this.
|
|
75
|
-
(this.
|
|
76
|
+
(this.Pl = !1),
|
|
77
|
+
(this.Dl = new f()),
|
|
78
|
+
(this.Ll = new f()),
|
|
76
79
|
(this.options = {}),
|
|
77
|
-
(this.
|
|
78
|
-
(this.
|
|
79
|
-
(this.
|
|
80
|
-
(this.
|
|
80
|
+
(this.jl = []),
|
|
81
|
+
(this.yl = []),
|
|
82
|
+
(this.So = []),
|
|
83
|
+
(this.Tl = "6.13.0");
|
|
81
84
|
}
|
|
82
|
-
|
|
83
|
-
this.
|
|
85
|
+
Ml(t) {
|
|
86
|
+
this.Dl.Ut(t);
|
|
84
87
|
}
|
|
85
|
-
|
|
86
|
-
this.
|
|
88
|
+
On(t) {
|
|
89
|
+
this.Ll.Ut(t);
|
|
87
90
|
}
|
|
88
91
|
initialize(t, i) {
|
|
89
92
|
var e, r, o;
|
|
90
|
-
if (this.
|
|
93
|
+
if (this.vr())
|
|
91
94
|
return b.info("Braze has already been initialized with an API key."), !0;
|
|
92
95
|
this.options = i || {};
|
|
93
|
-
let n = this.er(U.
|
|
94
|
-
const h =
|
|
96
|
+
let n = this.er(U.El);
|
|
97
|
+
const h = kt(no.Ul());
|
|
95
98
|
if (
|
|
96
99
|
(h && "true" === h.brazeLogging && (n = !0),
|
|
97
100
|
b.init(n),
|
|
@@ -102,52 +105,52 @@ class Ei {
|
|
|
102
105
|
)
|
|
103
106
|
return b.error("Braze requires a valid API key to be initialized."), !1;
|
|
104
107
|
this.eu = t;
|
|
105
|
-
let
|
|
106
|
-
if (null ==
|
|
108
|
+
let a = this.er(U.cl);
|
|
109
|
+
if (null == a || "" === a || "string" != typeof a)
|
|
107
110
|
return b.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
108
|
-
!1 === /^https?:/.test(
|
|
109
|
-
const
|
|
111
|
+
!1 === /^https?:/.test(a) && (a = `https://${a}`);
|
|
112
|
+
const l = a;
|
|
110
113
|
if (
|
|
111
|
-
((
|
|
112
|
-
(
|
|
113
|
-
"/" ===
|
|
114
|
-
(this.
|
|
115
|
-
|
|
114
|
+
((a = document.createElement("a")),
|
|
115
|
+
(a.href = l),
|
|
116
|
+
"/" === a.pathname && (a = `${a}api/v3`),
|
|
117
|
+
(this.Rl = a.toString()),
|
|
118
|
+
eo.kl && !this.er(U.hl))
|
|
116
119
|
)
|
|
117
120
|
return (
|
|
118
121
|
b.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
119
|
-
(this
|
|
122
|
+
(this.Pl = !0),
|
|
120
123
|
!1
|
|
121
124
|
);
|
|
122
|
-
const u = this.er(U.
|
|
123
|
-
c = this.er(U.
|
|
124
|
-
|
|
125
|
+
const u = this.er(U.ml) || !1,
|
|
126
|
+
c = this.er(U.xe),
|
|
127
|
+
m = _i.zl();
|
|
125
128
|
if (
|
|
126
|
-
((this.j =
|
|
127
|
-
u && this.j.
|
|
128
|
-
new ne.
|
|
129
|
+
((this.j = _i.Bl(t, u, c)),
|
|
130
|
+
u && this.j.Vl(t),
|
|
131
|
+
new ne.De(null, !0).wr(s.Se))
|
|
129
132
|
)
|
|
130
133
|
return (
|
|
131
134
|
b.info("Ignoring all activity due to previous opt out"),
|
|
132
|
-
(this
|
|
135
|
+
(this.Pl = !0),
|
|
133
136
|
!1
|
|
134
137
|
);
|
|
135
138
|
for (const t of C(this.options))
|
|
136
|
-
-1 ===
|
|
139
|
+
-1 === fi(Si).indexOf(t) &&
|
|
137
140
|
b.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
138
|
-
const
|
|
139
|
-
if (null != this.er(U.
|
|
140
|
-
const t = this.er(U.
|
|
141
|
-
-1 !==
|
|
142
|
-
? (this.
|
|
141
|
+
const d = ["mparticle", "wordpress", "tealium"];
|
|
142
|
+
if (null != this.er(U.Ol)) {
|
|
143
|
+
const t = this.er(U.Ol);
|
|
144
|
+
-1 !== d.indexOf(t)
|
|
145
|
+
? (this.wl = t)
|
|
143
146
|
: b.error("Invalid sdk flavor passed: " + t);
|
|
144
147
|
}
|
|
145
|
-
let p = this.er(
|
|
148
|
+
let p = this.er(Si.fl);
|
|
146
149
|
if (null != p)
|
|
147
150
|
if (g(p)) {
|
|
148
151
|
const t = [];
|
|
149
152
|
for (let i = 0; i < p.length; i++)
|
|
150
|
-
|
|
153
|
+
ra(
|
|
151
154
|
DeviceProperties,
|
|
152
155
|
p[i],
|
|
153
156
|
"devicePropertyAllowlist contained an invalid value.",
|
|
@@ -159,59 +162,60 @@ class Ei {
|
|
|
159
162
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
160
163
|
),
|
|
161
164
|
(p = null);
|
|
162
|
-
const E = this.er(U.
|
|
165
|
+
const E = this.er(U.Nl);
|
|
163
166
|
if (E) {
|
|
164
|
-
const t = new
|
|
165
|
-
this.j.Ju(s.Ou.
|
|
167
|
+
const t = new Ut(E);
|
|
168
|
+
this.j.Ju(s.Ou.Nl, t);
|
|
166
169
|
}
|
|
167
|
-
(this.tu = new
|
|
168
|
-
(this.
|
|
169
|
-
(this.
|
|
170
|
-
(this.
|
|
170
|
+
(this.tu = new li(this.j, p)),
|
|
171
|
+
(this.bl = new He()),
|
|
172
|
+
(this.h = new Ei(this.j)),
|
|
173
|
+
(this.Ss = new Nt(this.h, this.j)),
|
|
174
|
+
(this.C = new Ii(this.j, this.Ss, this.h, this.er(U.gl)));
|
|
171
175
|
const I = new f();
|
|
172
|
-
(this.
|
|
176
|
+
(this.Cl = new mi(this.j, this.er(U.Il), I)),
|
|
173
177
|
this.S(I),
|
|
174
|
-
(this.B = new
|
|
178
|
+
(this.B = new di(
|
|
175
179
|
this.tu,
|
|
176
180
|
this.j,
|
|
177
|
-
this.
|
|
181
|
+
this.Cl,
|
|
178
182
|
this.Ss,
|
|
179
183
|
this.C,
|
|
180
184
|
this.h,
|
|
181
185
|
this.eu,
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
184
|
-
this.
|
|
185
|
-
this.er(U.
|
|
186
|
-
this.er(U.
|
|
186
|
+
this.Rl,
|
|
187
|
+
this.Tl,
|
|
188
|
+
this.wl || "",
|
|
189
|
+
this.er(U.Sl),
|
|
190
|
+
this.er(U.Al),
|
|
187
191
|
)),
|
|
188
|
-
(this.Ru = new
|
|
192
|
+
(this.Ru = new pi(
|
|
189
193
|
this.eu,
|
|
190
|
-
this.
|
|
194
|
+
this.Rl,
|
|
191
195
|
this.C,
|
|
192
196
|
this.tu,
|
|
193
197
|
this.Ss,
|
|
194
198
|
this.h,
|
|
195
199
|
this.j,
|
|
196
200
|
(t) => {
|
|
197
|
-
if (this.
|
|
201
|
+
if (this.vr()) for (const i of this.$r()) i.q(t);
|
|
198
202
|
},
|
|
199
|
-
this.
|
|
203
|
+
this.Cl,
|
|
200
204
|
this.B,
|
|
201
205
|
)),
|
|
202
206
|
this.Ru.initialize(),
|
|
203
|
-
u || this.j.
|
|
207
|
+
u || this.j.Wl(),
|
|
204
208
|
b.info(
|
|
205
209
|
`Initialized for the Braze backend at "${this.er(
|
|
206
|
-
U.
|
|
210
|
+
U.cl,
|
|
207
211
|
)}" with API key "${this.eu}".`,
|
|
208
212
|
),
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
this.h.
|
|
213
|
+
ft.t(),
|
|
214
|
+
gi(),
|
|
215
|
+
this.h.po(() => {
|
|
212
216
|
var t;
|
|
213
217
|
this.isInitialized &&
|
|
214
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
218
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Qr()) &&
|
|
215
219
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
216
220
|
if (!this.isInitialized) return;
|
|
217
221
|
(0, t.default)();
|
|
@@ -220,70 +224,74 @@ class Ei {
|
|
|
220
224
|
this.Ru.rn(() => {
|
|
221
225
|
var t;
|
|
222
226
|
this.isInitialized &&
|
|
223
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
227
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Qr()) &&
|
|
224
228
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
225
229
|
if (!this.isInitialized) return;
|
|
226
230
|
(0, t.default)(void 0, void 0, !0);
|
|
227
231
|
});
|
|
228
232
|
}),
|
|
229
|
-
this.
|
|
233
|
+
this.Dl.A(this.options),
|
|
230
234
|
(this.isInitialized = !0),
|
|
231
235
|
window.dispatchEvent(new CustomEvent("braze.initialized")),
|
|
232
236
|
this.ar("tgr", () => {
|
|
233
237
|
var t;
|
|
234
|
-
null === (t = this.Ru) || void 0 === t || t.
|
|
238
|
+
null === (t = this.Ru) || void 0 === t || t.Br(void 0, void 0, "dust");
|
|
235
239
|
});
|
|
236
|
-
const _ = null === (e = this.C) || void 0 === e ? void 0 : e.
|
|
240
|
+
const _ = null === (e = this.C) || void 0 === e ? void 0 : e.Kl();
|
|
237
241
|
return (
|
|
238
|
-
|
|
242
|
+
m ||
|
|
239
243
|
null == _ ||
|
|
240
244
|
(null === (r = this.C) || void 0 === r
|
|
241
245
|
? void 0
|
|
242
|
-
: r.
|
|
246
|
+
: r.Fl(new Date().valueOf(), _)) ||
|
|
243
247
|
null === (o = this.Ru) ||
|
|
244
248
|
void 0 === o ||
|
|
245
|
-
o.
|
|
249
|
+
o.Br(),
|
|
246
250
|
!0
|
|
247
251
|
);
|
|
248
252
|
}
|
|
249
253
|
destroy(t) {
|
|
250
|
-
if ((b.destroy(), this.
|
|
251
|
-
this.
|
|
252
|
-
for (const t of this.
|
|
253
|
-
this.
|
|
254
|
-
for (const t of this.
|
|
254
|
+
if ((b.destroy(), this.vr())) {
|
|
255
|
+
this.Ll.A(), this.Ll.removeAllSubscriptions();
|
|
256
|
+
for (const t of this.jl) t.destroy();
|
|
257
|
+
this.jl = [];
|
|
258
|
+
for (const t of this.yl) t.clearData(!1);
|
|
255
259
|
this.B && this.B.fo(),
|
|
256
|
-
(this.
|
|
260
|
+
(this.yl = []),
|
|
257
261
|
this.removeAllSubscriptions(),
|
|
258
|
-
(this.
|
|
262
|
+
(this.So = []),
|
|
259
263
|
null != this.Ru && this.Ru.destroy(),
|
|
260
264
|
(this.Ru = null),
|
|
261
|
-
(this.
|
|
265
|
+
(this.Cl = null),
|
|
266
|
+
(this.bl = null),
|
|
262
267
|
(this.tu = null),
|
|
263
268
|
(this.B = null),
|
|
264
269
|
(this.h = null),
|
|
265
270
|
(this.C = null),
|
|
266
271
|
(this.Ss = null),
|
|
267
272
|
(this.options = {}),
|
|
268
|
-
(this.
|
|
273
|
+
(this.wl = void 0),
|
|
269
274
|
(this.isInitialized = !1),
|
|
270
|
-
(this
|
|
275
|
+
(this.Pl = !1),
|
|
271
276
|
t && (this.j = null);
|
|
272
277
|
}
|
|
273
278
|
}
|
|
274
279
|
rr() {
|
|
275
|
-
return !this.
|
|
280
|
+
return !this.Gl() && (!!this.vr() || (console.warn(R.ee), !1));
|
|
276
281
|
}
|
|
277
|
-
|
|
282
|
+
Fa() {
|
|
278
283
|
return this.eu;
|
|
279
284
|
}
|
|
280
|
-
|
|
281
|
-
return this.
|
|
285
|
+
Gr() {
|
|
286
|
+
return this.Cl;
|
|
282
287
|
}
|
|
283
288
|
ht() {
|
|
284
|
-
return this.
|
|
289
|
+
return this.Rl;
|
|
285
290
|
}
|
|
286
|
-
|
|
291
|
+
br() {
|
|
292
|
+
return this.bl;
|
|
293
|
+
}
|
|
294
|
+
Ie() {
|
|
287
295
|
return this.tu;
|
|
288
296
|
}
|
|
289
297
|
m() {
|
|
@@ -292,8 +300,8 @@ class Ei {
|
|
|
292
300
|
er(t) {
|
|
293
301
|
return this.options[t];
|
|
294
302
|
}
|
|
295
|
-
|
|
296
|
-
return this.
|
|
303
|
+
$r() {
|
|
304
|
+
return this.yl;
|
|
297
305
|
}
|
|
298
306
|
nn() {
|
|
299
307
|
return this.Ru;
|
|
@@ -318,39 +326,39 @@ class Ei {
|
|
|
318
326
|
}
|
|
319
327
|
g(t) {
|
|
320
328
|
let i = !1;
|
|
321
|
-
for (const s of this.
|
|
322
|
-
i || this.
|
|
329
|
+
for (const s of this.jl) s === t && (i = !0);
|
|
330
|
+
i || this.jl.push(t);
|
|
323
331
|
}
|
|
324
332
|
v(i) {
|
|
325
333
|
let s = !1;
|
|
326
|
-
for (const t of this.
|
|
327
|
-
i instanceof t && !s && this.
|
|
334
|
+
for (const t of this.yl) t.constructor === i.constructor && (s = !0);
|
|
335
|
+
i instanceof t && !s && this.yl.push(i);
|
|
328
336
|
}
|
|
329
337
|
S(t) {
|
|
330
|
-
t instanceof f && this.
|
|
338
|
+
t instanceof f && this.So.push(t);
|
|
331
339
|
}
|
|
332
340
|
removeAllSubscriptions() {
|
|
333
|
-
if (this.rr()) for (const t of this.
|
|
341
|
+
if (this.rr()) for (const t of this.So) t.removeAllSubscriptions();
|
|
334
342
|
}
|
|
335
343
|
removeSubscription(t) {
|
|
336
|
-
if (this.rr()) for (const i of this.
|
|
344
|
+
if (this.rr()) for (const i of this.So) i.removeSubscription(t);
|
|
337
345
|
}
|
|
338
|
-
|
|
339
|
-
this
|
|
346
|
+
qe(t) {
|
|
347
|
+
this.Pl = t;
|
|
340
348
|
}
|
|
341
|
-
|
|
349
|
+
vr() {
|
|
342
350
|
return this.isInitialized;
|
|
343
351
|
}
|
|
344
|
-
|
|
345
|
-
return this
|
|
352
|
+
Gl() {
|
|
353
|
+
return this.Pl;
|
|
346
354
|
}
|
|
347
355
|
ar(t, i) {
|
|
348
356
|
if (!this.rr()) return null;
|
|
349
|
-
return
|
|
357
|
+
return nt.o().Mh(t, i);
|
|
350
358
|
}
|
|
351
359
|
qi() {
|
|
352
|
-
return this.
|
|
360
|
+
return this.Tl;
|
|
353
361
|
}
|
|
354
362
|
}
|
|
355
|
-
const r = new
|
|
356
|
-
export { r as default,
|
|
363
|
+
const r = new Ai();
|
|
364
|
+
export { r as default, Ai as BrazeSdkInstance, U as OPTIONS };
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import eo from "../util/browser-detector.js";
|
|
2
2
|
import ke from "../models/device.js";
|
|
3
3
|
import DeviceProperties from "../Core/device-properties.js";
|
|
4
|
-
import
|
|
4
|
+
import Ut from "../models/identifier.js";
|
|
5
5
|
import { logger as b, Guid as V } from "../../shared-lib/index.js";
|
|
6
6
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
7
|
-
import { values as
|
|
7
|
+
import { values as fi } from "../util/code-utils.js";
|
|
8
8
|
import { getErrorMessage as ci } from "../util/error-utils.js";
|
|
9
|
-
export default class
|
|
9
|
+
export default class li {
|
|
10
10
|
constructor(t, e) {
|
|
11
11
|
(this.j = t),
|
|
12
|
-
(this.
|
|
12
|
+
(this.fc = e),
|
|
13
13
|
(this.j = t),
|
|
14
|
-
null == e && (e =
|
|
15
|
-
(this.
|
|
14
|
+
null == e && (e = fi(DeviceProperties)),
|
|
15
|
+
(this.fc = e);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
let e = this.j.$u(s.Ou.
|
|
19
|
-
null == e && ((e = new
|
|
17
|
+
Ye(t = !0) {
|
|
18
|
+
let e = this.j.$u(s.Ou.Nl);
|
|
19
|
+
null == e && ((e = new Ut(V.de())), t && this.j.Ju(s.Ou.Nl, e));
|
|
20
20
|
const r = new ke(e.Iu);
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
21
|
+
for (let t = 0; t < this.fc.length; t++) {
|
|
22
|
+
switch (this.fc[t]) {
|
|
23
23
|
case DeviceProperties.BROWSER:
|
|
24
|
-
r.browser =
|
|
24
|
+
r.browser = eo.browser;
|
|
25
25
|
break;
|
|
26
26
|
case DeviceProperties.BROWSER_VERSION:
|
|
27
|
-
r.
|
|
27
|
+
r.dc = eo.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.jc();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.kc = screen.width + "x" + screen.height;
|
|
34
34
|
break;
|
|
35
35
|
case DeviceProperties.LANGUAGE:
|
|
36
|
-
r.language =
|
|
36
|
+
r.language = eo.language;
|
|
37
37
|
break;
|
|
38
38
|
case DeviceProperties.TIME_ZONE:
|
|
39
|
-
r.timeZone = this.
|
|
39
|
+
r.timeZone = this.wc(new Date());
|
|
40
40
|
break;
|
|
41
41
|
case DeviceProperties.USER_AGENT:
|
|
42
|
-
r.userAgent =
|
|
42
|
+
r.userAgent = eo.userAgent;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
const t = this.j.St(s.It.
|
|
50
|
-
return t && t.os_version ? t.os_version :
|
|
47
|
+
jc() {
|
|
48
|
+
if (eo.Ic()) return eo.Ic();
|
|
49
|
+
const t = this.j.St(s.It.Mc);
|
|
50
|
+
return t && t.os_version ? t.os_version : eo.jc();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
wc(t) {
|
|
53
53
|
let e = !1;
|
|
54
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
55
55
|
try {
|
|
@@ -66,9 +66,9 @@ export default class Wt {
|
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
68
|
const r = t.getTimezoneOffset();
|
|
69
|
-
return this.
|
|
69
|
+
return this.Tc(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Tc(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|