@authing/react-ui-components 2.4.56-alpha.0 → 2.4.58
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/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +0 -9
- package/package.json +3 -3
- package/src/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +1 -3
- package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +3 -3
- package/src/components/AuthingGuard/GuardLayout/index.tsx +1 -6
- package/src/components/AuthingGuard/LoginLayout/index.tsx +23 -67
- package/src/components/AuthingGuard/api/appConfig.ts +2 -3
- package/src/components/AuthingGuard/api/userPoolConfig.ts +0 -2
- package/src/components/AuthingGuard/types/Forms.ts +0 -1
- package/src/components/AuthingGuard/types/GuardConfig.ts +0 -1
- package/src/index.tsx +5 -16
- package/lib/index.d.ts +0 -1241
|
@@ -4,15 +4,6 @@
|
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/**
|
|
8
|
-
* @license
|
|
9
|
-
* Lodash <https://lodash.com/>
|
|
10
|
-
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
11
|
-
* Released under MIT license <https://lodash.com/license>
|
|
12
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
13
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
7
|
/** @license React v16.13.1
|
|
17
8
|
* react-is.production.min.js
|
|
18
9
|
*
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authing/react-ui-components",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.58",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/index.min.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"antd": "^4.8.0",
|
|
9
|
-
"authing-js-sdk": "4.22.
|
|
9
|
+
"authing-js-sdk": "4.22.24-alpha",
|
|
10
10
|
"qs": "^6.9.4"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
@@ -185,5 +185,5 @@
|
|
|
185
185
|
"webpack-manifest-plugin": "2.2.0",
|
|
186
186
|
"workbox-webpack-plugin": "5.1.4"
|
|
187
187
|
},
|
|
188
|
-
"gitHead": "
|
|
188
|
+
"gitHead": "48a69edc8fd200848c6ffc28e0c8da74ab7c16f7"
|
|
189
189
|
}
|
|
@@ -14,7 +14,6 @@ export const QrCodeLoginForm: FC<QrLoginFormProps> = ({
|
|
|
14
14
|
onFail,
|
|
15
15
|
onSuccess,
|
|
16
16
|
type,
|
|
17
|
-
idpId,
|
|
18
17
|
}) => {
|
|
19
18
|
const {
|
|
20
19
|
state: { authClient, config },
|
|
@@ -32,7 +31,6 @@ export const QrCodeLoginForm: FC<QrLoginFormProps> = ({
|
|
|
32
31
|
|
|
33
32
|
useEffect(() => {
|
|
34
33
|
client.startScanning('authingGuardQrcode', {
|
|
35
|
-
extIdpConnId: idpId,
|
|
36
34
|
autoExchangeUserInfo: true,
|
|
37
35
|
...config.qrCodeScanOptions,
|
|
38
36
|
onStart(timer) {
|
|
@@ -48,7 +46,7 @@ export const QrCodeLoginForm: FC<QrLoginFormProps> = ({
|
|
|
48
46
|
},
|
|
49
47
|
})
|
|
50
48
|
return () => clearInterval(timerRef.current)
|
|
51
|
-
}, [client, config.qrCodeScanOptions,
|
|
49
|
+
}, [client, config.qrCodeScanOptions, onFail, onSuccess])
|
|
52
50
|
|
|
53
51
|
return (
|
|
54
52
|
<div className="authing-guard-qr-form">
|
|
@@ -218,7 +218,7 @@ export const SocialAndIdpLogin: FC<SocialAndIdpLoginProps> = ({
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
const onLogin = () => {
|
|
221
|
-
authClient.social.authorize(item.
|
|
221
|
+
authClient.social.authorize(item.provider, {
|
|
222
222
|
onSuccess(user) {
|
|
223
223
|
onSuccess(user)
|
|
224
224
|
},
|
|
@@ -254,12 +254,12 @@ export const SocialAndIdpLogin: FC<SocialAndIdpLoginProps> = ({
|
|
|
254
254
|
}
|
|
255
255
|
onClick={onLogin}
|
|
256
256
|
>
|
|
257
|
-
{item.tooltip?.[i18n.language as Lang] || item.
|
|
257
|
+
{item.tooltip?.[i18n.language as Lang] || item.name}
|
|
258
258
|
</Button>
|
|
259
259
|
) : (
|
|
260
260
|
<Tooltip
|
|
261
261
|
key={item.provider}
|
|
262
|
-
title={item.tooltip?.[i18n.language as Lang] || item.
|
|
262
|
+
title={item.tooltip?.[i18n.language as Lang] || item.name}
|
|
263
263
|
>
|
|
264
264
|
<div className="authing-social-login-item" onClick={onLogin}>
|
|
265
265
|
<IconFont type={iconType} />
|
|
@@ -157,7 +157,7 @@ const useGuardConfig = () => {
|
|
|
157
157
|
defaultGuardConfig.loginMethods
|
|
158
158
|
|
|
159
159
|
// 扫码多源配置
|
|
160
|
-
const qrcodeTabsSettings = appConfig.qrcodeTabsSettings
|
|
160
|
+
const qrcodeTabsSettings = appConfig.qrcodeTabsSettings
|
|
161
161
|
|
|
162
162
|
// 账密登录的登录拆分
|
|
163
163
|
const passwordLoginMethods =
|
|
@@ -171,8 +171,6 @@ const useGuardConfig = () => {
|
|
|
171
171
|
appConfig.loginTabs?.default ||
|
|
172
172
|
defaultGuardConfig.defaultLoginMethod
|
|
173
173
|
|
|
174
|
-
const loginMethodTitleMapping = appConfig.loginTabs?.title
|
|
175
|
-
|
|
176
174
|
// 注册方式
|
|
177
175
|
const registerMethods =
|
|
178
176
|
userConfig.registerMethods ||
|
|
@@ -241,15 +239,12 @@ const useGuardConfig = () => {
|
|
|
241
239
|
qrcodeTabsSettings,
|
|
242
240
|
agreementEnabled: appConfig.agreementEnabled,
|
|
243
241
|
agreements: appConfig.agreements,
|
|
244
|
-
loginMethodTitleMapping: loginMethodTitleMapping,
|
|
245
242
|
}
|
|
246
243
|
)
|
|
247
244
|
}, [
|
|
248
245
|
userConfig,
|
|
249
246
|
appConfig.loginTabs?.list,
|
|
250
|
-
appConfig.loginTabs?.defaultV2,
|
|
251
247
|
appConfig.loginTabs?.default,
|
|
252
|
-
appConfig.loginTabs?.title,
|
|
253
248
|
appConfig.qrcodeTabsSettings,
|
|
254
249
|
appConfig.passwordTabConfig?.enabledLoginMethods,
|
|
255
250
|
appConfig.registerTabs?.list,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { message } from 'antd'
|
|
2
2
|
import { User } from 'authing-js-sdk'
|
|
3
3
|
import { FormInstance } from 'antd/lib/form'
|
|
4
|
-
import React, { useCallback,
|
|
4
|
+
import React, { useCallback, useRef } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useGuardContext } from '../../../context/global/context'
|
|
7
7
|
import {
|
|
@@ -75,36 +75,36 @@ const useNormalLoginTabs = ({ onSuccess, onFail }: BaseFormProps) => {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
const LOGIN_FORM_MAP = {
|
|
78
|
-
[LoginMethods.Password]: (
|
|
78
|
+
[LoginMethods.Password]: (
|
|
79
79
|
<PasswordLoginForm
|
|
80
|
-
{...
|
|
80
|
+
{...formProps}
|
|
81
81
|
ref={(v) => (formRef.current[LoginMethods.Password] = v!)}
|
|
82
82
|
/>
|
|
83
83
|
),
|
|
84
|
-
[LoginMethods.PhoneCode]: (
|
|
84
|
+
[LoginMethods.PhoneCode]: (
|
|
85
85
|
<PhoneCodeLoginForm
|
|
86
|
-
{...
|
|
86
|
+
{...formProps}
|
|
87
87
|
ref={(v) => (formRef.current[LoginMethods.PhoneCode] = v!)}
|
|
88
88
|
/>
|
|
89
89
|
),
|
|
90
|
-
[LoginMethods.AppQr]: (
|
|
91
|
-
<QrCodeLoginForm type={LoginMethods.AppQr} {...
|
|
90
|
+
[LoginMethods.AppQr]: (
|
|
91
|
+
<QrCodeLoginForm type={LoginMethods.AppQr} {...formProps} />
|
|
92
92
|
),
|
|
93
|
-
[LoginMethods.WxMinQr]: (
|
|
94
|
-
<QrCodeLoginForm type={LoginMethods.WxMinQr} {...
|
|
93
|
+
[LoginMethods.WxMinQr]: (
|
|
94
|
+
<QrCodeLoginForm type={LoginMethods.WxMinQr} {...formProps} />
|
|
95
95
|
),
|
|
96
|
-
[LoginMethods.LDAP]: (
|
|
96
|
+
[LoginMethods.LDAP]: (
|
|
97
97
|
<LdapLoginForm
|
|
98
|
-
{...
|
|
98
|
+
{...formProps}
|
|
99
99
|
ref={(v) => (formRef.current[LoginMethods.LDAP] = v!)}
|
|
100
100
|
/>
|
|
101
101
|
),
|
|
102
|
-
[LoginMethods.WechatMpQrcode]: (
|
|
103
|
-
<QrCodeLoginForm type={LoginMethods.WechatMpQrcode} {...
|
|
102
|
+
[LoginMethods.WechatMpQrcode]: (
|
|
103
|
+
<QrCodeLoginForm type={LoginMethods.WechatMpQrcode} {...formProps} />
|
|
104
104
|
),
|
|
105
|
-
[LoginMethods.AD]: (
|
|
105
|
+
[LoginMethods.AD]: (
|
|
106
106
|
<ADLoginForm
|
|
107
|
-
{...
|
|
107
|
+
{...formProps}
|
|
108
108
|
ref={(v) => (formRef.current[LoginMethods.AD] = v!)}
|
|
109
109
|
/>
|
|
110
110
|
),
|
|
@@ -113,46 +113,14 @@ const useNormalLoginTabs = ({ onSuccess, onFail }: BaseFormProps) => {
|
|
|
113
113
|
const {
|
|
114
114
|
state: { config },
|
|
115
115
|
} = useGuardContext()
|
|
116
|
-
const {
|
|
117
|
-
loginMethods = [],
|
|
118
|
-
loginMethodTitleMapping,
|
|
119
|
-
qrcodeTabsSettings,
|
|
120
|
-
} = config
|
|
116
|
+
const { loginMethods = [] } = config
|
|
121
117
|
|
|
122
|
-
|
|
118
|
+
const tabs = loginMethods.map((item) => ({
|
|
119
|
+
key: item,
|
|
120
|
+
label: LOGIN_METHODS_MAP()?.[item]!,
|
|
121
|
+
component: LOGIN_FORM_MAP[item],
|
|
122
|
+
}))
|
|
123
123
|
|
|
124
|
-
// 兼容 密码登陆 donglyc
|
|
125
|
-
let filterLoginMethods = loginMethods.filter(
|
|
126
|
-
(d) => d.indexOf('password') === -1
|
|
127
|
-
)
|
|
128
|
-
const hasPassword = loginMethods.some((d) => d.indexOf('password') !== -1)
|
|
129
|
-
if (hasPassword) filterLoginMethods.push(LoginMethods.Password)
|
|
130
|
-
|
|
131
|
-
filterLoginMethods.forEach((method: LoginMethods) => {
|
|
132
|
-
if (
|
|
133
|
-
[LoginMethods.WechatMpQrcode, LoginMethods.WxMinQr].includes(method) &&
|
|
134
|
-
qrcodeTabsSettings[method]
|
|
135
|
-
) {
|
|
136
|
-
tabs.push(
|
|
137
|
-
...qrcodeTabsSettings[method].map((idp) => {
|
|
138
|
-
return {
|
|
139
|
-
key: idp.id,
|
|
140
|
-
label: idp.title || loginMethodTitleMapping[method],
|
|
141
|
-
component: LOGIN_FORM_MAP[method]({
|
|
142
|
-
...formProps,
|
|
143
|
-
idp,
|
|
144
|
-
}),
|
|
145
|
-
}
|
|
146
|
-
})
|
|
147
|
-
)
|
|
148
|
-
} else {
|
|
149
|
-
tabs.push({
|
|
150
|
-
key: method,
|
|
151
|
-
label: LOGIN_METHODS_MAP()[method],
|
|
152
|
-
component: LOGIN_FORM_MAP[method](formProps),
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
124
|
return {
|
|
157
125
|
tabs,
|
|
158
126
|
}
|
|
@@ -165,25 +133,13 @@ const SHOW_SOCIAL_LOGIN_TAB = [
|
|
|
165
133
|
]
|
|
166
134
|
export const LoginLayout = () => {
|
|
167
135
|
const {
|
|
168
|
-
state: { activeTabs
|
|
136
|
+
state: { activeTabs },
|
|
169
137
|
setValue,
|
|
170
138
|
} = useGuardContext()
|
|
171
|
-
const { qrcodeTabsSettings } = config
|
|
172
139
|
|
|
173
140
|
const { onFail, onSuccess } = useFormActions()
|
|
174
141
|
const { tabs } = useNormalLoginTabs({ onSuccess, onFail })
|
|
175
142
|
|
|
176
|
-
const activeKey = useMemo(() => {
|
|
177
|
-
const activeTab = activeTabs[GuardScenes.Login]
|
|
178
|
-
if (
|
|
179
|
-
[LoginMethods.WechatMpQrcode, LoginMethods.WxMinQr].includes(activeTab) &&
|
|
180
|
-
qrcodeTabsSettings[activeTab]
|
|
181
|
-
) {
|
|
182
|
-
return qrcodeTabsSettings[activeTab].find((item) => item.isDefault)?.id
|
|
183
|
-
}
|
|
184
|
-
return activeTab
|
|
185
|
-
}, [activeTabs, qrcodeTabsSettings])
|
|
186
|
-
|
|
187
143
|
return (
|
|
188
144
|
<>
|
|
189
145
|
<AuthingTabs
|
|
@@ -194,7 +150,7 @@ export const LoginLayout = () => {
|
|
|
194
150
|
[GuardScenes.Login]: t,
|
|
195
151
|
})
|
|
196
152
|
}
|
|
197
|
-
activeKey={
|
|
153
|
+
activeKey={activeTabs[GuardScenes.Login]}
|
|
198
154
|
/>
|
|
199
155
|
|
|
200
156
|
{SHOW_SOCIAL_LOGIN_TAB.includes(activeTabs[GuardScenes.Login]) && (
|
|
@@ -31,11 +31,11 @@ export const ApplicationMfaTypeLabel: () => Record<
|
|
|
31
31
|
|
|
32
32
|
export type QrcodeTabsSettings = Record<
|
|
33
33
|
LoginMethods,
|
|
34
|
-
|
|
34
|
+
{
|
|
35
35
|
id: string
|
|
36
36
|
title: string
|
|
37
37
|
isDefault?: boolean
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
>
|
|
40
40
|
|
|
41
41
|
export interface OidcClientMetadata {
|
|
@@ -102,7 +102,6 @@ export interface ApplicationConfig {
|
|
|
102
102
|
loginTabs: {
|
|
103
103
|
list: string[]
|
|
104
104
|
default: string
|
|
105
|
-
defaultV2?: string
|
|
106
105
|
title: { [x: string]: string }
|
|
107
106
|
}
|
|
108
107
|
socialConnections: SocialConnectionItem[]
|
|
@@ -72,10 +72,8 @@ export interface ICasConnectionConfig {
|
|
|
72
72
|
}
|
|
73
73
|
export interface SocialConnectionItem {
|
|
74
74
|
name: string
|
|
75
|
-
displayName: string
|
|
76
75
|
logo: string
|
|
77
76
|
description: string
|
|
78
|
-
identifier: string
|
|
79
77
|
provider: SocialConnectionProvider
|
|
80
78
|
authorizationUrl: string
|
|
81
79
|
tooltip: Record<Lang, string>
|
|
@@ -27,7 +27,6 @@ export interface LdapLoginFormProps extends BaseFormProps {
|
|
|
27
27
|
|
|
28
28
|
export interface QrLoginFormProps extends BaseFormProps {
|
|
29
29
|
type: LoginMethods.AppQr | LoginMethods.WxMinQr | LoginMethods.WechatMpQrcode
|
|
30
|
-
idpId?: string
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
export interface EmailRegisterFormProps extends BaseFormProps {
|
|
@@ -413,7 +413,6 @@ export interface GuardConfig extends UserConfig {
|
|
|
413
413
|
publicKey: ApplicationConfig['publicKey']
|
|
414
414
|
agreementEnabled: boolean
|
|
415
415
|
agreements: Agreement[]
|
|
416
|
-
loginMethodTitleMapping: Record<string, string>
|
|
417
416
|
qrcodeTabsSettings: QrcodeTabsSettings
|
|
418
417
|
}
|
|
419
418
|
|
package/src/index.tsx
CHANGED
|
@@ -4,8 +4,6 @@ import ReactDOM from 'react-dom'
|
|
|
4
4
|
import { Lang } from './components'
|
|
5
5
|
import { AuthingGuard } from './components/AuthingGuard'
|
|
6
6
|
|
|
7
|
-
import { SocialConnectionProvider } from 'authing-js-sdk'
|
|
8
|
-
|
|
9
7
|
import {
|
|
10
8
|
GuardMode,
|
|
11
9
|
// LoginMethods,
|
|
@@ -23,9 +21,8 @@ const App = () => {
|
|
|
23
21
|
|
|
24
22
|
const config: UserConfig = {
|
|
25
23
|
mode: GuardMode.Modal,
|
|
26
|
-
|
|
27
|
-
apiHost: 'http://console.authing.localhost:3000',
|
|
28
|
-
// appHost: 'http://0w9ugz.authing.localhost:3000',
|
|
24
|
+
appHost: 'https://core.dev2.authing-inc.co/',
|
|
25
|
+
// apiHost: 'http://console.authing.localhost:3000',
|
|
29
26
|
// apiHost: 'http://192.168.50.57:3000',
|
|
30
27
|
// loginMethods: Object.values(LoginMethods),
|
|
31
28
|
// logo:
|
|
@@ -56,7 +53,7 @@ const App = () => {
|
|
|
56
53
|
// }
|
|
57
54
|
// `,
|
|
58
55
|
// // autoRegister: true,
|
|
59
|
-
socialConnections: [
|
|
56
|
+
// socialConnections: [SocialConnections.AppleWeb],
|
|
60
57
|
}
|
|
61
58
|
|
|
62
59
|
const [visible, setVisible] = useState(false)
|
|
@@ -73,14 +70,6 @@ const App = () => {
|
|
|
73
70
|
return (
|
|
74
71
|
// eslint-disable-next-line react/jsx-no-undef
|
|
75
72
|
<>
|
|
76
|
-
<Button
|
|
77
|
-
type="primary"
|
|
78
|
-
onClick={() => {
|
|
79
|
-
//
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
add socialConnections
|
|
83
|
-
</Button>
|
|
84
73
|
<Button
|
|
85
74
|
type="primary"
|
|
86
75
|
onClick={() => {
|
|
@@ -125,8 +114,8 @@ const App = () => {
|
|
|
125
114
|
}}
|
|
126
115
|
// onLoad={(a) => console.log(a, '加载完成')}
|
|
127
116
|
// onPwdResetError={(e) => console.log(e)}
|
|
128
|
-
appId="
|
|
129
|
-
|
|
117
|
+
appId="6191cf610f772aa56dc70637"
|
|
118
|
+
tenantId="6194a41abf23c1d5268b362a"
|
|
130
119
|
// appId="5fd877fb0ba0421962eced94"
|
|
131
120
|
config={config}
|
|
132
121
|
/>
|