@arcblock/did-connect-react 3.4.13 → 3.4.15

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,180 +1,180 @@
1
- import { jsx as l, jsxs as po } from "react/jsx-runtime";
2
- import n from "prop-types";
3
- import { Box as A } from "@mui/material";
4
- import { LOGIN_PROVIDER as e, LOGIN_PROVIDER_ICON_SIZE as E, LOGIN_PROVIDER_NAME as uo } from "@arcblock/ux/lib/Util/constant";
5
- import { checkSameProtocol as go, getWebWalletUrl as ho } from "@arcblock/ux/lib/Util/wallet";
6
- import b from "lodash/noop";
7
- import { useMemoizedFn as a, useCreation as fo } from "ahooks";
8
- import O from "js-cookie";
9
- import { detectWalletExtension as yo, getCookieOptions as Lo } from "@arcblock/ux/lib/Util";
10
- import { useRef as w, useEffect as J } from "react";
11
- import { mergeSx as Io } from "@arcblock/ux/lib/Util/style";
12
- import Ao from "@arcblock/ux/lib/DIDConnect/provider-icon";
13
- import { GA_LAST_LOGIN_METHOD as y } from "@arcblock/ux/lib/withTracker/constant";
14
- import { translate as Eo } from "@arcblock/ux/lib/Locale/util";
15
- import bo from "@arcblock/ux/lib/Empty";
16
- import { useBrowser as xo } from "@arcblock/react-hooks";
1
+ import { jsx as l, jsxs as ho } from "react/jsx-runtime";
2
+ import e from "prop-types";
3
+ import { Box as E } from "@mui/material";
4
+ import { LAST_USED_LOGIN_METHOD as uo, LOGIN_PROVIDER as t, WALLET_LOGIN_METHOD as J, LOGIN_PROVIDER_ICON_SIZE as A, LOGIN_PROVIDER_NAME as go } from "@arcblock/ux/lib/Util/constant";
5
+ import { checkSameProtocol as fo, getWebWalletUrl as Lo } from "@arcblock/ux/lib/Util/wallet";
6
+ import M from "lodash/noop";
7
+ import { useMemoizedFn as c, useCreation as yo } from "ahooks";
8
+ import v from "js-cookie";
9
+ import { detectWalletExtension as Io, getCookieOptions as Eo } from "@arcblock/ux/lib/Util";
10
+ import { useRef as w, useEffect as X } from "react";
11
+ import { mergeSx as Ao } from "@arcblock/ux/lib/Util/style";
12
+ import Mo from "@arcblock/ux/lib/DIDConnect/provider-icon";
13
+ import { GA_LAST_LOGIN_METHOD as L } from "@arcblock/ux/lib/withTracker/constant";
14
+ import { translate as bo } from "@arcblock/ux/lib/Locale/util";
15
+ import xo from "@arcblock/ux/lib/Empty";
16
+ import { useBrowser as _o } from "@arcblock/react-hooks";
17
17
  import Co from "./mobile-login-item.js";
18
- import Po from "./web-login-item.js";
19
- import Mo from "./login-method-item.js";
18
+ import Oo from "./web-login-item.js";
19
+ import Po from "./login-method-item.js";
20
20
  import vo from "./wallet-login-options.js";
21
- import { useOAuth as _o } from "../../../OAuth/context.js";
22
- import { useStateContext as Oo } from "../../contexts/state.js";
23
- import { getAppId as wo, logger as Wo, getApiErrorMessage as To } from "../../../utils.js";
24
- import ko from "./passkey-login-item.js";
25
- import { usePasskey as So } from "../../../Passkey/context.js";
21
+ import { useOAuth as wo } from "../../../OAuth/context.js";
22
+ import { useStateContext as To } from "../../contexts/state.js";
23
+ import { getAppId as Wo, logger as So, getApiErrorMessage as ko } from "../../../utils.js";
24
+ import Do from "./passkey-login-item.js";
25
+ import { usePasskey as No } from "../../../Passkey/context.js";
26
26
  import "../../../Passkey/actions.js";
27
27
  import Ro from "../../plugins/email/index.js";
28
28
  import jo from "../../assets/locale.js";
