@arcblock/did-connect-react 3.2.19 → 3.3.1

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 (54) 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/Passkey/context.js +64 -63
  41. package/lib/Session/hooks/use-verify.js +1 -1
  42. package/lib/Session/libs/locales.js +3 -3
  43. package/lib/package.json.js +1 -1
  44. package/package.json +9 -9
  45. package/src/Connect/assets/locale.js +2 -0
  46. package/src/Connect/components/login-item/connect-choose-list.jsx +5 -5
  47. package/src/Connect/components/login-item/connect-provider-list.jsx +392 -0
  48. package/src/Connect/components/login-item/login-method-item.jsx +31 -28
  49. package/src/Connect/hooks/provider-list.js +127 -0
  50. package/src/Connect/index.jsx +8 -27
  51. package/src/OAuth/context.jsx +10 -2
  52. package/src/Passkey/context.jsx +3 -0
  53. package/src/Session/hooks/use-verify.jsx +1 -1
  54. package/src/Session/libs/locales.js +3 -3
@@ -54,56 +54,9 @@ export default App;
54
54
 
55
55
  `DidConnect` コンポーネントは、接続オプションの表示から最終的な成功またはエラー状態の処理まで、ユーザー認証フロー全体を調整します。
56
56
 
57
- ```d2
58
- direction: down
59
-
60
- User: {
61
- shape: c4-person
62
- }
63
-
64
- Application: {
65
- label: "React アプリケーション"
66
- shape: rectangle
67
-
68
- Login-Button: {
69
- label: "ログインボタン"
70
- }
71
-
72
- DidConnect-UI: {
73
- label: "DidConnect コンポーネント"
74
- shape: rectangle
75
-
76
- QR-Code: {
77
- label: "QR コード"
78
- }
79
-
80
- Login-Methods: {
81
- label: "他のログイン方法\n(OAuth、Passkey)"
82
- }
83
- }
84
- }
85
-
86
- Backend: {
87
- label: "バックエンドサーバー"
88
- shape: rectangle
89
- }
90
-
91
- DID-Wallet: {
92
- label: "DID Wallet"
93
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
94
- }
95
-
96
- User -> Application.Login-Button: "1. ログインをクリック"
97
- Application.Login-Button -> Application.DidConnect-UI: "2. UI をレンダリング"
98
- Application.DidConnect-UI -> Backend: "3. セッションを作成し、checkFn を介してポーリングを開始"
99
- User -> DID-Wallet: "4a. QR コードをスキャン"
100
- DID-Wallet -> Backend: "5. 承認を送信"
101
- User -> Application.DidConnect-UI.Login-Methods: "4b. OAuth/Passkey をクリック"
102
- Application.DidConnect-UI.Login-Methods -> Backend: "5. 認証"
103
- Backend -> Application.DidConnect-UI: "6. 成功ステータスを返す"
104
- Application.DidConnect-UI -> User: "7. onSuccess を呼び出し、UI を閉じる"
105
-
106
- ```
57
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
58
+ ![Connection UI (DidConnect)](assets/diagram/did-connect-diagram-0.ja.jpg)
59
+ <!-- DIAGRAM_IMAGE_END -->
107
60
 
108
61
  ## コンポーネントのプロパティ
109
62
 
@@ -52,58 +52,11 @@ In this example, clicking the "Login with DID" button sets the `isConnectOpen` s
52
52
 
53
53
  ## How It Works
54
54
 
55
- The `DidConnect` component orchestrates the entire user authentication flow, from displaying connection options to handling the final success or error state.
55
+ The `DidConnect` component orchestrates the entire user authentication flow, from displaying connection options to handling the final success or error state. The following diagram illustrates this flow:
56
56
 
