@arcblock/did-connect-react 3.4.15 → 3.5.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.
- package/dist/standalone/did-connect-react.css +1 -0
- package/dist/standalone/index.js +133700 -0
- package/lib/package.json.js +1 -1
- package/package.json +11 -6
- 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 -328
- package/src/Connect/components/login-item/connect-provider-list.jsx +0 -473
- package/src/Connect/components/login-item/login-method-item.jsx +0 -139
- package/src/Connect/components/login-item/mobile-login-item.jsx +0 -184
- package/src/Connect/components/login-item/passkey-login-item.jsx +0 -56
- package/src/Connect/components/login-item/wallet-login-options.jsx +0 -129
- package/src/Connect/components/login-item/web-login-item.jsx +0 -159
- 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 -635
- package/src/Connect/contexts/state.jsx +0 -235
- 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 -168
- 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 -35
- package/src/Connect/plugins/email/placeholder.jsx +0 -372
- 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,166 +0,0 @@
|
|
|
1
|
-
# Connection UI (DidConnect)
|
|
2
|
-
|
|
3
|
-
The `DidConnect` component is a pre-built, comprehensive UI solution for handling various decentralized identity (DID) connection flows. It provides a user-friendly interface for actions like login, authentication, and profile requests, supporting multiple connection methods out-of-the-box.
|
|
4
|
-
|
|
5
|
-
It serves as the visual centerpiece of the `@arcblock/did-connect-react` library, abstracting away the complexity of session management and real-time status updates. The component displays a QR code for DID Wallet users and offers alternative login options such as social logins (OAuth) and passwordless authentication (Passkeys).
|
|
6
|
-
|
|
7
|
-
Before using `DidConnect`, ensure you have wrapped your application with the [`SessionProvider`](./core-components-session-provider.md) to manage the overall session state.
|
|
8
|
-
|
|
9
|
-
## Basic Usage
|
|
10
|
-
|
|
11
|
-
To use `DidConnect`, you need to import it and provide a few essential props. The component is typically controlled by a state variable that determines its visibility.
|
|
12
|
-
|
|
13
|
-
```jsx DID Connect Example icon=logos:react
|
|
14
|
-
import React, { useState } from 'react';
|
|
15
|
-
import axios from 'axios';
|
|
16
|
-
import DidConnect from '@arcblock/did-connect-react/lib/Connect';
|
|
17
|
-
|
|
18
|
-
function App() {
|
|
19
|
-
const [isConnectOpen, setConnectOpen] = useState(false);
|
|
20
|
-
|
|
21
|
-
const handleClose = () => setConnectOpen(false);
|
|
22
|
-
const handleSuccess = () => {
|
|
23
|
-
// Handle successful login, e.g., redirect the user
|
|
24
|
-
window.location.href = '/profile';
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div>
|
|
29
|
-
<button onClick={() => setConnectOpen(true)}>Login with DID</button>
|
|
30
|
-
{isConnectOpen && (
|
|
31
|
-
<DidConnect
|
|
32
|
-
action="login"
|
|
33
|
-
checkFn={axios.get}
|
|
34
|
-
onClose={handleClose}
|
|
35
|
-
onSuccess={handleSuccess}
|
|
36
|
-
messages={{
|
|
37
|
-
title: 'Scan to Sign In',
|
|
38
|
-
scan: 'Scan QR code with your DID Wallet',
|
|
39
|
-
confirm: 'Confirm login on your DID Wallet',
|
|
40
|
-
success: 'You have successfully signed in!',
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
)}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export default App;
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
In this example, clicking the "Login with DID" button sets the `isConnectOpen` state to `true`, which renders the `DidConnect` component as a modal dialog. The `checkFn` prop is crucial, as it's the function the component uses to poll for the session status from your backend.
|
|
52
|
-
|
|
53
|
-
## How It Works
|
|
54
|
-
|
|
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
|
-
|
|
57
|
-
<!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
|
|
58
|
-

|
|
59
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
60
|
-
|
|
61
|
-
## Component Props
|
|
62
|
-
|
|
63
|
-
The `DidConnect` component is highly configurable through its props. Below is a detailed list of the available options.
|
|
64
|
-
|
|
65
|
-
### Core Configuration
|
|
66
|
-
|
|
67
|
-
These props are essential for setting up the component's basic functionality.
|
|
68
|
-
|
|
69
|
-
<x-field-group>
|
|
70
|
-
<x-field data-name="action" data-type="string" data-required="true">
|
|
71
|
-
<x-field-desc markdown>Defines the purpose of the connection, such as `login`, `claim`, `sign`, etc. This string is passed to your backend to determine the required actions.</x-field-desc>
|
|
72
|
-
</x-field>
|
|
73
|
-
<x-field data-name="checkFn" data-type="function" data-required="true">
|
|
74
|
-
<x-field-desc markdown>The function used to poll the backend for session status updates. It should be a function that makes an API request, like `axios.get`.</x-field-desc>
|
|
75
|
-
</x-field>
|
|
76
|
-
<x-field data-name="baseUrl" data-type="string" data-default="''">
|
|
77
|
-
<x-field-desc markdown>The base URL for the API endpoints. If your API is on a different domain, specify it here.</x-field-desc>
|
|
78
|
-
</x-field>
|
|
79
|
-
<x-field data-name="prefix" data-type="string" data-default="/api/did">
|
|
80
|
-
<x-field-desc markdown>The URL prefix for the DID Connect API endpoints on your backend.</x-field-desc>
|
|
81
|
-
</x-field>
|
|
82
|
-
</x-field-group>
|
|
83
|
-
|
|
84
|
-
### Behavior Control
|
|
85
|
-
|
|
86
|
-
These props control how the connection process behaves.
|
|
87
|
-
|
|
88
|
-
<x-field-group>
|
|
89
|
-
<x-field data-name="enabledConnectTypes" data-type="string[]" data-default='["web", "mobile", ...]'>
|
|
90
|
-
<x-field-desc markdown>An array of strings specifying which connection methods to display. Possible values include `web`, `mobile`, `github`, `google`, `apple`, `passkey`, etc.</x-field-desc>
|
|
91
|
-
</x-field>
|
|
92
|
-
<x-field data-name="passkeyBehavior" data-type="'none' | 'both' | 'only-existing' | 'only-new'" data-default="'none'">
|
|
93
|
-
<x-field-desc markdown>Controls the behavior of Passkey authentication. `none` disables it, `both` allows creating new passkeys and using existing ones, `only-existing` restricts to existing passkeys, and `only-new` forces new passkey creation.</x-field-desc>
|
|
94
|
-
</x-field>
|
|
95
|
-
<x-field data-name="allowWallet" data-type="boolean" data-default="true">
|
|
96
|
-
<x-field-desc markdown>If `false`, the QR code and mobile wallet connection options will be hidden.</x-field-desc>
|
|
97
|
-
</x-field>
|
|
98
|
-
<x-field data-name="autoConnect" data-type="boolean" data-default="true">
|
|
99
|
-
<x-field-desc markdown>If `true`, the component will automatically try to use a previously established connection from the same device.</x-field-desc>
|
|
100
|
-
</x-field>
|
|
101
|
-
<x-field data-name="forceConnected" data-type="boolean | string" data-default="true">
|
|
102
|
-
<x-field-desc markdown>If `true`, a user must connect with the same DID they are already logged in with. If a DID string is provided, the user must connect with that specific DID.</x-field-desc>
|
|
103
|
-
</x-field>
|
|
104
|
-
<x-field data-name="saveConnect" data-type="boolean" data-default="true">
|
|
105
|
-
<x-field-desc markdown>If `true`, the successful connection information is saved locally for future `autoConnect` attempts.</x-field-desc>
|
|
106
|
-
</x-field>
|
|
107
|
-
<x-field data-name="useSocket" data-type="boolean" data-default="true">
|
|
108
|
-
<x-field-desc markdown>If `true`, attempts to use a WebSocket for real-time status updates, falling back to polling if a connection cannot be established.</x-field-desc>
|
|
109
|
-
</x-field>
|
|
110
|
-
</x-field-group>
|
|
111
|
-
|
|
112
|
-
### UI Customization
|
|
113
|
-
|
|
114
|
-
Customize the appearance and text of the `DidConnect` component.
|
|
115
|
-
|
|
116
|
-
<x-field-group>
|
|
117
|
-
<x-field data-name="mode" data-type="'dialog' | 'drawer' | 'page'" data-default="'dialog'">
|
|
118
|
-
<x-field-desc markdown>Determines how the component is displayed. `dialog` shows it as a centered modal, `drawer` as a bottom sheet (on mobile), and `page` embeds it directly into the document flow.</x-field-desc>
|
|
119
|
-
</x-field>
|
|
120
|
-
<x-field data-name="messages" data-type="object">
|
|
121
|
-
<x-field-desc markdown>An object to customize the text displayed in the UI.</x-field-desc>
|
|
122
|
-
<x-field data-name="title" data-type="string" data-desc="The main title at the top."></x-field>
|
|
123
|
-
<x-field data-name="scan" data-type="string" data-desc="The instructional text below the title."></x-field>
|
|
124
|
-
<x-field data-name="confirm" data-type="string" data-desc="Text shown after the QR code is scanned."></x-field>
|
|
125
|
-
<x-field data-name="success" data-type="string | ReactNode" data-desc="Message displayed upon successful connection."></x-field>
|
|
126
|
-
<x-field data-name="error" data-type="string" data-desc="Message displayed on error."></x-field>
|
|
127
|
-
</x-field>
|
|
128
|
-
<x-field data-name="hideCloseButton" data-type="boolean" data-default="false">
|
|
129
|
-
<x-field-desc markdown>If `true`, the close button (X) in the top-right corner is hidden.</x-field-desc>
|
|
130
|
-
</x-field>
|
|
131
|
-
<x-field data-name="extraContent" data-type="ReactNode" data-default="null">
|
|
132
|
-
<x-field-desc markdown>Allows you to inject a custom React component or element into the UI, typically appearing below the main title/description.</x-field-desc>
|
|
133
|
-
</x-field>
|
|
134
|
-
<x-field data-name="customItems" data-type="ReactNode[]" data-default="[]">
|
|
135
|
-
<x-field-desc markdown>An array of custom React nodes to be added to the list of connection methods.</x-field-desc>
|
|
136
|
-
</x-field>
|
|
137
|
-
<x-field data-name="disableSwitchApp" data-type="boolean" data-default="false">
|
|
138
|
-
<x-field-desc markdown>If you are using Federated Login, this prop prevents users from switching between different applications in the group during the login process.</x-field-desc>
|
|
139
|
-
</x-field>
|
|
140
|
-
<x-field data-name="webWalletUrl" data-type="string">
|
|
141
|
-
<x-field-desc markdown>The URL of the web-based DID Wallet to be used for the "Connect with Web Wallet" option. Defaults to the official ArcBlock web wallet.</x-field-desc>
|
|
142
|
-
</x-field>
|
|
143
|
-
</x-field-group>
|
|
144
|
-
|
|
145
|
-
### Callbacks
|
|
146
|
-
|
|
147
|
-
Functions that are called at different stages of the connection lifecycle.
|
|
148
|
-
|
|
149
|
-
<x-field-group>
|
|
150
|
-
<x-field data-name="onClose" data-type="function" data-required="true">
|
|
151
|
-
<x-field-desc markdown>Callback function that is executed when the user closes the `DidConnect` dialog (e.g., by clicking the close button or outside the modal).</x-field-desc>
|
|
152
|
-
</x-field>
|
|
153
|
-
<x-field data-name="onSuccess" data-type="function" data-required="true">
|
|
154
|
-
<x-field-desc markdown>Callback function that is executed upon a successful connection. The session data is passed as an argument.</x-field-desc>
|
|
155
|
-
</x-field>
|
|
156
|
-
<x-field data-name="onError" data-type="function">
|
|
157
|
-
<x-field-desc markdown>Callback function that is executed when an error occurs during the process. The error object or message is passed as an argument.</x-field-desc>
|
|
158
|
-
</x-field>
|
|
159
|
-
<x-field data-name="onRecreateSession" data-type="function">
|
|
160
|
-
<x-field-desc markdown>A callback function that is invoked when the session needs to be reset, for example, after a timeout or when the user manually cancels and retries.</x-field-desc>
|
|
161
|
-
</x-field>
|
|
162
|
-
</x-field-group>
|
|
163
|
-
|
|
164
|
-
## Next Steps
|
|
165
|
-
|
|
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.
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
# 連線 UI (DidConnect)
|
|
2
|
-
|
|
3
|
-
`DidConnect` 元件是一個預先建置的、全面的 UI 解決方案,用於處理各種去中心化身分(DID)連線流程。它為登入、驗證和個人資料請求等操作提供了一個使用者友善的介面,並原生支援多種連線方式。
|
|
4
|
-
|
|
5
|
-
它是 `@arcblock/did-connect-react` 函式庫的視覺核心,將 session 管理和即時狀態更新的複雜性抽象化。該元件會為 DID Wallet 使用者顯示一個 QR code,並提供其他登入選項,例如社群登入(OAuth)和無密碼驗證(Passkeys)。
|
|
6
|
-
|
|
7
|
-
在使用 `DidConnect` 之前,請確保您已使用 [`SessionProvider`](./core-components-session-provider.md) 將您的應用程式包裹起來,以管理整體的 session 狀態。
|
|
8
|
-
|
|
9
|
-
## 基本用法
|
|
10
|
-
|
|
11
|
-
要使用 `DidConnect`,您需要匯入它並提供一些必要的 props。該元件通常由一個決定其可見性的狀態變數來控制。
|
|
12
|
-
|
|
13
|
-
```jsx DID Connect 範例 icon=logos:react
|
|
14
|
-
import React, { useState } from 'react';
|
|
15
|
-
import axios from 'axios';
|
|
16
|
-
import DidConnect from '@arcblock/did-connect-react/lib/Connect';
|
|
17
|
-
|
|
18
|
-
function App() {
|
|
19
|
-
const [isConnectOpen, setConnectOpen] = useState(false);
|
|
20
|
-
|
|
21
|
-
const handleClose = () => setConnectOpen(false);
|
|
22
|
-
const handleSuccess = () => {
|
|
23
|
-
// 處理成功登入,例如,重新導向使用者
|
|
24
|
-
window.location.href = '/profile';
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div>
|
|
29
|
-
<button onClick={() => setConnectOpen(true)}>使用 DID 登入</button>
|
|
30
|
-
{isConnectOpen && (
|
|
31
|
-
<DidConnect
|
|
32
|
-
action="login"
|
|
33
|
-
checkFn={axios.get}
|
|
34
|
-
onClose={handleClose}
|
|
35
|
-
onSuccess={handleSuccess}
|
|
36
|
-
messages={{
|
|
37
|
-
title: '掃描以登入',
|
|
38
|
-
scan: '使用您的 DID Wallet 掃描 QR code',
|
|
39
|
-
confirm: '在您的 DID Wallet 上確認登入',
|
|
40
|
-
success: '您已成功登入!',
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
)}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export default App;
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
在此範例中,點擊「使用 DID 登入」按鈕會將 `isConnectOpen` 狀態設定為 `true`,這會將 `DidConnect` 元件渲染為一個強制回應對話框。`checkFn` prop 至關重要,因為它是元件用來從您的後端輪詢 session 狀態的函式。
|
|
52
|
-
|
|
53
|
-
## 運作方式
|
|
54
|
-
|
|
55
|
-
`DidConnect` 元件協調了整個使用者驗證流程,從顯示連線選項到處理最終的成功或錯誤狀態。
|
|
56
|
-
|
|
57
|
-
<!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
|
|
58
|
-

|
|
59
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
60
|
-
|
|
61
|
-
## 元件 Props
|
|
62
|
-
|
|
63
|
-
`DidConnect` 元件可透過其 props 進行高度設定。以下是可用選項的詳細清單。
|
|
64
|
-
|
|
65
|
-
### 核心設定
|
|
66
|
-
|
|
67
|
-
這些 props 對於設定元件的基本功能至關重要。
|
|
68
|
-
|
|
69
|
-
<x-field-group>
|
|
70
|
-
<x-field data-name="action" data-type="string" data-required="true">
|
|
71
|
-
<x-field-desc markdown>定義連線的目的,例如 `login`、`claim`、`sign` 等。此字串會傳遞到您的後端以確定所需的操作。</x-field-desc>
|
|
72
|
-
</x-field>
|
|
73
|
-
<x-field data-name="checkFn" data-type="function" data-required="true">
|
|
74
|
-
<x-field-desc markdown>用於輪詢後端以獲取 session 狀態更新的函式。它應該是一個發出 API 請求的函式,例如 `axios.get`。</x-field-desc>
|
|
75
|
-
</x-field>
|
|
76
|
-
<x-field data-name="baseUrl" data-type="string" data-default="''">
|
|
77
|
-
<x-field-desc markdown>API 端點的基礎 URL。如果您的 API 在不同的網域上,請在此處指定。</x-field-desc>
|
|
78
|
-
</x-field>
|
|
79
|
-
<x-field data-name="prefix" data-type="string" data-default="/api/did">
|
|
80
|
-
<x-field-desc markdown>您後端 DID Connect API 端點的 URL 前綴。</x-field-desc>
|
|
81
|
-
</x-field>
|
|
82
|
-
</x-field-group>
|
|
83
|
-
|
|
84
|
-
### 行為控制
|
|
85
|
-
|
|
86
|
-
這些 props 控制連線過程的行為方式。
|
|
87
|
-
|
|
88
|
-
<x-field-group>
|
|
89
|
-
<x-field data-name="enabledConnectTypes" data-type="string[]" data-default='["web", "mobile", ...]'>
|
|
90
|
-
<x-field-desc markdown>一個字串陣列,指定要顯示哪些連線方式。可能的值包括 `web`、`mobile`、`github`、`google`、`apple`、`passkey` 等。</x-field-desc>
|
|
91
|
-
</x-field>
|
|
92
|
-
<x-field data-name="passkeyBehavior" data-type="'none' | 'both' | 'only-existing' | 'only-new'" data-default="'none'">
|
|
93
|
-
<x-field-desc markdown>控制 Passkey 驗證的行為。`none` 會停用它,`both` 允許建立新的 passkey 和使用現有的,`only-existing` 限制只能使用現有的 passkey,而 `only-new` 強制建立新的 passkey。</x-field-desc>
|
|
94
|
-
</x-field>
|
|
95
|
-
<x-field data-name="allowWallet" data-type="boolean" data-default="true">
|
|
96
|
-
<x-field-desc markdown>如果為 `false`,QR code 和行動錢包連線選項將被隱藏。</x-field-desc>
|
|
97
|
-
</x-field>
|
|
98
|
-
<x-field data-name="autoConnect" data-type="boolean" data-default="true">
|
|
99
|
-
<x-field-desc markdown>如果為 `true`,元件將自動嘗試使用來自同一裝置先前建立的連線。</x-field-desc>
|
|
100
|
-
</x-field>
|
|
101
|
-
<x-field data-name="forceConnected" data-type="boolean | string" data-default="true">
|
|
102
|
-
<x-field-desc markdown>如果為 `true`,使用者必須使用他們已經登入的同一個 DID 進行連線。如果提供了一個 DID 字串,使用者必須使用該特定的 DID 進行連線。</x-field-desc>
|
|
103
|
-
</x-field>
|
|
104
|
-
<x-field data-name="saveConnect" data-type="boolean" data-default="true">
|
|
105
|
-
<x-field-desc markdown>如果為 `true`,成功的連線資訊會儲存在本機,以供未來的 `autoConnect` 嘗試使用。</x-field-desc>
|
|
106
|
-
</x-field>
|
|
107
|
-
<x-field data-name="useSocket" data-type="boolean" data-default="true">
|
|
108
|
-
<x-field-desc markdown>如果為 `true`,則嘗試使用 WebSocket 進行即時狀態更新,如果無法建立連線,則退回使用輪詢。</x-field-desc>
|
|
109
|
-
</x-field>
|
|
110
|
-
</x-field-group>
|
|
111
|
-
|
|
112
|
-
### UI 客製化
|
|
113
|
-
|
|
114
|
-
客製化 `DidConnect` 元件的外觀和文字。
|
|
115
|
-
|
|
116
|
-
<x-field-group>
|
|
117
|
-
<x-field data-name="mode" data-type="'dialog' | 'drawer' | 'page'" data-default="'dialog'">
|
|
118
|
-
<x-field-desc markdown>決定元件的顯示方式。`dialog` 將其顯示為置中對話框,`drawer` 顯示為底部彈出視窗(在行動裝置上),而 `page` 將其直接嵌入文件流中。</x-field-desc>
|
|
119
|
-
</x-field>
|
|
120
|
-
<x-field data-name="messages" data-type="object">
|
|
121
|
-
<x-field-desc markdown>一個用於客製化 UI 中顯示文字的物件。</x-field-desc>
|
|
122
|
-
<x-field data-name="title" data-type="string" data-desc="頂部的主標題。"></x-field>
|
|
123
|
-
<x-field data-name="scan" data-type="string" data-desc="標題下方的說明文字。"></x-field>
|
|
124
|
-
<x-field data-name="confirm" data-type="string" data-desc="QR code 掃描後顯示的文字。"></x-field>
|
|
125
|
-
<x-field data-name="success" data-type="string | ReactNode" data-desc="成功連線時顯示的訊息。"></x-field>
|
|
126
|
-
<x-field data-name="error" data-type="string" data-desc="發生錯誤時顯示的訊息。"></x-field>
|
|
127
|
-
</x-field>
|
|
128
|
-
<x-field data-name="hideCloseButton" data-type="boolean" data-default="false">
|
|
129
|
-
<x-field-desc markdown>如果為 `true`,右上角的關閉按鈕(X)將被隱藏。</x-field-desc>
|
|
130
|
-
</x-field>
|
|
131
|
-
<x-field data-name="extraContent" data-type="ReactNode" data-default="null">
|
|
132
|
-
<x-field-desc markdown>允許您將自訂的 React 元件或元素注入 UI 中,通常會出現在主標題/描述下方。</x-field-desc>
|
|
133
|
-
</x-field>
|
|
134
|
-
<x-field data-name="customItems" data-type="ReactNode[]" data-default="[]">
|
|
135
|
-
<x-field-desc markdown>一個自訂 React 節點的陣列,將被新增到連線方式清單中。</x-field-desc>
|
|
136
|
-
</x-field>
|
|
137
|
-
<x-field data-name="disableSwitchApp" data-type="boolean" data-default="false">
|
|
138
|
-
<x-field-desc markdown>如果您正在使用統一登入站點群,此 prop 可防止使用者在登入過程中在群組中的不同應用程式之間切換。</x-field-desc>
|
|
139
|
-
</x-field>
|
|
140
|
-
<x-field data-name="webWalletUrl" data-type="string">
|
|
141
|
-
<x-field-desc markdown>用於「使用網頁錢包連線」選項的網頁版 DID Wallet 的 URL。預設為官方 ArcBlock 網頁錢包。</x-field-desc>
|
|
142
|
-
</x-field>
|
|
143
|
-
</x-field-group>
|
|
144
|
-
|
|
145
|
-
### 回呼
|
|
146
|
-
|
|
147
|
-
在連線生命週期的不同階段呼叫的函式。
|
|
148
|
-
|
|
149
|
-
<x-field-group>
|
|
150
|
-
<x-field data-name="onClose" data-type="function" data-required="true">
|
|
151
|
-
<x-field-desc markdown>當使用者關閉 `DidConnect` 對話框時(例如,點擊關閉按鈕或在對話框外部點擊)執行的回呼函式。</x-field-desc>
|
|
152
|
-
</x-field>
|
|
153
|
-
<x-field data-name="onSuccess" data-type="function" data-required="true">
|
|
154
|
-
<x-field-desc markdown>成功連線後執行的回呼函式。Session 資料會作為參數傳遞。</x-field-desc>
|
|
155
|
-
</x-field>
|
|
156
|
-
<x-field data-name="onError" data-type="function">
|
|
157
|
-
<x-field-desc markdown>在過程中發生錯誤時執行的回呼函式。錯誤物件或訊息會作為參數傳遞。</x-field-desc>
|
|
158
|
-
</x-field>
|
|
159
|
-
<x-field data-name="onRecreateSession" data-type="function">
|
|
160
|
-
<x-field-desc markdown>當 session 需要重置時(例如,逾時後或使用者手動取消並重試時)調用的回呼函式。</x-field-desc>
|
|
161
|
-
</x-field>
|
|
162
|
-
</x-field-group>
|
|
163
|
-
|
|
164
|
-
## 後續步驟
|
|
165
|
-
|
|
166
|
-
在對 `DidConnect` 元件有了扎實的理解後,您現在可以建構穩健的驗證體驗。若想對連線 UI 進行更多程式化控制,請探索 [`useConnect` hook](./hooks-use-connect.md),它允許您從應用程式的任何地方開啟和關閉 `DidConnect` 對話框。
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
# 连接 UI (DidConnect)
|
|
2
|
-
|
|
3
|
-
`DidConnect` 组件是一个预构建的、全面的 UI 解决方案,用于处理各种去中心化身份(DID)连接流程。它为登录、认证和个人资料请求等操作提供了用户友好的界面,并开箱即用地支持多种连接方式。
|
|
4
|
-
|
|
5
|
-
它作为 `@arcblock/did-connect-react` 库的视觉核心,抽象了会话管理和实时状态更新的复杂性。该组件为 DID Wallet 用户显示二维码,并提供其他登录选项,如社交登录(OAuth)和无密码认证(Passkeys)。
|
|
6
|
-
|
|
7
|
-
在使用 `DidConnect` 之前,请确保已使用 [`SessionProvider`](./core-components-session-provider.md) 包裹您的应用程序,以管理整体会话状态。
|
|
8
|
-
|
|
9
|
-
## 基本用法
|
|
10
|
-
|
|
11
|
-
要使用 `DidConnect`,您需要导入它并提供一些必要的 props。该组件通常由一个决定其可见性的状态变量控制。
|
|
12
|
-
|
|
13
|
-
```jsx DID Connect 示例 icon=logos:react
|
|
14
|
-
import React, { useState } from 'react';
|
|
15
|
-
import axios from 'axios';
|
|
16
|
-
import DidConnect from '@arcblock/did-connect-react/lib/Connect';
|
|
17
|
-
|
|
18
|
-
function App() {
|
|
19
|
-
const [isConnectOpen, setConnectOpen] = useState(false);
|
|
20
|
-
|
|
21
|
-
const handleClose = () => setConnectOpen(false);
|
|
22
|
-
const handleSuccess = () => {
|
|
23
|
-
// 处理成功登录,例如,重定向用户
|
|
24
|
-
window.location.href = '/profile';
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div>
|
|
29
|
-
<button onClick={() => setConnectOpen(true)}>Login with DID</button>
|
|
30
|
-
{isConnectOpen && (
|
|
31
|
-
<DidConnect
|
|
32
|
-
action="login"
|
|
33
|
-
checkFn={axios.get}
|
|
34
|
-
onClose={handleClose}
|
|
35
|
-
onSuccess={handleSuccess}
|
|
36
|
-
messages={{
|
|
37
|
-
title: 'Scan to Sign In',
|
|
38
|
-
scan: 'Scan QR code with your DID Wallet',
|
|
39
|
-
confirm: 'Confirm login on your DID Wallet',
|
|
40
|
-
success: 'You have successfully signed in!',
|
|
41
|
-
}}
|
|
42
|
-
/>
|
|
43
|
-
)}
|
|
44
|
-
</div>
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export default App;
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
在此示例中,点击 “Login with DID” 按钮会将 `isConnectOpen` 状态设置为 `true`,从而将 `DidConnect` 组件渲染为模态对话框。`checkFn` prop 至关重要,因为它是组件用于从您的后端轮询会话状态的函数。
|
|
52
|
-
|
|
53
|
-
## 工作原理
|
|
54
|
-
|
|
55
|
-
`DidConnect` 组件协调整个用户认证流程,从显示连接选项到处理最终的成功或错误状态。
|
|
56
|
-
|
|
57
|
-
<!-- DIAGRAM_IMAGE_START:flowchart:4:3:1765962229 -->
|
|
58
|
-

|
|
59
|
-
<!-- DIAGRAM_IMAGE_END -->
|
|
60
|
-
|
|
61
|
-
## 组件 Props
|
|
62
|
-
|
|
63
|
-
`DidConnect` 组件可通过其 props 进行高度配置。以下是可用选项的详细列表。
|
|
64
|
-
|
|
65
|
-
### 核心配置
|
|
66
|
-
|
|
67
|
-
这些 props 对于设置组件的基本功能至关重要。
|
|
68
|
-
|
|
69
|
-
<x-field-group>
|
|
70
|
-
<x-field data-name="action" data-type="string" data-required="true">
|
|
71
|
-
<x-field-desc markdown>定义连接的目的,例如 `login`、`claim`、`sign` 等。此字符串会传递给您的后端以确定所需的操作。</x-field-desc>
|
|
72
|
-
</x-field>
|
|
73
|
-
<x-field data-name="checkFn" data-type="function" data-required="true">
|
|
74
|
-
<x-field-desc markdown>用于向后端轮询会话状态更新的函数。它应该是一个能发起 API 请求的函数,例如 `axios.get`。</x-field-desc>
|
|
75
|
-
</x-field>
|
|
76
|
-
<x-field data-name="baseUrl" data-type="string" data-default="''">
|
|
77
|
-
<x-field-desc markdown>API 端点的基础 URL。如果您的 API 位于不同的域上,请在此处指定。</x-field-desc>
|
|
78
|
-
</x-field>
|
|
79
|
-
<x-field data-name="prefix" data-type="string" data-default="/api/did">
|
|
80
|
-
<x-field-desc markdown>您后端上 DID Connect API 端点的 URL 前缀。</x-field-desc>
|
|
81
|
-
</x-field>
|
|
82
|
-
</x-field-group>
|
|
83
|
-
|
|
84
|
-
### 行为控制
|
|
85
|
-
|
|
86
|
-
这些 props 控制连接过程的行为方式。
|
|
87
|
-
|
|
88
|
-
<x-field-group>
|
|
89
|
-
<x-field data-name="enabledConnectTypes" data-type="string[]" data-default='["web", "mobile", ...]'>
|
|
90
|
-
<x-field-desc markdown>一个字符串数组,用于指定要显示的连接方式。可能的值包括 `web`、`mobile`、`github`、`google`、`apple`、`passkey` 等。</x-field-desc>
|
|
91
|
-
</x-field>
|
|
92
|
-
<x-field data-name="passkeyBehavior" data-type="'none' | 'both' | 'only-existing' | 'only-new'" data-default="'none'">
|
|
93
|
-
<x-field-desc markdown>控制 Passkey 认证的行为。`none` 表示禁用,`both` 允许创建新密钥和使用现有密钥,`only-existing` 限制为仅使用现有密钥,而 `only-new` 强制创建新密钥。</x-field-desc>
|
|
94
|
-
</x-field>
|
|
95
|
-
<x-field data-name="allowWallet" data-type="boolean" data-default="true">
|
|
96
|
-
<x-field-desc markdown>如果为 `false`,二维码和移动钱包连接选项将被隐藏。</x-field-desc>
|
|
97
|
-
</x-field>
|
|
98
|
-
<x-field data-name="autoConnect" data-type="boolean" data-default="true">
|
|
99
|
-
<x-field-desc markdown>如果为 `true`,组件将自动尝试使用来自同一设备的先前建立的连接。</x-field-desc>
|
|
100
|
-
</x-field>
|
|
101
|
-
<x-field data-name="forceConnected" data-type="boolean | string" data-default="true">
|
|
102
|
-
<x-field-desc markdown>如果为 `true`,用户必须使用与他们已登录的 DID 相同的 DID 进行连接。如果提供了 DID 字符串,则用户必须使用该特定的 DID 进行连接。</x-field-desc>
|
|
103
|
-
</x-field>
|
|
104
|
-
<x-field data-name="saveConnect" data-type="boolean" data-default="true">
|
|
105
|
-
<x-field-desc markdown>如果为 `true`,成功的连接信息将保存在本地,以供将来的 `autoConnect` 尝试使用。</x-field-desc>
|
|
106
|
-
</x-field>
|
|
107
|
-
<x-field data-name="useSocket" data-type="boolean" data-default="true">
|
|
108
|
-
<x-field-desc markdown>如果为 `true`,则尝试使用 WebSocket 进行实时状态更新,如果无法建立连接,则回退到轮询。</x-field-desc>
|
|
109
|
-
</x-field>
|
|
110
|
-
</x-field-group>
|
|
111
|
-
|
|
112
|
-
### UI 自定义
|
|
113
|
-
|
|
114
|
-
自定义 `DidConnect` 组件的外观和文本。
|
|
115
|
-
|
|
116
|
-
<x-field-group>
|
|
117
|
-
<x-field data-name="mode" data-type="'dialog' | 'drawer' | 'page'" data-default="'dialog'">
|
|
118
|
-
<x-field-desc markdown>确定组件的显示方式。`dialog` 将其显示为居中模态框,`drawer` 显示为底部抽屉(在移动设备上),而 `page` 将其直接嵌入到文档流中。</x-field-desc>
|
|
119
|
-
</x-field>
|
|
120
|
-
<x-field data-name="messages" data-type="object">
|
|
121
|
-
<x-field-desc markdown>一个用于自定义 UI 中显示的文本的对象。</x-field-desc>
|
|
122
|
-
<x-field data-name="title" data-type="string" data-desc="顶部的主标题。"></x-field>
|
|
123
|
-
<x-field data-name="scan" data-type="string" data-desc="标题下方的说明性文本。"></x-field>
|
|
124
|
-
<x-field data-name="confirm" data-type="string" data-desc="扫描二维码后显示的文本。"></x-field>
|
|
125
|
-
<x-field data-name="success" data-type="string | ReactNode" data-desc="连接成功时显示的消息。"></x-field>
|
|
126
|
-
<x-field data-name="error" data-type="string" data-desc="发生错误时显示的消息。"></x-field>
|
|
127
|
-
</x-field>
|
|
128
|
-
<x-field data-name="hideCloseButton" data-type="boolean" data-default="false">
|
|
129
|
-
<x-field-desc markdown>如果为 `true`,右上角的关闭按钮(X)将被隐藏。</x-field-desc>
|
|
130
|
-
</x-field>
|
|
131
|
-
<x-field data-name="extraContent" data-type="ReactNode" data-default="null">
|
|
132
|
-
<x-field-desc markdown>允许您向 UI 中注入自定义的 React 组件或元素,通常显示在主标题/描述下方。</x-field-desc>
|
|
133
|
-
</x-field>
|
|
134
|
-
<x-field data-name="customItems" data-type="ReactNode[]" data-default="[]">
|
|
135
|
-
<x-field-desc markdown>一个自定义 React 节点数组,将被添加到连接方式列表中。</x-field-desc>
|
|
136
|
-
</x-field>
|
|
137
|
-
<x-field data-name="disableSwitchApp" data-type="boolean" data-default="false">
|
|
138
|
-
<x-field-desc markdown>如果您正在使用统一登录站点群,此 prop 会阻止用户在登录过程中在站点群中的不同应用程序之间切换。</x-field-desc>
|
|
139
|
-
</x-field>
|
|
140
|
-
<x-field data-name="webWalletUrl" data-type="string">
|
|
141
|
-
<x-field-desc markdown>用于“使用网页钱包连接”选项的基于 Web 的 DID Wallet 的 URL。默认为官方的 ArcBlock 网页钱包。</x-field-desc>
|
|
142
|
-
</x-field>
|
|
143
|
-
</x-field-group>
|
|
144
|
-
|
|
145
|
-
### 回调
|
|
146
|
-
|
|
147
|
-
在连接生命周期的不同阶段调用的函数。
|
|
148
|
-
|
|
149
|
-
<x-field-group>
|
|
150
|
-
<x-field data-name="onClose" data-type="function" data-required="true">
|
|
151
|
-
<x-field-desc markdown>当用户关闭 `DidConnect` 对话框时(例如,通过点击关闭按钮或模态框外部)执行的回调函数。</x-field-desc>
|
|
152
|
-
</x-field>
|
|
153
|
-
<x-field data-name="onSuccess" data-type="function" data-required="true">
|
|
154
|
-
<x-field-desc markdown>连接成功后执行的回调函数。会话数据作为参数传递。</x-field-desc>
|
|
155
|
-
</x-field>
|
|
156
|
-
<x-field data-name="onError" data-type="function">
|
|
157
|
-
<x-field-desc markdown>在此过程中发生错误时执行的回调函数。错误对象或消息作为参数传递。</x-field-desc>
|
|
158
|
-
</x-field>
|
|
159
|
-
<x-field data-name="onRecreateSession" data-type="function">
|
|
160
|
-
<x-field-desc markdown>当会话需要重置时(例如,在超时后或用户手动取消并重试时)调用的回调函数。</x-field-desc>
|
|
161
|
-
</x-field>
|
|
162
|
-
</x-field-group>
|
|
163
|
-
|
|
164
|
-
## 后续步骤
|
|
165
|
-
|
|
166
|
-
在对 `DidConnect` 组件有了扎实的理解之后,您现在可以构建稳健的认证体验。要对连接 UI 进行更多的程序化控制,请探索 [`useConnect` hook](./hooks-use-connect.md),它允许您从应用程序的任何位置打开和关闭 `DidConnect` 模态框。
|