@arcblock/did-connect-react 3.2.19 → 3.3.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.
- package/docs/assets/diagram/core-components-session-provider-01.ja.jpg +0 -0
- package/docs/assets/diagram/core-components-session-provider-01.jpg +0 -0
- package/docs/assets/diagram/core-components-session-provider-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/core-components-session-provider-01.zh.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/did-connect-diagram-0.zh.jpg +0 -0
- package/docs/assets/diagram/overview-01.ja.jpg +0 -0
- package/docs/assets/diagram/overview-01.jpg +0 -0
- package/docs/assets/diagram/overview-01.zh-TW.jpg +0 -0
- package/docs/assets/diagram/overview-01.zh.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.ja.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.zh-TW.jpg +0 -0
- package/docs/assets/diagram/use-connect-diagram-0.zh.jpg +0 -0
- package/docs/core-components-did-connect.ja.md +3 -50
- package/docs/core-components-did-connect.md +5 -52
- package/docs/core-components-did-connect.zh-TW.md +3 -50
- package/docs/core-components-did-connect.zh.md +3 -50
- package/docs/core-components-session-provider.ja.md +3 -45
- package/docs/core-components-session-provider.md +3 -45
- package/docs/core-components-session-provider.zh-TW.md +3 -45
- package/docs/core-components-session-provider.zh.md +3 -45
- package/docs/hooks-use-connect.ja.md +3 -39
- package/docs/hooks-use-connect.md +4 -40
- package/docs/hooks-use-connect.zh-TW.md +3 -39
- package/docs/hooks-use-connect.zh.md +3 -39
- package/docs/overview.ja.md +3 -45
- package/docs/overview.md +3 -45
- package/docs/overview.zh-TW.md +3 -45
- package/docs/overview.zh.md +3 -45
- package/lib/Connect/assets/locale.js +4 -2
- package/lib/Connect/components/login-item/connect-choose-list.js +2 -2
- package/lib/Connect/components/login-item/connect-provider-list.js +299 -0
- package/lib/Connect/components/login-item/login-method-item.js +42 -41
- package/lib/Connect/hooks/provider-list.js +50 -0
- package/lib/Connect/index.js +180 -196
- package/lib/OAuth/context.js +33 -32
- package/lib/Session/hooks/use-verify.js +1 -1
- package/lib/Session/libs/locales.js +3 -3
- package/lib/package.json.js +1 -1
- package/package.json +9 -9
- package/src/Connect/assets/locale.js +2 -0
- package/src/Connect/components/login-item/connect-choose-list.jsx +5 -5
- package/src/Connect/components/login-item/connect-provider-list.jsx +392 -0
- package/src/Connect/components/login-item/login-method-item.jsx +31 -28
- package/src/Connect/hooks/provider-list.js +127 -0
- package/src/Connect/index.jsx +8 -27
- package/src/OAuth/context.jsx +10 -2
- package/src/Session/hooks/use-verify.jsx +1 -1
- package/src/Session/libs/locales.js +3 -3
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useTheme as g, Box as r, Typography as
|
|
3
|
-
import { Icon as
|
|
4
|
-
import { isValidElement as
|
|
5
|
-
import
|
|
6
|
-
import { mergeSx as
|
|
7
|
-
import
|
|
8
|
-
function
|
|
9
|
-
title:
|
|
10
|
-
description:
|
|
11
|
-
icon:
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme as g, Box as r, Tooltip as y, Typography as s } from "@mui/material";
|
|
3
|
+
import { Icon as c } from "@iconify/react";
|
|
4
|
+
import { isValidElement as u } from "react";
|
|
5
|
+
import o from "prop-types";
|
|
6
|
+
import { mergeSx as m } from "@arcblock/ux/lib/Util/style";
|
|
7
|
+
import b from "@iconify-icons/material-symbols/arrow-right-alt-rounded";
|
|
8
|
+
function _({
|
|
9
|
+
title: n,
|
|
10
|
+
description: a = null,
|
|
11
|
+
icon: i,
|
|
12
12
|
iconScale: p = 0.95,
|
|
13
13
|
slotProps: d = {},
|
|
14
14
|
mode: f = "normal",
|
|
15
|
-
...
|
|
15
|
+
...l
|
|
16
16
|
}) {
|
|
17
17
|
const h = g();
|
|
18
|
-
return /* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ t(
|
|
19
19
|
r,
|
|
20
20
|
{
|
|
21
|
-
...
|
|
22
|
-
|
|
21
|
+
...l,
|
|
22
|
+
className: "arc-login-item",
|
|
23
|
+
sx: m(
|
|
23
24
|
{
|
|
24
25
|
display: "flex",
|
|
25
26
|
alignItems: "center",
|
|
@@ -46,14 +47,14 @@ function b({
|
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
},
|
|
49
|
-
|
|
50
|
+
l?.sx
|
|
50
51
|
),
|
|
51
52
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
+
/* @__PURE__ */ e(y, { title: n, children: /* @__PURE__ */ e(
|
|
53
54
|
r,
|
|
54
55
|
{
|
|
55
56
|
className: "arc-login-item__icon",
|
|
56
|
-
sx:
|
|
57
|
+
sx: m(
|
|
57
58
|
{
|
|
58
59
|
display: "flex",
|
|
59
60
|
justifyContent: "center",
|
|
@@ -62,11 +63,11 @@ function b({
|
|
|
62
63
|
},
|
|
63
64
|
d?.icon?.sx
|
|
64
65
|
),
|
|
65
|
-
children:
|
|
66
|
+
children: u(i) ? i : /* @__PURE__ */ e(
|
|
66
67
|
r,
|
|
67
68
|
{
|
|
68
|
-
component:
|
|
69
|
-
icon:
|
|
69
|
+
component: c,
|
|
70
|
+
icon: i,
|
|
70
71
|
sx: {
|
|
71
72
|
transform: `scale(${p})`,
|
|
72
73
|
width: 24,
|
|
@@ -75,11 +76,11 @@ function b({
|
|
|
75
76
|
}
|
|
76
77
|
)
|
|
77
78
|
}
|
|
78
|
-
),
|
|
79
|
-
f === "normal" ? /* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
79
|
+
) }),
|
|
80
|
+
f === "normal" ? /* @__PURE__ */ t(x, { children: [
|
|
81
|
+
/* @__PURE__ */ t(r, { className: "arc-login-item__body", sx: { display: "flex", flexDirection: "column", flex: 1 }, children: [
|
|
82
|
+
/* @__PURE__ */ e(
|
|
83
|
+
s,
|
|
83
84
|
{
|
|
84
85
|
sx: {
|
|
85
86
|
fontSize: 14,
|
|
@@ -87,26 +88,26 @@ function b({
|
|
|
87
88
|
color: "text.primary",
|
|
88
89
|
whiteSpace: "nowrap"
|
|
89
90
|
},
|
|
90
|
-
children:
|
|
91
|
+
children: n
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
|
-
|
|
94
|
-
|
|
94
|
+
a ? /* @__PURE__ */ e(
|
|
95
|
+
s,
|
|
95
96
|
{
|
|
96
97
|
sx: {
|
|
97
98
|
color: "text.secondary",
|
|
98
99
|
fontSize: 12,
|
|
99
100
|
lineHeight: 1
|
|
100
101
|
},
|
|
101
|
-
children:
|
|
102
|
+
children: a
|
|
102
103
|
}
|
|
103
104
|
) : null
|
|
104
105
|
] }),
|
|
105
|
-
/* @__PURE__ */
|
|
106
|
-
|
|
106
|
+
/* @__PURE__ */ e(
|
|
107
|
+
c,
|
|
107
108
|
{
|
|
108
109
|
className: "other-item-icon",
|
|
109
|
-
icon:
|
|
110
|
+
icon: b,
|
|
110
111
|
fontSize: "1.3rem",
|
|
111
112
|
color: h.palette.primary.main
|
|
112
113
|
}
|
|
@@ -116,14 +117,14 @@ function b({
|
|
|
116
117
|
}
|
|
117
118
|
);
|
|
118
119
|
}
|
|
119
|
-
|
|
120
|
-
title:
|
|
121
|
-
description:
|
|
122
|
-
icon:
|
|
123
|
-
iconScale:
|
|
124
|
-
slotProps:
|
|
125
|
-
mode:
|
|
120
|
+
_.propTypes = {
|
|
121
|
+
title: o.string.isRequired,
|
|
122
|
+
description: o.string,
|
|
123
|
+
icon: o.any.isRequired,
|
|
124
|
+
iconScale: o.number,
|
|
125
|
+
slotProps: o.object,
|
|
126
|
+
mode: o.oneOf(["mini", "simple", "normal"])
|
|
126
127
|
};
|
|
127
128
|
export {
|
|
128
|
-
|
|
129
|
+
_ as default
|
|
129
130
|
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useBrowser as m } from "@arcblock/react-hooks";
|
|
2
|
+
import { useRequest as v, useCreation as u } from "ahooks";
|
|
3
|
+
import c from "lodash/isNil";
|
|
4
|
+
import { LOGIN_PROVIDER as o } from "@arcblock/ux/lib/Util/constant";
|
|
5
|
+
import { getFederatedEnabled as w, getMaster as P, getBlockletData as E } from "@arcblock/ux/lib/Util/federated";
|
|
6
|
+
const k = async ({ sourceAppPid: n }) => {
|
|
7
|
+
const t = globalThis?.blocklet;
|
|
8
|
+
if (!t)
|
|
9
|
+
return {
|
|
10
|
+
[o.WALLET]: {
|
|
11
|
+
order: 0,
|
|
12
|
+
enabled: !0,
|
|
13
|
+
showQrcode: !0
|
|
14
|
+
},
|
|
15
|
+
[o.PASSKEY]: {
|
|
16
|
+
order: 1,
|
|
17
|
+
enabled: !0
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const s = w(t), e = P(t);
|
|
21
|
+
return s && e?.appPid && n === e?.appPid ? (await E(e.appUrl))?.settings?.authentication || {} : t?.settings?.authentication || {};
|
|
22
|
+
}, y = async ({ sourceAppPid: n } = {}) => {
|
|
23
|
+
const t = await k({ sourceAppPid: n });
|
|
24
|
+
return Object.entries(t).map(([e, r]) => ({ ...r, provider: e })).filter((e) => e.enabled).sort((e, r) => !c(e?.order) && !c(r?.order) ? e.order - r.order : c(e?.order) ? 1 : -1);
|
|
25
|
+
};
|
|
26
|
+
function I({
|
|
27
|
+
allowWallet: n = !0,
|
|
28
|
+
passkeyBehavior: t = "none",
|
|
29
|
+
action: s,
|
|
30
|
+
sourceAppPid: e,
|
|
31
|
+
mode: r = "dialog",
|
|
32
|
+
blocklet: L = globalThis.blocklet,
|
|
33
|
+
isSmallView: f = !1
|
|
34
|
+
}) {
|
|
35
|
+
const h = ["login", "invite", "connect-to-did-space", "connect-to-did-domain", "destroy-self"], l = m(), { data: g = [] } = v(
|
|
36
|
+
async () => await y({ sourceAppPid: e }),
|
|
37
|
+
{ refreshDeps: [e] }
|
|
38
|
+
), d = u(() => g.filter((i) => i.name === o.WALLET ? n : i.name === o.PASSKEY ? t !== "none" && !l.wallet && !l.arcSphere : i.name === o.EMAIL ? L?.settings?.notification?.email?.enabled ?? !1 : !(i.type === "oauth" && !h.includes(s))), [g]), p = u(() => {
|
|
39
|
+
const a = r === "drawer" || f && l.mobile.any;
|
|
40
|
+
return globalThis?.blocklet ? !!(d.find((b) => b.provider === o.WALLET)?.showQrcode !== !0 || a) : !!a;
|
|
41
|
+
}, [r, f, d]);
|
|
42
|
+
return {
|
|
43
|
+
hideChooseList: u(() => !1),
|
|
44
|
+
hideQRCode: p,
|
|
45
|
+
providerList: d
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
I as default
|
|
50
|
+
};
|