57
- ```d2
58
- direction: down
59
-
60
- User: {
61
- shape: c4-person
62
- }
63
-
64
- Application: {
65
- label: "React Application"
66
- shape: rectangle
67
-
68
- Login-Button: {
69
- label: "Login Button"
70
- }
71
-
72
- DidConnect-UI: {
73
- label: "DidConnect Component"
74
- shape: rectangle
75
-
76
- QR-Code: {
77
- label: "QR Code"
78
- }
79
-
80
- Login-Methods: {
81
- label: "Other Login Methods\n(OAuth, Passkey)"
82
- }
83
- }
84
- }
85
-
86
- Backend: {
87
- label: "Backend Server"
88
- shape: rectangle
89
- }
90
-
91
- DID-Wallet: {
92
- label: "DID Wallet"
93
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
94
- }
95
-
96
- User -> Application.Login-Button: "1. Clicks Login"
97
- Application.Login-Button -> Application.DidConnect-UI: "2. Renders UI"
98
- Application.DidConnect-UI -> Backend: "3. Creates session, starts polling via checkFn"
99
- User -> DID-Wallet: "4a. Scans QR Code"
100
- DID-Wallet -> Backend: "5. Sends approval"
101
- User -> Application.DidConnect-UI.Login-Methods: "4b. Clicks OAuth/Passkey"
102
- Application.DidConnect-UI.Login-Methods -> Backend: "5. Authenticates"
103
- Backend -> Application.DidConnect-UI: "6. Returns success status"
104
- Application.DidConnect-UI -> User: "7. Calls onSuccess & closes UI"
105
-
106
- ```
57
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
58
+ ![Connection UI (DidConnect)](assets/diagram/did-connect-diagram-0.jpg)
59
+ <!-- DIAGRAM_IMAGE_END -->
107
60
 
108
61
  ## Component Props
109
62
 
@@ -210,4 +163,4 @@ Functions that are called at different stages of the connection lifecycle.
210
163
 
211
164
  ## Next Steps
212
165
 
213
- With a solid understanding of the `DidConnect` component, you can now build robust authentication experiences. For more programmatic control over the connection UI, explore the [`useConnect` hook](./hooks-use-connect.md), which allows you to open and close the `DidConnect` modal from anywhere in your application.
166
+ With a solid understanding of the `DidConnect` component, you can now build robust authentication experiences. For more programmatic control over the connection UI, explore the [`useConnect` hook](./hooks-use-connect.md), which allows you to open and close the `DidConnect` modal from anywhere in your application.
@@ -54,56 +54,9 @@ export default App;
54
54
 
55
55
  `DidConnect` 元件協調了整個使用者驗證流程,從顯示連線選項到處理最終的成功或錯誤狀態。
56
56
 
57
- ```d2
58
- direction: down
59
-
60
- User: {
61
- shape: c4-person
62
- }
63
-
64
- Application: {
65
- label: "React 應用程式"
66
- shape: rectangle
67
-
68
- Login-Button: {
69
- label: "登入按鈕"
70
- }
71
-
72
- DidConnect-UI: {
73
- label: "DidConnect 元件"
74
- shape: rectangle
75
-
76
- QR-Code: {
77
- label: "QR Code"
78
- }
79
-
80
- Login-Methods: {
81
- label: "其他登入方式\n(OAuth, Passkey)"
82
- }
83
- }
84
- }
85
-
86
- Backend: {
87
- label: "後端伺服器"
88
- shape: rectangle
89
- }
90
-
91
- DID-Wallet: {
92
- label: "DID Wallet"
93
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
94
- }
95
-
96
- User -> Application.Login-Button: "1. 點擊登入"
97
- Application.Login-Button -> Application.DidConnect-UI: "2. 渲染 UI"
98
- Application.DidConnect-UI -> Backend: "3. 建立 session,透過 checkFn 開始輪詢"
99
- User -> DID-Wallet: "4a. 掃描 QR Code"
100
- DID-Wallet -> Backend: "5. 發送批准"
101
- User -> Application.DidConnect-UI.Login-Methods: "4b. 點擊 OAuth/Passkey"
102
- Application.DidConnect-UI.Login-Methods -> Backend: "5. 進行驗證"
103
- Backend -> Application.DidConnect-UI: "6. 回傳成功狀態"
104
- Application.DidConnect-UI -> User: "7. 呼叫 onSuccess 並關閉 UI"
105
-
106
- ```
57
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
58
+ ![Connection UI (DidConnect)](assets/diagram/did-connect-diagram-0.zh-TW.jpg)
59
+ <!-- DIAGRAM_IMAGE_END -->
107
60
 
