@braze/web-sdk 5.1.1 → 5.3.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 +65 -10
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +20 -20
- package/shared-lib/indexed-db-adapter.js +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +22 -21
- package/src/ContentCards/content-cards-provider.js +107 -135
- 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 +2 -2
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/FeatureFlags/feature-flag.js +41 -30
- package/src/FeatureFlags/feature-flags-provider.js +88 -84
- 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 +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +24 -24
- 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 +45 -42
- package/src/InAppMessage/display/in-app-message-to-html.js +22 -22
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +23 -21
- package/src/InAppMessage/in-app-message-manager.js +95 -112
- 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 +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/control-message.js +4 -2
- package/src/InAppMessage/models/full-screen-message.js +14 -11
- package/src/InAppMessage/models/html-message.js +11 -9
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +127 -120
- package/src/InAppMessage/models/modal-message.js +14 -11
- package/src/InAppMessage/models/slide-up-message.js +46 -21
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +37 -43
- package/src/InAppMessage/utils/in-app-message-utils.js +18 -1
- package/src/Push/push-manager-factory.js +4 -4
- package/src/Push/push-manager.js +118 -110
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +19 -19
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +0 -2
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +12 -12
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +27 -27
- package/src/managers/braze-instance.js +119 -112
- package/src/managers/device-manager.js +19 -19
- package/src/managers/network-manager.js +215 -165
- package/src/managers/server-config-manager.js +46 -50
- package/src/managers/session-manager.js +21 -21
- package/src/managers/storage-manager-factory.js +1 -1
- package/src/managers/storage-manager.js +128 -125
- package/src/managers/utils.js +6 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +19 -11
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +34 -20
- package/src/models/push-token.js +4 -4
- package/src/models/server-config.js +24 -24
- package/src/request-controller.js +134 -124
- package/src/triggers/models/filter-set.js +2 -2
- package/src/triggers/models/filter.js +56 -56
- package/src/triggers/models/in-app-message-click-data.js +8 -8
- 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 +36 -36
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +84 -95
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +25 -24
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +2 -2
- package/src/util/device-constants.js +2 -2
- package/src/util/dom-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +36 -37
- package/src/util/user-agent-parser.js +8 -8
- package/src/util/validation-utils.js +2 -0
- package/src/util/window-utils.js +3 -3
|
@@ -3,17 +3,17 @@ import y from "../common/base-provider.js";
|
|
|
3
3
|
import e from "../managers/braze-instance.js";
|
|
4
4
|
import ContentCards from "./content-cards.js";
|
|
5
5
|
import { dateFromUnixTimestamp as l } from "../util/date-utils.js";
|
|
6
|
-
import { isURIJavascriptOrData as
|
|
6
|
+
import { isURIJavascriptOrData as R } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
|
-
newCardFromContentCardsJson as
|
|
9
|
-
newCardFromSerializedValue as
|
|
8
|
+
newCardFromContentCardsJson as N,
|
|
9
|
+
newCardFromSerializedValue as S,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
11
|
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
12
12
|
import T from "../managers/subscription-manager.js";
|
|
13
13
|
import s from "../common/event-logger.js";
|
|
14
|
-
import
|
|
15
|
-
import { randomInclusive as
|
|
16
|
-
import { MAX_ERROR_RETRIES_CONTENT_CARDS as
|
|
14
|
+
import D from "../util/request-header-utils.js";
|
|
15
|
+
import { randomInclusive as U } from "../util/math.js";
|
|
16
|
+
import { MAX_ERROR_RETRIES_CONTENT_CARDS as k } from "../common/constants.js";
|
|
17
17
|
import {
|
|
18
18
|
logger as r,
|
|
19
19
|
IndexedDBAdapter as A,
|
|
@@ -64,17 +64,17 @@ export default class v extends y {
|
|
|
64
64
|
}
|
|
65
65
|
Kt() {
|
|
66
66
|
if (!this.u) return;
|
|
67
|
-
const t = this.u.j(o.C.
|
|
67
|
+
const t = this.u.j(o.C.ws) || [],
|
|
68
68
|
s = [];
|
|
69
69
|
for (let i = 0; i < t.length; i++) {
|
|
70
|
-
const e =
|
|
70
|
+
const e = S(t[i]);
|
|
71
71
|
null != e && s.push(e);
|
|
72
72
|
}
|
|
73
|
-
(this.cards = this.
|
|
73
|
+
(this.cards = this.Cs(this.bs(s, !1))),
|
|
74
74
|
(this.Bt = this.u.j(o.C.gs) || this.Bt),
|
|
75
75
|
(this.Ht = this.u.j(o.C.ys) || this.Ht);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
js(t, s = !1, i = 0, e = 0) {
|
|
78
78
|
let h;
|
|
79
79
|
if (s) {
|
|
80
80
|
h = [];
|
|
@@ -89,10 +89,10 @@ export default class v extends y {
|
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
if (s) {
|
|
92
|
-
const t =
|
|
92
|
+
const t = N(e);
|
|
93
93
|
null != r && r.viewed && t && (t.viewed = !0), null != t && h.push(t);
|
|
94
94
|
} else if (null == r) {
|
|
95
|
-
const t =
|
|
95
|
+
const t = N(e);
|
|
96
96
|
null != t && h.push(t);
|
|
97
97
|
} else {
|
|
98
98
|
if (!r.Ct(e))
|
|
@@ -103,31 +103,31 @@ export default class v extends y {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
(this.cards = this.
|
|
107
|
-
this.
|
|
106
|
+
(this.cards = this.Cs(this.bs(h, s))),
|
|
107
|
+
this.Rs(),
|
|
108
108
|
(this.Bt = i),
|
|
109
109
|
(this.Ht = e),
|
|
110
110
|
this.u && (this.u.k(o.C.gs, this.Bt), this.u.k(o.C.ys, this.Ht));
|
|
111
111
|
}
|
|
112
|
-
|
|
112
|
+
Ns(t) {
|
|
113
113
|
if (this.Ts() && null != t && t.cards) {
|
|
114
|
-
this.u && this.u.k(o.C.
|
|
114
|
+
this.u && this.u.k(o.C.Ss, e.Ds());
|
|
115
115
|
const s = t.full_sync;
|
|
116
116
|
s || this.Kt(),
|
|
117
|
-
this.
|
|
118
|
-
this.Jt.Dt(this.
|
|
117
|
+
this.js(t.cards, s, t.last_full_sync_at, t.last_card_updated_at),
|
|
118
|
+
this.Jt.Dt(this.Us(!0));
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
|
|
121
|
+
ks(t) {
|
|
122
122
|
this.u && this.u.k(o.C.As, t);
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
Fs(t, e, h) {
|
|
125
125
|
const r = () => {
|
|
126
|
-
this.
|
|
126
|
+
this.xs(e, h, !0);
|
|
127
127
|
},
|
|
128
128
|
n = t ? b(t) : null;
|
|
129
129
|
let l;
|
|
130
|
-
if ((this.
|
|
130
|
+
if ((this.zs(), !n || !n["retry-after"])) return void this.ks(0);
|
|
131
131
|
const a = n["retry-after"];
|
|
132
132
|
if (isNaN(a) && !isNaN(Date.parse(a)))
|
|
133
133
|
(l = Date.parse(a) - new Date().getTime()), l < 0 && r();
|
|
@@ -135,7 +135,7 @@ export default class v extends y {
|
|
|
135
135
|
if (isNaN(parseFloat(a.toString()))) {
|
|
136
136
|
const t =
|
|
137
137
|
"Received unexpected value for retry-after header in /sync response";
|
|
138
|
-
return s.q(i.
|
|
138
|
+
return s.q(i.qs, { e: t + ": " + a }), void this.ks(0);
|
|
139
139
|
}
|
|
140
140
|
l = 1e3 * parseFloat(a.toString());
|
|
141
141
|
}
|
|
@@ -145,7 +145,7 @@ export default class v extends y {
|
|
|
145
145
|
let u = 0;
|
|
146
146
|
this.u && (u = this.u.j(o.C.As)),
|
|
147
147
|
(null == u || isNaN(parseInt(u.toString()))) && (u = 0),
|
|
148
|
-
this.
|
|
148
|
+
this.ks(parseInt(u.toString()) + 1);
|
|
149
149
|
}
|
|
150
150
|
es(t) {
|
|
151
151
|
var s;
|
|
@@ -164,7 +164,7 @@ export default class v extends y {
|
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
166
166
|
if (null == h) {
|
|
167
|
-
const t =
|
|
167
|
+
const t = N(e);
|
|
168
168
|
null != t && i.push(t);
|
|
169
169
|
} else {
|
|
170
170
|
if (!h.Ct(e))
|
|
@@ -175,7 +175,7 @@ export default class v extends y {
|
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
(this.cards = this.
|
|
178
|
+
(this.cards = this.Cs(this.bs(i, !1))), this.Rs(), this.Jt.Dt(this.Us(!0));
|
|
179
179
|
}
|
|
180
180
|
bs(t, s) {
|
|
181
181
|
let i = {},
|
|
@@ -202,7 +202,7 @@ export default class v extends y {
|
|
|
202
202
|
t
|
|
203
203
|
);
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
Cs(t) {
|
|
206
206
|
const s = [],
|
|
207
207
|
i = new Date();
|
|
208
208
|
let e = {};
|
|
@@ -210,7 +210,7 @@ export default class v extends y {
|
|
|
210
210
|
let h = !1;
|
|
211
211
|
for (let n = 0; n < t.length; n++) {
|
|
212
212
|
const o = t[n].url;
|
|
213
|
-
if (!this.Ft && o &&
|
|
213
|
+
if (!this.Ft && o && R(o)) {
|
|
214
214
|
r.error(
|
|
215
215
|
`Card with url ${o} will not be displayed because Javascript URLs are disabled. Use the "allowUserSuppliedJavascript" option for braze.initialize to enable this card.`,
|
|
216
216
|
);
|
|
@@ -227,97 +227,90 @@ export default class v extends y {
|
|
|
227
227
|
}
|
|
228
228
|
return h && this.u && this.u.k(o.C.A, e), s;
|
|
229
229
|
}
|
|
230
|
-
|
|
230
|
+
Rs() {
|
|
231
231
|
var t;
|
|
232
232
|
const s = [];
|
|
233
233
|
for (let t = 0; t < this.cards.length; t++) s.push(this.cards[t].Y());
|
|
234
|
-
null === (t = this.u) || void 0 === t || t.k(o.C.
|
|
234
|
+
null === (t = this.u) || void 0 === t || t.k(o.C.ws, s);
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
zs() {
|
|
237
237
|
this.ns && (clearTimeout(this.ns), (this.ns = null));
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
Es() {
|
|
240
240
|
null != this.os && (clearTimeout(this.os), (this.os = null));
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
this.
|
|
242
|
+
Ls(t = 1e3 * this.us, s, i) {
|
|
243
|
+
this.Es(),
|
|
244
244
|
(this.os = window.setTimeout(() => {
|
|
245
|
-
this.
|
|
245
|
+
this.xs(s, i, !0);
|
|
246
246
|
}, t)),
|
|
247
247
|
(this.ls = t);
|
|
248
248
|
}
|
|
249
|
-
|
|
250
|
-
var
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
if (!
|
|
254
|
-
|
|
255
|
-
if ((c && (this.xs(), this.Us(0)), !this.Ts()))
|
|
249
|
+
xs(t, s, i = !1, h = !0) {
|
|
250
|
+
var r;
|
|
251
|
+
const n = this.qt,
|
|
252
|
+
l = this.u;
|
|
253
|
+
if (!n || !l) return void ("function" == typeof s && s());
|
|
254
|
+
if ((!i && (this.zs(), this.ks(0)), !this.Ts()))
|
|
256
255
|
return void (
|
|
257
|
-
null === (
|
|
258
|
-
void 0 ===
|
|
259
|
-
|
|
260
|
-
this.
|
|
256
|
+
null === (r = this.yt) ||
|
|
257
|
+
void 0 === r ||
|
|
258
|
+
r.Is(() => {
|
|
259
|
+
this.xs(t, s);
|
|
261
260
|
})
|
|
262
261
|
);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
u.j(o.C.Ds) !== e.Ss() && this.$s(),
|
|
274
|
-
(d.last_full_sync_at = this.Bt),
|
|
275
|
-
(d.last_card_updated_at = this.Ht);
|
|
276
|
-
const m = a._s(d, S.Gs.Bs, i);
|
|
277
|
-
let p = !1;
|
|
278
|
-
a.Hs(
|
|
279
|
-
d,
|
|
280
|
-
() => {
|
|
262
|
+
h && this.Es();
|
|
263
|
+
const a = n.Js({}, !0);
|
|
264
|
+
l.j(o.C.Ss) !== e.Ds() && this.Ms(),
|
|
265
|
+
(a.last_full_sync_at = this.Bt),
|
|
266
|
+
(a.last_card_updated_at = this.Ht);
|
|
267
|
+
const u = n.$s(a, D.Ps.Bs, i);
|
|
268
|
+
let c = !1;
|
|
269
|
+
n.Xs(
|
|
270
|
+
a,
|
|
271
|
+
(i = -1) => {
|
|
281
272
|
if (this.u) {
|
|
282
273
|
const t = new Date().valueOf();
|
|
283
|
-
|
|
274
|
+
D._s(this.u, D.Ps.Bs, t);
|
|
284
275
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
276
|
+
-1 !== i && u.push(["X-Braze-Req-Tokens-Remaining", i.toString()]),
|
|
277
|
+
C.Gs({
|
|
278
|
+
url: `${n.Hs()}/content_cards/sync`,
|
|
279
|
+
data: a,
|
|
280
|
+
headers: u,
|
|
281
|
+
L: (i, e) => {
|
|
282
|
+
if (!n.Ks(a, i, u))
|
|
283
|
+
return (c = !0), void ("function" == typeof s && s());
|
|
284
|
+
n.Os(),
|
|
285
|
+
this.Fs(e, t, s),
|
|
286
|
+
this.Ns(i),
|
|
287
|
+
(c = !1),
|
|
288
|
+
D.Qs(this.u, D.Ps.Bs, 1),
|
|
289
|
+
"function" == typeof t && t();
|
|
290
|
+
},
|
|
291
|
+
error: (t) => {
|
|
292
|
+
n.Vs(t, "retrieving content cards"),
|
|
293
|
+
(c = !0),
|
|
294
|
+
"function" == typeof s && s();
|
|
295
|
+
},
|
|
296
|
+
Ws: () => {
|
|
297
|
+
if (c && h && !this.os && this.cs + 1 < k) {
|
|
298
|
+
D.Ys(this.u, D.Ps.Bs);
|
|
299
|
+
let i = this.ls;
|
|
300
|
+
(null == i || i < 1e3 * this.us) && (i = 1e3 * this.us),
|
|
301
|
+
this.Ls(Math.min(3e5, U(1e3 * this.us, 3 * i)), t, s),
|
|
302
|
+
(this.cs = this.cs + 1);
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
});
|
|
314
306
|
},
|
|
315
|
-
|
|
307
|
+
D.Ps.Bs,
|
|
308
|
+
s,
|
|
316
309
|
);
|
|
317
310
|
}
|
|
318
|
-
|
|
311
|
+
Us(t) {
|
|
319
312
|
t || this.Kt();
|
|
320
|
-
const s = this.
|
|
313
|
+
const s = this.Cs(this.cards);
|
|
321
314
|
s.sort((t, s) =>
|
|
322
315
|
t.pinned && !s.pinned
|
|
323
316
|
? -1
|
|
@@ -336,24 +329,24 @@ export default class v extends y {
|
|
|
336
329
|
new ContentCards(s, l(i))
|
|
337
330
|
);
|
|
338
331
|
}
|
|
339
|
-
|
|
332
|
+
Zs(t) {
|
|
340
333
|
return this.Jt.It(t);
|
|
341
334
|
}
|
|
342
|
-
|
|
335
|
+
Ms() {
|
|
343
336
|
(this.Bt = 0),
|
|
344
337
|
(this.Ht = 0),
|
|
345
|
-
this.u && (this.u.
|
|
338
|
+
this.u && (this.u.ti(o.C.gs), this.u.ti(o.C.ys));
|
|
346
339
|
}
|
|
347
340
|
changeUser(t) {
|
|
348
341
|
t ||
|
|
349
342
|
((this.cards = []),
|
|
350
343
|
this.Jt.Dt(new ContentCards(this.cards.slice(), null)),
|
|
351
344
|
this.u &&
|
|
352
|
-
(this.u.
|
|
353
|
-
this.u.
|
|
354
|
-
this.u.
|
|
355
|
-
this.u.
|
|
356
|
-
this
|
|
345
|
+
(this.u.ti(o.C.ws),
|
|
346
|
+
this.u.ti(o.C.v),
|
|
347
|
+
this.u.ti(o.C.H),
|
|
348
|
+
this.u.ti(o.C.A))),
|
|
349
|
+
this.Ms();
|
|
357
350
|
}
|
|
358
351
|
clearData(t) {
|
|
359
352
|
(this.Bt = 0),
|
|
@@ -362,40 +355,19 @@ export default class v extends y {
|
|
|
362
355
|
this.Jt.Dt(new ContentCards(this.cards.slice(), null)),
|
|
363
356
|
t &&
|
|
364
357
|
this.u &&
|
|
365
|
-
(this.u.
|
|
366
|
-
this.u.
|
|
367
|
-
this.u.
|
|
368
|
-
this.u.
|
|
369
|
-
this.u.
|
|
370
|
-
this.u.
|
|
358
|
+
(this.u.ti(o.C.ws),
|
|
359
|
+
this.u.ti(o.C.v),
|
|
360
|
+
this.u.ti(o.C.H),
|
|
361
|
+
this.u.ti(o.C.A),
|
|
362
|
+
this.u.ti(o.C.gs),
|
|
363
|
+
this.u.ti(o.C.ys));
|
|
371
364
|
}
|
|
372
365
|
Ts() {
|
|
373
366
|
return (
|
|
374
|
-
!!this.yt && (!!this.yt.
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
li(t) {
|
|
378
|
-
this.u && this.u.k(o.C.ai, t);
|
|
379
|
-
}
|
|
380
|
-
ui() {
|
|
381
|
-
return this.u ? this.u.j(o.C.ai) : null;
|
|
382
|
-
}
|
|
383
|
-
Js() {
|
|
384
|
-
var t, s, i;
|
|
385
|
-
const e = null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ks);
|
|
386
|
-
if (null == e || isNaN(e)) return !0;
|
|
387
|
-
const h = (null === (s = this.yt) || void 0 === s ? void 0 : s.ci()) || -1,
|
|
388
|
-
r = (null === (i = this.yt) || void 0 === i ? void 0 : i.fi()) || -1;
|
|
389
|
-
if (-1 === h || -1 === r) return !0;
|
|
390
|
-
let n = this.ui();
|
|
391
|
-
(null == n || isNaN(n)) && (n = h);
|
|
392
|
-
const l = (new Date().valueOf() - e) / 1e3;
|
|
393
|
-
return (
|
|
394
|
-
(n = Math.min(n + l / r, h)),
|
|
395
|
-
!(n < 1) && ((n = Math.trunc(n) - 1), this.li(n), !0)
|
|
367
|
+
!!this.yt && (!!this.yt.si() || (0 !== this.yt.ii() && this.ei(), !1))
|
|
396
368
|
);
|
|
397
369
|
}
|
|
398
|
-
|
|
399
|
-
this.Jt.Dt(new ContentCards([], new Date())), this.u && this.u.
|
|
370
|
+
ei() {
|
|
371
|
+
this.Jt.Dt(new ContentCards([], new Date())), this.u && this.u.ti(o.C.ws);
|
|
400
372
|
}
|
|
401
373
|
}
|
|
@@ -3,12 +3,12 @@ import g from "./content-cards-provider-factory.js";
|
|
|
3
3
|
export function subscribeToContentCardsUpdates(r) {
|
|
4
4
|
if (!e.X()) return;
|
|
5
5
|
const t = g.rr(),
|
|
6
|
-
n = t.
|
|
6
|
+
n = t.Zs(r);
|
|
7
7
|
if (!t.ps()) {
|
|
8
8
|
const r = e.cr();
|
|
9
9
|
if (r) {
|
|
10
10
|
const n = r.mr(() => {
|
|
11
|
-
t.
|
|
11
|
+
t.xs();
|
|
12
12
|
});
|
|
13
13
|
n && t.vs(n);
|
|
14
14
|
}
|
|
@@ -19,7 +19,7 @@ export function showContentCards(n, t) {
|
|
|
19
19
|
let o = !1;
|
|
20
20
|
null == n && ((n = document.body), (o = !0));
|
|
21
21
|
const i = e.nn(L.tn) || e.nn(L.en) || !1,
|
|
22
|
-
a = g.rr().
|
|
22
|
+
a = g.rr().Us(!1);
|
|
23
23
|
"function" == typeof t && F(a, t(a.cards.slice()), a.lastUpdated, null, i);
|
|
24
24
|
const s = I(a, i, o),
|
|
25
25
|
f = g.rr(),
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
import { logger as r } from "../../shared-lib/index.js";
|
|
2
2
|
export default class FeatureFlag {
|
|
3
|
-
constructor(t,
|
|
3
|
+
constructor(t, e = !1, r = {}, i) {
|
|
4
4
|
(this.id = t),
|
|
5
|
-
(this.enabled =
|
|
6
|
-
(this.properties =
|
|
7
|
-
(this.trackingString =
|
|
5
|
+
(this.enabled = e),
|
|
6
|
+
(this.properties = r),
|
|
7
|
+
(this.trackingString = i),
|
|
8
8
|
(this.id = t),
|
|
9
|
-
(this.enabled =
|
|
10
|
-
(this.properties =
|
|
11
|
-
(this.trackingString =
|
|
9
|
+
(this.enabled = e),
|
|
10
|
+
(this.properties = r),
|
|
11
|
+
(this.trackingString = i);
|
|
12
|
+
}
|
|
13
|
+
he(t, e, r) {
|
|
14
|
+
const i = this.properties[t];
|
|
15
|
+
return null == i ? (this.ye(t), null) : e(i) ? i.value : (this.Pe(r), null);
|
|
12
16
|
}
|
|
13
17
|
getStringProperty(t) {
|
|
14
|
-
|
|
15
|
-
return null == r
|
|
16
|
-
? (this.Er(t), null)
|
|
17
|
-
: this.Ir(r)
|
|
18
|
-
? r.value
|
|
19
|
-
: (this.Nr("string"), null);
|
|
18
|
+
return this.he(t, this.be, "string");
|
|
20
19
|
}
|
|
21
20
|
getNumberProperty(t) {
|
|
22
|
-
|
|
23
|
-
return null == r
|
|
24
|
-
? (this.Er(t), null)
|
|
25
|
-
: this.Tr(r)
|
|
26
|
-
? r.value
|
|
27
|
-
: (this.Nr("number"), null);
|
|
21
|
+
return this.he(t, this.Ie, "number");
|
|
28
22
|
}
|
|
29
23
|
getBooleanProperty(t) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
return this.he(t, this.de, "boolean");
|
|
25
|
+
}
|
|
26
|
+
getImageProperty(t) {
|
|
27
|
+
return this.he(t, this.Te, "image");
|
|
28
|
+
}
|
|
29
|
+
getJsonProperty(t) {
|
|
30
|
+
return this.he(t, this.Ee, "jsonobject");
|
|
31
|
+
}
|
|
32
|
+
getTimestampProperty(t) {
|
|
33
|
+
return this.he(t, this.Ne, "datetime");
|
|
36
34
|
}
|
|
37
35
|
Y() {
|
|
38
36
|
const t = {};
|
|
@@ -44,21 +42,34 @@ export default class FeatureFlag {
|
|
|
44
42
|
t
|
|
45
43
|
);
|
|
46
44
|
}
|
|
47
|
-
|
|
45
|
+
Pe(t) {
|
|
48
46
|
r.info(`Property is not of type ${t}.`);
|
|
49
47
|
}
|
|
50
|
-
|
|
48
|
+
ye(t) {
|
|
51
49
|
r.info(`${t} not found in feature flag properties.`);
|
|
52
50
|
}
|
|
53
|
-
|
|
51
|
+
be(t) {
|
|
54
52
|
return "string" === t.type && "string" == typeof t.value;
|
|
55
53
|
}
|
|
56
|
-
|
|
54
|
+
Ie(t) {
|
|
57
55
|
return "number" === t.type && "number" == typeof t.value;
|
|
58
56
|
}
|
|
59
|
-
|
|
57
|
+
de(t) {
|
|
60
58
|
return "boolean" === t.type && "boolean" == typeof t.value;
|
|
61
59
|
}
|
|
60
|
+
Te(t) {
|
|
61
|
+
return "image" === t.type && "string" == typeof t.value;
|
|
62
|
+
}
|
|
63
|
+
Ee(t) {
|
|
64
|
+
return (
|
|
65
|
+
"jsonobject" === t.type &&
|
|
66
|
+
"object" == typeof t.value &&
|
|
67
|
+
t.value.constructor == Object
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
Ne(t) {
|
|
71
|
+
return "datetime" === t.type && "number" == typeof t.value;
|
|
72
|
+
}
|
|
62
73
|
}
|
|
63
74
|
(FeatureFlag.tt = { ht: "id", le: "e", pe: "pr", Fe: "fts" }),
|
|
64
75
|
(FeatureFlag.Rt = { ht: "id", le: "enabled", pe: "properties", Fe: "fts" });
|