@braze/web-sdk 4.9.0 → 5.0.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 +2204 -2230
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -1
- package/shared-lib/event-types.js +9 -9
- package/shared-lib/indexed-db-adapter.js +13 -13
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +8 -8
- package/src/Card/models/captioned-image.js +19 -19
- package/src/Card/models/card.js +95 -94
- package/src/Card/models/classic-card.js +19 -19
- package/src/Card/models/control-card.js +9 -9
- package/src/Card/models/image-only.js +21 -22
- package/src/Card/models/index.js +0 -1
- package/src/Card/util/card-factory.js +39 -39
- package/src/ContentCards/content-cards-provider.js +114 -114
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/index.js +0 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
- package/src/ContentCards/ui/hide-content-cards.js +2 -2
- package/src/ContentCards/ui/show-content-cards.js +14 -14
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +2 -2
- package/src/Core/disable-sdk.js +4 -4
- package/src/Core/enable-sdk.js +4 -4
- package/src/Core/get-device-id.js +9 -7
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/open-session.js +5 -5
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +4 -4
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +7 -7
- package/src/FeatureFlags/feature-flags-provider.js +50 -50
- package/src/FeatureFlags/get-all-feature-flags.js +1 -1
- package/src/FeatureFlags/get-feature-flag.js +3 -5
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +15 -15
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/ui/hide-feed.js +2 -2
- package/src/Feed/ui/show-feed.js +13 -13
- package/src/InAppMessage/display/html-message-to-html.js +11 -12
- package/src/InAppMessage/display/in-app-message-to-html.js +15 -15
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +38 -38
- package/src/InAppMessage/models/full-screen-message.js +31 -31
- package/src/InAppMessage/models/html-message.js +16 -16
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +46 -46
- package/src/InAppMessage/models/modal-message.js +30 -30
- package/src/InAppMessage/models/slide-up-message.js +26 -26
- package/src/InAppMessage/ui/show-in-app-message.js +9 -9
- 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.js +31 -31
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +8 -8
- package/src/User/user.js +38 -37
- package/src/common/base-feed.js +15 -14
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +32 -32
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/managers/auth-manager.js +6 -6
- package/src/managers/braze-instance.js +84 -92
- package/src/managers/device-manager.js +9 -9
- package/src/managers/network-manager.js +72 -69
- package/src/managers/server-config-manager.js +13 -13
- package/src/managers/session-manager.js +9 -9
- package/src/managers/storage-manager-factory.js +11 -11
- package/src/managers/storage-manager.js +110 -110
- package/src/managers/subscription-manager.js +3 -3
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +1 -1
- package/src/models/server-config.js +6 -6
- package/src/request-controller.js +129 -125
- package/src/triggers/models/custom-event-data.js +1 -1
- 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 +31 -31
- 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 +4 -4
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +32 -32
- package/src/triggers/triggers-provider.js +55 -55
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +11 -11
- package/src/util/client-hints-parser.js +5 -5
- package/src/util/component-utils.js +2 -2
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +4 -5
- package/src/util/dom-utils.js +5 -5
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +17 -17
- package/src/util/user-agent-parser.js +11 -16
- package/src/util/validation-utils.js +9 -9
- package/src/Card/models/banner.js +0 -31
- package/src/ContentCards/log-content-cards-displayed.js +0 -5
|
@@ -12,31 +12,31 @@ import {
|
|
|
12
12
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
13
13
|
export function newCard(e, n, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x, F) {
|
|
14
14
|
let b;
|
|
15
|
-
if (n === Card.
|
|
15
|
+
if (n === Card.et.Ot || n === Card.et.Mt)
|
|
16
16
|
b = new ClassicCard(e, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x);
|
|
17
|
-
else if (n === Card.
|
|
17
|
+
else if (n === Card.et.ht)
|
|
18
18
|
b = new CaptionedImage(e, t, o, i, l, u, d, a, s, w, f, m, C, p, c, x);
|
|
19
|
-
else if (n === Card.
|
|
19
|
+
else if (n === Card.et.Pt)
|
|
20
20
|
b = new ImageOnly(e, t, i, u, d, a, s, w, f, m, C, p, c, x);
|
|
21
21
|
else {
|
|
22
|
-
if (n !== Card.
|
|
22
|
+
if (n !== Card.et.Ut)
|
|
23
23
|
return r.j.error("Ignoring card with unknown type " + n), null;
|
|
24
24
|
b = new ControlCard(e, t, d, s, C, p);
|
|
25
25
|
}
|
|
26
26
|
return F && (b.test = F), b;
|
|
27
27
|
}
|
|
28
28
|
export function newCardFromContentCardsJson(e) {
|
|
29
|
-
if (e[Card.
|
|
30
|
-
const n = e[Card.
|
|
31
|
-
r = e[Card.
|
|
32
|
-
t = e[Card.
|
|
33
|
-
o = e[Card.
|
|
34
|
-
i = e[Card.
|
|
35
|
-
u = e[Card.
|
|
36
|
-
d = l(e[Card.
|
|
29
|
+
if (e[Card.Rt.Lt]) return null;
|
|
30
|
+
const n = e[Card.Rt.rt],
|
|
31
|
+
r = e[Card.Rt.st],
|
|
32
|
+
t = e[Card.Rt.ot],
|
|
33
|
+
o = e[Card.Rt.ct],
|
|
34
|
+
i = e[Card.Rt.nt],
|
|
35
|
+
u = e[Card.Rt.dt],
|
|
36
|
+
d = l(e[Card.Rt.ut]),
|
|
37
37
|
a = d;
|
|
38
38
|
let s;
|
|
39
|
-
s = e[Card.
|
|
39
|
+
s = e[Card.Rt.xt] === Card._t ? null : l(e[Card.Rt.xt]);
|
|
40
40
|
return newCard(
|
|
41
41
|
n,
|
|
42
42
|
r,
|
|
@@ -48,14 +48,14 @@ export function newCardFromContentCardsJson(e) {
|
|
|
48
48
|
d,
|
|
49
49
|
null,
|
|
50
50
|
s,
|
|
51
|
-
e[Card.
|
|
52
|
-
e[Card.
|
|
53
|
-
e[Card.
|
|
54
|
-
e[Card.
|
|
55
|
-
e[Card.
|
|
56
|
-
e[Card.
|
|
57
|
-
e[Card.
|
|
58
|
-
e[Card.
|
|
51
|
+
e[Card.Rt.URL],
|
|
52
|
+
e[Card.Rt.bt],
|
|
53
|
+
e[Card.Rt.gt],
|
|
54
|
+
e[Card.Rt.jt],
|
|
55
|
+
e[Card.Rt.zt],
|
|
56
|
+
e[Card.Rt.kt],
|
|
57
|
+
e[Card.Rt.qt],
|
|
58
|
+
e[Card.Rt.vt] || !1,
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
export function newCardFromFeedJson(e) {
|
|
@@ -81,24 +81,24 @@ export function newCardFromFeedJson(e) {
|
|
|
81
81
|
export function newCardFromSerializedValue(e) {
|
|
82
82
|
return (
|
|
83
83
|
newCard(
|
|
84
|
-
e[Card.
|
|
85
|
-
e[Card.
|
|
86
|
-
e[Card.
|
|
87
|
-
e[Card.
|
|
88
|
-
e[Card.
|
|
89
|
-
e[Card.
|
|
90
|
-
w(e[Card.
|
|
91
|
-
w(e[Card.
|
|
92
|
-
e[Card.
|
|
93
|
-
w(e[Card.
|
|
94
|
-
e[Card.
|
|
95
|
-
e[Card.
|
|
96
|
-
e[Card.
|
|
97
|
-
e[Card.
|
|
98
|
-
e[Card.
|
|
99
|
-
e[Card.
|
|
100
|
-
e[Card.
|
|
101
|
-
e[Card.
|
|
84
|
+
e[Card.it.rt],
|
|
85
|
+
e[Card.it.st],
|
|
86
|
+
e[Card.it.ot],
|
|
87
|
+
e[Card.it.ct],
|
|
88
|
+
e[Card.it.nt],
|
|
89
|
+
e[Card.it.dt],
|
|
90
|
+
w(e[Card.it.lt]),
|
|
91
|
+
w(e[Card.it.ut]),
|
|
92
|
+
e[Card.it.ft],
|
|
93
|
+
w(e[Card.it.xt]),
|
|
94
|
+
e[Card.it.URL],
|
|
95
|
+
e[Card.it.bt],
|
|
96
|
+
e[Card.it.gt],
|
|
97
|
+
e[Card.it.jt],
|
|
98
|
+
e[Card.it.zt],
|
|
99
|
+
e[Card.it.kt],
|
|
100
|
+
e[Card.it.qt],
|
|
101
|
+
e[Card.it.vt] || !1,
|
|
102
102
|
) || void 0
|
|
103
103
|
);
|
|
104
104
|
}
|
|
@@ -18,59 +18,59 @@ import { MAX_ERROR_RETRIES_CONTENT_CARDS as S } from "../common/constants.js";
|
|
|
18
18
|
export default class v extends y {
|
|
19
19
|
constructor(t, s, i, h, n) {
|
|
20
20
|
super(),
|
|
21
|
-
(this.
|
|
21
|
+
(this.wt = t),
|
|
22
22
|
(this.u = s),
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this
|
|
26
|
-
(this.
|
|
23
|
+
(this.yt = i),
|
|
24
|
+
(this.Jt = h),
|
|
25
|
+
(this.$t = n),
|
|
26
|
+
(this.wt = t),
|
|
27
27
|
(this.u = s),
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
30
|
-
(this
|
|
31
|
-
(this.
|
|
32
|
-
e.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
28
|
+
(this.yt = i),
|
|
29
|
+
(this.Jt = h),
|
|
30
|
+
(this.$t = n),
|
|
31
|
+
(this.Bt = new E()),
|
|
32
|
+
e.Ht(this.Bt),
|
|
33
|
+
(this.Kt = 0),
|
|
34
|
+
(this.Qt = 0),
|
|
35
35
|
(this.cards = []),
|
|
36
|
-
this.
|
|
37
|
-
const o = r.
|
|
38
|
-
new r.
|
|
39
|
-
this.
|
|
36
|
+
this.Yt();
|
|
37
|
+
const o = r.ts.Zt;
|
|
38
|
+
new r.es(o, r.j).ss(o.rs.hs, (t) => {
|
|
39
|
+
this.ns(t);
|
|
40
40
|
}),
|
|
41
|
-
(this
|
|
42
|
-
(this.
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
45
|
-
(this.
|
|
46
|
-
(this.
|
|
47
|
-
(this.
|
|
41
|
+
(this.os = null),
|
|
42
|
+
(this.ls = null),
|
|
43
|
+
(this.us = null),
|
|
44
|
+
(this.cs = null),
|
|
45
|
+
(this.fs = null),
|
|
46
|
+
(this.ds = 10),
|
|
47
|
+
(this.ps = 0);
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
return this
|
|
49
|
+
Cs() {
|
|
50
|
+
return this.os;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
this
|
|
52
|
+
ws(t) {
|
|
53
|
+
this.os = t;
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
return this.
|
|
55
|
+
bs() {
|
|
56
|
+
return this.ls;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
this.
|
|
58
|
+
vs(t) {
|
|
59
|
+
this.ls = t;
|
|
60
60
|
}
|
|
61
|
-
|
|
61
|
+
Yt() {
|
|
62
62
|
if (!this.u) return;
|
|
63
|
-
const t = this.u.v(i.k.
|
|
63
|
+
const t = this.u.v(i.k.gs) || [],
|
|
64
64
|
s = [];
|
|
65
65
|
for (let i = 0; i < t.length; i++) {
|
|
66
66
|
const e = R(t[i]);
|
|
67
67
|
null != e && s.push(e);
|
|
68
68
|
}
|
|
69
|
-
(this.cards = this.
|
|
70
|
-
(this.
|
|
71
|
-
(this.
|
|
69
|
+
(this.cards = this.ys(this.Ns(s, !1))),
|
|
70
|
+
(this.Kt = this.u.v(i.k.js) || this.Kt),
|
|
71
|
+
(this.Qt = this.u.v(i.k.Rs) || this.Qt);
|
|
72
72
|
}
|
|
73
|
-
|
|
73
|
+
Ts(t, s = !1, e = 0, h = 0) {
|
|
74
74
|
let r;
|
|
75
75
|
if (s) {
|
|
76
76
|
r = [];
|
|
@@ -91,7 +91,7 @@ export default class v extends y {
|
|
|
91
91
|
const t = j(e);
|
|
92
92
|
null != t && r.push(t);
|
|
93
93
|
} else {
|
|
94
|
-
if (!h.
|
|
94
|
+
if (!h.Ct(e))
|
|
95
95
|
for (let t = 0; t < r.length; t++)
|
|
96
96
|
if (e.id === r[t].id) {
|
|
97
97
|
r.splice(t, 1);
|
|
@@ -99,31 +99,31 @@ export default class v extends y {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
(this.cards = this.
|
|
103
|
-
this.
|
|
104
|
-
(this.
|
|
105
|
-
(this.
|
|
106
|
-
this.u && (this.u.D(i.k.
|
|
102
|
+
(this.cards = this.ys(this.Ns(r, s))),
|
|
103
|
+
this.Ds(),
|
|
104
|
+
(this.Kt = e),
|
|
105
|
+
(this.Qt = h),
|
|
106
|
+
this.u && (this.u.D(i.k.js, this.Kt), this.u.D(i.k.Rs, this.Qt));
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
if (this.
|
|
110
|
-
this.u && this.u.D(i.k.
|
|
108
|
+
Ss(t) {
|
|
109
|
+
if (this.ks() && null != t && t.cards) {
|
|
110
|
+
this.u && this.u.D(i.k.Us, e.As());
|
|
111
111
|
const s = t.full_sync;
|
|
112
|
-
s || this.
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
112
|
+
s || this.Yt(),
|
|
113
|
+
this.Ts(t.cards, s, t.last_full_sync_at, t.last_card_updated_at),
|
|
114
|
+
this.Bt.Dt(this.Ls(!0));
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
this.u && this.u.D(i.k.
|
|
117
|
+
Fs(t) {
|
|
118
|
+
this.u && this.u.D(i.k.zs, t);
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
Ms(t, e, h) {
|
|
121
121
|
const n = () => {
|
|
122
|
-
this.
|
|
122
|
+
this.xs(e, h, !0);
|
|
123
123
|
},
|
|
124
124
|
o = t ? b(t) : null;
|
|
125
125
|
let l;
|
|
126
|
-
if ((this.Es(), !o || !o["retry-after"])) return void this.
|
|
126
|
+
if ((this.Es(), !o || !o["retry-after"])) return void this.Fs(0);
|
|
127
127
|
const a = o["retry-after"];
|
|
128
128
|
if (isNaN(a) && !isNaN(Date.parse(a)))
|
|
129
129
|
(l = Date.parse(a) - new Date().getTime()), l < 0 && n();
|
|
@@ -131,24 +131,24 @@ export default class v extends y {
|
|
|
131
131
|
if (isNaN(parseFloat(a.toString()))) {
|
|
132
132
|
const t =
|
|
133
133
|
"Received unexpected value for retry-after header in /sync response";
|
|
134
|
-
return s.N(r.q.qs, { e: t + ": " + a }), void this.
|
|
134
|
+
return s.N(r.q.qs, { e: t + ": " + a }), void this.Fs(0);
|
|
135
135
|
}
|
|
136
136
|
l = 1e3 * parseFloat(a.toString());
|
|
137
137
|
}
|
|
138
|
-
this.
|
|
138
|
+
this.us = window.setTimeout(() => {
|
|
139
139
|
n();
|
|
140
140
|
}, l);
|
|
141
141
|
let u = 0;
|
|
142
|
-
this.u && (u = this.u.v(i.k.
|
|
142
|
+
this.u && (u = this.u.v(i.k.zs)),
|
|
143
143
|
(null == u || isNaN(parseInt(u.toString()))) && (u = 0),
|
|
144
|
-
this.
|
|
144
|
+
this.Fs(parseInt(u.toString()) + 1);
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
if (!this.
|
|
148
|
-
this.
|
|
146
|
+
ns(t) {
|
|
147
|
+
if (!this.ks()) return;
|
|
148
|
+
this.Yt();
|
|
149
149
|
const s = this.cards.slice();
|
|
150
150
|
let i = null;
|
|
151
|
-
this.
|
|
151
|
+
this.wt && (i = this.wt.getUserId());
|
|
152
152
|
for (let e = 0; e < t.length; e++)
|
|
153
153
|
if (i === t[e].userId || (null == i && null == t[e].userId)) {
|
|
154
154
|
const i = t[e].card;
|
|
@@ -162,7 +162,7 @@ export default class v extends y {
|
|
|
162
162
|
const t = j(i);
|
|
163
163
|
null != t && s.push(t);
|
|
164
164
|
} else {
|
|
165
|
-
if (!h.
|
|
165
|
+
if (!h.Ct(i))
|
|
166
166
|
for (let t = 0; t < s.length; t++)
|
|
167
167
|
if (i.id === s[t].id) {
|
|
168
168
|
s.splice(t, 1);
|
|
@@ -170,9 +170,9 @@ export default class v extends y {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
(this.cards = this.
|
|
173
|
+
(this.cards = this.ys(this.Ns(s, !1))), this.Ds(), this.Bt.Dt(this.Ls(!0));
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
Ns(t, s) {
|
|
176
176
|
let e = {},
|
|
177
177
|
h = {},
|
|
178
178
|
r = {};
|
|
@@ -197,7 +197,7 @@ export default class v extends y {
|
|
|
197
197
|
t
|
|
198
198
|
);
|
|
199
199
|
}
|
|
200
|
-
|
|
200
|
+
ys(t) {
|
|
201
201
|
const s = [],
|
|
202
202
|
e = new Date();
|
|
203
203
|
let h = {};
|
|
@@ -205,7 +205,7 @@ export default class v extends y {
|
|
|
205
205
|
let n = !1;
|
|
206
206
|
for (let i = 0; i < t.length; i++) {
|
|
207
207
|
const o = t[i].url;
|
|
208
|
-
if (!this.
|
|
208
|
+
if (!this.Jt && o && N(o)) {
|
|
209
209
|
r.j.error(
|
|
210
210
|
`Card with url ${o} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
|
|
211
211
|
);
|
|
@@ -222,51 +222,51 @@ export default class v extends y {
|
|
|
222
222
|
}
|
|
223
223
|
return n && this.u && this.u.D(i.k.G, h), s;
|
|
224
224
|
}
|
|
225
|
-
|
|
225
|
+
Ds() {
|
|
226
226
|
if (!this.u) return;
|
|
227
227
|
const t = [];
|
|
228
|
-
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].
|
|
229
|
-
this.u.D(i.k.
|
|
228
|
+
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].tt());
|
|
229
|
+
this.u.D(i.k.gs, t);
|
|
230
230
|
}
|
|
231
231
|
Es() {
|
|
232
|
-
this.
|
|
232
|
+
this.us && (clearTimeout(this.us), (this.us = null));
|
|
233
233
|
}
|
|
234
234
|
Is() {
|
|
235
|
-
null != this.
|
|
235
|
+
null != this.cs && (clearTimeout(this.cs), (this.cs = null));
|
|
236
236
|
}
|
|
237
|
-
Js(t = 1e3 * this.
|
|
237
|
+
Js(t = 1e3 * this.ds, s, i) {
|
|
238
238
|
this.Is(),
|
|
239
|
-
(this.
|
|
240
|
-
this.
|
|
239
|
+
(this.cs = window.setTimeout(() => {
|
|
240
|
+
this.xs(s, i, !0);
|
|
241
241
|
}, t)),
|
|
242
|
-
(this.
|
|
242
|
+
(this.fs = t);
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
xs(t, s, h = !1, n = !0) {
|
|
245
245
|
var o;
|
|
246
|
-
const l = this
|
|
246
|
+
const l = this.$t,
|
|
247
247
|
a = this.u;
|
|
248
248
|
if (!l || !a) return void ("function" == typeof s && s());
|
|
249
249
|
const u = !h;
|
|
250
|
-
if ((u && (this.Es(), this.
|
|
250
|
+
if ((u && (this.Es(), this.Fs(0)), !this.ks()))
|
|
251
251
|
return void (
|
|
252
|
-
this.
|
|
253
|
-
this.
|
|
254
|
-
this.
|
|
252
|
+
this.yt &&
|
|
253
|
+
this.yt.Ps(() => {
|
|
254
|
+
this.xs(t, s);
|
|
255
255
|
})
|
|
256
256
|
);
|
|
257
257
|
let c = !0;
|
|
258
258
|
if (
|
|
259
259
|
(u &&
|
|
260
|
-
(null === (o = this.
|
|
260
|
+
(null === (o = this.yt) || void 0 === o ? void 0 : o.$s()) &&
|
|
261
261
|
(c = this._s()),
|
|
262
262
|
!c)
|
|
263
263
|
)
|
|
264
264
|
return void r.j.info("Content card sync being throttled.");
|
|
265
265
|
n && this.Is();
|
|
266
266
|
const f = l.Bs({}, !0);
|
|
267
|
-
a.v(i.k.
|
|
268
|
-
(f.last_full_sync_at = this.
|
|
269
|
-
(f.last_card_updated_at = this.
|
|
267
|
+
a.v(i.k.Us) !== e.As() && this.Gs(),
|
|
268
|
+
(f.last_full_sync_at = this.Kt),
|
|
269
|
+
(f.last_card_updated_at = this.Qt);
|
|
270
270
|
const d = l.Hs(f, T.Os.Ks, h);
|
|
271
271
|
let m = !1;
|
|
272
272
|
l.Qs(f, () => {
|
|
@@ -282,8 +282,8 @@ export default class v extends y {
|
|
|
282
282
|
if (!l.Zs(f, i, d))
|
|
283
283
|
return (m = !0), void ("function" == typeof s && s());
|
|
284
284
|
l.ti(),
|
|
285
|
-
this.
|
|
286
|
-
this.
|
|
285
|
+
this.Ms(e, t, s),
|
|
286
|
+
this.Ss(i),
|
|
287
287
|
(m = !1),
|
|
288
288
|
T.si(this.u, T.Os.Ks, 1),
|
|
289
289
|
"function" == typeof t && t();
|
|
@@ -294,20 +294,20 @@ export default class v extends y {
|
|
|
294
294
|
"function" == typeof s && s();
|
|
295
295
|
},
|
|
296
296
|
ei: () => {
|
|
297
|
-
if (m && n && !this.
|
|
297
|
+
if (m && n && !this.cs && this.ps + 1 < S) {
|
|
298
298
|
T.hi(this.u, T.Os.Ks);
|
|
299
|
-
let i = this.
|
|
300
|
-
(null == i || i < 1e3 * this.
|
|
301
|
-
this.Js(Math.min(3e5, D(1e3 * this.
|
|
302
|
-
(this.
|
|
299
|
+
let i = this.fs;
|
|
300
|
+
(null == i || i < 1e3 * this.ds) && (i = 1e3 * this.ds),
|
|
301
|
+
this.Js(Math.min(3e5, D(1e3 * this.ds, 3 * i)), t, s),
|
|
302
|
+
(this.ps = this.ps + 1);
|
|
303
303
|
}
|
|
304
304
|
},
|
|
305
305
|
});
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
|
-
|
|
309
|
-
t || this.
|
|
310
|
-
const s = this.
|
|
308
|
+
Ls(t) {
|
|
309
|
+
t || this.Yt();
|
|
310
|
+
const s = this.ys(this.cards);
|
|
311
311
|
s.sort((t, s) =>
|
|
312
312
|
t.pinned && !s.pinned
|
|
313
313
|
? -1
|
|
@@ -319,48 +319,48 @@ export default class v extends y {
|
|
|
319
319
|
? 1
|
|
320
320
|
: 0,
|
|
321
321
|
);
|
|
322
|
-
let e = Math.max(this.
|
|
322
|
+
let e = Math.max(this.Qt || 0, this.Kt || 0);
|
|
323
323
|
return (
|
|
324
324
|
0 === e && (e = void 0),
|
|
325
|
-
this.u && this.u.v(i.k.
|
|
325
|
+
this.u && this.u.v(i.k.Rs) === this.Qt && void 0 === e && (e = this.Qt),
|
|
326
326
|
new ContentCards(s, l(e))
|
|
327
327
|
);
|
|
328
328
|
}
|
|
329
329
|
ri(t) {
|
|
330
|
-
return this.
|
|
330
|
+
return this.Bt.It(t);
|
|
331
331
|
}
|
|
332
332
|
Gs() {
|
|
333
|
-
(this.
|
|
334
|
-
(this.
|
|
335
|
-
this.u && (this.u.ni(i.k.
|
|
333
|
+
(this.Kt = 0),
|
|
334
|
+
(this.Qt = 0),
|
|
335
|
+
this.u && (this.u.ni(i.k.js), this.u.ni(i.k.Rs));
|
|
336
336
|
}
|
|
337
337
|
changeUser(t) {
|
|
338
338
|
t ||
|
|
339
339
|
((this.cards = []),
|
|
340
|
-
this.
|
|
340
|
+
this.Bt.Dt(new ContentCards(this.cards.slice(), null)),
|
|
341
341
|
this.u &&
|
|
342
|
-
(this.u.ni(i.k.
|
|
342
|
+
(this.u.ni(i.k.gs),
|
|
343
343
|
this.u.ni(i.k.C),
|
|
344
344
|
this.u.ni(i.k.K),
|
|
345
345
|
this.u.ni(i.k.G))),
|
|
346
346
|
this.Gs();
|
|
347
347
|
}
|
|
348
348
|
clearData(t) {
|
|
349
|
-
(this.
|
|
350
|
-
(this.
|
|
349
|
+
(this.Kt = 0),
|
|
350
|
+
(this.Qt = 0),
|
|
351
351
|
(this.cards = []),
|
|
352
|
-
this.
|
|
352
|
+
this.Bt.Dt(new ContentCards(this.cards.slice(), null)),
|
|
353
353
|
t &&
|
|
354
354
|
this.u &&
|
|
355
|
-
(this.u.ni(i.k.
|
|
355
|
+
(this.u.ni(i.k.gs),
|
|
356
356
|
this.u.ni(i.k.C),
|
|
357
357
|
this.u.ni(i.k.K),
|
|
358
358
|
this.u.ni(i.k.G),
|
|
359
|
-
this.u.ni(i.k.
|
|
360
|
-
this.u.ni(i.k.
|
|
359
|
+
this.u.ni(i.k.js),
|
|
360
|
+
this.u.ni(i.k.Rs));
|
|
361
361
|
}
|
|
362
|
-
|
|
363
|
-
return !(this.
|
|
362
|
+
ks() {
|
|
363
|
+
return !(this.yt && !this.yt.oi()) || (0 !== this.yt.li() && this.ai(), !1);
|
|
364
364
|
}
|
|
365
365
|
ui(t) {
|
|
366
366
|
this.u && this.u.D(i.k.ci, t);
|
|
@@ -370,7 +370,7 @@ export default class v extends y {
|
|
|
370
370
|
}
|
|
371
371
|
_s() {
|
|
372
372
|
const t = this.u,
|
|
373
|
-
s = this.
|
|
373
|
+
s = this.yt;
|
|
374
374
|
if (!t || !s) return !0;
|
|
375
375
|
const e = t.v(i.k.Vs);
|
|
376
376
|
if (null == e || isNaN(e)) return !0;
|
|
@@ -386,6 +386,6 @@ export default class v extends y {
|
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
388
|
ai() {
|
|
389
|
-
this.
|
|
389
|
+
this.Bt.Dt(new ContentCards([], new Date())), this.u && this.u.ni(i.k.gs);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { default as ContentCards } from "./content-cards.js";
|
|
2
2
|
export { getCachedContentCards } from "./get-cached-content-cards.js";
|
|
3
3
|
export { hideContentCards } from "./ui/hide-content-cards.js";
|
|
4
|
-
export { logContentCardsDisplayed } from "./log-content-cards-displayed.js";
|
|
5
4
|
export { requestContentCardsRefresh } from "./request-content-cards-refresh.js";
|
|
6
5
|
export { showContentCards } from "./ui/show-content-cards.js";
|
|
7
6
|
export { subscribeToContentCardsUpdates } from "./subscribe-to-content-cards-updates.js";
|
|
@@ -4,13 +4,13 @@ export function subscribeToContentCardsUpdates(r) {
|
|
|
4
4
|
if (!e.rr()) return;
|
|
5
5
|
const t = g.er(),
|
|
6
6
|
n = t.ri(r);
|
|
7
|
-
if (!t.
|
|
7
|
+
if (!t.bs()) {
|
|
8
8
|
const r = e.cr();
|
|
9
9
|
if (r) {
|
|
10
10
|
const n = r.pr(() => {
|
|
11
|
-
t.
|
|
11
|
+
t.xs();
|
|
12
12
|
});
|
|
13
|
-
n && t.
|
|
13
|
+
n && t.vs(n);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return n;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import e from "../../managers/braze-instance.js";
|
|
2
|
-
import { destroyFeedHtml as
|
|
2
|
+
import { destroyFeedHtml as z } from "../../common/feed-display.js";
|
|
3
3
|
export function hideContentCards(n) {
|
|
4
4
|
if (!e.rr()) return;
|
|
5
5
|
const o = document.querySelectorAll(".ab-feed");
|
|
6
6
|
for (let e = 0; e < o.length; e++)
|
|
7
|
-
(null == n || (null != n && o[e].parentNode === n)) &&
|
|
7
|
+
(null == n || (null != n && o[e].parentNode === n)) && z(o[e]);
|
|
8
8
|
}
|
|
@@ -2,28 +2,28 @@ import e, { OPTIONS as L } from "../../managers/braze-instance.js";
|
|
|
2
2
|
import { ContentCards, subscribeToContentCardsUpdates } from "../index.js";
|
|
3
3
|
import g from "../content-cards-provider-factory.js";
|
|
4
4
|
import {
|
|
5
|
-
destroyFeedHtml as
|
|
5
|
+
destroyFeedHtml as z,
|
|
6
6
|
detectFeedImpressions as q,
|
|
7
7
|
feedToHtml as I,
|
|
8
8
|
LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as M,
|
|
9
9
|
refreshFeed as $,
|
|
10
|
-
registerFeedSubscriptionId as
|
|
11
|
-
updateFeedCards as
|
|
10
|
+
registerFeedSubscriptionId as k,
|
|
11
|
+
updateFeedCards as A,
|
|
12
12
|
} from "../../common/feed-display.js";
|
|
13
|
-
import { setCardHeight as
|
|
14
|
-
import { setupFeedUI as
|
|
13
|
+
import { setCardHeight as B } from "../../Card/display/card-display.js";
|
|
14
|
+
import { setupFeedUI as F } from "../../ui/js/index.js";
|
|
15
15
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
16
16
|
export function showContentCards(n, t) {
|
|
17
17
|
if (!e.rr()) return;
|
|
18
|
-
|
|
18
|
+
F();
|
|
19
19
|
let o = !1;
|
|
20
20
|
null == n && ((n = document.body), (o = !0));
|
|
21
21
|
const a = e.nn(L.tn) || e.nn(L.en) || !1,
|
|
22
|
-
i = g.er().
|
|
23
|
-
"function" == typeof t &&
|
|
22
|
+
i = g.er().Ls(!1);
|
|
23
|
+
"function" == typeof t && A(i, t(i.cards.slice()), i.lastUpdated, null, a);
|
|
24
24
|
const s = I(i, a, o),
|
|
25
25
|
l = g.er(),
|
|
26
|
-
f = l.
|
|
26
|
+
f = l.Cs();
|
|
27
27
|
(null == i.lastUpdated ||
|
|
28
28
|
new Date().valueOf() - i.lastUpdated.valueOf() > ContentCards.mr) &&
|
|
29
29
|
(null == f || new Date().valueOf() - f > ContentCards.mr) &&
|
|
@@ -31,7 +31,7 @@ export function showContentCards(n, t) {
|
|
|
31
31
|
`Cached content cards were older than max TTL of ${ContentCards.mr} ms, requesting an update from the server.`,
|
|
32
32
|
),
|
|
33
33
|
$(i, s),
|
|
34
|
-
l.
|
|
34
|
+
l.ws(new Date().valueOf()));
|
|
35
35
|
const c = new Date().valueOf(),
|
|
36
36
|
u = subscribeToContentCardsUpdates(function (n) {
|
|
37
37
|
const e = s.querySelectorAll(".ab-refresh-button")[0];
|
|
@@ -49,22 +49,22 @@ export function showContentCards(n, t) {
|
|
|
49
49
|
}
|
|
50
50
|
let o = n.cards;
|
|
51
51
|
"function" == typeof t && (o = t(o.slice())),
|
|
52
|
-
|
|
52
|
+
A(i, o, n.lastUpdated, s, a);
|
|
53
53
|
});
|
|
54
|
-
|
|
54
|
+
k(u, s);
|
|
55
55
|
const d = function (n) {
|
|
56
56
|
const t = n.querySelectorAll(".ab-feed");
|
|
57
57
|
let e = null;
|
|
58
58
|
for (let o = 0; o < t.length; o++) t[o].parentNode === n && (e = t[o]);
|
|
59
59
|
null != e
|
|
60
|
-
? (
|
|
60
|
+
? (z(e), null != e.parentNode && e.parentNode.replaceChild(s, e))
|
|
61
61
|
: n.appendChild(s),
|
|
62
62
|
setTimeout(function () {
|
|
63
63
|
s.className = s.className.replace("ab-hide", "ab-show");
|
|
64
64
|
}, 0),
|
|
65
65
|
o && s.focus(),
|
|
66
66
|
q(i, s),
|
|
67
|
-
|
|
67
|
+
B(i.cards, n);
|
|
68
68
|
};
|
|
69
69
|
var m;
|
|
70
70
|
null != n
|
|
@@ -2,7 +2,7 @@ import K from "../managers/braze-instance.js";
|
|
|
2
2
|
import BrazeSdkMetadata from "./braze-sdk-metadata.js";
|
|
3
3
|
import {
|
|
4
4
|
isArray as p,
|
|
5
|
-
validateValueIsFromEnum as
|
|
5
|
+
validateValueIsFromEnum as G,
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
8
8
|
export function addSdkMetadata(a) {
|
|
@@ -13,7 +13,7 @@ export function addSdkMetadata(a) {
|
|
|
13
13
|
);
|
|
14
14
|
for (const t of a)
|
|
15
15
|
if (
|
|
16
|
-
!
|
|
16
|
+
!G(
|
|
17
17
|
BrazeSdkMetadata,
|
|
18
18
|
t,
|
|
19
19
|
"sdkMetadata contained an invalid value.",
|