@arcblock/did-connect-react 3.3.9 → 3.4.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.
@@ -1,5 +1,5 @@
1
- import { useRef as I, useEffect as S } from "react";
2
- import W from "lodash/get";
1
+ import { useRef as I, useEffect as C } from "react";
2
+ import T from "lodash/get";
3
3
  import ue from "js-cookie";
4
4
  import B from "lodash/omitBy";
5
5
  import M from "lodash/isNil";
@@ -9,71 +9,63 @@ import { useReactive as H, useCreation as pe, useMemoizedFn as E } from "ahooks"
9
9
  import ke from "@arcblock/react-hooks/lib/useInterval";
10
10
  import me from "@arcblock/react-hooks/lib/useBrowser";
11
11
  import { getVisitorId as he, stringifyQuery as $, isUrl as ge } from "@arcblock/ux/lib/Util";
12
- import { WsClient as we } from "@arcblock/ws";
13
- import { sleep as q, getConnectedInfo as be, updateConnectedInfo as Ce, parseNextWorkflow as Q, createAxios as z, decodeConnectUrl as Se, parseTokenFromConnectUrl as xe } from "../../utils.js";
12
+ import { WsClient as be } from "@arcblock/ws";
13
+ import { sleep as q, getExtraHeaders as x, getConnectedInfo as we, updateConnectedInfo as Ce, parseNextWorkflow as Q, createAxios as z, decodeConnectUrl as Se, parseTokenFromConnectUrl as Ie } from "../../utils.js";
14
14
  import V from "../assets/locale.js";
15
- import Ie from "./security.js";
16
- import $e from "./page-show.js";
15
+ import $e from "./security.js";
16
+ import xe from "./page-show.js";
17
17
  import { RELAY_SOCKET_PREFIX as G } from "../../constant.js";
18
18
  function ve(o) {
19
- const a = o || window.location.href;
20
- return new URL(a).host;
19
+ const l = o || window.location.href;
20
+ return new URL(l).host;
21
21
  }
