@arcblock/did-connect-react 3.2.18 → 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.
Files changed (52) hide show
  1. package/docs/assets/diagram/core-components-session-provider-01.ja.jpg +0 -0
  2. package/docs/assets/diagram/core-components-session-provider-01.jpg +0 -0
  3. package/docs/assets/diagram/core-components-session-provider-01.zh-TW.jpg +0 -0
  4. package/docs/assets/diagram/core-components-session-provider-01.zh.jpg +0 -0
  5. package/docs/assets/diagram/did-connect-diagram-0.ja.jpg +0 -0
  6. package/docs/assets/diagram/did-connect-diagram-0.jpg +0 -0
  7. package/docs/assets/diagram/did-connect-diagram-0.zh-TW.jpg +0 -0
  8. package/docs/assets/diagram/did-connect-diagram-0.zh.jpg +0 -0
  9. package/docs/assets/diagram/overview-01.ja.jpg +0 -0
  10. package/docs/assets/diagram/overview-01.jpg +0 -0
  11. package/docs/assets/diagram/overview-01.zh-TW.jpg +0 -0
  12. package/docs/assets/diagram/overview-01.zh.jpg +0 -0
  13. package/docs/assets/diagram/use-connect-diagram-0.ja.jpg +0 -0
  14. package/docs/assets/diagram/use-connect-diagram-0.jpg +0 -0
  15. package/docs/assets/diagram/use-connect-diagram-0.zh-TW.jpg +0 -0
  16. package/docs/assets/diagram/use-connect-diagram-0.zh.jpg +0 -0
  17. package/docs/core-components-did-connect.ja.md +3 -50
  18. package/docs/core-components-did-connect.md +5 -52
  19. package/docs/core-components-did-connect.zh-TW.md +3 -50
  20. package/docs/core-components-did-connect.zh.md +3 -50
  21. package/docs/core-components-session-provider.ja.md +3 -45
  22. package/docs/core-components-session-provider.md +3 -45
  23. package/docs/core-components-session-provider.zh-TW.md +3 -45
  24. package/docs/core-components-session-provider.zh.md +3 -45
  25. package/docs/hooks-use-connect.ja.md +3 -39
  26. package/docs/hooks-use-connect.md +4 -40
  27. package/docs/hooks-use-connect.zh-TW.md +3 -39
  28. package/docs/hooks-use-connect.zh.md +3 -39
  29. package/docs/overview.ja.md +3 -45
  30. package/docs/overview.md +3 -45
  31. package/docs/overview.zh-TW.md +3 -45
  32. package/docs/overview.zh.md +3 -45
  33. package/lib/Connect/assets/locale.js +4 -2
  34. package/lib/Connect/components/login-item/connect-choose-list.js +2 -2
  35. package/lib/Connect/components/login-item/connect-provider-list.js +299 -0
  36. package/lib/Connect/components/login-item/login-method-item.js +42 -41
  37. package/lib/Connect/hooks/provider-list.js +50 -0
  38. package/lib/Connect/index.js +180 -196
  39. package/lib/OAuth/context.js +33 -32
  40. package/lib/Session/hooks/use-verify.js +1 -1
  41. package/lib/Session/libs/locales.js +3 -3
  42. package/lib/package.json.js +1 -1
  43. package/package.json +9 -9
  44. package/src/Connect/assets/locale.js +2 -0
  45. package/src/Connect/components/login-item/connect-choose-list.jsx +5 -5
  46. package/src/Connect/components/login-item/connect-provider-list.jsx +392 -0
  47. package/src/Connect/components/login-item/login-method-item.jsx +31 -28
  48. package/src/Connect/hooks/provider-list.js +127 -0
  49. package/src/Connect/index.jsx +8 -27
  50. package/src/OAuth/context.jsx +10 -2
  51. package/src/Session/hooks/use-verify.jsx +1 -1
  52. package/src/Session/libs/locales.js +3 -3
@@ -11,45 +11,9 @@
11
11
  1. **`connectHolder`**:一个必须在组件树中渲染的 React 元素。此元素负责在 `DidConnect` 模态框被激活时进行渲染。在 `open` 函数被调用之前,它保持不可见。
