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