@authing/react-ui-components 2.4.55-alpha.2 → 2.4.55-alpha.6
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.d.ts +1241 -0
- package/lib/index.min.css +1 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +9 -0
- package/package.json +2 -2
- package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +3 -3
- package/src/components/AuthingGuard/GuardLayout/index.tsx +6 -1
- package/src/components/AuthingGuard/LoginLayout/index.tsx +50 -42
- package/src/components/AuthingGuard/api/appConfig.ts +17 -1
- package/src/components/AuthingGuard/api/userPoolConfig.ts +2 -0
- package/src/components/AuthingGuard/style.less +1 -0
- package/src/components/AuthingGuard/types/GuardConfig.ts +2 -0
- package/src/index.tsx +1 -1
- package/yarn-error.log +5860 -5105
- package/build/asset-manifest.json +0 -25
- package/build/favicon.ico +0 -0
- package/build/index.html +0 -1
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/build/static/css/2.e5f4a1ca.chunk.css +0 -2
- package/build/static/css/2.e5f4a1ca.chunk.css.map +0 -1
- package/build/static/css/main.4dd73333.chunk.css +0 -2
- package/build/static/css/main.4dd73333.chunk.css.map +0 -1
- package/build/static/js/2.b28e1968.chunk.js +0 -3
- package/build/static/js/2.b28e1968.chunk.js.LICENSE.txt +0 -70
- package/build/static/js/2.b28e1968.chunk.js.map +0 -1
- package/build/static/js/3.584da164.chunk.js +0 -2
- package/build/static/js/3.584da164.chunk.js.map +0 -1
- package/build/static/js/main.eeb41586.chunk.js +0 -2
- package/build/static/js/main.eeb41586.chunk.js.map +0 -1
- package/build/static/js/runtime-main.6174f3e9.js +0 -2
- package/build/static/js/runtime-main.6174f3e9.js.map +0 -1
|
@@ -4,6 +4,15 @@
|
|
|
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
|
+
|
|
7
16
|
/** @license React v16.13.1
|
|
8
17
|
* react-is.production.min.js
|
|
9
18
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authing/react-ui-components",
|
|
3
|
-
"version": "2.4.55-alpha.
|
|
3
|
+
"version": "2.4.55-alpha.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "lib/index.min.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -185,4 +185,4 @@
|
|
|
185
185
|
"webpack-manifest-plugin": "2.2.0",
|
|
186
186
|
"workbox-webpack-plugin": "5.1.4"
|
|
187
187
|
}
|
|
188
|
-
}
|
|
188
|
+
}
|
|
@@ -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.identifier, {
|
|
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.displayName}
|
|
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.displayName}
|
|
263
263
|
>
|
|
264
264
|
<div className="authing-social-login-item" onClick={onLogin}>
|
|
265
265
|
<IconFont type={iconType} />
|
|
@@ -156,6 +156,9 @@ const useGuardConfig = () => {
|
|
|
156
156
|
appConfig.loginTabs?.list ||
|
|
157
157
|
defaultGuardConfig.loginMethods
|
|
158
158
|
|
|
159
|
+
// 扫码多源配置
|
|
160
|
+
const qrcodeTabsSettings = appConfig.qrcodeTabsSettings ?? {}
|
|
161
|
+
|
|
159
162
|
// 账密登录的登录拆分
|
|
160
163
|
const passwordLoginMethods =
|
|
161
164
|
userConfig.passwordLoginMethods ||
|
|
@@ -165,7 +168,6 @@ const useGuardConfig = () => {
|
|
|
165
168
|
// 默认登录方式
|
|
166
169
|
const defaultLoginMethod =
|
|
167
170
|
userConfig.defaultLoginMethod ||
|
|
168
|
-
appConfig.loginTabs?.defaultV2 ||
|
|
169
171
|
appConfig.loginTabs?.default ||
|
|
170
172
|
defaultGuardConfig.defaultLoginMethod
|
|
171
173
|
|
|
@@ -236,6 +238,7 @@ const useGuardConfig = () => {
|
|
|
236
238
|
defaultRegisterMethod,
|
|
237
239
|
enterpriseConnectionObjs,
|
|
238
240
|
publicKey: appConfig.publicKey,
|
|
241
|
+
qrcodeTabsSettings,
|
|
239
242
|
agreementEnabled: appConfig.agreementEnabled,
|
|
240
243
|
agreements: appConfig.agreements,
|
|
241
244
|
loginMethodTitleMapping: loginMethodTitleMapping,
|
|
@@ -244,8 +247,10 @@ const useGuardConfig = () => {
|
|
|
244
247
|
}, [
|
|
245
248
|
userConfig,
|
|
246
249
|
appConfig.loginTabs?.list,
|
|
250
|
+
appConfig.loginTabs?.defaultV2,
|
|
247
251
|
appConfig.loginTabs?.default,
|
|
248
252
|
appConfig.loginTabs?.title,
|
|
253
|
+
appConfig.qrcodeTabsSettings,
|
|
249
254
|
appConfig.passwordTabConfig?.enabledLoginMethods,
|
|
250
255
|
appConfig.registerTabs?.list,
|
|
251
256
|
appConfig.registerTabs?.default,
|
|
@@ -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, useRef } from 'react'
|
|
4
|
+
import React, { useCallback, useMemo, useRef } from 'react'
|
|
5
5
|
|
|
6
6
|
import { useGuardContext } from '../../../context/global/context'
|
|
7
7
|
import {
|
|
@@ -113,39 +113,40 @@ const useNormalLoginTabs = ({ onSuccess, onFail }: BaseFormProps) => {
|
|
|
113
113
|
const {
|
|
114
114
|
state: { config },
|
|
115
115
|
} = useGuardContext()
|
|
116
|
-
const {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
const {
|
|
117
|
+
loginMethods = [],
|
|
118
|
+
loginMethodTitleMapping,
|
|
119
|
+
qrcodeTabsSettings,
|
|
120
|
+
} = config
|
|
121
|
+
|
|
122
|
+
let tabs: any[] = []
|
|
123
|
+
|
|
124
|
+
loginMethods.forEach((method: LoginMethods) => {
|
|
125
|
+
if (
|
|
126
|
+
[LoginMethods.WechatMpQrcode, LoginMethods.WxMinQr].includes(method) &&
|
|
127
|
+
qrcodeTabsSettings[method]
|
|
128
|
+
) {
|
|
129
|
+
tabs.push(
|
|
130
|
+
...qrcodeTabsSettings[method].map((idp) => {
|
|
131
|
+
console.log(idp)
|
|
132
|
+
return {
|
|
133
|
+
key: idp.id,
|
|
134
|
+
label: idp.title || loginMethodTitleMapping[method],
|
|
135
|
+
component: LOGIN_FORM_MAP[method]({
|
|
136
|
+
...formProps,
|
|
137
|
+
idp,
|
|
138
|
+
}),
|
|
139
|
+
}
|
|
140
|
+
})
|
|
124
141
|
)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
label: loginMethodTitleMapping[tab]!,
|
|
134
|
-
component: LOGIN_FORM_MAP[type]({
|
|
135
|
-
...formProps,
|
|
136
|
-
idpId: idpId,
|
|
137
|
-
}),
|
|
138
|
-
}
|
|
139
|
-
} else {
|
|
140
|
-
return {
|
|
141
|
-
key: tab,
|
|
142
|
-
label: LOGIN_METHODS_MAP()?.[tab]!,
|
|
143
|
-
component: LOGIN_FORM_MAP[tab](formProps),
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
})
|
|
147
|
-
.filter((i) => i !== undefined)
|
|
148
|
-
|
|
142
|
+
} else {
|
|
143
|
+
tabs.push({
|
|
144
|
+
key: method,
|
|
145
|
+
label: LOGIN_METHODS_MAP()[method],
|
|
146
|
+
component: LOGIN_FORM_MAP[method](formProps),
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
})
|
|
149
150
|
return {
|
|
150
151
|
tabs,
|
|
151
152
|
}
|
|
@@ -158,30 +159,37 @@ const SHOW_SOCIAL_LOGIN_TAB = [
|
|
|
158
159
|
]
|
|
159
160
|
export const LoginLayout = () => {
|
|
160
161
|
const {
|
|
161
|
-
state: { activeTabs },
|
|
162
|
+
state: { activeTabs, config },
|
|
162
163
|
setValue,
|
|
163
164
|
} = useGuardContext()
|
|
165
|
+
const { qrcodeTabsSettings } = config
|
|
164
166
|
|
|
165
167
|
const { onFail, onSuccess } = useFormActions()
|
|
166
168
|
const { tabs } = useNormalLoginTabs({ onSuccess, onFail })
|
|
167
169
|
|
|
170
|
+
const activeKey = useMemo(() => {
|
|
171
|
+
const activeTab = activeTabs[GuardScenes.Login]
|
|
172
|
+
if (
|
|
173
|
+
[LoginMethods.WechatMpQrcode, LoginMethods.WxMinQr].includes(activeTab) &&
|
|
174
|
+
qrcodeTabsSettings[activeTab]
|
|
175
|
+
) {
|
|
176
|
+
return qrcodeTabsSettings[activeTab].find((item) => item.isDefault)?.id
|
|
177
|
+
}
|
|
178
|
+
return activeTab
|
|
179
|
+
}, [activeTabs, qrcodeTabsSettings])
|
|
180
|
+
console.log(activeKey)
|
|
181
|
+
|
|
168
182
|
return (
|
|
169
183
|
<>
|
|
170
184
|
<AuthingTabs
|
|
171
|
-
tabs={
|
|
172
|
-
tabs as {
|
|
173
|
-
key: LoginMethods
|
|
174
|
-
label: string
|
|
175
|
-
component: JSX.Element
|
|
176
|
-
}[]
|
|
177
|
-
}
|
|
185
|
+
tabs={tabs}
|
|
178
186
|
onTabClick={(t) =>
|
|
179
187
|
setValue('activeTabs', {
|
|
180
188
|
...activeTabs,
|
|
181
189
|
[GuardScenes.Login]: t,
|
|
182
190
|
})
|
|
183
191
|
}
|
|
184
|
-
activeKey={
|
|
192
|
+
activeKey={activeKey}
|
|
185
193
|
/>
|
|
186
194
|
|
|
187
195
|
{SHOW_SOCIAL_LOGIN_TAB.includes(activeTabs[GuardScenes.Login]) && (
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { requestClient } from './http'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Lang,
|
|
4
|
+
LoginMethods,
|
|
5
|
+
Protocol,
|
|
6
|
+
} from '../../../components/AuthingGuard/types'
|
|
3
7
|
import {
|
|
4
8
|
IAzureAdConnectionConfig,
|
|
5
9
|
ICasConnectionConfig,
|
|
@@ -25,6 +29,15 @@ export const ApplicationMfaTypeLabel: () => Record<
|
|
|
25
29
|
[ApplicationMfaType.EMAIL]: i18n.t('common.EmailVerification'),
|
|
26
30
|
})
|
|
27
31
|
|
|
32
|
+
export type QrcodeTabsSettings = Record<
|
|
33
|
+
LoginMethods,
|
|
34
|
+
Array<{
|
|
35
|
+
id: string
|
|
36
|
+
title: string
|
|
37
|
+
isDefault?: boolean
|
|
38
|
+
}>
|
|
39
|
+
>
|
|
40
|
+
|
|
28
41
|
export interface OidcClientMetadata {
|
|
29
42
|
grant_types: string[]
|
|
30
43
|
client_id: string
|
|
@@ -83,6 +96,9 @@ export interface ApplicationConfig {
|
|
|
83
96
|
default: string
|
|
84
97
|
title: { [x: string]: string }
|
|
85
98
|
}
|
|
99
|
+
|
|
100
|
+
qrcodeTabsSettings: QrcodeTabsSettings
|
|
101
|
+
|
|
86
102
|
loginTabs: {
|
|
87
103
|
list: string[]
|
|
88
104
|
default: string
|
|
@@ -72,8 +72,10 @@ export interface ICasConnectionConfig {
|
|
|
72
72
|
}
|
|
73
73
|
export interface SocialConnectionItem {
|
|
74
74
|
name: string
|
|
75
|
+
displayName: string
|
|
75
76
|
logo: string
|
|
76
77
|
description: string
|
|
78
|
+
identifier: string
|
|
77
79
|
provider: SocialConnectionProvider
|
|
78
80
|
authorizationUrl: string
|
|
79
81
|
tooltip: Record<Lang, string>
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
ApplicationConfig,
|
|
14
14
|
PasswordLoginMethods,
|
|
15
15
|
Agreement,
|
|
16
|
+
QrcodeTabsSettings,
|
|
16
17
|
} from '../../../components/AuthingGuard/api'
|
|
17
18
|
import { Lang } from './Locales'
|
|
18
19
|
|
|
@@ -413,6 +414,7 @@ export interface GuardConfig extends UserConfig {
|
|
|
413
414
|
agreementEnabled: boolean
|
|
414
415
|
agreements: Agreement[]
|
|
415
416
|
loginMethodTitleMapping: Record<string, string>
|
|
417
|
+
qrcodeTabsSettings: QrcodeTabsSettings
|
|
416
418
|
}
|
|
417
419
|
|
|
418
420
|
export interface LocalesConfig {
|
package/src/index.tsx
CHANGED
|
@@ -115,7 +115,7 @@ const App = () => {
|
|
|
115
115
|
// onLoad={(a) => console.log(a, '加载完成')}
|
|
116
116
|
// onPwdResetError={(e) => console.log(e)}
|
|
117
117
|
appId="619c7976cd38c13a2222464f"
|
|
118
|
-
tenantId="
|
|
118
|
+
tenantId="61a5ed126cddae656cce9007"
|
|
119
119
|
// appId="5fd877fb0ba0421962eced94"
|
|
120
120
|
config={config}
|
|
121
121
|
/>
|