@braze/web-sdk 5.8.0 → 5.8.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/index.d.ts +1 -1
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +22 -22
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +18 -18
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +16 -16
- package/src/Banner/banner-provider.js +79 -79
- package/src/Banner/banner.js +9 -9
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/get-all-banners.js +2 -2
- package/src/Banner/get-banner.js +2 -2
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +1 -1
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +8 -8
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +1 -1
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +92 -92
- 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 +39 -39
- package/src/ContentCards/content-cards-provider.js +142 -142
- 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 +4 -4
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/disable-sdk.js +6 -6
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +5 -5
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +15 -15
- package/src/FeatureFlags/feature-flags-provider.js +61 -61
- 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 +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +41 -41
- 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 +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +89 -89
- package/src/InAppMessage/log-in-app-message-button-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +8 -8
- package/src/InAppMessage/models/in-app-message.js +80 -80
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +29 -29
- 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 +12 -12
- package/src/Push/push-manager-factory.js +1 -1
- package/src/Push/push-manager.js +94 -94
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +17 -17
- package/src/User/user.js +38 -38
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +5 -5
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +125 -125
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +149 -149
- package/src/managers/server-config-manager.js +84 -84
- package/src/managers/session-manager.js +27 -27
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +83 -83
- package/src/managers/subscription-manager.js +10 -10
- package/src/managers/utils.js +4 -4
- 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 +3 -3
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +148 -148
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +2 -2
- 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 +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +32 -32
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +72 -72
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +4 -4
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +6 -6
- package/src/util/request-header-utils.js +21 -21
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/window-utils.js +1 -1
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import c from "../common/event-logger.js";
|
|
8
8
|
import { isArray as z, isEqual as ii } from "../util/code-utils.js";
|
|
9
9
|
import { logger as N, EventTypes as d } from "../../shared-lib/index.js";
|
|
10
|
-
import { STORAGE_KEYS as
|
|
10
|
+
import { STORAGE_KEYS as s } from "./storage-manager.js";
|
|
11
11
|
import h from "../util/request-header-utils.js";
|
|
12
12
|
import {
|
|
13
13
|
LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT as $t,
|
|
@@ -17,64 +17,64 @@ import { getAlias as Ht } from "./utils.js";
|
|
|
17
17
|
import { readResponseHeaders as Yt } from "../util/net.js";
|
|
18
18
|
export default class Pt {
|
|
19
19
|
constructor(t, e, i, s, r, n, o, a, h, u, l, c) {
|
|
20
|
-
(this.
|
|
20
|
+
(this.an = t),
|
|
21
21
|
(this.C = e),
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
22
|
+
(this.Ra = i),
|
|
23
|
+
(this.Cs = s),
|
|
24
24
|
(this.T = r),
|
|
25
25
|
(this.B = n),
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
26
|
+
(this.un = o),
|
|
27
|
+
(this.Pa = a),
|
|
28
|
+
(this.Oa = h),
|
|
29
|
+
(this.Ta = u),
|
|
30
30
|
(this.appVersion = l),
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
31
|
+
(this.au = c),
|
|
32
|
+
(this.du = (t) => (null == t ? "" : `${t} `)),
|
|
33
|
+
(this.an = t),
|
|
34
34
|
(this.C = e),
|
|
35
|
-
(this.
|
|
36
|
-
(this.
|
|
35
|
+
(this.Ra = i),
|
|
36
|
+
(this.Cs = s),
|
|
37
37
|
(this.T = r),
|
|
38
38
|
(this.B = n),
|
|
39
|
-
(this.
|
|
40
|
-
(this.
|
|
41
|
-
(this.
|
|
42
|
-
(this.
|
|
39
|
+
(this.un = o),
|
|
40
|
+
(this.Pa = a),
|
|
41
|
+
(this.Oa = h),
|
|
42
|
+
(this.Ta = u),
|
|
43
43
|
(this.appVersion = l),
|
|
44
|
-
(this.
|
|
45
|
-
(this.
|
|
44
|
+
(this.au = c),
|
|
45
|
+
(this.fu = ["npm"]);
|
|
46
46
|
}
|
|
47
|
-
H(
|
|
48
|
-
const r = this.
|
|
49
|
-
n = r
|
|
50
|
-
o = this.C.
|
|
51
|
-
ii(o, n) || (
|
|
52
|
-
(
|
|
53
|
-
(
|
|
54
|
-
const a = this.C.
|
|
55
|
-
h = this.C.
|
|
56
|
-
this.
|
|
57
|
-
(!ii(a, this.
|
|
58
|
-
(
|
|
59
|
-
(
|
|
60
|
-
this.
|
|
61
|
-
(
|
|
62
|
-
(
|
|
63
|
-
(
|
|
64
|
-
const u = this.
|
|
65
|
-
if ((
|
|
66
|
-
const
|
|
67
|
-
|
|
47
|
+
H(t, e = !1, i = !1) {
|
|
48
|
+
const r = this.an.ve(!i),
|
|
49
|
+
n = r.$r(),
|
|
50
|
+
o = this.C.ft(s.gt.ic);
|
|
51
|
+
ii(o, n) || (t.device = n),
|
|
52
|
+
(t.api_key = this.un),
|
|
53
|
+
(t.time = L(new Date().valueOf(), !0));
|
|
54
|
+
const a = this.C.ft(s.gt.vu) || [],
|
|
55
|
+
h = this.C.ft(s.gt.pu) || "";
|
|
56
|
+
this.fu.length > 0 &&
|
|
57
|
+
(!ii(a, this.fu) || h !== this.T.St()) &&
|
|
58
|
+
(t.sdk_metadata = this.fu),
|
|
59
|
+
(t.sdk_version = this.Oa),
|
|
60
|
+
this.Ta && (t.sdk_flavor = this.Ta),
|
|
61
|
+
(t.app_version = this.appVersion),
|
|
62
|
+
(t.app_version_code = this.au),
|
|
63
|
+
(t.device_id = r.id);
|
|
64
|
+
const u = this.Cs.getUserId();
|
|
65
|
+
if ((e && null !== u && (t.user_id = u), !u && !this.Ra.wh())) {
|
|
66
|
+
const e = Ht(this.C);
|
|
67
|
+
e && (t.alias = e);
|
|
68
68
|
}
|
|
69
|
-
return
|
|
69
|
+
return t;
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
st(t, e, i) {
|
|
72
72
|
const s = e.auth_error,
|
|
73
73
|
r = e.error;
|
|
74
74
|
if (!s && !r) return !0;
|
|
75
75
|
if (s) {
|
|
76
76
|
let e;
|
|
77
|
-
this.
|
|
77
|
+
this.Ra.Hh();
|
|
78
78
|
const r = { errorCode: s.error_code };
|
|
79
79
|
for (const t of i)
|
|
80
80
|
z(t) && "X-Braze-Auth-Signature" === t[0] && (r.signature = t[1]);
|
|
@@ -86,12 +86,12 @@ export default class Pt {
|
|
|
86
86
|
n
|
|
87
87
|
? ((r.reason = n), (e = `due to ${n}`))
|
|
88
88
|
: (e = `with error code ${s.error_code}.`),
|
|
89
|
-
this.
|
|
89
|
+
this.Ra.wh() ||
|
|
90
90
|
(e +=
|
|
91
91
|
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
|
|
92
92
|
N.error(`SDK Authentication failed ${e}`),
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
93
|
+
this.Ru(t.events || [], t.attributes || []),
|
|
94
|
+
this.Ra.Bh(r),
|
|
95
95
|
!1
|
|
96
96
|
);
|
|
97
97
|
}
|
|
@@ -99,42 +99,42 @@ export default class Pt {
|
|
|
99
99
|
let i,
|
|
100
100
|
s = r;
|
|
101
101
|
switch (s) {
|
|
102
|
-
case qt.
|
|
102
|
+
case qt.gu:
|
|
103
103
|
return (
|
|
104
104
|
(i = "Received successful response with empty body."),
|
|
105
|
-
c.
|
|
105
|
+
c.ut(d.bu, { e: i }),
|
|
106
106
|
N.info(i),
|
|
107
107
|
!1
|
|
108
108
|
);
|
|
109
|
-
case qt.
|
|
109
|
+
case qt.qu:
|
|
110
110
|
return (
|
|
111
111
|
(i = "Received successful response with invalid JSON"),
|
|
112
|
-
c.
|
|
112
|
+
c.ut(d.bu, { e: i + ": " + e.response }),
|
|
113
113
|
N.info(i),
|
|
114
114
|
!1
|
|
115
115
|
);
|
|
116
|
-
case qt.
|
|
117
|
-
s = `The API key "${t.api_key}" is invalid for the baseUrl ${this.
|
|
116
|
+
case qt.Au:
|
|
117
|
+
s = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Pa}`;
|
|
118
118
|
break;
|
|
119
|
-
case qt.
|
|
119
|
+
case qt.Du:
|
|
120
120
|
s =
|
|
121
121
|
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
|
|
122
122
|
break;
|
|
123
|
-
case qt.
|
|
123
|
+
case qt.ku:
|
|
124
124
|
s = "No device identifier. Please contact support@braze.com";
|
|
125
125
|
}
|
|
126
126
|
N.error("Backend error: " + s);
|
|
127
127
|
}
|
|
128
128
|
return !1;
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
Tu(t, e, i, s) {
|
|
131
131
|
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || i || s);
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
yu(t, e, i, s, r = !1) {
|
|
134
134
|
const n = [],
|
|
135
135
|
o = (t) => t || "",
|
|
136
|
-
a = o(this.
|
|
137
|
-
let u = this.
|
|
136
|
+
a = o(this.Cs.getUserId());
|
|
137
|
+
let u = this.Nr(t, e);
|
|
138
138
|
const l = [],
|
|
139
139
|
c = [];
|
|
140
140
|
let d,
|
|
@@ -142,7 +142,7 @@ export default class Pt {
|
|
|
142
142
|
if (i.length > 0) {
|
|
143
143
|
const t = [];
|
|
144
144
|
for (const e of i) {
|
|
145
|
-
if (((d = e
|
|
145
|
+
if (((d = e.$r()), this.Ra.wh())) {
|
|
146
146
|
if (a && !d.user_id) {
|
|
147
147
|
f || (f = {}), f.events || (f.events = []), f.events.push(d);
|
|
148
148
|
continue;
|
|
@@ -159,60 +159,60 @@ export default class Pt {
|
|
|
159
159
|
if (s.length > 0) {
|
|
160
160
|
const t = [];
|
|
161
161
|
for (const e of s)
|
|
162
|
-
e && (this.
|
|
162
|
+
e && (this.Ra.wh() && o(e.user_id) !== a ? l.push(e) : t.push(e));
|
|
163
163
|
t.length > 0 && (u.attributes = t);
|
|
164
164
|
}
|
|
165
|
-
if ((this.
|
|
165
|
+
if ((this.Ru(c, l), (u = this.H(u, !1, r)), f)) {
|
|
166
166
|
f = this.H(f, !1, r);
|
|
167
|
-
const t = { requestData: f, headers: this.J(f, h.O.
|
|
167
|
+
const t = { requestData: f, headers: this.J(f, h.O.Nu) };
|
|
168
168
|
n.push(t);
|
|
169
169
|
}
|
|
170
|
-
if (u && !this.
|
|
171
|
-
const m = { requestData: u, headers: this.J(u, h.O.
|
|
170
|
+
if (u && !this.Tu(u.events, u.attributes, t, e)) return f ? n : null;
|
|
171
|
+
const m = { requestData: u, headers: this.J(u, h.O.Nu) };
|
|
172
172
|
return n.push(m), n;
|
|
173
173
|
}
|
|
174
|
-
|
|
174
|
+
Ru(t, e) {
|
|
175
175
|
if (t) {
|
|
176
176
|
const e = [];
|
|
177
177
|
for (const i of t) {
|
|
178
178
|
const t = ve.fromJson(i);
|
|
179
179
|
(t.time = Xt(t.time)), e.push(t);
|
|
180
180
|
}
|
|
181
|
-
this.C.
|
|
181
|
+
this.C.Vo(e);
|
|
182
182
|
}
|
|
183
|
-
if (e) for (const t of e) this.C.
|
|
183
|
+
if (e) for (const t of e) this.C.wu(t);
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
et(t, e) {
|
|
186
186
|
let i = "HTTP error ";
|
|
187
187
|
null != t && (i += t + " "), (i += e), N.error(i);
|
|
188
188
|
}
|
|
189
189
|
zr(t) {
|
|
190
|
-
return c.
|
|
190
|
+
return c.ut(d.Cu, { n: t });
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
Nr(t, e, i) {
|
|
193
193
|
const s = {};
|
|
194
194
|
t && (s.feed = !0), e && (s.triggers = !0);
|
|
195
|
-
const r = null != i ? i : this.
|
|
196
|
-
if ((r && (s.user_id = r), !s.user_id && !this.
|
|
195
|
+
const r = null != i ? i : this.Cs.getUserId();
|
|
196
|
+
if ((r && (s.user_id = r), !s.user_id && !this.Ra.wh())) {
|
|
197
197
|
const t = Ht(this.C);
|
|
198
198
|
t && (s.alias = t);
|
|
199
199
|
}
|
|
200
|
-
return (s.config = { config_time: this.B.
|
|
200
|
+
return (s.config = { config_time: this.B.Et() }), { respond_with: s };
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
Su(t) {
|
|
203
203
|
const e = new Date().valueOf();
|
|
204
204
|
let i = $t.toString();
|
|
205
|
-
const s = h.
|
|
205
|
+
const s = h.Bu(this.C, t);
|
|
206
206
|
if (-1 !== s) {
|
|
207
207
|
i = (e - s).toString();
|
|
208
208
|
}
|
|
209
209
|
return i;
|
|
210
210
|
}
|
|
211
211
|
J(t, e, i = !1) {
|
|
212
|
-
const s = [["X-Braze-Api-Key", this.
|
|
213
|
-
r = this.
|
|
212
|
+
const s = [["X-Braze-Api-Key", this.un]],
|
|
213
|
+
r = this.Su(e);
|
|
214
214
|
s.push(["X-Braze-Last-Req-Ms-Ago", r]);
|
|
215
|
-
const n = h.
|
|
215
|
+
const n = h.zu(this.C, e).toString();
|
|
216
216
|
s.push(["X-Braze-Req-Attempt", n]);
|
|
217
217
|
let o = !1;
|
|
218
218
|
if (
|
|
@@ -222,58 +222,58 @@ export default class Pt {
|
|
|
222
222
|
null != t.respond_with &&
|
|
223
223
|
t.respond_with.feed &&
|
|
224
224
|
(s.push(["X-Braze-FeedRequest", "true"]), (o = !0)),
|
|
225
|
-
e === h.O.
|
|
225
|
+
e === h.O.gi)
|
|
226
226
|
) {
|
|
227
227
|
s.push(["X-Braze-ContentCardsRequest", "true"]);
|
|
228
|
-
let t = h.
|
|
229
|
-
(t && !i) || ((t = 1), h
|
|
228
|
+
let t = h.zu(this.C, h.O.gi);
|
|
229
|
+
(t && !i) || ((t = 1), h.ju(this.C, h.O.gi, t));
|
|
230
230
|
const e = Math.max(0, t - 1);
|
|
231
231
|
s.push(["BRAZE-SYNC-RETRY-COUNT", e.toString()]), (o = !0);
|
|
232
232
|
}
|
|
233
233
|
if (
|
|
234
|
-
(e === h.O.
|
|
234
|
+
(e === h.O.Le &&
|
|
235
235
|
(s.push(["X-Braze-FeatureFlagsRequest", "true"]), (o = !0)),
|
|
236
236
|
o && s.push(["X-Braze-DataRequest", "true"]),
|
|
237
|
-
this.
|
|
237
|
+
this.Ra.wh())
|
|
238
238
|
) {
|
|
239
|
-
const t = this.
|
|
239
|
+
const t = this.Ra.jh();
|
|
240
240
|
null != t && s.push(["X-Braze-Auth-Signature", t]);
|
|
241
241
|
}
|
|
242
242
|
return s;
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
Mu(t, e, i, s) {
|
|
245
245
|
window.setTimeout(() => {
|
|
246
|
-
N.info(`Retrying rate limited ${this.
|
|
246
|
+
N.info(`Retrying rate limited ${this.du(s)}SDK request.`),
|
|
247
247
|
this.V(e, i, s);
|
|
248
248
|
}, t);
|
|
249
249
|
}
|
|
250
|
-
V(e, i,
|
|
251
|
-
if (!this.
|
|
250
|
+
V(t, e, i, r) {
|
|
251
|
+
if (!this.Xu(i))
|
|
252
252
|
return (
|
|
253
|
-
N.info(`${this.
|
|
253
|
+
N.info(`${this.du(i)}SDK request being rate limited.`),
|
|
254
254
|
void ("function" == typeof r && r())
|
|
255
255
|
);
|
|
256
|
-
const n = this
|
|
257
|
-
if (!n.
|
|
256
|
+
const n = this.$u();
|
|
257
|
+
if (!n.Fu)
|
|
258
258
|
return (
|
|
259
259
|
N.info(
|
|
260
|
-
`${this.
|
|
261
|
-
|
|
260
|
+
`${this.du(
|
|
261
|
+
i,
|
|
262
262
|
)}SDK request being rate limited. Request will be retried in ${Math.trunc(
|
|
263
|
-
n.
|
|
263
|
+
n.Lu / 1e3,
|
|
264
264
|
)} seconds.`,
|
|
265
265
|
),
|
|
266
|
-
void this.
|
|
266
|
+
void this.Mu(n.Lu, t, e, i)
|
|
267
267
|
);
|
|
268
|
-
this.C.
|
|
269
|
-
const o =
|
|
268
|
+
this.C.Bt(s.gt.Eu, new Date().valueOf());
|
|
269
|
+
const o = t.device;
|
|
270
270
|
o && o.os_version instanceof Promise
|
|
271
|
-
? o.os_version.then((
|
|
272
|
-
(
|
|
271
|
+
? o.os_version.then((i) => {
|
|
272
|
+
(t.device.os_version = i), e(n.Ku);
|
|
273
273
|
})
|
|
274
|
-
:
|
|
274
|
+
: e(n.Ku);
|
|
275
275
|
}
|
|
276
|
-
|
|
276
|
+
Iu(t) {
|
|
277
277
|
const e = t ? Yt(t) : null;
|
|
278
278
|
if (!e || !e["retry-after"]) return null;
|
|
279
279
|
const i = e["retry-after"];
|
|
@@ -284,21 +284,21 @@ export default class Pt {
|
|
|
284
284
|
{
|
|
285
285
|
const t =
|
|
286
286
|
"Received unexpected value for retry-after header in /sync response";
|
|
287
|
-
c.
|
|
287
|
+
c.ut(d.bu, { e: t + ": " + i });
|
|
288
288
|
}
|
|
289
289
|
return null;
|
|
290
290
|
}
|
|
291
|
-
|
|
292
|
-
if (h.
|
|
291
|
+
rt(t, e, i, s, r, n) {
|
|
292
|
+
if (h.zu(this.C, i) >= Kt) return;
|
|
293
293
|
let o;
|
|
294
294
|
n = n || 0;
|
|
295
|
-
const a = this.
|
|
295
|
+
const a = this.Iu(t);
|
|
296
296
|
r();
|
|
297
297
|
const u = (t) => {
|
|
298
298
|
const r = window.setTimeout(() => {
|
|
299
299
|
e();
|
|
300
300
|
}, t);
|
|
301
|
-
s(r), h.
|
|
301
|
+
s(r), h.Pu(this.C, i);
|
|
302
302
|
};
|
|
303
303
|
if (a && !isNaN(a.value)) {
|
|
304
304
|
switch (a.type) {
|
|
@@ -309,85 +309,85 @@ export default class Pt {
|
|
|
309
309
|
o = a.value + n;
|
|
310
310
|
}
|
|
311
311
|
u(o);
|
|
312
|
-
} else n ? u(n) : h.
|
|
312
|
+
} else n ? u(n) : h.wi(this.C, i);
|
|
313
313
|
}
|
|
314
|
-
|
|
315
|
-
var
|
|
316
|
-
null === (
|
|
314
|
+
Uu(t) {
|
|
315
|
+
var e;
|
|
316
|
+
null === (e = this.C) || void 0 === e || e.Bt(s.gt.xu, t);
|
|
317
317
|
}
|
|
318
|
-
|
|
319
|
-
let
|
|
320
|
-
null ==
|
|
318
|
+
Hu(t, e) {
|
|
319
|
+
let i = this.Ou();
|
|
320
|
+
null == i && (i = {}), (i[t] = e), this.C.Bt(s.gt.Gu, i);
|
|
321
321
|
}
|
|
322
|
-
|
|
323
|
-
var
|
|
324
|
-
return null === (
|
|
322
|
+
_u() {
|
|
323
|
+
var t;
|
|
324
|
+
return null === (t = this.C) || void 0 === t ? void 0 : t.ft(s.gt.xu);
|
|
325
325
|
}
|
|
326
|
-
|
|
327
|
-
var
|
|
328
|
-
return null === (
|
|
326
|
+
Ou() {
|
|
327
|
+
var t;
|
|
328
|
+
return null === (t = this.C) || void 0 === t ? void 0 : t.ft(s.gt.Gu);
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
Wu(t, e, i, s, r = "") {
|
|
331
331
|
let n;
|
|
332
332
|
if (r) {
|
|
333
|
-
const t = this.
|
|
333
|
+
const t = this.Ou();
|
|
334
334
|
n = null == t || isNaN(t[r]) ? e : t[r];
|
|
335
|
-
} else (n = this.
|
|
335
|
+
} else (n = this._u()), (null == n || isNaN(n)) && (n = e);
|
|
336
336
|
const o = (t - s) / 1e3;
|
|
337
337
|
return (n = Math.min(n + o / i, e)), n;
|
|
338
338
|
}
|
|
339
|
-
|
|
339
|
+
Yu(t, e) {
|
|
340
340
|
return Math.max(0, (1 - t) * e * 1e3);
|
|
341
341
|
}
|
|
342
|
-
|
|
343
|
-
var
|
|
344
|
-
const u = {
|
|
345
|
-
if ((null ==
|
|
342
|
+
Ju(t, e = "") {
|
|
343
|
+
var i, r, n, o, a;
|
|
344
|
+
const u = { Fu: !0, Ku: -1, Lu: 0 };
|
|
345
|
+
if ((null == t && (t = !0), !t && !e)) return u;
|
|
346
346
|
let l,
|
|
347
347
|
c,
|
|
348
348
|
d = null;
|
|
349
|
-
if (
|
|
349
|
+
if (t) d = null === (i = this.C) || void 0 === i ? void 0 : i.ft(s.gt.Eu);
|
|
350
350
|
else {
|
|
351
|
-
const t = h.
|
|
352
|
-
if (null == t || null == t[
|
|
353
|
-
d = t[
|
|
351
|
+
const t = h.Qu(this.C);
|
|
352
|
+
if (null == t || null == t[e]) return u;
|
|
353
|
+
d = t[e];
|
|
354
354
|
}
|
|
355
355
|
if (null == d || isNaN(d)) return u;
|
|
356
356
|
if (
|
|
357
|
-
(
|
|
357
|
+
(t
|
|
358
358
|
? ((l =
|
|
359
|
-
(null === (r = this.B) || void 0 === r ? void 0 : r.
|
|
360
|
-
(c = (null === (n = this.B) || void 0 === n ? void 0 : n.
|
|
359
|
+
(null === (r = this.B) || void 0 === r ? void 0 : r.Vu()) || -1),
|
|
360
|
+
(c = (null === (n = this.B) || void 0 === n ? void 0 : n.Zu()) || -1))
|
|
361
361
|
: ((l =
|
|
362
|
-
(null === (o = this.B) || void 0 === o ? void 0 : o.
|
|
362
|
+
(null === (o = this.B) || void 0 === o ? void 0 : o.tl(e)) || -1),
|
|
363
363
|
(c =
|
|
364
|
-
(null === (a = this.B) || void 0 === a ? void 0 : a.
|
|
364
|
+
(null === (a = this.B) || void 0 === a ? void 0 : a.el(e)) || -1)),
|
|
365
365
|
-1 === l || -1 === c)
|
|
366
366
|
)
|
|
367
367
|
return u;
|
|
368
368
|
const f = new Date().valueOf();
|
|
369
|
-
let m = this.
|
|
369
|
+
let m = this.Wu(f, l, c, d, e);
|
|
370
370
|
return m < 1
|
|
371
|
-
? ((u.
|
|
371
|
+
? ((u.Fu = !1), (u.Lu = this.Yu(m, c)), u)
|
|
372
372
|
: ((m = Math.trunc(m) - 1),
|
|
373
|
-
(u.
|
|
374
|
-
|
|
373
|
+
(u.Ku = m),
|
|
374
|
+
t ? this.Uu(m) : this.Hu(e, m),
|
|
375
375
|
u);
|
|
376
376
|
}
|
|
377
|
-
|
|
378
|
-
return this.
|
|
377
|
+
$u() {
|
|
378
|
+
return this.Ju(!0);
|
|
379
379
|
}
|
|
380
|
-
|
|
381
|
-
const e = this.
|
|
382
|
-
return !(e && !e.
|
|
380
|
+
Xu(t) {
|
|
381
|
+
const e = this.Ju(!1, t);
|
|
382
|
+
return !(e && !e.Fu);
|
|
383
383
|
}
|
|
384
|
-
|
|
385
|
-
this.
|
|
384
|
+
it() {
|
|
385
|
+
this.Ra.it();
|
|
386
386
|
}
|
|
387
387
|
Z() {
|
|
388
|
-
return this.
|
|
388
|
+
return this.Pa;
|
|
389
389
|
}
|
|
390
390
|
addSdkMetadata(t) {
|
|
391
|
-
for (const e of t) -1 === this.
|
|
391
|
+
for (const e of t) -1 === this.fu.indexOf(e) && this.fu.push(e);
|
|
392
392
|
}
|
|
393
393
|
}
|