@braze/web-sdk 6.6.0 → 6.7.1
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 +253 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +21 -20
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +26 -26
- package/src/Banner/banner-factory.js +11 -1
- package/src/Banner/banner-provider.js +244 -120
- package/src/Banner/banner.js +14 -12
- package/src/Banner/display/banner-to-html.js +23 -16
- package/src/Banner/display/detect-banner-impressions.js +13 -13
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +4 -4
- package/src/Banner/log-banner-click.js +4 -4
- package/src/Banner/log-banner-dismissal.js +23 -0
- package/src/Banner/log-banner-impressions.js +7 -7
- package/src/Banner/request-banners-refresh.js +12 -16
- package/src/Banner/subscribe-to-banners-updates.js +6 -6
- package/src/Banner/ui/insert-banner.js +12 -12
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +33 -33
- package/src/Card/constants.js +1 -1
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- 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 +18 -18
- package/src/Card/util/card-factory.js +41 -41
- package/src/ContentCards/content-cards-provider-factory.js +12 -12
- package/src/ContentCards/content-cards-provider.js +151 -151
- package/src/ContentCards/content-cards.js +5 -5
- 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 +6 -6
- package/src/ContentCards/ui/show-content-cards.js +10 -10
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +9 -9
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +8 -8
- package/src/Core/log-purchase.js +5 -5
- package/src/Core/open-session.js +7 -7
- 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 +6 -6
- package/src/DUST/dust-provider-factory.js +11 -11
- package/src/DUST/dust-provider.js +255 -255
- package/src/DUST/dust-shared-worker-impl.js +100 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/InAppMessage/constants.js +83 -2
- package/src/InAppMessage/display/html-message-display-utils.js +15 -15
- package/src/InAppMessage/display/html-message-to-html.js +36 -37
- package/src/InAppMessage/display/in-app-message-to-html.js +44 -44
- package/src/InAppMessage/display/modal-utils.js +10 -14
- package/src/InAppMessage/in-app-message-factory.js +16 -20
- package/src/InAppMessage/in-app-message-manager.js +115 -116
- package/src/InAppMessage/log-in-app-message-button-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +56 -49
- package/src/InAppMessage/models/html-message.js +31 -27
- package/src/InAppMessage/models/in-app-message-button.js +12 -12
- package/src/InAppMessage/models/in-app-message.js +202 -256
- package/src/InAppMessage/models/modal-message.js +55 -49
- package/src/InAppMessage/models/slide-up-message.js +57 -51
- package/src/InAppMessage/models/templated-in-app-message.js +10 -10
- package/src/InAppMessage/shared-types.js +1 -0
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +43 -41
- 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 +9 -9
- package/src/Push/push-manager.js +15 -15
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +60 -59
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -1
- package/src/common/content-cards-display.js +38 -38
- package/src/common/event-logger.js +8 -8
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +197 -186
- package/src/managers/constants.js +1 -0
- package/src/managers/device-manager.js +25 -25
- package/src/managers/network-manager.js +155 -155
- package/src/managers/server-config-manager.js +106 -93
- package/src/managers/session-manager.js +37 -33
- package/src/managers/storage-manager-factory.js +33 -28
- package/src/managers/storage-manager.js +192 -170
- package/src/managers/subscription-manager.js +13 -13
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +13 -13
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +9 -9
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +29 -38
- package/src/request-controller.js +160 -164
- 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 +12 -12
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +8 -8
- package/src/triggers/models/trigger-condition.js +58 -58
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +44 -44
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/component-utils.js +3 -3
- package/src/util/dom-utils.js +2 -2
- package/src/util/html-display-utils.js +11 -11
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +8 -8
- package/src/util/request-header-utils.js +25 -25
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +21 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,99 +1,100 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Gt from "./auth-manager.js";
|
|
2
2
|
import t from "../common/base-provider.js";
|
|
3
3
|
import ro from "../util/browser-detector.js";
|
|
4
|
-
import
|
|
4
|
+
import Pt from "./device-manager.js";
|
|
5
5
|
import DeviceProperties from "../Core/device-properties.js";
|
|
6
6
|
import {
|
|
7
|
-
isArray as
|
|
8
|
-
keys as
|
|
7
|
+
isArray as g,
|
|
8
|
+
keys as D,
|
|
9
9
|
validateValueIsFromEnum as ta,
|
|
10
|
-
values as
|
|
10
|
+
values as Wt,
|
|
11
11
|
} from "../util/code-utils.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
12
|
+
import Vt from "./network-manager.js";
|
|
13
|
+
import Kt from "../request-controller.js";
|
|
14
|
+
import Yt from "./server-config-manager.js";
|
|
15
|
+
import Xt from "./session-manager.js";
|
|
16
|
+
import ne, { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
17
|
+
import Zt from "./storage-manager-factory.js";
|
|
18
|
+
import f from "./subscription-manager.js";
|
|
19
19
|
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
20
|
-
import
|
|
21
|
-
import { subscribeToDust as
|
|
22
|
-
import
|
|
20
|
+
import sr from "../DUST/dust-provider-factory.js";
|
|
21
|
+
import { subscribeToDust as Qt } from "../DUST/subscribe-to-dust.js";
|
|
22
|
+
import Ut from "../User/user-manager.js";
|
|
23
23
|
import { User } from "../User/index.js";
|
|
24
|
-
import { parseQueryStringKeyValues as
|
|
24
|
+
import { parseQueryStringKeyValues as lt } from "../util/url-utils.js";
|
|
25
25
|
import { WindowUtils as no } from "../util/window-utils.js";
|
|
26
|
-
import { CoreStrings as
|
|
27
|
-
import { SupportedOptions as
|
|
26
|
+
import { CoreStrings as R } from "../common/constants.js";
|
|
27
|
+
import { SupportedOptions as hi, logger as E } from "../../shared-lib/index.js";
|
|
28
28
|
import _t from "../models/identifier.js";
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
const U = {
|
|
30
|
+
_h: "allowCrawlerActivity",
|
|
31
|
+
Nh: "baseUrl",
|
|
32
|
+
se: "cookieExpiryInDays",
|
|
33
|
+
Oh: "noCookies",
|
|
34
|
+
Th: "devicePropertyAllowlist",
|
|
35
|
+
ka: "disablePushTokenMaintenance",
|
|
36
|
+
Rh: "enableLogging",
|
|
37
|
+
Ph: "enableSdkAuthentication",
|
|
38
|
+
_a: "manageServiceWorkerExternally",
|
|
39
|
+
Dh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
40
|
+
Lh: "sessionTimeoutInSeconds",
|
|
41
|
+
yh: "appVersion",
|
|
42
|
+
Mh: "appVersionNumber",
|
|
43
|
+
xa: "serviceWorkerLocation",
|
|
44
|
+
Ma: "safariWebsitePushId",
|
|
45
|
+
qa: "localization",
|
|
46
|
+
sr: "contentSecurityNonce",
|
|
47
|
+
nr: "allowUserSuppliedJavascript",
|
|
48
|
+
ja: "inAppMessageZIndex",
|
|
49
|
+
ba: "openInAppMessagesInNewTab",
|
|
50
50
|
tn: "openCardsInNewTab",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
oh: "requireExplicitInAppMessageDismissal",
|
|
52
|
+
Uh: "doNotLoadFontAwesome",
|
|
53
|
+
Wh: "deviceId",
|
|
54
|
+
ya: "serviceWorkerScope",
|
|
55
|
+
Qe: "dustHost",
|
|
56
|
+
Bh: "sdkFlavor",
|
|
57
57
|
};
|
|
58
|
-
class
|
|
58
|
+
class li {
|
|
59
59
|
constructor() {
|
|
60
60
|
(this.tu = ""),
|
|
61
|
-
(this.
|
|
62
|
-
(this.
|
|
63
|
-
(this.
|
|
61
|
+
(this.Vh = ""),
|
|
62
|
+
(this.Kh = void 0),
|
|
63
|
+
(this.Gh = null),
|
|
64
64
|
(this.eu = null),
|
|
65
|
-
(this.
|
|
65
|
+
(this.B = null),
|
|
66
66
|
(this.Ru = null),
|
|
67
67
|
(this.h = null),
|
|
68
|
+
(this.j = null),
|
|
68
69
|
(this.C = null),
|
|
69
|
-
(this.
|
|
70
|
-
(this.
|
|
71
|
-
(this.ul = ""),
|
|
70
|
+
(this.Ss = null),
|
|
71
|
+
(this.Yh = ""),
|
|
72
72
|
(this.isInitialized = !1),
|
|
73
|
-
(this
|
|
74
|
-
(this.
|
|
75
|
-
(this.
|
|
73
|
+
(this.$h = !1),
|
|
74
|
+
(this.qh = new f()),
|
|
75
|
+
(this.Hh = new f()),
|
|
76
76
|
(this.options = {}),
|
|
77
|
-
(this.
|
|
78
|
-
(this.
|
|
79
|
-
(this.
|
|
80
|
-
(this.
|
|
77
|
+
(this.Jh = []),
|
|
78
|
+
(this.Xh = []),
|
|
79
|
+
(this.In = []),
|
|
80
|
+
(this.Vh = "6.7.1");
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
this.
|
|
82
|
+
Zh(t) {
|
|
83
|
+
this.qh.Kt(t);
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
this.
|
|
85
|
+
uh(t) {
|
|
86
|
+
this.Hh.Kt(t);
|
|
87
87
|
}
|
|
88
88
|
initialize(t, i) {
|
|
89
|
+
var e, r, o;
|
|
89
90
|
if (this.ao())
|
|
90
91
|
return E.info("Braze has already been initialized with an API key."), !0;
|
|
91
92
|
this.options = i || {};
|
|
92
|
-
let
|
|
93
|
-
const
|
|
93
|
+
let n = this.er(U.Rh);
|
|
94
|
+
const h = lt(no.Qh());
|
|
94
95
|
if (
|
|
95
|
-
(
|
|
96
|
-
E.init(
|
|
96
|
+
(h && "true" === h.brazeLogging && (n = !0),
|
|
97
|
+
E.init(n),
|
|
97
98
|
E.info(
|
|
98
99
|
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`,
|
|
99
100
|
),
|
|
@@ -101,116 +102,116 @@ class $t {
|
|
|
101
102
|
)
|
|
102
103
|
return E.error("Braze requires a valid API key to be initialized."), !1;
|
|
103
104
|
this.tu = t;
|
|
104
|
-
let
|
|
105
|
-
if (null ==
|
|
105
|
+
let l = this.er(U.Nh);
|
|
106
|
+
if (null == l || "" === l || "string" != typeof l)
|
|
106
107
|
return E.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
107
|
-
!1 === /^https?:/.test(
|
|
108
|
-
const
|
|
108
|
+
!1 === /^https?:/.test(l) && (l = `https://${l}`);
|
|
109
|
+
const a = l;
|
|
109
110
|
if (
|
|
110
|
-
((
|
|
111
|
-
(
|
|
112
|
-
"/" ===
|
|
113
|
-
(this.
|
|
114
|
-
ro.
|
|
111
|
+
((l = document.createElement("a")),
|
|
112
|
+
(l.href = a),
|
|
113
|
+
"/" === l.pathname && (l = `${l}api/v3`),
|
|
114
|
+
(this.Yh = l.toString()),
|
|
115
|
+
ro.il && !this.er(U._h))
|
|
115
116
|
)
|
|
116
117
|
return (
|
|
117
118
|
E.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
118
|
-
(this
|
|
119
|
+
(this.$h = !0),
|
|
119
120
|
!1
|
|
120
121
|
);
|
|
121
|
-
const
|
|
122
|
-
|
|
122
|
+
const u = this.er(U.Oh) || !1,
|
|
123
|
+
c = this.er(U.se),
|
|
124
|
+
m = Zt.sl();
|
|
123
125
|
if (
|
|
124
|
-
((this.
|
|
125
|
-
|
|
126
|
-
new
|
|
126
|
+
((this.C = Zt.rl(t, u, c)),
|
|
127
|
+
u && this.C.hl(t),
|
|
128
|
+
new ne.le(null, !0).wr(s.ce))
|
|
127
129
|
)
|
|
128
130
|
return (
|
|
129
131
|
E.info("Ignoring all activity due to previous opt out"),
|
|
130
|
-
(this
|
|
132
|
+
(this.$h = !0),
|
|
131
133
|
!1
|
|
132
134
|
);
|
|
133
|
-
for (const t of
|
|
134
|
-
-1 ===
|
|
135
|
+
for (const t of D(this.options))
|
|
136
|
+
-1 === Wt(hi).indexOf(t) &&
|
|
135
137
|
E.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
136
|
-
const
|
|
137
|
-
if (null != this.
|
|
138
|
-
const t = this.
|
|
139
|
-
-1 !==
|
|
140
|
-
? (this.
|
|
138
|
+
const p = ["mparticle", "wordpress", "tealium"];
|
|
139
|
+
if (null != this.er(U.Bh)) {
|
|
140
|
+
const t = this.er(U.Bh);
|
|
141
|
+
-1 !== p.indexOf(t)
|
|
142
|
+
? (this.Kh = t)
|
|
141
143
|
: E.error("Invalid sdk flavor passed: " + t);
|
|
142
144
|
}
|
|
143
|
-
let
|
|
144
|
-
if (null !=
|
|
145
|
-
if (
|
|
145
|
+
let d = this.er(hi.Th);
|
|
146
|
+
if (null != d)
|
|
147
|
+
if (g(d)) {
|
|
146
148
|
const t = [];
|
|
147
|
-
for (let i = 0; i <
|
|
149
|
+
for (let i = 0; i < d.length; i++)
|
|
148
150
|
ta(
|
|
149
151
|
DeviceProperties,
|
|
150
|
-
|
|
152
|
+
d[i],
|
|
151
153
|
"devicePropertyAllowlist contained an invalid value.",
|
|
152
154
|
"DeviceProperties",
|
|
153
|
-
) && t.push(
|
|
154
|
-
|
|
155
|
+
) && t.push(d[i]);
|
|
156
|
+
d = t;
|
|
155
157
|
} else
|
|
156
158
|
E.error(
|
|
157
159
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
158
160
|
),
|
|
159
|
-
(
|
|
160
|
-
const
|
|
161
|
-
if (
|
|
162
|
-
const t = new _t(
|
|
163
|
-
this.
|
|
161
|
+
(d = null);
|
|
162
|
+
const I = this.er(U.Wh);
|
|
163
|
+
if (I) {
|
|
164
|
+
const t = new _t(I);
|
|
165
|
+
this.C.Iu(s.Ou.Wh, t);
|
|
164
166
|
}
|
|
165
|
-
(this.eu = new
|
|
166
|
-
(this.h = new
|
|
167
|
-
(this.
|
|
168
|
-
(this.
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
this.
|
|
173
|
-
(this.j = new Mt(
|
|
167
|
+
(this.eu = new Pt(this.C, d)),
|
|
168
|
+
(this.h = new Yt(this.C)),
|
|
169
|
+
(this.Ss = new Ut(this.h, this.C)),
|
|
170
|
+
(this.j = new Xt(this.C, this.Ss, this.h, this.er(U.Lh)));
|
|
171
|
+
const _ = new f();
|
|
172
|
+
(this.Gh = new Gt(this.C, this.er(U.Ph), _)),
|
|
173
|
+
this.S(_),
|
|
174
|
+
(this.B = new Vt(
|
|
174
175
|
this.eu,
|
|
175
|
-
this.B,
|
|
176
|
-
this.al,
|
|
177
|
-
this.vs,
|
|
178
176
|
this.C,
|
|
177
|
+
this.Gh,
|
|
178
|
+
this.Ss,
|
|
179
|
+
this.j,
|
|
179
180
|
this.h,
|
|
180
181
|
this.tu,
|
|
181
|
-
this.
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
184
|
-
this.
|
|
185
|
-
this.
|
|
182
|
+
this.Yh,
|
|
183
|
+
this.Vh,
|
|
184
|
+
this.Kh || "",
|
|
185
|
+
this.er(U.yh),
|
|
186
|
+
this.er(U.Mh),
|
|
186
187
|
)),
|
|
187
|
-
(this.Ru = new
|
|
188
|
+
(this.Ru = new Kt(
|
|
188
189
|
this.tu,
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
190
|
+
this.Yh,
|
|
191
|
+
this.j,
|
|
191
192
|
this.eu,
|
|
192
|
-
this.
|
|
193
|
+
this.Ss,
|
|
193
194
|
this.h,
|
|
194
|
-
this.
|
|
195
|
+
this.C,
|
|
195
196
|
(t) => {
|
|
196
|
-
if (this.ao()) for (const i of this.
|
|
197
|
+
if (this.ao()) for (const i of this.vr()) i.I(t);
|
|
197
198
|
},
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
199
|
+
this.Gh,
|
|
200
|
+
this.B,
|
|
200
201
|
)),
|
|
201
202
|
this.Ru.initialize(),
|
|
202
|
-
|
|
203
|
+
u || this.C.ll(),
|
|
203
204
|
E.info(
|
|
204
|
-
`Initialized for the Braze backend at "${this.
|
|
205
|
-
|
|
205
|
+
`Initialized for the Braze backend at "${this.er(
|
|
206
|
+
U.Nh,
|
|
206
207
|
)}" with API key "${this.tu}".`,
|
|
207
208
|
),
|
|
208
209
|
rt.t(),
|
|
209
|
-
|
|
210
|
-
this.h.
|
|
210
|
+
Qt(),
|
|
211
|
+
this.h.bo(() => {
|
|
211
212
|
var t;
|
|
212
213
|
this.isInitialized &&
|
|
213
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
214
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.lo()) &&
|
|
214
215
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
215
216
|
if (!this.isInitialized) return;
|
|
216
217
|
(0, t.default)();
|
|
@@ -219,66 +220,76 @@ class $t {
|
|
|
219
220
|
this.Ru.rn(() => {
|
|
220
221
|
var t;
|
|
221
222
|
this.isInitialized &&
|
|
222
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
223
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.lo()) &&
|
|
223
224
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
224
225
|
if (!this.isInitialized) return;
|
|
225
226
|
(0, t.default)(void 0, void 0, !0);
|
|
226
227
|
});
|
|
227
228
|
}),
|
|
228
|
-
this.
|
|
229
|
+
this.qh.A(this.options),
|
|
229
230
|
(this.isInitialized = !0),
|
|
230
|
-
window.dispatchEvent(new CustomEvent("braze.initialized"))
|
|
231
|
+
window.dispatchEvent(new CustomEvent("braze.initialized"));
|
|
232
|
+
const S = null === (e = this.j) || void 0 === e ? void 0 : e.al();
|
|
233
|
+
return (
|
|
234
|
+
m ||
|
|
235
|
+
null == S ||
|
|
236
|
+
(null === (r = this.j) || void 0 === r
|
|
237
|
+
? void 0
|
|
238
|
+
: r.ul(new Date().valueOf(), S)) ||
|
|
239
|
+
null === (o = this.Ru) ||
|
|
240
|
+
void 0 === o ||
|
|
241
|
+
o.Sr(),
|
|
231
242
|
!0
|
|
232
243
|
);
|
|
233
244
|
}
|
|
234
245
|
destroy(t) {
|
|
235
246
|
if ((E.destroy(), this.ao())) {
|
|
236
|
-
this.
|
|
237
|
-
for (const t of this.
|
|
238
|
-
this.
|
|
239
|
-
for (const t of this.
|
|
240
|
-
this.
|
|
241
|
-
(this.
|
|
247
|
+
this.Hh.A(), this.Hh.removeAllSubscriptions();
|
|
248
|
+
for (const t of this.Jh) t.destroy();
|
|
249
|
+
this.Jh = [];
|
|
250
|
+
for (const t of this.Xh) t.clearData(!1);
|
|
251
|
+
this.B && this.B.fo(),
|
|
252
|
+
(this.Xh = []),
|
|
242
253
|
this.removeAllSubscriptions(),
|
|
243
|
-
(this.
|
|
254
|
+
(this.In = []),
|
|
244
255
|
null != this.Ru && this.Ru.destroy(),
|
|
245
256
|
(this.Ru = null),
|
|
246
|
-
(this.
|
|
257
|
+
(this.Gh = null),
|
|
247
258
|
(this.eu = null),
|
|
248
|
-
(this.
|
|
259
|
+
(this.B = null),
|
|
249
260
|
(this.h = null),
|
|
250
|
-
(this.
|
|
251
|
-
(this.
|
|
261
|
+
(this.j = null),
|
|
262
|
+
(this.Ss = null),
|
|
252
263
|
(this.options = {}),
|
|
253
|
-
(this.
|
|
264
|
+
(this.Kh = void 0),
|
|
254
265
|
(this.isInitialized = !1),
|
|
255
|
-
(this
|
|
256
|
-
t && (this.
|
|
266
|
+
(this.$h = !1),
|
|
267
|
+
t && (this.C = null);
|
|
257
268
|
}
|
|
258
269
|
}
|
|
259
270
|
rr() {
|
|
260
|
-
return !this.
|
|
271
|
+
return !this.cl() && (!!this.ao() || (console.warn(R.ee), !1));
|
|
261
272
|
}
|
|
262
|
-
|
|
273
|
+
za() {
|
|
263
274
|
return this.tu;
|
|
264
275
|
}
|
|
265
|
-
|
|
266
|
-
return this.
|
|
276
|
+
Br() {
|
|
277
|
+
return this.Gh;
|
|
267
278
|
}
|
|
268
|
-
|
|
269
|
-
return this.
|
|
279
|
+
ht() {
|
|
280
|
+
return this.Yh;
|
|
270
281
|
}
|
|
271
282
|
ue() {
|
|
272
283
|
return this.eu;
|
|
273
284
|
}
|
|
274
285
|
m() {
|
|
275
|
-
return this.
|
|
286
|
+
return this.B;
|
|
276
287
|
}
|
|
277
|
-
|
|
288
|
+
er(t) {
|
|
278
289
|
return this.options[t];
|
|
279
290
|
}
|
|
280
|
-
|
|
281
|
-
return this.
|
|
291
|
+
vr() {
|
|
292
|
+
return this.Xh;
|
|
282
293
|
}
|
|
283
294
|
nn() {
|
|
284
295
|
return this.Ru;
|
|
@@ -287,55 +298,55 @@ class $t {
|
|
|
287
298
|
return this.h;
|
|
288
299
|
}
|
|
289
300
|
u() {
|
|
290
|
-
return this.
|
|
301
|
+
return this.j;
|
|
291
302
|
}
|
|
292
303
|
p() {
|
|
293
|
-
return this.
|
|
304
|
+
return this.C;
|
|
294
305
|
}
|
|
295
|
-
|
|
296
|
-
if (this.
|
|
306
|
+
zr() {
|
|
307
|
+
if (this.Ss && this.Ru) return new User(this.Ss, this.Ru);
|
|
297
308
|
}
|
|
298
309
|
ir() {
|
|
299
|
-
return this.
|
|
310
|
+
return this.Ss;
|
|
300
311
|
}
|
|
301
|
-
|
|
302
|
-
return !0 === this.
|
|
312
|
+
ar() {
|
|
313
|
+
return !0 === this.er(U.nr);
|
|
303
314
|
}
|
|
304
315
|
g(t) {
|
|
305
316
|
let i = !1;
|
|
306
|
-
for (const s of this.
|
|
307
|
-
i || this.
|
|
317
|
+
for (const s of this.Jh) s === t && (i = !0);
|
|
318
|
+
i || this.Jh.push(t);
|
|
308
319
|
}
|
|
309
320
|
v(i) {
|
|
310
321
|
let s = !1;
|
|
311
|
-
for (const t of this.
|
|
312
|
-
i instanceof t && !s && this.
|
|
322
|
+
for (const t of this.Xh) t.constructor === i.constructor && (s = !0);
|
|
323
|
+
i instanceof t && !s && this.Xh.push(i);
|
|
313
324
|
}
|
|
314
|
-
|
|
315
|
-
t instanceof
|
|
325
|
+
S(t) {
|
|
326
|
+
t instanceof f && this.In.push(t);
|
|
316
327
|
}
|
|
317
328
|
removeAllSubscriptions() {
|
|
318
|
-
if (this.rr()) for (const t of this.
|
|
329
|
+
if (this.rr()) for (const t of this.In) t.removeAllSubscriptions();
|
|
319
330
|
}
|
|
320
331
|
removeSubscription(t) {
|
|
321
|
-
if (this.rr()) for (const i of this.
|
|
332
|
+
if (this.rr()) for (const i of this.In) i.removeSubscription(t);
|
|
322
333
|
}
|
|
323
|
-
|
|
324
|
-
this
|
|
334
|
+
fe(t) {
|
|
335
|
+
this.$h = t;
|
|
325
336
|
}
|
|
326
337
|
ao() {
|
|
327
338
|
return this.isInitialized;
|
|
328
339
|
}
|
|
329
|
-
|
|
330
|
-
return this
|
|
340
|
+
cl() {
|
|
341
|
+
return this.$h;
|
|
331
342
|
}
|
|
332
|
-
|
|
343
|
+
dr(t, i) {
|
|
333
344
|
if (!this.rr()) return null;
|
|
334
|
-
return
|
|
345
|
+
return sr.o().Ze(t, i);
|
|
335
346
|
}
|
|
336
|
-
|
|
337
|
-
return this.
|
|
347
|
+
zi() {
|
|
348
|
+
return this.Vh;
|
|
338
349
|
}
|
|
339
350
|
}
|
|
340
|
-
const r = new
|
|
341
|
-
export { r as default,
|
|
351
|
+
const r = new li();
|
|
352
|
+
export { r as default, li as BrazeSdkInstance, U as OPTIONS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const DEFAULT_MINIMUM_SESSION_TIMEOUT_IN_MS = 1e4;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import ro from "../util/browser-detector.js";
|
|
2
|
-
import
|
|
2
|
+
import Se 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 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 Wt } from "../util/code-utils.js";
|
|
8
8
|
import { getErrorMessage as ai } from "../util/error-utils.js";
|
|
9
|
-
export default class
|
|
9
|
+
export default class Pt {
|
|
10
10
|
constructor(t, e) {
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
14
|
-
null == e && (e =
|
|
15
|
-
(this.
|
|
11
|
+
(this.C = t),
|
|
12
|
+
(this.Da = e),
|
|
13
|
+
(this.C = t),
|
|
14
|
+
null == e && (e = Wt(DeviceProperties)),
|
|
15
|
+
(this.Da = e);
|
|
16
16
|
}
|
|
17
17
|
ve(t = !0) {
|
|
18
|
-
let e = this.
|
|
19
|
-
null == e && ((e = new _t(
|
|
20
|
-
const r = new
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
18
|
+
let e = this.C.$u(s.Ou.Wh);
|
|
19
|
+
null == e && ((e = new _t(V.de())), t && this.C.Iu(s.Ou.Wh, e));
|
|
20
|
+
const r = new Se(e.Tu);
|
|
21
|
+
for (let t = 0; t < this.Da.length; t++) {
|
|
22
|
+
switch (this.Da[t]) {
|
|
23
23
|
case DeviceProperties.BROWSER:
|
|
24
24
|
r.browser = ro.browser;
|
|
25
25
|
break;
|
|
26
26
|
case DeviceProperties.BROWSER_VERSION:
|
|
27
|
-
r.
|
|
27
|
+
r.Oa = ro.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.Fa();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.Ga = screen.width + "x" + screen.height;
|
|
34
34
|
break;
|
|
35
35
|
case DeviceProperties.LANGUAGE:
|
|
36
36
|
r.language = ro.language;
|
|
37
37
|
break;
|
|
38
38
|
case DeviceProperties.TIME_ZONE:
|
|
39
|
-
r.timeZone = this.
|
|
39
|
+
r.timeZone = this.Ja(new Date());
|
|
40
40
|
break;
|
|
41
41
|
case DeviceProperties.USER_AGENT:
|
|
42
42
|
r.userAgent = ro.userAgent;
|
|
@@ -44,12 +44,12 @@ export default class Ot {
|
|
|
44
44
|
}
|
|
45
45
|
return r;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
if (ro.
|
|
49
|
-
const t = this.
|
|
50
|
-
return t && t.os_version ? t.os_version : ro.
|
|
47
|
+
Fa() {
|
|
48
|
+
if (ro.Aa()) return ro.Aa();
|
|
49
|
+
const t = this.C.Rt(s.Tt.Ba);
|
|
50
|
+
return t && t.os_version ? t.os_version : ro.Fa();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Ja(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 Ot {
|
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
68
|
const r = t.getTimezoneOffset();
|
|
69
|
-
return this.
|
|
69
|
+
return this.Ha(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Ha(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|