@braze/web-sdk 5.7.0 → 5.8.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 +4 -4
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +8 -8
- package/shared-lib/indexed-db-adapter.js +7 -7
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +17 -17
- package/src/Banner/get-all-banners.js +2 -3
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/request-banners-refresh.js +20 -12
- package/src/Banner/subscribe-to-banners-updates.js +14 -13
- package/src/Banner/ui/insert-banner.js +11 -9
- package/src/Card/log-card-impressions.js +2 -2
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards.js +3 -3
- 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 +3 -3
- 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/is-disabled.js +1 -1
- package/src/Core/open-session.js +6 -6
- package/src/Core/wipe-data.js +1 -1
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +17 -17
- package/src/FeatureFlags/feature-flags-provider.js +37 -37
- package/src/FeatureFlags/get-all-feature-flags.js +6 -7
- package/src/FeatureFlags/get-feature-flag.js +5 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed.js +2 -2
- package/src/Feed/ui/show-feed.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +18 -18
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +49 -49
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +3 -3
- package/src/InAppMessage/models/html-message.js +5 -5
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +32 -32
- package/src/InAppMessage/models/modal-message.js +3 -3
- package/src/InAppMessage/models/slide-up-message.js +6 -6
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +18 -18
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +83 -83
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +6 -6
- package/src/User/user.js +18 -18
- package/src/common/base-feed.js +3 -3
- package/src/common/event-logger.js +1 -1
- package/src/common/feed-display.js +8 -8
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/braze-instance.js +107 -107
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +117 -117
- package/src/managers/server-config-manager.js +61 -61
- package/src/managers/session-manager.js +25 -25
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +57 -57
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +2 -2
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +10 -10
- package/src/models/push-token.js +7 -7
- package/src/models/server-config.js +30 -30
- package/src/request-controller.js +93 -93
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +1 -1
- package/src/triggers/models/trigger-condition.js +29 -29
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +9 -9
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +15 -15
- 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 +3 -3
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +13 -13
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +4 -4
- package/src/util/window-utils.js +1 -1
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Type definitions for @braze/web-sdk v5.
|
|
2
|
+
* Type definitions for @braze/web-sdk v5.8.0
|
|
3
3
|
* Project: https://github.com/braze-inc/braze-web-sdk
|
|
4
4
|
* (c) Braze, Inc. 2025 - http://braze.com
|
|
5
5
|
* License available at https://github.com/braze-inc/braze-web-sdk/blob/master/LICENSE
|
|
@@ -2162,7 +2162,7 @@ export function openSession(): void;
|
|
|
2162
2162
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2163
2163
|
*
|
|
2164
2164
|
* ```
|
|
2165
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2165
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.8/service-worker.js');
|
|
2166
2166
|
* ```
|
|
2167
2167
|
*
|
|
2168
2168
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2475,7 +2475,7 @@ export function getBanner(placementId: string): Banner | null | undefined;
|
|
|
2475
2475
|
* @param banner - The `Banner` to insert onto the page.
|
|
2476
2476
|
* @param parentNode - The HTML element to render the banner into.
|
|
2477
2477
|
*/
|
|
2478
|
-
export function insertBanner(banner: Banner, parentNode: HTMLElement): void;
|
|
2478
|
+
export function insertBanner(banner: Banner | null | undefined, parentNode: HTMLElement): void;
|
|
2479
2479
|
|
|
2480
2480
|
/**
|
|
2481
2481
|
* Logs that the user clicked the given banner. This should generally be called through the Braze JavaScript bridge
|
|
@@ -2630,7 +2630,7 @@ export type InitializationOptions = {
|
|
|
2630
2630
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2631
2631
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2632
2632
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2633
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2633
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.8/service-worker.js');` or by including the content
|
|
2634
2634
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2635
2635
|
*/
|
|
2636
2636
|
manageServiceWorkerExternally?: boolean;
|
package/package.json
CHANGED
|
@@ -3,28 +3,28 @@ const d = {
|
|
|
3
3
|
Pr: "p",
|
|
4
4
|
gc: "pc",
|
|
5
5
|
Ac: "ca",
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
zu: "i",
|
|
7
|
+
Du: "ie",
|
|
8
8
|
xt: "cci",
|
|
9
9
|
$t: "ccic",
|
|
10
10
|
lt: "ccc",
|
|
11
11
|
dt: "ccd",
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
Il: "ss",
|
|
13
|
+
Dl: "se",
|
|
14
14
|
Ir: "si",
|
|
15
15
|
Mr: "sc",
|
|
16
16
|
Tr: "sbc",
|
|
17
17
|
Mc: "sfe",
|
|
18
|
-
|
|
18
|
+
qo: "iec",
|
|
19
19
|
fc: "lr",
|
|
20
20
|
mc: "uae",
|
|
21
21
|
yt: "ci",
|
|
22
22
|
ut: "cc",
|
|
23
23
|
wc: "lcaa",
|
|
24
24
|
bc: "lcar",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
Jn: "inc",
|
|
26
|
+
Mn: "add",
|
|
27
|
+
Yn: "rem",
|
|
28
28
|
Hn: "set",
|
|
29
29
|
Kn: "ncam",
|
|
30
30
|
kc: "sgu",
|
|
@@ -180,7 +180,7 @@ export default class tt {
|
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
cr(t, e, n) {
|
|
184
184
|
if (!this.isSupported()) return "function" == typeof n && n(), !1;
|
|
185
185
|
const o = this;
|
|
186
186
|
return this.Bd((i) => {
|
|
@@ -307,7 +307,7 @@ export default class tt {
|
|
|
307
307
|
for (const e in this.database.Ks) {
|
|
308
308
|
const n = e;
|
|
309
309
|
this.database.Ks.hasOwnProperty(e) &&
|
|
310
|
-
this.database.Ks[n] !== this.database.Ks.
|
|
310
|
+
this.database.Ks[n] !== this.database.Ks.oe &&
|
|
311
311
|
t.push(this.database.Ks[n]);
|
|
312
312
|
}
|
|
313
313
|
const e = this;
|
|
@@ -338,15 +338,15 @@ tt._s = {
|
|
|
338
338
|
Sd: "AppboyServiceWorkerAsyncStorage",
|
|
339
339
|
VERSION: 6,
|
|
340
340
|
Ks: {
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
Su: "data",
|
|
342
|
+
jr: "pushClicks",
|
|
343
343
|
cu: "pushSubscribed",
|
|
344
344
|
Cd: "fallbackDevice",
|
|
345
345
|
Hs: "cardUpdates",
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
oe: "optOut",
|
|
347
|
+
kr: "pendingData",
|
|
348
348
|
yh: "sdkAuthenticationSignature",
|
|
349
349
|
},
|
|
350
|
-
|
|
350
|
+
te: 1,
|
|
351
351
|
},
|
|
352
352
|
};
|
package/shared-lib/logger.js
CHANGED
|
@@ -24,13 +24,13 @@ const N = {
|
|
|
24
24
|
},
|
|
25
25
|
warn: function (n) {
|
|
26
26
|
if (N.zg) {
|
|
27
|
-
const o = "Braze SDK Warning: " + n + " (v5.
|
|
27
|
+
const o = "Braze SDK Warning: " + n + " (v5.8.0)";
|
|
28
28
|
null != N.vd ? N.vd(o) : console.warn(o);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
error: function (n) {
|
|
32
32
|
if (N.zg) {
|
|
33
|
-
const o = "Braze SDK Error: " + n + " (v5.
|
|
33
|
+
const o = "Braze SDK Error: " + n + " (v5.8.0)";
|
|
34
34
|
null != N.vd ? N.vd(o) : console.error(o);
|
|
35
35
|
}
|
|
36
36
|
},
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
Wo: "allowCrawlerActivity",
|
|
3
|
+
Vo: "baseUrl",
|
|
4
|
+
Ko: "noCookies",
|
|
5
|
+
Yo: "devicePropertyAllowlist",
|
|
6
6
|
Da: "disablePushTokenMaintenance",
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Xo: "enableLogging",
|
|
8
|
+
Zo: "enableSdkAuthentication",
|
|
9
9
|
Ca: "manageServiceWorkerExternally",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
Qo: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Wh: "sessionTimeoutInSeconds",
|
|
12
|
+
Vh: "appVersion",
|
|
13
|
+
$h: "appVersionNumber",
|
|
14
14
|
_a: "serviceWorkerLocation",
|
|
15
15
|
Ba: "safariWebsitePushId",
|
|
16
16
|
Ea: "localization",
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
er: "contentSecurityNonce",
|
|
18
|
+
re: "allowUserSuppliedJavascript",
|
|
19
|
+
To: "inAppMessageZIndex",
|
|
20
|
+
Fo: "openInAppMessagesInNewTab",
|
|
21
21
|
en: "openNewsFeedCardsInNewTab",
|
|
22
22
|
mh: "requireExplicitInAppMessageDismissal",
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Yh: "doNotLoadFontAwesome",
|
|
24
|
+
Xh: "deviceId",
|
|
25
25
|
Aa: "serviceWorkerScope",
|
|
26
|
-
|
|
26
|
+
Zh: "sdkFlavor",
|
|
27
27
|
tn: "openCardsInNewTab",
|
|
28
28
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { logger as N } from "../../shared-lib/index.js";
|
|
2
1
|
import r from "../managers/braze-instance.js";
|
|
3
2
|
import i from "./banner-provider-factory.js";
|
|
4
3
|
import { getBannerIfNotExpired as v } from "./get-banner.js";
|
|
5
4
|
export function getAllBanners() {
|
|
6
5
|
if (!r.rr()) return;
|
|
7
6
|
const n = {},
|
|
8
|
-
|
|
9
|
-
if (
|
|
7
|
+
t = r.v();
|
|
8
|
+
if (t && !t.Ds()) return n;
|
|
10
9
|
const o = i.m().fs();
|
|
11
10
|
for (const r in o) n[r] = v(o, r);
|
|
12
11
|
return n;
|
package/src/Banner/get-banner.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { logger as N } from "../../shared-lib/index.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
import i from "./banner-provider-factory.js";
|
|
4
|
-
export function getBannerIfNotExpired(n,
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
7
|
-
const t =
|
|
8
|
-
|
|
9
|
-
return -1 !== t && 1e3 * t <
|
|
10
|
-
? (N.info(`Banner with ID: ${
|
|
4
|
+
export function getBannerIfNotExpired(n, r) {
|
|
5
|
+
const e = n[r];
|
|
6
|
+
if (!e) return null;
|
|
7
|
+
const t = e.it,
|
|
8
|
+
o = new Date().valueOf();
|
|
9
|
+
return -1 !== t && 1e3 * t < o
|
|
10
|
+
? (N.info(`Banner with ID: ${e.id} and placement ID: ${r} has expired.`),
|
|
11
11
|
null)
|
|
12
|
-
:
|
|
12
|
+
: e;
|
|
13
13
|
}
|
|
14
14
|
export function getBanner(n) {
|
|
15
15
|
if (!r.rr()) return;
|
|
16
|
-
const e =
|
|
17
|
-
if (
|
|
18
|
-
return getBannerIfNotExpired(
|
|
16
|
+
const e = i.m();
|
|
17
|
+
if (!e.L()) return null;
|
|
18
|
+
return getBannerIfNotExpired(e.fs(), n);
|
|
19
19
|
}
|
|
@@ -1,26 +1,34 @@
|
|
|
1
1
|
import { logger as N } from "../../shared-lib/index.js";
|
|
2
2
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as p } from "../common/constants.js";
|
|
3
|
-
import r from "../managers/braze-instance.js";
|
|
4
|
-
import { isArray as
|
|
3
|
+
import r, { OPTIONS as w } from "../managers/braze-instance.js";
|
|
4
|
+
import { isArray as z } from "../util/code-utils.js";
|
|
5
5
|
import { isValidBannerPlacementId as D } from "../util/validation-utils.js";
|
|
6
6
|
import i from "./banner-provider-factory.js";
|
|
7
|
-
export function requestBannersRefresh(e, n,
|
|
7
|
+
export function requestBannersRefresh(e, n, t) {
|
|
8
8
|
if (!r.rr()) return void N.warn(p);
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
if (!
|
|
12
|
-
if (!w(e) || 0 === e.length)
|
|
9
|
+
const s = r.v();
|
|
10
|
+
if (!s) return;
|
|
11
|
+
if (!z(e) || 0 === e.length)
|
|
13
12
|
return void N.warn("placementIds should be a non-empty array.");
|
|
13
|
+
if (!r.ee(w.re))
|
|
14
|
+
return void N.error(
|
|
15
|
+
"Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
|
|
16
|
+
);
|
|
17
|
+
const o = i.m();
|
|
14
18
|
if (i.m().Rs())
|
|
15
19
|
return void N.warn(
|
|
16
20
|
"Banners can be refreshed only once per session per user.",
|
|
17
21
|
);
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
if (!s || !o.L())
|
|
23
|
+
return void s.A(() => {
|
|
24
|
+
requestBannersRefresh(e, n, t);
|
|
25
|
+
});
|
|
26
|
+
const a = s.ne();
|
|
27
|
+
e.length > a &&
|
|
20
28
|
(N.warn(
|
|
21
|
-
`Number of placement IDs requested exceeds the max allowed. Trimming placementIds array from length ${e.length} to ${
|
|
29
|
+
`Number of placement IDs requested exceeds the max allowed. Trimming placementIds array from length ${e.length} to ${a} (max allowed).`,
|
|
22
30
|
),
|
|
23
|
-
(e = e.slice(0,
|
|
31
|
+
(e = e.slice(0, a))),
|
|
24
32
|
0 !==
|
|
25
33
|
(e = e.filter(
|
|
26
34
|
(e) =>
|
|
@@ -31,5 +39,5 @@ export function requestBannersRefresh(e, n, o) {
|
|
|
31
39
|
!1),
|
|
32
40
|
)).length &&
|
|
33
41
|
(N.info(`Requesting banners for placement IDs: ${JSON.stringify(e)}`),
|
|
34
|
-
i.m().$(e, n,
|
|
42
|
+
i.m().$(e, n, t));
|
|
35
43
|
}
|
|
@@ -2,22 +2,23 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import i from "./banner-provider-factory.js";
|
|
3
3
|
import { getAllBanners } from "./get-all-banners.js";
|
|
4
4
|
export function subscribeToBannersUpdates(n) {
|
|
5
|
+
var o;
|
|
5
6
|
if (!r.rr()) return;
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
7
|
+
const t = i.m();
|
|
8
|
+
if (t.Is()) {
|
|
8
9
|
const r = getAllBanners();
|
|
9
10
|
r && "function" == typeof n && n(r);
|
|
10
11
|
}
|
|
11
|
-
const
|
|
12
|
-
if (!
|
|
13
|
-
const n =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const s = t.qs(n);
|
|
13
|
+
if (!t.Cs()) {
|
|
14
|
+
const n =
|
|
15
|
+
null === (o = r.nn()) || void 0 === o
|
|
16
|
+
? void 0
|
|
17
|
+
: o.rn(() => {
|
|
18
|
+
const n = t.ls();
|
|
19
|
+
n && n.length > 0 && t.$(n);
|
|
20
|
+
});
|
|
21
|
+
n && t.Ts(n);
|
|
21
22
|
}
|
|
22
|
-
return
|
|
23
|
+
return s;
|
|
23
24
|
}
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import N from "../../../shared-lib/logger.js";
|
|
2
2
|
import { SUBSCRIPTION_ID_DATA_ATTRIBUTE as f } from "../../common/constants.js";
|
|
3
|
-
import r, { OPTIONS as
|
|
3
|
+
import r, { OPTIONS as w } from "../../managers/braze-instance.js";
|
|
4
4
|
import { setupBannerUI as U } from "../../ui/js/banner-css.js";
|
|
5
5
|
import { addPassiveEventListener as J } from "../../util/dom-utils.js";
|
|
6
6
|
import { bannerToHtml as S } from "../display/banner-to-html.js";
|
|
7
7
|
import { destroyBannerHtml as A } from "../display/destroy-banner-html.js";
|
|
8
8
|
import { detectBannerImpressions as C } from "../display/detect-banner-impressions.js";
|
|
9
9
|
import { subscribeToBannersUpdates } from "../subscribe-to-banners-updates.js";
|
|
10
|
-
export function insertBanner(o,
|
|
10
|
+
export function insertBanner(o, e) {
|
|
11
11
|
if (!r.rr()) return;
|
|
12
|
-
if (!o
|
|
13
|
-
if (!
|
|
12
|
+
if (!o) return void N.error("Not inserting banner: banner was not provided.");
|
|
13
|
+
if (!e)
|
|
14
|
+
return void N.error("Not inserting banner: parentNode was not provided.");
|
|
15
|
+
if (!r.ee(w.re))
|
|
14
16
|
return void N.error(
|
|
15
17
|
"Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
|
|
16
18
|
);
|
|
17
19
|
U();
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const n = S(o, r.ee(w.er)),
|
|
21
|
+
s = subscribeToBannersUpdates((s) => {
|
|
22
|
+
const i = s[o.placementId];
|
|
23
|
+
i ? e.replaceChildren(S(i, r.ee(w.er))) : A(n);
|
|
22
24
|
});
|
|
23
|
-
|
|
25
|
+
s && n.setAttribute(f, s), e.replaceChildren(n), J(window, "scroll", C), C();
|
|
24
26
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Card } from "./models/index.js";
|
|
2
2
|
import _ from "./card-manager-factory.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
|
-
import { isArray as
|
|
4
|
+
import { isArray as z } from "../util/code-utils.js";
|
|
5
5
|
import { MUST_BE_CARD_WARNING_SUFFIX as K } from "../common/constants.js";
|
|
6
6
|
import { logger as N } from "../../shared-lib/index.js";
|
|
7
7
|
export function logCardImpressions(o, n) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
|
-
if (!
|
|
9
|
+
if (!z(o)) return N.error("cards must be an array"), !1;
|
|
10
10
|
for (const r of o)
|
|
11
11
|
if (!(r instanceof Card)) return N.error(`Each card in cards ${K}`), !1;
|
|
12
12
|
return _.ea().jt(o, n).ss;
|
|
@@ -14,11 +14,11 @@ export default class ContentCards extends rr {
|
|
|
14
14
|
logCardClick(r) {
|
|
15
15
|
return logCardClick(r, !0);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
sr() {
|
|
18
18
|
requestContentCardsRefresh();
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
nr() {
|
|
21
21
|
return !0;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
ContentCards.
|
|
24
|
+
ContentCards.dr = 6e4;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as w } from "../../managers/braze-instance.js";
|
|
2
2
|
import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
|
|
3
3
|
import W from "../content-cards-provider-factory.js";
|
|
4
4
|
import {
|
|
@@ -18,17 +18,17 @@ export function showContentCards(n, t) {
|
|
|
18
18
|
fn();
|
|
19
19
|
let e = !1;
|
|
20
20
|
null == n && ((n = document.body), (e = !0));
|
|
21
|
-
const o = r.
|
|
21
|
+
const o = r.ee(w.tn) || r.ee(w.en) || !1,
|
|
22
22
|
i = W.m().Ri(!1);
|
|
23
23
|
"function" == typeof t && an(i, t(i.cards.slice()), i.lastUpdated, null, o);
|
|
24
24
|
const a = tn(i, o, e),
|
|
25
25
|
s = W.m(),
|
|
26
26
|
f = s.Zs();
|
|
27
27
|
(null == i.lastUpdated ||
|
|
28
|
-
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.
|
|
29
|
-
(null == f || new Date().valueOf() - f > ContentCards.
|
|
28
|
+
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.dr) &&
|
|
29
|
+
(null == f || new Date().valueOf() - f > ContentCards.dr) &&
|
|
30
30
|
(N.info(
|
|
31
|
-
`Cached content cards were older than max TTL of ${ContentCards.
|
|
31
|
+
`Cached content cards were older than max TTL of ${ContentCards.dr} ms, requesting an update from the server.`,
|
|
32
32
|
),
|
|
33
33
|
on(i, a),
|
|
34
34
|
s.fi(new Date().valueOf()));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import aa from "../managers/braze-instance.js";
|
|
2
2
|
import BrazeSdkMetadata from "./braze-sdk-metadata.js";
|
|
3
3
|
import {
|
|
4
|
-
isArray as
|
|
4
|
+
isArray as z,
|
|
5
5
|
validateValueIsFromEnum as ta,
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import { logger as N } from "../../shared-lib/index.js";
|
|
@@ -9,7 +9,7 @@ export function addSdkMetadata(a) {
|
|
|
9
9
|
if (!aa.rr()) return;
|
|
10
10
|
const t = aa.g();
|
|
11
11
|
if (t) {
|
|
12
|
-
if (!
|
|
12
|
+
if (!z(a))
|
|
13
13
|
return (
|
|
14
14
|
N.error("Cannot set SDK metadata because metadata is not an array."), !1
|
|
15
15
|
);
|
package/src/Core/change-user.js
CHANGED
|
@@ -7,11 +7,11 @@ export function changeUser(e, i) {
|
|
|
7
7
|
if (!r.rr()) return;
|
|
8
8
|
if (null == e || 0 === e.length || e != e)
|
|
9
9
|
return void N.error("changeUser requires a non-empty userId.");
|
|
10
|
-
if (er(e) > User.
|
|
10
|
+
if (er(e) > User.ur)
|
|
11
11
|
return void N.error(
|
|
12
|
-
`Rejected user id "${e}" because it is longer than ${User.
|
|
12
|
+
`Rejected user id "${e}" because it is longer than ${User.ur} bytes.`,
|
|
13
13
|
);
|
|
14
14
|
if (null != i && !ir(i, "set signature for new user", "signature")) return;
|
|
15
15
|
const t = r.nn();
|
|
16
|
-
t && t.changeUser(e.toString(), r.
|
|
16
|
+
t && t.changeUser(e.toString(), r.ar(), i);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -4,12 +4,12 @@ import ne, { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
|
4
4
|
export function disableSDK() {
|
|
5
5
|
const e = r.nn();
|
|
6
6
|
e && e.requestImmediateDataFlush();
|
|
7
|
-
const n = new ne.
|
|
8
|
-
s = "This-cookie-will-expire-in-" + n.
|
|
9
|
-
n.store(t.
|
|
7
|
+
const n = new ne.se(null, !0),
|
|
8
|
+
s = "This-cookie-will-expire-in-" + n.ae();
|
|
9
|
+
n.store(t.ie, s);
|
|
10
10
|
const a = tt._s.Xs;
|
|
11
|
-
new tt(a, N).setItem(a.Ks.
|
|
11
|
+
new tt(a, N).setItem(a.Ks.oe, a.te, !0),
|
|
12
12
|
N.info("disableSDK was called"),
|
|
13
13
|
r.destroy(!1),
|
|
14
|
-
r.
|
|
14
|
+
r.le(!0);
|
|
15
15
|
}
|
package/src/Core/enable-sdk.js
CHANGED
|
@@ -2,10 +2,10 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
3
3
|
import ne, { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
|
-
new ne.
|
|
5
|
+
new ne.se(null, !0).remove(t.ie);
|
|
6
6
|
const e = tt._s.Xs;
|
|
7
|
-
new tt(e, N).me(e.Ks.
|
|
7
|
+
new tt(e, N).me(e.Ks.oe, e.te),
|
|
8
8
|
N.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
|
-
r.
|
|
10
|
+
r.le(!1);
|
|
11
11
|
}
|
|
@@ -2,9 +2,9 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { logger as N } from "../../shared-lib/index.js";
|
|
3
3
|
export function getDeviceId(e) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t = r.
|
|
5
|
+
const t = r.ce();
|
|
6
6
|
if (!t) return;
|
|
7
|
-
const i = t.
|
|
7
|
+
const i = t.de().id;
|
|
8
8
|
if ("function" != typeof e) return i;
|
|
9
9
|
N.warn(
|
|
10
10
|
"The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
|
package/src/Core/get-user.js
CHANGED
package/src/Core/is-disabled.js
CHANGED
package/src/Core/open-session.js
CHANGED
|
@@ -9,17 +9,17 @@ export function openSession() {
|
|
|
9
9
|
i.openSession();
|
|
10
10
|
const t = tt._s.Xs,
|
|
11
11
|
o = new tt(t, N);
|
|
12
|
-
o.
|
|
12
|
+
o.cr(t.Ks.jr, (r, n) => {
|
|
13
13
|
const e = n.lastClick,
|
|
14
14
|
s = n.trackingString;
|
|
15
15
|
N.info(`Firing push click trigger from ${s} push click at ${e}`);
|
|
16
|
-
const c = i.
|
|
16
|
+
const c = i.lr(e, s),
|
|
17
17
|
g = function () {
|
|
18
|
-
ot.m().ue(et.
|
|
18
|
+
ot.m().ue(et.hr, [s], c);
|
|
19
19
|
};
|
|
20
|
-
i.
|
|
20
|
+
i.br(g, g), o.me(t.Ks.jr, r);
|
|
21
21
|
}),
|
|
22
|
-
o.Gs(t.Ks
|
|
23
|
-
i.
|
|
22
|
+
o.Gs(t.Ks.kr, function (r) {
|
|
23
|
+
i.vr(r);
|
|
24
24
|
});
|
|
25
25
|
}
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { logger as N } from "../../shared-lib/index.js";
|
|
2
2
|
import FeatureFlag from "./feature-flag.js";
|
|
3
3
|
export function newFeatureFlagFromJson(e) {
|
|
4
|
-
if (e[FeatureFlag.li.Et] && "boolean" == typeof e[FeatureFlag.li.
|
|
4
|
+
if (e[FeatureFlag.li.Et] && "boolean" == typeof e[FeatureFlag.li.pe])
|
|
5
5
|
return new FeatureFlag(
|
|
6
6
|
e[FeatureFlag.li.Et],
|
|
7
|
-
e[FeatureFlag.li.le],
|
|
8
7
|
e[FeatureFlag.li.pe],
|
|
9
8
|
e[FeatureFlag.li.Fe],
|
|
9
|
+
e[FeatureFlag.li.be],
|
|
10
10
|
);
|
|
11
11
|
N.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
|
|
12
12
|
}
|
|
13
13
|
export function newFeatureFlagFromSerializedValue(e) {
|
|
14
|
-
if (e[FeatureFlag.qt.Et] && "boolean" == typeof e[FeatureFlag.qt.
|
|
14
|
+
if (e[FeatureFlag.qt.Et] && "boolean" == typeof e[FeatureFlag.qt.pe])
|
|
15
15
|
return new FeatureFlag(
|
|
16
16
|
e[FeatureFlag.qt.Et],
|
|
17
|
-
e[FeatureFlag.qt.le],
|
|
18
17
|
e[FeatureFlag.qt.pe],
|
|
19
18
|
e[FeatureFlag.qt.Fe],
|
|
19
|
+
e[FeatureFlag.qt.be],
|
|
20
20
|
);
|
|
21
21
|
N.info(
|
|
22
22
|
`Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`,
|