12
12
  2. **`connectApi`**:一个包含用于控制模态框生命周期的函数(`open`、`close`、`openPopup`、`loginOAuth`)的对象。
13
13
 
14
- ```d2
15
- direction: down
16
-
17
- User: {
18
- shape: c4-person
19
- }
20
-
21
- Your-App: {
22
- label: "你的应用程序"
23
- shape: rectangle
24
-
25
- Custom-Button: {
26
- label: "自定义按钮"
27
- }
28
-
29
- useConnect-Hook: {
30
- label: "useConnect()"
31
- }
32
-
33
- connectHolder: {
34
- label: "connectHolder"
35
- }
36
- }
37
-
38
- DID-Wallet: {
39
- label: "DID Wallet"
40
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
41
- }
42
-
43
- User -> Your-App.Custom-Button: "1. 点击"
44
- Your-App.Custom-Button -> Your-App.useConnect-Hook: "2. 调用 connectApi.open()"
45
- Your-App.useConnect-Hook -> Your-App.connectHolder: "3. 激活模态框"
46
- Your-App.connectHolder -> User: "4. 显示 DidConnect UI"
47
- User -> DID-Wallet: "5. 扫描二维码并批准"
48
- DID-Wallet -> Your-App.connectHolder: "6. 发送响应"
49
- Your-App.connectHolder -> Your-App.useConnect-Hook: "7. 触发 onSuccess 回调"
50
- Your-App.useConnect-Hook -> Your-App.connectHolder: "8. 停用模态框"
51
-
52
- ```
14
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
15
+ ![useConnect](assets/diagram/use-connect-diagram-0.zh.jpg)
16
+ <!-- DIAGRAM_IMAGE_END -->
53
17
 
54
18
  ## 设置
55
19
 
@@ -27,51 +27,9 @@
27
27
 
