@braze/web-sdk 5.8.0 → 5.9.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 +14 -9
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +25 -25
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +18 -18
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +16 -16
- package/src/Banner/banner-provider.js +90 -87
- package/src/Banner/banner.js +9 -9
- package/src/Banner/display/banner-to-html.js +32 -27
- package/src/Banner/get-all-banners.js +11 -5
- package/src/Banner/get-banner.js +7 -4
- package/src/Banner/log-banner-click.js +4 -4
- package/src/Banner/log-banner-impressions.js +6 -6
- package/src/Banner/request-banners-refresh.js +6 -3
- package/src/Banner/subscribe-to-banners-updates.js +7 -7
- package/src/Banner/ui/insert-banner.js +2 -2
- package/src/Card/card-manager.js +39 -39
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-click.js +2 -2
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-card-impressions.js +3 -3
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +96 -96
- 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 +43 -43
- package/src/ContentCards/content-cards-provider.js +156 -154
- 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 +6 -6
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/change-user.js +1 -1
- package/src/Core/disable-sdk.js +8 -8
- package/src/Core/enable-sdk.js +6 -6
- package/src/Core/get-device-id.js +2 -2
- 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 +8 -8
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/wipe-data.js +7 -5
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +15 -15
- package/src/FeatureFlags/feature-flags-provider.js +69 -63
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- 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-factory.js +1 -1
- package/src/Feed/feed-provider.js +44 -44
- 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 +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +25 -25
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/in-app-message-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +92 -92
- package/src/InAppMessage/log-in-app-message-button-click.js +7 -7
- 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 +82 -82
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +29 -29
- 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 +18 -18
- package/src/Push/push-manager-factory.js +1 -1
- package/src/Push/push-manager.js +94 -94
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +20 -20
- package/src/User/user.js +38 -38
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +7 -7
- package/src/common/feed-display.js +8 -8
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +14 -14
- package/src/managers/braze-instance.js +134 -133
- package/src/managers/device-manager.js +25 -25
- package/src/managers/network-manager.js +167 -161
- package/src/managers/server-config-manager.js +104 -92
- package/src/managers/session-manager.js +29 -29
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +86 -86
- package/src/managers/subscription-manager.js +11 -11
- 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 +4 -4
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +37 -37
- package/src/request-controller.js +159 -158
- package/src/triggers/models/custom-event-data.js +2 -2
- package/src/triggers/models/custom-event-property-data.js +4 -4
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +7 -7
- package/src/triggers/models/in-app-message-click-data.js +2 -2
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +36 -36
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +14 -14
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +72 -72
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- 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 +2 -2
- package/src/util/dom-utils.js +4 -4
- package/src/util/html-display-utils.js +14 -14
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +7 -7
- package/src/util/request-header-utils.js +21 -21
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +2 -2
- package/src/util/window-utils.js +2 -2
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.9.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
|
|
@@ -58,7 +58,8 @@ export class DeviceProperties {
|
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* Abstract base for news feed and Content Cards cards. Use subclasses `ClassicCard`, `CaptionedImage`,
|
|
61
|
-
* `ImageOnly`, and `ControlCard`.
|
|
61
|
+
* `ImageOnly`, and `ControlCard`. For example, you can check `if (card instanceof ClassicCard)` to
|
|
62
|
+
* determine if the card is of the type `ClassicCard`.
|
|
62
63
|
*/
|
|
63
64
|
export class Card {
|
|
64
65
|
/**
|
|
@@ -517,7 +518,8 @@ type CropType =
|
|
|
517
518
|
|
|
518
519
|
/**
|
|
519
520
|
* Abstract base for in-app messages. Use subclasses `SlideUpMessage`,
|
|
520
|
-
* `ModalMessage`, `FullScreenMessage`, and `HtmlMessage`.
|
|
521
|
+
* `ModalMessage`, `FullScreenMessage`, and `HtmlMessage`. For example, you can check `if (message instanceof FullScreenMessage)` to
|
|
522
|
+
* determine if the message is of the type `FullScreenMessage`.
|
|
521
523
|
*/
|
|
522
524
|
export class InAppMessage {
|
|
523
525
|
static SlideFrom: {
|
|
@@ -1446,7 +1448,7 @@ export class User {
|
|
|
1446
1448
|
/**
|
|
1447
1449
|
* Sets the LINE user ID for the user.
|
|
1448
1450
|
*
|
|
1449
|
-
* @param lineId - Must be a non-empty string no greater than 33 characters in length.
|
|
1451
|
+
* @param lineId - Must be a non-empty string no greater than 33 characters in length.
|
|
1450
1452
|
* Accepts an explicit null value to null out attribute.
|
|
1451
1453
|
*
|
|
1452
1454
|
* @returns Whether the update was successfully enqueued.
|
|
@@ -2162,7 +2164,7 @@ export function openSession(): void;
|
|
|
2162
2164
|
* - Create a `service-worker.js` file with the content below and place it in the root directory of your website:
|
|
2163
2165
|
*
|
|
2164
2166
|
* ```
|
|
2165
|
-
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2167
|
+
* self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.9/service-worker.js');
|
|
2166
2168
|
* ```
|
|
2167
2169
|
*
|
|
2168
2170
|
* For more details, see [Our Product Documentation](https://www.braze.com/docs/developer_guide/platform_integration_guides/web/push_notifications/integration).
|
|
@@ -2402,8 +2404,8 @@ export function handleBrazeAction(
|
|
|
2402
2404
|
* Gets a feature flag by its ID.
|
|
2403
2405
|
*
|
|
2404
2406
|
* @param id - The ID of the feature flag.
|
|
2405
|
-
* @returns - An object of type `FeatureFlag`, if feature flag with given ID
|
|
2406
|
-
*
|
|
2407
|
+
* @returns - An object of type `FeatureFlag`, if feature flag with given ID is enabled or explicitly disabled via experiment or canvas.
|
|
2408
|
+
* The method returns `null` if feature flag is not rolled out to the user or does not exist, or returns `undefined` if the SDK has not been initialized.
|
|
2407
2409
|
*/
|
|
2408
2410
|
export function getFeatureFlag(id: string): FeatureFlag | null | undefined;
|
|
2409
2411
|
|
|
@@ -2475,7 +2477,10 @@ export function getBanner(placementId: string): Banner | null | undefined;
|
|
|
2475
2477
|
* @param banner - The `Banner` to insert onto the page.
|
|
2476
2478
|
* @param parentNode - The HTML element to render the banner into.
|
|
2477
2479
|
*/
|
|
2478
|
-
export function insertBanner(
|
|
2480
|
+
export function insertBanner(
|
|
2481
|
+
banner: Banner | null | undefined,
|
|
2482
|
+
parentNode: HTMLElement,
|
|
2483
|
+
): void;
|
|
2479
2484
|
|
|
2480
2485
|
/**
|
|
2481
2486
|
* Logs that the user clicked the given banner. This should generally be called through the Braze JavaScript bridge
|
|
@@ -2630,7 +2635,7 @@ export type InitializationOptions = {
|
|
|
2630
2635
|
* lifecycle of, set this option to true and the Braze SDK will not register or unregister a service worker. If you set this
|
|
2631
2636
|
* option to true, in order for push to function correctly you must register the service worker yourself BEFORE calling
|
|
2632
2637
|
* `requestPushPermission`, and ensure that it contains Braze's service worker code, either with
|
|
2633
|
-
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.
|
|
2638
|
+
* `self.importScripts('https://js.appboycdn.com/web-sdk-develop/5.9/service-worker.js');` or by including the content
|
|
2634
2639
|
* of that file directly. When this option is true, the `serviceWorkerLocation` option is irrelevant and is ignored.
|
|
2635
2640
|
*/
|
|
2636
2641
|
manageServiceWorkerExternally?: boolean;
|
package/package.json
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
const d = {
|
|
2
2
|
CustomEvent: "ce",
|
|
3
3
|
Pr: "p",
|
|
4
|
-
|
|
4
|
+
bc: "pc",
|
|
5
5
|
Ac: "ca",
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
Su: "i",
|
|
7
|
+
qu: "ie",
|
|
8
|
+
ts: "cci",
|
|
9
|
+
rs: "ccic",
|
|
10
|
+
Mt: "ccc",
|
|
11
|
+
Wt: "ccd",
|
|
12
|
+
Fl: "ss",
|
|
13
13
|
Dl: "se",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
Ki: "si",
|
|
15
|
+
Li: "sc",
|
|
16
|
+
Qi: "sbc",
|
|
17
17
|
Mc: "sfe",
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
Do: "iec",
|
|
19
|
+
vc: "lr",
|
|
20
|
+
fc: "uae",
|
|
21
|
+
ss: "ci",
|
|
22
|
+
Ot: "cc",
|
|
23
|
+
yc: "lcaa",
|
|
24
|
+
kc: "lcar",
|
|
25
|
+
Hn: "inc",
|
|
26
|
+
On: "add",
|
|
27
|
+
Gn: "rem",
|
|
28
|
+
$n: "set",
|
|
29
|
+
Bn: "ncam",
|
|
30
|
+
jc: "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
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const K = {
|
|
2
|
+
ce: function () {
|
|
3
3
|
const t = (t = !1) => {
|
|
4
4
|
const n = (Math.random().toString(16) + "000000000").substr(2, 8);
|
|
5
5
|
return t ? "-" + n.substr(0, 4) + "-" + n.substr(4, 4) : n;
|
|
@@ -7,4 +7,4 @@ const G = {
|
|
|
7
7
|
return t() + t(!0) + t(!0) + t();
|
|
8
8
|
},
|
|
9
9
|
};
|
|
10
|
-
export default
|
|
10
|
+
export default K;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class st {
|
|
2
2
|
constructor(t, e) {
|
|
3
3
|
(this.database = t),
|
|
4
4
|
(this.vd = e),
|
|
@@ -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) => {
|
|
@@ -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
|
-
|
|
337
|
-
|
|
336
|
+
st.Ls = {
|
|
337
|
+
Fs: {
|
|
338
338
|
Sd: "AppboyServiceWorkerAsyncStorage",
|
|
339
339
|
VERSION: 6,
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
Ms: {
|
|
341
|
+
Nu: "data",
|
|
342
342
|
jr: "pushClicks",
|
|
343
343
|
cu: "pushSubscribed",
|
|
344
344
|
Cd: "fallbackDevice",
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
Js: "cardUpdates",
|
|
346
|
+
pe: "optOut",
|
|
347
347
|
kr: "pendingData",
|
|
348
348
|
yh: "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.9.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.9.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
|
+
Yo: "allowCrawlerActivity",
|
|
3
|
+
Zo: "baseUrl",
|
|
4
|
+
Wh: "noCookies",
|
|
5
|
+
Vh: "devicePropertyAllowlist",
|
|
6
6
|
Da: "disablePushTokenMaintenance",
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
$h: "enableLogging",
|
|
8
|
+
Yh: "enableSdkAuthentication",
|
|
9
9
|
Ca: "manageServiceWorkerExternally",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
Xh: "minimumIntervalBetweenTriggerActionsInSeconds",
|
|
11
|
+
Zh: "sessionTimeoutInSeconds",
|
|
12
|
+
Qh: "appVersion",
|
|
13
|
+
Ea: "appVersionNumber",
|
|
14
14
|
_a: "serviceWorkerLocation",
|
|
15
15
|
Ba: "safariWebsitePushId",
|
|
16
|
-
|
|
16
|
+
Zn: "localization",
|
|
17
17
|
er: "contentSecurityNonce",
|
|
18
18
|
re: "allowUserSuppliedJavascript",
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
Go: "inAppMessageZIndex",
|
|
20
|
+
Ko: "openInAppMessagesInNewTab",
|
|
21
21
|
en: "openNewsFeedCardsInNewTab",
|
|
22
22
|
mh: "requireExplicitInAppMessageDismissal",
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Ia: "doNotLoadFontAwesome",
|
|
24
|
+
Na: "deviceId",
|
|
25
25
|
Aa: "serviceWorkerScope",
|
|
26
|
-
|
|
26
|
+
Oa: "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,40 +11,40 @@ 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),
|
|
27
27
|
(this.I = null),
|
|
28
28
|
(this.q = null),
|
|
29
|
-
(this.
|
|
30
|
-
r.
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
29
|
+
(this.D = new u()),
|
|
30
|
+
r.F(this.D),
|
|
31
|
+
(this.N = null),
|
|
32
|
+
(this.k = 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
|
-
this.M(), this.
|
|
44
|
+
this.M(), this.D.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.
|
|
91
|
-
let
|
|
92
|
-
(null ==
|
|
93
|
-
(o = Math.min(3e5, a(1e3 * this.R, 3 *
|
|
90
|
+
if (((this.k = 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,96 @@ export default class e extends s {
|
|
|
109
109
|
i,
|
|
110
110
|
);
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
return this.
|
|
112
|
+
ht() {
|
|
113
|
+
return this.k;
|
|
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
|
-
|
|
161
|
-
return this.
|
|
160
|
+
Ct() {
|
|
161
|
+
return this.N;
|
|
162
162
|
}
|
|
163
|
-
|
|
164
|
-
this.
|
|
163
|
+
Tt(t) {
|
|
164
|
+
this.N = 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.
|
|
178
|
+
qt(t) {
|
|
179
|
+
return this.D.Dt(t);
|
|
180
180
|
}
|
|
181
|
-
|
|
182
|
-
var
|
|
181
|
+
Ft() {
|
|
182
|
+
var t;
|
|
183
183
|
return (
|
|
184
|
-
(null === (
|
|
184
|
+
(null === (t = this.C) || void 0 === t ? void 0 : t.ft(s.gt.Nt)) || {}
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
this.C && this.C.
|
|
187
|
+
kt(t) {
|
|
188
|
+
this.C && this.C.Bt(s.gt.Nt, t);
|
|
189
189
|
}
|
|
190
190
|
changeUser() {
|
|
191
|
-
this.
|
|
191
|
+
this.xt(), this.G();
|
|
192
|
+
}
|
|
193
|
+
clearData() {
|
|
194
|
+
this.G();
|
|
192
195
|
}
|
|
193
196
|
L() {
|
|
194
|
-
return !!this.B && (!!this.B.
|
|
197
|
+
return !!this.B && (!!this.B.zt() || (0 !== this.B.Et() && this.xt(), !1));
|
|
195
198
|
}
|
|
196
|
-
|
|
199
|
+
xt() {
|
|
197
200
|
(this.banners = {}),
|
|
198
|
-
this.C && (this.C.
|
|
199
|
-
this.
|
|
201
|
+
this.C && (this.C.Ut(s.gt.vt), this.C.Ut(s.gt.Nt)),
|
|
202
|
+
this.D.X({});
|
|
200
203
|
}
|
|
201
204
|
}
|
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
|
}
|