@braze/web-sdk 5.0.1 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.d.ts +10 -5
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +29 -29
- package/shared-lib/guid.js +3 -3
- package/shared-lib/index.js +6 -0
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +21 -21
- package/src/Card/card-manager.js +43 -45
- package/src/Card/display/card-display.js +60 -60
- package/src/Card/log-card-click.js +4 -4
- package/src/Card/log-card-dismissal.js +2 -3
- package/src/Card/log-card-impressions.js +7 -7
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- 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 +68 -68
- package/src/ContentCards/content-cards-provider-factory.js +3 -3
- package/src/ContentCards/content-cards-provider.js +255 -245
- package/src/ContentCards/content-cards.js +2 -2
- 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/hide-content-cards.js +1 -1
- package/src/ContentCards/ui/show-content-cards.js +24 -24
- package/src/ContentCards/ui/toggle-content-cards.js +1 -1
- package/src/Core/add-sdk-metadata.js +21 -19
- package/src/Core/change-user.js +10 -10
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +11 -11
- package/src/Core/enable-sdk.js +7 -7
- package/src/Core/get-device-id.js +6 -6
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +41 -41
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +15 -15
- package/src/Core/log-purchase.js +31 -37
- package/src/Core/open-session.js +12 -12
- package/src/Core/remove-all-subscriptions.js +1 -1
- package/src/Core/remove-subscription.js +1 -1
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +6 -4
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +12 -12
- package/src/FeatureFlags/feature-flag.js +10 -10
- package/src/FeatureFlags/feature-flags-provider-factory.js +3 -2
- package/src/FeatureFlags/feature-flags-provider.js +108 -80
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +15 -13
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +7 -4
- package/src/Feed/feed-provider-factory.js +2 -2
- package/src/Feed/feed-provider.js +44 -44
- package/src/Feed/feed.js +1 -1
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +4 -4
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/hide-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +28 -28
- package/src/Feed/ui/toggle-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +5 -5
- package/src/InAppMessage/display/html-message-to-html.js +54 -54
- package/src/InAppMessage/display/in-app-message-to-html.js +79 -79
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +49 -49
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +143 -138
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-impression.js +6 -6
- package/src/InAppMessage/models/full-screen-message.js +33 -33
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +6 -6
- package/src/InAppMessage/models/in-app-message.js +99 -99
- package/src/InAppMessage/models/modal-message.js +32 -32
- package/src/InAppMessage/models/slide-up-message.js +28 -28
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
- package/src/InAppMessage/ui/show-in-app-message.js +81 -81
- package/src/Push/is-push-blocked.js +1 -1
- package/src/Push/is-push-permission-granted.js +1 -1
- package/src/Push/is-push-supported.js +1 -1
- package/src/Push/push-manager-factory.js +5 -5
- package/src/Push/push-manager.js +176 -173
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/unregister-push.js +1 -1
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +29 -29
- package/src/User/user.js +72 -74
- package/src/common/base-feed.js +7 -7
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/event-logger.js +21 -18
- package/src/common/feed-display.js +44 -44
- package/src/l10n/l10n-manager-factory.js +3 -3
- package/src/l10n/l10n-manager.js +7 -7
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +188 -190
- package/src/managers/device-manager.js +28 -28
- package/src/managers/network-manager.js +189 -138
- package/src/managers/server-config-manager.js +69 -53
- package/src/managers/session-manager.js +34 -30
- package/src/managers/storage-manager-factory.js +16 -16
- package/src/managers/storage-manager.js +178 -163
- package/src/managers/subscription-manager.js +12 -12
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +34 -14
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +32 -23
- package/src/request-controller.js +187 -179
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +13 -13
- package/src/triggers/models/filter.js +45 -45
- package/src/triggers/models/in-app-message-click-data.js +12 -12
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +7 -7
- package/src/triggers/models/trigger-condition.js +57 -59
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +38 -38
- package/src/triggers/triggers-provider-factory.js +4 -4
- package/src/triggers/triggers-provider.js +127 -130
- package/src/ui/js/attach-css.js +2 -2
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +3 -3
- package/src/util/braze-actions.js +35 -35
- package/src/util/browser-detector.js +21 -21
- package/src/util/client-hints-parser.js +8 -8
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +4 -4
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +18 -18
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +18 -18
- package/src/util/request-header-utils.js +39 -37
- package/src/util/string-utils.js +10 -10
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +37 -39
- package/src/util/window-utils.js +3 -3
- package/shared-lib/braze-shared-lib.js +0 -8
|
@@ -5,309 +5,319 @@ import ContentCards from "./content-cards.js";
|
|
|
5
5
|
import { dateFromUnixTimestamp as l } from "../util/date-utils.js";
|
|
6
6
|
import { isURIJavascriptOrData as N } from "../util/url-utils.js";
|
|
7
7
|
import {
|
|
8
|
-
newCardFromContentCardsJson as
|
|
9
|
-
newCardFromSerializedValue as
|
|
8
|
+
newCardFromContentCardsJson as R,
|
|
9
|
+
newCardFromSerializedValue as D,
|
|
10
10
|
} from "../Card/util/card-factory.js";
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import E from "../managers/subscription-manager.js";
|
|
11
|
+
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
12
|
+
import T from "../managers/subscription-manager.js";
|
|
14
13
|
import s from "../common/event-logger.js";
|
|
15
|
-
import
|
|
16
|
-
import { randomInclusive as
|
|
17
|
-
import { MAX_ERROR_RETRIES_CONTENT_CARDS as
|
|
14
|
+
import S from "../util/request-header-utils.js";
|
|
15
|
+
import { randomInclusive as k } from "../util/math.js";
|
|
16
|
+
import { MAX_ERROR_RETRIES_CONTENT_CARDS as U } from "../common/constants.js";
|
|
17
|
+
import {
|
|
18
|
+
logger as r,
|
|
19
|
+
IndexedDBAdapter as A,
|
|
20
|
+
EventTypes as i,
|
|
21
|
+
} from "../../shared-lib/index.js";
|
|
18
22
|
export default class v extends y {
|
|
19
23
|
constructor(t, s, i, h, n) {
|
|
20
24
|
super(),
|
|
21
25
|
(this.wt = t),
|
|
22
26
|
(this.u = s),
|
|
23
27
|
(this.yt = i),
|
|
24
|
-
(this.
|
|
25
|
-
(this
|
|
28
|
+
(this.Ft = h),
|
|
29
|
+
(this.qt = n),
|
|
26
30
|
(this.wt = t),
|
|
27
31
|
(this.u = s),
|
|
28
32
|
(this.yt = i),
|
|
29
|
-
(this.
|
|
30
|
-
(this
|
|
31
|
-
(this.
|
|
32
|
-
e
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
33
|
+
(this.Ft = h),
|
|
34
|
+
(this.qt = n),
|
|
35
|
+
(this.Jt = new T()),
|
|
36
|
+
e.$t(this.Jt),
|
|
37
|
+
(this.Bt = 0),
|
|
38
|
+
(this.Ht = 0),
|
|
35
39
|
(this.cards = []),
|
|
36
|
-
this.
|
|
37
|
-
const o =
|
|
38
|
-
new
|
|
39
|
-
this.
|
|
40
|
+
this.Kt();
|
|
41
|
+
const o = A.Yt.Qt;
|
|
42
|
+
new A(o, r).Zt(o.ss.ts, (t) => {
|
|
43
|
+
this.es(t);
|
|
40
44
|
}),
|
|
45
|
+
(this.hs = null),
|
|
46
|
+
(this.rs = null),
|
|
47
|
+
(this.ns = null),
|
|
41
48
|
(this.os = null),
|
|
42
49
|
(this.ls = null),
|
|
43
|
-
(this.us =
|
|
44
|
-
(this.cs =
|
|
45
|
-
(this.fs = null),
|
|
46
|
-
(this.ds = 10),
|
|
47
|
-
(this.ps = 0);
|
|
50
|
+
(this.us = 10),
|
|
51
|
+
(this.cs = 0);
|
|
48
52
|
}
|
|
49
|
-
|
|
50
|
-
return this.
|
|
53
|
+
fs() {
|
|
54
|
+
return this.hs;
|
|
51
55
|
}
|
|
52
|
-
|
|
53
|
-
this.
|
|
56
|
+
ds(t) {
|
|
57
|
+
this.hs = t;
|
|
54
58
|
}
|
|
55
|
-
|
|
56
|
-
return this.
|
|
59
|
+
ps() {
|
|
60
|
+
return this.rs;
|
|
57
61
|
}
|
|
58
62
|
vs(t) {
|
|
59
|
-
this.
|
|
63
|
+
this.rs = t;
|
|
60
64
|
}
|
|
61
|
-
|
|
65
|
+
Kt() {
|
|
62
66
|
if (!this.u) return;
|
|
63
|
-
const t = this.u.
|
|
67
|
+
const t = this.u.j(o.C.Cs) || [],
|
|
64
68
|
s = [];
|
|
65
69
|
for (let i = 0; i < t.length; i++) {
|
|
66
|
-
const e =
|
|
70
|
+
const e = D(t[i]);
|
|
67
71
|
null != e && s.push(e);
|
|
68
72
|
}
|
|
69
|
-
(this.cards = this.
|
|
70
|
-
(this.
|
|
71
|
-
(this.
|
|
73
|
+
(this.cards = this.ws(this.bs(s, !1))),
|
|
74
|
+
(this.Bt = this.u.j(o.C.gs) || this.Bt),
|
|
75
|
+
(this.Ht = this.u.j(o.C.ys) || this.Ht);
|
|
72
76
|
}
|
|
73
|
-
|
|
74
|
-
let
|
|
77
|
+
Ns(t, s = !1, i = 0, e = 0) {
|
|
78
|
+
let h;
|
|
75
79
|
if (s) {
|
|
76
|
-
|
|
77
|
-
for (const t of this.cards) t.test &&
|
|
78
|
-
} else
|
|
80
|
+
h = [];
|
|
81
|
+
for (const t of this.cards) t.test && h.push(t);
|
|
82
|
+
} else h = this.cards.slice();
|
|
79
83
|
for (let i = 0; i < t.length; i++) {
|
|
80
84
|
const e = t[i];
|
|
81
|
-
let
|
|
85
|
+
let r = null;
|
|
82
86
|
for (let t = 0; t < this.cards.length; t++)
|
|
83
87
|
if (e.id === this.cards[t].id) {
|
|
84
|
-
|
|
88
|
+
r = this.cards[t];
|
|
85
89
|
break;
|
|
86
90
|
}
|
|
87
91
|
if (s) {
|
|
88
|
-
const t =
|
|
89
|
-
null !=
|
|
90
|
-
} else if (null ==
|
|
91
|
-
const t =
|
|
92
|
-
null != t &&
|
|
92
|
+
const t = R(e);
|
|
93
|
+
null != r && r.viewed && t && (t.viewed = !0), null != t && h.push(t);
|
|
94
|
+
} else if (null == r) {
|
|
95
|
+
const t = R(e);
|
|
96
|
+
null != t && h.push(t);
|
|
93
97
|
} else {
|
|
94
|
-
if (!
|
|
95
|
-
for (let t = 0; t <
|
|
96
|
-
if (e.id ===
|
|
97
|
-
|
|
98
|
+
if (!r.Ct(e))
|
|
99
|
+
for (let t = 0; t < h.length; t++)
|
|
100
|
+
if (e.id === h[t].id) {
|
|
101
|
+
h.splice(t, 1);
|
|
98
102
|
break;
|
|
99
103
|
}
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
|
-
(this.cards = this.
|
|
103
|
-
this.
|
|
104
|
-
(this.
|
|
105
|
-
(this.
|
|
106
|
-
this.u && (this.u.
|
|
106
|
+
(this.cards = this.ws(this.bs(h, s))),
|
|
107
|
+
this.js(),
|
|
108
|
+
(this.Bt = i),
|
|
109
|
+
(this.Ht = e),
|
|
110
|
+
this.u && (this.u.k(o.C.gs, this.Bt), this.u.k(o.C.ys, this.Ht));
|
|
107
111
|
}
|
|
108
|
-
|
|
109
|
-
if (this.
|
|
110
|
-
this.u && this.u.
|
|
112
|
+
Rs(t) {
|
|
113
|
+
if (this.Ts() && null != t && t.cards) {
|
|
114
|
+
this.u && this.u.k(o.C.Ds, e.Ss());
|
|
111
115
|
const s = t.full_sync;
|
|
112
|
-
s || this.
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
116
|
+
s || this.Kt(),
|
|
117
|
+
this.Ns(t.cards, s, t.last_full_sync_at, t.last_card_updated_at),
|
|
118
|
+
this.Jt.Dt(this.ks(!0));
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
|
-
|
|
118
|
-
this.u && this.u.
|
|
121
|
+
Us(t) {
|
|
122
|
+
this.u && this.u.k(o.C.As, t);
|
|
119
123
|
}
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
this.
|
|
124
|
+
Ls(t, e, h) {
|
|
125
|
+
const r = () => {
|
|
126
|
+
this.Fs(e, h, !0);
|
|
123
127
|
},
|
|
124
|
-
|
|
128
|
+
n = t ? b(t) : null;
|
|
125
129
|
let l;
|
|
126
|
-
if ((this.
|
|
127
|
-
const a =
|
|
130
|
+
if ((this.xs(), !n || !n["retry-after"])) return void this.Us(0);
|
|
131
|
+
const a = n["retry-after"];
|
|
128
132
|
if (isNaN(a) && !isNaN(Date.parse(a)))
|
|
129
|
-
(l = Date.parse(a) - new Date().getTime()), l < 0 &&
|
|
133
|
+
(l = Date.parse(a) - new Date().getTime()), l < 0 && r();
|
|
130
134
|
else {
|
|
131
135
|
if (isNaN(parseFloat(a.toString()))) {
|
|
132
136
|
const t =
|
|
133
137
|
"Received unexpected value for retry-after header in /sync response";
|
|
134
|
-
return s.
|
|
138
|
+
return s.q(i.Ms, { e: t + ": " + a }), void this.Us(0);
|
|
135
139
|
}
|
|
136
140
|
l = 1e3 * parseFloat(a.toString());
|
|
137
141
|
}
|
|
138
|
-
this.
|
|
139
|
-
|
|
142
|
+
this.ns = window.setTimeout(() => {
|
|
143
|
+
r();
|
|
140
144
|
}, l);
|
|
141
145
|
let u = 0;
|
|
142
|
-
this.u && (u = this.u.
|
|
146
|
+
this.u && (u = this.u.j(o.C.As)),
|
|
143
147
|
(null == u || isNaN(parseInt(u.toString()))) && (u = 0),
|
|
144
|
-
this.
|
|
148
|
+
this.Us(parseInt(u.toString()) + 1);
|
|
145
149
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
this.
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
es(t) {
|
|
151
|
+
var s;
|
|
152
|
+
if (!this.Ts()) return;
|
|
153
|
+
this.Kt();
|
|
154
|
+
const i = this.cards.slice();
|
|
155
|
+
let e = null;
|
|
156
|
+
e = null === (s = this.wt) || void 0 === s ? void 0 : s.getUserId();
|
|
157
|
+
for (let s = 0; s < t.length; s++)
|
|
158
|
+
if (e === t[s].userId || (null == e && null == t[s].userId)) {
|
|
159
|
+
const e = t[s].card;
|
|
155
160
|
let h = null;
|
|
156
161
|
for (let t = 0; t < this.cards.length; t++)
|
|
157
|
-
if (
|
|
162
|
+
if (e.id === this.cards[t].id) {
|
|
158
163
|
h = this.cards[t];
|
|
159
164
|
break;
|
|
160
165
|
}
|
|
161
166
|
if (null == h) {
|
|
162
|
-
const t =
|
|
163
|
-
null != t &&
|
|
167
|
+
const t = R(e);
|
|
168
|
+
null != t && i.push(t);
|
|
164
169
|
} else {
|
|
165
|
-
if (!h.Ct(
|
|
166
|
-
for (let t = 0; t <
|
|
167
|
-
if (
|
|
168
|
-
|
|
170
|
+
if (!h.Ct(e))
|
|
171
|
+
for (let t = 0; t < i.length; t++)
|
|
172
|
+
if (e.id === i[t].id) {
|
|
173
|
+
i.splice(t, 1);
|
|
169
174
|
break;
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
}
|
|
173
|
-
(this.cards = this.
|
|
178
|
+
(this.cards = this.ws(this.bs(i, !1))), this.js(), this.Jt.Dt(this.ks(!0));
|
|
174
179
|
}
|
|
175
|
-
|
|
176
|
-
let
|
|
177
|
-
|
|
178
|
-
|
|
180
|
+
bs(t, s) {
|
|
181
|
+
let i = {},
|
|
182
|
+
e = {},
|
|
183
|
+
h = {};
|
|
179
184
|
this.u &&
|
|
180
|
-
((
|
|
181
|
-
(
|
|
182
|
-
(
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
+
((i = this.u.j(o.C.v) || {}),
|
|
186
|
+
(e = this.u.j(o.C.H) || {}),
|
|
187
|
+
(h = this.u.j(o.C.A) || {}));
|
|
188
|
+
const r = {},
|
|
189
|
+
n = {},
|
|
185
190
|
l = {};
|
|
186
191
|
for (let s = 0; s < t.length; s++) {
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
+
const o = t[s].id;
|
|
193
|
+
o &&
|
|
194
|
+
(i[o] && ((t[s].clicked = !0), (r[o] = !0)),
|
|
195
|
+
e[o] && ((t[s].viewed = !0), (n[o] = !0)),
|
|
196
|
+
h[o] && ((t[s].dismissed = !0), (l[o] = !0)));
|
|
192
197
|
}
|
|
193
198
|
return (
|
|
194
199
|
s &&
|
|
195
200
|
this.u &&
|
|
196
|
-
(this.u.
|
|
201
|
+
(this.u.k(o.C.v, r), this.u.k(o.C.H, n), this.u.k(o.C.A, l)),
|
|
197
202
|
t
|
|
198
203
|
);
|
|
199
204
|
}
|
|
200
|
-
|
|
205
|
+
ws(t) {
|
|
201
206
|
const s = [],
|
|
202
|
-
|
|
203
|
-
let
|
|
204
|
-
this.u && (
|
|
205
|
-
let
|
|
206
|
-
for (let
|
|
207
|
-
const o = t[
|
|
208
|
-
if (!this.
|
|
209
|
-
r.
|
|
207
|
+
i = new Date();
|
|
208
|
+
let e = {};
|
|
209
|
+
this.u && (e = this.u.j(o.C.A) || {});
|
|
210
|
+
let h = !1;
|
|
211
|
+
for (let n = 0; n < t.length; n++) {
|
|
212
|
+
const o = t[n].url;
|
|
213
|
+
if (!this.Ft && o && N(o)) {
|
|
214
|
+
r.error(
|
|
210
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.`,
|
|
211
216
|
);
|
|
212
217
|
continue;
|
|
213
218
|
}
|
|
214
|
-
const l = t[
|
|
219
|
+
const l = t[n].expiresAt;
|
|
215
220
|
let a = !0;
|
|
216
|
-
if ((null != l && (a = l >=
|
|
217
|
-
s.push(t[
|
|
221
|
+
if ((null != l && (a = l >= i), (a = a && !t[n].dismissed), a))
|
|
222
|
+
s.push(t[n]);
|
|
218
223
|
else {
|
|
219
|
-
const s = t[
|
|
220
|
-
s && (
|
|
224
|
+
const s = t[n].id;
|
|
225
|
+
s && (e[s] = !0), (h = !0);
|
|
221
226
|
}
|
|
222
227
|
}
|
|
223
|
-
return
|
|
228
|
+
return h && this.u && this.u.k(o.C.A, e), s;
|
|
224
229
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
for (let
|
|
229
|
-
this.u.
|
|
230
|
+
js() {
|
|
231
|
+
var t;
|
|
232
|
+
const s = [];
|
|
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.Cs, s);
|
|
230
235
|
}
|
|
231
|
-
|
|
232
|
-
this.
|
|
236
|
+
xs() {
|
|
237
|
+
this.ns && (clearTimeout(this.ns), (this.ns = null));
|
|
233
238
|
}
|
|
234
|
-
|
|
235
|
-
null != this.
|
|
239
|
+
zs() {
|
|
240
|
+
null != this.os && (clearTimeout(this.os), (this.os = null));
|
|
236
241
|
}
|
|
237
|
-
|
|
238
|
-
this.
|
|
239
|
-
(this.
|
|
240
|
-
this.
|
|
242
|
+
Es(t = 1e3 * this.us, s, i) {
|
|
243
|
+
this.zs(),
|
|
244
|
+
(this.os = window.setTimeout(() => {
|
|
245
|
+
this.Fs(s, i, !0);
|
|
241
246
|
}, t)),
|
|
242
|
-
(this.
|
|
247
|
+
(this.ls = t);
|
|
243
248
|
}
|
|
244
|
-
|
|
245
|
-
var
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
if (!
|
|
249
|
-
const
|
|
250
|
-
if ((
|
|
249
|
+
Fs(t, s, i = !1, h = !0) {
|
|
250
|
+
var n, l;
|
|
251
|
+
const a = this.qt,
|
|
252
|
+
u = this.u;
|
|
253
|
+
if (!a || !u) return void ("function" == typeof s && s());
|
|
254
|
+
const c = !i;
|
|
255
|
+
if ((c && (this.xs(), this.Us(0)), !this.Ts()))
|
|
251
256
|
return void (
|
|
252
|
-
this.yt
|
|
253
|
-
|
|
254
|
-
|
|
257
|
+
null === (n = this.yt) ||
|
|
258
|
+
void 0 === n ||
|
|
259
|
+
n.qs(() => {
|
|
260
|
+
this.Fs(t, s);
|
|
255
261
|
})
|
|
256
262
|
);
|
|
257
|
-
let
|
|
263
|
+
let f = !0;
|
|
258
264
|
if (
|
|
259
|
-
(
|
|
260
|
-
(null === (
|
|
261
|
-
(
|
|
262
|
-
!
|
|
265
|
+
(c &&
|
|
266
|
+
(null === (l = this.yt) || void 0 === l ? void 0 : l.Is()) &&
|
|
267
|
+
(f = this.Js()),
|
|
268
|
+
!f)
|
|
263
269
|
)
|
|
264
|
-
return void r.
|
|
265
|
-
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
(
|
|
269
|
-
(
|
|
270
|
-
const
|
|
271
|
-
let
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
"
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
(this.
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
270
|
+
return void r.info("Content card sync being throttled.");
|
|
271
|
+
h && this.zs();
|
|
272
|
+
const d = a.Ps({}, !0);
|
|
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
|
+
() => {
|
|
281
|
+
if (this.u) {
|
|
282
|
+
const t = new Date().valueOf();
|
|
283
|
+
c && this.u.k(o.C.Ks, t), S.Os(this.u, S.Gs.Bs, t);
|
|
284
|
+
}
|
|
285
|
+
C.Qs({
|
|
286
|
+
url: a.Vs() + "/content_cards/sync",
|
|
287
|
+
data: d,
|
|
288
|
+
headers: m,
|
|
289
|
+
L: (i, e) => {
|
|
290
|
+
if (!a.Ws(d, i, m))
|
|
291
|
+
return (p = !0), void ("function" == typeof s && s());
|
|
292
|
+
a.Xs(),
|
|
293
|
+
this.Ls(e, t, s),
|
|
294
|
+
this.Rs(i),
|
|
295
|
+
(p = !1),
|
|
296
|
+
S.Ys(this.u, S.Gs.Bs, 1),
|
|
297
|
+
"function" == typeof t && t();
|
|
298
|
+
},
|
|
299
|
+
error: (t) => {
|
|
300
|
+
a.Zs(t, "retrieving content cards"),
|
|
301
|
+
(p = !0),
|
|
302
|
+
"function" == typeof s && s();
|
|
303
|
+
},
|
|
304
|
+
ti: () => {
|
|
305
|
+
if (p && h && !this.os && this.cs + 1 < U) {
|
|
306
|
+
S.si(this.u, S.Gs.Bs);
|
|
307
|
+
let i = this.ls;
|
|
308
|
+
(null == i || i < 1e3 * this.us) && (i = 1e3 * this.us),
|
|
309
|
+
this.Es(Math.min(3e5, k(1e3 * this.us, 3 * i)), t, s),
|
|
310
|
+
(this.cs = this.cs + 1);
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
});
|
|
314
|
+
},
|
|
315
|
+
S.ii.Bs,
|
|
316
|
+
);
|
|
307
317
|
}
|
|
308
|
-
|
|
309
|
-
t || this.
|
|
310
|
-
const s = this.
|
|
318
|
+
ks(t) {
|
|
319
|
+
t || this.Kt();
|
|
320
|
+
const s = this.ws(this.cards);
|
|
311
321
|
s.sort((t, s) =>
|
|
312
322
|
t.pinned && !s.pinned
|
|
313
323
|
? -1
|
|
@@ -319,73 +329,73 @@ export default class v extends y {
|
|
|
319
329
|
? 1
|
|
320
330
|
: 0,
|
|
321
331
|
);
|
|
322
|
-
let
|
|
332
|
+
let i = Math.max(this.Ht || 0, this.Bt || 0);
|
|
323
333
|
return (
|
|
324
|
-
0 ===
|
|
325
|
-
this.u && this.u.
|
|
326
|
-
new ContentCards(s, l(
|
|
334
|
+
0 === i && (i = void 0),
|
|
335
|
+
this.u && this.u.j(o.C.ys) === this.Ht && void 0 === i && (i = this.Ht),
|
|
336
|
+
new ContentCards(s, l(i))
|
|
327
337
|
);
|
|
328
338
|
}
|
|
329
|
-
|
|
330
|
-
return this.
|
|
339
|
+
ei(t) {
|
|
340
|
+
return this.Jt.It(t);
|
|
331
341
|
}
|
|
332
|
-
|
|
333
|
-
(this.
|
|
334
|
-
(this.
|
|
335
|
-
this.u && (this.u.
|
|
342
|
+
$s() {
|
|
343
|
+
(this.Bt = 0),
|
|
344
|
+
(this.Ht = 0),
|
|
345
|
+
this.u && (this.u.hi(o.C.gs), this.u.hi(o.C.ys));
|
|
336
346
|
}
|
|
337
347
|
changeUser(t) {
|
|
338
348
|
t ||
|
|
339
349
|
((this.cards = []),
|
|
340
|
-
this.
|
|
350
|
+
this.Jt.Dt(new ContentCards(this.cards.slice(), null)),
|
|
341
351
|
this.u &&
|
|
342
|
-
(this.u.
|
|
343
|
-
this.u.
|
|
344
|
-
this.u.
|
|
345
|
-
this.u.
|
|
346
|
-
this
|
|
352
|
+
(this.u.hi(o.C.Cs),
|
|
353
|
+
this.u.hi(o.C.v),
|
|
354
|
+
this.u.hi(o.C.H),
|
|
355
|
+
this.u.hi(o.C.A))),
|
|
356
|
+
this.$s();
|
|
347
357
|
}
|
|
348
358
|
clearData(t) {
|
|
349
|
-
(this.
|
|
350
|
-
(this.
|
|
359
|
+
(this.Bt = 0),
|
|
360
|
+
(this.Ht = 0),
|
|
351
361
|
(this.cards = []),
|
|
352
|
-
this.
|
|
362
|
+
this.Jt.Dt(new ContentCards(this.cards.slice(), null)),
|
|
353
363
|
t &&
|
|
354
364
|
this.u &&
|
|
355
|
-
(this.u.
|
|
356
|
-
this.u.
|
|
357
|
-
this.u.
|
|
358
|
-
this.u.
|
|
359
|
-
this.u.
|
|
360
|
-
this.u.
|
|
365
|
+
(this.u.hi(o.C.Cs),
|
|
366
|
+
this.u.hi(o.C.v),
|
|
367
|
+
this.u.hi(o.C.H),
|
|
368
|
+
this.u.hi(o.C.A),
|
|
369
|
+
this.u.hi(o.C.gs),
|
|
370
|
+
this.u.hi(o.C.ys));
|
|
361
371
|
}
|
|
362
|
-
|
|
363
|
-
return
|
|
372
|
+
Ts() {
|
|
373
|
+
return (
|
|
374
|
+
!!this.yt && (!!this.yt.ri() || (0 !== this.yt.ni() && this.oi(), !1))
|
|
375
|
+
);
|
|
364
376
|
}
|
|
365
|
-
|
|
366
|
-
this.u && this.u.
|
|
377
|
+
li(t) {
|
|
378
|
+
this.u && this.u.k(o.C.ai, t);
|
|
367
379
|
}
|
|
368
|
-
|
|
369
|
-
return this.u ? this.u.
|
|
380
|
+
ui() {
|
|
381
|
+
return this.u ? this.u.j(o.C.ai) : null;
|
|
370
382
|
}
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
if (!t || !s) return !0;
|
|
375
|
-
const e = t.v(i.k.Vs);
|
|
383
|
+
Js() {
|
|
384
|
+
var t, s, i;
|
|
385
|
+
const e = null === (t = this.u) || void 0 === t ? void 0 : t.j(o.C.Ks);
|
|
376
386
|
if (null == e || isNaN(e)) return !0;
|
|
377
|
-
const h = s.
|
|
378
|
-
r =
|
|
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;
|
|
379
389
|
if (-1 === h || -1 === r) return !0;
|
|
380
|
-
let n = this.
|
|
390
|
+
let n = this.ui();
|
|
381
391
|
(null == n || isNaN(n)) && (n = h);
|
|
382
|
-
const
|
|
392
|
+
const l = (new Date().valueOf() - e) / 1e3;
|
|
383
393
|
return (
|
|
384
|
-
(n = Math.min(n +
|
|
385
|
-
!(n < 1) && ((n = Math.trunc(n) - 1), this.
|
|
394
|
+
(n = Math.min(n + l / r, h)),
|
|
395
|
+
!(n < 1) && ((n = Math.trunc(n) - 1), this.li(n), !0)
|
|
386
396
|
);
|
|
387
397
|
}
|
|
388
|
-
|
|
389
|
-
this.
|
|
398
|
+
oi() {
|
|
399
|
+
this.Jt.Dt(new ContentCards([], new Date())), this.u && this.u.hi(o.C.Cs);
|
|
390
400
|
}
|
|
391
401
|
}
|