@braze/web-sdk 6.3.1 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +38 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +30 -30
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +60 -60
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +24 -23
- package/src/Banner/banner-provider.js +95 -81
- package/src/Banner/banner.js +9 -9
- package/src/Banner/constants.js +4 -0
- package/src/Banner/display/banner-to-html.js +3 -3
- package/src/Banner/display/destroy-banner-html.js +3 -3
- package/src/Banner/display/detect-banner-impressions.js +16 -16
- package/src/Banner/get-all-banners.js +4 -4
- package/src/Banner/get-banner.js +5 -4
- package/src/Banner/index.js +2 -0
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +6 -6
- package/src/Banner/request-banners-refresh.js +18 -20
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Banner/ui/insert-banner.js +17 -14
- package/src/Card/card-manager-factory.js +6 -6
- package/src/Card/card-manager.js +28 -28
- package/src/Card/constants.js +1 -0
- package/src/Card/display/card-display.js +7 -7
- 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 +3 -3
- package/src/Card/models/card.js +9 -9
- package/src/Card/models/classic-card.js +3 -3
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +3 -3
- package/src/ContentCards/content-cards-provider-factory.js +6 -2
- package/src/ContentCards/content-cards-provider.js +101 -87
- package/src/ContentCards/content-cards.js +4 -4
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +5 -5
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +1 -1
- package/src/Core/disable-sdk.js +5 -5
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +7 -7
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +3 -3
- package/src/DUST/dust-connection-core.js +23 -0
- package/src/DUST/dust-provider-factory.js +22 -0
- package/src/DUST/dust-provider.js +520 -0
- package/src/DUST/dust-shared-worker-code.js +2 -0
- package/src/DUST/dust-shared-worker-impl.js +240 -0
- package/src/DUST/dust-worker-bridge.js +136 -0
- package/src/DUST/index.js +13 -0
- package/src/DUST/subscribe-to-dust.js +24 -0
- package/src/DUST/types.js +1 -0
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +6 -6
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +98 -84
- 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 +7 -7
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/constants.js +4 -0
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +34 -34
- package/src/InAppMessage/display/modal-utils.js +14 -14
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +98 -98
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-impression.js +8 -8
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +21 -21
- package/src/InAppMessage/models/html-message.js +18 -18
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +145 -145
- package/src/InAppMessage/models/modal-message.js +21 -21
- package/src/InAppMessage/models/slide-up-message.js +27 -27
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +18 -0
- package/src/InAppMessage/ui/show-in-app-message.js +36 -36
- 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 +97 -97
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +17 -17
- package/src/User/user-manager.js +24 -24
- package/src/User/user.js +55 -55
- package/src/common/constants.js +8 -10
- package/src/common/content-cards-display.js +40 -40
- package/src/common/event-logger.js +8 -8
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +11 -11
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +30 -30
- package/src/managers/braze-instance.js +170 -162
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +149 -149
- package/src/managers/server-config-manager.js +140 -95
- package/src/managers/session-manager.js +39 -39
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +145 -141
- package/src/managers/subscription-manager.js +11 -11
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +11 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +16 -16
- package/src/models/push-token.js +13 -13
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +45 -37
- package/src/request-controller.js +163 -158
- package/src/triggers/models/custom-event-data.js +5 -5
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +10 -10
- package/src/triggers/models/filter.js +27 -27
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +47 -47
- 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 +63 -63
- 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 +9 -9
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +11 -11
- package/src/util/component-utils.js +5 -5
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +7 -7
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +5 -5
- package/src/util/request-header-utils.js +27 -27
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/validation-utils.js +17 -17
- package/src/util/window-utils.js +3 -3
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
|
-
import
|
|
2
|
+
import m from "./subscription-manager.js";
|
|
3
3
|
import { logger as E, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
4
|
-
export default class
|
|
4
|
+
export default class kt {
|
|
5
5
|
constructor(t, i, s) {
|
|
6
|
-
(this.
|
|
7
|
-
(this.
|
|
8
|
-
(this.
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
15
|
-
}
|
|
16
|
-
fh() {
|
|
17
|
-
return this.Zn;
|
|
6
|
+
(this.B = t),
|
|
7
|
+
(this.gh = i),
|
|
8
|
+
(this.ph = s),
|
|
9
|
+
(this.B = t),
|
|
10
|
+
(this.gh = i || !1),
|
|
11
|
+
(this.ph = s),
|
|
12
|
+
(this.Fh = new m()),
|
|
13
|
+
(this.kh = 0),
|
|
14
|
+
(this.fh = 1);
|
|
18
15
|
}
|
|
19
16
|
wh() {
|
|
20
|
-
return this.
|
|
17
|
+
return this.gh;
|
|
18
|
+
}
|
|
19
|
+
jh() {
|
|
20
|
+
return this.B.dt(s.ft.xh);
|
|
21
21
|
}
|
|
22
22
|
setSdkAuthenticationSignature(t) {
|
|
23
|
-
const i = this.
|
|
24
|
-
this.
|
|
23
|
+
const i = this.jh();
|
|
24
|
+
this.B.bt(s.ft.xh, t);
|
|
25
25
|
const e = et.Us.Rs;
|
|
26
|
-
new et(e, E).setItem(e.Fs.
|
|
26
|
+
new et(e, E).setItem(e.Fs.qh, this.fh, t), i !== t && this.Z();
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
this.
|
|
28
|
+
yh() {
|
|
29
|
+
this.B.zt(s.ft.xh);
|
|
30
30
|
const t = et.Us.Rs;
|
|
31
|
-
new et(t, E).
|
|
31
|
+
new et(t, E).je(t.Fs.qh, this.fh);
|
|
32
32
|
}
|
|
33
33
|
subscribeToSdkAuthenticationFailures(t) {
|
|
34
|
-
return this.
|
|
35
|
-
}
|
|
36
|
-
yh(t) {
|
|
37
|
-
this.gh.L(t);
|
|
34
|
+
return this.ph.Rt(t);
|
|
38
35
|
}
|
|
39
|
-
Bh() {
|
|
40
|
-
this.ph.
|
|
36
|
+
Bh(t) {
|
|
37
|
+
this.ph.L(t);
|
|
41
38
|
}
|
|
42
39
|
Gh() {
|
|
43
|
-
this.Fh
|
|
40
|
+
this.Fh.removeAllSubscriptions();
|
|
44
41
|
}
|
|
45
42
|
Hh() {
|
|
46
|
-
|
|
43
|
+
this.kh += 1;
|
|
44
|
+
}
|
|
45
|
+
Jh() {
|
|
46
|
+
return this.kh;
|
|
47
47
|
}
|
|
48
48
|
Z() {
|
|
49
|
-
this.
|
|
49
|
+
this.kh = 0;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -1,92 +1,95 @@
|
|
|
1
|
-
import
|
|
1
|
+
import kt from "./auth-manager.js";
|
|
2
2
|
import t from "../common/base-provider.js";
|
|
3
3
|
import ro from "../util/browser-detector.js";
|
|
4
4
|
import Ot from "./device-manager.js";
|
|
5
5
|
import DeviceProperties from "../Core/device-properties.js";
|
|
6
6
|
import {
|
|
7
|
-
isArray as
|
|
7
|
+
isArray as R,
|
|
8
8
|
keys as C,
|
|
9
9
|
validateValueIsFromEnum as ta,
|
|
10
10
|
values as Pt,
|
|
11
11
|
} from "../util/code-utils.js";
|
|
12
12
|
import Mt from "./network-manager.js";
|
|
13
13
|
import Wt from "../request-controller.js";
|
|
14
|
-
import
|
|
15
|
-
import
|
|
14
|
+
import Bt from "./server-config-manager.js";
|
|
15
|
+
import Vt from "./session-manager.js";
|
|
16
16
|
import ee, { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
17
|
-
import
|
|
18
|
-
import
|
|
17
|
+
import Kt from "./storage-manager-factory.js";
|
|
18
|
+
import m from "./subscription-manager.js";
|
|
19
19
|
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
20
|
+
import nr from "../DUST/dust-provider-factory.js";
|
|
21
|
+
import { subscribeToDust as Gt } from "../DUST/subscribe-to-dust.js";
|
|
20
22
|
import bt from "../User/user-manager.js";
|
|
21
23
|
import { User } from "../User/index.js";
|
|
22
24
|
import { parseQueryStringKeyValues as ll } from "../util/url-utils.js";
|
|
23
25
|
import { WindowUtils as no } from "../util/window-utils.js";
|
|
24
|
-
import {
|
|
26
|
+
import { CoreStrings as z } from "../common/constants.js";
|
|
25
27
|
import { SupportedOptions as $t, logger as E } from "../../shared-lib/index.js";
|
|
26
28
|
import _t from "../models/identifier.js";
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
29
|
+
const D = {
|
|
30
|
+
Ph: "allowCrawlerActivity",
|
|
31
|
+
Wh: "baseUrl",
|
|
32
|
+
Vh: "noCookies",
|
|
33
|
+
Kh: "devicePropertyAllowlist",
|
|
34
|
+
La: "disablePushTokenMaintenance",
|
|
35
|
+
$h: "enableLogging",
|
|
36
|
+
Yh: "enableSdkAuthentication",
|
|
37
|
+
Ka: "manageServiceWorkerExternally",
|
|
38
|
+
Xh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
39
|
+
Zh: "sessionTimeoutInSeconds",
|
|
40
|
+
Qh: "appVersion",
|
|
41
|
+
Xa: "appVersionNumber",
|
|
42
|
+
Ga: "serviceWorkerLocation",
|
|
43
|
+
Ia: "safariWebsitePushId",
|
|
44
|
+
Wa: "localization",
|
|
43
45
|
er: "contentSecurityNonce",
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
te: "allowUserSuppliedJavascript",
|
|
47
|
+
$a: "inAppMessageZIndex",
|
|
48
|
+
Ja: "openInAppMessagesInNewTab",
|
|
47
49
|
tn: "openCardsInNewTab",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
Oh: "requireExplicitInAppMessageDismissal",
|
|
51
|
+
Za: "doNotLoadFontAwesome",
|
|
52
|
+
tl: "deviceId",
|
|
53
|
+
Ha: "serviceWorkerScope",
|
|
54
|
+
Ne: "dustHost",
|
|
55
|
+
il: "sdkFlavor",
|
|
53
56
|
};
|
|
54
|
-
class
|
|
57
|
+
class qt {
|
|
55
58
|
constructor() {
|
|
56
|
-
(this.
|
|
57
|
-
(this.
|
|
58
|
-
(this.
|
|
59
|
-
(this.
|
|
60
|
-
(this.
|
|
61
|
-
(this.
|
|
62
|
-
(this.
|
|
59
|
+
(this.tu = ""),
|
|
60
|
+
(this.sl = ""),
|
|
61
|
+
(this.rl = void 0),
|
|
62
|
+
(this.hl = null),
|
|
63
|
+
(this.eu = null),
|
|
64
|
+
(this.j = null),
|
|
65
|
+
(this.Ru = null),
|
|
63
66
|
(this.h = null),
|
|
64
67
|
(this.C = null),
|
|
65
|
-
(this.
|
|
66
|
-
(this.
|
|
67
|
-
(this.
|
|
68
|
+
(this.B = null),
|
|
69
|
+
(this.vs = null),
|
|
70
|
+
(this.al = ""),
|
|
68
71
|
(this.isInitialized = !1),
|
|
69
|
-
(this.
|
|
70
|
-
(this.
|
|
71
|
-
(this.
|
|
72
|
+
(this.ul = !1),
|
|
73
|
+
(this.cl = new m()),
|
|
74
|
+
(this.fl = new m()),
|
|
72
75
|
(this.options = {}),
|
|
73
|
-
(this.
|
|
74
|
-
(this.
|
|
75
|
-
(this.
|
|
76
|
-
(this.
|
|
76
|
+
(this.ml = []),
|
|
77
|
+
(this.dl = []),
|
|
78
|
+
(this.jn = []),
|
|
79
|
+
(this.sl = "6.5.0");
|
|
77
80
|
}
|
|
78
|
-
|
|
79
|
-
this.
|
|
81
|
+
El(t) {
|
|
82
|
+
this.cl.Rt(t);
|
|
80
83
|
}
|
|
81
84
|
mh(t) {
|
|
82
|
-
this.
|
|
85
|
+
this.fl.Rt(t);
|
|
83
86
|
}
|
|
84
87
|
initialize(t, i) {
|
|
85
88
|
if (this.ao())
|
|
86
89
|
return E.info("Braze has already been initialized with an API key."), !0;
|
|
87
90
|
this.options = i || {};
|
|
88
|
-
let e = this.
|
|
89
|
-
const r = ll(no.
|
|
91
|
+
let e = this.re(D.$h);
|
|
92
|
+
const r = ll(no.gl());
|
|
90
93
|
if (
|
|
91
94
|
(r && "true" === r.brazeLogging && (e = !0),
|
|
92
95
|
E.init(e),
|
|
@@ -96,46 +99,46 @@ class Jt {
|
|
|
96
99
|
null == t || "" === t || "string" != typeof t)
|
|
97
100
|
)
|
|
98
101
|
return E.error("Braze requires a valid API key to be initialized."), !1;
|
|
99
|
-
this.
|
|
100
|
-
let
|
|
101
|
-
if (null ==
|
|
102
|
+
this.tu = t;
|
|
103
|
+
let o = this.re(D.Wh);
|
|
104
|
+
if (null == o || "" === o || "string" != typeof o)
|
|
102
105
|
return E.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
103
|
-
!1 === /^https?:/.test(
|
|
104
|
-
const
|
|
106
|
+
!1 === /^https?:/.test(o) && (o = `https://${o}`);
|
|
107
|
+
const n = o;
|
|
105
108
|
if (
|
|
106
|
-
((
|
|
107
|
-
(
|
|
108
|
-
"/" ===
|
|
109
|
-
(this.
|
|
110
|
-
ro.
|
|
109
|
+
((o = document.createElement("a")),
|
|
110
|
+
(o.href = n),
|
|
111
|
+
"/" === o.pathname && (o = `${o}api/v3`),
|
|
112
|
+
(this.al = o.toString()),
|
|
113
|
+
ro.Il && !this.re(D.Ph))
|
|
111
114
|
)
|
|
112
115
|
return (
|
|
113
116
|
E.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
114
|
-
(this.
|
|
117
|
+
(this.ul = !0),
|
|
115
118
|
!1
|
|
116
119
|
);
|
|
117
|
-
const h = this.
|
|
120
|
+
const h = this.re(D.Vh) || !1;
|
|
118
121
|
if (
|
|
119
|
-
((this.
|
|
122
|
+
((this.B = Kt._l(t, h)), h && this.B.Sl(t), new ee.le(null, !0).jr(s.pe))
|
|
120
123
|
)
|
|
121
124
|
return (
|
|
122
125
|
E.info("Ignoring all activity due to previous opt out"),
|
|
123
|
-
(this.
|
|
126
|
+
(this.ul = !0),
|
|
124
127
|
!1
|
|
125
128
|
);
|
|
126
129
|
for (const t of C(this.options))
|
|
127
130
|
-1 === Pt($t).indexOf(t) &&
|
|
128
131
|
E.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
129
132
|
const a = ["mparticle", "wordpress", "tealium"];
|
|
130
|
-
if (null != this.
|
|
131
|
-
const t = this.
|
|
133
|
+
if (null != this.re(D.il)) {
|
|
134
|
+
const t = this.re(D.il);
|
|
132
135
|
-1 !== a.indexOf(t)
|
|
133
|
-
? (this.
|
|
136
|
+
? (this.rl = t)
|
|
134
137
|
: E.error("Invalid sdk flavor passed: " + t);
|
|
135
138
|
}
|
|
136
|
-
let l = this.
|
|
139
|
+
let l = this.re($t.Kh);
|
|
137
140
|
if (null != l)
|
|
138
|
-
if (
|
|
141
|
+
if (R(l)) {
|
|
139
142
|
const t = [];
|
|
140
143
|
for (let i = 0; i < l.length; i++)
|
|
141
144
|
ta(
|
|
@@ -150,74 +153,75 @@ class Jt {
|
|
|
150
153
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
151
154
|
),
|
|
152
155
|
(l = null);
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
const t = new _t(
|
|
156
|
-
this.
|
|
156
|
+
const u = this.re(D.tl);
|
|
157
|
+
if (u) {
|
|
158
|
+
const t = new _t(u);
|
|
159
|
+
this.B.Iu(s.Ou.tl, t);
|
|
157
160
|
}
|
|
158
|
-
(this.
|
|
159
|
-
(this.h = new
|
|
160
|
-
(this.
|
|
161
|
-
(this.C = new
|
|
162
|
-
const
|
|
161
|
+
(this.eu = new Ot(this.B, l)),
|
|
162
|
+
(this.h = new Bt(this.B)),
|
|
163
|
+
(this.vs = new bt(this.h, this.B)),
|
|
164
|
+
(this.C = new Vt(this.B, this.vs, this.h, this.re(D.Zh)));
|
|
165
|
+
const c = new m();
|
|
163
166
|
return (
|
|
164
|
-
(this.
|
|
165
|
-
this.q(
|
|
166
|
-
(this.
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
169
|
-
this.
|
|
170
|
-
this.
|
|
167
|
+
(this.hl = new kt(this.B, this.re(D.Yh), c)),
|
|
168
|
+
this.q(c),
|
|
169
|
+
(this.j = new Mt(
|
|
170
|
+
this.eu,
|
|
171
|
+
this.B,
|
|
172
|
+
this.hl,
|
|
173
|
+
this.vs,
|
|
171
174
|
this.C,
|
|
172
175
|
this.h,
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
178
|
-
this.
|
|
176
|
+
this.tu,
|
|
177
|
+
this.al,
|
|
178
|
+
this.sl,
|
|
179
|
+
this.rl || "",
|
|
180
|
+
this.re(D.Qh),
|
|
181
|
+
this.re(D.Xa),
|
|
179
182
|
)),
|
|
180
|
-
(this.
|
|
181
|
-
this.
|
|
182
|
-
this.
|
|
183
|
+
(this.Ru = new Wt(
|
|
184
|
+
this.tu,
|
|
185
|
+
this.al,
|
|
183
186
|
this.C,
|
|
184
|
-
this.
|
|
185
|
-
this.
|
|
187
|
+
this.eu,
|
|
188
|
+
this.vs,
|
|
186
189
|
this.h,
|
|
187
|
-
this.
|
|
190
|
+
this.B,
|
|
188
191
|
(t) => {
|
|
189
|
-
if (this.ao()) for (const i of this.
|
|
192
|
+
if (this.ao()) for (const i of this.gr()) i.N(t);
|
|
190
193
|
},
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
194
|
+
this.hl,
|
|
195
|
+
this.j,
|
|
193
196
|
)),
|
|
194
|
-
this.
|
|
195
|
-
h || this.
|
|
197
|
+
this.Ru.initialize(),
|
|
198
|
+
h || this.B.Al(),
|
|
196
199
|
E.info(
|
|
197
|
-
`Initialized for the Braze backend at "${this.
|
|
198
|
-
|
|
199
|
-
)}" with API key "${this.
|
|
200
|
+
`Initialized for the Braze backend at "${this.re(
|
|
201
|
+
D.Wh,
|
|
202
|
+
)}" with API key "${this.tu}".`,
|
|
200
203
|
),
|
|
201
204
|
rt.t(),
|
|
202
|
-
|
|
205
|
+
Gt(),
|
|
206
|
+
this.h.jo(() => {
|
|
203
207
|
var t;
|
|
204
208
|
this.isInitialized &&
|
|
205
|
-
(null === (t = this.h) || void 0 === t ? void 0 : t.
|
|
209
|
+
(null === (t = this.h) || void 0 === t ? void 0 : t.Yr()) &&
|
|
206
210
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
207
211
|
if (!this.isInitialized) return;
|
|
208
212
|
(0, t.default)();
|
|
209
213
|
});
|
|
210
214
|
}),
|
|
211
|
-
this.
|
|
215
|
+
this.Ru.rn(() => {
|
|
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.Yr()) &&
|
|
215
219
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
216
220
|
if (!this.isInitialized) return;
|
|
217
221
|
(0, t.default)(void 0, void 0, !0);
|
|
218
222
|
});
|
|
219
223
|
}),
|
|
220
|
-
this.
|
|
224
|
+
this.cl.L(this.options),
|
|
221
225
|
(this.isInitialized = !0),
|
|
222
226
|
window.dispatchEvent(new CustomEvent("braze.initialized")),
|
|
223
227
|
!0
|
|
@@ -225,55 +229,55 @@ class Jt {
|
|
|
225
229
|
}
|
|
226
230
|
destroy(t) {
|
|
227
231
|
if ((E.destroy(), this.ao())) {
|
|
228
|
-
this.
|
|
229
|
-
for (const t of this.
|
|
230
|
-
this.
|
|
231
|
-
for (const t of this.
|
|
232
|
-
this.
|
|
233
|
-
(this.
|
|
232
|
+
this.fl.L(), this.fl.removeAllSubscriptions();
|
|
233
|
+
for (const t of this.ml) t.destroy();
|
|
234
|
+
this.ml = [];
|
|
235
|
+
for (const t of this.dl) t.clearData(!1);
|
|
236
|
+
this.j && this.j.fo(),
|
|
237
|
+
(this.dl = []),
|
|
234
238
|
this.removeAllSubscriptions(),
|
|
235
|
-
(this.
|
|
236
|
-
null != this.
|
|
237
|
-
(this.
|
|
238
|
-
(this.
|
|
239
|
-
(this.
|
|
240
|
-
(this.
|
|
239
|
+
(this.jn = []),
|
|
240
|
+
null != this.Ru && this.Ru.destroy(),
|
|
241
|
+
(this.Ru = null),
|
|
242
|
+
(this.hl = null),
|
|
243
|
+
(this.eu = null),
|
|
244
|
+
(this.j = null),
|
|
241
245
|
(this.h = null),
|
|
242
246
|
(this.C = null),
|
|
243
|
-
(this.
|
|
247
|
+
(this.vs = null),
|
|
244
248
|
(this.options = {}),
|
|
245
|
-
(this.
|
|
249
|
+
(this.rl = void 0),
|
|
246
250
|
(this.isInitialized = !1),
|
|
247
|
-
(this.
|
|
248
|
-
t && (this.
|
|
251
|
+
(this.ul = !1),
|
|
252
|
+
t && (this.B = null);
|
|
249
253
|
}
|
|
250
254
|
}
|
|
251
255
|
rr() {
|
|
252
|
-
return !this.
|
|
256
|
+
return !this.Nl() && (!!this.ao() || (console.warn(z.ee), !1));
|
|
253
257
|
}
|
|
254
|
-
|
|
255
|
-
return this.
|
|
258
|
+
_a() {
|
|
259
|
+
return this.tu;
|
|
256
260
|
}
|
|
257
261
|
Sr() {
|
|
258
|
-
return this.
|
|
262
|
+
return this.hl;
|
|
259
263
|
}
|
|
260
264
|
V() {
|
|
261
|
-
return this.
|
|
265
|
+
return this.al;
|
|
262
266
|
}
|
|
263
|
-
|
|
264
|
-
return this.
|
|
267
|
+
ue() {
|
|
268
|
+
return this.eu;
|
|
265
269
|
}
|
|
266
270
|
m() {
|
|
267
|
-
return this.
|
|
271
|
+
return this.j;
|
|
268
272
|
}
|
|
269
|
-
|
|
273
|
+
re(t) {
|
|
270
274
|
return this.options[t];
|
|
271
275
|
}
|
|
272
|
-
|
|
273
|
-
return this.
|
|
276
|
+
gr() {
|
|
277
|
+
return this.dl;
|
|
274
278
|
}
|
|
275
279
|
nn() {
|
|
276
|
-
return this.
|
|
280
|
+
return this.Ru;
|
|
277
281
|
}
|
|
278
282
|
l() {
|
|
279
283
|
return this.h;
|
|
@@ -282,48 +286,52 @@ class Jt {
|
|
|
282
286
|
return this.C;
|
|
283
287
|
}
|
|
284
288
|
p() {
|
|
285
|
-
return this.
|
|
289
|
+
return this.B;
|
|
286
290
|
}
|
|
287
|
-
|
|
288
|
-
if (this.
|
|
291
|
+
br() {
|
|
292
|
+
if (this.vs && this.Ru) return new User(this.vs, this.Ru);
|
|
289
293
|
}
|
|
290
294
|
ir() {
|
|
291
|
-
return this.
|
|
295
|
+
return this.vs;
|
|
292
296
|
}
|
|
293
|
-
|
|
294
|
-
return !0 === this.
|
|
297
|
+
nr() {
|
|
298
|
+
return !0 === this.re(D.te);
|
|
295
299
|
}
|
|
296
300
|
g(t) {
|
|
297
301
|
let i = !1;
|
|
298
|
-
for (const s of this.
|
|
299
|
-
i || this.
|
|
302
|
+
for (const s of this.ml) s === t && (i = !0);
|
|
303
|
+
i || this.ml.push(t);
|
|
300
304
|
}
|
|
301
305
|
v(i) {
|
|
302
306
|
let s = !1;
|
|
303
|
-
for (const t of this.
|
|
304
|
-
i instanceof t && !s && this.
|
|
307
|
+
for (const t of this.dl) t.constructor === i.constructor && (s = !0);
|
|
308
|
+
i instanceof t && !s && this.dl.push(i);
|
|
305
309
|
}
|
|
306
310
|
q(t) {
|
|
307
|
-
t instanceof
|
|
311
|
+
t instanceof m && this.jn.push(t);
|
|
308
312
|
}
|
|
309
313
|
removeAllSubscriptions() {
|
|
310
|
-
if (this.rr()) for (const t of this.
|
|
314
|
+
if (this.rr()) for (const t of this.jn) t.removeAllSubscriptions();
|
|
311
315
|
}
|
|
312
316
|
removeSubscription(t) {
|
|
313
|
-
if (this.rr()) for (const i of this.
|
|
317
|
+
if (this.rr()) for (const i of this.jn) i.removeSubscription(t);
|
|
314
318
|
}
|
|
315
|
-
|
|
316
|
-
this.
|
|
319
|
+
ge(t) {
|
|
320
|
+
this.ul = t;
|
|
317
321
|
}
|
|
318
322
|
ao() {
|
|
319
323
|
return this.isInitialized;
|
|
320
324
|
}
|
|
321
|
-
|
|
322
|
-
return this.
|
|
325
|
+
Nl() {
|
|
326
|
+
return this.ul;
|
|
327
|
+
}
|
|
328
|
+
tr(t, i) {
|
|
329
|
+
if (!this.rr()) return null;
|
|
330
|
+
return nr.o().Be(t, i);
|
|
323
331
|
}
|
|
324
332
|
Vs() {
|
|
325
|
-
return this.
|
|
333
|
+
return this.sl;
|
|
326
334
|
}
|
|
327
335
|
}
|
|
328
|
-
const r = new
|
|
329
|
-
export { r as default,
|
|
336
|
+
const r = new qt();
|
|
337
|
+
export { r as default, qt as BrazeSdkInstance, D as OPTIONS };
|
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import ro from "../util/browser-detector.js";
|
|
2
|
-
import
|
|
2
|
+
import Jt from "../models/device.js";
|
|
3
3
|
import DeviceProperties from "../Core/device-properties.js";
|
|
4
4
|
import _t from "../models/identifier.js";
|
|
5
5
|
import { logger as E, Guid as P } from "../../shared-lib/index.js";
|
|
6
6
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
7
7
|
import { values as Pt } from "../util/code-utils.js";
|
|
8
|
-
import { getErrorMessage as
|
|
8
|
+
import { getErrorMessage as ai } from "../util/error-utils.js";
|
|
9
9
|
export default class Ot {
|
|
10
10
|
constructor(t, e) {
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
11
|
+
(this.B = t),
|
|
12
|
+
(this.tc = e),
|
|
13
|
+
(this.B = t),
|
|
14
14
|
null == e && (e = Pt(DeviceProperties)),
|
|
15
|
-
(this.
|
|
15
|
+
(this.tc = e);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
let e = this.
|
|
19
|
-
null == e && ((e = new _t(P.
|
|
20
|
-
const r = new
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
17
|
+
ve(t = !0) {
|
|
18
|
+
let e = this.B.$u(s.Ou.tl);
|
|
19
|
+
null == e && ((e = new _t(P.se())), t && this.B.Iu(s.Ou.tl, e));
|
|
20
|
+
const r = new Jt(e.Tu);
|
|
21
|
+
for (let t = 0; t < this.tc.length; t++) {
|
|
22
|
+
switch (this.tc[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.ec = ro.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
r.os = this.
|
|
30
|
+
r.os = this.rc();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
r.
|
|
33
|
+
r.sc = 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.oc(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
|
+
rc() {
|
|
48
|
+
if (ro.nc()) return ro.nc();
|
|
49
|
+
const t = this.B.dt(s.ft.ac);
|
|
50
|
+
return t && t.os_version ? t.os_version : ro.rc();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
oc(t) {
|
|
53
53
|
let e = !1;
|
|
54
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
55
55
|
try {
|
|
@@ -60,15 +60,15 @@ export default class Ot {
|
|
|
60
60
|
} catch (t) {
|
|
61
61
|
E.info(
|
|
62
62
|
"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
|
|
63
|
-
|
|
63
|
+
ai(t),
|
|
64
64
|
),
|
|
65
65
|
(e = !0);
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
68
|
const r = t.getTimezoneOffset();
|
|
69
|
-
return this.
|
|
69
|
+
return this.cc(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
cc(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|