@braze/web-sdk 5.6.1 → 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/README.md +1 -1
- package/index.d.ts +15 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +23 -23
- package/shared-lib/indexed-db-adapter.js +20 -20
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +17 -17
- package/src/Banner/banner-provider.js +53 -50
- package/src/Banner/banner.js +1 -1
- package/src/Banner/get-all-banners.js +3 -4
- package/src/Banner/get-banner.js +11 -11
- package/src/Banner/log-banner-click.js +1 -1
- 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 +10 -10
- package/src/Card/log-card-impressions.js +2 -2
- package/src/Card/models/captioned-image.js +1 -1
- package/src/Card/models/card.js +3 -3
- package/src/Card/models/classic-card.js +1 -1
- package/src/Card/models/control-card.js +1 -1
- package/src/Card/models/image-only.js +1 -1
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +139 -180
- 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 +10 -10
- 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/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +3 -3
- package/src/Core/log-purchase.js +1 -1
- package/src/Core/open-session.js +9 -9
- package/src/Core/wipe-data.js +5 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +18 -18
- package/src/FeatureFlags/feature-flags-provider.js +81 -78
- 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 +34 -34
- package/src/Feed/feed.js +2 -2
- package/src/Feed/get-cached-feed.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 +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
- package/src/InAppMessage/display/modal-utils.js +6 -6
- 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 +115 -91
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +5 -5
- package/src/InAppMessage/models/html-message.js +10 -10
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +42 -42
- package/src/InAppMessage/models/modal-message.js +5 -5
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- 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 +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 +12 -12
- package/src/User/user-manager.js +12 -12
- package/src/User/user.js +48 -36
- package/src/common/base-feed.js +3 -3
- package/src/common/constants.js +1 -1
- package/src/common/event-logger.js +4 -4
- package/src/common/feed-display.js +14 -14
- package/src/l10n/l10n-manager-factory.js +2 -2
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +10 -10
- package/src/managers/braze-instance.js +128 -128
- package/src/managers/device-manager.js +18 -18
- package/src/managers/network-manager.js +184 -147
- package/src/managers/server-config-manager.js +63 -63
- package/src/managers/session-manager.js +27 -27
- package/src/managers/storage-manager-factory.js +10 -10
- package/src/managers/storage-manager.js +146 -146
- package/src/managers/subscription-manager.js +8 -8
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +4 -4
- package/src/models/braze-event.js +8 -8
- 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/server-config.js +31 -31
- package/src/request-controller.js +163 -151
- package/src/triggers/models/custom-event-data.js +5 -5
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +16 -16
- 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 +37 -37
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +39 -39
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/iam-css.js +1 -1
- 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 +6 -6
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/html-display-utils.js +1 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +22 -23
- package/src/util/request-header-utils.js +25 -22
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/validation-utils.js +17 -17
- package/src/util/window-utils.js +2 -2
|
@@ -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
|
}
|
package/src/Card/card-manager.js
CHANGED
|
@@ -15,13 +15,13 @@ export default class M {
|
|
|
15
15
|
r
|
|
16
16
|
);
|
|
17
17
|
if (n && s.id && this.C) {
|
|
18
|
-
const n = this.C.
|
|
19
|
-
(n[s.id] = !0), this.C.
|
|
18
|
+
const n = this.C.vs(t.gs.ot) || {};
|
|
19
|
+
(n[s.id] = !0), this.C.Bs(t.gs.ot, n);
|
|
20
20
|
}
|
|
21
21
|
const i = this.et([s]);
|
|
22
22
|
if (null == i) return r;
|
|
23
23
|
const o = n ? d.lt : d.ut;
|
|
24
|
-
return c.
|
|
24
|
+
return c.cs(o, i);
|
|
25
25
|
}
|
|
26
26
|
ct(s) {
|
|
27
27
|
const n = new E();
|
|
@@ -33,18 +33,18 @@ export default class M {
|
|
|
33
33
|
n
|
|
34
34
|
);
|
|
35
35
|
if (s.id && this.C) {
|
|
36
|
-
const n = this.C.
|
|
37
|
-
(n[s.id] = !0), this.C.
|
|
36
|
+
const n = this.C.vs(t.gs.gt) || {};
|
|
37
|
+
(n[s.id] = !0), this.C.Bs(t.gs.gt, n);
|
|
38
38
|
}
|
|
39
39
|
const r = this.et([s]);
|
|
40
|
-
return null == r ? n : c.
|
|
40
|
+
return null == r ? n : c.cs(d.dt, r);
|
|
41
41
|
}
|
|
42
42
|
jt(s, n) {
|
|
43
43
|
const r = new E(!0),
|
|
44
44
|
i = [],
|
|
45
45
|
o = [];
|
|
46
46
|
let e = {};
|
|
47
|
-
this.C && (e = n ? this.C.
|
|
47
|
+
this.C && (e = n ? this.C.vs(t.gs.vt) || {} : this.C.vs(t.gs.Ct) || {});
|
|
48
48
|
for (const t of s) {
|
|
49
49
|
t.wt()
|
|
50
50
|
? (t instanceof ControlCard ? o.push(t) : i.push(t),
|
|
@@ -57,14 +57,14 @@ export default class M {
|
|
|
57
57
|
a = this.et(o);
|
|
58
58
|
if (null == l && null == a) return (r.ss = !1), r;
|
|
59
59
|
if (
|
|
60
|
-
(this.C && (n ? this.C.
|
|
60
|
+
(this.C && (n ? this.C.Bs(t.gs.vt, e) : this.C.Bs(t.gs.Ct, e)), null != l)
|
|
61
61
|
) {
|
|
62
62
|
const t = n ? d.xt : d.yt,
|
|
63
|
-
s = c.
|
|
63
|
+
s = c.cs(t, l);
|
|
64
64
|
r.It(s);
|
|
65
65
|
}
|
|
66
66
|
if (null != a && n) {
|
|
67
|
-
const t = c.
|
|
67
|
+
const t = c.cs(d.$t, a);
|
|
68
68
|
r.It(t);
|
|
69
69
|
}
|
|
70
70
|
return r;
|
|
@@ -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;
|
package/src/Card/models/card.js
CHANGED
|
@@ -50,10 +50,10 @@ export default class Card {
|
|
|
50
50
|
(this.Zt = null);
|
|
51
51
|
}
|
|
52
52
|
subscribeToClickedEvent(t) {
|
|
53
|
-
return this.ti().
|
|
53
|
+
return this.ti().Fs(t);
|
|
54
54
|
}
|
|
55
55
|
subscribeToDismissedEvent(t) {
|
|
56
|
-
return this.ii().
|
|
56
|
+
return this.ii().Fs(t);
|
|
57
57
|
}
|
|
58
58
|
removeSubscription(t) {
|
|
59
59
|
this.ti().removeSubscription(t), this.ii().removeSubscription(t);
|
|
@@ -142,7 +142,7 @@ export default class Card {
|
|
|
142
142
|
!0
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
bs() {
|
|
146
146
|
N.error("Must be implemented in a subclass");
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -1,80 +1,72 @@
|
|
|
1
|
-
import l
|
|
1
|
+
import l from "../util/net.js";
|
|
2
2
|
import s from "../common/base-provider.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import ContentCards from "./content-cards.js";
|
|
5
5
|
import { dateFromUnixTimestamp as O } from "../util/date-utils.js";
|
|
6
|
-
import { isURIJavascriptOrData as
|
|
6
|
+
import { isURIJavascriptOrData as X } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
|
-
newCardFromContentCardsJson as
|
|
9
|
-
newCardFromSerializedValue as
|
|
8
|
+
newCardFromContentCardsJson as Y,
|
|
9
|
+
newCardFromSerializedValue as Z,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
11
|
import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
12
12
|
import u from "../managers/subscription-manager.js";
|
|
13
|
-
import c from "../common/event-logger.js";
|
|
14
13
|
import h from "../util/request-header-utils.js";
|
|
15
14
|
import { randomInclusive as a } from "../util/math.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
logger as N,
|
|
19
|
-
IndexedDBAdapter as it,
|
|
20
|
-
EventTypes as d,
|
|
21
|
-
} from "../../shared-lib/index.js";
|
|
15
|
+
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
22
16
|
export default class Q extends s {
|
|
23
17
|
constructor(t, s, i, e, h) {
|
|
24
18
|
super(),
|
|
25
19
|
(this.As = t),
|
|
26
20
|
(this.C = s),
|
|
27
21
|
(this.B = i),
|
|
28
|
-
(this.
|
|
22
|
+
(this.Ls = e),
|
|
29
23
|
(this.S = h),
|
|
30
24
|
(this.As = t),
|
|
31
25
|
(this.C = s),
|
|
32
26
|
(this.B = i),
|
|
33
|
-
(this.
|
|
27
|
+
(this.Ls = e),
|
|
34
28
|
(this.S = h),
|
|
35
|
-
(this.
|
|
36
|
-
r.N(this.
|
|
29
|
+
(this.Js = new u()),
|
|
30
|
+
r.N(this.Js),
|
|
31
|
+
(this.Ms = 0),
|
|
37
32
|
(this.$s = 0),
|
|
38
|
-
(this.Ps = 0),
|
|
39
33
|
(this.cards = []),
|
|
40
|
-
this.
|
|
41
|
-
const n =
|
|
42
|
-
new
|
|
43
|
-
this.
|
|
34
|
+
this.Ps();
|
|
35
|
+
const n = tt._s.Xs;
|
|
36
|
+
new tt(n, N).Gs(n.Ks.Hs, (t) => {
|
|
37
|
+
this.Os(t);
|
|
44
38
|
}),
|
|
45
|
-
(this.
|
|
39
|
+
(this.Qs = null),
|
|
46
40
|
(this.k = null),
|
|
41
|
+
(this.Vs = null),
|
|
47
42
|
(this.Ws = null),
|
|
48
|
-
(this.Ys =
|
|
49
|
-
(this.Zs = null),
|
|
50
|
-
(this.fi = 10),
|
|
51
|
-
(this.di = 0);
|
|
43
|
+
(this.Ys = 10);
|
|
52
44
|
}
|
|
53
|
-
|
|
54
|
-
return this.
|
|
45
|
+
Zs() {
|
|
46
|
+
return this.Qs;
|
|
55
47
|
}
|
|
56
|
-
|
|
57
|
-
this.
|
|
48
|
+
fi(t) {
|
|
49
|
+
this.Qs = t;
|
|
58
50
|
}
|
|
59
|
-
|
|
51
|
+
Cs() {
|
|
60
52
|
return this.k;
|
|
61
53
|
}
|
|
62
|
-
|
|
54
|
+
Ts(t) {
|
|
63
55
|
this.k = t;
|
|
64
56
|
}
|
|
65
|
-
|
|
57
|
+
Ps() {
|
|
66
58
|
if (!this.C) return;
|
|
67
|
-
const s = this.C.
|
|
59
|
+
const s = this.C.vs(t.gs.di) || [],
|
|
68
60
|
i = [];
|
|
69
61
|
for (let t = 0; t < s.length; t++) {
|
|
70
|
-
const e =
|
|
62
|
+
const e = Z(s[t]);
|
|
71
63
|
null != e && i.push(e);
|
|
72
64
|
}
|
|
73
|
-
(this.cards = this.
|
|
74
|
-
(this
|
|
75
|
-
(this
|
|
65
|
+
(this.cards = this.pi(this.Ci(i, !1))),
|
|
66
|
+
(this.Ms = this.C.vs(t.gs.bi) || this.Ms),
|
|
67
|
+
(this.$s = this.C.vs(t.gs.vi) || this.$s);
|
|
76
68
|
}
|
|
77
|
-
|
|
69
|
+
wi(s, i = !1, e = 0, h = 0) {
|
|
78
70
|
let r;
|
|
79
71
|
if (i) {
|
|
80
72
|
r = [];
|
|
@@ -89,10 +81,10 @@ export default class Q extends s {
|
|
|
89
81
|
break;
|
|
90
82
|
}
|
|
91
83
|
if (i) {
|
|
92
|
-
const t =
|
|
84
|
+
const t = Y(e);
|
|
93
85
|
null != h && h.viewed && t && (t.viewed = !0), null != t && r.push(t);
|
|
94
86
|
} else if (null == h) {
|
|
95
|
-
const t =
|
|
87
|
+
const t = Y(e);
|
|
96
88
|
null != t && r.push(t);
|
|
97
89
|
} else {
|
|
98
90
|
if (!h.ni(e))
|
|
@@ -103,54 +95,28 @@ export default class Q extends s {
|
|
|
103
95
|
}
|
|
104
96
|
}
|
|
105
97
|
}
|
|
106
|
-
(this.cards = this.
|
|
107
|
-
this.
|
|
108
|
-
(this
|
|
109
|
-
(this
|
|
110
|
-
this.C && (this.C.
|
|
98
|
+
(this.cards = this.pi(this.Ci(r, i))),
|
|
99
|
+
this.gi(),
|
|
100
|
+
(this.Ms = e),
|
|
101
|
+
(this.$s = h),
|
|
102
|
+
this.C && (this.C.Bs(t.gs.bi, this.Ms), this.C.Bs(t.gs.vi, this.$s));
|
|
111
103
|
}
|
|
112
104
|
U(s) {
|
|
113
|
-
if (this.
|
|
114
|
-
this.C && this.C.
|
|
105
|
+
if (this.ji() && null != s && s.cards) {
|
|
106
|
+
this.C && this.C.Bs(t.gs.yi, r.Si());
|
|
115
107
|
const i = s.full_sync;
|
|
116
|
-
i || this.
|
|
117
|
-
this.
|
|
118
|
-
this.
|
|
108
|
+
i || this.Ps(),
|
|
109
|
+
this.wi(s.cards, i, s.last_full_sync_at, s.last_card_updated_at),
|
|
110
|
+
this.Js.X(this.Ri(!0));
|
|
119
111
|
}
|
|
120
112
|
}
|
|
121
|
-
|
|
122
|
-
this.
|
|
113
|
+
Ui(t) {
|
|
114
|
+
this.ki(), (this.Vs = t);
|
|
123
115
|
}
|
|
124
|
-
|
|
125
|
-
const h = () => {
|
|
126
|
-
this.zi(i, e, !0);
|
|
127
|
-
},
|
|
128
|
-
r = s ? X(s) : null;
|
|
129
|
-
let n;
|
|
130
|
-
if ((this.qi(), !r || !r["retry-after"])) return void this.Ai(0);
|
|
131
|
-
const o = r["retry-after"];
|
|
132
|
-
if (isNaN(o) && !isNaN(Date.parse(o)))
|
|
133
|
-
(n = Date.parse(o) - new Date().getTime()), n < 0 && h();
|
|
134
|
-
else {
|
|
135
|
-
if (isNaN(parseFloat(o.toString()))) {
|
|
136
|
-
const t =
|
|
137
|
-
"Received unexpected value for retry-after header in /sync response";
|
|
138
|
-
return c.ds(d.Li, { e: t + ": " + o }), void this.Ai(0);
|
|
139
|
-
}
|
|
140
|
-
n = 1e3 * parseFloat(o.toString());
|
|
141
|
-
}
|
|
142
|
-
this.Ws = window.setTimeout(() => {
|
|
143
|
-
h();
|
|
144
|
-
}, n);
|
|
145
|
-
let l = 0;
|
|
146
|
-
this.C && (l = this.C.ps(t.bs.Fi)),
|
|
147
|
-
(null == l || isNaN(parseInt(l.toString()))) && (l = 0),
|
|
148
|
-
this.Ai(parseInt(l.toString()) + 1);
|
|
149
|
-
}
|
|
150
|
-
Qs(t) {
|
|
116
|
+
Os(t) {
|
|
151
117
|
var s;
|
|
152
|
-
if (!this.
|
|
153
|
-
this.
|
|
118
|
+
if (!this.ji()) return;
|
|
119
|
+
this.Ps();
|
|
154
120
|
const i = this.cards.slice();
|
|
155
121
|
let e = null;
|
|
156
122
|
e = null === (s = this.As) || void 0 === s ? void 0 : s.getUserId();
|
|
@@ -164,7 +130,7 @@ export default class Q extends s {
|
|
|
164
130
|
break;
|
|
165
131
|
}
|
|
166
132
|
if (null == h) {
|
|
167
|
-
const t =
|
|
133
|
+
const t = Y(e);
|
|
168
134
|
null != t && i.push(t);
|
|
169
135
|
} else {
|
|
170
136
|
if (!h.ni(e))
|
|
@@ -175,16 +141,16 @@ export default class Q extends s {
|
|
|
175
141
|
}
|
|
176
142
|
}
|
|
177
143
|
}
|
|
178
|
-
(this.cards = this.
|
|
144
|
+
(this.cards = this.pi(this.Ci(i, !1))), this.gi(), this.Js.X(this.Ri(!0));
|
|
179
145
|
}
|
|
180
|
-
|
|
146
|
+
Ci(s, i) {
|
|
181
147
|
let e = {},
|
|
182
148
|
h = {},
|
|
183
149
|
r = {};
|
|
184
150
|
this.C &&
|
|
185
|
-
((e = this.C.
|
|
186
|
-
(h = this.C.
|
|
187
|
-
(r = this.C.
|
|
151
|
+
((e = this.C.vs(t.gs.ot) || {}),
|
|
152
|
+
(h = this.C.vs(t.gs.vt) || {}),
|
|
153
|
+
(r = this.C.vs(t.gs.gt) || {}));
|
|
188
154
|
const n = {},
|
|
189
155
|
o = {},
|
|
190
156
|
l = {};
|
|
@@ -198,19 +164,19 @@ export default class Q extends s {
|
|
|
198
164
|
return (
|
|
199
165
|
i &&
|
|
200
166
|
this.C &&
|
|
201
|
-
(this.C.
|
|
167
|
+
(this.C.Bs(t.gs.ot, n), this.C.Bs(t.gs.vt, o), this.C.Bs(t.gs.gt, l)),
|
|
202
168
|
s
|
|
203
169
|
);
|
|
204
170
|
}
|
|
205
|
-
|
|
171
|
+
pi(s) {
|
|
206
172
|
const i = [],
|
|
207
173
|
e = new Date();
|
|
208
174
|
let h = {};
|
|
209
|
-
this.C && (h = this.C.
|
|
175
|
+
this.C && (h = this.C.vs(t.gs.gt) || {});
|
|
210
176
|
let r = !1;
|
|
211
177
|
for (let t = 0; t < s.length; t++) {
|
|
212
178
|
const n = s[t].url;
|
|
213
|
-
if (!this.
|
|
179
|
+
if (!this.Ls && n && X(n)) {
|
|
214
180
|
N.error(
|
|
215
181
|
`Card with url ${n} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
|
|
216
182
|
);
|
|
@@ -225,92 +191,85 @@ export default class Q extends s {
|
|
|
225
191
|
i && (h[i] = !0), (r = !0);
|
|
226
192
|
}
|
|
227
193
|
}
|
|
228
|
-
return r && this.C && this.C.
|
|
194
|
+
return r && this.C && this.C.Bs(t.gs.gt, h), i;
|
|
229
195
|
}
|
|
230
|
-
|
|
196
|
+
gi() {
|
|
231
197
|
var s;
|
|
232
198
|
const i = [];
|
|
233
|
-
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].
|
|
234
|
-
null === (s = this.C) || void 0 === s || s.
|
|
235
|
-
}
|
|
236
|
-
qi() {
|
|
237
|
-
this.Ws && (clearTimeout(this.Ws), (this.Ws = null));
|
|
238
|
-
}
|
|
239
|
-
Ji() {
|
|
240
|
-
null != this.Ys && (clearTimeout(this.Ys), (this.Ys = null));
|
|
199
|
+
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].bs());
|
|
200
|
+
null === (s = this.C) || void 0 === s || s.Bs(t.gs.di, i);
|
|
241
201
|
}
|
|
242
|
-
|
|
243
|
-
this.
|
|
244
|
-
(this.Ys = window.setTimeout(() => {
|
|
245
|
-
this.zi(s, i, !0);
|
|
246
|
-
}, t)),
|
|
247
|
-
(this.Zs = t);
|
|
202
|
+
ki() {
|
|
203
|
+
this.Vs && (clearTimeout(this.Vs), (this.Vs = null));
|
|
248
204
|
}
|
|
249
|
-
|
|
250
|
-
var
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
if (!
|
|
254
|
-
if ((
|
|
205
|
+
Di(s, i, e = !1) {
|
|
206
|
+
var n;
|
|
207
|
+
const o = this.S,
|
|
208
|
+
u = this.C;
|
|
209
|
+
if (!o || !u) return void ("function" == typeof i && i());
|
|
210
|
+
if ((e && (h.zi(u, h.O.Ai), this.ki()), !this.ji()))
|
|
255
211
|
return void (
|
|
256
|
-
null === (
|
|
257
|
-
void 0 ===
|
|
258
|
-
|
|
259
|
-
this.
|
|
212
|
+
null === (n = this.B) ||
|
|
213
|
+
void 0 === n ||
|
|
214
|
+
n.qi(() => {
|
|
215
|
+
this.Di(s, i, !0);
|
|
260
216
|
})
|
|
261
217
|
);
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
f,
|
|
218
|
+
const c = o.H({}, !0);
|
|
219
|
+
u.vs(t.gs.yi) !== r.Si() && this.xi(),
|
|
220
|
+
(c.last_full_sync_at = this.Ms),
|
|
221
|
+
(c.last_card_updated_at = this.$s);
|
|
222
|
+
const f = o.J(c, h.O.Ai, e);
|
|
223
|
+
let d = !1;
|
|
224
|
+
o.V(
|
|
225
|
+
c,
|
|
271
226
|
(t = -1) => {
|
|
272
227
|
if (this.C) {
|
|
273
228
|
const t = new Date().valueOf();
|
|
274
|
-
h.W(this.C, h.O.
|
|
229
|
+
h.W(this.C, h.O.Ai, t);
|
|
275
230
|
}
|
|
276
|
-
-1 !== t &&
|
|
231
|
+
-1 !== t && f.push(["X-Braze-Req-Tokens-Remaining", t.toString()]),
|
|
277
232
|
l.Y({
|
|
278
|
-
url: `${
|
|
279
|
-
data:
|
|
280
|
-
headers:
|
|
281
|
-
ss: (t
|
|
282
|
-
if (!
|
|
283
|
-
return (
|
|
284
|
-
|
|
285
|
-
this.xi(e, s, i),
|
|
286
|
-
this.U(t),
|
|
287
|
-
(m = !1),
|
|
288
|
-
h.ns(this.C, h.O.Pi, 1),
|
|
289
|
-
"function" == typeof s && s();
|
|
233
|
+
url: `${o.Z()}/content_cards/sync`,
|
|
234
|
+
data: c,
|
|
235
|
+
headers: f,
|
|
236
|
+
ss: (t) => {
|
|
237
|
+
if (!o.ts(c, t, f))
|
|
238
|
+
return (d = !0), void ("function" == typeof i && i());
|
|
239
|
+
o.es(), this.U(t), (d = !1), "function" == typeof s && s();
|
|
290
240
|
},
|
|
291
241
|
error: (t) => {
|
|
292
|
-
|
|
293
|
-
(
|
|
242
|
+
o.ns(t, "retrieving content cards"),
|
|
243
|
+
(d = !0),
|
|
294
244
|
"function" == typeof i && i();
|
|
295
245
|
},
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
let t = this.
|
|
300
|
-
(null == t || t < 1e3 * this.
|
|
301
|
-
|
|
302
|
-
(this.di = this.di + 1);
|
|
246
|
+
rs: (t, e) => {
|
|
247
|
+
let r;
|
|
248
|
+
if (d) {
|
|
249
|
+
let t = this.Ws;
|
|
250
|
+
(null == t || t < 1e3 * this.Ys) && (t = 1e3 * this.Ys),
|
|
251
|
+
(r = Math.min(3e5, a(1e3 * this.Ys, 3 * t)));
|
|
303
252
|
}
|
|
253
|
+
o.os(
|
|
254
|
+
e,
|
|
255
|
+
() => {
|
|
256
|
+
this.Di(s, i, !1);
|
|
257
|
+
},
|
|
258
|
+
h.O.Ai,
|
|
259
|
+
(t) => this.Ui(t),
|
|
260
|
+
() => this.ki(),
|
|
261
|
+
r,
|
|
262
|
+
);
|
|
304
263
|
},
|
|
305
264
|
});
|
|
306
265
|
},
|
|
307
|
-
h.O.
|
|
266
|
+
h.O.Ai,
|
|
308
267
|
i,
|
|
309
268
|
);
|
|
310
269
|
}
|
|
311
|
-
|
|
312
|
-
s || this.
|
|
313
|
-
const i = this.
|
|
270
|
+
Ri(s) {
|
|
271
|
+
s || this.Ps();
|
|
272
|
+
const i = this.pi(this.cards);
|
|
314
273
|
i.sort((t, s) =>
|
|
315
274
|
t.pinned && !s.pinned
|
|
316
275
|
? -1
|
|
@@ -322,50 +281,50 @@ export default class Q extends s {
|
|
|
322
281
|
? 1
|
|
323
282
|
: 0,
|
|
324
283
|
);
|
|
325
|
-
let e = Math.max(this
|
|
284
|
+
let e = Math.max(this.$s || 0, this.Ms || 0);
|
|
326
285
|
return (
|
|
327
286
|
0 === e && (e = void 0),
|
|
328
|
-
this.C && this.C.
|
|
287
|
+
this.C && this.C.vs(t.gs.vi) === this.$s && void 0 === e && (e = this.$s),
|
|
329
288
|
new ContentCards(i, O(e))
|
|
330
289
|
);
|
|
331
290
|
}
|
|
332
|
-
|
|
333
|
-
return this.
|
|
291
|
+
qs(t) {
|
|
292
|
+
return this.Js.Fs(t);
|
|
334
293
|
}
|
|
335
|
-
|
|
336
|
-
(this
|
|
337
|
-
(this
|
|
338
|
-
this.C && (this.C.
|
|
294
|
+
xi() {
|
|
295
|
+
(this.Ms = 0),
|
|
296
|
+
(this.$s = 0),
|
|
297
|
+
this.C && (this.C.Es(t.gs.bi), this.C.Es(t.gs.vi));
|
|
339
298
|
}
|
|
340
299
|
changeUser(s) {
|
|
341
300
|
s ||
|
|
342
301
|
((this.cards = []),
|
|
343
|
-
this.
|
|
302
|
+
this.Js.X(new ContentCards(this.cards.slice(), null)),
|
|
344
303
|
this.C &&
|
|
345
|
-
(this.C.
|
|
346
|
-
this.C.
|
|
347
|
-
this.C.
|
|
348
|
-
this.C.
|
|
349
|
-
this.
|
|
304
|
+
(this.C.Es(t.gs.di),
|
|
305
|
+
this.C.Es(t.gs.ot),
|
|
306
|
+
this.C.Es(t.gs.vt),
|
|
307
|
+
this.C.Es(t.gs.gt))),
|
|
308
|
+
this.xi();
|
|
350
309
|
}
|
|
351
310
|
clearData(s) {
|
|
352
|
-
(this
|
|
353
|
-
(this
|
|
311
|
+
(this.Ms = 0),
|
|
312
|
+
(this.$s = 0),
|
|
354
313
|
(this.cards = []),
|
|
355
|
-
this.
|
|
314
|
+
this.Js.X(new ContentCards(this.cards.slice(), null)),
|
|
356
315
|
s &&
|
|
357
316
|
this.C &&
|
|
358
|
-
(this.C.
|
|
359
|
-
this.C.
|
|
360
|
-
this.C.
|
|
361
|
-
this.C.
|
|
362
|
-
this.C.
|
|
363
|
-
this.C.
|
|
317
|
+
(this.C.Es(t.gs.di),
|
|
318
|
+
this.C.Es(t.gs.ot),
|
|
319
|
+
this.C.Es(t.gs.vt),
|
|
320
|
+
this.C.Es(t.gs.gt),
|
|
321
|
+
this.C.Es(t.gs.bi),
|
|
322
|
+
this.C.Es(t.gs.vi));
|
|
364
323
|
}
|
|
365
|
-
|
|
366
|
-
return !!this.B && (!!this.B.
|
|
324
|
+
ji() {
|
|
325
|
+
return !!this.B && (!!this.B.Fi() || (0 !== this.B.Us() && this.Li(), !1));
|
|
367
326
|
}
|
|
368
|
-
|
|
369
|
-
this.
|
|
327
|
+
Li() {
|
|
328
|
+
this.Js.X(new ContentCards([], new Date())), this.C && this.C.Es(t.gs.di);
|
|
370
329
|
}
|
|
371
330
|
}
|