108
61
  ## 元件 Props
109
62
 
@@ -54,56 +54,9 @@ export default App;
54
54
 
55
55
  `DidConnect` 组件协调整个用户认证流程,从显示连接选项到处理最终的成功或错误状态。
56
56
 
57
- ```d2
58
- direction: down
59
-
60
- User: {
61
- shape: c4-person
62
- }
63
-
64
- Application: {
65
- label: "React 应用程序"
66
- shape: rectangle
67
-
68
- Login-Button: {
69
- label: "登录按钮"
70
- }
71
-
72
- DidConnect-UI: {
73
- label: "DidConnect 组件"
74
- shape: rectangle
75
-
76
- QR-Code: {
77
- label: "二维码"
78
- }
79
-
80
- Login-Methods: {
81
- label: "其他登录方式\n(OAuth, Passkey)"
82
- }
83
- }
84
- }
85
-
86
- Backend: {
87
- label: "后端服务器"
88
- shape: rectangle
89
- }
90
-
91
- DID-Wallet: {
92
- label: "DID Wallet"
93
- icon: "https://www.arcblock.io/image-bin/uploads/37198ddc4a0b9e91e5c1c821ab895a34.svg"
94
- }
95
-
96
- User -> Application.Login-Button: "1. 点击登录"
97
- Application.Login-Button -> Application.DidConnect-UI: "2. 渲染 UI"
98
- Application.DidConnect-UI -> Backend: "3. 创建会话,通过 checkFn 开始轮询"
99
- User -> DID-Wallet: "4a. 扫描二维码"
100
- DID-Wallet -> Backend: "5. 发送批准"
101
- User -> Application.DidConnect-UI.Login-Methods: "4b. 点击 OAuth/Passkey"
102
- Application.DidConnect-UI.Login-Methods -> Backend: "5. 进行认证"
103
- Backend -> Application.DidConnect-UI: "6. 返回成功状态"
104
- Application.DidConnect-UI -> User: "7. 调用 onSuccess 并关闭 UI"
105
-
106
- ```
57
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
58
+ ![Connection UI (DidConnect)](assets/diagram/did-connect-diagram-0.zh.jpg)
59
+ <!-- DIAGRAM_IMAGE_END -->
107
60
 
108
61
  ## 组件 Props
109
62
 
@@ -10,51 +10,9 @@
10
10
 
11
11
  以下は、基本的なアーキテクチャを示す図です。
12
12
 
13
- ```d2 SessionProvider Architecture icon=mdi:react
14
- direction: down
15
-
16
- SessionProvider: {
17
- label: "SessionProvider"
18
- shape: rectangle
19
- style: {
20
- fill: "#f0f9ff"
21
- stroke: "#0284c7"
22
- }
23
-
24
- Session-Context: {
25
- label: "セッションコンテキスト\n{ user, login(), logout() ... }"
26
- shape: cylinder
27
- style.fill: "#ecfdf5"
28
- }
29
-
30
- Your-App: {
31
- label: "あなたのアプリケーション"
32
- shape: rectangle
33
-
34
- Header: {
35
- label: "ヘッダーコンポーネント"
36
- }
37
-
38
- ProfilePage: {
39
- label: "プロフィールページ"
40
- }
41
-
42
- LoginButton: {
43
- label: "ログインボタン"
44
- }
45
- }
46
-
47
- Session-Context -> Your-App: 提供
48
- }
49
-
50
- Your-App.Header: 利用
51
- Your-App.ProfilePage: 利用
52
- Your-App.LoginButton: 利用とアクション
53
-
54
- Your-App.Header -> Session-Context
55
- Your-App.ProfilePage -> Session-Context
56
- Your-App.LoginButton -> Session-Context
57
- ```
13
+ <!-- DIAGRAM_IMAGE_START:architecture:4:3:1765962229 -->
14
+ ![Session Management (SessionProvider)](assets/diagram/core-components-session-provider-01.ja.jpg)
15
+ <!-- DIAGRAM_IMAGE_END -->
58
16
 
