@braze/web-sdk 5.7.0 → 5.8.1
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 +23 -23
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +21 -21
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +18 -18
- package/src/Banner/banner-provider.js +79 -79
- package/src/Banner/banner.js +9 -9
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/get-all-banners.js +3 -4
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +21 -13
- package/src/Banner/subscribe-to-banners-updates.js +14 -13
- package/src/Banner/ui/insert-banner.js +11 -9
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +8 -8
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +3 -3
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +92 -92
- 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 +39 -39
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +142 -142
- package/src/ContentCards/content-cards.js +3 -3
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- 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 +8 -8
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +3 -3
- package/src/Core/disable-sdk.js +7 -7
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +7 -7
- package/src/Core/wipe-data.js +3 -3
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +19 -19
- package/src/FeatureFlags/feature-flags-provider.js +61 -61
- 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 +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +41 -41
- package/src/Feed/feed.js +2 -2
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +5 -5
- 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 +20 -20
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +89 -89
- package/src/InAppMessage/log-in-app-message-button-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +8 -8
- package/src/InAppMessage/models/in-app-message.js +83 -83
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +30 -30
- 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/show-in-app-message.js +19 -19
- package/src/Push/push-manager-factory.js +8 -8
- package/src/Push/push-manager.js +96 -96
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +41 -41
- package/src/common/base-feed.js +3 -3
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +10 -10
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +139 -139
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +151 -151
- package/src/managers/server-config-manager.js +86 -86
- package/src/managers/session-manager.js +38 -38
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +96 -96
- package/src/managers/subscription-manager.js +10 -10
- package/src/managers/utils.js +4 -4
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +152 -152
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +2 -2
- 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 +33 -33
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +74 -74
- 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 +7 -7
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +6 -6
- package/src/util/request-header-utils.js +21 -21
- 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.1
|
|
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
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
const d = {
|
|
2
2
|
CustomEvent: "ce",
|
|
3
3
|
Pr: "p",
|
|
4
|
-
|
|
4
|
+
fc: "pc",
|
|
5
5
|
Ac: "ca",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
Cu: "i",
|
|
7
|
+
bu: "ie",
|
|
8
|
+
ss: "cci",
|
|
9
|
+
os: "ccic",
|
|
10
|
+
Mt: "ccc",
|
|
11
|
+
Wt: "ccd",
|
|
12
|
+
Bl: "ss",
|
|
13
|
+
Dl: "se",
|
|
14
|
+
Li: "si",
|
|
15
|
+
Qi: "sc",
|
|
16
|
+
Vi: "sbc",
|
|
17
17
|
Mc: "sfe",
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
Eo: "iec",
|
|
19
|
+
mc: "lr",
|
|
20
|
+
dc: "uae",
|
|
21
|
+
ns: "ci",
|
|
22
|
+
Ot: "cc",
|
|
23
23
|
wc: "lcaa",
|
|
24
24
|
bc: "lcar",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
Gn: "inc",
|
|
26
|
+
Rn: "add",
|
|
27
|
+
On: "rem",
|
|
28
|
+
$n: "set",
|
|
29
|
+
Bn: "ncam",
|
|
30
30
|
kc: "sgu",
|
|
31
31
|
yr: "ffi",
|
|
32
32
|
ro: "bi",
|
|
33
|
-
|
|
33
|
+
ct: "bc",
|
|
34
34
|
},
|
|
35
35
|
dr = { Fr: "feed_displayed", Sc: "content_cards_displayed" };
|
|
36
36
|
export { d as EventTypes, dr as InternalEventTypes };
|
package/shared-lib/guid.js
CHANGED
|
@@ -64,11 +64,11 @@ export default class tt {
|
|
|
64
64
|
"...",
|
|
65
65
|
);
|
|
66
66
|
const n = null === (e = t.target) || void 0 === e ? void 0 : e.result;
|
|
67
|
-
for (const t in i.database.
|
|
67
|
+
for (const t in i.database.Ms) {
|
|
68
68
|
const e = t;
|
|
69
|
-
i.database.
|
|
70
|
-
!n.objectStoreNames.contains(i.database.
|
|
71
|
-
n.createObjectStore(i.database.
|
|
69
|
+
i.database.Ms.hasOwnProperty(t) &&
|
|
70
|
+
!n.objectStoreNames.contains(i.database.Ms[e]) &&
|
|
71
|
+
n.createObjectStore(i.database.Ms[e]);
|
|
72
72
|
}
|
|
73
73
|
}),
|
|
74
74
|
(o.onsuccess = (n) => {
|
|
@@ -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) => {
|
|
@@ -216,7 +216,7 @@ export default class tt {
|
|
|
216
216
|
});
|
|
217
217
|
}, n);
|
|
218
218
|
}
|
|
219
|
-
|
|
219
|
+
ge(t, e) {
|
|
220
220
|
if (!this.isSupported()) return !1;
|
|
221
221
|
const n = this;
|
|
222
222
|
return this.Bd((o) => {
|
|
@@ -249,7 +249,7 @@ export default class tt {
|
|
|
249
249
|
};
|
|
250
250
|
});
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
Ns(t, e) {
|
|
253
253
|
if (!this.isSupported()) return !1;
|
|
254
254
|
const n = this;
|
|
255
255
|
return this.Bd((o) => {
|
|
@@ -304,11 +304,11 @@ export default class tt {
|
|
|
304
304
|
clearData() {
|
|
305
305
|
if (!this.isSupported()) return !1;
|
|
306
306
|
const t = [];
|
|
307
|
-
for (const e in this.database.
|
|
307
|
+
for (const e in this.database.Ms) {
|
|
308
308
|
const n = e;
|
|
309
|
-
this.database.
|
|
310
|
-
this.database.
|
|
311
|
-
t.push(this.database.
|
|
309
|
+
this.database.Ms.hasOwnProperty(e) &&
|
|
310
|
+
this.database.Ms[n] !== this.database.Ms.pe &&
|
|
311
|
+
t.push(this.database.Ms[n]);
|
|
312
312
|
}
|
|
313
313
|
const e = this;
|
|
314
314
|
return this.Bd(function (n) {
|
|
@@ -333,20 +333,20 @@ export default class tt {
|
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
|
-
tt.
|
|
337
|
-
|
|
336
|
+
tt.Ls = {
|
|
337
|
+
Fs: {
|
|
338
338
|
Sd: "AppboyServiceWorkerAsyncStorage",
|
|
339
339
|
VERSION: 6,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
340
|
+
Ms: {
|
|
341
|
+
Nu: "data",
|
|
342
|
+
jr: "pushClicks",
|
|
343
343
|
cu: "pushSubscribed",
|
|
344
344
|
Cd: "fallbackDevice",
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
Js: "cardUpdates",
|
|
346
|
+
pe: "optOut",
|
|
347
|
+
kr: "pendingData",
|
|
348
|
+
qh: "sdkAuthenticationSignature",
|
|
349
349
|
},
|
|
350
|
-
|
|
350
|
+
be: 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.1)";
|
|
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.1)";
|
|
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
|
+
Yo: "allowCrawlerActivity",
|
|
3
|
+
Zo: "baseUrl",
|
|
4
|
+
Wh: "noCookies",
|
|
5
|
+
Vh: "devicePropertyAllowlist",
|
|
6
6
|
Da: "disablePushTokenMaintenance",
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Kh: "enableLogging",
|
|
8
|
+
$h: "enableSdkAuthentication",
|
|
9
9
|
Ca: "manageServiceWorkerExternally",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
Yh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Xh: "sessionTimeoutInSeconds",
|
|
12
|
+
Zh: "appVersion",
|
|
13
|
+
Qh: "appVersionNumber",
|
|
14
14
|
_a: "serviceWorkerLocation",
|
|
15
15
|
Ba: "safariWebsitePushId",
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
Xn: "localization",
|
|
17
|
+
er: "contentSecurityNonce",
|
|
18
|
+
re: "allowUserSuppliedJavascript",
|
|
19
|
+
No: "inAppMessageZIndex",
|
|
20
|
+
Ko: "openInAppMessagesInNewTab",
|
|
21
21
|
en: "openNewsFeedCardsInNewTab",
|
|
22
22
|
mh: "requireExplicitInAppMessageDismissal",
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Ea: "doNotLoadFontAwesome",
|
|
24
|
+
Ia: "deviceId",
|
|
25
25
|
Aa: "serviceWorkerScope",
|
|
26
|
-
|
|
26
|
+
Na: "sdkFlavor",
|
|
27
27
|
tn: "openCardsInNewTab",
|
|
28
28
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { STORAGE_KEYS as
|
|
1
|
+
import t from "../common/base-provider.js";
|
|
2
|
+
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
3
3
|
import {
|
|
4
4
|
newBannerFromJson as n,
|
|
5
5
|
newBannerFromSerializedValue as o,
|
|
@@ -11,16 +11,16 @@ import u from "../managers/subscription-manager.js";
|
|
|
11
11
|
import r from "../managers/braze-instance.js";
|
|
12
12
|
import c from "../common/event-logger.js";
|
|
13
13
|
import { EventTypes as d } from "../../shared-lib/event-types.js";
|
|
14
|
-
export default class e extends
|
|
15
|
-
constructor(
|
|
14
|
+
export default class e extends t {
|
|
15
|
+
constructor(t, s, i, e) {
|
|
16
16
|
super(),
|
|
17
|
-
(this.B =
|
|
18
|
-
(this.S =
|
|
17
|
+
(this.B = t),
|
|
18
|
+
(this.S = s),
|
|
19
19
|
(this.C = i),
|
|
20
20
|
(this.T = e),
|
|
21
21
|
(this.banners = {}),
|
|
22
|
-
(this.B =
|
|
23
|
-
(this.S =
|
|
22
|
+
(this.B = t),
|
|
23
|
+
(this.S = s),
|
|
24
24
|
(this.C = i),
|
|
25
25
|
(this.T = e),
|
|
26
26
|
(this.R = 10),
|
|
@@ -31,20 +31,20 @@ export default class e extends s {
|
|
|
31
31
|
(this.k = null),
|
|
32
32
|
(this.D = null);
|
|
33
33
|
}
|
|
34
|
-
U(
|
|
35
|
-
if (this.L() && null !=
|
|
34
|
+
U(t) {
|
|
35
|
+
if (this.L() && null != t && t.banners) {
|
|
36
36
|
this.banners = {};
|
|
37
|
-
const
|
|
38
|
-
for (const
|
|
39
|
-
const i = t
|
|
37
|
+
const s = t.banners;
|
|
38
|
+
for (const t in s) {
|
|
39
|
+
const i = s[t];
|
|
40
40
|
let e = null;
|
|
41
41
|
null != i && null != i.banner && (e = n(i.banner)),
|
|
42
|
-
e && (this.banners[
|
|
42
|
+
e && (this.banners[t] = e);
|
|
43
43
|
}
|
|
44
44
|
this.M(), this.F.X(this.banners);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
$(
|
|
47
|
+
$(t, s, i, e = !0) {
|
|
48
48
|
var n;
|
|
49
49
|
const r = () => {
|
|
50
50
|
"function" == typeof i && i();
|
|
@@ -54,7 +54,7 @@ export default class e extends s {
|
|
|
54
54
|
null === (n = this.B) ||
|
|
55
55
|
void 0 === n ||
|
|
56
56
|
n.A(() => {
|
|
57
|
-
this.$(
|
|
57
|
+
this.$(t, s, i);
|
|
58
58
|
})
|
|
59
59
|
);
|
|
60
60
|
const o = this.S;
|
|
@@ -62,7 +62,7 @@ export default class e extends s {
|
|
|
62
62
|
e && this.G();
|
|
63
63
|
const u = o.H({}, !0),
|
|
64
64
|
c = [];
|
|
65
|
-
for (const
|
|
65
|
+
for (const s of t) c.push({ id: s });
|
|
66
66
|
u.placements = c;
|
|
67
67
|
const d = o.J(u, h.O.K);
|
|
68
68
|
let m = !1;
|
|
@@ -78,27 +78,27 @@ export default class e extends s {
|
|
|
78
78
|
url: `${n.Z()}/banners/sync`,
|
|
79
79
|
headers: d,
|
|
80
80
|
data: u,
|
|
81
|
-
|
|
82
|
-
if (!n.
|
|
83
|
-
n.
|
|
81
|
+
tt: (t) => {
|
|
82
|
+
if (!n.st(u, t, d)) return (m = !0), void r();
|
|
83
|
+
n.it(), this.U(t), (m = !1), "function" == typeof s && s();
|
|
84
84
|
},
|
|
85
|
-
error: (
|
|
86
|
-
n.
|
|
85
|
+
error: (t) => {
|
|
86
|
+
n.et(t, "retrieving banners"), (m = !0), r();
|
|
87
87
|
},
|
|
88
|
-
|
|
88
|
+
nt: (e, r) => {
|
|
89
89
|
let o;
|
|
90
|
-
if (((this.D =
|
|
91
|
-
let
|
|
92
|
-
(null ==
|
|
93
|
-
(o = Math.min(3e5, a(1e3 * this.R, 3 *
|
|
90
|
+
if (((this.D = t), m)) {
|
|
91
|
+
let t = this.I;
|
|
92
|
+
(null == t || t < 1e3 * this.R) && (t = 1e3 * this.R),
|
|
93
|
+
(o = Math.min(3e5, a(1e3 * this.R, 3 * t)));
|
|
94
94
|
}
|
|
95
|
-
n.
|
|
95
|
+
n.rt(
|
|
96
96
|
r,
|
|
97
97
|
() => {
|
|
98
|
-
this.$(
|
|
98
|
+
this.$(t, s, i, !1);
|
|
99
99
|
},
|
|
100
100
|
h.O.K,
|
|
101
|
-
(
|
|
101
|
+
(t) => this.ot(t),
|
|
102
102
|
() => this.G(),
|
|
103
103
|
o,
|
|
104
104
|
);
|
|
@@ -109,93 +109,93 @@ export default class e extends s {
|
|
|
109
109
|
i,
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
ht() {
|
|
113
113
|
return this.D;
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
const i = { id:
|
|
117
|
-
|
|
118
|
-
return c.
|
|
115
|
+
lt(t, s) {
|
|
116
|
+
const i = { id: t.id };
|
|
117
|
+
s && (i.bid = s);
|
|
118
|
+
return c.ut(d.ct, i).tt;
|
|
119
119
|
}
|
|
120
120
|
G() {
|
|
121
121
|
null != this.q && (clearTimeout(this.q), (this.q = null));
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
this.G(), (this.q =
|
|
123
|
+
ot(t) {
|
|
124
|
+
this.G(), (this.q = t);
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
let
|
|
128
|
-
this.C && (
|
|
126
|
+
dt() {
|
|
127
|
+
let t = {};
|
|
128
|
+
this.C && (t = this.C.ft(s.gt.vt));
|
|
129
129
|
const i = {};
|
|
130
|
-
for (const
|
|
130
|
+
for (const s in t) {
|
|
131
131
|
let e = null;
|
|
132
|
-
null != s
|
|
132
|
+
null != t[s] && (e = o(t[s])), e && (i[e.placementId] = e);
|
|
133
133
|
}
|
|
134
134
|
return i;
|
|
135
135
|
}
|
|
136
136
|
M() {
|
|
137
|
-
var
|
|
137
|
+
var t;
|
|
138
138
|
if (!this.C) return;
|
|
139
139
|
const i = {};
|
|
140
|
-
for (const
|
|
140
|
+
for (const s in this.banners) {
|
|
141
141
|
const e =
|
|
142
|
-
(null === (
|
|
142
|
+
(null === (t = this.banners[s]) || void 0 === t ? void 0 : t.bt()) ||
|
|
143
143
|
null;
|
|
144
|
-
i[
|
|
144
|
+
i[s] = e;
|
|
145
145
|
}
|
|
146
|
-
this.C.
|
|
146
|
+
this.C.Bt(s.gt.vt, i), this.jt();
|
|
147
147
|
}
|
|
148
|
-
|
|
149
|
-
var
|
|
150
|
-
null === (
|
|
151
|
-
void 0 ===
|
|
152
|
-
|
|
148
|
+
jt() {
|
|
149
|
+
var t, i;
|
|
150
|
+
null === (t = this.C) ||
|
|
151
|
+
void 0 === t ||
|
|
152
|
+
t.Bt(s.gt.yt, null === (i = this.T) || void 0 === i ? void 0 : i.St());
|
|
153
153
|
}
|
|
154
|
-
|
|
155
|
-
var
|
|
154
|
+
wt() {
|
|
155
|
+
var t;
|
|
156
156
|
return (
|
|
157
|
-
(null === (
|
|
157
|
+
(null === (t = this.C) || void 0 === t ? void 0 : t.ft(s.gt.yt)) || null
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
Ct() {
|
|
161
161
|
return this.k;
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
this.k =
|
|
163
|
+
Tt(t) {
|
|
164
|
+
this.k = t;
|
|
165
165
|
}
|
|
166
|
-
|
|
167
|
-
var
|
|
168
|
-
const
|
|
169
|
-
i = this.
|
|
170
|
-
return null != i &&
|
|
166
|
+
Rt() {
|
|
167
|
+
var t;
|
|
168
|
+
const s = null === (t = this.T) || void 0 === t ? void 0 : t.St(),
|
|
169
|
+
i = this.wt();
|
|
170
|
+
return null != i && s === i;
|
|
171
171
|
}
|
|
172
|
-
|
|
173
|
-
var
|
|
174
|
-
const
|
|
175
|
-
i = this.
|
|
176
|
-
return null == i ||
|
|
172
|
+
It() {
|
|
173
|
+
var t;
|
|
174
|
+
const s = null === (t = this.T) || void 0 === t ? void 0 : t.St(),
|
|
175
|
+
i = this.wt();
|
|
176
|
+
return null == i || s === i;
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
return this.F.
|
|
178
|
+
qt(t) {
|
|
179
|
+
return this.F.Ft(t);
|
|
180
180
|
}
|
|
181
|
-
|
|
182
|
-
var
|
|
181
|
+
Nt() {
|
|
182
|
+
var t;
|
|
183
183
|
return (
|
|
184
|
-
(null === (
|
|
184
|
+
(null === (t = this.C) || void 0 === t ? void 0 : t.ft(s.gt.kt)) || {}
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
this.C && this.C.
|
|
187
|
+
xt(t) {
|
|
188
|
+
this.C && this.C.Bt(s.gt.kt, t);
|
|
189
189
|
}
|
|
190
190
|
changeUser() {
|
|
191
|
-
this.
|
|
191
|
+
this.zt();
|
|
192
192
|
}
|
|
193
193
|
L() {
|
|
194
|
-
return !!this.B && (!!this.B.
|
|
194
|
+
return !!this.B && (!!this.B.Dt() || (0 !== this.B.Et() && this.zt(), !1));
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
zt() {
|
|
197
197
|
(this.banners = {}),
|
|
198
|
-
this.C && (this.C.
|
|
198
|
+
this.C && (this.C.Ut(s.gt.vt), this.C.Ut(s.gt.kt)),
|
|
199
199
|
this.F.X({});
|
|
200
200
|
}
|
|
201
201
|
}
|
package/src/Banner/banner.js
CHANGED
|
@@ -3,28 +3,28 @@ export default class Banner {
|
|
|
3
3
|
(this.id = t),
|
|
4
4
|
(this.placementId = i),
|
|
5
5
|
(this.html = s),
|
|
6
|
-
(this.
|
|
6
|
+
(this.At = h),
|
|
7
7
|
(this.isControl = r),
|
|
8
|
-
(this.
|
|
8
|
+
(this.Gt = e),
|
|
9
9
|
(this.id = t),
|
|
10
10
|
(this.placementId = i),
|
|
11
11
|
(this.html = s),
|
|
12
|
-
(this.
|
|
12
|
+
(this.At = h),
|
|
13
13
|
(this.isControl = r),
|
|
14
|
-
(this.
|
|
15
|
-
(this.
|
|
14
|
+
(this.Gt = e),
|
|
15
|
+
(this.Ht = !1);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
Jt() {
|
|
18
18
|
return this.isControl;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
bt() {
|
|
21
21
|
return {
|
|
22
22
|
id: this.id,
|
|
23
23
|
o: this.placementId,
|
|
24
24
|
html: this.html,
|
|
25
|
-
t: this.
|
|
25
|
+
t: this.At,
|
|
26
26
|
i: this.isControl,
|
|
27
|
-
u: this.
|
|
27
|
+
u: this.Gt,
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -19,7 +19,7 @@ export function controlBannerToHtml(t) {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
export function bannerToHtml(t, n) {
|
|
22
|
-
if (t.
|
|
22
|
+
if (t.Jt()) return controlBannerToHtml(t);
|
|
23
23
|
const o = document.createElement("iframe");
|
|
24
24
|
return (
|
|
25
25
|
(o.id = t.id),
|
|
@@ -37,7 +37,7 @@ export function bannerToHtml(t, n) {
|
|
|
37
37
|
{},
|
|
38
38
|
b(o, () => {
|
|
39
39
|
import("../../Feed/ui/show-feed.js").then((t) => {
|
|
40
|
-
r.
|
|
40
|
+
r._t() ? t.showFeed() : N.error(p);
|
|
41
41
|
});
|
|
42
42
|
}),
|
|
43
43
|
),
|
|
@@ -1,13 +1,12 @@
|
|
|
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 (
|
|
10
|
-
const o = i.m().
|
|
7
|
+
t = r.v();
|
|
8
|
+
if (t && !t.Dt()) return n;
|
|
9
|
+
const o = i.m().dt();
|
|
11
10
|
for (const r in o) n[r] = v(o, r);
|
|
12
11
|
return n;
|
|
13
12
|
}
|
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.Gt,
|
|
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.dt(), n);
|
|
19
19
|
}
|
|
@@ -10,11 +10,11 @@ export function logBannerClick(n, o) {
|
|
|
10
10
|
N.error("Banner argument to logBannerClick must be an Banner object."), !1
|
|
11
11
|
);
|
|
12
12
|
const e = i.m(),
|
|
13
|
-
t = e.
|
|
13
|
+
t = e.dt();
|
|
14
14
|
return 0 === y(t).length
|
|
15
15
|
? (N.info("Not logging banner click. No banners exist."), !1)
|
|
16
16
|
: t[n.placementId]
|
|
17
|
-
? e.
|
|
17
|
+
? e.lt(n, o)
|
|
18
18
|
: (N.info(
|
|
19
19
|
`Not logging banner click for ID ${n.placementId}. The placement ID did not correspond to any banner.`,
|
|
20
20
|
),
|