@braze/web-sdk 6.3.1 → 6.4.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 +35 -3
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +23 -23
- package/shared-lib/guid.js +2 -2
- package/shared-lib/indexed-db-adapter.js +7 -7
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +22 -21
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +7 -7
- package/src/Banner/index.js +2 -0
- package/src/Banner/request-banners-refresh.js +6 -6
- package/src/Banner/ui/insert-banner.js +4 -4
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +4 -4
- 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/card.js +7 -7
- package/src/Card/util/card-factory.js +6 -6
- package/src/ContentCards/content-cards-provider-factory.js +14 -10
- package/src/ContentCards/content-cards-provider.js +28 -28
- package/src/ContentCards/content-cards.js +4 -4
- 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 +3 -3
- package/src/ContentCards/ui/show-content-cards.js +8 -8
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +5 -5
- package/src/Core/disable-sdk.js +3 -3
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-user.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-purchase.js +7 -7
- package/src/Core/open-session.js +11 -11
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +5 -5
- package/src/DUST/dust-provider-factory.js +20 -0
- package/src/DUST/dust-provider.js +288 -0
- package/src/DUST/index.js +3 -0
- package/src/DUST/subscribe-to-dust.js +24 -0
- package/src/DUST/types.js +1 -0
- package/src/FeatureFlags/feature-flags-provider-factory.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +38 -38
- 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 +5 -5
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +5 -5
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +5 -5
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +80 -80
- package/src/InAppMessage/log-in-app-message-button-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +5 -5
- 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 +12 -12
- package/src/InAppMessage/models/html-message.js +14 -14
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +119 -121
- package/src/InAppMessage/models/modal-message.js +12 -12
- package/src/InAppMessage/models/slide-up-message.js +21 -21
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +18 -0
- package/src/InAppMessage/ui/show-in-app-message.js +24 -24
- 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 +8 -8
- package/src/Push/push-manager.js +90 -90
- package/src/Push/utils/push-utils.js +17 -17
- package/src/User/user-manager.js +12 -12
- package/src/User/user.js +48 -48
- package/src/common/constants.js +1 -0
- package/src/common/content-cards-display.js +20 -20
- package/src/common/event-logger.js +4 -4
- package/src/common/properties-base.js +16 -16
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +141 -133
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +139 -139
- package/src/managers/server-config-manager.js +99 -82
- package/src/managers/session-manager.js +32 -32
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +76 -74
- package/src/managers/subscription-manager.js +10 -10
- 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 +12 -12
- package/src/models/push-token.js +12 -12
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +38 -34
- package/src/request-controller.js +136 -134
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +30 -30
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +36 -36
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +15 -15
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +25 -25
- 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 +3 -3
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +10 -10
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +22 -22
- package/src/util/user-agent-parser.js +14 -14
- package/src/util/validation-utils.js +9 -9
- 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 v6.
|
|
2
|
+
* Type definitions for @braze/web-sdk v6.4.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
|
|
@@ -2006,6 +2006,38 @@ export function logContentCardImpressions(contentCards: Card[]): boolean;
|
|
|
2006
2006
|
*/
|
|
2007
2007
|
export function logContentCardClick(contentCard: Card): boolean;
|
|
2008
2008
|
|
|
2009
|
+
/**
|
|
2010
|
+
* Logs that the user saw the given Banners.
|
|
2011
|
+
* This is done automatically when you use Braze's display module and should only be called
|
|
2012
|
+
* if you're bypassing that and manually building the DOM for displaying banners in
|
|
2013
|
+
* your own code.
|
|
2014
|
+
*
|
|
2015
|
+
* @param placementIds - array of placement IDs (strings) that received impressions
|
|
2016
|
+
*
|
|
2017
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2018
|
+
* Returns undefined if the SDK has not been initialized.
|
|
2019
|
+
*/
|
|
2020
|
+
export function logBannerImpressions(
|
|
2021
|
+
placementIds: Array<string>,
|
|
2022
|
+
): boolean | undefined;
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* Logs when user clicks on a Banner.
|
|
2026
|
+
* This is done automatically when you use Braze's display module and should only be called
|
|
2027
|
+
* if you're bypassing that and manually building the DOM for displaying banners in
|
|
2028
|
+
* your own code.
|
|
2029
|
+
*
|
|
2030
|
+
* @param banner - the `Banner` object that received a click
|
|
2031
|
+
* @param buttonId - optional button ID if the click was on a specific button within the banner
|
|
2032
|
+
*
|
|
2033
|
+
* @returns Whether or not the event was successfully logged (to be flushed later).
|
|
2034
|
+
* Returns undefined if the SDK has not been initialized.
|
|
2035
|
+
*/
|
|
2036
|
+
export function logBannerClick(
|
|
2037
|
+
banner: Banner,
|
|
2038
|
+
buttonId?: string,
|
|
2039
|
+
): boolean | undefined;
|
|
2040
|
+
|
|
2009
2041
|
/**
|
|
2010
2042
|
* Reports that the current user performed a custom named event.
|
|
2011
2043
|
*
|
|
@@ -2138,7 +2170,7 @@ export function openSession(): void;
|
|
|
2138
2170
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2139
2171
|
*
|
|
2140
2172
|
* ```
|
|
2141
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk/6.
|
|
2173
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk/6.4/service-worker.js');
|
|
2142
2174
|
* ```
|
|
2143
2175
|
*
|
|
2144
2176
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2561,7 +2593,7 @@ export type InitializationOptions = {
|
|
|
2561
2593
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2562
2594
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2563
2595
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2564
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk/6.
|
|
2596
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk/6.4/service-worker.js');` or by including the content
|
|
2565
2597
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2566
2598
|
*/
|
|
2567
2599
|
manageServiceWorkerExternally?: boolean;
|
package/package.json
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
const m = {
|
|
2
2
|
CustomEvent: "ce",
|
|
3
3
|
Pr: "p",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
Ic: "pc",
|
|
5
|
+
Jc: "ca",
|
|
6
|
+
Hu: "i",
|
|
7
|
+
ju: "ie",
|
|
8
8
|
Ut: "cci",
|
|
9
9
|
Wt: "ccic",
|
|
10
10
|
Ht: "ccc",
|
|
11
11
|
Mt: "ccd",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
sm: "ss",
|
|
13
|
+
Jl: "se",
|
|
14
|
+
Jr: "si",
|
|
15
|
+
Kr: "sc",
|
|
16
|
+
Lr: "sbc",
|
|
17
|
+
Kc: "sfe",
|
|
18
|
+
Mo: "iec",
|
|
19
|
+
Fc: "lr",
|
|
20
|
+
Rc: "uae",
|
|
21
|
+
Nc: "lcaa",
|
|
22
|
+
xc: "lcar",
|
|
23
|
+
vu: "inc",
|
|
24
|
+
Nu: "add",
|
|
25
|
+
yu: "rem",
|
|
26
|
+
fu: "set",
|
|
27
|
+
gu: "ncam",
|
|
28
|
+
Oc: "sgu",
|
|
29
|
+
Ir: "ffi",
|
|
30
30
|
ro: "bi",
|
|
31
31
|
ot: "bc",
|
|
32
32
|
},
|
|
33
|
-
Ee = {
|
|
33
|
+
Ee = { Qc: "content_cards_displayed" };
|
|
34
34
|
export { m as EventTypes, Ee as InternalEventTypes };
|
package/shared-lib/guid.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const L = {
|
|
2
2
|
oe: function () {
|
|
3
3
|
if ("undefined" != typeof window && window.crypto) {
|
|
4
4
|
if ("function" == typeof window.crypto.randomUUID)
|
|
@@ -26,4 +26,4 @@ const P = {
|
|
|
26
26
|
return n() + n(!0) + n(!0) + n();
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
|
-
export default
|
|
29
|
+
export default L;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class it {
|
|
2
2
|
constructor(t, e) {
|
|
3
3
|
(this.database = t),
|
|
4
4
|
(this.vd = e),
|
|
@@ -180,7 +180,7 @@ export default class et {
|
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
kr(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) => {
|
|
@@ -333,19 +333,19 @@ export default class et {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
|
|
336
|
+
it.Us = {
|
|
337
337
|
Rs: {
|
|
338
338
|
Sd: "AppboyServiceWorkerAsyncStorage",
|
|
339
339
|
VERSION: 6,
|
|
340
340
|
Fs: {
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
Yi: "data",
|
|
342
|
+
vr: "pushClicks",
|
|
343
343
|
cu: "pushSubscribed",
|
|
344
344
|
Cd: "fallbackDevice",
|
|
345
345
|
As: "cardUpdates",
|
|
346
346
|
le: "optOut",
|
|
347
|
-
|
|
348
|
-
|
|
347
|
+
zr: "pendingData",
|
|
348
|
+
qh: "sdkAuthenticationSignature",
|
|
349
349
|
},
|
|
350
350
|
me: 1,
|
|
351
351
|
},
|
package/shared-lib/logger.js
CHANGED
|
@@ -24,13 +24,13 @@ const E = {
|
|
|
24
24
|
},
|
|
25
25
|
warn: function (n) {
|
|
26
26
|
if (E.zg) {
|
|
27
|
-
const o = "Braze SDK Warning: " + n + " (v6.
|
|
27
|
+
const o = "Braze SDK Warning: " + n + " (v6.4.0)";
|
|
28
28
|
null != E.vd ? E.vd(o) : console.warn(o);
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
error: function (n) {
|
|
32
32
|
if (E.zg) {
|
|
33
|
-
const o = "Braze SDK Error: " + n + " (v6.
|
|
33
|
+
const o = "Braze SDK Error: " + n + " (v6.4.0)";
|
|
34
34
|
null != E.vd ? E.vd(o) : console.error(o);
|
|
35
35
|
}
|
|
36
36
|
},
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
Ph: "allowCrawlerActivity",
|
|
3
|
+
Wh: "baseUrl",
|
|
4
|
+
Vh: "noCookies",
|
|
5
|
+
Kh: "devicePropertyAllowlist",
|
|
6
|
+
Da: "disablePushTokenMaintenance",
|
|
7
|
+
$h: "enableLogging",
|
|
8
|
+
Yh: "enableSdkAuthentication",
|
|
9
|
+
Ca: "manageServiceWorkerExternally",
|
|
10
|
+
Xh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Zh: "sessionTimeoutInSeconds",
|
|
12
|
+
Qh: "appVersion",
|
|
13
|
+
Ia: "appVersionNumber",
|
|
14
|
+
_a: "serviceWorkerLocation",
|
|
15
|
+
Ba: "safariWebsitePushId",
|
|
16
|
+
Ea: "localization",
|
|
17
17
|
er: "contentSecurityNonce",
|
|
18
18
|
re: "allowUserSuppliedJavascript",
|
|
19
19
|
Jo: "inAppMessageZIndex",
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
To: "openInAppMessagesInNewTab",
|
|
21
|
+
Oh: "requireExplicitInAppMessageDismissal",
|
|
22
|
+
Na: "doNotLoadFontAwesome",
|
|
23
|
+
Oa: "deviceId",
|
|
24
|
+
Aa: "serviceWorkerScope",
|
|
25
|
+
zi: "dustHost",
|
|
26
|
+
Ta: "sdkFlavor",
|
|
26
27
|
tn: "openCardsInNewTab",
|
|
27
28
|
};
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
buildBrazeBridge as N,
|
|
4
4
|
} from "../../util/html-display-utils.js";
|
|
5
5
|
import E from "../../../shared-lib/logger.js";
|
|
6
|
-
import { logBannerClick
|
|
6
|
+
import { logBannerClick } from "../log-banner-click.js";
|
|
7
7
|
export const BANNER_PLACEMENT_ID = "data-ab-banner-placement-id";
|
|
8
8
|
export const BANNER_HTML_CLASS = "ab-html-banner";
|
|
9
9
|
export const CONTROL_BANNER_HTML_CLASS = "ab-html-control-banner";
|
|
@@ -32,7 +32,7 @@ export function bannerToHtml(n, t) {
|
|
|
32
32
|
o && o.length > 0 && e.setAttribute("title", o[0].textContent || "");
|
|
33
33
|
const r = Object.assign(Object.assign({}, N(e)), {
|
|
34
34
|
logClick: function () {
|
|
35
|
-
|
|
35
|
+
logBannerClick(n, ...arguments);
|
|
36
36
|
},
|
|
37
37
|
closeMessage: function () {},
|
|
38
38
|
setBannerHeight: (n) => {
|
|
@@ -4,18 +4,18 @@ import {
|
|
|
4
4
|
detectImpression as $,
|
|
5
5
|
} from "../../common/detect-impression.js";
|
|
6
6
|
import { topIsInView as g, bottomIsInView as x } from "../../util/dom-utils.js";
|
|
7
|
-
import { logBannerImpressions
|
|
7
|
+
import { logBannerImpressions } from "../log-banner-impressions.js";
|
|
8
8
|
import {
|
|
9
|
-
BANNER_HTML_CLASS as
|
|
10
|
-
BANNER_PLACEMENT_ID as
|
|
11
|
-
CONTROL_BANNER_HTML_CLASS as
|
|
9
|
+
BANNER_HTML_CLASS as B,
|
|
10
|
+
BANNER_PLACEMENT_ID as I,
|
|
11
|
+
CONTROL_BANNER_HTML_CLASS as k,
|
|
12
12
|
} from "./banner-to-html.js";
|
|
13
13
|
export function detectBannerImpressions() {
|
|
14
|
-
const o = document.querySelectorAll(`.${
|
|
14
|
+
const o = document.querySelectorAll(`.${B}, .${k}`),
|
|
15
15
|
t = [];
|
|
16
16
|
for (let n = 0; n < o.length; n++) {
|
|
17
17
|
const s = o[n],
|
|
18
|
-
i = s.getAttribute(
|
|
18
|
+
i = s.getAttribute(I);
|
|
19
19
|
if (!i) continue;
|
|
20
20
|
const m = $.oo(s),
|
|
21
21
|
r = $.no(s);
|
|
@@ -24,5 +24,5 @@ export function detectBannerImpressions() {
|
|
|
24
24
|
c = x(s);
|
|
25
25
|
e && !m && j(s), c && !r && d(s), $.oo(s) && $.no(s) && t.push(i);
|
|
26
26
|
}
|
|
27
|
-
t.length > 0 &&
|
|
27
|
+
t.length > 0 && logBannerImpressions(t);
|
|
28
28
|
}
|
package/src/Banner/index.js
CHANGED
|
@@ -4,3 +4,5 @@ export { insertBanner } from "./ui/insert-banner.js";
|
|
|
4
4
|
export { requestBannersRefresh } from "./request-banners-refresh.js";
|
|
5
5
|
export { getAllBanners } from "./get-all-banners.js";
|
|
6
6
|
export { subscribeToBannersUpdates } from "./subscribe-to-banners-updates.js";
|
|
7
|
+
export { logBannerImpressions } from "./log-banner-impressions.js";
|
|
8
|
+
export { logBannerClick } from "./log-banner-click.js";
|
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
BANNERS_DISABLED_MESSAGE as v,
|
|
4
4
|
BRAZE_MUST_BE_INITIALIZED_ERROR as w,
|
|
5
5
|
} from "../common/constants.js";
|
|
6
|
-
import r, { OPTIONS as
|
|
7
|
-
import { isArray as
|
|
8
|
-
import { isValidBannerPlacementId as
|
|
6
|
+
import r, { OPTIONS as q } from "../managers/braze-instance.js";
|
|
7
|
+
import { isArray as z } from "../util/code-utils.js";
|
|
8
|
+
import { isValidBannerPlacementId as D } from "../util/validation-utils.js";
|
|
9
9
|
import i from "./banner-provider-factory.js";
|
|
10
10
|
export function requestBannersRefresh(e, t, n) {
|
|
11
11
|
if (!r.rr()) return void E.warn(w);
|
|
12
12
|
const o = r.l();
|
|
13
13
|
if (!o) return;
|
|
14
|
-
if (!
|
|
14
|
+
if (!z(e) || 0 === e.length)
|
|
15
15
|
return void E.warn("placementIds should be a non-empty array.");
|
|
16
|
-
if (!r.ee(
|
|
16
|
+
if (!r.ee(q.re))
|
|
17
17
|
return void E.error(
|
|
18
18
|
"Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
|
|
19
19
|
);
|
|
@@ -31,7 +31,7 @@ export function requestBannersRefresh(e, t, n) {
|
|
|
31
31
|
0 !==
|
|
32
32
|
(e = e.filter(
|
|
33
33
|
(e) =>
|
|
34
|
-
!!
|
|
34
|
+
!!D(e) ||
|
|
35
35
|
(E.warn(
|
|
36
36
|
`Placement ID should be a valid utf8 string with no whitespaces, filtering out: ${e}`,
|
|
37
37
|
),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import E 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 q } 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";
|
|
@@ -12,15 +12,15 @@ export function insertBanner(o, e) {
|
|
|
12
12
|
if (!o) return void E.error("Not inserting banner: banner was not provided.");
|
|
13
13
|
if (!e)
|
|
14
14
|
return void E.error("Not inserting banner: parentNode was not provided.");
|
|
15
|
-
if (!r.ee(
|
|
15
|
+
if (!r.ee(q.re))
|
|
16
16
|
return void E.error(
|
|
17
17
|
"Banners are disabled. Use the 'allowUserSuppliedJavascript' option for braze.initialize to enable these messages.",
|
|
18
18
|
);
|
|
19
19
|
U();
|
|
20
|
-
const n = S(o, r.ee(
|
|
20
|
+
const n = S(o, r.ee(q.er)),
|
|
21
21
|
s = subscribeToBannersUpdates((s) => {
|
|
22
22
|
const i = s[o.placementId];
|
|
23
|
-
i ? e.replaceChildren(S(i, r.ee(
|
|
23
|
+
i ? e.replaceChildren(S(i, r.ee(q.er))) : A(n);
|
|
24
24
|
});
|
|
25
25
|
s && n.setAttribute(f, s), e.replaceChildren(n), J(window, "scroll", F), F();
|
|
26
26
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import M from "./card-manager.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
|
-
const
|
|
3
|
+
const _ = {
|
|
4
4
|
i: !1,
|
|
5
5
|
aa: null,
|
|
6
|
-
ea: () => (
|
|
6
|
+
ea: () => (_.t(), _.aa || (_.aa = new M(r.p())), _.aa),
|
|
7
7
|
t: () => {
|
|
8
|
-
|
|
8
|
+
_.i || (r.g(_), (_.i = !0));
|
|
9
9
|
},
|
|
10
10
|
destroy: () => {
|
|
11
|
-
(
|
|
11
|
+
(_.aa = null), (_.i = !1);
|
|
12
12
|
},
|
|
13
13
|
};
|
|
14
|
-
export default
|
|
14
|
+
export default _;
|
package/src/Card/card-manager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ControlCard } from "./models/index.js";
|
|
2
2
|
import c from "../common/event-logger.js";
|
|
3
|
-
import
|
|
3
|
+
import G from "../models/request-result.js";
|
|
4
4
|
import { logger as E, EventTypes as m } from "../../shared-lib/index.js";
|
|
5
5
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
6
6
|
export default class M {
|
|
@@ -8,7 +8,7 @@ export default class M {
|
|
|
8
8
|
(this.j = t), (this.j = t);
|
|
9
9
|
}
|
|
10
10
|
logClick(t) {
|
|
11
|
-
const n = new
|
|
11
|
+
const n = new G();
|
|
12
12
|
if ((t.$t(), null == t.url || "" === t.url))
|
|
13
13
|
return (
|
|
14
14
|
E.info(`Card ${t.id} has no url. Not logging click to Braze servers.`),
|
|
@@ -24,7 +24,7 @@ export default class M {
|
|
|
24
24
|
return c.rt(i, r);
|
|
25
25
|
}
|
|
26
26
|
Jt(t) {
|
|
27
|
-
const n = new
|
|
27
|
+
const n = new G();
|
|
28
28
|
if (!t.Kt())
|
|
29
29
|
return (
|
|
30
30
|
E.info(
|
|
@@ -40,7 +40,7 @@ export default class M {
|
|
|
40
40
|
return null == r ? n : c.rt(m.Mt, r);
|
|
41
41
|
}
|
|
42
42
|
Ot(t) {
|
|
43
|
-
const n = new
|
|
43
|
+
const n = new G(!0),
|
|
44
44
|
r = [],
|
|
45
45
|
i = [];
|
|
46
46
|
let o = {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createCloseButton as T } from "../../util/component-utils.js";
|
|
2
|
-
import { detectSwipe as
|
|
3
|
-
import { _handleBrazeAction as
|
|
2
|
+
import { detectSwipe as H, DIRECTIONS as R } from "../../util/dom-utils.js";
|
|
3
|
+
import { _handleBrazeAction as K } from "../../Core/handle-braze-action.js";
|
|
4
4
|
import { logCardDismissal } from "../index.js";
|
|
5
|
-
import { Guid as
|
|
5
|
+
import { Guid as L } from "../../../shared-lib/index.js";
|
|
6
6
|
export function markCardAsRead(t) {
|
|
7
7
|
if (null != t) {
|
|
8
8
|
const e = t.querySelectorAll(".ab-unread-indicator")[0];
|
|
@@ -37,7 +37,7 @@ export function cardToHtml(t, e, a, o = "ltr") {
|
|
|
37
37
|
let n = "",
|
|
38
38
|
d = !1;
|
|
39
39
|
t.url && "" !== t.url && ((n = t.url), (d = !0));
|
|
40
|
-
const r = (o) => (markCardAsRead(i), d && (e(t),
|
|
40
|
+
const r = (o) => (markCardAsRead(i), d && (e(t), K(n, a, o)), !1);
|
|
41
41
|
if (t.pinned) {
|
|
42
42
|
const t = document.createElement("div");
|
|
43
43
|
t.className = "ab-pinned-indicator";
|
|
@@ -74,10 +74,10 @@ export function cardToHtml(t, e, a, o = "ltr") {
|
|
|
74
74
|
t.logCardDismissal = () => logCardDismissal(t);
|
|
75
75
|
const e = T("Dismiss Card", void 0, t.dismissCard.bind(t), o);
|
|
76
76
|
i.appendChild(e),
|
|
77
|
-
|
|
77
|
+
H(c, R.Zt, (t) => {
|
|
78
78
|
(i.className += " ab-swiped-left"), e.onclick(t);
|
|
79
79
|
}),
|
|
80
|
-
|
|
80
|
+
H(c, R.ae, (t) => {
|
|
81
81
|
(i.className += " ab-swiped-right"), e.onclick(t);
|
|
82
82
|
});
|
|
83
83
|
}
|
|
@@ -87,7 +87,7 @@ export function cardToHtml(t, e, a, o = "ltr") {
|
|
|
87
87
|
const t = document.createElement("h1");
|
|
88
88
|
if (
|
|
89
89
|
((t.className = "ab-title"),
|
|
90
|
-
(t.id =
|
|
90
|
+
(t.id = L.oe()),
|
|
91
91
|
i.setAttribute("aria-labelledby", t.id),
|
|
92
92
|
d)
|
|
93
93
|
) {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Card } from "./models/index.js";
|
|
2
|
-
import
|
|
3
|
-
import { MUST_BE_CARD_WARNING_SUFFIX as
|
|
2
|
+
import _ from "./card-manager-factory.js";
|
|
3
|
+
import { MUST_BE_CARD_WARNING_SUFFIX as O } from "../common/constants.js";
|
|
4
4
|
import r from "../managers/braze-instance.js";
|
|
5
5
|
import { logger as E } from "../../shared-lib/index.js";
|
|
6
6
|
export function logCardDismissal(o) {
|
|
7
7
|
return (
|
|
8
8
|
!!r.rr() &&
|
|
9
|
-
(o instanceof Card ?
|
|
9
|
+
(o instanceof Card ? _.ea().Jt(o).W : (E.error("card " + O), !1))
|
|
10
10
|
);
|
|
11
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import E from "../../shared-lib/logger.js";
|
|
2
|
-
import { MUST_BE_CARD_WARNING_SUFFIX as
|
|
2
|
+
import { MUST_BE_CARD_WARNING_SUFFIX as O } from "../common/constants.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
|
-
import
|
|
4
|
+
import _ from "./card-manager-factory.js";
|
|
5
5
|
import { Card } from "./models/index.js";
|
|
6
6
|
export function logContentCardClick(o) {
|
|
7
7
|
return (
|
|
8
8
|
!!r.rr() &&
|
|
9
|
-
(o instanceof Card ?
|
|
9
|
+
(o instanceof Card ? _.ea().logClick(o).W : (E.error("card " + O), !1))
|
|
10
10
|
);
|
|
11
11
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Card } from "./models/index.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
|
-
import { isArray as
|
|
3
|
+
import { isArray as z } from "../util/code-utils.js";
|
|
4
4
|
import E from "../../shared-lib/logger.js";
|
|
5
|
-
import { MUST_BE_CARD_WARNING_SUFFIX as
|
|
6
|
-
import
|
|
5
|
+
import { MUST_BE_CARD_WARNING_SUFFIX as O } from "../common/constants.js";
|
|
6
|
+
import _ from "./card-manager-factory.js";
|
|
7
7
|
export function logContentCardImpressions(o) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
|
-
if (!
|
|
9
|
+
if (!z(o)) return E.error("cards must be an array"), !1;
|
|
10
10
|
for (const r of o)
|
|
11
|
-
if (!(r instanceof Card)) return E.error(`Each card in cards ${
|
|
12
|
-
return
|
|
11
|
+
if (!(r instanceof Card)) return E.error(`Each card in cards ${O}`), !1;
|
|
12
|
+
return _.ea().Ot(o).W;
|
|
13
13
|
}
|
package/src/Card/models/card.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
-
convertMsToSeconds as
|
|
3
|
-
dateFromUnixTimestamp as
|
|
2
|
+
convertMsToSeconds as P,
|
|
3
|
+
dateFromUnixTimestamp as X,
|
|
4
4
|
} from "../../util/date-utils.js";
|
|
5
|
-
import { FEED_ANIMATION_DURATION as
|
|
5
|
+
import { FEED_ANIMATION_DURATION as V } from "../../common/constants.js";
|
|
6
6
|
import u from "../../managers/subscription-manager.js";
|
|
7
7
|
import E from "../../../shared-lib/logger.js";
|
|
8
8
|
export default class Card {
|
|
@@ -77,7 +77,7 @@ export default class Card {
|
|
|
77
77
|
setTimeout(function () {
|
|
78
78
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
79
79
|
}, Card.ni));
|
|
80
|
-
},
|
|
80
|
+
}, V));
|
|
81
81
|
}
|
|
82
82
|
hi() {
|
|
83
83
|
return null == this.ti && (this.ti = new u()), this.ti;
|
|
@@ -107,7 +107,7 @@ export default class Card {
|
|
|
107
107
|
if (
|
|
108
108
|
null != t[Card.ui.ps] &&
|
|
109
109
|
null != this.updated &&
|
|
110
|
-
parseInt(t[Card.ui.ps]) <
|
|
110
|
+
parseInt(t[Card.ui.ps]) < P(this.updated.valueOf())
|
|
111
111
|
)
|
|
112
112
|
return !0;
|
|
113
113
|
if (
|
|
@@ -118,12 +118,12 @@ export default class Card {
|
|
|
118
118
|
null != t[Card.ui.ds] && (this.description = t[Card.ui.ds]),
|
|
119
119
|
null != t[Card.ui.ps])
|
|
120
120
|
) {
|
|
121
|
-
const i =
|
|
121
|
+
const i = X(t[Card.ui.ps]);
|
|
122
122
|
null != i && (this.updated = i);
|
|
123
123
|
}
|
|
124
124
|
if (null != t[Card.ui.us]) {
|
|
125
125
|
let i;
|
|
126
|
-
(i = t[Card.ui.us] === Card.Ti ? null :
|
|
126
|
+
(i = t[Card.ui.us] === Card.Ti ? null : X(t[Card.ui.us])),
|
|
127
127
|
(this.expiresAt = i);
|
|
128
128
|
}
|
|
129
129
|
if (
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
ImageOnly,
|
|
7
7
|
} from "../index.js";
|
|
8
8
|
import {
|
|
9
|
-
dateFromUnixTimestamp as
|
|
10
|
-
rehydrateDateAfterJsonization as
|
|
9
|
+
dateFromUnixTimestamp as X,
|
|
10
|
+
rehydrateDateAfterJsonization as Q,
|
|
11
11
|
} from "../../util/date-utils.js";
|
|
12
12
|
import { logger as E } from "../../../shared-lib/index.js";
|
|
13
13
|
export function newCard(e, n, r, t, i, o, l, u, d, a, f, s, w, m, p, C, c, x) {
|
|
@@ -33,9 +33,9 @@ export function newCardFromContentCardsJson(e) {
|
|
|
33
33
|
i = e[Card.ui.cs],
|
|
34
34
|
o = e[Card.ui.ns],
|
|
35
35
|
l = e[Card.ui.ds],
|
|
36
|
-
u =
|
|
36
|
+
u = X(e[Card.ui.ps]);
|
|
37
37
|
let d;
|
|
38
|
-
d = e[Card.ui.us] === Card.Ti ? null :
|
|
38
|
+
d = e[Card.ui.us] === Card.Ti ? null : X(e[Card.ui.us]);
|
|
39
39
|
return newCard(
|
|
40
40
|
n,
|
|
41
41
|
r,
|
|
@@ -66,8 +66,8 @@ export function newCardFromSerializedValue(e) {
|
|
|
66
66
|
e[Card.ss.cs],
|
|
67
67
|
e[Card.ss.ns],
|
|
68
68
|
e[Card.ss.ds],
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
Q(e[Card.ss.ps]),
|
|
70
|
+
Q(e[Card.ss.us]),
|
|
71
71
|
e[Card.ss.URL],
|
|
72
72
|
e[Card.ss.ls],
|
|
73
73
|
e[Card.ss.fs],
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import W from "./content-cards-provider.js";
|
|
3
|
+
const Y = {
|
|
4
4
|
i: !1,
|
|
5
5
|
provider: null,
|
|
6
6
|
o: () => (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
((
|
|
10
|
-
r.v(
|
|
11
|
-
|
|
7
|
+
Y.t(),
|
|
8
|
+
Y.provider ||
|
|
9
|
+
((Y.provider = new W(r.ir(), r.p(), r.l(), r.nr(), r.m())),
|
|
10
|
+
r.v(Y.provider),
|
|
11
|
+
r.tr("ccr", () => {
|
|
12
|
+
var r;
|
|
13
|
+
null === (r = Y.provider) || void 0 === r || r.ar();
|
|
14
|
+
})),
|
|
15
|
+
Y.provider
|
|
12
16
|
),
|
|
13
17
|
t: () => {
|
|
14
|
-
|
|
18
|
+
Y.i || (r.g(Y), (Y.i = !0));
|
|
15
19
|
},
|
|
16
20
|
destroy: () => {
|
|
17
|
-
(
|
|
21
|
+
(Y.provider = null), (Y.i = !1);
|
|
18
22
|
},
|
|
19
23
|
};
|
|
20
|
-
export default
|
|
24
|
+
export default Y;
|