@braze/web-sdk 6.5.0 → 6.6.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 +8 -3
- package/package.json +1 -1
- package/shared-lib/event-types.js +11 -11
- package/shared-lib/indexed-db-adapter.js +4 -4
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +14 -13
- package/src/Core/disable-sdk.js +8 -7
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/is-disabled.js +1 -1
- package/src/DUST/dust-provider.js +100 -100
- package/src/DUST/dust-shared-worker-impl.js +12 -12
- package/src/DUST/dust-worker-bridge.js +11 -11
- package/src/DUST/subscribe-to-dust.js +5 -5
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +68 -68
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-click.js +1 -1
- package/src/InAppMessage/log-in-app-message-html-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-impression.js +1 -1
- package/src/InAppMessage/models/full-screen-message.js +7 -7
- package/src/InAppMessage/models/html-message.js +8 -8
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +42 -42
- package/src/InAppMessage/models/modal-message.js +8 -8
- package/src/InAppMessage/models/slide-up-message.js +6 -6
- 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/Push/push-manager-factory.js +2 -2
- package/src/Push/utils/push-utils.js +6 -6
- package/src/User/user-manager.js +2 -2
- package/src/User/user.js +9 -9
- package/src/common/content-cards-display.js +1 -1
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/braze-instance.js +99 -95
- package/src/managers/device-manager.js +2 -2
- package/src/managers/network-manager.js +116 -116
- package/src/managers/server-config-manager.js +33 -33
- package/src/managers/session-manager.js +1 -1
- package/src/managers/storage-manager-factory.js +8 -8
- package/src/managers/storage-manager.js +45 -48
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +1 -1
- package/src/models/device.js +1 -1
- package/src/models/push-token.js +6 -6
- package/src/models/server-config.js +29 -29
- package/src/request-controller.js +91 -91
- package/src/triggers/models/trigger-condition.js +25 -25
- package/src/triggers/models/trigger.js +7 -7
- package/src/triggers/triggers-provider-factory.js +1 -1
- package/src/triggers/triggers-provider.js +12 -12
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/braze-actions.js +2 -2
- package/src/util/browser-detector.js +1 -1
- package/src/util/net.js +2 -2
- package/src/util/request-header-utils.js +12 -12
- package/src/util/window-utils.js +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import qt from "../models/backend-errors.js";
|
|
2
2
|
import De from "../models/braze-event.js";
|
|
3
3
|
import {
|
|
4
4
|
convertMsToSeconds as X,
|
|
5
|
-
convertSecondsToMs as
|
|
5
|
+
convertSecondsToMs as Xt,
|
|
6
6
|
} from "../util/date-utils.js";
|
|
7
7
|
import v from "../common/event-logger.js";
|
|
8
8
|
import { isArray as R, isEqual as ni } from "../util/code-utils.js";
|
|
@@ -19,51 +19,51 @@ export default class Mt {
|
|
|
19
19
|
constructor(t, e, i, s, r, n, o, a, h, u, l, c) {
|
|
20
20
|
(this.eu = t),
|
|
21
21
|
(this.B = e),
|
|
22
|
-
(this.
|
|
22
|
+
(this.al = i),
|
|
23
23
|
(this.vs = s),
|
|
24
24
|
(this.C = r),
|
|
25
25
|
(this.h = n),
|
|
26
26
|
(this.tu = o),
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
27
|
+
(this.ul = a),
|
|
28
|
+
(this.rl = h),
|
|
29
|
+
(this.hl = u),
|
|
30
30
|
(this.appVersion = l),
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
31
|
+
(this.Rl = c),
|
|
32
|
+
(this.bl = (t) => (null == t ? "" : `${t} `)),
|
|
33
33
|
(this.eu = t),
|
|
34
34
|
(this.B = e),
|
|
35
|
-
(this.
|
|
35
|
+
(this.al = i),
|
|
36
36
|
(this.vs = s),
|
|
37
37
|
(this.C = r),
|
|
38
38
|
(this.h = n),
|
|
39
39
|
(this.tu = o),
|
|
40
|
-
(this.
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
40
|
+
(this.ul = a),
|
|
41
|
+
(this.rl = h),
|
|
42
|
+
(this.hl = u),
|
|
43
43
|
(this.appVersion = l),
|
|
44
|
-
(this.
|
|
45
|
-
(this.
|
|
46
|
-
(this.
|
|
44
|
+
(this.Rl = c),
|
|
45
|
+
(this.ql = ["npm"]),
|
|
46
|
+
(this.Dl = {});
|
|
47
47
|
}
|
|
48
48
|
$(t, e = !1, i = !1) {
|
|
49
49
|
const r = this.eu.ve(!i),
|
|
50
|
-
n = r.
|
|
50
|
+
n = r.Jn(),
|
|
51
51
|
o = this.B.dt(s.ft.ac);
|
|
52
52
|
ni(o, n) || (t.device = n),
|
|
53
53
|
(t.api_key = this.tu),
|
|
54
54
|
(t.time = X(new Date().valueOf(), !0));
|
|
55
|
-
const a = this.B.dt(s.ft.
|
|
56
|
-
h = this.B.dt(s.ft.
|
|
57
|
-
this.
|
|
58
|
-
(!ni(a, this.
|
|
59
|
-
(t.sdk_metadata = this.
|
|
60
|
-
(t.sdk_version = this.
|
|
61
|
-
this.
|
|
55
|
+
const a = this.B.dt(s.ft.Tl) || [],
|
|
56
|
+
h = this.B.dt(s.ft.kl) || "";
|
|
57
|
+
this.ql.length > 0 &&
|
|
58
|
+
(!ni(a, this.ql) || h !== this.C.yt()) &&
|
|
59
|
+
(t.sdk_metadata = this.ql),
|
|
60
|
+
(t.sdk_version = this.rl),
|
|
61
|
+
this.hl && (t.sdk_flavor = this.hl),
|
|
62
62
|
(t.app_version = this.appVersion),
|
|
63
|
-
(t.app_version_code = this.
|
|
63
|
+
(t.app_version_code = this.Rl),
|
|
64
64
|
(t.device_id = r.id);
|
|
65
65
|
const u = this.vs.getUserId();
|
|
66
|
-
if ((e && null !== u && (t.user_id = u), !u && !this.
|
|
66
|
+
if ((e && null !== u && (t.user_id = u), !u && !this.al.wh())) {
|
|
67
67
|
const e = qe(this.B);
|
|
68
68
|
e && (t.alias = e);
|
|
69
69
|
}
|
|
@@ -75,7 +75,7 @@ export default class Mt {
|
|
|
75
75
|
if (!s && !r) return !0;
|
|
76
76
|
if (s) {
|
|
77
77
|
let e;
|
|
78
|
-
this.
|
|
78
|
+
this.al.Hh();
|
|
79
79
|
const r = { errorCode: s.error_code };
|
|
80
80
|
for (const t of i)
|
|
81
81
|
R(t) && "X-Braze-Auth-Signature" === t[0] && (r.signature = t[1]);
|
|
@@ -87,12 +87,12 @@ export default class Mt {
|
|
|
87
87
|
n
|
|
88
88
|
? ((r.reason = n), (e = `due to ${n}`))
|
|
89
89
|
: (e = `with error code ${s.error_code}.`),
|
|
90
|
-
this.
|
|
90
|
+
this.al.wh() ||
|
|
91
91
|
(e +=
|
|
92
92
|
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
|
|
93
93
|
E.error(`SDK Authentication failed ${e}`),
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
94
|
+
this.yl(t.events || [], t.attributes || []),
|
|
95
|
+
this.al.Bh(r),
|
|
96
96
|
!1
|
|
97
97
|
);
|
|
98
98
|
}
|
|
@@ -100,42 +100,42 @@ export default class Mt {
|
|
|
100
100
|
let i,
|
|
101
101
|
s = r;
|
|
102
102
|
switch (s) {
|
|
103
|
-
case
|
|
103
|
+
case qt.wl:
|
|
104
104
|
return (
|
|
105
105
|
(i = "Received successful response with empty body."),
|
|
106
|
-
v.lt(f.
|
|
106
|
+
v.lt(f.Cl, { e: i }),
|
|
107
107
|
E.info(i),
|
|
108
108
|
!1
|
|
109
109
|
);
|
|
110
|
-
case
|
|
110
|
+
case qt.Bl:
|
|
111
111
|
return (
|
|
112
112
|
(i = "Received successful response with invalid JSON"),
|
|
113
|
-
v.lt(f.
|
|
113
|
+
v.lt(f.Cl, { e: i + ": " + e.response }),
|
|
114
114
|
E.info(i),
|
|
115
115
|
!1
|
|
116
116
|
);
|
|
117
|
-
case
|
|
118
|
-
s = `The API key "${t.api_key}" is invalid for the baseUrl ${this.
|
|
117
|
+
case qt.zl:
|
|
118
|
+
s = `The API key "${t.api_key}" is invalid for the baseUrl ${this.ul}`;
|
|
119
119
|
break;
|
|
120
|
-
case
|
|
120
|
+
case qt.jl:
|
|
121
121
|
s =
|
|
122
122
|
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
|
|
123
123
|
break;
|
|
124
|
-
case
|
|
124
|
+
case qt.Ml:
|
|
125
125
|
s = "No device identifier. Please contact support@braze.com";
|
|
126
126
|
}
|
|
127
127
|
E.error("Backend error: " + s);
|
|
128
128
|
}
|
|
129
129
|
return !1;
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
$l(t, e, i) {
|
|
132
132
|
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || i);
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
Xl(t, e, i, s = !1) {
|
|
135
135
|
const r = [],
|
|
136
136
|
n = (t) => t || "",
|
|
137
137
|
o = n(this.vs.getUserId());
|
|
138
|
-
let a = this.
|
|
138
|
+
let a = this.Hn(t);
|
|
139
139
|
const u = [],
|
|
140
140
|
l = [];
|
|
141
141
|
let c,
|
|
@@ -143,7 +143,7 @@ export default class Mt {
|
|
|
143
143
|
if (e.length > 0) {
|
|
144
144
|
const t = [];
|
|
145
145
|
for (const i of e) {
|
|
146
|
-
if (((c = i.
|
|
146
|
+
if (((c = i.Jn()), this.al.wh())) {
|
|
147
147
|
if (o && !c.user_id) {
|
|
148
148
|
d || (d = {}), d.events || (d.events = []), d.events.push(c);
|
|
149
149
|
continue;
|
|
@@ -160,50 +160,50 @@ export default class Mt {
|
|
|
160
160
|
if (i.length > 0) {
|
|
161
161
|
const t = [];
|
|
162
162
|
for (const e of i)
|
|
163
|
-
e && (this.
|
|
163
|
+
e && (this.al.wh() && n(e.user_id) !== o ? u.push(e) : t.push(e));
|
|
164
164
|
t.length > 0 && (a.attributes = t);
|
|
165
165
|
}
|
|
166
|
-
if ((this.
|
|
166
|
+
if ((this.yl(l, u), (a = this.$(a, !1, s)), d)) {
|
|
167
167
|
d = this.$(d, !1, s);
|
|
168
|
-
const t = { requestData: d, headers: this.A(d, h.H.
|
|
168
|
+
const t = { requestData: d, headers: this.A(d, h.H._e) };
|
|
169
169
|
r.push(t);
|
|
170
170
|
}
|
|
171
|
-
if (a && !this
|
|
172
|
-
const f = { requestData: a, headers: this.A(a, h.H.
|
|
171
|
+
if (a && !this.$l(a.events, a.attributes, t)) return d ? r : null;
|
|
172
|
+
const f = { requestData: a, headers: this.A(a, h.H._e) };
|
|
173
173
|
return r.push(f), r;
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
yl(t, e) {
|
|
176
176
|
if (t) {
|
|
177
177
|
const e = [];
|
|
178
178
|
for (const i of t) {
|
|
179
179
|
const t = De.fromJson(i);
|
|
180
|
-
(t.time =
|
|
180
|
+
(t.time = Xt(t.time)), e.push(t);
|
|
181
181
|
}
|
|
182
182
|
this.B.ol(e);
|
|
183
183
|
}
|
|
184
|
-
if (e) for (const t of e) this.B.
|
|
184
|
+
if (e) for (const t of e) this.B.Ll(t);
|
|
185
185
|
}
|
|
186
186
|
_(t, e) {
|
|
187
187
|
let i = "HTTP error ";
|
|
188
188
|
null != t && (i += t + " "), (i += e), E.error(i);
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
return v.lt(f.
|
|
190
|
+
Fl(t) {
|
|
191
|
+
return v.lt(f.Kl, { n: t });
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
Hn(t, e) {
|
|
194
194
|
const i = {};
|
|
195
195
|
t && (i.triggers = !0);
|
|
196
196
|
const s = null != e ? e : this.vs.getUserId();
|
|
197
|
-
if ((s && (i.user_id = s), !i.user_id && !this.
|
|
197
|
+
if ((s && (i.user_id = s), !i.user_id && !this.al.wh())) {
|
|
198
198
|
const t = qe(this.B);
|
|
199
199
|
t && (i.alias = t);
|
|
200
200
|
}
|
|
201
201
|
return (i.config = { config_time: this.h.xt() }), { respond_with: i };
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
Pl(t) {
|
|
204
204
|
const e = new Date().valueOf();
|
|
205
205
|
let i = Qt.toString();
|
|
206
|
-
const s = h.
|
|
206
|
+
const s = h.Ul(this.B, t);
|
|
207
207
|
if (-1 !== s) {
|
|
208
208
|
i = (e - s).toString();
|
|
209
209
|
}
|
|
@@ -211,9 +211,9 @@ export default class Mt {
|
|
|
211
211
|
}
|
|
212
212
|
A(t, e, i = !1) {
|
|
213
213
|
const s = [["X-Braze-Api-Key", this.tu]],
|
|
214
|
-
r = this.
|
|
214
|
+
r = this.Pl(e);
|
|
215
215
|
s.push(["X-Braze-Last-Req-Ms-Ago", r]);
|
|
216
|
-
const n = h.
|
|
216
|
+
const n = h.xl(this.B, e).toString();
|
|
217
217
|
s.push(["X-Braze-Req-Attempt", n]);
|
|
218
218
|
let o = !1;
|
|
219
219
|
if (
|
|
@@ -223,8 +223,8 @@ export default class Mt {
|
|
|
223
223
|
e === h.H.vi)
|
|
224
224
|
) {
|
|
225
225
|
s.push(["X-Braze-ContentCardsRequest", "true"]);
|
|
226
|
-
let t = h.
|
|
227
|
-
(t && !i) || ((t = 1), h.
|
|
226
|
+
let t = h.xl(this.B, h.H.vi);
|
|
227
|
+
(t && !i) || ((t = 1), h.Hl(this.B, h.H.vi, t));
|
|
228
228
|
const e = Math.max(0, t - 1);
|
|
229
229
|
s.push(["BRAZE-SYNC-RETRY-COUNT", e.toString()]), (o = !0);
|
|
230
230
|
}
|
|
@@ -232,55 +232,55 @@ export default class Mt {
|
|
|
232
232
|
(e === h.H.wo &&
|
|
233
233
|
(s.push(["X-Braze-FeatureFlagsRequest", "true"]), (o = !0)),
|
|
234
234
|
o && s.push(["X-Braze-DataRequest", "true"]),
|
|
235
|
-
this.
|
|
235
|
+
this.al.wh())
|
|
236
236
|
) {
|
|
237
|
-
const t = this.
|
|
237
|
+
const t = this.al.jh();
|
|
238
238
|
null != t && s.push(["X-Braze-Auth-Signature", t]);
|
|
239
239
|
}
|
|
240
240
|
return s;
|
|
241
241
|
}
|
|
242
|
-
|
|
243
|
-
if (this.
|
|
242
|
+
Ol(t, e, i, s) {
|
|
243
|
+
if (this.Dl[s]) return;
|
|
244
244
|
const r = window.setTimeout(() => {
|
|
245
|
-
E.info(`Retrying rate limited ${this.
|
|
245
|
+
E.info(`Retrying rate limited ${this.bl(s)}SDK request.`),
|
|
246
246
|
this.J(e, i, s);
|
|
247
247
|
}, t);
|
|
248
|
-
this.
|
|
248
|
+
this.Dl[s] = r;
|
|
249
249
|
}
|
|
250
250
|
fo() {
|
|
251
|
-
for (const t in this.
|
|
252
|
-
const e = this.
|
|
251
|
+
for (const t in this.Dl) {
|
|
252
|
+
const e = this.Dl[t];
|
|
253
253
|
window.clearTimeout(e);
|
|
254
254
|
}
|
|
255
|
-
this.
|
|
255
|
+
this.Dl = {};
|
|
256
256
|
}
|
|
257
257
|
J(t, e, i, r) {
|
|
258
|
-
if (!this.
|
|
258
|
+
if (!this.Gl(i))
|
|
259
259
|
return (
|
|
260
|
-
E.info(`${this.
|
|
260
|
+
E.info(`${this.bl(i)}SDK request being rate limited.`),
|
|
261
261
|
void ("function" == typeof r && r())
|
|
262
262
|
);
|
|
263
|
-
const n = this.
|
|
264
|
-
if (!n.
|
|
263
|
+
const n = this.Wl();
|
|
264
|
+
if (!n.Yl)
|
|
265
265
|
return (
|
|
266
|
-
this.
|
|
266
|
+
this.Ol(n.Jl, t, e, i),
|
|
267
267
|
void E.info(
|
|
268
|
-
`${this.
|
|
268
|
+
`${this.bl(
|
|
269
269
|
i,
|
|
270
270
|
)}SDK request being rate limited. Request will be retried in ${Math.trunc(
|
|
271
|
-
n.
|
|
271
|
+
n.Jl / 1e3,
|
|
272
272
|
)} seconds.`,
|
|
273
273
|
)
|
|
274
274
|
);
|
|
275
|
-
this.B.bt(s.ft.
|
|
275
|
+
this.B.bt(s.ft.Ql, new Date().valueOf());
|
|
276
276
|
const o = t.device;
|
|
277
277
|
o && o.os_version instanceof Promise
|
|
278
278
|
? o.os_version.then((i) => {
|
|
279
|
-
(t.device.os_version = i), e(n.
|
|
279
|
+
(t.device.os_version = i), e(n.Vl);
|
|
280
280
|
})
|
|
281
|
-
: e(n.
|
|
281
|
+
: e(n.Vl);
|
|
282
282
|
}
|
|
283
|
-
|
|
283
|
+
Zl(t) {
|
|
284
284
|
const e = t ? Ae(t) : null;
|
|
285
285
|
if (!e || !e["retry-after"]) return null;
|
|
286
286
|
const i = e["retry-after"];
|
|
@@ -291,21 +291,21 @@ export default class Mt {
|
|
|
291
291
|
{
|
|
292
292
|
const t =
|
|
293
293
|
"Received unexpected value for retry-after header in /sync response";
|
|
294
|
-
v.lt(f.
|
|
294
|
+
v.lt(f.Cl, { e: t + ": " + i });
|
|
295
295
|
}
|
|
296
296
|
return null;
|
|
297
297
|
}
|
|
298
298
|
et(t, e, i, s, r, n) {
|
|
299
|
-
if (h.
|
|
299
|
+
if (h.xl(this.B, i) >= Zt) return;
|
|
300
300
|
let o;
|
|
301
301
|
n = n || 0;
|
|
302
|
-
const a = this.
|
|
302
|
+
const a = this.Zl(t);
|
|
303
303
|
r();
|
|
304
304
|
const u = (t) => {
|
|
305
305
|
const r = window.setTimeout(() => {
|
|
306
306
|
e();
|
|
307
307
|
}, t);
|
|
308
|
-
s(r), h.
|
|
308
|
+
s(r), h.hc(this.B, i);
|
|
309
309
|
};
|
|
310
310
|
if (a && !isNaN(a.value)) {
|
|
311
311
|
switch (a.type) {
|
|
@@ -318,44 +318,44 @@ export default class Mt {
|
|
|
318
318
|
u(o);
|
|
319
319
|
} else n ? u(n) : h.fi(this.B, i);
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
uc(t) {
|
|
322
322
|
var e;
|
|
323
|
-
null === (e = this.B) || void 0 === e || e.bt(s.ft.
|
|
323
|
+
null === (e = this.B) || void 0 === e || e.bt(s.ft.lc, t);
|
|
324
324
|
}
|
|
325
|
-
|
|
326
|
-
let i = this.
|
|
327
|
-
null == i && (i = {}), (i[t] = e), this.B.bt(s.ft.
|
|
325
|
+
dc(t, e) {
|
|
326
|
+
let i = this.fc();
|
|
327
|
+
null == i && (i = {}), (i[t] = e), this.B.bt(s.ft.mc, i);
|
|
328
328
|
}
|
|
329
|
-
|
|
329
|
+
vc() {
|
|
330
330
|
var t;
|
|
331
|
-
return null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.
|
|
331
|
+
return null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.lc);
|
|
332
332
|
}
|
|
333
|
-
|
|
333
|
+
fc() {
|
|
334
334
|
var t;
|
|
335
|
-
return null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.
|
|
335
|
+
return null === (t = this.B) || void 0 === t ? void 0 : t.dt(s.ft.mc);
|
|
336
336
|
}
|
|
337
|
-
|
|
337
|
+
Rc(t, e, i, s, r = "") {
|
|
338
338
|
let n;
|
|
339
339
|
if (r) {
|
|
340
|
-
const t = this.
|
|
340
|
+
const t = this.fc();
|
|
341
341
|
n = null == t || isNaN(t[r]) ? e : t[r];
|
|
342
|
-
} else (n = this.
|
|
342
|
+
} else (n = this.vc()), (null == n || isNaN(n)) && (n = e);
|
|
343
343
|
const o = (t - s) / 1e3;
|
|
344
344
|
return (n = Math.min(n + o / i, e)), n;
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
gc(t, e) {
|
|
347
347
|
return Math.max(0, (1 - t) * e * 1e3);
|
|
348
348
|
}
|
|
349
|
-
|
|
349
|
+
bc(t, e = "") {
|
|
350
350
|
var i, r, n, o, a;
|
|
351
|
-
const u = {
|
|
351
|
+
const u = { Yl: !0, Vl: -1, Jl: 0 };
|
|
352
352
|
if ((null == t && (t = !0), !t && !e)) return u;
|
|
353
353
|
let l,
|
|
354
354
|
c,
|
|
355
355
|
d = null;
|
|
356
|
-
if (t) d = null === (i = this.B) || void 0 === i ? void 0 : i.dt(s.ft.
|
|
356
|
+
if (t) d = null === (i = this.B) || void 0 === i ? void 0 : i.dt(s.ft.Ql);
|
|
357
357
|
else {
|
|
358
|
-
const t = h.
|
|
358
|
+
const t = h.qc(this.B);
|
|
359
359
|
if (null == t || null == t[e]) return u;
|
|
360
360
|
d = t[e];
|
|
361
361
|
}
|
|
@@ -363,38 +363,38 @@ export default class Mt {
|
|
|
363
363
|
if (
|
|
364
364
|
(t
|
|
365
365
|
? ((l =
|
|
366
|
-
(null === (r = this.h) || void 0 === r ? void 0 : r.
|
|
367
|
-
(c = (null === (n = this.h) || void 0 === n ? void 0 : n.
|
|
366
|
+
(null === (r = this.h) || void 0 === r ? void 0 : r.Ac()) || -1),
|
|
367
|
+
(c = (null === (n = this.h) || void 0 === n ? void 0 : n.Dc()) || -1))
|
|
368
368
|
: ((l =
|
|
369
|
-
(null === (o = this.h) || void 0 === o ? void 0 : o.
|
|
369
|
+
(null === (o = this.h) || void 0 === o ? void 0 : o.Tc(e)) || -1),
|
|
370
370
|
(c =
|
|
371
|
-
(null === (a = this.h) || void 0 === a ? void 0 : a.
|
|
371
|
+
(null === (a = this.h) || void 0 === a ? void 0 : a.kc(e)) || -1)),
|
|
372
372
|
-1 === l || -1 === c)
|
|
373
373
|
)
|
|
374
374
|
return u;
|
|
375
375
|
const f = new Date().valueOf();
|
|
376
|
-
let m = this.
|
|
376
|
+
let m = this.Rc(f, l, c, d, e);
|
|
377
377
|
return m < 1
|
|
378
|
-
? ((u.
|
|
378
|
+
? ((u.Yl = !1), (u.Jl = this.gc(m, c)), u)
|
|
379
379
|
: ((m = Math.trunc(m) - 1),
|
|
380
|
-
(u.
|
|
381
|
-
t ? this.
|
|
380
|
+
(u.Vl = m),
|
|
381
|
+
t ? this.uc(m) : this.dc(e, m),
|
|
382
382
|
u);
|
|
383
383
|
}
|
|
384
|
-
|
|
385
|
-
return this.
|
|
384
|
+
Wl() {
|
|
385
|
+
return this.bc(!0);
|
|
386
386
|
}
|
|
387
|
-
|
|
388
|
-
const e = this.
|
|
389
|
-
return !(e && !e.
|
|
387
|
+
Gl(t) {
|
|
388
|
+
const e = this.bc(!1, t);
|
|
389
|
+
return !(e && !e.Yl);
|
|
390
390
|
}
|
|
391
391
|
Z() {
|
|
392
|
-
this.
|
|
392
|
+
this.al.Z();
|
|
393
393
|
}
|
|
394
394
|
V() {
|
|
395
|
-
return this.
|
|
395
|
+
return this.ul;
|
|
396
396
|
}
|
|
397
397
|
addSdkMetadata(t) {
|
|
398
|
-
for (const e of t) -1 === this.
|
|
398
|
+
for (const e of t) -1 === this.ql.indexOf(e) && this.ql.push(e);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
@@ -28,14 +28,14 @@ export default class Bt {
|
|
|
28
28
|
return this.Lc;
|
|
29
29
|
}
|
|
30
30
|
xt() {
|
|
31
|
-
return this.Mc().
|
|
31
|
+
return this.Mc().Sc;
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
Nc(t) {
|
|
34
34
|
var i, e, n, r;
|
|
35
35
|
if (null != t && null != t.config) {
|
|
36
36
|
const l = t.config;
|
|
37
|
-
if (l.time > this.Mc().
|
|
38
|
-
const t = (t) => (null == t ? this.Mc().
|
|
37
|
+
if (l.time > this.Mc().Sc) {
|
|
38
|
+
const t = (t) => (null == t ? this.Mc().xc : t),
|
|
39
39
|
u = new li(
|
|
40
40
|
l.time,
|
|
41
41
|
l.events_blacklist,
|
|
@@ -51,9 +51,9 @@ export default class Bt {
|
|
|
51
51
|
l.request_backoff,
|
|
52
52
|
);
|
|
53
53
|
let o = !1;
|
|
54
|
-
null != u.
|
|
54
|
+
null != u.Gc && this.ju() !== u.Gc && (o = !0);
|
|
55
55
|
let a = !1;
|
|
56
|
-
null != u.
|
|
56
|
+
null != u.Ic.enabled && this.wi() !== u.Ic.enabled && (a = !0);
|
|
57
57
|
let h = !1;
|
|
58
58
|
null != u.Xr.enabled && this.Yr() !== u.Xr.enabled && (h = !0);
|
|
59
59
|
let c = !1;
|
|
@@ -64,7 +64,7 @@ export default class Bt {
|
|
|
64
64
|
(c = !0);
|
|
65
65
|
let d = !1;
|
|
66
66
|
null != (null === (n = u.dust) || void 0 === n ? void 0 : n.enabled) &&
|
|
67
|
-
this.
|
|
67
|
+
this.Ze() !==
|
|
68
68
|
(null === (r = u.dust) || void 0 === r ? void 0 : r.enabled) &&
|
|
69
69
|
(d = !0),
|
|
70
70
|
(this.Lc = u),
|
|
@@ -94,54 +94,54 @@ export default class Bt {
|
|
|
94
94
|
return this.yc.Rt(t);
|
|
95
95
|
}
|
|
96
96
|
Ce(t) {
|
|
97
|
-
return -1 !== this.Mc().
|
|
97
|
+
return -1 !== this.Mc().Kc.indexOf(t);
|
|
98
98
|
}
|
|
99
99
|
qu(t) {
|
|
100
|
-
return -1 !== this.Mc().
|
|
100
|
+
return -1 !== this.Mc().Pc.indexOf(t);
|
|
101
101
|
}
|
|
102
102
|
Dr(t) {
|
|
103
|
-
return -1 !== this.Mc().
|
|
103
|
+
return -1 !== this.Mc()._c.indexOf(t);
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
return this.Mc().
|
|
105
|
+
Oc() {
|
|
106
|
+
return this.Mc().Vc;
|
|
107
107
|
}
|
|
108
108
|
ju() {
|
|
109
|
-
return this.Mc().
|
|
109
|
+
return this.Mc().Gc;
|
|
110
110
|
}
|
|
111
111
|
wi() {
|
|
112
|
-
return this.Mc().
|
|
112
|
+
return this.Mc().Ic.enabled || !1;
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
const t = this.Mc().
|
|
114
|
+
zc() {
|
|
115
|
+
const t = this.Mc().xc;
|
|
116
116
|
return !(!t || null == t.enabled) && t.enabled;
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
if (!this.
|
|
120
|
-
const t = this.Mc().
|
|
118
|
+
Ac() {
|
|
119
|
+
if (!this.zc()) return -1;
|
|
120
|
+
const t = this.Mc().xc;
|
|
121
121
|
return null == t.capacity || t.capacity < 10 ? -1 : t.capacity;
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
if (!this.
|
|
125
|
-
const t = this.Mc().
|
|
123
|
+
Dc() {
|
|
124
|
+
if (!this.zc()) return -1;
|
|
125
|
+
const t = this.Mc().xc;
|
|
126
126
|
return null == t.refill_rate || t.refill_rate <= 0 ? -1 : t.refill_rate;
|
|
127
127
|
}
|
|
128
|
-
|
|
129
|
-
const i = this.Mc().
|
|
128
|
+
Hc(t) {
|
|
129
|
+
const i = this.Mc().xc.endpoint_overrides;
|
|
130
130
|
return null == i ? null : i[t];
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
const i = this.
|
|
132
|
+
Tc(t) {
|
|
133
|
+
const i = this.Hc(t);
|
|
134
134
|
return null == i || isNaN(i.capacity) || i.capacity <= 0 ? -1 : i.capacity;
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
const i = this.
|
|
136
|
+
kc(t) {
|
|
137
|
+
const i = this.Hc(t);
|
|
138
138
|
return null == i || isNaN(i.refill_rate) || i.refill_rate <= 0
|
|
139
139
|
? -1
|
|
140
140
|
: i.refill_rate;
|
|
141
141
|
}
|
|
142
142
|
Yr() {
|
|
143
143
|
return this.Mc().Xr.enabled && null == this.yo()
|
|
144
|
-
? (v.lt(f.
|
|
144
|
+
? (v.lt(f.Cl, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
145
145
|
: this.Mc().Xr.enabled || !1;
|
|
146
146
|
}
|
|
147
147
|
yo() {
|
|
@@ -162,7 +162,7 @@ export default class Bt {
|
|
|
162
162
|
: t.max_placements) || 0
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
Ze() {
|
|
166
166
|
var t;
|
|
167
167
|
return (
|
|
168
168
|
(null === (t = this.Mc().dust) || void 0 === t ? void 0 : t.enabled) || !1
|
|
@@ -171,7 +171,7 @@ export default class Bt {
|
|
|
171
171
|
st() {
|
|
172
172
|
var t;
|
|
173
173
|
const i =
|
|
174
|
-
null === (t = this.Mc().
|
|
174
|
+
null === (t = this.Mc().Jc) || void 0 === t
|
|
175
175
|
? void 0
|
|
176
176
|
: t.min_sleep_duration_ms;
|
|
177
177
|
return null != i ? i : c;
|
|
@@ -179,13 +179,13 @@ export default class Bt {
|
|
|
179
179
|
it() {
|
|
180
180
|
var t;
|
|
181
181
|
const i =
|
|
182
|
-
null === (t = this.Mc().
|
|
182
|
+
null === (t = this.Mc().Jc) || void 0 === t ? void 0 : t.scale_factor;
|
|
183
183
|
return null != i ? i : d;
|
|
184
184
|
}
|
|
185
185
|
nt() {
|
|
186
186
|
var t;
|
|
187
187
|
const i =
|
|
188
|
-
null === (t = this.Mc().
|
|
188
|
+
null === (t = this.Mc().Jc) || void 0 === t
|
|
189
189
|
? void 0
|
|
190
190
|
: t.max_sleep_duration_ms;
|
|
191
191
|
return null != i ? i : u;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import ee, { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
2
2
|
import { logger as E } from "../../shared-lib/index.js";
|
|
3
3
|
const Kt = {
|
|
4
|
-
|
|
5
|
-
let
|
|
4
|
+
Sl: function (e, o = !1, t) {
|
|
5
|
+
let r = !1;
|
|
6
6
|
try {
|
|
7
7
|
if (localStorage && localStorage.getItem)
|
|
8
8
|
try {
|
|
9
9
|
localStorage.setItem(s.ft.Qc, "true"),
|
|
10
10
|
localStorage.getItem(s.ft.Qc) &&
|
|
11
|
-
(localStorage.removeItem(s.ft.Qc), (
|
|
11
|
+
(localStorage.removeItem(s.ft.Qc), (r = !0));
|
|
12
12
|
} catch (e) {
|
|
13
13
|
if (
|
|
14
14
|
!(
|
|
@@ -19,15 +19,15 @@ const Kt = {
|
|
|
19
19
|
)
|
|
20
20
|
)
|
|
21
21
|
throw e;
|
|
22
|
-
|
|
22
|
+
r = !0;
|
|
23
23
|
}
|
|
24
24
|
} catch (e) {
|
|
25
25
|
E.info("Local Storage not supported!");
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
let
|
|
30
|
-
return (
|
|
27
|
+
const a = Kt.Uc(),
|
|
28
|
+
n = new ee.Wc(e, a && !o, r, t);
|
|
29
|
+
let c;
|
|
30
|
+
return (c = r ? new ee.Xc(e) : new ee.Yc()), new ee(n, c);
|
|
31
31
|
},
|
|
32
32
|
Uc: function () {
|
|
33
33
|
return (
|