@arcblock/did-connect-react 3.3.5 → 3.3.7

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,170 +1,174 @@
1
- import { jsx as l, jsxs as ie } from "react/jsx-runtime";
1
+ import { jsx as l, jsxs as se } from "react/jsx-runtime";
2
2
  import o from "prop-types";
3
- import { Box as h } from "@mui/material";
4
- import { LOGIN_PROVIDER as r, LOGIN_PROVIDER_ICON_SIZE as g, LOGIN_PROVIDER_NAME as le } from "@arcblock/ux/lib/Util/constant";
5
- import { getWebWalletUrl as se } from "@arcblock/ux/lib/Util/wallet";
6
- import u from "lodash/noop";
7
- import { useMemoizedFn as c } from "ahooks";
8
- import E from "js-cookie";
9
- import { getCookieOptions as ae } from "@arcblock/ux/lib/Util";
10
- import { useRef as b, useEffect as ce } from "react";
11
- import { mergeSx as me } from "@arcblock/ux/lib/Util/style";
12
- import de from "@arcblock/ux/lib/DIDConnect/provider-icon";
13
- import { GA_LAST_LOGIN_METHOD as p } from "@arcblock/ux/lib/withTracker/constant";
14
- import { translate as pe } from "@arcblock/ux/lib/Locale/util";
15
- import he from "@arcblock/ux/lib/Empty";
16
- import { useBrowser as ge } from "@arcblock/react-hooks";
17
- import ue from "./mobile-login-item.js";
18
- import fe from "./web-login-item.js";
19
- import ye from "./login-method-item.js";
20
- import Le from "./wallet-login-options.js";
21
- import { useOAuth as Ie } from "../../../OAuth/context.js";
22
- import { useStateContext as Ce } from "../../contexts/state.js";
23
- import { getAppId as xe, logger as Ae, getApiErrorMessage as Ee } from "../../../utils.js";
24
- import be from "./passkey-login-item.js";
25
- import { usePasskey as Me } from "../../../Passkey/context.js";
3
+ import { Box as y } from "@mui/material";
4
+ import { LOGIN_PROVIDER as t, LOGIN_PROVIDER_ICON_SIZE as L, LOGIN_PROVIDER_NAME as ae } from "@arcblock/ux/lib/Util/constant";
5
+ import { getWebWalletUrl as ce } from "@arcblock/ux/lib/Util/wallet";
6
+ import I from "lodash/noop";
7
+ import { useMemoizedFn as c, useCreation as me } from "ahooks";
8
+ import M from "js-cookie";
9
+ import { getCookieOptions as de } from "@arcblock/ux/lib/Util";
10
+ import { useRef as P, useEffect as K } from "react";
11
+ import { mergeSx as pe } from "@arcblock/ux/lib/Util/style";
12
+ import ue from "@arcblock/ux/lib/DIDConnect/provider-icon";
13
+ import { GA_LAST_LOGIN_METHOD as g } from "@arcblock/ux/lib/withTracker/constant";
14
+ import { translate as he } from "@arcblock/ux/lib/Locale/util";
15
+ import ge from "@arcblock/ux/lib/Empty";
16
+ import { useBrowser as fe } from "@arcblock/react-hooks";
17
+ import ye from "./mobile-login-item.js";
18
+ import Le from "./web-login-item.js";
19
+ import Ie from "./login-method-item.js";
20
+ import Ce from "./wallet-login-options.js";
21
+ import { useOAuth as Ae } from "../../../OAuth/context.js";
22
+ import { useStateContext as be } from "../../contexts/state.js";
23
+ import { getAppId as xe, logger as Ee, getApiErrorMessage as Me } from "../../../utils.js";
24
+ import Pe from "./passkey-login-item.js";
25
+ import { usePasskey as ve } from "../../../Passkey/context.js";
26
26
  import "../../../Passkey/actions.js";
