@arcblock/did-connect-react 3.4.14 → 3.5.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/dist/standalone/did-connect-react.css +1 -0
- package/dist/standalone/index.js +133700 -0
- package/lib/Connect/components/login-item/connect-choose-list.js +111 -111
- package/lib/Connect/components/login-item/connect-provider-list.js +180 -180
- package/lib/Connect/components/login-item/mobile-login-item.js +56 -56
- package/lib/Connect/components/login-item/passkey-login-item.js +27 -29
- package/lib/Connect/components/login-item/web-login-item.js +31 -29
- package/lib/Connect/connect.js +202 -197
- package/lib/Connect/contexts/state.js +19 -17
- package/lib/Connect/hooks/provider-list.js +33 -33
- package/lib/Connect/plugins/email/list-item.js +14 -14
- package/lib/Connect/plugins/email/placeholder.js +77 -76
- package/lib/package.json.js +1 -1
- package/package.json +14 -9
- package/.aigne/doc-smith/config.yaml +0 -85
- package/.aigne/doc-smith/history.yaml +0 -6
- package/.aigne/doc-smith/output/structure-plan.json +0 -204
- package/.aigne/doc-smith/translation-cache.yaml +0 -11
- package/.aigne/doc-smith/upload-cache.yaml +0 -213
- package/docs/_sidebar.md +0 -18
- package/docs/advanced-authentication-methods.ja.md +0 -261
- package/docs/advanced-authentication-methods.md +0 -261
- package/docs/advanced-authentication-methods.zh-TW.md +0 -261
- package/docs/advanced-authentication-methods.zh.md +0 -261
- package/docs/advanced-utilities.ja.md +0 -132
- package/docs/advanced-utilities.md +0 -132
- package/docs/advanced-utilities.zh-TW.md +0 -132
- package/docs/advanced-utilities.zh.md +0 -132
- package/docs/advanced.ja.md +0 -95
- package/docs/advanced.md +0 -95
- package/docs/advanced.zh-TW.md +0 -95
- package/docs/advanced.zh.md +0 -95
- package/docs/api-reference.ja.md +0 -178
- package/docs/api-reference.md +0 -178
- package/docs/api-reference.zh-TW.md +0 -178
- package/docs/api-reference.zh.md +0 -178
- 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 +0 -166
- package/docs/core-components-did-connect.md +0 -166
- package/docs/core-components-did-connect.zh-TW.md +0 -166
- package/docs/core-components-did-connect.zh.md +0 -166
- package/docs/core-components-session-provider.ja.md +0 -197
- package/docs/core-components-session-provider.md +0 -197
- package/docs/core-components-session-provider.zh-TW.md +0 -197
- package/docs/core-components-session-provider.zh.md +0 -197
- package/docs/core-components.ja.md +0 -16
- package/docs/core-components.md +0 -16
- package/docs/core-components.zh-TW.md +0 -16
- package/docs/core-components.zh.md +0 -16
- package/docs/getting-started.ja.md +0 -138
- package/docs/getting-started.md +0 -138
- package/docs/getting-started.zh-TW.md +0 -138
- package/docs/getting-started.zh.md +0 -138
- package/docs/hooks-use-connect.ja.md +0 -178
- package/docs/hooks-use-connect.md +0 -178
- package/docs/hooks-use-connect.zh-TW.md +0 -178
- package/docs/hooks-use-connect.zh.md +0 -178
- package/docs/hooks-use-did.ja.md +0 -107
- package/docs/hooks-use-did.md +0 -107
- package/docs/hooks-use-did.zh-TW.md +0 -107
- package/docs/hooks-use-did.zh.md +0 -107
- package/docs/hooks-use-oauth-passkey.ja.md +0 -188
- package/docs/hooks-use-oauth-passkey.md +0 -188
- package/docs/hooks-use-oauth-passkey.zh-TW.md +0 -188
- package/docs/hooks-use-oauth-passkey.zh.md +0 -188
- package/docs/hooks.ja.md +0 -23
- package/docs/hooks.md +0 -23
- package/docs/hooks.zh-TW.md +0 -23
- package/docs/hooks.zh.md +0 -23
- package/docs/overview.ja.md +0 -119
- package/docs/overview.md +0 -119
- package/docs/overview.zh-TW.md +0 -119
- package/docs/overview.zh.md +0 -119
- package/docs/ui-components-address.ja.md +0 -121
- package/docs/ui-components-address.md +0 -121
- package/docs/ui-components-address.zh-TW.md +0 -121
- package/docs/ui-components-address.zh.md +0 -121
- package/docs/ui-components-avatar.ja.md +0 -65
- package/docs/ui-components-avatar.md +0 -65
- package/docs/ui-components-avatar.zh-TW.md +0 -65
- package/docs/ui-components-avatar.zh.md +0 -65
- package/docs/ui-components-button.ja.md +0 -99
- package/docs/ui-components-button.md +0 -99
- package/docs/ui-components-button.zh-TW.md +0 -99
- package/docs/ui-components-button.zh.md +0 -99
- package/docs/ui-components-logo.ja.md +0 -52
- package/docs/ui-components-logo.md +0 -52
- package/docs/ui-components-logo.zh-TW.md +0 -52
- package/docs/ui-components-logo.zh.md +0 -52
- package/docs/ui-components.ja.md +0 -57
- package/docs/ui-components.md +0 -57
- package/docs/ui-components.zh-TW.md +0 -57
- package/docs/ui-components.zh.md +0 -57
- package/glossary.md +0 -1
- package/src/Address/index.jsx +0 -2
- package/src/Avatar/index.jsx +0 -2
- package/src/Button/Button.stories.jsx +0 -7
- package/src/Button/index.jsx +0 -21
- package/src/Connect/Connect.stories.jsx +0 -34
- package/src/Connect/assets/locale.js +0 -149
- package/src/Connect/assets/login-bg.png +0 -0
- package/src/Connect/assets/login-slogan.js +0 -7
- package/src/Connect/components/action-button.jsx +0 -22
- package/src/Connect/components/app-tips.jsx +0 -156
- package/src/Connect/components/auto-height.jsx +0 -38
- package/src/Connect/components/back-button.jsx +0 -24
- package/src/Connect/components/connect-status.jsx +0 -259
- package/src/Connect/components/did-connect-title.jsx +0 -107
- package/src/Connect/components/download-tips.jsx +0 -55
- package/src/Connect/components/loading.jsx +0 -25
- package/src/Connect/components/login-item/connect-choose-list.jsx +0 -317
- package/src/Connect/components/login-item/connect-provider-list.jsx +0 -462
- package/src/Connect/components/login-item/login-method-item.jsx +0 -139
- package/src/Connect/components/login-item/mobile-login-item.jsx +0 -181
- package/src/Connect/components/login-item/passkey-login-item.jsx +0 -54
- package/src/Connect/components/login-item/wallet-login-options.jsx +0 -129
- package/src/Connect/components/login-item/web-login-item.jsx +0 -157
- package/src/Connect/components/mask-overlay.jsx +0 -32
- package/src/Connect/components/refresh-overlay.jsx +0 -52
- package/src/Connect/components/switch-app.jsx +0 -69
- package/src/Connect/connect.jsx +0 -617
- package/src/Connect/contexts/state.jsx +0 -234
- package/src/Connect/fallback-connect.jsx +0 -47
- package/src/Connect/fullpage.jsx +0 -3
- package/src/Connect/hooks/auth-url.js +0 -31
- package/src/Connect/hooks/method-list.js +0 -121
- package/src/Connect/hooks/page-show.js +0 -24
- package/src/Connect/hooks/provider-list.js +0 -165
- package/src/Connect/hooks/security.js +0 -40
- package/src/Connect/hooks/token.js +0 -627
- package/src/Connect/hooks/use-apps.js +0 -69
- package/src/Connect/hooks/use-quick-connect.js +0 -119
- package/src/Connect/index.jsx +0 -21
- package/src/Connect/landing-page.jsx +0 -3
- package/src/Connect/plugins/email/index.jsx +0 -85
- package/src/Connect/plugins/email/list-item.jsx +0 -34
- package/src/Connect/plugins/email/placeholder.jsx +0 -365
- package/src/Connect/plugins/index.js +0 -2
- package/src/Connect/use-connect.jsx +0 -321
- package/src/Connect/with-blocklet.jsx +0 -26
- package/src/Connect/with-bridge-call.jsx +0 -138
- package/src/Federated/context.jsx +0 -93
- package/src/Federated/index.jsx +0 -1
- package/src/Logo/index.jsx +0 -2
- package/src/OAuth/bind-conflict-alert.jsx +0 -37
- package/src/OAuth/context.jsx +0 -407
- package/src/OAuth/guest.svg +0 -20
- package/src/OAuth/index.jsx +0 -1
- package/src/OAuth/passport-switcher.jsx +0 -2
- package/src/Passkey/actions.jsx +0 -217
- package/src/Passkey/constants.js +0 -2
- package/src/Passkey/context.jsx +0 -395
- package/src/Passkey/dialog.jsx +0 -401
- package/src/Passkey/icon.jsx +0 -10
- package/src/Passkey/index.jsx +0 -2
- package/src/Service/index.jsx +0 -96
- package/src/Session/assets/did-spaces-guide-cover.svg +0 -1
- package/src/Session/assets/did-spaces-guide-icon.svg +0 -7
- package/src/Session/context.jsx +0 -7
- package/src/Session/did-spaces-guide.jsx +0 -173
- package/src/Session/handler.jsx +0 -98
- package/src/Session/hooks/use-federated.js +0 -91
- package/src/Session/hooks/use-mobile.jsx +0 -6
- package/src/Session/hooks/use-protected-routes.js +0 -16
- package/src/Session/hooks/use-session-token.js +0 -400
- package/src/Session/hooks/use-verify.jsx +0 -76
- package/src/Session/index.jsx +0 -1789
- package/src/Session/libs/constants.js +0 -17
- package/src/Session/libs/did-spaces.js +0 -38
- package/src/Session/libs/federated.js +0 -82
- package/src/Session/libs/index.js +0 -5
- package/src/Session/libs/locales.js +0 -160
- package/src/Session/libs/login-mobile.js +0 -80
- package/src/Session/window-focus-aware.jsx +0 -28
- package/src/SessionManager/index.jsx +0 -2
- package/src/Storage/engine/cookie.js +0 -25
- package/src/Storage/engine/local-storage.js +0 -57
- package/src/Storage/index.js +0 -25
- package/src/User/index.js +0 -4
- package/src/User/use-did.js +0 -80
- package/src/User/wrap-did.jsx +0 -18
- package/src/WebWalletSWKeeper/index.jsx +0 -3
- package/src/components/PassportSwitcher.jsx +0 -160
- package/src/constant.js +0 -27
- package/src/error.js +0 -6
- package/src/hooks/use-locale.jsx +0 -6
- package/src/index.js +0 -32
- package/src/locales/en.jsx +0 -15
- package/src/locales/index.jsx +0 -13
- package/src/locales/zh.jsx +0 -15
- package/src/types.d.ts +0 -355
- package/src/utils.js +0 -413
- package/vite.config.mjs +0 -29
|
@@ -1,46 +1,44 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import e from "prop-types";
|
|
3
|
-
import { useRef as
|
|
3
|
+
import { useRef as d, useImperativeHandle as S } from "react";
|
|
4
4
|
import { useMemoizedFn as y } from "ahooks";
|
|
5
|
-
import { LOGIN_PROVIDER as
|
|
6
|
-
import
|
|
7
|
-
import { getAppId as
|
|
8
|
-
import { useStateContext as
|
|
9
|
-
function
|
|
10
|
-
const { extraParams:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
23
|
-
return d(p, () => ({
|
|
5
|
+
import { LAST_USED_LOGIN_METHOD as A, LOGIN_PROVIDER as p } from "@arcblock/ux/lib/Util/constant";
|
|
6
|
+
import I from "../../../Passkey/actions.js";
|
|
7
|
+
import { getAppId as P } from "../../../utils.js";
|
|
8
|
+
import { useStateContext as L } from "../../contexts/state.js";
|
|
9
|
+
function R({ ref: i = null, onSuccess: c, tokenState: o, behavior: n = "none", ...m }) {
|
|
10
|
+
const { extraParams: t, lastLoginMethod: r } = L(), s = d(null), a = y((u) => (localStorage.setItem(A, p.PASSKEY), c(
|
|
11
|
+
{
|
|
12
|
+
...u,
|
|
13
|
+
encrypted: !1
|
|
14
|
+
},
|
|
15
|
+
(f) => f,
|
|
16
|
+
{
|
|
17
|
+
sourceAppPid: t?.sourceAppPid,
|
|
18
|
+
connected_app: P(o.appInfo, o.memberAppInfo)
|
|
19
|
+
}
|
|
20
|
+
)));
|
|
21
|
+
return S(i, () => ({
|
|
24
22
|
connect: s.current.click
|
|
25
|
-
})), n === "none" ? null : /* @__PURE__ */
|
|
26
|
-
|
|
23
|
+
})), n === "none" ? null : /* @__PURE__ */ l(
|
|
24
|
+
I,
|
|
27
25
|
{
|
|
28
|
-
...
|
|
26
|
+
...m,
|
|
29
27
|
ref: s,
|
|
30
|
-
isLatest:
|
|
28
|
+
isLatest: r && r === p.PASSKEY,
|
|
31
29
|
action: o.action,
|
|
32
30
|
behavior: n,
|
|
33
|
-
onSuccess:
|
|
34
|
-
extraParams:
|
|
31
|
+
onSuccess: a,
|
|
32
|
+
extraParams: t
|
|
35
33
|
}
|
|
36
34
|
);
|
|
37
35
|
}
|
|
38
|
-
|
|
36
|
+
R.propTypes = {
|
|
39
37
|
onSuccess: e.func.isRequired,
|
|
40
38
|
tokenState: e.object.isRequired,
|
|
41
39
|
behavior: e.oneOf(["none", "both", "only-existing", "only-new"]),
|
|
42
40
|
ref: e.any
|
|
43
41
|
};
|
|
44
42
|
export {
|
|
45
|
-
|
|
43
|
+
R as default
|
|
46
44
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as p } from "react/jsx-runtime";
|
|
2
2
|
import o from "prop-types";
|
|
3
|
-
import { CircularProgress as
|
|
4
|
-
import { useReactive as
|
|
5
|
-
import { detectWalletExtension as
|
|
6
|
-
import { mergeSx as
|
|
3
|
+
import { CircularProgress as O } from "@mui/material";
|
|
4
|
+
import { useReactive as R, useMemoizedFn as I, useCreation as a } from "ahooks";
|
|
5
|
+
import { detectWalletExtension as w, openWebWallet as A } from "@arcblock/ux/lib/Util";
|
|
6
|
+
import { mergeSx as C } from "@arcblock/ux/lib/Util/style";
|
|
7
7
|
import P from "lodash/noop";
|
|
8
|
-
import
|
|
9
|
-
import { useImperativeHandle as
|
|
8
|
+
import T from "lodash/omit";
|
|
9
|
+
import { useImperativeHandle as v } from "react";
|
|
10
10
|
import y from "@arcblock/ux/lib/DIDConnect/provider-icon";
|
|
11
|
-
import { LOGIN_PROVIDER_ICON_SIZE as
|
|
12
|
-
import
|
|
13
|
-
import { useStateContext as
|
|
11
|
+
import { WALLET_LOGIN_METHOD as N, LOGIN_PROVIDER_ICON_SIZE as f, LOGIN_PROVIDER as M } from "@arcblock/ux/lib/Util/constant";
|
|
12
|
+
import U from "./login-method-item.js";
|
|
13
|
+
import { useStateContext as G } from "../../contexts/state.js";
|
|
14
14
|
import { EXT_DOWNLOAD_URL as g } from "../../../constant.js";
|
|
15
15
|
import j from "../../hooks/auth-url.js";
|
|
16
16
|
function q({
|
|
@@ -18,54 +18,56 @@ function q({
|
|
|
18
18
|
tokenState: r,
|
|
19
19
|
locale: D = "en",
|
|
20
20
|
webWalletUrl: b,
|
|
21
|
-
onClick:
|
|
22
|
-
disableSwitchApp:
|
|
21
|
+
onClick: W = P,
|
|
22
|
+
disableSwitchApp: h = !1,
|
|
23
23
|
autoConnect: t = !0,
|
|
24
24
|
...u
|
|
25
25
|
}) {
|
|
26
|
-
const { browserBrand: l } =
|
|
26
|
+
const { browserBrand: l, connectState: L } = G(), s = w(), n = R({
|
|
27
27
|
loading: !1
|
|
28
|
-
}),
|
|
28
|
+
}), E = j({ disableSwitchApp: h, tokenState: r }), c = I(() => {
|
|
29
29
|
if (!t)
|
|
30
30
|
return;
|
|
31
|
-
n.loading = !0
|
|
31
|
+
n.loading = !0;
|
|
32
|
+
const e = A({
|
|
32
33
|
webWalletUrl: b,
|
|
33
|
-
url:
|
|
34
|
+
url: E,
|
|
34
35
|
locale: D,
|
|
35
36
|
appInfo: r.appInfo,
|
|
36
37
|
memberAppInfo: r.memberAppInfo
|
|
37
|
-
})
|
|
38
|
+
});
|
|
39
|
+
L.walletMethod = N.WEB, e?.type === "web" ? n.loading = !1 : setTimeout(() => {
|
|
38
40
|
n.loading = !1;
|
|
39
41
|
}, 3e3);
|
|
40
42
|
}), m = I((e) => {
|
|
41
|
-
r.url && (
|
|
43
|
+
r.url && (W(e), e?.preventDefault(), c());
|
|
42
44
|
});
|
|
43
|
-
|
|
45
|
+
v(x, () => ({
|
|
44
46
|
connect: c
|
|
45
47
|
}));
|
|
46
|
-
const i =
|
|
48
|
+
const i = a(() => l === "edge" ? g.edge : l === "chrome" ? g.chrome : null, [l]), d = a(() => {
|
|
47
49
|
const e = {};
|
|
48
50
|
return s || !t ? e.onClick = m : i && t ? (e.component = "a", e.href = i, e.target = "_blank", e.rel = "noopener") : e.onClick = m, r.url || (e.sx = {
|
|
49
51
|
cursor: "not-allowed"
|
|
50
52
|
}), e;
|
|
51
|
-
}, [m, r.url]),
|
|
53
|
+
}, [m, r.url]), _ = a(() => t ? s || i ? "DID Wallet (Extension)" : "DID Wallet (Web)" : "DID Wallet", [s, i]);
|
|
52
54
|
return /* @__PURE__ */ p(
|
|
53
|
-
|
|
55
|
+
U,
|
|
54
56
|
{
|
|
55
57
|
...u,
|
|
56
|
-
sx:
|
|
58
|
+
sx: C(
|
|
57
59
|
{
|
|
58
60
|
textDecoration: "none"
|
|
59
61
|
},
|
|
60
62
|
u?.sx,
|
|
61
63
|
d.sx
|
|
62
64
|
),
|
|
63
|
-
title:
|
|
65
|
+
title: _,
|
|
64
66
|
icon: n.loading || !r.url ? /* @__PURE__ */ p(
|
|
65
|
-
|
|
67
|
+
O,
|
|
66
68
|
{
|
|
67
69
|
color: "primary",
|
|
68
|
-
size:
|
|
70
|
+
size: f,
|
|
69
71
|
sx: {
|
|
70
72
|
"& svg": {
|
|
71
73
|
transform: "scale(0.75)"
|
|
@@ -76,14 +78,14 @@ function q({
|
|
|
76
78
|
y,
|
|
77
79
|
{
|
|
78
80
|
sx: {
|
|
79
|
-
width:
|
|
80
|
-
height:
|
|
81
|
+
width: f,
|
|
82
|
+
height: f,
|
|
81
83
|
transform: "scale(0.9)"
|
|
82
84
|
},
|
|
83
|
-
provider:
|
|
85
|
+
provider: M.DID_WALLET
|
|
84
86
|
}
|
|
85
87
|
),
|
|
86
|
-
...
|
|
88
|
+
...T(d, "sx")
|
|
87
89
|
}
|
|
88
90
|
);
|
|
89
91
|
}
|