28
28
  `@arcblock/did-connect-react`はクライアントサイドのライブラリであり、認証ロジックを処理するために対応するバックエンドサービスが必要であることに注意することが重要です。このサービスは、Node.js用の[`@arcblock/did-connect-js`](https://www.arcblock.io/docs/did-connect-sdk)ライブラリを使用して構築する必要があります。
29
29
 
30
- ```d2 基本的な認証フロー
31
- direction: down
32
-
33
- User: {
34
- shape: c4-person
35
- }
36
-
37
- Your-Application: {
38
- label: "あなたのReactアプリケーション"
39
- shape: rectangle
40
-
41
- SessionProvider: {
42
- label: "SessionProvider\n(セッション状態を管理)"
43
- shape: rectangle
44
-
45
- App-Components: {
46
- label: "あなたのアプリコンポーネント"
47
- shape: rectangle
48
-
49
- ConnectButton: {
50
- label: "ConnectButton"
51
- shape: rectangle
52
- }
53
- }
54
-
55
- DidConnect-Modal: {
56
- label: "DidConnectモーダル\n(QRコードフローを処理)"
57
- shape: rectangle
58
- }
59
- }
60
- }
61
-
62
- DID-Wallet: {
63
- label: "DID Wallet"
64
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
65
- }
66
-
67
- User -> Your-Application.SessionProvider.App-Components.ConnectButton: "1. ボタンをクリック"
68
- Your-Application.SessionProvider.App-Components.ConnectButton -> Your-Application.SessionProvider.DidConnect-Modal: "2. モーダルを開く"
69
- Your-Application.SessionProvider.DidConnect-Modal -> User: "3. QRコードを表示"
70
- User -> DID-Wallet: "4. スキャンして承認"
71
- DID-Wallet -> Your-Application.SessionProvider: "5. 接続を完了"
72
- Your-Application.SessionProvider -> Your-Application.SessionProvider.App-Components: "6. セッション状態を更新"
73
-
74
- ```
30
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
31
+ ![Overview](assets/diagram/overview-01.ja.jpg)
32
+ <!-- DIAGRAM_IMAGE_END -->
75
33
 
76
34
  ### インストール
77
35
 
package/docs/overview.md CHANGED
@@ -27,51 +27,9 @@ The library revolves around a central `SessionProvider` that manages the user's
27
27
 
28
28
  It's important to note that `@arcblock/did-connect-react` is a client-side library and requires a corresponding backend service to handle the authentication logic. This service should be built using the [`@arcblock/did-connect-js`](https://www.arcblock.io/docs/did-connect-sdk) library for Node.js.
29
29
 
30
- ```d2 Basic Authentication Flow
31
- direction: down
32
-
33
- User: {
34
- shape: c4-person
35
- }
36
-
37
- Your-Application: {
38
- label: "Your React Application"
39
- shape: rectangle
40
-
41
- SessionProvider: {
42
- label: "SessionProvider\n(Manages session state)"
43
- shape: rectangle
44
-
45
- App-Components: {
46
- label: "Your App Components"
47
- shape: rectangle
48
-
49
- ConnectButton: {
50
- label: "ConnectButton"
51
- shape: rectangle
52
- }
53
- }
54
-
55
- DidConnect-Modal: {
56
- label: "DidConnect Modal\n(Handles QR code flow)"
57
- shape: rectangle
58
- }
59
- }
60
- }
61
-
62
- DID-Wallet: {
63
- label: "DID Wallet"
64
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
65
- }
66
-
67
- User -> Your-Application.SessionProvider.App-Components.ConnectButton: "1. Clicks button"
68
- Your-Application.SessionProvider.App-Components.ConnectButton -> Your-Application.SessionProvider.DidConnect-Modal: "2. Opens modal"
69
- Your-Application.SessionProvider.DidConnect-Modal -> User: "3. Displays QR code"
70
- User -> DID-Wallet: "4. Scans & approves"
71
- DID-Wallet -> Your-Application.SessionProvider: "5. Completes connection"
72
- Your-Application.SessionProvider -> Your-Application.SessionProvider.App-Components: "6. Updates session state"
73
-
74
- ```
30
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
31
+ ![Overview](assets/diagram/overview-01.jpg)
32
+ <!-- DIAGRAM_IMAGE_END -->
75
33
 
76
34
  ### Installation
77
35
 
@@ -27,51 +27,9 @@
27
27
 
28
28
  需要注意的是,`@arcblock/did-connect-react` 是一個用戶端程式庫,需要一個對應的後端服務來處理驗證邏輯。該服務應使用適用於 Node.js 的 [`@arcblock/did-connect-js`](https://www.arcblock.io/docs/did-connect-sdk) 程式庫來建構。
29
29
 
30
- ```d2 基本驗證流程
31
- direction: down
32
-
33
- User: {
34
- shape: c4-person
35
- }
36
-
37
- Your-Application: {
38
- label: "您的 React 應用程式"
39
- shape: rectangle
40
-
41
- SessionProvider: {
42
- label: "SessionProvider\n(管理會話狀態)"
43
- shape: rectangle
44
-
45
- App-Components: {
46
- label: "您的應用程式元件"
47
- shape: rectangle
48
-
49
- ConnectButton: {
50
- label: "ConnectButton"
51
- shape: rectangle
52
- }
53
- }
54
-
55
- DidConnect-Modal: {
56
- label: "DidConnect 對話方塊\n(處理 QR Code 流程)"
57
- shape: rectangle
58
- }
59
- }
60
- }
61
-
62
- DID-Wallet: {
63
- label: "DID Wallet"
64
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
65
- }
66
-
67
- User -> Your-Application.SessionProvider.App-Components.ConnectButton: "1. 點擊按鈕"
68
- Your-Application.SessionProvider.App-Components.ConnectButton -> Your-Application.SessionProvider.DidConnect-Modal: "2. 開啟對話方塊"
69
- Your-Application.SessionProvider.DidConnect-Modal -> User: "3. 顯示 QR Code"
70
- User -> DID-Wallet: "4. 掃描並批准"
71
- DID-Wallet -> Your-Application.SessionProvider: "5. 完成連線"
72
- Your-Application.SessionProvider -> Your-Application.SessionProvider.App-Components: "6. 更新會話狀態"
73
-
74
- ```
30
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
31
+ ![Overview](assets/diagram/overview-01.zh-TW.jpg)
32
+ <!-- DIAGRAM_IMAGE_END -->
75
33
 
76
34
  ### 安裝
77
35
 
@@ -27,51 +27,9 @@
27
27
 
28
28
  需要注意的是,`@arcblock/did-connect-react` 是一个客户端库,需要相应的后端服务来处理身份验证逻辑。该服务应使用适用于 Node.js 的 [`@arcblock/did-connect-js`](https://www.arcblock.io/docs/did-connect-sdk) 库来构建。
29
29
 
30
- ```d2 基本身份验证流程
31
- direction: down
32
-
33
- User: {
34
- shape: c4-person
35
- }
36
-
37
- Your-Application: {
38
- label: "你的 React 应用程序"
39
- shape: rectangle
40
-
41
- SessionProvider: {
42
- label: "SessionProvider\n(管理会话状态)"
43
- shape: rectangle
44
-
45
- App-Components: {
46
- label: "你的应用组件"
47
- shape: rectangle
48
-
49
- ConnectButton: {
50
- label: "ConnectButton"
51
- shape: rectangle
52
- }
53
- }
54
-
55
- DidConnect-Modal: {
56
- label: "DidConnect 模态框\n(处理二维码流程)"
57
- shape: rectangle
58
- }
59
- }
60
- }
61
-
62
- DID-Wallet: {
63
- label: "DID 钱包"
64
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
65
- }
66
-
67
- User -> Your-Application.SessionProvider.App-Components.ConnectButton: "1. 点击按钮"
68
- Your-Application.SessionProvider.App-Components.ConnectButton -> Your-Application.SessionProvider.DidConnect-Modal: "2. 打开模态框"
69
- Your-Application.SessionProvider.DidConnect-Modal -> User: "3. 显示二维码"
70
- User -> DID-Wallet: "4. 扫描并批准"
71
- DID-Wallet -> Your-Application.SessionProvider: "5. 完成连接"
72
- Your-Application.SessionProvider -> Your-Application.SessionProvider.App-Components: "6. 更新会话状态"
73
-
74
- ```
30
+ <!-- DIAGRAM_IMAGE_START:architecture:16:9:1765962229 -->
31
+ ![Overview](assets/diagram/overview-01.zh.jpg)
32
+ <!-- DIAGRAM_IMAGE_END -->
75
33
 
76
34
  ### 安装
77
35
 
@@ -66,7 +66,8 @@ const e = {
66
66
  passkeyPreviewTitle: "Passkey",
67
67
  passkeyPreviewDescription: "Sign in with Passkey - More secure and convenient authentication. No passwords to remember, easily access apps and websites.",
68
68
  didConnectTitle: "DID Connect",
69
- didConnectDescription: "Decentralized identities and apps, W3C DID-based, future-ready."
69
+ didConnectDescription: "Decentralized identities and apps, W3C DID-based, future-ready.",
70
+ noAuthenticationProvider: "No authentication provider configured"
70
71
  },
71
72
  zh: {
72
73
  generateError: "二维码生成失败",
@@ -135,7 +136,8 @@ const e = {
135
136
  passkeyPreviewTitle: "Passkey",
136
137
  passkeyPreviewDescription: "使用 Passkey 账户登录 - 更安全、更便捷的身份验证方式。无需记忆密码,轻松登录各类应用和网站",
137
138
  didConnectTitle: "DID Connect",
138
- didConnectDescription: "面向未来的基于 W3C DID 去中心化身份和应用"
139
+ didConnectDescription: "面向未来的基于 W3C DID 去中心化身份和应用",
140
+ noAuthenticationProvider: "未配置任何身份验证提供者"
139
141
  }
140
142
  };
141
143
  export {
@@ -29,7 +29,7 @@ function ye({
29
29
  webWalletUrl: U = oe(),
30
30
  tokenKey: N,
31
31
  passkeyBehavior: W = "none",
32
- onRest: g = d,
32
+ onReset: g = d,
33
33
  showMobileLogin: j = !0,
34
34
  showOAuthLogin: v = !0,
35
35
  showPasskeyLogin: w = !0,
@@ -232,7 +232,7 @@ ye.propTypes = {
232
232
  webWalletUrl: o.string,
233
233
  tokenKey: o.string.isRequired,
234
234
  passkeyBehavior: o.oneOf(["none", "both", "only-existing", "only-new"]),
235
- onRest: o.func,
235
+ onReset: o.func,
236
236
  showMobileLogin: o.bool,
237
237
  showOAuthLogin: o.bool,
238
238
  showPasskeyLogin: o.bool,
@@ -0,0 +1,299 @@
1
+ import { jsx as s, jsxs as ee } from "react/jsx-runtime";
2
+ import t from "prop-types";
3
+ import { Box as d } from "@mui/material";
4
+ import { LOGIN_PROVIDER as r, LOGIN_PROVIDER_NAME as oe } from "@arcblock/ux/lib/Util/constant";
5
+ import { checkSameProtocol as te, getWebWalletUrl as ne } from "@arcblock/ux/lib/Util/wallet";
6
+ import u from "lodash/noop";
7
+ import { useMemoizedFn as h } from "ahooks";
8
+ import y from "js-cookie";
9
+ import { detectWalletExtension as re, getCookieOptions as ie } from "@arcblock/ux/lib/Util";
10
+ import { useRef as x, useEffect as se } from "react";
11
+ import { mergeSx as le } from "@arcblock/ux/lib/Util/style";
12
+ import ce 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 ae } from "@arcblock/ux/lib/Locale/util";
15
+ import me from "@arcblock/ux/lib/Empty";
16
+ import { useBrowser as pe } from "@arcblock/react-hooks";
17
+ import de from "./mobile-login-item.js";
18
+ import ue from "./web-login-item.js";
19
+ import he from "./login-method-item.js";
20
+ import { useOAuth as ge } from "../../../OAuth/context.js";
21
+ import { useStateContext as fe } from "../../contexts/state.js";
22
+ import { getAppId as ye, logger as xe, getApiErrorMessage as Le } from "../../../utils.js";
23
+ import Ae from "./passkey-login-item.js";
24
+ import { usePasskey as Ie } from "../../../Passkey/context.js";
25
+ import "../../../Passkey/actions.js";
26
+ import Ee from "../../plugins/email/index.js";
27
+ import Ce from "../../assets/locale.js";
28
+ function Pe({
29
+ onSuccess: L = u,
30
+ onError: A = u,
31
+ size: m = "small",
32
+ tokenState: n,
33
+ webWalletUrl: I = ne(),
34
+ tokenKey: U,
35
+ passkeyBehavior: E = "none",
36
+ onReset: g = u,
37
+ providerList: f = [],
38
+ slotProps: G = {},
39
+ disableSwitchApp: C = !1,
40
+ forceUpdate: B = u,
41
+ magicToken: P = void 0,
42
+ baseUrl: K = "/",
43
+ customItems: q = []
44
+ }) {
45
+ const v = x(null), M = x(null), w = x(null), b = pe(), V = te(I), _ = re(), { loginOAuth: Y, logoutOAuth: H, t: $, oauthState: l } = ge(), { passkeyState: O } = Ie(), { extraParams: T, locale: R, connectState: i, plugins: k, setPlugins: z, setSelectedPlugin: J, getPlugin: j } = fe(), Q = h((e, o = {}) => ae(Ce, e, R, "en", o)), S = h(async (e) => {
46
+ localStorage.setItem(p, e.provider), n.reset(), l.reset({
47
+ status: "scanned"
48
+ }), O.reset(), i.chooseMethod = e.provider;
49
+ const o = T?.sourceAppPid;
50
+ try {
51
+ l.loading = !0, l.status = "scanned";
52
+ const c = await Y(e, {
53
+ action: n.action,
54
+ ...T
55
+ }), a = ie({ returnDomain: !1 });
56
+ y.remove("connected_did", a), y.remove("connected_pk", a), y.remove("connected_wallet_os", a), c?.sessionToken && (await L(
57
+ {
58
+ ...c,
59
+ encrypted: !1
60
+ },
61
+ (Z) => Z,
62
+ {
63
+ sourceAppPid: o,
64
+ connected_app: ye(n.appInfo, n.memberAppInfo)
65
+ }
66
+ ), l.loading = !1, l.status = "succeed");
67
+ } catch (c) {
68
+ xe.error(`Failed login OAuth: ${e.provider}`, c);
69
+ const a = Le(c, $("loginOAuthFailed"));
70
+ l.loading = !1, l.error = a, l.status = "error", await H({ provider: e.provider }), A(new Error(a));
71
+ }
72
+ }), W = h(async () => {
73
+ n.reset(), await g(), n.status = "created", i.chooseMethod = "wallet";
74
+ }), D = f.some((e) => e.provider === r.EMAIL), F = Ee({ baseUrl: K }), X = h(() => {
75
+ if (P && f.some((e) => e.name === r.EMAIL) && k.some((e) => e.name === r.EMAIL)) {
76
+ const e = j(r.EMAIL);
77
+ e.state.status === "idle" && (localStorage.setItem(p, "email"), e.state.reset(), e.state.magicToken = P, i.chooseMethod = r.EMAIL, J(e), B());
78
+ }
79
+ });
80
+ se(() => {
81
+ const e = [];
82
+ if (D) {
83
+ const o = j(r.EMAIL);
84
+ o && o.baseUrl === F.baseUrl ? e.push(o) : e.push(F);
85
+ }
86
+ z(e), i.retryConnect = W, setTimeout(() => {
87
+ X();
88
+ }, 100);
89
+ }, [D]);
90
+ const N = f.map((e) => {
91
+ if (e.provider === r.WALLET) {
92
+ if (b.mobile.any)
93
+ return /* @__PURE__ */ s(
94
+ de,
95
+ {
96
+ ref: v,
97
+ tokenState: n,
98
+ sx: [m === "small" ? { p: 1 } : { p: 2 }],
99
+ locale: R,
100
+ tokenKey: U,
101
+ disableSwitchApp: C,
102
+ onClick: async () => {
103
+ localStorage.setItem(p, "wallet"), n.reset(), await g(), n.status = "created", i.chooseMethod = "wallet";
104
+ const o = v.current?.connect;
105
+ i.retryConnect = () => {
106
+ o(W);
107
+ };
108
+ }
109
+ },
110
+ r.WALLET
111
+ );
112
+ if ((V || _) && (!b.mobile.any || _))
113
+ return /* @__PURE__ */ s(
114
+ ue,
115
+ {
116
+ ref: M,
117
+ tokenState: n,
118
+ webWalletUrl: I,
119
+ sx: [m === "small" ? { p: 1 } : { p: 2 }],
120
+ disableSwitchApp: C,
121
+ onClick: () => {
122
+ localStorage.setItem(p, "wallet"), n.status = "scanned", i.chooseMethod = "wallet-web";
123
+ const o = M.current.connect;
124
+ i.retryConnect = async () => {
125
+ await g(), n.error = "", n.status = "scanned", o();
126
+ };
127
+ }
128
+ },
129
+ r.WALLET
130
+ );
131
+ }
132
+ if (e.provider === r.PASSKEY)
133
+ return E === "none" ? null : /* @__PURE__ */ s(
134
+ Ae,
135
+ {
136
+ ref: w,
137
+ onSuccess: L,
138
+ onError: A,
139
+ tokenState: n,
140
+ behavior: E,
141
+ sx: [m === "small" ? { p: 1 } : { p: 2 }],
142
+ onClick: () => {
143
+ localStorage.setItem(p, "passkey");
144
+ const o = w.current.connect;
145
+ i.chooseMethod = "passkey", i.retryConnect = () => {
146
+ O.verifying = !0, i.chooseMethod = "passkey", o();
147
+ };
148
+ },
149
+ slotProps: {
150
+ icon: {
151
+ sx: {
152
+ fontSize: 24,
153
+ "& svg": {
154
+ fontSize: 24,
155
+ width: "1em",
156
+ height: "1em"
157
+ }
158
+ }
159
+ }
160
+ }
161
+ },
162
+ r.PASSKEY
163
+ );
164
+ if (e.provider === r.EMAIL) {
165
+ const o = k.find((c) => c.name === r.EMAIL);
166
+ return o ? o?.renderListItem({
167
+ key: o.name,
168
+ sx: [m === "small" ? { p: 1 } : { p: 2 }]
169
+ // forceUpdate,
170
+ }) : null;
171
+ }
172
+ return e.type === "oauth" ? /* @__PURE__ */ s(
173
+ he,
174
+ {
175
+ title: oe[e.provider],
176
+ icon: /* @__PURE__ */ s(
177
+ ce,
178
+ {
179
+ provider: e.provider,
180
+ sx: {
181
+ transform: "scale(0.95)",
182
+ width: 24,
183
+ height: 24,
184
+ color: "text.primary"
185
+ }
186
+ }
187
+ ),
188
+ onClick: () => {
189
+ S(e), i.retryConnect = () => {
190
+ S(e);
191
+ };
192
+ },
193
+ sx: [m === "small" ? { p: 1 } : { p: 2 }]
194
+ },
195
+ e.provider
196
+ ) : null;
197
+ }).filter(Boolean);
198
+ return /* @__PURE__ */ s(d, { className: "did-connect__choose", sx: le({ flex: 1 }, G?.root?.sx), children: /* @__PURE__ */ s(
199
+ d,
200
+ {
201
+ sx: {
202
+ display: "flex",
203
+ flexDirection: "column",
204
+ gap: 2
205
+ },
206
+ children: /* @__PURE__ */ ee(
207
+ d,
208
+ {
209
+ sx: [
210
+ {
211
+ display: "flex",
212
+ flexDirection: "column",
213
+ gap: 1.5
214
+ }
215
+ ],
216
+ children: [
217
+ /* @__PURE__ */ s(
218
+ d,
219
+ {
220
+ sx: {
221
+ display: "grid",
222
+ gridTemplateColumns: "repeat(12, 1fr)",
223
+ gap: 1.25,
224
+ ".arc-login-item:nth-child(-n+3)": {
225
+ gridColumn: "span 12"
226
+ },
227
+ ".arc-login-item:nth-child(4):last-child": {
228
+ gridColumn: "span 12"
229
+ },
230
+ ".arc-login-item:nth-child(4):nth-last-child(2), .arc-login-item:nth-child(4):nth-last-child(2), .arc-login-item:nth-child(4):nth-last-child(2) ~ .arc-login-item": {
231
+ gridColumn: "span 6",
232
+ justifyContent: "center",
233
+ ".arc-login-item__body, .other-item-icon": {
234
+ display: "none"
235
+ }
236
+ },
237
+ ".arc-login-item:nth-child(4):nth-last-child(3), .arc-login-item:nth-child(4):nth-last-child(3) ~ .arc-login-item": {
238
+ justifyContent: "center",
239
+ gridColumn: "span 4",
240
+ ".arc-login-item__body, .other-item-icon": {
241
+ display: "none"
242
+ }
243
+ },
244
+ ".arc-login-item:nth-child(4):nth-last-child(4), .arc-login-item:nth-child(4):nth-last-child(4) ~ .arc-login-item": {
245
+ gridColumn: "span 3",
246
+ justifyContent: "center",
247
+ ".arc-login-item__body, .other-item-icon": {
248
+ display: "none"
249
+ }
250
+ },
251
+ "&:has(.arc-login-item:nth-child(8)) .arc-login-item:nth-child(n+4)": {
252
+ gridColumn: "span 3",
253
+ justifyContent: "center",
254
+ ".arc-login-item__body, .other-item-icon": {
255
+ display: "none"
256
+ }
257
+ }
258
+ },
259
+ children: N.length > 0 ? N : /* @__PURE__ */ s(
260
+ me,
261
+ {
262
+ className: "arc-login-item",
263
+ sx: {
264
+ ".empty-content": {
265
+ textAlign: "center"
266
+ }
267
+ },
268
+ children: Q("noAuthenticationProvider")
269
+ }
270
+ )
271
+ }
272
+ ),
273
+ q.map((e) => e || null)
274
+ ]
275
+ }
276
+ )
277
+ }
278
+ ) });
279
+ }
280
+ Pe.propTypes = {
281
+ onSuccess: t.func,
282
+ onError: t.func,
283
+ size: t.oneOf(["small", "normal", "large"]),
284
+ tokenState: t.object.isRequired,
285
+ webWalletUrl: t.string,
286
+ tokenKey: t.string.isRequired,
287
+ passkeyBehavior: t.oneOf(["none", "both", "only-existing", "only-new"]),
288
+ onReset: t.func,
289
+ providerList: t.array,
290
+ slotProps: t.object,
291
+ disableSwitchApp: t.bool,
292
+ forceUpdate: t.func,
293
+ magicToken: t.string,
294
+ baseUrl: t.string,
295
+ customItems: t.arrayOf(t.node)
296
+ };
297
+ export {
298
+ Pe as default
299
+ };