59
17
  ## はじめに
60
18
 
@@ -10,51 +10,9 @@ This component handles everything from storing session tokens and managing user
10
10
 
11
11
  Here is a diagram illustrating the basic architecture:
12
12
 
13
- ```d2 SessionProvider Architecture icon=mdi:react
14
- direction: down
15
-
16
- SessionProvider: {
17
- label: "SessionProvider"
18
- shape: rectangle
19
- style: {
20
- fill: "#f0f9ff"
21
- stroke: "#0284c7"
22
- }
23
-
24
- Session-Context: {
25
- label: "Session Context\n{ user, login(), logout() ... }"
26
- shape: cylinder
27
- style.fill: "#ecfdf5"
28
- }
29
-
30
- Your-App: {
31
- label: "Your Application"
32
- shape: rectangle
33
-
34
- Header: {
35
- label: "Header Component"
36
- }
37
-
38
- ProfilePage: {
39
- label: "Profile Page"
40
- }
41
-
42
- LoginButton: {
43
- label: "Login Button"
44
- }
45
- }
46
-
47
- Session-Context -> Your-App: Provides
48
- }
49
-
50
- Your-App.Header: Consumes
51
- Your-App.ProfilePage: Consumes
52
- Your-App.LoginButton: Consumes & Actions
53
-
54
- Your-App.Header -> Session-Context
55
- Your-App.ProfilePage -> Session-Context
56
- Your-App.LoginButton -> Session-Context
57
- ```
13
+ <!-- DIAGRAM_IMAGE_START:architecture:4:3:1765962229 -->
14
+ ![Session Management (SessionProvider)](assets/diagram/core-components-session-provider-01.jpg)
15
+ <!-- DIAGRAM_IMAGE_END -->
58
16
 
59
17
  ## Getting Started
60
18
 
@@ -10,51 +10,9 @@
10
10
 
11
11
  這是一個說明基本架構的圖表:
12
12
 
13
- ```d2 SessionProvider Architecture icon=mdi:react
14
- direction: down
15
-
16
- SessionProvider: {
17
- label: "SessionProvider"
18
- shape: rectangle
19
- style: {
20
- fill: "#f0f9ff"
21
- stroke: "#0284c7"
22
- }
23
-
24
- Session-Context: {
25
- label: "Session Context\n{ user, login(), logout() ... }"
26
- shape: cylinder
27
- style.fill: "#ecfdf5"
28
- }
29
-
30
- Your-App: {
31
- label: "您的應用程式"
32
- shape: rectangle
33
-
34
- Header: {
35
- label: "Header 元件"
36
- }
37
-
38
- ProfilePage: {
39
- label: "個人資料頁面"
40
- }
41
-
42
- LoginButton: {
43
- label: "登入按鈕"
44
- }
45
- }
46
-
47
- Session-Context -> Your-App: 提供
48
- }
49
-
50
- Your-App.Header: 使用
51
- Your-App.ProfilePage: 使用
52
- Your-App.LoginButton: 使用與操作
53
-
54
- Your-App.Header -> Session-Context
55
- Your-App.ProfilePage -> Session-Context
56
- Your-App.LoginButton -> Session-Context
57
- ```
13
+ <!-- DIAGRAM_IMAGE_START:architecture:4:3:1765962229 -->
14
+ ![Session Management (SessionProvider)](assets/diagram/core-components-session-provider-01.zh-TW.jpg)
15
+ <!-- DIAGRAM_IMAGE_END -->
58
16
 
59
17
  ## 入門指南
60
18
 
@@ -10,51 +10,9 @@
10
10
 
11
11
  下图说明了基本架构:
12
12
 
