@braze/web-sdk 6.5.0 → 6.7.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 +258 -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 -25
- 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 -8
- 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/defer-in-app-message.js +1 -1
- 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 +116 -117
- 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 -182
- 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 +194 -175
- 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 +159 -163
- 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,98 +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
|
-
|
|
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",
|
|
49
50
|
tn: "openCardsInNewTab",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
oh: "requireExplicitInAppMessageDismissal",
|
|
52
|
+
Uh: "doNotLoadFontAwesome",
|
|
53
|
+
Wh: "deviceId",
|
|
54
|
+
ya: "serviceWorkerScope",
|
|
55
|
+
Qe: "dustHost",
|
|
56
|
+
Bh: "sdkFlavor",
|
|
56
57
|
};
|
|
57
|
-
class
|
|
58
|
+
class li {
|
|
58
59
|
constructor() {
|
|
59
60
|
(this.tu = ""),
|
|
60
|
-
(this.
|
|
61
|
-
(this.
|
|
62
|
-
(this.
|
|
61
|
+
(this.Vh = ""),
|
|
62
|
+
(this.Kh = void 0),
|
|
63
|
+
(this.Gh = null),
|
|
63
64
|
(this.eu = null),
|
|
64
|
-
(this.
|
|
65
|
+
(this.B = null),
|
|
65
66
|
(this.Ru = null),
|
|
66
67
|
(this.h = null),
|
|
68
|
+
(this.j = null),
|
|
67
69
|
(this.C = null),
|
|
68
|
-
(this.
|
|
69
|
-
(this.
|
|
70
|
-
(this.al = ""),
|
|
70
|
+
(this.Ss = null),
|
|
71
|
+
(this.Yh = ""),
|
|
71
72
|
(this.isInitialized = !1),
|
|
72
|
-
(this
|
|
73
|
-
(this.
|
|
74
|
-
(this.
|
|
73
|
+
(this.$h = !1),
|
|
74
|
+
(this.qh = new f()),
|
|
75
|
+
(this.Hh = new f()),
|
|
75
76
|
(this.options = {}),
|
|
76
|
-
(this.
|
|
77
|
-
(this.
|
|
78
|
-
(this.
|
|
79
|
-
(this.
|
|
77
|
+
(this.Jh = []),
|
|
78
|
+
(this.Xh = []),
|
|
79
|
+
(this.In = []),
|
|
80
|
+
(this.Vh = "6.7.0");
|
|
80
81
|
}
|
|
81
|
-
|
|
82
|
-
this.
|
|
82
|
+
Zh(t) {
|
|
83
|
+
this.qh.Kt(t);
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
-
this.
|
|
85
|
+
uh(t) {
|
|
86
|
+
this.Hh.Kt(t);
|
|
86
87
|
}
|
|
87
88
|
initialize(t, i) {
|
|
89
|
+
var e, r, o;
|
|
88
90
|
if (this.ao())
|
|
89
91
|
return E.info("Braze has already been initialized with an API key."), !0;
|
|
90
92
|
this.options = i || {};
|
|
91
|
-
let
|
|
92
|
-
const
|
|
93
|
+
let n = this.er(U.Rh);
|
|
94
|
+
const h = lt(no.Qh());
|
|
93
95
|
if (
|
|
94
|
-
(
|
|
95
|
-
E.init(
|
|
96
|
+
(h && "true" === h.brazeLogging && (n = !0),
|
|
97
|
+
E.init(n),
|
|
96
98
|
E.info(
|
|
97
99
|
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`,
|
|
98
100
|
),
|
|
@@ -100,113 +102,116 @@ class qt {
|
|
|
100
102
|
)
|
|
101
103
|
return E.error("Braze requires a valid API key to be initialized."), !1;
|
|
102
104
|
this.tu = t;
|
|
103
|
-
let
|
|
104
|
-
if (null ==
|
|
105
|
+
let l = this.er(U.Nh);
|
|
106
|
+
if (null == l || "" === l || "string" != typeof l)
|
|
105
107
|
return E.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
106
|
-
!1 === /^https?:/.test(
|
|
107
|
-
const
|
|
108
|
+
!1 === /^https?:/.test(l) && (l = `https://${l}`);
|
|
109
|
+
const a = l;
|
|
108
110
|
if (
|
|
109
|
-
((
|
|
110
|
-
(
|
|
111
|
-
"/" ===
|
|
112
|
-
(this.
|
|
113
|
-
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))
|
|
114
116
|
)
|
|
115
117
|
return (
|
|
116
118
|
E.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
117
|
-
(this
|
|
119
|
+
(this.$h = !0),
|
|
118
120
|
!1
|
|
119
121
|
);
|
|
120
|
-
const
|
|
122
|
+
const u = this.er(U.Oh) || !1,
|
|
123
|
+
c = this.er(U.se),
|
|
124
|
+
m = Zt.sl();
|
|
121
125
|
if (
|
|
122
|
-
((this.
|
|
126
|
+
((this.C = Zt.rl(t, u, c)),
|
|
127
|
+
u && this.C.hl(t),
|
|
128
|
+
new ne.le(null, !0).wr(s.ce))
|
|
123
129
|
)
|
|
124
130
|
return (
|
|
125
131
|
E.info("Ignoring all activity due to previous opt out"),
|
|
126
|
-
(this
|
|
132
|
+
(this.$h = !0),
|
|
127
133
|
!1
|
|
128
134
|
);
|
|
129
|
-
for (const t of
|
|
130
|
-
-1 ===
|
|
135
|
+
for (const t of D(this.options))
|
|
136
|
+
-1 === Wt(hi).indexOf(t) &&
|
|
131
137
|
E.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
132
|
-
const
|
|
133
|
-
if (null != this.
|
|
134
|
-
const t = this.
|
|
135
|
-
-1 !==
|
|
136
|
-
? (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)
|
|
137
143
|
: E.error("Invalid sdk flavor passed: " + t);
|
|
138
144
|
}
|
|
139
|
-
let
|
|
140
|
-
if (null !=
|
|
141
|
-
if (
|
|
145
|
+
let d = this.er(hi.Th);
|
|
146
|
+
if (null != d)
|
|
147
|
+
if (g(d)) {
|
|
142
148
|
const t = [];
|
|
143
|
-
for (let i = 0; i <
|
|
149
|
+
for (let i = 0; i < d.length; i++)
|
|
144
150
|
ta(
|
|
145
151
|
DeviceProperties,
|
|
146
|
-
|
|
152
|
+
d[i],
|
|
147
153
|
"devicePropertyAllowlist contained an invalid value.",
|
|
148
154
|
"DeviceProperties",
|
|
149
|
-
) && t.push(
|
|
150
|
-
|
|
155
|
+
) && t.push(d[i]);
|
|
156
|
+
d = t;
|
|
151
157
|
} else
|
|
152
158
|
E.error(
|
|
153
159
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
154
160
|
),
|
|
155
|
-
(
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
158
|
-
const t = new _t(
|
|
159
|
-
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);
|
|
160
166
|
}
|
|
161
|
-
(this.eu = new
|
|
162
|
-
(this.h = new
|
|
163
|
-
(this.
|
|
164
|
-
(this.
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
this.
|
|
169
|
-
(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(
|
|
170
175
|
this.eu,
|
|
171
|
-
this.B,
|
|
172
|
-
this.hl,
|
|
173
|
-
this.vs,
|
|
174
176
|
this.C,
|
|
177
|
+
this.Gh,
|
|
178
|
+
this.Ss,
|
|
179
|
+
this.j,
|
|
175
180
|
this.h,
|
|
176
181
|
this.tu,
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
this.
|
|
182
|
+
this.Yh,
|
|
183
|
+
this.Vh,
|
|
184
|
+
this.Kh || "",
|
|
185
|
+
this.er(U.yh),
|
|
186
|
+
this.er(U.Mh),
|
|
182
187
|
)),
|
|
183
|
-
(this.Ru = new
|
|
188
|
+
(this.Ru = new Kt(
|
|
184
189
|
this.tu,
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
190
|
+
this.Yh,
|
|
191
|
+
this.j,
|
|
187
192
|
this.eu,
|
|
188
|
-
this.
|
|
193
|
+
this.Ss,
|
|
189
194
|
this.h,
|
|
190
|
-
this.
|
|
195
|
+
this.C,
|
|
191
196
|
(t) => {
|
|
192
|
-
if (this.ao()) for (const i of this.
|
|
197
|
+
if (this.ao()) for (const i of this.vr()) i.I(t);
|
|
193
198
|
},
|
|
194
|
-
this.
|
|
195
|
-
this.
|
|
199
|
+
this.Gh,
|
|
200
|
+
this.B,
|
|
196
201
|
)),
|
|
197
202
|
this.Ru.initialize(),
|
|
198
|
-
|
|
203
|
+
u || this.C.ll(),
|
|
199
204
|
E.info(
|
|
200
|
-
`Initialized for the Braze backend at "${this.
|
|
201
|
-
|
|
205
|
+
`Initialized for the Braze backend at "${this.er(
|
|
206
|
+
U.Nh,
|
|
202
207
|
)}" with API key "${this.tu}".`,
|
|
203
208
|
),
|
|
204
209
|
rt.t(),
|
|
205
|
-
|
|
206
|
-
this.h.
|
|
210
|
+
Qt(),
|
|
211
|
+
this.h.bo(() => {
|
|
207
212
|
var t;
|
|
208
213
|
this.isInitialized &&
|
|
209
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
214
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.lo()) &&
|
|
210
215
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
211
216
|
if (!this.isInitialized) return;
|
|
212
217
|
(0, t.default)();
|
|
@@ -215,66 +220,76 @@ class qt {
|
|
|
215
220
|
this.Ru.rn(() => {
|
|
216
221
|
var t;
|
|
217
222
|
this.isInitialized &&
|
|
218
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
223
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.lo()) &&
|
|
219
224
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
220
225
|
if (!this.isInitialized) return;
|
|
221
226
|
(0, t.default)(void 0, void 0, !0);
|
|
222
227
|
});
|
|
223
228
|
}),
|
|
224
|
-
this.
|
|
229
|
+
this.qh.A(this.options),
|
|
225
230
|
(this.isInitialized = !0),
|
|
226
|
-
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(),
|
|
227
242
|
!0
|
|
228
243
|
);
|
|
229
244
|
}
|
|
230
245
|
destroy(t) {
|
|
231
246
|
if ((E.destroy(), this.ao())) {
|
|
232
|
-
this.
|
|
233
|
-
for (const t of this.
|
|
234
|
-
this.
|
|
235
|
-
for (const t of this.
|
|
236
|
-
this.
|
|
237
|
-
(this.
|
|
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 = []),
|
|
238
253
|
this.removeAllSubscriptions(),
|
|
239
|
-
(this.
|
|
254
|
+
(this.In = []),
|
|
240
255
|
null != this.Ru && this.Ru.destroy(),
|
|
241
256
|
(this.Ru = null),
|
|
242
|
-
(this.
|
|
257
|
+
(this.Gh = null),
|
|
243
258
|
(this.eu = null),
|
|
244
|
-
(this.
|
|
259
|
+
(this.B = null),
|
|
245
260
|
(this.h = null),
|
|
246
|
-
(this.
|
|
247
|
-
(this.
|
|
261
|
+
(this.j = null),
|
|
262
|
+
(this.Ss = null),
|
|
248
263
|
(this.options = {}),
|
|
249
|
-
(this.
|
|
264
|
+
(this.Kh = void 0),
|
|
250
265
|
(this.isInitialized = !1),
|
|
251
|
-
(this
|
|
252
|
-
t && (this.
|
|
266
|
+
(this.$h = !1),
|
|
267
|
+
t && (this.C = null);
|
|
253
268
|
}
|
|
254
269
|
}
|
|
255
270
|
rr() {
|
|
256
|
-
return !this.
|
|
271
|
+
return !this.cl() && (!!this.ao() || (console.warn(R.ee), !1));
|
|
257
272
|
}
|
|
258
|
-
|
|
273
|
+
za() {
|
|
259
274
|
return this.tu;
|
|
260
275
|
}
|
|
261
|
-
|
|
262
|
-
return this.
|
|
276
|
+
Br() {
|
|
277
|
+
return this.Gh;
|
|
263
278
|
}
|
|
264
|
-
|
|
265
|
-
return this.
|
|
279
|
+
ht() {
|
|
280
|
+
return this.Yh;
|
|
266
281
|
}
|
|
267
282
|
ue() {
|
|
268
283
|
return this.eu;
|
|
269
284
|
}
|
|
270
285
|
m() {
|
|
271
|
-
return this.
|
|
286
|
+
return this.B;
|
|
272
287
|
}
|
|
273
|
-
|
|
288
|
+
er(t) {
|
|
274
289
|
return this.options[t];
|
|
275
290
|
}
|
|
276
|
-
|
|
277
|
-
return this.
|
|
291
|
+
vr() {
|
|
292
|
+
return this.Xh;
|
|
278
293
|
}
|
|
279
294
|
nn() {
|
|
280
295
|
return this.Ru;
|
|
@@ -283,55 +298,55 @@ class qt {
|
|
|
283
298
|
return this.h;
|
|
284
299
|
}
|
|
285
300
|
u() {
|
|
286
|
-
return this.
|
|
301
|
+
return this.j;
|
|
287
302
|
}
|
|
288
303
|
p() {
|
|
289
|
-
return this.
|
|
304
|
+
return this.C;
|
|
290
305
|
}
|
|
291
|
-
|
|
292
|
-
if (this.
|
|
306
|
+
zr() {
|
|
307
|
+
if (this.Ss && this.Ru) return new User(this.Ss, this.Ru);
|
|
293
308
|
}
|
|
294
309
|
ir() {
|
|
295
|
-
return this.
|
|
310
|
+
return this.Ss;
|
|
296
311
|
}
|
|
297
|
-
|
|
298
|
-
return !0 === this.
|
|
312
|
+
ar() {
|
|
313
|
+
return !0 === this.er(U.nr);
|
|
299
314
|
}
|
|
300
315
|
g(t) {
|
|
301
316
|
let i = !1;
|
|
302
|
-
for (const s of this.
|
|
303
|
-
i || this.
|
|
317
|
+
for (const s of this.Jh) s === t && (i = !0);
|
|
318
|
+
i || this.Jh.push(t);
|
|
304
319
|
}
|
|
305
320
|
v(i) {
|
|
306
321
|
let s = !1;
|
|
307
|
-
for (const t of this.
|
|
308
|
-
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);
|
|
309
324
|
}
|
|
310
|
-
|
|
311
|
-
t instanceof
|
|
325
|
+
S(t) {
|
|
326
|
+
t instanceof f && this.In.push(t);
|
|
312
327
|
}
|
|
313
328
|
removeAllSubscriptions() {
|
|
314
|
-
if (this.rr()) for (const t of this.
|
|
329
|
+
if (this.rr()) for (const t of this.In) t.removeAllSubscriptions();
|
|
315
330
|
}
|
|
316
331
|
removeSubscription(t) {
|
|
317
|
-
if (this.rr()) for (const i of this.
|
|
332
|
+
if (this.rr()) for (const i of this.In) i.removeSubscription(t);
|
|
318
333
|
}
|
|
319
|
-
|
|
320
|
-
this
|
|
334
|
+
fe(t) {
|
|
335
|
+
this.$h = t;
|
|
321
336
|
}
|
|
322
337
|
ao() {
|
|
323
338
|
return this.isInitialized;
|
|
324
339
|
}
|
|
325
|
-
|
|
326
|
-
return this
|
|
340
|
+
cl() {
|
|
341
|
+
return this.$h;
|
|
327
342
|
}
|
|
328
|
-
|
|
343
|
+
dr(t, i) {
|
|
329
344
|
if (!this.rr()) return null;
|
|
330
|
-
return
|
|
345
|
+
return sr.o().Ze(t, i);
|
|
331
346
|
}
|
|
332
|
-
|
|
333
|
-
return this.
|
|
347
|
+
zi() {
|
|
348
|
+
return this.Vh;
|
|
334
349
|
}
|
|
335
350
|
}
|
|
336
|
-
const r = new
|
|
337
|
-
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";
|