@arcblock/did-connect-react 3.3.1 → 3.3.3
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/did-connect-title.js +5 -4
- package/lib/Connect/components/login-item/connect-choose-list.js +86 -86
- package/lib/Connect/components/login-item/connect-provider-list.js +98 -94
- package/lib/Connect/components/login-item/login-method-item.js +22 -21
- package/lib/Connect/components/login-item/mobile-login-item.js +47 -47
- package/lib/Connect/components/login-item/web-login-item.js +40 -40
- package/lib/Connect/index.js +59 -59
- package/lib/Connect/plugins/email/list-item.js +10 -10
- package/lib/OAuth/context.js +1 -1
- package/lib/package.json.js +1 -1
- package/lib/utils.js +2 -2
- package/package.json +5 -5
- package/src/Connect/components/did-connect-title.jsx +1 -0
- package/src/Connect/components/login-item/connect-choose-list.jsx +5 -5
- package/src/Connect/components/login-item/connect-provider-list.jsx +11 -7
- package/src/Connect/components/login-item/login-method-item.jsx +4 -3
- package/src/Connect/components/login-item/mobile-login-item.jsx +5 -5
- package/src/Connect/components/login-item/web-login-item.jsx +6 -6
- package/src/Connect/index.jsx +2 -2
- package/src/Connect/plugins/email/list-item.jsx +2 -2
- package/src/OAuth/context.jsx +1 -1
- package/src/utils.js +2 -2
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import r from "prop-types";
|
|
3
3
|
import { CircularProgress as C } from "@mui/material";
|
|
4
|
-
import { useReactive as
|
|
5
|
-
import { detectWalletExtension as
|
|
6
|
-
import { mergeSx as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { useImperativeHandle as
|
|
10
|
-
import
|
|
11
|
-
import { LOGIN_PROVIDER as
|
|
12
|
-
import
|
|
13
|
-
import { useStateContext as
|
|
14
|
-
import { EXT_DOWNLOAD_URL as
|
|
4
|
+
import { useReactive as L, useMemoizedFn as d, useCreation as p } from "ahooks";
|
|
5
|
+
import { detectWalletExtension as _, openWebWallet as w } from "@arcblock/ux/lib/Util";
|
|
6
|
+
import { mergeSx as E } from "@arcblock/ux/lib/Util/style";
|
|
7
|
+
import O from "lodash/noop";
|
|
8
|
+
import P from "lodash/omit";
|
|
9
|
+
import { useImperativeHandle as v } from "react";
|
|
10
|
+
import A from "@arcblock/ux/lib/DIDConnect/provider-icon";
|
|
11
|
+
import { LOGIN_PROVIDER_ICON_SIZE as a, LOGIN_PROVIDER as y } from "@arcblock/ux/lib/Util/constant";
|
|
12
|
+
import T from "./login-method-item.js";
|
|
13
|
+
import { useStateContext as N } from "../../contexts/state.js";
|
|
14
|
+
import { EXT_DOWNLOAD_URL as I } from "../../../constant.js";
|
|
15
15
|
import U from "../../hooks/auth-url.js";
|
|
16
16
|
function j({
|
|
17
|
-
ref:
|
|
17
|
+
ref: g = null,
|
|
18
18
|
tokenState: o,
|
|
19
|
-
locale:
|
|
19
|
+
locale: x = "en",
|
|
20
20
|
webWalletUrl: b,
|
|
21
|
-
onClick:
|
|
21
|
+
onClick: D = O,
|
|
22
22
|
disableSwitchApp: h = !1,
|
|
23
|
-
...
|
|
23
|
+
...f
|
|
24
24
|
}) {
|
|
25
|
-
const { browserBrand: i } =
|
|
25
|
+
const { browserBrand: i } = N(), l = _(), t = L({
|
|
26
26
|
loading: !1
|
|
27
|
-
}),
|
|
28
|
-
t.loading = !0,
|
|
27
|
+
}), W = U({ disableSwitchApp: h, tokenState: o }), u = d(() => {
|
|
28
|
+
t.loading = !0, w({
|
|
29
29
|
webWalletUrl: b,
|
|
30
|
-
url:
|
|
31
|
-
locale:
|
|
30
|
+
url: W,
|
|
31
|
+
locale: x,
|
|
32
32
|
appInfo: o.appInfo,
|
|
33
33
|
memberAppInfo: o.memberAppInfo
|
|
34
34
|
})?.type === "web" ? t.loading = !1 : setTimeout(() => {
|
|
35
35
|
t.loading = !1;
|
|
36
36
|
}, 3e3);
|
|
37
|
-
}), s =
|
|
38
|
-
o.url && (
|
|
37
|
+
}), s = d((e) => {
|
|
38
|
+
o.url && (D(e), e?.preventDefault(), u());
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
connect:
|
|
40
|
+
v(g, () => ({
|
|
41
|
+
connect: u
|
|
42
42
|
}));
|
|
43
|
-
const n = p(() => i === "edge" ?
|
|
43
|
+
const n = p(() => i === "edge" ? I.edge : i === "chrome" ? I.chrome : null, [i]), c = p(() => {
|
|
44
44
|
const e = {};
|
|
45
45
|
return l ? e.onClick = s : n ? (e.component = "a", e.href = n, e.target = "_blank", e.rel = "noopener") : e.onClick = s, o.url || (e.sx = {
|
|
46
46
|
cursor: "not-allowed"
|
|
47
47
|
}), e;
|
|
48
|
-
}, [s, o.url]),
|
|
48
|
+
}, [s, o.url]), R = p(() => l || n ? "DID Wallet (Extension)" : "DID Wallet (Web)", [l, n]);
|
|
49
49
|
return /* @__PURE__ */ m(
|
|
50
|
-
|
|
50
|
+
T,
|
|
51
51
|
{
|
|
52
|
-
...
|
|
53
|
-
sx:
|
|
52
|
+
...f,
|
|
53
|
+
sx: E(
|
|
54
54
|
{
|
|
55
55
|
textDecoration: "none"
|
|
56
56
|
},
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
f?.sx,
|
|
58
|
+
c.sx
|
|
59
59
|
),
|
|
60
|
-
title:
|
|
60
|
+
title: R,
|
|
61
61
|
icon: t.loading || !o.url ? /* @__PURE__ */ m(
|
|
62
62
|
C,
|
|
63
63
|
{
|
|
64
64
|
color: "primary",
|
|
65
|
-
size:
|
|
65
|
+
size: a,
|
|
66
66
|
sx: {
|
|
67
67
|
"& svg": {
|
|
68
68
|
transform: "scale(0.75)"
|
|
@@ -70,17 +70,17 @@ function j({
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
) : /* @__PURE__ */ m(
|
|
73
|
-
|
|
73
|
+
A,
|
|
74
74
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
style: {
|
|
75
|
+
sx: {
|
|
76
|
+
width: a,
|
|
77
|
+
height: a,
|
|
79
78
|
transform: "scale(0.9)"
|
|
80
|
-
}
|
|
79
|
+
},
|
|
80
|
+
provider: y.DID_WALLET
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
|
-
...
|
|
83
|
+
...P(c, "sx")
|
|
84
84
|
}
|
|
85
85
|
);
|
|
86
86
|
}
|
package/lib/Connect/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import { jsx as t, jsxs as p, Fragment as Le } from "react/jsx-runtime";
|
|
|
2
2
|
import { use as Be, useRef as re, useState as Fe, useEffect as ne } from "react";
|
|
3
3
|
import e from "prop-types";
|
|
4
4
|
import { Box as i, Skeleton as Ne, Divider as je } from "@mui/material";
|
|
5
|
-
import { useUpdate as He, useSize as Ve, useCreation as d, useMount as ie, useMemoizedFn as
|
|
5
|
+
import { useUpdate as He, useSize as Ve, useCreation as d, useMount as ie, useMemoizedFn as U, useDebounceFn as qe, usePrevious as Ye, useUpdateEffect as Ge } from "ahooks";
|
|
6
6
|
import b from "lodash/noop";
|
|
7
7
|
import Ke from "lodash/isUndefined";
|
|
8
8
|
import Qe from "@arcblock/ux/lib/CloseButton";
|
|
9
|
-
import { LOGIN_PROVIDER as Xe, OAUTH_PROVIDER as
|
|
9
|
+
import { LOGIN_PROVIDER as Xe, OAUTH_PROVIDER as M, DID_CONNECT_MEDIUM_WIDTH as z, LOGIN_PROVIDER_NAME as Je, DID_CONNECT_SMALL_WIDTH as Ze } from "@arcblock/ux/lib/Util/constant";
|
|
10
10
|
import $e from "@arcblock/ux/lib/QRCode";
|
|
11
11
|
import { withUxTheme as et, withContainer as tt, DIDConnectFooter as ot } from "@arcblock/ux/lib/DIDConnect";
|
|
12
12
|
import { useTheme as rt } from "@arcblock/ux/lib/Theme";
|
|
@@ -41,31 +41,31 @@ function se({
|
|
|
41
41
|
checkInterval: I = xt,
|
|
42
42
|
checkTimeout: v = gt * 1e3,
|
|
43
43
|
prefix: D = bt,
|
|
44
|
-
tokenKey:
|
|
45
|
-
locale:
|
|
44
|
+
tokenKey: L = "_t_",
|
|
45
|
+
locale: B = "en",
|
|
46
46
|
encKey: ae = "_ek_",
|
|
47
47
|
autoConnect: le = !0,
|
|
48
|
-
forceConnected:
|
|
48
|
+
forceConnected: F = !0,
|
|
49
49
|
saveConnect: ue = !0,
|
|
50
50
|
useSocket: de = !0,
|
|
51
|
-
allowWallet:
|
|
51
|
+
allowWallet: N = !0,
|
|
52
52
|
provider: fe = "",
|
|
53
53
|
messages: u = {},
|
|
54
|
-
passkeyBehavior:
|
|
54
|
+
passkeyBehavior: j = "none",
|
|
55
55
|
webWalletUrl: me = It(),
|
|
56
|
-
enabledConnectTypes: pe = ["web", "mobile", ...Object.keys(
|
|
57
|
-
extraContent:
|
|
56
|
+
enabledConnectTypes: pe = ["web", "mobile", ...Object.keys(M)],
|
|
57
|
+
extraContent: H = null,
|
|
58
58
|
disableSwitchApp: T = !1,
|
|
59
|
-
magicToken:
|
|
59
|
+
magicToken: V = void 0,
|
|
60
60
|
customItems: he = [],
|
|
61
61
|
onClose: P = b,
|
|
62
|
-
onError:
|
|
62
|
+
onError: q = b,
|
|
63
63
|
onSuccess: _ = b,
|
|
64
|
-
onRecreateSession:
|
|
64
|
+
onRecreateSession: Y = b,
|
|
65
65
|
setColor: xe = b
|
|
66
66
|
}) {
|
|
67
|
-
const R = rt(),
|
|
68
|
-
t:
|
|
67
|
+
const R = rt(), G = He(), be = Be(ct), ge = St(be?.session?.user), {
|
|
68
|
+
t: K,
|
|
69
69
|
staticState: Ce,
|
|
70
70
|
connectState: s,
|
|
71
71
|
extraParams: ye,
|
|
@@ -73,9 +73,9 @@ function se({
|
|
|
73
73
|
currentAppColor: O,
|
|
74
74
|
// 插件相关
|
|
75
75
|
selectedPlugin: c,
|
|
76
|
-
blocklet:
|
|
76
|
+
blocklet: Q,
|
|
77
77
|
masterBlocklet: we
|
|
78
|
-
} = lt(), { state: o, generate:
|
|
78
|
+
} = lt(), { state: o, generate: X, cancelWhenScanned: Se } = ft({
|
|
79
79
|
action: w,
|
|
80
80
|
baseUrl: h,
|
|
81
81
|
checkFn: S,
|
|
@@ -83,23 +83,23 @@ function se({
|
|
|
83
83
|
checkTimeout: v,
|
|
84
84
|
extraParams: ye,
|
|
85
85
|
prefix: D,
|
|
86
|
-
onError:
|
|
86
|
+
onError: q,
|
|
87
87
|
onSuccess: _,
|
|
88
|
-
locale:
|
|
89
|
-
tokenKey:
|
|
88
|
+
locale: B,
|
|
89
|
+
tokenKey: L,
|
|
90
90
|
encKey: ae,
|
|
91
91
|
autoConnect: le,
|
|
92
|
-
forceConnected:
|
|
92
|
+
forceConnected: F === !0 ? ge || !0 : F,
|
|
93
93
|
saveConnect: ue,
|
|
94
94
|
useSocket: de,
|
|
95
95
|
provider: fe
|
|
96
|
-
}), A = re(!1),
|
|
96
|
+
}), A = re(!1), J = re(null), x = Ve(J), Z = d(() => x ? x.width < z - 50 : !0, [x, x?.width]), [$, Ie] = Fe(!1);
|
|
97
97
|
ie(() => {
|
|
98
|
-
Ie(x?.width <
|
|
98
|
+
Ie(x?.width < z - 50);
|
|
99
99
|
});
|
|
100
100
|
const { oauthState: a, setBaseUrl: ve } = mt(), { passkeyState: l, setTargetAppPid: De } = ht();
|
|
101
101
|
ie(() => {
|
|
102
|
-
ve(h), De(
|
|
102
|
+
ve(h), De(Q?.appPid), o.reset(), a.reset(), l.reset();
|
|
103
103
|
}), ne(() => {
|
|
104
104
|
xe(O);
|
|
105
105
|
}, [O]);
|
|
@@ -114,12 +114,12 @@ function se({
|
|
|
114
114
|
a.error,
|
|
115
115
|
l.error,
|
|
116
116
|
c?.state?.error
|
|
117
|
-
]), C = d(() => k.includes(l.status) || k.includes(a.status) || k.includes(o.status) || k.includes(c?.state?.computedStatus), [o.status, a.status, l.status, c?.state?.computedStatus]), ee =
|
|
118
|
-
|
|
119
|
-
}), Pe =
|
|
117
|
+
]), C = d(() => k.includes(l.status) || k.includes(a.status) || k.includes(o.status) || k.includes(c?.state?.computedStatus), [o.status, a.status, l.status, c?.state?.computedStatus]), ee = U(async () => {
|
|
118
|
+
Y(), a.reset(), l.reset(), await X(!1);
|
|
119
|
+
}), Pe = U(() => {
|
|
120
120
|
s?.retryConnect();
|
|
121
|
-
}), _e =
|
|
122
|
-
|
|
121
|
+
}), _e = U(() => {
|
|
122
|
+
Y(), a.reset(), l.reset(), c?.state?.reset(), Ce.current.cancelCount++, Se();
|
|
123
123
|
}), { run: Re } = qe(
|
|
124
124
|
() => {
|
|
125
125
|
A.current || o.status === "timeout" && (A.current = !0, o.reset(), ee(), A.current = !1);
|
|
@@ -130,14 +130,14 @@ function se({
|
|
|
130
130
|
const Oe = d(() => Je[s.chooseMethod] || "DID Wallet", [s.chooseMethod]), { providerList: Ae, hideQRCode: m, hideChooseList: n } = kt({
|
|
131
131
|
action: o.action,
|
|
132
132
|
sourceAppPid: s?.sourceAppPid,
|
|
133
|
-
allowWallet:
|
|
134
|
-
passkeyBehavior:
|
|
133
|
+
allowWallet: N,
|
|
134
|
+
passkeyBehavior: j,
|
|
135
135
|
mode: f,
|
|
136
|
-
blocklet: s?.sourceAppPid ? we :
|
|
137
|
-
isSmallView:
|
|
136
|
+
blocklet: s?.sourceAppPid ? we : Q,
|
|
137
|
+
isSmallView: Z
|
|
138
138
|
}), We = Ye(s?.sourceAppPid);
|
|
139
139
|
Ge(() => {
|
|
140
|
-
Ke(We) ||
|
|
140
|
+
Ke(We) || X();
|
|
141
141
|
}, [s?.sourceAppPid]);
|
|
142
142
|
const r = (y) => {
|
|
143
143
|
const Me = R.spacing(y);
|
|
@@ -173,12 +173,12 @@ function se({
|
|
|
173
173
|
onRetry: Pe,
|
|
174
174
|
onClose: P,
|
|
175
175
|
messages: Te,
|
|
176
|
-
locale:
|
|
176
|
+
locale: B,
|
|
177
177
|
className: "did-connect__auth-status auth-status",
|
|
178
178
|
loadingIcon: s.chooseMethod ? /* @__PURE__ */ t(nt, { provider: s.chooseMethod, sx: { color: "text.primary" } }) : null,
|
|
179
179
|
chooseMethod: Oe,
|
|
180
180
|
hideRetry: s.chooseMethod === "email",
|
|
181
|
-
hideBack: !!
|
|
181
|
+
hideBack: !!V
|
|
182
182
|
}
|
|
183
183
|
) })
|
|
184
184
|
}
|
|
@@ -237,7 +237,7 @@ function se({
|
|
|
237
237
|
)
|
|
238
238
|
}
|
|
239
239
|
);
|
|
240
|
-
}, [oe, n]), ze = d(() => n ? "column-reverse" : !m && $ ? "column" : "row", [n, $, m]),
|
|
240
|
+
}, [oe, n]), ze = d(() => n ? "column-reverse" : !m && $ ? "column" : "row", [n, $, m]), W = /* @__PURE__ */ p(
|
|
241
241
|
i,
|
|
242
242
|
{
|
|
243
243
|
className: "did-connect__body",
|
|
@@ -247,7 +247,7 @@ function se({
|
|
|
247
247
|
justifyContent: "center",
|
|
248
248
|
alignItems: "stretch",
|
|
249
249
|
flex: 1,
|
|
250
|
-
gap: !m &&
|
|
250
|
+
gap: !m && Z ? 0 : 1.5,
|
|
251
251
|
overflow: "visible",
|
|
252
252
|
px: n ? 2 : 0
|
|
253
253
|
},
|
|
@@ -288,11 +288,11 @@ function se({
|
|
|
288
288
|
textAlign: "center"
|
|
289
289
|
},
|
|
290
290
|
children: [
|
|
291
|
-
|
|
291
|
+
K("scanWithWallet1"),
|
|
292
292
|
" ",
|
|
293
293
|
/* @__PURE__ */ t(yt, {}),
|
|
294
294
|
" ",
|
|
295
|
-
|
|
295
|
+
K("scanWithWallet2")
|
|
296
296
|
]
|
|
297
297
|
}
|
|
298
298
|
)
|
|
@@ -333,20 +333,20 @@ function se({
|
|
|
333
333
|
sx: [C ? { display: "none" } : {}]
|
|
334
334
|
}
|
|
335
335
|
},
|
|
336
|
-
allowWallet:
|
|
336
|
+
allowWallet: N,
|
|
337
337
|
size: m && f !== "dialog" ? "normal" : "small",
|
|
338
338
|
tokenState: o,
|
|
339
339
|
messages: u,
|
|
340
|
-
tokenKey:
|
|
340
|
+
tokenKey: L,
|
|
341
341
|
onSuccess: _,
|
|
342
|
-
passkeyBehavior:
|
|
342
|
+
passkeyBehavior: j,
|
|
343
343
|
webWalletUrl: me,
|
|
344
|
-
extraContent:
|
|
344
|
+
extraContent: H,
|
|
345
345
|
enabledConnectTypes: pe,
|
|
346
346
|
onReset: ee,
|
|
347
347
|
disableSwitchApp: T,
|
|
348
|
-
forceUpdate:
|
|
349
|
-
magicToken:
|
|
348
|
+
forceUpdate: G,
|
|
349
|
+
magicToken: V,
|
|
350
350
|
baseUrl: h,
|
|
351
351
|
customItems: he,
|
|
352
352
|
providerList: Ae
|
|
@@ -358,16 +358,16 @@ function se({
|
|
|
358
358
|
]
|
|
359
359
|
}
|
|
360
360
|
);
|
|
361
|
-
let
|
|
362
|
-
return c ?
|
|
363
|
-
fallback:
|
|
364
|
-
forceUpdate:
|
|
361
|
+
let E = W;
|
|
362
|
+
return c ? E = c.renderPlaceholder({
|
|
363
|
+
fallback: W,
|
|
364
|
+
forceUpdate: G,
|
|
365
365
|
onSuccess: _,
|
|
366
|
-
onError:
|
|
367
|
-
}) :
|
|
366
|
+
onError: q
|
|
367
|
+
}) : E = W, /* @__PURE__ */ p(
|
|
368
368
|
i,
|
|
369
369
|
{
|
|
370
|
-
ref:
|
|
370
|
+
ref: J,
|
|
371
371
|
className: "did-connect__root",
|
|
372
372
|
sx: {
|
|
373
373
|
backgroundColor: "background.default",
|
|
@@ -378,13 +378,13 @@ function se({
|
|
|
378
378
|
maxWidth: "100%",
|
|
379
379
|
width: (
|
|
380
380
|
// eslint-disable-next-line no-nested-ternary
|
|
381
|
-
f === "drawer" ? "100%" : m || C ? Ze :
|
|
381
|
+
f === "drawer" ? "100%" : m || C ? Ze : z
|
|
382
382
|
),
|
|
383
383
|
transition: "width 0.2s ease-in-out",
|
|
384
384
|
margin: "auto",
|
|
385
|
-
p:
|
|
385
|
+
p: 3,
|
|
386
386
|
pb: 0,
|
|
387
|
-
gap: 2
|
|
387
|
+
gap: 2.5
|
|
388
388
|
},
|
|
389
389
|
children: [
|
|
390
390
|
/* @__PURE__ */ t(i, { "data-did-auth-url": o.url, sx: { display: "none" } }),
|
|
@@ -393,11 +393,11 @@ function se({
|
|
|
393
393
|
{
|
|
394
394
|
title: u.title,
|
|
395
395
|
description: u.scan,
|
|
396
|
-
extraContent:
|
|
396
|
+
extraContent: H,
|
|
397
397
|
disableSwitchApp: T
|
|
398
398
|
}
|
|
399
399
|
),
|
|
400
|
-
/* @__PURE__ */ t(dt, { initHeight: 72, children:
|
|
400
|
+
/* @__PURE__ */ t(dt, { initHeight: 72, children: E }),
|
|
401
401
|
/* @__PURE__ */ t(ot, { currentAppInfo: ke, currentAppColor: O }),
|
|
402
402
|
Ee
|
|
403
403
|
]
|
|
@@ -423,10 +423,10 @@ se.propTypes = {
|
|
|
423
423
|
useSocket: e.bool,
|
|
424
424
|
extraContent: e.any,
|
|
425
425
|
passkeyBehavior: e.oneOf(["none", "both", "only-existing", "only-new"]),
|
|
426
|
-
enabledConnectTypes: e.arrayOf(e.oneOf(["web", "mobile", ...Object.keys(
|
|
426
|
+
enabledConnectTypes: e.arrayOf(e.oneOf(["web", "mobile", ...Object.keys(M)])),
|
|
427
427
|
webWalletUrl: e.string,
|
|
428
428
|
allowWallet: e.bool,
|
|
429
|
-
provider: e.oneOf([Xe.WALLET, ...Object.keys(
|
|
429
|
+
provider: e.oneOf([Xe.WALLET, ...Object.keys(M), ""]),
|
|
430
430
|
hideCloseButton: e.bool,
|
|
431
431
|
disableSwitchApp: e.bool,
|
|
432
432
|
onClose: e.func,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import c from "prop-types";
|
|
3
3
|
import { useMemoizedFn as l } from "ahooks";
|
|
4
|
-
import p from "@iconify-icons/
|
|
4
|
+
import p from "@iconify-icons/tabler/mail-filled";
|
|
5
5
|
import { LOGIN_PROVIDER as o, LOGIN_PROVIDER_NAME as a } from "@arcblock/ux/lib/Util/constant";
|
|
6
|
-
import { GA_LAST_LOGIN_METHOD as
|
|
7
|
-
import
|
|
8
|
-
import { useStateContext as
|
|
6
|
+
import { GA_LAST_LOGIN_METHOD as I } from "@arcblock/ux/lib/withTracker/constant";
|
|
7
|
+
import f from "../../components/login-item/login-method-item.js";
|
|
8
|
+
import { useStateContext as u } from "../../contexts/state.js";
|
|
9
9
|
function L({ ...e }) {
|
|
10
|
-
const { setSelectedPlugin:
|
|
11
|
-
localStorage.setItem(
|
|
12
|
-
const t =
|
|
13
|
-
t.state.reset(), t.state.status = "creating",
|
|
10
|
+
const { setSelectedPlugin: i, getPlugin: r, connectState: m } = u(), n = l(() => {
|
|
11
|
+
localStorage.setItem(I, "email");
|
|
12
|
+
const t = r(o.EMAIL);
|
|
13
|
+
t.state.reset(), t.state.status = "creating", m.chooseMethod = o.EMAIL, i(t);
|
|
14
14
|
});
|
|
15
15
|
return /* @__PURE__ */ s(
|
|
16
|
-
|
|
16
|
+
f,
|
|
17
17
|
{
|
|
18
18
|
...e,
|
|
19
19
|
title: a[o.EMAIL],
|
|
20
20
|
icon: p,
|
|
21
|
-
onClick:
|
|
21
|
+
onClick: n
|
|
22
22
|
}
|
|
23
23
|
);
|
|
24
24
|
}
|
package/lib/OAuth/context.js
CHANGED
package/lib/package.json.js
CHANGED
package/lib/utils.js
CHANGED
|
@@ -172,8 +172,8 @@ const he = (e, { width: o = 680, height: r = 720, name: n = "did-connect:popup",
|
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
174
|
setTimeout(() => {
|
|
175
|
-
e.popup?.close(), clearTimeout(i), clearInterval(n), window.removeEventListener("message", t, !1)
|
|
176
|
-
}, e.closeTimeout || 0);
|
|
175
|
+
e.popup?.close(), clearTimeout(i), clearInterval(n), window.removeEventListener("message", t, !1);
|
|
176
|
+
}, e.closeTimeout || 0), o(s);
|
|
177
177
|
}
|
|
178
178
|
};
|
|
179
179
|
i = setTimeout(
|
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.3",
|
|
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.3",
|
|
36
36
|
"@arcblock/did": "^1.27.16",
|
|
37
|
-
"@arcblock/icons": "3.3.
|
|
38
|
-
"@arcblock/react-hooks": "3.3.
|
|
37
|
+
"@arcblock/icons": "3.3.3",
|
|
38
|
+
"@arcblock/react-hooks": "3.3.3",
|
|
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": "915561d073369e7a4e78a45349ae286a05b8c253"
|
|
85
85
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
|
-
import { LOGIN_PROVIDER, LOGIN_PROVIDER_NAME } from '@arcblock/ux/lib/Util/constant';
|
|
3
|
+
import { LOGIN_PROVIDER, LOGIN_PROVIDER_ICON_SIZE, LOGIN_PROVIDER_NAME } from '@arcblock/ux/lib/Util/constant';
|
|
4
4
|
import { getWebWalletUrl } from '@arcblock/ux/lib/Util/wallet';
|
|
5
5
|
import noop from 'lodash/noop';
|
|
6
6
|
import { useMemoizedFn } from 'ahooks';
|
|
@@ -229,8 +229,8 @@ export default function ConnectChooseList({
|
|
|
229
229
|
provider={item.provider}
|
|
230
230
|
sx={{
|
|
231
231
|
transform: 'scale(0.95)',
|
|
232
|
-
width:
|
|
233
|
-
height:
|
|
232
|
+
width: LOGIN_PROVIDER_ICON_SIZE,
|
|
233
|
+
height: LOGIN_PROVIDER_ICON_SIZE,
|
|
234
234
|
color: 'text.primary',
|
|
235
235
|
}}
|
|
236
236
|
/>
|
|
@@ -266,9 +266,9 @@ export default function ConnectChooseList({
|
|
|
266
266
|
slotProps={{
|
|
267
267
|
icon: {
|
|
268
268
|
sx: {
|
|
269
|
-
fontSize:
|
|
269
|
+
fontSize: LOGIN_PROVIDER_ICON_SIZE,
|
|
270
270
|
'& svg': {
|
|
271
|
-
fontSize:
|
|
271
|
+
fontSize: LOGIN_PROVIDER_ICON_SIZE,
|
|
272
272
|
width: '1em',
|
|
273
273
|
height: '1em',
|
|
274
274
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import { Box } from '@mui/material';
|
|
3
|
-
import { LOGIN_PROVIDER, LOGIN_PROVIDER_NAME } from '@arcblock/ux/lib/Util/constant';
|
|
3
|
+
import { LOGIN_PROVIDER, LOGIN_PROVIDER_NAME, LOGIN_PROVIDER_ICON_SIZE } from '@arcblock/ux/lib/Util/constant';
|
|
4
4
|
import { checkSameProtocol, getWebWalletUrl } from '@arcblock/ux/lib/Util/wallet';
|
|
5
5
|
import noop from 'lodash/noop';
|
|
6
6
|
import { useMemoizedFn } from 'ahooks';
|
|
@@ -237,9 +237,9 @@ export default function ConnectProviderList({
|
|
|
237
237
|
slotProps={{
|
|
238
238
|
icon: {
|
|
239
239
|
sx: {
|
|
240
|
-
fontSize:
|
|
240
|
+
fontSize: LOGIN_PROVIDER_ICON_SIZE,
|
|
241
241
|
'& svg': {
|
|
242
|
-
fontSize:
|
|
242
|
+
fontSize: LOGIN_PROVIDER_ICON_SIZE,
|
|
243
243
|
width: '1em',
|
|
244
244
|
height: '1em',
|
|
245
245
|
},
|
|
@@ -272,8 +272,8 @@ export default function ConnectProviderList({
|
|
|
272
272
|
provider={item.provider}
|
|
273
273
|
sx={{
|
|
274
274
|
transform: 'scale(0.95)',
|
|
275
|
-
width:
|
|
276
|
-
height:
|
|
275
|
+
width: LOGIN_PROVIDER_ICON_SIZE,
|
|
276
|
+
height: LOGIN_PROVIDER_ICON_SIZE,
|
|
277
277
|
color: 'text.primary',
|
|
278
278
|
}}
|
|
279
279
|
/>
|
|
@@ -284,7 +284,7 @@ export default function ConnectProviderList({
|
|
|
284
284
|
handleLoginOAuth(item);
|
|
285
285
|
};
|
|
286
286
|
}}
|
|
287
|
-
sx={[size === 'small' ? { p: 1 } : { p: 2 }]}
|
|
287
|
+
sx={[size === 'small' ? { p: 1.2 } : { p: 2 }]}
|
|
288
288
|
/>
|
|
289
289
|
);
|
|
290
290
|
}
|
|
@@ -313,10 +313,14 @@ export default function ConnectProviderList({
|
|
|
313
313
|
sx={{
|
|
314
314
|
display: 'grid',
|
|
315
315
|
gridTemplateColumns: 'repeat(12, 1fr)' /* 灵活的12列基础网格 */,
|
|
316
|
-
gap: 1.
|
|
316
|
+
gap: 1.5,
|
|
317
317
|
'.arc-login-item:nth-child(-n+3)': {
|
|
318
318
|
gridColumn: 'span 12',
|
|
319
319
|
},
|
|
320
|
+
// 当登录项大于等于 5 时,第三个登录项增加一个 marginBottom,用于分割独占一行的和一行多个的登录项
|
|
321
|
+
'.arc-login-item:nth-child(3):nth-last-child(n+3)': {
|
|
322
|
+
mb: 1,
|
|
323
|
+
},
|
|
320
324
|
'.arc-login-item:nth-child(4):last-child': {
|
|
321
325
|
gridColumn: 'span 12',
|
|
322
326
|
},
|
|
@@ -3,6 +3,7 @@ import { Icon } from '@iconify/react';
|
|
|
3
3
|
import { isValidElement } from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import { mergeSx } from '@arcblock/ux/lib/Util/style';
|
|
6
|
+
import { LOGIN_PROVIDER_ICON_SIZE } from '@arcblock/ux/lib/Util/constant';
|
|
6
7
|
import ArrowRightAltRoundedIcon from '@iconify-icons/material-symbols/arrow-right-alt-rounded';
|
|
7
8
|
|
|
8
9
|
export default function LoginMethodItem({
|
|
@@ -26,7 +27,7 @@ export default function LoginMethodItem({
|
|
|
26
27
|
alignItems: 'center',
|
|
27
28
|
gap: 1,
|
|
28
29
|
cursor: 'pointer',
|
|
29
|
-
p: 1,
|
|
30
|
+
p: 1.2,
|
|
30
31
|
borderRadius: 1,
|
|
31
32
|
backgroundColor: 'grey.50',
|
|
32
33
|
textDecoration: 'none',
|
|
@@ -69,8 +70,8 @@ export default function LoginMethodItem({
|
|
|
69
70
|
icon={icon}
|
|
70
71
|
sx={{
|
|
71
72
|
transform: `scale(${iconScale})`,
|
|
72
|
-
width:
|
|
73
|
-
height:
|
|
73
|
+
width: LOGIN_PROVIDER_ICON_SIZE,
|
|
74
|
+
height: LOGIN_PROVIDER_ICON_SIZE,
|
|
74
75
|
}}
|
|
75
76
|
/>
|
|
76
77
|
)}
|
|
@@ -7,7 +7,7 @@ import noop from 'lodash/noop';
|
|
|
7
7
|
import { useImperativeHandle } from 'react';
|
|
8
8
|
import { mergeSx } from '@arcblock/ux/lib/Util/style';
|
|
9
9
|
import ProviderIcon from '@arcblock/ux/lib/DIDConnect/provider-icon';
|
|
10
|
-
import { LOGIN_PROVIDER } from '@arcblock/ux/lib/Util/constant';
|
|
10
|
+
import { LOGIN_PROVIDER, LOGIN_PROVIDER_ICON_SIZE } from '@arcblock/ux/lib/Util/constant';
|
|
11
11
|
|
|
12
12
|
import { useStateContext } from '../../contexts/state';
|
|
13
13
|
import LoginMethodItem from './login-method-item';
|
|
@@ -145,7 +145,7 @@ export default function MobileLoginItem({
|
|
|
145
145
|
currentState.loading || !tokenState.url ? (
|
|
146
146
|
<CircularProgress
|
|
147
147
|
color="primary"
|
|
148
|
-
size={
|
|
148
|
+
size={LOGIN_PROVIDER_ICON_SIZE}
|
|
149
149
|
sx={{
|
|
150
150
|
'& svg': {
|
|
151
151
|
transform: 'scale(0.75)',
|
|
@@ -154,10 +154,10 @@ export default function MobileLoginItem({
|
|
|
154
154
|
/>
|
|
155
155
|
) : (
|
|
156
156
|
<ProviderIcon
|
|
157
|
-
width="24px"
|
|
158
|
-
height="24px"
|
|
159
157
|
provider={LOGIN_PROVIDER.DID_WALLET}
|
|
160
|
-
|
|
158
|
+
sx={{
|
|
159
|
+
width: LOGIN_PROVIDER_ICON_SIZE,
|
|
160
|
+
height: LOGIN_PROVIDER_ICON_SIZE,
|
|
161
161
|
transform: 'scale(0.9)',
|
|
162
162
|
}}
|
|
163
163
|
/>
|