@arcblock/did-connect-react 3.3.6 → 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.
- package/lib/Connect/components/login-item/connect-provider-list.js +151 -147
- package/lib/Connect/components/login-item/wallet-login-options.js +30 -30
- package/lib/package.json.js +1 -1
- package/package.json +5 -5
- package/src/Connect/components/login-item/connect-provider-list.jsx +12 -2
- package/src/Connect/components/login-item/wallet-login-options.jsx +1 -1
|
@@ -1,170 +1,174 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
1
|
+
import { jsx as l, jsxs as se } from "react/jsx-runtime";
|
|
2
2
|
import o from "prop-types";
|
|
3
|
-
import { Box as
|
|
4
|
-
import { LOGIN_PROVIDER as
|
|
5
|
-
import { getWebWalletUrl as
|
|
6
|
-
import
|
|
7
|
-
import { useMemoizedFn as c } from "ahooks";
|
|
8
|
-
import
|
|
9
|
-
import { getCookieOptions as
|
|
10
|
-
import { useRef as
|
|
11
|
-
import { mergeSx as
|
|
12
|
-
import
|
|
13
|
-
import { GA_LAST_LOGIN_METHOD as
|
|
14
|
-
import { translate as
|
|
15
|
-
import
|
|
16
|
-
import { useBrowser as
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import { useOAuth as
|
|
22
|
-
import { useStateContext as
|
|
23
|
-
import { getAppId as xe, logger as
|
|
24
|
-
import
|
|
25
|
-
import { usePasskey as
|
|
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
|
|
28
|
-
import
|
|
29
|
-
function
|
|
30
|
-
onSuccess:
|
|
31
|
-
onError:
|
|
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:
|
|
35
|
-
tokenKey:
|
|
36
|
-
passkeyBehavior:
|
|
37
|
-
onReset:
|
|
38
|
-
providerList:
|
|
39
|
-
slotProps:
|
|
40
|
-
disableSwitchApp:
|
|
41
|
-
forceUpdate:
|
|
42
|
-
magicToken:
|
|
43
|
-
baseUrl:
|
|
44
|
-
customItems:
|
|
45
|
-
qrcode:
|
|
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
|
|
48
|
-
extraParams:
|
|
49
|
-
locale:
|
|
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:
|
|
52
|
-
setPlugins:
|
|
53
|
-
setSelectedPlugin:
|
|
54
|
-
getPlugin:
|
|
55
|
-
showWalletOptions:
|
|
56
|
-
setShowWalletOptions:
|
|
57
|
-
} =
|
|
58
|
-
localStorage.setItem(
|
|
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
|
-
}),
|
|
61
|
-
const
|
|
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
|
|
64
|
+
const a = await Q(e, {
|
|
65
65
|
action: n.action,
|
|
66
|
-
...
|
|
67
|
-
}),
|
|
68
|
-
|
|
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
|
-
(
|
|
73
|
+
(le) => le,
|
|
74
74
|
{
|
|
75
|
-
sourceAppPid:
|
|
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
|
-
|
|
81
|
-
const
|
|
82
|
-
s.loading = !1, s.error =
|
|
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
|
-
|
|
88
|
-
|
|
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(
|
|
90
|
+
e(B);
|
|
91
91
|
};
|
|
92
|
-
}),
|
|
93
|
-
localStorage.setItem(
|
|
94
|
-
const e =
|
|
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
|
|
96
|
+
await C(), n.error = "", n.status = "scanned", e();
|
|
97
97
|
};
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
}),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
110
|
+
K(() => {
|
|
107
111
|
const e = [];
|
|
108
|
-
if (
|
|
109
|
-
const
|
|
110
|
-
|
|
112
|
+
if (U) {
|
|
113
|
+
const r = F(t.EMAIL);
|
|
114
|
+
r && r.baseUrl === q.baseUrl ? e.push(r) : e.push(q);
|
|
111
115
|
}
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
ee(e), i.retryConnect = B, setTimeout(() => {
|
|
117
|
+
ie();
|
|
114
118
|
}, 100);
|
|
115
|
-
}, [
|
|
116
|
-
const
|
|
117
|
-
if (e.provider ===
|
|
118
|
-
return
|
|
119
|
-
|
|
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:
|
|
125
|
+
ref: b,
|
|
122
126
|
tokenState: n,
|
|
123
127
|
sx: [m === "small" ? { p: 1 } : { p: 2 }],
|
|
124
|
-
locale:
|
|
125
|
-
tokenKey:
|
|
126
|
-
disableSwitchApp:
|
|
127
|
-
onClick:
|
|
128
|
+
locale: N,
|
|
129
|
+
tokenKey: O,
|
|
130
|
+
disableSwitchApp: A,
|
|
131
|
+
onClick: G
|
|
128
132
|
},
|
|
129
|
-
|
|
133
|
+
t.WALLET
|
|
130
134
|
) : /* @__PURE__ */ l(
|
|
131
|
-
|
|
135
|
+
Le,
|
|
132
136
|
{
|
|
133
|
-
ref:
|
|
137
|
+
ref: x,
|
|
134
138
|
tokenState: n,
|
|
135
|
-
webWalletUrl:
|
|
139
|
+
webWalletUrl: w,
|
|
136
140
|
sx: [m === "small" ? { p: 1 } : { p: 2 }],
|
|
137
|
-
disableSwitchApp:
|
|
141
|
+
disableSwitchApp: A,
|
|
138
142
|
autoConnect: !1,
|
|
139
143
|
onClick: () => {
|
|
140
|
-
|
|
144
|
+
f(!0);
|
|
141
145
|
}
|
|
142
146
|
},
|
|
143
|
-
|
|
147
|
+
t.WALLET
|
|
144
148
|
);
|
|
145
|
-
if (e.provider ===
|
|
146
|
-
return
|
|
147
|
-
|
|
149
|
+
if (e.provider === t.PASSKEY)
|
|
150
|
+
return T === "none" ? null : /* @__PURE__ */ l(
|
|
151
|
+
Pe,
|
|
148
152
|
{
|
|
149
153
|
ref: R,
|
|
150
|
-
onSuccess:
|
|
151
|
-
onError:
|
|
154
|
+
onSuccess: v,
|
|
155
|
+
onError: _,
|
|
152
156
|
tokenState: n,
|
|
153
|
-
behavior:
|
|
157
|
+
behavior: T,
|
|
154
158
|
sx: [m === "small" ? { p: 1 } : { p: 2 }],
|
|
155
159
|
onClick: () => {
|
|
156
|
-
localStorage.setItem(
|
|
157
|
-
const
|
|
160
|
+
localStorage.setItem(g, "passkey");
|
|
161
|
+
const r = R.current.connect;
|
|
158
162
|
i.chooseMethod = "passkey", i.retryConnect = () => {
|
|
159
|
-
|
|
163
|
+
k.verifying = !0, i.chooseMethod = "passkey", r();
|
|
160
164
|
};
|
|
161
165
|
},
|
|
162
166
|
slotProps: {
|
|
163
167
|
icon: {
|
|
164
168
|
sx: {
|
|
165
|
-
fontSize:
|
|
169
|
+
fontSize: L,
|
|
166
170
|
"& svg": {
|
|
167
|
-
fontSize:
|
|
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
|
-
|
|
179
|
+
t.PASSKEY
|
|
176
180
|
);
|
|
177
|
-
if (e.provider ===
|
|
178
|
-
const
|
|
179
|
-
return
|
|
180
|
-
key:
|
|
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
|
-
|
|
190
|
+
Ie,
|
|
187
191
|
{
|
|
188
|
-
title:
|
|
192
|
+
title: ae[e.provider],
|
|
189
193
|
icon: /* @__PURE__ */ l(
|
|
190
|
-
|
|
194
|
+
ue,
|
|
191
195
|
{
|
|
192
196
|
provider: e.provider,
|
|
193
197
|
sx: {
|
|
194
198
|
transform: "scale(0.95)",
|
|
195
|
-
width:
|
|
196
|
-
height:
|
|
199
|
+
width: L,
|
|
200
|
+
height: L,
|
|
197
201
|
color: "text.primary"
|
|
198
202
|
}
|
|
199
203
|
}
|
|
200
204
|
),
|
|
201
205
|
onClick: () => {
|
|
202
|
-
|
|
203
|
-
|
|
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(
|
|
212
|
-
|
|
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__ */
|
|
220
|
-
|
|
223
|
+
children: /* @__PURE__ */ se(
|
|
224
|
+
y,
|
|
221
225
|
{
|
|
222
226
|
sx: [
|
|
223
227
|
{
|
|
224
228
|
display: "flex",
|
|
225
229
|
flexDirection: "column",
|
|
226
|
-
...
|
|
230
|
+
...h && !u.mobile.any ? { alignItems: "center", gap: 0 } : { gap: 1.5 }
|
|
227
231
|
}
|
|
228
232
|
],
|
|
229
233
|
children: [
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
h && !u.mobile.any ? /* @__PURE__ */ l(
|
|
235
|
+
Ce,
|
|
232
236
|
{
|
|
233
|
-
qrcode:
|
|
237
|
+
qrcode: J,
|
|
234
238
|
tokenState: n,
|
|
235
|
-
webWalletUrl:
|
|
239
|
+
webWalletUrl: w,
|
|
236
240
|
size: m,
|
|
237
|
-
disableSwitchApp:
|
|
238
|
-
tokenKey:
|
|
239
|
-
walletLoginRef:
|
|
240
|
-
webLoginRef:
|
|
241
|
-
onMobileLoginClick:
|
|
242
|
-
onWebLoginClick:
|
|
243
|
-
onBack:
|
|
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
|
-
|
|
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:
|
|
292
|
-
|
|
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:
|
|
304
|
+
children: ne("noAuthenticationProvider")
|
|
301
305
|
}
|
|
302
306
|
)
|
|
303
307
|
}
|
|
304
308
|
),
|
|
305
|
-
|
|
309
|
+
$.map((e) => e || null)
|
|
306
310
|
]
|
|
307
311
|
}
|
|
308
312
|
)
|
|
309
313
|
}
|
|
310
314
|
) });
|
|
311
315
|
}
|
|
312
|
-
|
|
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
|
-
|
|
335
|
+
Oe as default
|
|
332
336
|
};
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { jsxs as
|
|
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
|
|
5
|
-
import { checkSameProtocol as
|
|
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
|
|
11
|
-
import
|
|
12
|
-
import { useStateContext as
|
|
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:
|
|
14
|
+
qrcode: u,
|
|
15
15
|
tokenState: r,
|
|
16
|
-
webWalletUrl: n =
|
|
16
|
+
webWalletUrl: n = k(),
|
|
17
17
|
size: l = "small",
|
|
18
18
|
disableSwitchApp: m = !1,
|
|
19
|
-
tokenKey:
|
|
20
|
-
walletLoginRef:
|
|
21
|
-
webLoginRef:
|
|
22
|
-
onMobileLoginClick:
|
|
23
|
-
onWebLoginClick:
|
|
24
|
-
onBack:
|
|
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 } =
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
|
|
29
|
-
/* @__PURE__ */
|
|
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:
|
|
60
|
+
children: c ? /* @__PURE__ */ e(
|
|
61
61
|
T,
|
|
62
62
|
{
|
|
63
|
-
ref:
|
|
63
|
+
ref: x,
|
|
64
64
|
tokenState: r,
|
|
65
|
-
isTablet:
|
|
65
|
+
isTablet: c,
|
|
66
66
|
sx: [l === "small" ? { p: 1 } : { p: 2 }],
|
|
67
67
|
locale: w,
|
|
68
|
-
tokenKey:
|
|
68
|
+
tokenKey: b,
|
|
69
69
|
disableSwitchApp: m,
|
|
70
|
-
onClick:
|
|
70
|
+
onClick: h
|
|
71
71
|
},
|
|
72
|
-
|
|
72
|
+
p.WALLET
|
|
73
73
|
) : (
|
|
74
74
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
75
|
-
/* @__PURE__ */ e(
|
|
76
|
-
|
|
75
|
+
/* @__PURE__ */ e(d, { children: (y || a) && (!i.mobile.any || a) ? /* @__PURE__ */ e(
|
|
76
|
+
P,
|
|
77
77
|
{
|
|
78
|
-
ref:
|
|
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:
|
|
83
|
+
onClick: L
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
p.WALLET
|
|
86
86
|
) : null })
|
|
87
87
|
)
|
|
88
88
|
}
|
|
89
89
|
),
|
|
90
|
-
/* @__PURE__ */ e(
|
|
90
|
+
s && /* @__PURE__ */ e(v, { variant: "text", onClick: s })
|
|
91
91
|
] })
|
|
92
92
|
] });
|
|
93
93
|
}
|
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/did-connect-react",
|
|
3
|
-
"version": "3.3.
|
|
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.
|
|
35
|
+
"@arcblock/bridge": "3.3.7",
|
|
36
36
|
"@arcblock/did": "^1.27.16",
|
|
37
|
-
"@arcblock/icons": "3.3.
|
|
38
|
-
"@arcblock/react-hooks": "3.3.
|
|
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": "
|
|
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
|