@braze/web-sdk 5.5.0 → 5.6.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 +109 -7
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +33 -31
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +20 -20
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +24 -24
- package/src/Banner/banner-factory.js +14 -0
- package/src/Banner/banner-provider-factory.js +19 -0
- package/src/Banner/banner-provider.js +198 -0
- package/src/Banner/banner.js +30 -0
- package/src/Banner/display/banner-to-html.js +57 -0
- package/src/Banner/display/destroy-banner-html.js +7 -0
- package/src/Banner/display/detect-banner-impressions.js +28 -0
- package/src/Banner/get-all-banners.js +13 -0
- package/src/Banner/get-banner.js +19 -0
- package/src/Banner/index.js +7 -0
- package/src/Banner/log-banner-click.js +22 -0
- package/src/Banner/log-banner-impressions.js +31 -0
- package/src/Banner/request-banners-refresh.js +35 -0
- package/src/Banner/subscribe-to-banners-updates.js +23 -0
- package/src/Banner/types.js +1 -0
- package/src/Banner/ui/insert-banner.js +24 -0
- package/src/Card/card-manager-factory.js +10 -10
- package/src/Card/card-manager.js +54 -52
- package/src/Card/display/card-display.js +77 -91
- package/src/Card/log-card-click.js +6 -6
- package/src/Card/log-card-dismissal.js +6 -5
- package/src/Card/log-card-impressions.js +11 -11
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +99 -99
- 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 +19 -19
- package/src/Card/util/card-factory.js +58 -58
- package/src/ContentCards/content-cards-provider-factory.js +14 -14
- package/src/ContentCards/content-cards-provider.js +261 -263
- package/src/ContentCards/content-cards.js +5 -5
- package/src/ContentCards/get-cached-content-cards.js +3 -3
- package/src/ContentCards/request-content-cards-refresh.js +4 -4
- package/src/ContentCards/subscribe-to-content-cards-updates.js +13 -13
- package/src/ContentCards/ui/hide-content-cards.js +7 -7
- package/src/ContentCards/ui/show-content-cards.js +52 -52
- package/src/ContentCards/ui/toggle-content-cards.js +4 -4
- package/src/Core/add-sdk-metadata.js +9 -9
- package/src/Core/change-user.js +14 -14
- package/src/Core/destroy.js +3 -3
- package/src/Core/disable-sdk.js +13 -13
- package/src/Core/enable-sdk.js +9 -9
- package/src/Core/get-device-id.js +10 -10
- package/src/Core/get-user.js +2 -2
- package/src/Core/handle-braze-action.js +53 -53
- package/src/Core/initialize.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +2 -2
- package/src/Core/log-custom-event.js +27 -27
- package/src/Core/log-purchase.js +38 -38
- package/src/Core/open-session.js +18 -18
- package/src/Core/remove-all-subscriptions.js +2 -2
- package/src/Core/remove-subscription.js +3 -3
- package/src/Core/request-immediate-data-flush.js +5 -5
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +6 -6
- package/src/Core/subscribe-to-sdk-authentication-failures.js +5 -5
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +13 -13
- package/src/FeatureFlags/feature-flag.js +10 -10
- package/src/FeatureFlags/feature-flags-provider-factory.js +13 -14
- package/src/FeatureFlags/feature-flags-provider.js +118 -116
- package/src/FeatureFlags/get-all-feature-flags.js +10 -10
- package/src/FeatureFlags/get-feature-flag.js +9 -9
- package/src/FeatureFlags/log-feature-flag-impression.js +18 -18
- package/src/FeatureFlags/refresh-feature-flags.js +6 -6
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +9 -9
- package/src/Feed/feed-provider-factory.js +12 -12
- package/src/Feed/feed-provider.js +59 -59
- package/src/Feed/feed.js +4 -4
- package/src/Feed/get-cached-feed.js +3 -3
- package/src/Feed/log-feed-displayed.js +5 -5
- package/src/Feed/request-feed-refresh.js +3 -3
- package/src/Feed/subscribe-to-feed-updates.js +4 -4
- package/src/Feed/ui/hide-feed.js +5 -5
- package/src/Feed/ui/show-feed.js +53 -53
- package/src/Feed/ui/toggle-feed.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +9 -9
- package/src/InAppMessage/display/html-message-display-utils.js +18 -164
- package/src/InAppMessage/display/html-message-to-html.js +55 -62
- package/src/InAppMessage/display/in-app-message-to-html.js +74 -74
- package/src/InAppMessage/display/modal-utils.js +17 -17
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +61 -61
- package/src/InAppMessage/in-app-message-manager-factory.js +9 -9
- package/src/InAppMessage/in-app-message-manager.js +158 -156
- package/src/InAppMessage/log-in-app-message-button-click.js +16 -16
- package/src/InAppMessage/log-in-app-message-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-html-click.js +15 -15
- package/src/InAppMessage/log-in-app-message-impression.js +6 -6
- package/src/InAppMessage/models/control-message.js +15 -8
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +23 -23
- package/src/InAppMessage/models/in-app-message-button.js +10 -10
- package/src/InAppMessage/models/in-app-message.js +155 -155
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +35 -35
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +3 -3
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +103 -103
- 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 +25 -25
- package/src/Push/push-manager.js +176 -176
- package/src/Push/request-push-permission.js +8 -8
- package/src/Push/unregister-push.js +4 -4
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +38 -38
- package/src/User/user.js +95 -92
- package/src/common/base-feed.js +9 -9
- package/src/common/base-provider.js +2 -2
- package/src/common/constants.js +1 -0
- package/src/common/detect-impression.js +18 -0
- package/src/common/event-logger.js +22 -22
- package/src/common/feed-display.js +53 -53
- package/src/index.js +1 -0
- package/src/l10n/l10n-manager-factory.js +15 -15
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +38 -38
- package/src/managers/braze-instance.js +212 -212
- package/src/managers/device-manager.js +30 -30
- package/src/managers/network-manager.js +234 -235
- package/src/managers/server-config-manager.js +99 -83
- package/src/managers/session-manager.js +46 -50
- package/src/managers/storage-manager-factory.js +13 -13
- package/src/managers/storage-manager.js +182 -180
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +4 -4
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +15 -15
- package/src/models/push-token.js +10 -10
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +38 -34
- package/src/request-controller.js +228 -228
- 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 +66 -66
- package/src/triggers/models/in-app-message-click-data.js +10 -10
- 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 +5 -5
- package/src/triggers/models/trigger-condition.js +46 -46
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +33 -33
- package/src/triggers/triggers-provider-factory.js +16 -16
- package/src/triggers/triggers-provider.js +156 -154
- package/src/ui/js/attach-css.js +7 -7
- package/src/ui/js/banner-css.js +11 -0
- package/src/ui/js/feed-css.js +4 -4
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/index.js +1 -0
- package/src/ui/js/load-font-awesome.js +8 -8
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +32 -32
- package/src/util/browser-detector.js +27 -27
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/code-utils.js +5 -5
- package/src/util/component-utils.js +5 -5
- package/src/util/deprecation-utils.js +3 -3
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +158 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +21 -21
- package/src/util/request-header-utils.js +31 -30
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +9 -9
- package/src/util/validation-utils.js +89 -85
- package/src/util/window-utils.js +3 -3
|
@@ -1,329 +1,329 @@
|
|
|
1
1
|
import qt from "./auth-manager.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import s from "../common/base-provider.js";
|
|
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
|
|
8
|
-
keys as
|
|
9
|
-
validateValueIsFromEnum as
|
|
7
|
+
isArray as w,
|
|
8
|
+
keys as y,
|
|
9
|
+
validateValueIsFromEnum as ta,
|
|
10
10
|
values as Rt,
|
|
11
11
|
} from "../util/code-utils.js";
|
|
12
12
|
import Pt from "./network-manager.js";
|
|
13
13
|
import Lt from "../request-controller.js";
|
|
14
14
|
import Dt from "./server-config-manager.js";
|
|
15
15
|
import Mt from "./session-manager.js";
|
|
16
|
-
import
|
|
16
|
+
import ne, { STORAGE_KEYS as t } from "./storage-manager.js";
|
|
17
17
|
import Wt from "./storage-manager-factory.js";
|
|
18
|
-
import
|
|
19
|
-
import { TriggersProviderFactory as
|
|
18
|
+
import u from "./subscription-manager.js";
|
|
19
|
+
import { TriggersProviderFactory as ot } from "../triggers/triggers-provider-factory.js";
|
|
20
20
|
import kt from "../User/user-manager.js";
|
|
21
21
|
import { User } from "../User/index.js";
|
|
22
|
-
import { parseQueryStringKeyValues as
|
|
23
|
-
import { WindowUtils as
|
|
24
|
-
import { BRAZE_MUST_BE_INITIALIZED_ERROR as
|
|
25
|
-
import { SupportedOptions as zt, logger as
|
|
22
|
+
import { parseQueryStringKeyValues as ll } from "../util/url-utils.js";
|
|
23
|
+
import { WindowUtils as no } from "../util/window-utils.js";
|
|
24
|
+
import { BRAZE_MUST_BE_INITIALIZED_ERROR as p } from "../common/constants.js";
|
|
25
|
+
import { SupportedOptions as zt, logger as N } from "../../shared-lib/index.js";
|
|
26
26
|
import _t from "../models/identifier.js";
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
const z = {
|
|
28
|
+
Oo: "allowCrawlerActivity",
|
|
29
|
+
Ro: "baseUrl",
|
|
30
|
+
Lo: "noCookies",
|
|
31
|
+
Wo: "devicePropertyAllowlist",
|
|
32
|
+
Da: "disablePushTokenMaintenance",
|
|
33
|
+
Vo: "enableLogging",
|
|
34
|
+
Ko: "enableSdkAuthentication",
|
|
35
|
+
Ca: "manageServiceWorkerExternally",
|
|
36
|
+
Go: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
37
|
+
Yo: "sessionTimeoutInSeconds",
|
|
38
|
+
Ho: "appVersion",
|
|
39
|
+
Xo: "appVersionNumber",
|
|
40
|
+
_a: "serviceWorkerLocation",
|
|
41
|
+
Ba: "safariWebsitePushId",
|
|
42
|
+
Ea: "localization",
|
|
43
|
+
ir: "contentSecurityNonce",
|
|
44
|
+
er: "allowUserSuppliedJavascript",
|
|
45
|
+
Jo: "inAppMessageZIndex",
|
|
46
|
+
Do: "openInAppMessagesInNewTab",
|
|
47
47
|
tn: "openCardsInNewTab",
|
|
48
48
|
en: "openNewsFeedCardsInNewTab",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
mh: "requireExplicitInAppMessageDismissal",
|
|
50
|
+
Zo: "doNotLoadFontAwesome",
|
|
51
|
+
Qo: "deviceId",
|
|
52
|
+
Aa: "serviceWorkerScope",
|
|
53
|
+
Wh: "sdkFlavor",
|
|
54
54
|
};
|
|
55
55
|
class Vt {
|
|
56
56
|
constructor() {
|
|
57
|
-
(this.
|
|
58
|
-
(this.
|
|
59
|
-
(this
|
|
60
|
-
(this.
|
|
61
|
-
(this.
|
|
62
|
-
(this
|
|
63
|
-
(this.
|
|
64
|
-
(this.
|
|
65
|
-
(this.
|
|
66
|
-
(this.
|
|
67
|
-
(this.
|
|
68
|
-
(this.
|
|
57
|
+
(this.yn = ""),
|
|
58
|
+
(this.Vh = ""),
|
|
59
|
+
(this.$h = void 0),
|
|
60
|
+
(this.Yh = null),
|
|
61
|
+
(this.wn = null),
|
|
62
|
+
(this.S = null),
|
|
63
|
+
(this.Ue = null),
|
|
64
|
+
(this.B = null),
|
|
65
|
+
(this.T = null),
|
|
66
|
+
(this.C = null),
|
|
67
|
+
(this.As = null),
|
|
68
|
+
(this.Xh = ""),
|
|
69
69
|
(this.isInitialized = !1),
|
|
70
|
-
(this
|
|
71
|
-
(this.
|
|
72
|
-
(this.
|
|
70
|
+
(this.Zh = !1),
|
|
71
|
+
(this.Qh = new u()),
|
|
72
|
+
(this.Ia = new u()),
|
|
73
73
|
(this.options = {}),
|
|
74
|
-
(this.
|
|
75
|
-
(this.
|
|
76
|
-
(this.
|
|
77
|
-
(this.
|
|
74
|
+
(this.Na = []),
|
|
75
|
+
(this.Oa = []),
|
|
76
|
+
(this.Ir = []),
|
|
77
|
+
(this.Vh = "5.6.0");
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
this.
|
|
79
|
+
Ta(t) {
|
|
80
|
+
this.Qh.Ns(t);
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
this.
|
|
82
|
+
Nh(t) {
|
|
83
|
+
this.Ia.Ns(t);
|
|
84
84
|
}
|
|
85
|
-
initialize(
|
|
86
|
-
if (this.
|
|
87
|
-
return
|
|
88
|
-
this.options =
|
|
89
|
-
let
|
|
90
|
-
const
|
|
85
|
+
initialize(i, s) {
|
|
86
|
+
if (this.nt())
|
|
87
|
+
return N.info("Braze has already been initialized with an API key."), !0;
|
|
88
|
+
this.options = s || {};
|
|
89
|
+
let e = this.sr(z.Vo);
|
|
90
|
+
const r = ll(no.Ra());
|
|
91
91
|
if (
|
|
92
|
-
(
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
(r && "true" === r.brazeLogging && (e = !0),
|
|
93
|
+
N.init(e),
|
|
94
|
+
N.info(
|
|
95
95
|
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`,
|
|
96
96
|
),
|
|
97
|
-
null ==
|
|
97
|
+
null == i || "" === i || "string" != typeof i)
|
|
98
98
|
)
|
|
99
|
-
return
|
|
100
|
-
this.
|
|
101
|
-
let n = this.
|
|
99
|
+
return N.error("Braze requires a valid API key to be initialized."), !1;
|
|
100
|
+
this.yn = i;
|
|
101
|
+
let n = this.sr(z.Ro);
|
|
102
102
|
if (null == n || "" === n || "string" != typeof n)
|
|
103
|
-
return
|
|
103
|
+
return N.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
104
104
|
!1 === /^https?:/.test(n) && (n = `https://${n}`);
|
|
105
|
-
const
|
|
105
|
+
const o = n;
|
|
106
106
|
if (
|
|
107
107
|
((n = document.createElement("a")),
|
|
108
|
-
(n.href =
|
|
108
|
+
(n.href = o),
|
|
109
109
|
"/" === n.pathname && (n = `${n}api/v3`),
|
|
110
|
-
(this.
|
|
111
|
-
|
|
110
|
+
(this.Xh = n.toString()),
|
|
111
|
+
ro.Pa && !this.sr(z.Oo))
|
|
112
112
|
)
|
|
113
113
|
return (
|
|
114
|
-
|
|
115
|
-
(this
|
|
114
|
+
N.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
115
|
+
(this.Zh = !0),
|
|
116
116
|
!1
|
|
117
117
|
);
|
|
118
|
-
const
|
|
118
|
+
const h = this.sr(z.Lo) || !1;
|
|
119
119
|
if (
|
|
120
|
-
((this.
|
|
120
|
+
((this.C = Wt.La(i, h)), h && this.C.Ua(i), new ne.ne(null, !0).gr(t.ae))
|
|
121
121
|
)
|
|
122
122
|
return (
|
|
123
|
-
|
|
124
|
-
(this
|
|
123
|
+
N.info("Ignoring all activity due to previous opt out"),
|
|
124
|
+
(this.Zh = !0),
|
|
125
125
|
!1
|
|
126
126
|
);
|
|
127
|
-
for (const t of
|
|
127
|
+
for (const t of y(this.options))
|
|
128
128
|
-1 === Rt(zt).indexOf(t) &&
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
if (null != this.
|
|
132
|
-
const t = this.
|
|
133
|
-
-1 !==
|
|
134
|
-
? (this
|
|
135
|
-
:
|
|
129
|
+
N.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
130
|
+
const a = ["mparticle", "wordpress", "tealium"];
|
|
131
|
+
if (null != this.sr(z.Wh)) {
|
|
132
|
+
const t = this.sr(z.Wh);
|
|
133
|
+
-1 !== a.indexOf(t)
|
|
134
|
+
? (this.$h = t)
|
|
135
|
+
: N.error("Invalid sdk flavor passed: " + t);
|
|
136
136
|
}
|
|
137
|
-
let
|
|
138
|
-
if (null !=
|
|
139
|
-
if (
|
|
137
|
+
let l = this.sr(zt.Wo);
|
|
138
|
+
if (null != l)
|
|
139
|
+
if (w(l)) {
|
|
140
140
|
const t = [];
|
|
141
|
-
for (let i = 0; i <
|
|
142
|
-
|
|
141
|
+
for (let i = 0; i < l.length; i++)
|
|
142
|
+
ta(
|
|
143
143
|
DeviceProperties,
|
|
144
|
-
|
|
144
|
+
l[i],
|
|
145
145
|
"devicePropertyAllowlist contained an invalid value.",
|
|
146
146
|
"DeviceProperties",
|
|
147
|
-
) && t.push(
|
|
148
|
-
|
|
147
|
+
) && t.push(l[i]);
|
|
148
|
+
l = t;
|
|
149
149
|
} else
|
|
150
|
-
|
|
150
|
+
N.error(
|
|
151
151
|
"devicePropertyAllowlist must be an array. Defaulting to all properties.",
|
|
152
152
|
),
|
|
153
|
-
(
|
|
154
|
-
const c = this.
|
|
153
|
+
(l = null);
|
|
154
|
+
const c = this.sr(z.Qo);
|
|
155
155
|
if (c) {
|
|
156
|
-
const
|
|
157
|
-
this.
|
|
156
|
+
const i = new _t(c);
|
|
157
|
+
this.C.uu(t.iu.Qo, i);
|
|
158
158
|
}
|
|
159
|
-
(this.
|
|
160
|
-
(this.
|
|
161
|
-
(this.
|
|
162
|
-
(this.
|
|
163
|
-
const f = new
|
|
159
|
+
(this.wn = new Ot(this.C, l)),
|
|
160
|
+
(this.B = new Dt(this.C)),
|
|
161
|
+
(this.As = new kt(this.B, this.C)),
|
|
162
|
+
(this.T = new Mt(this.C, this.As, this.B, this.sr(z.Yo)));
|
|
163
|
+
const f = new u();
|
|
164
164
|
return (
|
|
165
|
-
(this.
|
|
166
|
-
this.
|
|
167
|
-
(this
|
|
168
|
-
this.
|
|
169
|
-
this.
|
|
170
|
-
this.
|
|
171
|
-
this.
|
|
172
|
-
this.
|
|
173
|
-
this.
|
|
174
|
-
this.
|
|
175
|
-
this.
|
|
176
|
-
this.
|
|
177
|
-
this
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
165
|
+
(this.Yh = new qt(this.C, this.sr(z.Ko), f)),
|
|
166
|
+
this.N(f),
|
|
167
|
+
(this.S = new Pt(
|
|
168
|
+
this.wn,
|
|
169
|
+
this.C,
|
|
170
|
+
this.Yh,
|
|
171
|
+
this.As,
|
|
172
|
+
this.T,
|
|
173
|
+
this.B,
|
|
174
|
+
this.yn,
|
|
175
|
+
this.Xh,
|
|
176
|
+
this.Vh,
|
|
177
|
+
this.$h || "",
|
|
178
|
+
this.sr(z.Ho),
|
|
179
|
+
this.sr(z.Xo),
|
|
180
180
|
)),
|
|
181
|
-
(this.
|
|
182
|
-
this.
|
|
183
|
-
this.
|
|
184
|
-
this.
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
188
|
-
this.
|
|
181
|
+
(this.Ue = new Lt(
|
|
182
|
+
this.yn,
|
|
183
|
+
this.Xh,
|
|
184
|
+
this.T,
|
|
185
|
+
this.wn,
|
|
186
|
+
this.As,
|
|
187
|
+
this.B,
|
|
188
|
+
this.C,
|
|
189
189
|
(t) => {
|
|
190
|
-
if (this.
|
|
190
|
+
if (this.nt()) for (const i of this.lr()) i.U(t);
|
|
191
191
|
},
|
|
192
|
-
this.
|
|
193
|
-
this
|
|
192
|
+
this.Yh,
|
|
193
|
+
this.S,
|
|
194
194
|
)),
|
|
195
|
-
this.
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
`Initialized for the Braze backend at "${this.
|
|
199
|
-
|
|
200
|
-
)}" with API key "${this.
|
|
195
|
+
this.Ue.initialize(),
|
|
196
|
+
h || this.C.Wa(),
|
|
197
|
+
N.info(
|
|
198
|
+
`Initialized for the Braze backend at "${this.sr(
|
|
199
|
+
z.Ro,
|
|
200
|
+
)}" with API key "${this.yn}".`,
|
|
201
201
|
),
|
|
202
|
-
|
|
203
|
-
this.
|
|
202
|
+
ot.p(),
|
|
203
|
+
this.B.Re(() => {
|
|
204
204
|
var t;
|
|
205
205
|
this.isInitialized &&
|
|
206
|
-
(null === (t = this.
|
|
206
|
+
(null === (t = this.B) || void 0 === t ? void 0 : t.Qi()) &&
|
|
207
207
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
208
208
|
if (!this.isInitialized) return;
|
|
209
209
|
(0, t.default)();
|
|
210
210
|
});
|
|
211
211
|
}),
|
|
212
|
-
this.
|
|
212
|
+
this.Ue.rn(() => {
|
|
213
213
|
var t;
|
|
214
214
|
this.isInitialized &&
|
|
215
|
-
(null === (t = this.
|
|
215
|
+
(null === (t = this.B) || void 0 === t ? void 0 : t.Qi()) &&
|
|
216
216
|
import("../FeatureFlags/refresh-feature-flags.js").then((t) => {
|
|
217
217
|
if (!this.isInitialized) return;
|
|
218
218
|
(0, t.default)(void 0, void 0, !0);
|
|
219
219
|
});
|
|
220
220
|
}),
|
|
221
|
-
this.
|
|
221
|
+
this.Qh.X(this.options),
|
|
222
222
|
(this.isInitialized = !0),
|
|
223
223
|
window.dispatchEvent(new CustomEvent("braze.initialized")),
|
|
224
224
|
!0
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
destroy(t) {
|
|
228
|
-
if ((
|
|
229
|
-
this.
|
|
230
|
-
for (const t of this.
|
|
231
|
-
this.
|
|
232
|
-
for (const t of this.
|
|
233
|
-
(this.
|
|
228
|
+
if ((N.destroy(), this.nt())) {
|
|
229
|
+
this.Ia.X(), this.Ia.removeAllSubscriptions();
|
|
230
|
+
for (const t of this.Na) t.destroy();
|
|
231
|
+
this.Na = [];
|
|
232
|
+
for (const t of this.Oa) t.clearData(!1);
|
|
233
|
+
(this.Oa = []),
|
|
234
234
|
this.removeAllSubscriptions(),
|
|
235
|
-
(this.
|
|
236
|
-
null != this.
|
|
237
|
-
(this.
|
|
238
|
-
(this.
|
|
239
|
-
(this.
|
|
240
|
-
(this
|
|
241
|
-
(this.
|
|
242
|
-
(this.
|
|
243
|
-
(this.
|
|
235
|
+
(this.Ir = []),
|
|
236
|
+
null != this.Ue && this.Ue.destroy(),
|
|
237
|
+
(this.Ue = null),
|
|
238
|
+
(this.Yh = null),
|
|
239
|
+
(this.wn = null),
|
|
240
|
+
(this.S = null),
|
|
241
|
+
(this.B = null),
|
|
242
|
+
(this.T = null),
|
|
243
|
+
(this.As = null),
|
|
244
244
|
(this.options = {}),
|
|
245
|
-
(this
|
|
245
|
+
(this.$h = void 0),
|
|
246
246
|
(this.isInitialized = !1),
|
|
247
|
-
(this
|
|
248
|
-
t && (this.
|
|
247
|
+
(this.Zh = !1),
|
|
248
|
+
t && (this.C = null);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
-
|
|
252
|
-
return !this
|
|
251
|
+
rr() {
|
|
252
|
+
return !this.Va() && (!!this.nt() || (console.warn(p), !1));
|
|
253
253
|
}
|
|
254
|
-
|
|
255
|
-
return this.
|
|
254
|
+
Ma() {
|
|
255
|
+
return this.yn;
|
|
256
256
|
}
|
|
257
257
|
Sr() {
|
|
258
|
-
return this.
|
|
258
|
+
return this.Yh;
|
|
259
259
|
}
|
|
260
|
-
|
|
261
|
-
return this.
|
|
260
|
+
Z() {
|
|
261
|
+
return this.Xh;
|
|
262
262
|
}
|
|
263
263
|
te() {
|
|
264
|
-
return this.
|
|
264
|
+
return this.wn;
|
|
265
265
|
}
|
|
266
|
-
|
|
267
|
-
return this
|
|
266
|
+
g() {
|
|
267
|
+
return this.S;
|
|
268
268
|
}
|
|
269
|
-
|
|
269
|
+
sr(t) {
|
|
270
270
|
return this.options[t];
|
|
271
271
|
}
|
|
272
|
-
|
|
273
|
-
return this.
|
|
274
|
-
}
|
|
275
|
-
cr() {
|
|
276
|
-
return this.Ui;
|
|
272
|
+
lr() {
|
|
273
|
+
return this.Oa;
|
|
277
274
|
}
|
|
278
|
-
|
|
279
|
-
return this.
|
|
275
|
+
nn() {
|
|
276
|
+
return this.Ue;
|
|
280
277
|
}
|
|
281
|
-
|
|
282
|
-
return this.
|
|
278
|
+
v() {
|
|
279
|
+
return this.B;
|
|
283
280
|
}
|
|
284
|
-
|
|
285
|
-
return this.
|
|
281
|
+
P() {
|
|
282
|
+
return this.T;
|
|
286
283
|
}
|
|
287
|
-
|
|
288
|
-
|
|
284
|
+
j() {
|
|
285
|
+
return this.C;
|
|
289
286
|
}
|
|
290
|
-
|
|
291
|
-
return this.
|
|
287
|
+
cr() {
|
|
288
|
+
if (this.As && this.Ue) return new User(this.As, this.Ue);
|
|
292
289
|
}
|
|
293
290
|
tr() {
|
|
294
|
-
return
|
|
291
|
+
return this.As;
|
|
292
|
+
}
|
|
293
|
+
nr() {
|
|
294
|
+
return !0 === this.sr(z.er);
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
h(t) {
|
|
297
297
|
let i = !1;
|
|
298
|
-
for (const s of this.
|
|
299
|
-
i || this.
|
|
298
|
+
for (const s of this.Na) s === t && (i = !0);
|
|
299
|
+
i || this.Na.push(t);
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
_(t) {
|
|
302
302
|
let i = !1;
|
|
303
|
-
for (const s of this.
|
|
304
|
-
t instanceof
|
|
303
|
+
for (const s of this.Oa) s.constructor === t.constructor && (i = !0);
|
|
304
|
+
t instanceof s && !i && this.Oa.push(t);
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
t instanceof
|
|
306
|
+
N(t) {
|
|
307
|
+
t instanceof u && this.Ir.push(t);
|
|
308
308
|
}
|
|
309
309
|
removeAllSubscriptions() {
|
|
310
|
-
if (this.
|
|
310
|
+
if (this.rr()) for (const t of this.Ir) t.removeAllSubscriptions();
|
|
311
311
|
}
|
|
312
312
|
removeSubscription(t) {
|
|
313
|
-
if (this.
|
|
313
|
+
if (this.rr()) for (const i of this.Ir) i.removeSubscription(t);
|
|
314
314
|
}
|
|
315
|
-
|
|
316
|
-
this
|
|
315
|
+
re(t) {
|
|
316
|
+
this.Zh = t;
|
|
317
317
|
}
|
|
318
|
-
|
|
318
|
+
nt() {
|
|
319
319
|
return this.isInitialized;
|
|
320
320
|
}
|
|
321
|
-
|
|
322
|
-
return this
|
|
321
|
+
Va() {
|
|
322
|
+
return this.Zh;
|
|
323
323
|
}
|
|
324
|
-
|
|
325
|
-
return this.
|
|
324
|
+
Ui() {
|
|
325
|
+
return this.Vh;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
const
|
|
329
|
-
export {
|
|
328
|
+
const r = new Vt();
|
|
329
|
+
export { r as default, Vt as BrazeSdkInstance, z as OPTIONS };
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ro from "../util/browser-detector.js";
|
|
2
2
|
import Gt 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
|
|
6
|
-
import { STORAGE_KEYS as
|
|
5
|
+
import { logger as N, Guid as G } from "../../shared-lib/index.js";
|
|
6
|
+
import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
7
7
|
import { values as Rt } from "../util/code-utils.js";
|
|
8
8
|
import { getErrorMessage as si } from "../util/error-utils.js";
|
|
9
9
|
export default class Ot {
|
|
10
10
|
constructor(t, e) {
|
|
11
|
-
(this.
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
11
|
+
(this.C = t),
|
|
12
|
+
(this.Fa = e),
|
|
13
|
+
(this.C = t),
|
|
14
14
|
null == e && (e = Rt(DeviceProperties)),
|
|
15
|
-
(this.
|
|
15
|
+
(this.Fa = e);
|
|
16
16
|
}
|
|
17
|
-
ce(
|
|
18
|
-
let
|
|
19
|
-
null ==
|
|
20
|
-
const
|
|
21
|
-
for (let t = 0; t < this.
|
|
22
|
-
switch (this.
|
|
17
|
+
ce(e = !0) {
|
|
18
|
+
let r = this.C.tu(t.iu.Qo);
|
|
19
|
+
null == r && ((r = new _t(G.Rt())), e && this.C.uu(t.iu.Qo, r));
|
|
20
|
+
const s = new Gt(r.eu);
|
|
21
|
+
for (let t = 0; t < this.Fa.length; t++) {
|
|
22
|
+
switch (this.Fa[t]) {
|
|
23
23
|
case DeviceProperties.BROWSER:
|
|
24
|
-
|
|
24
|
+
s.browser = ro.browser;
|
|
25
25
|
break;
|
|
26
26
|
case DeviceProperties.BROWSER_VERSION:
|
|
27
|
-
|
|
27
|
+
s.Ga = ro.version;
|
|
28
28
|
break;
|
|
29
29
|
case DeviceProperties.OS:
|
|
30
|
-
|
|
30
|
+
s.os = this.Ja();
|
|
31
31
|
break;
|
|
32
32
|
case DeviceProperties.RESOLUTION:
|
|
33
|
-
|
|
33
|
+
s.Ha = screen.width + "x" + screen.height;
|
|
34
34
|
break;
|
|
35
35
|
case DeviceProperties.LANGUAGE:
|
|
36
|
-
|
|
36
|
+
s.language = ro.language;
|
|
37
37
|
break;
|
|
38
38
|
case DeviceProperties.TIME_ZONE:
|
|
39
|
-
|
|
39
|
+
s.timeZone = this.Ka(new Date());
|
|
40
40
|
break;
|
|
41
41
|
case DeviceProperties.USER_AGENT:
|
|
42
|
-
|
|
42
|
+
s.userAgent = ro.userAgent;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return s;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
return
|
|
47
|
+
Ja() {
|
|
48
|
+
if (ro.Qa()) return ro.Qa();
|
|
49
|
+
const e = this.C.ps(t.bs.Xa);
|
|
50
|
+
return e && e.os_version ? e.os_version : ro.Ja();
|
|
51
51
|
}
|
|
52
|
-
|
|
52
|
+
Ka(t) {
|
|
53
53
|
let e = !1;
|
|
54
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
55
55
|
try {
|
|
@@ -58,17 +58,17 @@ export default class Ot {
|
|
|
58
58
|
if (null != t && "" !== t) return t;
|
|
59
59
|
}
|
|
60
60
|
} catch (t) {
|
|
61
|
-
|
|
61
|
+
N.info(
|
|
62
62
|
"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
|
|
63
63
|
si(t),
|
|
64
64
|
),
|
|
65
65
|
(e = !0);
|
|
66
66
|
}
|
|
67
67
|
if (e) return "";
|
|
68
|
-
const
|
|
69
|
-
return this.
|
|
68
|
+
const r = t.getTimezoneOffset();
|
|
69
|
+
return this.Ya(r);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
Ya(t) {
|
|
72
72
|
const e = Math.trunc(t / 60),
|
|
73
73
|
r = Math.trunc(t % 60);
|
|
74
74
|
let s = "GMT";
|