22
- function v(o) {
23
- const a = {}, d = o || window.location.href;
24
- if (d) {
25
- const { hostname: w, protocol: i, port: p } = new URL(d);
26
- a["x-real-hostname"] = w, a["x-real-port"] = p, a["x-real-protocol"] = i.endsWith(":") ? i.substring(0, i.length - 1) : i;
27
- }
28
- return a;
29
- }
30
- const R = {};
31
- function Ue({ action: o, prefix: a, checkFn: d, extraParams: w, baseUrl: i }) {
32
- const p = `${a}/token?${$(w)}`;
33
- return R[p] || (R[p] = async function() {
34
- const k = +/* @__PURE__ */ new Date(), h = await d(p, { headers: v(i) }), g = +/* @__PURE__ */ new Date();
35
- if (g - k < 500 && await q(500 - (g - k)), h?.data?.token)
22
+ const P = {};
23
+ function Ue({ action: o, prefix: l, checkFn: k, extraParams: v, baseUrl: m }) {
24
+ const d = `${l}/token?${$(v)}`;
25
+ return P[d] || (P[d] = async function() {
26
+ const f = +/* @__PURE__ */ new Date(), h = await k(d, { headers: x(m) }), g = +/* @__PURE__ */ new Date();
27
+ if (g - f < 500 && await q(500 - (g - f)), h?.data?.token)
36
28
  return h.data;
37
29
  if (h?.data?.error)
38
30
  throw new Error(h.data.error);
39
- const U = ge(a) ? a : `${i}${a}`;
31
+ const U = ge(l) ? l : `${m}${l}`;
40
32
  throw new Error(`Error generating ${o} QR Code from: ${U}`);
41
- }), R[p];
33
+ }), P[d];
42
34
  }
43
35
  const Ae = () => {
44
36
  try {
45
- const a = new URL(window.location.href).searchParams.get("__connect_url__");
46
- if (!a)
37
+ const l = new URL(window.location.href).searchParams.get("__connect_url__");
38
+ if (!l)
47
39
  return null;
48
- const d = Se(a);
40
+ const k = Se(l);
49
41
  return {
50
- token: xe(d),
51
- url: d
42
+ token: Ie(k),
43
+ url: k
52
44
  };
53
45
  } catch (o) {
54
46
  return {
55
47
  error: o
56
48
  };
57
49
  }
58
- }, J = () => W(globalThis, "blocklet.appPid") || W(globalThis, "blocklet.appId") || W(globalThis, "env.appId") || "", ye = () => (W(globalThis, "env.apiPrefix") || "/").replace(/\/$/, "").replace(G, ""), P = (o) => `relay:${J()}:${o}`, Ee = () => window.location.protocol === "https:" ? "wss:" : "ws:", X = (o) => !o || new URL(o).origin === window.location.origin, Y = (o) => ["succeed", "error", "timeout", "busy"].includes(o);
50
+ }, J = () => T(globalThis, "blocklet.appPid") || T(globalThis, "blocklet.appId") || T(globalThis, "env.appId") || "", ye = () => (T(globalThis, "env.apiPrefix") || "/").replace(/\/$/, "").replace(G, ""), R = (o) => `relay:${J()}:${o}`, Ee = () => window.location.protocol === "https:" ? "wss:" : "ws:", X = (o) => !o || new URL(o).origin === window.location.origin, Y = (o) => ["succeed", "error", "timeout", "busy"].includes(o);
59
51
  function Xe({
60
52
  action: o,
61
- checkFn: a,
62
- checkInterval: d,
63
- checkTimeout: w,
64
- extraParams: i,
65
- locale: p,
53
+ checkFn: l,
54
+ checkInterval: k,
55
+ checkTimeout: v,
56
+ extraParams: m,
57
+ locale: d,
66
58
  prefix: _,
67
- tokenKey: k,
59
+ tokenKey: f,
68
60
  encKey: h,
69
61
  onError: g,
70
62
  onSuccess: U,
71
63
  baseUrl: Z,
72
64
  autoConnect: K = !0,
73
65
  forceConnected: ee = !0,
74
- saveConnect: te = !0,
66
+ saveConnect: re = !0,
75
67
  // FIXME: @zhanghan 将来需要设置为默认 false,仅在需要的时候进行保存 login, switch/role/profile
76
- useSocket: re = !0,
68
+ useSocket: te = !0,
77
69
  provider: ne = "wallet"
78
70
  }) {
79
71
  const e = H({
@@ -94,41 +86,41 @@ function Xe({
94
86
  nextWorkflow: "",
95
87
  baseUrl: Z,
96
88
  prefix: `${_}/${o}`,
97
- extraParams: B(i, M),
98
- checkFn: a,
89
+ extraParams: B(m, M),
90
+ checkFn: l,
99
91
  results: {},
100
92
  action: o,
101
93
  provider: ne,
102
94
  reset() {
103
95
  this.error = "", this.status = "created";
104
96
  }
105
- }), F = I(null), x = V[p] || V.en, f = pe(() => Ae(), []), oe = Math.ceil(w / d), l = H({
97
+ }), F = I(null), S = V[d] || V.en, u = pe(() => Ae(), []), oe = Math.ceil(v / k), c = H({
106
98
  onSuccessCalled: !1,
107
99
  cancelWhenScannedCounter: 0,
108
100
  isSocketAvailable: !1
109
- }), { encryptKey: se, decrypt: A } = Ie(), D = me(), O = he(), c = I(null), m = I(null), b = {
101
+ }), { encryptKey: se, decrypt: A } = $e(), D = me(), O = he(), a = I(null), p = I(null), b = {
110
102
  ...e.extraParams,
111
- locale: p,
112
- [k]: e.token || f?.token,
103
+ locale: d,
104
+ [f]: e.token || u?.token,
113
105
  provider: e.provider
114
106
  }, L = async () => {
115
- if (!(f?.token && f?.token === e.token)) {
107
+ if (!(u?.token && u?.token === e.token)) {
116
108
  try {
117
- b[k] && e.status === "created" && await e.checkFn(`${e.prefix}/timeout?${$(b)}`, {
118
- headers: v(e.baseUrl)
109
+ b[f] && e.status === "created" && await e.checkFn(`${e.prefix}/timeout?${$(b)}`, {
110
+ headers: x(e.baseUrl)
119
111
  });
120
112
  } catch {
121
113
  }
122
114
  try {
123
- e.token && m.current && (await c.current.unsubscribe(P(e.token)), m.current = null);
115
+ e.token && p.current && (await a.current.unsubscribe(R(e.token)), p.current = null);
124
116
  } catch {
125
117
  }
126
118
  }
127
- }, ae = E((...r) => {
128
- const t = {
119
+ }, ae = E((...t) => {
120
+ const r = {
129
121
  [h]: se,
130
122
  ...e.extraParams,
131
- locale: p,
123
+ locale: d,
132
124
  forceConnected: ee,
133
125
  // - autoConnect 请求参数用于控制服务端是否给钱包应用发送自动连接通知
134
126
  // - 使用 connect 组件时明确传入了 autoConnect = false, 则 autoConnect 请求参数 为 false
@@ -136,97 +128,97 @@ function Xe({
136
128
  // (避免 "无限自动连接问题")
137
129
  // - 如果上次连接设备 (connected_wallet_os) 不是 ios/android, 则禁用自动连接
138
130
  autoConnect: K && // 如果是 wallet webview 环境, 不发送通知, 避免 wallet 连续弹出 auth 窗口 2 次 (#341)
139
- !(D.wallet || D.arcSphere) && !l.cancelWhenScannedCounter && ["ios", "android"].includes(ue.get("connected_wallet_os")),
131
+ !(D.wallet || D.arcSphere) && !c.cancelWhenScannedCounter && ["ios", "android"].includes(ue.get("connected_wallet_os")),
140
132
  provider: e.provider
141
133
  };
142
- O && (t.visitorId = O);
134
+ O && (r.visitorId = O);
143
135
  const n = fe(F.current || {}, ["sourceAppPid", "verbose"]);
144
136
  return Object.keys(n).forEach((s) => {
145
- (!t[s] || s === h && n[s]) && (t[s] = n[s]);
146
- }), f?.token && !t.sourceToken && (t.sourceToken = f?.token), Ue({
137
+ (!r[s] || s === h && n[s]) && (r[s] = n[s]);
138
+ }), u?.token && !r.sourceToken && (r.sourceToken = u?.token), Ue({
147
139
  action: o,
148
140
  prefix: e.prefix,
149
141
  baseUrl: e.baseUrl,
150
142
  checkFn: e.checkFn,
151
- extraParams: t
152
- })(...r);
153
- }), y = E(async (r = !0) => {
154
- r && L();
143
+ extraParams: r
144
+ })(...t);
145
+ }), y = E(async (t = !0) => {
146
+ t && L();
155
147
  try {
156
- e.loading = !0, e.token = "", e.url = "", e.store = null, e.extraParams = B(i, M), await q();
157
- const t = await ae(), n = t.extra || {};
158
- e.loading = !1, e.token = t.token, e.url = t.url, e.status = "created", e.error = "", e.checkCount = 0, e.appInfo = t.appInfo, e.memberAppInfo = t.memberAppInfo, e.connectedDid = n.connectedDid, e.saveConnect = n.saveConnect;
159
- } catch (t) {
160
- e.loading = !1, e.status = "error", e.error = `${x.generateError}: ${t.message}`;
148
+ e.loading = !0, e.token = "", e.url = "", e.store = null, e.extraParams = B(m, M), await q();
149
+ const r = await ae(), n = r.extra || {};
150
+ e.loading = !1, e.token = r.token, e.url = r.url, e.status = "created", e.error = "", e.checkCount = 0, e.appInfo = r.appInfo, e.memberAppInfo = r.memberAppInfo, e.connectedDid = n.connectedDid, e.saveConnect = n.saveConnect;
151
+ } catch (r) {
152
+ e.loading = !1, e.status = "error", e.error = `${S.generateError}: ${r.message}`;
161
153
  }
162
154
  }), ce = E(() => {
163
- l.cancelWhenScannedCounter++;
155
+ c.cancelWhenScannedCounter++;
164
156
  });
165
- S(() => {
166
- l.cancelWhenScannedCounter > 0 && (i.nw ? g(new Error(x.retryForbidden)) : y());
167
- }, [l.cancelWhenScannedCounter]), S(() => (!(/^((?!chrome|android).)*safari/i.test(globalThis.navigator.userAgent) || Object.hasOwn(globalThis?.blocklet || {}, "DID_CONNECT_DISABLE_SOCKET")) && re && X(e.baseUrl) && J() ? (!c.current || c.current.isConnected() === !1 || c.current.baseUrl !== e.baseUrl) && (c.current = new we(
157
+ C(() => {
158
+ c.cancelWhenScannedCounter > 0 && (m.nw ? g(new Error(S.retryForbidden)) : y());
159
+ }, [c.cancelWhenScannedCounter]), C(() => (!(/^((?!chrome|android).)*safari/i.test(globalThis.navigator.userAgent) || Object.hasOwn(globalThis?.blocklet || {}, "DID_CONNECT_DISABLE_SOCKET")) && te && X(e.baseUrl) && J() ? (!a.current || a.current.isConnected() === !1 || a.current.baseUrl !== e.baseUrl) && (a.current = new be(
168
160
  `${Ee()}//${ve(e.baseUrl)}${ye()}${G}/relay`,
169
161
  {
170
162
  longpollerTimeout: 5e3,
171
163
  // connection timeout
172
164
  heartbeatIntervalMs: 30 * 1e3
173
165
  }
174
- ), c.current.baseUrl = e.baseUrl, c.current.onOpen(() => {
175
- l.isSocketAvailable = !0;
176
- }), c.current.connect()) : l.isSocketAvailable && (l.isSocketAvailable = !1), () => {
177
- c.current && (c.current.disconnect(), c.current = null);
166
+ ), a.current.baseUrl = e.baseUrl, a.current.onOpen(() => {
167
+ c.isSocketAvailable = !0;
168
+ }), a.current.connect()) : c.isSocketAvailable && (c.isSocketAvailable = !1), () => {
169
+ a.current && (a.current.disconnect(), a.current = null);
178
170
  }), [e.baseUrl]);
179
- const ie = () => !e.token || e.loading || Y(e.status) ? null : d, j = I(null);
180
- S(() => {
171
+ const ie = () => !e.token || e.loading || Y(e.status) ? null : k, j = I(null);
172
+ C(() => {
181
173
  j.current = { state: e, params: b };
182
- }), S(() => () => {
183
- const { state: r, params: t } = j.current;
184
- r.status === "created" && t[k] && r.checkFn(`${r.prefix}/timeout?${$(t)}`, {
185
- headers: v(r.baseUrl)
174
+ }), C(() => () => {
175
+ const { state: t, params: r } = j.current;
176
+ t.status === "created" && r[f] && t.checkFn(`${t.prefix}/timeout?${$(r)}`, {
177
+ headers: x(t.baseUrl)
186
178
  });
187
179
  }, []);
188
- const C = E(async (r = !1) => {
189
- if ((e.checking || document.hidden) && !r || (e.status === "created" && e.checkCount++, l.isSocketAvailable && !r))
180
+ const w = E(async (t = !1) => {
181
+ if ((e.checking || document.hidden) && !t || (e.status === "created" && e.checkCount++, c.isSocketAvailable && !t))
190
182
  return null;
191
183
  try {
192
184
  e.checking = !0;
193
- const t = await e.checkFn(`${e.prefix}/status?${$(b)}`, {
194
- headers: v(e.baseUrl)
195
- }), { status: n, error: u, mfaCode: s = 0 } = t.data;
196
- if (e.store = t.data, e.mfaCode = s, e.checking = !1, e.status === "scanned" && n === "created" || (e.status = n), n === "error" && u) {
197
- const N = new Error(u);
198
- throw N.response = t, N;
185
+ const r = await e.checkFn(`${e.prefix}/status?${$(b)}`, {
186
+ headers: x(e.baseUrl)
187
+ }), { status: n, error: i, mfaCode: s = 0 } = r.data;
188
+ if (e.store = r.data, e.mfaCode = s, e.checking = !1, e.status === "scanned" && n === "created" || (e.status = n), n === "error" && i) {
189
+ const N = new Error(i);
190
+ throw N.response = r, N;
199
191
  }
200
- return t.data;
201
- } catch (t) {
202
- const { response: n } = t;
192
+ return r.data;
193
+ } catch (r) {
194
+ const { response: n } = r;
203
195
  if (n?.status) {
204
- b[k] && e.checkFn(`${e.prefix}/timeout?${$(b)}`, {
205
- headers: v(e.baseUrl)
196
+ b[f] && e.checkFn(`${e.prefix}/timeout?${$(b)}`, {
197
+ headers: x(e.baseUrl)
206
198
  });
207
- const u = n?.data?.error ? n.data.error : t.message, s = new Error(u);
208
- s.code = n.status, e.status = "error", e.checking = !1, e.error = u, g(s, e?.store, A);
199
+ const i = n?.data?.error ? n.data.error : r.message, s = new Error(i);
200
+ s.code = n.status, e.status = "error", e.checking = !1, e.error = i, g(s, e?.store, A);
209
201
  } else
210
- e.status = "error", e.checking = !1, e.error = x.generateError;
202
+ e.status = "error", e.checking = !1, e.error = S.generateError;
211
203
  }
212
204
  return null;
213
205
  }), le = async () => {
214
206
  try {
215
- if (f.error)
216
- throw f.error;
217
- e.loading = !0, e.token = f.token, e.url = f.url, e.inExistingSession = !0;
218
- let r = await C();
219
- if ((["scanned"].includes(r?.status) || r?.sourceToken === f?.token) && (await y(!1), r = await C()), F.current = r?.extraParams || null, r?.status && !["created"].includes(r?.status))
220
- throw new Error(`${x.invalidSessionStatus} [${r.status}]`);
221
- } catch (r) {
222
- e.status = "error", e.error = r.message, g(r, e?.store, A);
207
+ if (u.error)
208
+ throw u.error;
209
+ e.loading = !0, e.token = u.token, e.url = u.url, e.inExistingSession = !0;
210
+ let t = await w();
211
+ if ((["scanned"].includes(t?.status) || t?.sourceToken === u?.token) && (await y(!1), t = await w()), F.current = t?.extraParams || null, t?.status && !["created"].includes(t?.status))
212
+ throw new Error(`${S.invalidSessionStatus} [${t.status}]`);
213
+ } catch (t) {
214
+ e.status = "error", e.error = t.message, g(t, e?.store, A);
223
215
  } finally {
224
216
  e.loading = !1;
225
217
  }
226
218
  };
227
- S(() => {
219
+ C(() => {
228
220
  if (!e.token && !e.store && !e.loading && !e.error)
229
- if (f)
221
+ if (u)
230
222
  le();
231
223
  else {
232
224
  y(!1);
@@ -236,67 +228,67 @@ function Xe({
236
228
  e.status = "timeout", L();
237
229
  return;
238
230
  }
239
- if (e.status === "succeed" && !l.onSuccessCalled) {
240
- const r = be({
231
+ if (e.status === "succeed" && !c.onSuccessCalled) {
232
+ const t = we({
241
233
  ...e.store,
242
234
  appInfo: e.appInfo,
243
235
  memberAppInfo: e.memberAppInfo
244
236
  });
245
- if (X(e.baseUrl) && te && e.saveConnect && e.store.did && Ce(r, !0), e.store) {
246
- const { nextWorkflow: t } = e.store;
247
- if (t)
237
+ if (X(e.baseUrl) && re && e.saveConnect && e.store.did && Ce(t, !0), e.store) {
238
+ const { nextWorkflow: r } = e.store;
239
+ if (r)
248
240
  try {
249
- const n = Q(t, k);
250
- e.nextWorkflow = n?.nextWorkflow || t, Object.assign(e, n), e.store = null, e.error = "", e.url = "", e.appInfo = null, e.memberAppInfo = null, e.checkCount = 0, e.status = "scanned", e.results = {
241
+ const n = Q(r, f);
242
+ e.nextWorkflow = n?.nextWorkflow || r, Object.assign(e, n), e.store = null, e.error = "", e.url = "", e.appInfo = null, e.memberAppInfo = null, e.checkCount = 0, e.status = "scanned", e.results = {
251
243
  ...e.results,
252
244
  [e.token]: e.store
253
- }, e.checkFn = z({ baseURL: n.baseUrl, timeout: 8e3 }).get, C();
245
+ }, e.checkFn = z({ baseURL: n.baseUrl, timeout: 8e3 }).get, w();
254
246
  } catch (n) {
255
- console.error(`Invalid nextWorkflow: ${t}`, n), e.status = "error", e.error = `Invalid nextWorkflow: ${t}: ${n.message}`;
247
+ console.error(`Invalid nextWorkflow: ${r}`, n), e.status = "error", e.error = `Invalid nextWorkflow: ${r}: ${n.message}`;
256
248
  }
257
249
  else if (e.nextWorkflow && (e.nextWorkflow = "", e.url = ""), typeof U == "function") {
258
250
  const n = Object.values({ ...e.results, [e.token]: e.store });
259
- l.onSuccessCalled = !0;
260
- const u = n.length > 1 ? n : n[0], s = de(u);
251
+ c.onSuccessCalled = !0;
252
+ const i = n.length > 1 ? n : n[0], s = de(i);
261
253
  U(s, A, {
262
- sourceAppPid: i?.sourceAppPid,
263
- ...r
254
+ sourceAppPid: m?.sourceAppPid,
255
+ ...t
264
256
  });
265
257
  }
266
258
  }
267
259
  return;
268
260
  }
269
261
  if (e.store?.nextWorkflow) {
270
- const { nextWorkflow: r } = e.store;
262
+ const { nextWorkflow: t } = e.store;
271
263
  try {
272
- const t = Q(r, k);
273
- e.nextWorkflow = t?.nextWorkflow || r, Object.assign(e, t), e.store = null, e.error = "", e.url = "", e.appInfo = null, e.memberAppInfo = null, e.checkCount = 0, e.status = "scanned", e.results = {
264
+ const r = Q(t, f);
265
+ e.nextWorkflow = r?.nextWorkflow || t, Object.assign(e, r), e.store = null, e.error = "", e.url = "", e.appInfo = null, e.memberAppInfo = null, e.checkCount = 0, e.status = "scanned", e.results = {
274
266
  ...e.results,
275
267
  [e.token]: e.store
276
- }, e.checkFn = z({ baseURL: t.baseUrl, timeout: 8e3 }).get, C();
277
- } catch (t) {
278
- console.error(`Invalid nextWorkflow: ${r}`, t), e.status = "error", e.error = `Invalid nextWorkflow: ${r}: ${t.message}`;
268
+ }, e.checkFn = z({ baseURL: r.baseUrl, timeout: 8e3 }).get, w();
269
+ } catch (r) {
270
+ console.error(`Invalid nextWorkflow: ${t}`, r), e.status = "error", e.error = `Invalid nextWorkflow: ${t}: ${r.message}`;
279
271
  }
280
272
  }
281
273
  });
282
- const T = I(0);
283
- return S(() => {
284
- if (e.token && l.isSocketAvailable && c.current) {
285
- let r = !1;
286
- m.current ? m.current.token !== e.token && (c.current.unsubscribe(P(m.current.token)), r = !0) : r = !0, r && (m.current = c.current.subscribe(P(e.token)), T.current = 0, m.current.token = e.token, m.current.on("updated", ({ response: t }) => {
287
- const n = +new Date(t.updatedAt);
288
- if (n <= T.current) {
289
- console.warn("Ignore outdated message", t);
274
+ const W = I(0);
275
+ return C(() => {
276
+ if (e.token && c.isSocketAvailable && a.current) {
277
+ let t = !1;
278
+ p.current ? p.current.token !== e.token && (a.current.unsubscribe(R(p.current.token)), t = !0) : t = !0, t && (p.current = a.current.subscribe(R(e.token)), W.current = 0, p.current.token = e.token, p.current.on("updated", ({ response: r }) => {
279
+ const n = +new Date(r.updatedAt);
280
+ if (n <= W.current) {
281
+ console.warn("Ignore outdated message", r);
290
282
  return;
291
283
  }
292
- T.current = n;
293
- let { status: u, error: s } = t;
294
- u === "forbidden" && (s = x.forbidden, u = "error"), e.status = u, e.mfaCode = t.mfaCode || 0, e.store = t, e.error = s, s && g(new Error(s), e?.store, A);
284
+ W.current = n;
285
+ let { status: i, error: s } = r;
286
+ i === "forbidden" && (s = S.forbidden, i = "error"), e.status = i, e.mfaCode = r.mfaCode || 0, e.store = r, e.error = s, s && g(new Error(s), e?.store, A);
295
287
  }));
296
288
  }
297
- }, [e.token, l.isSocketAvailable, c.current]), ke(C, ie()), $e(() => {
289
+ }, [e.token, c.isSocketAvailable, a.current]), ke(w, ie()), xe(() => {
298
290
  e.token && Y(e.status) === !1 && (e.checking = !1, setTimeout(() => {
299
- C(!0);
291
+ w(!0);
300
292
  }, 100));
301
293
  }), { state: e, generate: y, cancelWhenScanned: ce };
302
294
  }