27
- import ve from "../../plugins/email/index.js";
28
- import Pe from "../../assets/locale.js";
29
- function _e({
30
- onSuccess: M = u,
31
- onError: v = u,
27
+ import _e from "../../plugins/email/index.js";
28
+ import we from "../../assets/locale.js";
29
+ function Oe({
30
+ onSuccess: v = I,
31
+ onError: _ = I,
32
32
  size: m = "small",
33
33
  tokenState: n,
34
- webWalletUrl: P = se(),
35
- tokenKey: _,
36
- passkeyBehavior: w = "none",
37
- onReset: f = u,
38
- providerList: y = [],
39
- slotProps: V = {},
40
- disableSwitchApp: L = !1,
41
- forceUpdate: K = u,
42
- magicToken: O = void 0,
43
- baseUrl: Y = "/",
44
- customItems: H = [],
45
- qrcode: Z = null
34
+ webWalletUrl: w = ce(),
35
+ tokenKey: O,
36
+ passkeyBehavior: T = "none",
37
+ onReset: C = I,
38
+ providerList: d = [],
39
+ slotProps: Y = {},
40
+ disableSwitchApp: A = !1,
41
+ forceUpdate: H = I,
42
+ magicToken: W = void 0,
43
+ baseUrl: Z = "/",
44
+ customItems: $ = [],
45
+ qrcode: J = null
46
46
  }) {
47
- const I = b(null), C = b(null), R = b(null), x = ge(), { loginOAuth: $, logoutOAuth: J, t: Q, oauthState: s } = Ie(), { passkeyState: T } = Me(), {
48
- extraParams: k,
49
- locale: W,
47
+ const b = P(null), x = P(null), R = P(null), u = fe(), { loginOAuth: Q, logoutOAuth: X, t: z, oauthState: s } = Ae(), { passkeyState: k } = ve(), {
48
+ extraParams: j,
49
+ locale: N,
50
50
  connectState: i,
51
- plugins: j,
52
- setPlugins: X,
53
- setSelectedPlugin: z,
54
- getPlugin: N,
55
- showWalletOptions: A,
56
- setShowWalletOptions: D
57
- } = Ce(), ee = c((e, t = {}) => pe(Pe, e, W, "en", t)), F = c(async (e) => {
58
- localStorage.setItem(p, e.provider), n.reset(), s.reset({
51
+ plugins: D,
52
+ setPlugins: ee,
53
+ setSelectedPlugin: oe,
54
+ getPlugin: F,
55
+ showWalletOptions: h,
56
+ setShowWalletOptions: f
57
+ } = be(), ne = c((e, r = {}) => he(we, e, N, "en", r)), S = c(async (e) => {
58
+ localStorage.setItem(g, e.provider), n.reset(), s.reset({
59
59
  status: "scanned"
60
- }), T.reset(), i.chooseMethod = e.provider;
61
- const t = k?.sourceAppPid;
60
+ }), k.reset(), i.chooseMethod = e.provider;
61
+ const r = j?.sourceAppPid;
62
62
  try {
63
63
  s.loading = !0, s.status = "scanned";
64
- const a = await $(e, {
64
+ const a = await Q(e, {
65
65
  action: n.action,
66
- ...k
67
- }), d = ae({ returnDomain: !1 });
68
- E.remove("connected_did", d), E.remove("connected_pk", d), E.remove("connected_wallet_os", d), a?.sessionToken && (await M(
66
+ ...j
67
+ }), p = de({ returnDomain: !1 });
68
+ M.remove("connected_did", p), M.remove("connected_pk", p), M.remove("connected_wallet_os", p), a?.sessionToken && (await v(
69
69
  {
70
70
  ...a,
71
71
  encrypted: !1
72
72
  },
73
- (re) => re,
73
+ (le) => le,
74
74
  {
75
- sourceAppPid: t,
75
+ sourceAppPid: r,
76
76
  connected_app: xe(n.appInfo, n.memberAppInfo)
77
77
  }
78
78
  ), s.loading = !1, s.status = "succeed");
79
79
  } catch (a) {
80
- Ae.error(`Failed login OAuth: ${e.provider}`, a);
81
- const d = Ee(a, Q("loginOAuthFailed"));
82
- s.loading = !1, s.error = d, s.status = "error", await J({ provider: e.provider }), v(new Error(d));
80
+ Ee.error(`Failed login OAuth: ${e.provider}`, a);
81
+ const p = Me(a, z("loginOAuthFailed"));
82
+ s.loading = !1, s.error = p, s.status = "error", await X({ provider: e.provider }), _(new Error(p));
83
83
  }
84
- }), S = c(async () => {
85
- n.reset(), await f(), n.status = "created", i.chooseMethod = "wallet";
86
84
  }), B = c(async () => {
87
- localStorage.setItem(p, "wallet"), n.reset(), await f(), n.status = "created", i.chooseMethod = "wallet";
88
- const e = I.current?.connect;
85
+ n.reset(), await C(), n.status = "created", i.chooseMethod = "wallet";
86
+ }), G = c(async () => {
87
+ localStorage.setItem(g, "wallet"), n.reset(), await C(), n.status = "created", i.chooseMethod = "wallet";
88
+ const e = b.current?.connect;
89
89
  i.retryConnect = () => {
90
- e(S);
90
+ e(B);
91
91
  };
92
- }), oe = c(() => {
93
- localStorage.setItem(p, "wallet"), n.status = "scanned", i.chooseMethod = "wallet-web";
94
- const e = C.current.connect;
92
+ }), te = c(() => {
93
+ localStorage.setItem(g, "wallet"), n.status = "scanned", i.chooseMethod = "wallet-web";
94
+ const e = x.current.connect;
95
95
  i.retryConnect = async () => {
96
- await f(), n.error = "", n.status = "scanned", e();
96
+ await C(), n.error = "", n.status = "scanned", e();
97
97
  };
98
- }), ne = c(() => {
99
- D(!1);
100
- }), G = y.some((e) => e.provider === r.EMAIL), U = ve({ baseUrl: Y }), te = c(() => {
101
- if (O && y.some((e) => e.name === r.EMAIL) && j.some((e) => e.name === r.EMAIL)) {
102
- const e = N(r.EMAIL);
103
- e.state.status === "idle" && (localStorage.setItem(p, "email"), e.state.reset(), e.state.magicToken = O, i.chooseMethod = r.EMAIL, z(e), K());
98
+ }), re = c(() => {
99
+ f(!1);
100
+ }), E = me(() => d.length === 1 && d[0].provider === t.WALLET, [d]);
101
+ K(() => {
102
+ E && !u.mobile.any && !h && f(!0);
103
+ }, [E, u.mobile.any, f, h]);
104
+ const U = d.some((e) => e.provider === t.EMAIL), q = _e({ baseUrl: Z }), ie = c(() => {
105
+ if (W && d.some((e) => e.name === t.EMAIL) && D.some((e) => e.name === t.EMAIL)) {
106
+ const e = F(t.EMAIL);
107
+ e.state.status === "idle" && (localStorage.setItem(g, "email"), e.state.reset(), e.state.magicToken = W, i.chooseMethod = t.EMAIL, oe(e), H());
104
108
  }
105
109
  });
106
- ce(() => {
110
+ K(() => {
107
111
  const e = [];
108
- if (G) {
109
- const t = N(r.EMAIL);
110
- t && t.baseUrl === U.baseUrl ? e.push(t) : e.push(U);
112
+ if (U) {
113
+ const r = F(t.EMAIL);
114
+ r && r.baseUrl === q.baseUrl ? e.push(r) : e.push(q);
111
115
  }
112
- X(e), i.retryConnect = S, setTimeout(() => {
113
- te();
116
+ ee(e), i.retryConnect = B, setTimeout(() => {
117
+ ie();
114
118
  }, 100);
115
- }, [G]);
116
- const q = y.map((e) => {
117
- if (e.provider === r.WALLET)
118
- return x.mobile.any && !A ? /* @__PURE__ */ l(
119
- ue,
119
+ }, [U]);
120
+ const V = d.map((e) => {
121
+ if (e.provider === t.WALLET)
122
+ return u.mobile.any && !h ? /* @__PURE__ */ l(
123
+ ye,
120
124
  {
121
- ref: I,
125
+ ref: b,
122
126
  tokenState: n,
123
127
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
124
- locale: W,
125
- tokenKey: _,
126
- disableSwitchApp: L,
127
- onClick: B
128
+ locale: N,
129
+ tokenKey: O,
130
+ disableSwitchApp: A,
131
+ onClick: G
128
132
  },
129
- r.WALLET
133
+ t.WALLET
130
134
  ) : /* @__PURE__ */ l(
131
- fe,
135
+ Le,
132
136
  {
133
- ref: C,
137
+ ref: x,
134
138
  tokenState: n,
135
- webWalletUrl: P,
139
+ webWalletUrl: w,
136
140
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
137
- disableSwitchApp: L,
141
+ disableSwitchApp: A,
138
142
  autoConnect: !1,
139
143
  onClick: () => {
140
- D(!0);
144
+ f(!0);
141
145
  }
142
146
  },
143
- r.WALLET
147
+ t.WALLET
144
148
  );
145
- if (e.provider === r.PASSKEY)
146
- return w === "none" ? null : /* @__PURE__ */ l(
147
- be,
149
+ if (e.provider === t.PASSKEY)
150
+ return T === "none" ? null : /* @__PURE__ */ l(
151
+ Pe,
148
152
  {
149
153
  ref: R,
150
- onSuccess: M,
151
- onError: v,
154
+ onSuccess: v,
155
+ onError: _,
152
156
  tokenState: n,
153
- behavior: w,
157
+ behavior: T,
154
158
  sx: [m === "small" ? { p: 1 } : { p: 2 }],
155
159
  onClick: () => {
156
- localStorage.setItem(p, "passkey");
157
- const t = R.current.connect;
160
+ localStorage.setItem(g, "passkey");
161
+ const r = R.current.connect;
158
162
  i.chooseMethod = "passkey", i.retryConnect = () => {
159
- T.verifying = !0, i.chooseMethod = "passkey", t();
163
+ k.verifying = !0, i.chooseMethod = "passkey", r();
160
164
  };
161
165
  },
162
166
  slotProps: {
163
167
  icon: {
164
168
  sx: {
165
- fontSize: g,
169
+ fontSize: L,
166
170
  "& svg": {
167
- fontSize: g,
171
+ fontSize: L,
168
172
  width: "1em",
169
173
  height: "1em"
170
174
  }
@@ -172,35 +176,35 @@ function _e({
172
176
  }
173
177
  }
174
178
  },
175
- r.PASSKEY
179
+ t.PASSKEY
176
180
  );
177
- if (e.provider === r.EMAIL) {
178
- const t = j.find((a) => a.name === r.EMAIL);
179
- return t ? t?.renderListItem({
180
- key: t.name,
181
+ if (e.provider === t.EMAIL) {
182
+ const r = D.find((a) => a.name === t.EMAIL);
183
+ return r ? r?.renderListItem({
184
+ key: r.name,
181
185
  sx: [m === "small" ? { p: 1 } : { p: 2 }]
182
186
  // forceUpdate,
183
187
  }) : null;
184
188
  }
185
189
  return e.type === "oauth" ? /* @__PURE__ */ l(
186
- ye,
190
+ Ie,
187
191
  {
188
- title: le[e.provider],
192
+ title: ae[e.provider],
189
193
  icon: /* @__PURE__ */ l(
190
- de,
194
+ ue,
191
195
  {
192
196
  provider: e.provider,
193
197
  sx: {
194
198
  transform: "scale(0.95)",
195
- width: g,
196
- height: g,
199
+ width: L,
200
+ height: L,
197
201
  color: "text.primary"
198
202
  }
199
203
  }
200
204
  ),
201
205
  onClick: () => {
202
- F(e), i.retryConnect = () => {
203
- F(e);
206
+ S(e), i.retryConnect = () => {
207
+ S(e);
204
208
  };
205
209
  },
206
210
  sx: [m === "small" ? { p: 1.2 } : { p: 2 }]
@@ -208,42 +212,42 @@ function _e({
208
212
  e.provider
209
213
  ) : null;
210
214
  }).filter(Boolean);
211
- return /* @__PURE__ */ l(h, { className: "did-connect__choose", sx: me({ flex: 1 }, V?.root?.sx), children: /* @__PURE__ */ l(
212
- h,
215
+ return /* @__PURE__ */ l(y, { className: "did-connect__choose", sx: pe({ flex: 1 }, Y?.root?.sx), children: /* @__PURE__ */ l(
216
+ y,
213
217
  {
214
218
  sx: {
215
219
  display: "flex",
216
220
  flexDirection: "column",
217
221
  gap: 2
218
222
  },
219
- children: /* @__PURE__ */ ie(
220
- h,
223
+ children: /* @__PURE__ */ se(
224
+ y,
221
225
  {
222
226
  sx: [
223
227
  {
224
228
  display: "flex",
225
229
  flexDirection: "column",
226
- ...A && !x.mobile.any ? { alignItems: "center", gap: 0 } : { gap: 1.5 }
230
+ ...h && !u.mobile.any ? { alignItems: "center", gap: 0 } : { gap: 1.5 }
227
231
  }
228
232
  ],
229
233
  children: [
230
- A && !x.mobile.any ? /* @__PURE__ */ l(
231
- Le,
234
+ h && !u.mobile.any ? /* @__PURE__ */ l(
235
+ Ce,
232
236
  {
233
- qrcode: Z,
237
+ qrcode: J,
234
238
  tokenState: n,
235
- webWalletUrl: P,
239
+ webWalletUrl: w,
236
240
  size: m,
237
- disableSwitchApp: L,
238
- tokenKey: _,
239
- walletLoginRef: I,
240
- webLoginRef: C,
241
- onMobileLoginClick: B,
242
- onWebLoginClick: oe,
243
- onBack: ne
241
+ disableSwitchApp: A,
242
+ tokenKey: O,
243
+ walletLoginRef: b,
244
+ webLoginRef: x,
245
+ onMobileLoginClick: G,
246
+ onWebLoginClick: te,
247
+ onBack: E ? void 0 : re
244
248
  }
245
249
  ) : /* @__PURE__ */ l(
246
- h,
250
+ y,
247
251
  {
248
252
  sx: {
249
253
  display: "grid",
@@ -288,8 +292,8 @@ function _e({
288
292
  }
289
293
  }
290
294
  },
291
- children: q.length > 0 ? q : /* @__PURE__ */ l(
292
- he,
295
+ children: V.length > 0 ? V : /* @__PURE__ */ l(
296
+ ge,
293
297
  {
294
298
  className: "arc-login-item",
295
299
  sx: {
@@ -297,19 +301,19 @@ function _e({
297
301
  textAlign: "center"
298
302
  }
299
303
  },
300
- children: ee("noAuthenticationProvider")
304
+ children: ne("noAuthenticationProvider")
301
305
  }
302
306
  )
303
307
  }
304
308
  ),
305
- H.map((e) => e || null)
309
+ $.map((e) => e || null)
306
310
  ]
307
311
  }
308
312
  )
309
313
  }
310
314
  ) });
311
315
  }
312
- _e.propTypes = {
316
+ Oe.propTypes = {
313
317
  onSuccess: o.func,
314
318
  onError: o.func,
315
319
  size: o.oneOf(["small", "normal", "large"]),
@@ -328,5 +332,5 @@ _e.propTypes = {
328
332
  qrcode: o.node
329
333
  };
330
334
  export {
331
- _e as default
335
+ Oe as default
332
336
  };
@@ -1,32 +1,32 @@
1
- import { jsxs as c, Fragment as f, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as f, Fragment as d, jsx as e } from "react/jsx-runtime";
2
2
  import o from "prop-types";
3
3
  import { Box as t, Divider as R } from "@mui/material";
4
- import { LOGIN_PROVIDER as d } from "@arcblock/ux/lib/Util/constant";
5
- import { checkSameProtocol as k, getWebWalletUrl as C } from "@arcblock/ux/lib/Util/wallet";
4
+ import { LOGIN_PROVIDER as p } from "@arcblock/ux/lib/Util/constant";
5
+ import { checkSameProtocol as C, getWebWalletUrl as k } from "@arcblock/ux/lib/Util/wallet";
6
6
  import { detectWalletExtension as W } from "@arcblock/ux/lib/Util";
7
7
  import { useCreation as q } from "ahooks";
8
8
  import { useBrowser as j } from "@arcblock/react-hooks";
9
9
  import T from "./mobile-login-item.js";
10
- import B from "./web-login-item.js";
11
- import P from "../back-button.js";
12
- import { useStateContext as v } from "../../contexts/state.js";
10
+ import P from "./web-login-item.js";
11
+ import v from "../back-button.js";
12
+ import { useStateContext as B } from "../../contexts/state.js";
13
13
  function E({
14
- qrcode: p,
14
+ qrcode: u,
15
15
  tokenState: r,
16
- webWalletUrl: n = C(),
16
+ webWalletUrl: n = k(),
17
17
  size: l = "small",
18
18
  disableSwitchApp: m = !1,
19
- tokenKey: u,
20
- walletLoginRef: b = null,
21
- webLoginRef: x = null,
22
- onMobileLoginClick: g,
23
- onWebLoginClick: h,
24
- onBack: L
19
+ tokenKey: b,
20
+ walletLoginRef: x = null,
21
+ webLoginRef: g = null,
22
+ onMobileLoginClick: h,
23
+ onWebLoginClick: L,
24
+ onBack: s
25
25
  }) {
26
- const { locale: w } = v(), i = j(), y = k(n), s = W(), a = q(() => i.mobile.tablet || !i.mobile.any && window?.navigator?.maxTouchPoints > 0, [i.mobile.tablet, i.mobile.any]);
27
- return /* @__PURE__ */ c(f, { children: [
28
- p,
29
- /* @__PURE__ */ c(t, { sx: { width: "100%", display: "flex", flexDirection: "column", gap: 1.5 }, children: [
26
+ const { locale: w } = B(), i = j(), y = C(n), a = W(), c = q(() => i.mobile.tablet || !i.mobile.any && window?.navigator?.maxTouchPoints > 0, [i.mobile.tablet, i.mobile.any]);
27
+ return /* @__PURE__ */ f(d, { children: [
28
+ u,
29
+ /* @__PURE__ */ f(t, { sx: { width: "100%", display: "flex", flexDirection: "column", gap: 1.5 }, children: [
30
30
  /* @__PURE__ */ e(t, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
31
31
  R,
32
32
  {
@@ -57,37 +57,37 @@ function E({
57
57
  }
58
58
  }
59
59
  },
60
- children: a ? /* @__PURE__ */ e(
60
+ children: c ? /* @__PURE__ */ e(
61
61
  T,
62
62
  {
63
- ref: b,
63
+ ref: x,
64
64
  tokenState: r,
65
- isTablet: a,
65
+ isTablet: c,
66
66
  sx: [l === "small" ? { p: 1 } : { p: 2 }],
67
67
  locale: w,
68
- tokenKey: u,
68
+ tokenKey: b,
69
69
  disableSwitchApp: m,
70
- onClick: g
70
+ onClick: h
71
71
  },
72
- d.WALLET
72
+ p.WALLET
73
73
  ) : (
74
74
  // eslint-disable-next-line react/jsx-no-useless-fragment
75
- /* @__PURE__ */ e(f, { children: (y || s) && (!i.mobile.any || s) ? /* @__PURE__ */ e(
76
- B,
75
+ /* @__PURE__ */ e(d, { children: (y || a) && (!i.mobile.any || a) ? /* @__PURE__ */ e(
76
+ P,
77
77
  {
78
- ref: x,
78
+ ref: g,
79
79
  tokenState: r,
80
80
  webWalletUrl: n,
81
81
  sx: [l === "small" ? { p: 1 } : { p: 2 }],
82
82
  disableSwitchApp: m,
83
- onClick: h
83
+ onClick: L
84
84
  },
85
- d.WALLET
85
+ p.WALLET
86
86
  ) : null })
87
87
  )
88
88
  }
89
89
  ),
90
- /* @__PURE__ */ e(P, { variant: "text", onClick: L })
90
+ s && /* @__PURE__ */ e(v, { variant: "text", onClick: s })
91
91
  ] })
92
92
  ] });
93
93
  }
@@ -1,4 +1,4 @@
1
- const o = "3.3.5", s = {
1
+ const o = "3.3.7", s = {
2
2
  version: o
3
3
  };
4
4
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/did-connect-react",
3
- "version": "3.3.5",
3
+ "version": "3.3.7",
4
4
  "description": "Client side library to work with DID Connect by ArcBlock.",
5
5
  "keywords": [
6
6
  "react",
@@ -32,10 +32,10 @@
32
32
  "url": "https://github.com/ArcBlock/ux/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/bridge": "3.3.5",
35
+ "@arcblock/bridge": "3.3.7",
36
36
  "@arcblock/did": "^1.27.16",
37
- "@arcblock/icons": "3.3.5",
38
- "@arcblock/react-hooks": "3.3.5",
37
+ "@arcblock/icons": "3.3.7",
38
+ "@arcblock/react-hooks": "3.3.7",
39
39
  "@arcblock/ws": "^1.27.16",
40
40
  "@blocklet/constant": "^1.17.6",
41
41
  "@fontsource/lexend": "^5.2.9",
@@ -81,5 +81,5 @@
81
81
  "eslint-plugin-react-hooks": "^4.6.2",
82
82
  "jest": "^29.7.0"
83
83
  },
84
- "gitHead": "757fbba540967c8552f9c30fc64fdce00a8be222"
84
+ "gitHead": "cd0e3b812192ce054be488bcb60ed3f44e81fdff"
85
85
  }
@@ -3,7 +3,7 @@ import { Box } from '@mui/material';
3
3
  import { LOGIN_PROVIDER, LOGIN_PROVIDER_NAME, LOGIN_PROVIDER_ICON_SIZE } from '@arcblock/ux/lib/Util/constant';
4
4
  import { getWebWalletUrl } from '@arcblock/ux/lib/Util/wallet';
5
5
  import noop from 'lodash/noop';
6
- import { useMemoizedFn } from 'ahooks';
6
+ import { useMemoizedFn, useCreation } from 'ahooks';
7
7
  import Cookie from 'js-cookie';
8
8
  import { getCookieOptions } from '@arcblock/ux/lib/Util';
9
9
  import { useEffect, useRef } from 'react';
@@ -153,6 +153,16 @@ export default function ConnectProviderList({
153
153
  setShowWalletOptions(false);
154
154
  });
155
155
 
156
+ const onlyWalletProvider = useCreation(() => {
157
+ return providerList.length === 1 && providerList[0].provider === LOGIN_PROVIDER.WALLET;
158
+ }, [providerList]);
159
+
160
+ useEffect(() => {
161
+ if (onlyWalletProvider && !browser.mobile.any && !showWalletOptions) {
162
+ setShowWalletOptions(true);
163
+ }
164
+ }, [onlyWalletProvider, browser.mobile.any, setShowWalletOptions, showWalletOptions]);
165
+
156
166
  const showEmailLogin = providerList.some((p) => p.provider === LOGIN_PROVIDER.EMAIL);
157
167
 
158
168
  const emailPlugin = useEmailPlugin({ baseUrl });
@@ -339,7 +349,7 @@ export default function ConnectProviderList({
339
349
  webLoginRef={webLoginRef}
340
350
  onMobileLoginClick={handleMobileLoginClick}
341
351
  onWebLoginClick={handleWebLoginClick}
342
- onBack={handleWalletLoginBack}
352
+ onBack={onlyWalletProvider ? undefined : handleWalletLoginBack}
343
353
  />
344
354
  ) : (
345
355
  <Box
@@ -95,7 +95,7 @@ export default function WalletLoginOptions({
95
95
  )}
96
96
  </Box>
97
97
 
98
- <BackButton variant="text" onClick={onBack} />
98
+ {onBack && <BackButton variant="text" onClick={onBack} />}
99
99
  </Box>
100
100
  </>
101
101
  );