29
- function No({
30
- onSuccess: W = b,
31
- onError: T = b,
29
+ function Bo({
30
+ onSuccess: T = M,
31
+ onError: W = M,
32
32
  size: m = "small",
33
- tokenState: t,
34
- webWalletUrl: x = ho(),
35
- tokenKey: k,
36
- passkeyBehavior: S = "none",
37
- onReset: C = b,
38
- providerList: p = [],
39
- slotProps: X = {},
40
- disableSwitchApp: P = !1,
41
- forceUpdate: z = b,
42
- magicToken: R = void 0,
43
- baseUrl: Q = "/",
44
- customItems: oo = [],
45
- qrcode: eo = null,
46
- hideQRCode: d = !1
33
+ tokenState: n,
34
+ webWalletUrl: b = Lo(),
35
+ tokenKey: S,
36
+ passkeyBehavior: k = "none",
37
+ onReset: x = M,
38
+ providerList: d = [],
39
+ slotProps: z = {},
40
+ disableSwitchApp: _ = !1,
41
+ forceUpdate: Q = M,
42
+ magicToken: D = void 0,
43
+ baseUrl: oo = "/",
44
+ customItems: eo = [],
45
+ qrcode: to = null,
46
+ hideQRCode: p = !1
47
47
  }) {
48
- const M = w(null), v = w(null), j = w(null), no = go(x), N = yo(), u = xo(), { loginOAuth: to, logoutOAuth: ro, t: io, oauthState: s } = _o(), { passkeyState: D } = So(), {
49
- extraParams: F,
50
- locale: B,
51
- connectState: i,
52
- plugins: G,
53
- setPlugins: lo,
54
- setSelectedPlugin: so,
48
+ const C = w(null), O = w(null), N = w(null), no = fo(b), R = Io(), h = _o(), { loginOAuth: ro, logoutOAuth: io, t: lo, oauthState: s } = wo(), { passkeyState: j } = No(), {
49
+ extraParams: B,
50
+ locale: G,
51
+ connectState: r,
52
+ plugins: F,
53
+ setPlugins: so,
54
+ setSelectedPlugin: ao,
55
55
  getPlugin: U,
56
56
  showWalletOptions: f,
57
- setShowWalletOptions: L,
58
- lastLoginMethod: g
59
- } = Oo(), I = a((o, r = {}) => Eo(jo, o, B, "en", r)), q = a(async (o) => {
60
- localStorage.setItem(y, o.provider), t.reset(), s.reset({
57
+ setShowWalletOptions: y,
58
+ lastLoginMethod: u
59
+ } = To(), I = c((o, i = {}) => bo(jo, o, G, "en", i)), q = c(async (o) => {
60
+ localStorage.setItem(L, o.provider), n.reset(), s.reset({
61
61
  status: "scanned"
62
- }), D.reset(), i.chooseMethod = o.provider;
63
- const r = F?.sourceAppPid;
62
+ }), j.reset(), r.chooseMethod = o.provider, r.walletMethod = "";
63
+ const i = B?.sourceAppPid;
64
64
  try {
65
65
  s.loading = !0, s.status = "scanned";
66
- const c = await to(o, {
67
- action: t.action,
68
- ...F
69
- }), h = Lo({ returnDomain: !1 });
70
- O.remove("connected_did", h), O.remove("connected_pk", h), O.remove("connected_wallet_os", h), c?.sessionToken && (await W(
66
+ const a = await ro(o, {
67
+ action: n.action,
68
+ ...B
69
+ }), g = Eo({ returnDomain: !1 });
70
+ v.remove("connected_did", g), v.remove("connected_pk", g), v.remove("connected_wallet_os", g), a?.sessionToken && (localStorage.setItem(uo, o.provider), await T(
71
71
  {
72
- ...c,
72
+ ...a,
73
73
  encrypted: !1
74
74
  },
75
- (mo) => mo,
75
+ (po) => po,
76
76
  {
77
- sourceAppPid: r,
78
- connected_app: wo(t.appInfo, t.memberAppInfo)
77
+ sourceAppPid: i,
78
+ connected_app: Wo(n.appInfo, n.memberAppInfo)
79
79
  }
80
80
  ), s.loading = !1, s.status = "succeed");
81
- } catch (c) {
82
- Wo.error(`Failed login OAuth: ${o.provider}`, c);
83
- const h = To(c, io("loginOAuthFailed"));
84
- s.loading = !1, s.error = h, s.status = "error", await ro({ provider: o.provider }), T(new Error(h));
81
+ } catch (a) {
82
+ So.error(`Failed login OAuth: ${o.provider}`, a);
83
+ const g = ko(a, lo("loginOAuthFailed"));
84
+ s.loading = !1, s.error = g, s.status = "error", await io({ provider: o.provider }), W(new Error(g));
85
85
  }
86
- }), K = a(async () => {
87
- t.reset(), await C(), t.status = "created", i.chooseMethod = "wallet";
88
- }), V = a(async () => {
89
- localStorage.setItem(y, e.WALLET), t.reset(), await C(), t.status = "created", i.chooseMethod = "wallet";
90
- const o = M.current?.connect;
91
- i.retryConnect = () => {
92
- o(K);
86
+ }), H = c(async () => {
87
+ n.reset(), await x(), n.status = "created", r.chooseMethod = "wallet", r.walletMethod = "";
88
+ }), K = c(async () => {
89
+ localStorage.setItem(L, t.WALLET), n.reset(), await x(), n.status = "created", r.chooseMethod = "wallet";
90
+ const o = C.current?.connect;
91
+ r.retryConnect = () => {
92
+ o(H);
93
93
  };
94
- }), Y = a(() => {
95
- localStorage.setItem(y, e.WALLET), t.status = "scanned", i.chooseMethod = "wallet-web";
96
- const o = v.current.connect;
97
- i.retryConnect = async () => {
98
- await C(), t.error = "", t.status = "scanned", o();
94
+ }), V = c(() => {
95
+ localStorage.setItem(L, t.WALLET), n.status = "scanned", r.chooseMethod = "wallet-web";
96
+ const o = O.current.connect;
97
+ r.retryConnect = async () => {
98
+ await x(), n.error = "", n.status = "scanned", o();
99
99
  };
100
- }), co = a(() => {
101
- L(!1);
102
- }), _ = fo(() => p.length === 1 && p[0].provider === e.WALLET, [p]);
103
- J(() => {
104
- d && _ && !u.mobile.any && !f && L(!0);
105
- }, [d, _, u.mobile.any, L, f]);
106
- const H = p.some((o) => o.provider === e.EMAIL), Z = Ro({ baseUrl: Q }), ao = a(() => {
107
- if (R && p.some((o) => o.name === e.EMAIL) && G.some((o) => o.name === e.EMAIL)) {
108
- const o = U(e.EMAIL);
109
- o.state.status === "idle" && (localStorage.setItem(y, e.EMAIL), o.state.reset(), o.state.magicToken = R, i.chooseMethod = e.EMAIL, so(o), z());
100
+ }), co = c(() => {
101
+ y(!1);
102
+ }), P = yo(() => d.length === 1 && d[0].provider === t.WALLET, [d]);
103
+ X(() => {
104
+ p && P && !h.mobile.any && !f && y(!0);
105
+ }, [p, P, h.mobile.any, y, f]);
106
+ const Y = d.some((o) => o.provider === t.EMAIL), Z = Ro({ baseUrl: oo }), mo = c(() => {
107
+ if (D && d.some((o) => o.name === t.EMAIL) && F.some((o) => o.name === t.EMAIL)) {
108
+ const o = U(t.EMAIL);
109
+ o.state.status === "idle" && (localStorage.setItem(L, t.EMAIL), o.state.reset(), o.state.magicToken = D, r.chooseMethod = t.EMAIL, ao(o), Q());
110
110
  }
111
111
  });
112
- J(() => {
112
+ X(() => {
113
113
  const o = [];
114
- if (H) {
115
- const r = U(e.EMAIL);
116
- r && r.baseUrl === Z.baseUrl ? o.push(r) : o.push(Z);
114
+ if (Y) {
115
+ const i = U(t.EMAIL);
116
+ i && i.baseUrl === Z.baseUrl ? o.push(i) : o.push(Z);
117
117
  }
118
- lo(o), i.retryConnect = K, setTimeout(() => {
119
- ao();
118
+ so(o), r.retryConnect = H, setTimeout(() => {
119
+ mo();
120
120
  }, 100);
121
- }, [H]);
122
- const $ = p.map((o) => {
123
- if (o.provider === e.WALLET)
124
- return u.mobile.any && !f ? /* @__PURE__ */ l(
121
+ }, [Y]);
122
+ const $ = d.map((o) => {
123
+ if (o.provider === t.WALLET)
124
+ return h.mobile.any && !f ? /* @__PURE__ */ l(
125
125
  Co,
126
126
  {
127
127
  t: I,
128
- isLatest: g && g === e.WALLET,
129
- ref: M,
130
- tokenState: t,
128
+ isLatest: u && u === J.MOBILE,
129
+ ref: C,
130
+ tokenState: n,
131
131
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
132
- locale: B,
133
- tokenKey: k,
134
- disableSwitchApp: P,
135
- onClick: V
132
+ locale: G,
133
+ tokenKey: S,
134
+ disableSwitchApp: _,
135
+ onClick: K
136
136
  },
137
- e.WALLET
138
- ) : d || !d && (no || N) && (!u.mobile.any || N) ? /* @__PURE__ */ l(
139
- Po,
137
+ t.WALLET
138
+ ) : p || !p && (no || R) && (!h.mobile.any || R) ? /* @__PURE__ */ l(
139
+ Oo,
140
140
  {
141
141
  t: I,
142
- isLatest: g && g === e.WALLET,
143
- ref: v,
144
- tokenState: t,
145
- webWalletUrl: x,
142
+ isLatest: u && u === J.WEB,
143
+ ref: O,
144
+ tokenState: n,
145
+ webWalletUrl: b,
146
146
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
147
- disableSwitchApp: P,
148
- autoConnect: !d,
147
+ disableSwitchApp: _,
148
+ autoConnect: !p,
149
149
  onClick: () => {
150
- d ? L(!0) : Y();
150
+ p ? y(!0) : V();
151
151
  }
152
152
  },
153
- e.WALLET
153
+ t.WALLET
154
154
  ) : null;
155
- if (o.provider === e.PASSKEY)
156
- return S === "none" ? null : /* @__PURE__ */ l(
157
- ko,
155
+ if (o.provider === t.PASSKEY)
156
+ return k === "none" ? null : /* @__PURE__ */ l(
157
+ Do,
158
158
  {
159
- ref: j,
160
- onSuccess: W,
161
- onError: T,
162
- tokenState: t,
163
- behavior: S,
159
+ ref: N,
160
+ onSuccess: T,
161
+ onError: W,
162
+ tokenState: n,
163
+ behavior: k,
164
164
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
165
165
  onClick: () => {
166
- localStorage.setItem(y, e.PASSKEY);
167
- const r = j.current.connect;
168
- i.chooseMethod = "passkey", i.retryConnect = () => {
169
- D.verifying = !0, i.chooseMethod = "passkey", r();
166
+ localStorage.setItem(L, t.PASSKEY);
167
+ const i = N.current.connect;
168
+ r.chooseMethod = "passkey", r.walletMethod = "", r.retryConnect = () => {
169
+ j.verifying = !0, r.chooseMethod = "passkey", i();
170
170
  };
171
171
  },
172
172
  slotProps: {
173
173
  icon: {
174
174
  sx: {
175
- fontSize: E,
175
+ fontSize: A,
176
176
  "& svg": {
177
- fontSize: E,
177
+ fontSize: A,
178
178
  width: "1em",
179
179
  height: "1em"
180
180
  }
@@ -182,36 +182,36 @@ function No({
182
182
  }
183
183
  }
184
184
  },
185
- e.PASSKEY
185
+ t.PASSKEY
186
186
  );
187
- if (o.provider === e.EMAIL) {
188
- const r = G.find((c) => c.name === e.EMAIL);
189
- return r ? r?.renderListItem({
190
- key: r.name,
187
+ if (o.provider === t.EMAIL) {
188
+ const i = F.find((a) => a.name === t.EMAIL);
189
+ return i ? i?.renderListItem({
190
+ key: i.name,
191
191
  sx: [m === "small" ? { p: 1 } : { p: 2 }]
192
192
  // forceUpdate,
193
193
  }) : null;
194
194
  }
195
195
  return o.type === "oauth" ? /* @__PURE__ */ l(
196
- Mo,
196
+ Po,
197
197
  {
198
198
  t: I,
199
- isLatest: g && g === o.provider,
200
- title: uo[o.provider],
199
+ isLatest: u && u === o.provider,
200
+ title: go[o.provider],
201
201
  icon: /* @__PURE__ */ l(
202
- Ao,
202
+ Mo,
203
203
  {
204
204
  provider: o.provider,
205
205
  sx: {
206
206
  transform: "scale(0.95)",
207
- width: E,
208
- height: E,
207
+ width: A,
208
+ height: A,
209
209
  color: "text.primary"
210
210
  }
211
211
  }
212
212
  ),
213
213
  onClick: () => {
214
- q(o), i.retryConnect = () => {
214
+ q(o), r.retryConnect = () => {
215
215
  q(o);
216
216
  };
217
217
  },
@@ -220,42 +220,42 @@ function No({
220
220
  o.provider
221
221
  ) : null;
222
222
  }).filter(Boolean);
223
- return /* @__PURE__ */ l(A, { className: "did-connect__choose", sx: Io({ flex: 1 }, X?.root?.sx), children: /* @__PURE__ */ l(
224
- A,
223
+ return /* @__PURE__ */ l(E, { className: "did-connect__choose", sx: Ao({ flex: 1 }, z?.root?.sx), children: /* @__PURE__ */ l(
224
+ E,
225
225
  {
226
226
  sx: {
227
227
  display: "flex",
228
228
  flexDirection: "column",
229
229
  gap: 2
230
230
  },
231
- children: /* @__PURE__ */ po(
232
- A,
231
+ children: /* @__PURE__ */ ho(
232
+ E,
233
233
  {
234
234
  sx: [
235
235
  {
236
236
  display: "flex",
237
237
  flexDirection: "column",
238
- ...f && !u.mobile.any ? { alignItems: "center", gap: 0 } : { gap: 1.5 }
238
+ ...f && !h.mobile.any ? { alignItems: "center", gap: 0 } : { gap: 1.5 }
239
239
  }
240
240
  ],
241
241
  children: [
242
- f && !u.mobile.any ? /* @__PURE__ */ l(
242
+ f && !h.mobile.any ? /* @__PURE__ */ l(
243
243
  vo,
244
244
  {
245
- qrcode: eo,
246
- tokenState: t,
247
- webWalletUrl: x,
245
+ qrcode: to,
246
+ tokenState: n,
247
+ webWalletUrl: b,
248
248
  size: m,
249
- disableSwitchApp: P,
250
- tokenKey: k,
251
- walletLoginRef: M,
252
- webLoginRef: v,
253
- onMobileLoginClick: V,
254
- onWebLoginClick: Y,
255
- onBack: _ ? void 0 : co
249
+ disableSwitchApp: _,
250
+ tokenKey: S,
251
+ walletLoginRef: C,
252
+ webLoginRef: O,
253
+ onMobileLoginClick: K,
254
+ onWebLoginClick: V,
255
+ onBack: P ? void 0 : co
256
256
  }
257
257
  ) : /* @__PURE__ */ l(
258
- A,
258
+ E,
259
259
  {
260
260
  sx: {
261
261
  display: "grid",
@@ -301,7 +301,7 @@ function No({
301
301
  }
302
302
  },
303
303
  children: $.length > 0 ? $ : /* @__PURE__ */ l(
304
- bo,
304
+ xo,
305
305
  {
306
306
  className: "arc-login-item",
307
307
  sx: {
@@ -314,32 +314,32 @@ function No({
314
314
  )
315
315
  }
316
316
  ),
317
- oo.map((o) => o || null)
317
+ eo.map((o) => o || null)
318
318
  ]
319
319
  }
320
320
  )
321
321
  }
322
322
  ) });
323
323
  }
324
- No.propTypes = {
325
- onSuccess: n.func,
326
- onError: n.func,
327
- size: n.oneOf(["small", "normal", "large"]),
328
- tokenState: n.object.isRequired,
329
- webWalletUrl: n.string,
330
- tokenKey: n.string.isRequired,
331
- passkeyBehavior: n.oneOf(["none", "both", "only-existing", "only-new"]),
332
- onReset: n.func,
333
- providerList: n.array,
334
- slotProps: n.object,
335
- disableSwitchApp: n.bool,
336
- forceUpdate: n.func,
337
- magicToken: n.string,
338
- baseUrl: n.string,
339
- customItems: n.arrayOf(n.node),
340
- qrcode: n.node,
341
- hideQRCode: n.bool
324
+ Bo.propTypes = {
325
+ onSuccess: e.func,
326
+ onError: e.func,
327
+ size: e.oneOf(["small", "normal", "large"]),
328
+ tokenState: e.object.isRequired,
329
+ webWalletUrl: e.string,
330
+ tokenKey: e.string.isRequired,
331
+ passkeyBehavior: e.oneOf(["none", "both", "only-existing", "only-new"]),
332
+ onReset: e.func,
333
+ providerList: e.array,
334
+ slotProps: e.object,
335
+ disableSwitchApp: e.bool,
336
+ forceUpdate: e.func,
337
+ magicToken: e.string,
338
+ baseUrl: e.string,
339
+ customItems: e.arrayOf(e.node),
340
+ qrcode: e.node,
341
+ hideQRCode: e.bool
342
342
  };
343
343
  export {
344
- No as default
344
+ Bo as default
345
345
  };
@@ -1,104 +1,104 @@
1
- import { jsx as m } from "react/jsx-runtime";
1
+ import { jsx as p } from "react/jsx-runtime";
2
2
  import n from "prop-types";
3
- import { CircularProgress as T } from "@mui/material";
4
- import { useReactive as E, useCreation as W, useMemoizedFn as a } from "ahooks";
5
- import _ from "@arcblock/bridge";
6
- import { useBrowser as N } from "@arcblock/react-hooks";
7
- import q from "lodash/noop";
3
+ import { CircularProgress as _ } from "@mui/material";
4
+ import { useReactive as v, useCreation as N, useMemoizedFn as l } from "ahooks";
5
+ import W from "@arcblock/bridge";
6
+ import { useBrowser as q } from "@arcblock/react-hooks";
7
+ import B from "lodash/noop";
8
8
  import { useImperativeHandle as F } from "react";
9
- import { mergeSx as M } from "@arcblock/ux/lib/Util/style";
9
+ import { mergeSx as G } from "@arcblock/ux/lib/Util/style";
10
10
  import j from "@arcblock/ux/lib/DIDConnect/provider-icon";
11
- import { LOGIN_PROVIDER_ICON_SIZE as p, LOGIN_PROVIDER as z } from "@arcblock/ux/lib/Util/constant";
12
- import { useStateContext as G } from "../../contexts/state.js";
11
+ import { WALLET_LOGIN_METHOD as f, LOGIN_PROVIDER_ICON_SIZE as d, LOGIN_PROVIDER as z } from "@arcblock/ux/lib/Util/constant";
12
+ import { useStateContext as H } from "../../contexts/state.js";
13
13
  import J from "./login-method-item.js";
14
- import { logger as b } from "../../../utils.js";
14
+ import { logger as L } from "../../../utils.js";
15
15
  import K from "../../hooks/auth-url.js";
16
16
  function V({
17
- isTablet: w = !1,
18
- ref: C = null,
17
+ isTablet: C = !1,
18
+ ref: A = null,
19
19
  tokenState: e,
20
20
  locale: P,
21
21
  tokenKey: y,
22
- onClick: R = q,
23
- disableSwitchApp: A = !1,
24
- ...f
22
+ onClick: R = B,
23
+ disableSwitchApp: O = !1,
24
+ ...h
25
25
  }) {
26
- const l = E({
26
+ const a = v({
27
27
  loading: !1
28
- }), { isWalletWebview: d } = G(), L = "DID Wallet", c = N(), h = new URL(window.location.href), x = K({ disableSwitchApp: A, tokenState: e }), u = W(() => {
28
+ }), { isWalletWebview: u, connectState: c } = H(), x = "DID Wallet", m = q(), I = new URL(window.location.href), E = K({ disableSwitchApp: O, tokenState: e }), g = N(() => {
29
29
  if (!e.url)
30
30
  return "";
31
- h.searchParams.set("tokenKey", e.token);
32
- const o = new URL(x);
33
- c.wallet || (o.searchParams.set("callback", encodeURIComponent(h)), o.searchParams.set("callback_delay", 1500)), o.searchParams.set("locale", P);
34
- const g = new TextEncoder(), D = o.href.length;
35
- let r = "", i = "";
31
+ I.searchParams.set("tokenKey", e.token);
32
+ const o = new URL(E);
33
+ m.wallet || (o.searchParams.set("callback", encodeURIComponent(I)), o.searchParams.set("callback_delay", 1500)), o.searchParams.set("locale", P);
34
+ const w = new TextEncoder(), U = o.href.length;
35
+ let r = "", s = "";
36
36
  try {
37
37
  if (e.appInfo) {
38
- const t = g.encode(JSON.stringify(e.appInfo));
39
- r = btoa(String.fromCharCode(...t));
38
+ const i = w.encode(JSON.stringify(e.appInfo));
39
+ r = btoa(String.fromCharCode(...i));
40
40
  }
41
41
  if (e.memberAppInfo) {
42
- const t = g.encode(JSON.stringify(e.memberAppInfo));
43
- i = btoa(String.fromCharCode(...t));
42
+ const i = w.encode(JSON.stringify(e.memberAppInfo));
43
+ s = btoa(String.fromCharCode(...i));
44
44
  }
45
- if (D + 8 + r.length + 14 + i.length > 2e3)
46
- throw b.warn("URL too long, drop appInfo & memberAppInfo", { appInfo: r, memberAppInfo: i }), new Error("URL too long");
47
- i ? r && (o.searchParams.set("appInfo", r), o.searchParams.set("memberAppInfo", i)) : r && o.searchParams.set("appInfo", r);
48
- } catch (t) {
49
- b.warn("Failed to convert appInfo & memberAppInfo", t);
45
+ if (U + 8 + r.length + 14 + s.length > 2e3)
46
+ throw L.warn("URL too long, drop appInfo & memberAppInfo", { appInfo: r, memberAppInfo: s }), new Error("URL too long");
47
+ s ? r && (o.searchParams.set("appInfo", r), o.searchParams.set("memberAppInfo", s)) : r && o.searchParams.set("appInfo", r);
48
+ } catch (i) {
49
+ L.warn("Failed to convert appInfo & memberAppInfo", i);
50
50
  }
51
51
  return o.href.replace(/^https?:\/\//, "abt://");
52
- }, [y, e.token, e.appInfo, e.memberAppInfo, e.url]), O = a(() => {
53
- l.loading = !0, setTimeout(() => {
54
- _.call("authAction", { action: "auth", deepLink: u });
52
+ }, [y, e.token, e.appInfo, e.memberAppInfo, e.url]), M = l(() => {
53
+ a.loading = !0, setTimeout(() => {
54
+ W.call("authAction", { action: "auth", deepLink: g });
55
55
  }, 600), setTimeout(() => {
56
- l.loading = !1;
56
+ a.loading = !1;
57
57
  }, 2e3);
58
- }), U = a(() => {
58
+ }), T = l(() => {
59
59
  e.checking = !0, e.status = "scanned";
60
- }), s = {};
61
- !d && c.mobile.any && (s.component = "a", s.href = u), e.url || (s.sx = {
60
+ }), t = {};
61
+ !u && m.mobile.any && (t.component = "a", t.href = g), e.url || (t.sx = {
62
62
  cursor: "not-allowed"
63
63
  });
64
- const I = a((o) => {
65
- e.url && (d ? O() : c.mobile.any || w ? U() : o());
66
- }), v = a(() => {
67
- I(R);
64
+ const b = l((o) => {
65
+ e.url && (u ? (c.walletMethod = f.MOBILE, M()) : m.mobile.any || C ? (c.walletMethod = f.MOBILE, T()) : (c.walletMethod = f.SCAN, o()));
66
+ }), D = l(() => {
67
+ b(R);
68
68
  });
69
- return F(C, () => ({
70
- connect: I
71
- })), /* @__PURE__ */ m(
69
+ return F(A, () => ({
70
+ connect: b
71
+ })), /* @__PURE__ */ p(
72
72
  J,
73
73
  {
74
- ...f,
75
- ...s,
76
- sx: M(f?.sx, s?.sx),
77
- title: L,
78
- icon: l.loading || !e.url ? /* @__PURE__ */ m(
79
- T,
74
+ ...h,
75
+ ...t,
76
+ sx: G(h?.sx, t?.sx),
77
+ title: x,
78
+ icon: a.loading || !e.url ? /* @__PURE__ */ p(
79
+ _,
80
80
  {
81
81
  color: "primary",
82
- size: p,
82
+ size: d,
83
83
  sx: {
84
84
  "& svg": {
85
85
  transform: "scale(0.75)"
86
86
  }
87
87
  }
88
88
  }
89
- ) : /* @__PURE__ */ m(
89
+ ) : /* @__PURE__ */ p(
90
90
  j,
91
91
  {
92
92
  provider: z.DID_WALLET,
93
93
  sx: {
94
- width: p,
95
- height: p,
94
+ width: d,
95
+ height: d,
96
96
  transform: "scale(0.9)"
97
97
  }
98
98
  }
99
99
  ),
100
100
  iconScale: 1,
101
- onClick: v
101
+ onClick: D
102
102
  }
103
103
  );
104
104
  }