13
- ```d2 SessionProvider 架构 icon=mdi:react
14
- direction: down
15
-
16
- SessionProvider: {
17
- label: "SessionProvider"
18
- shape: rectangle
19
- style: {
20
- fill: "#f0f9ff"
21
- stroke: "#0284c7"
22
- }
23
-
24
- Session-Context: {
25
- label: "会话上下文\n{ user, login(), logout() ... }"
26
- shape: cylinder
27
- style.fill: "#ecfdf5"
28
- }
29
-
30
- Your-App: {
31
- label: "您的应用程序"
32
- shape: rectangle
33
-
34
- Header: {
35
- label: "Header 组件"
36
- }
37
-
38
- ProfilePage: {
39
- label: "个人资料页面"
40
- }
41
-
42
- LoginButton: {
43
- label: "登录按钮"
44
- }
45
- }
46
-
47
- Session-Context -> Your-App: 提供
48
- }
49
-
50
- Your-App.Header: 消费
51
- Your-App.ProfilePage: 消费
52
- Your-App.LoginButton: 消费与操作
53
-
54
- Your-App.Header -> Session-Context
55
- Your-App.ProfilePage -> Session-Context
56
- Your-App.LoginButton -> Session-Context
57
- ```
13
+ <!-- DIAGRAM_IMAGE_START:architecture:4:3:1765962229 -->
14
+ ![Session Management (SessionProvider)](assets/diagram/core-components-session-provider-01.zh.jpg)
15
+ <!-- DIAGRAM_IMAGE_END -->
58
16
 
59
17
  ## 快速入门
60
18
 
@@ -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. QRをスキャンして承認"
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.ja.jpg)
16
+ <!-- DIAGRAM_IMAGE_END -->
53
17
 
54
18
  ## セットアップ
55
19
 
@@ -11,45 +11,9 @@ The `useConnect` hook returns two main elements:
11
11
  1. **`connectHolder`**: A React element that must be rendered in your component tree. This element is responsible for rendering the `DidConnect` modal when it's activated. It remains invisible until the `open` function is called.
12
12
  2. **`connectApi`**: An object containing the functions (`open`, `close`, `openPopup`, `loginOAuth`) you'll use to control the modal's lifecycle.
13
13
 
14
- ```d2
15
- direction: down
16
-
17
- User: {
18
- shape: c4-person
19
- }
20
-
21
- Your-App: {
22
- label: "Your Application"
23
- shape: rectangle
24
-
25
- Custom-Button: {
26
- label: "Custom Button"
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. Clicks"
44
- Your-App.Custom-Button -> Your-App.useConnect-Hook: "2. Calls connectApi.open()"
45
- Your-App.useConnect-Hook -> Your-App.connectHolder: "3. Activates modal"
46
- Your-App.connectHolder -> User: "4. Displays DidConnect UI"
47
- User -> DID-Wallet: "5. Scans QR & Approves"
48
- DID-Wallet -> Your-App.connectHolder: "6. Sends response"
49
- Your-App.connectHolder -> Your-App.useConnect-Hook: "7. Triggers onSuccess callback"
50
- Your-App.useConnect-Hook -> Your-App.connectHolder: "8. Deactivates modal"
51
-
52
- ```
14
+ <!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
15
+ ![useConnect](assets/diagram/use-connect-diagram-0.jpg)
16
+ <!-- DIAGRAM_IMAGE_END -->
53
17
 
54
18
  ## Setup
55
19
 
@@ -211,4 +175,4 @@ This is a helper function to directly initiate an OAuth login flow. It's a lower
211
175
  <x-field data-name="action" data-type="string" data-required="true" data-desc="The action, typically 'login'."></x-field>
212
176
  <x-field data-name="extraParams" data-type="object" data-required="false" data-desc="Additional parameters for the OAuth flow."></x-field>
213
177
  <x-field data-name="onLogin" data-type="function" data-required="true" data-desc="Callback function executed upon successful login."></x-field>
214
- </x-field-group>
178
+ </x-field-group>
@@ -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. 掃描 QR 並批准"
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-TW.jpg)
16
+ <!-- DIAGRAM_IMAGE_END -->
53
17
 
54
18
  ## 設定
55
19