@authing/react-ui-components 3.0.0-alpha → 3.0.0-rc.3

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 (232) hide show
  1. package/lib/index.d.ts +781 -110
  2. package/lib/index.min.css +2 -2
  3. package/lib/index.min.js +1 -1
  4. package/lib/index.min.js.LICENSE.txt +2 -0
  5. package/package.json +34 -12
  6. package/.eslintignore +0 -6
  7. package/.eslintrc.js +0 -7
  8. package/.prettierrc +0 -5
  9. package/.vscode/settings.json +0 -31
  10. package/build/favicon.ico +0 -0
  11. package/build/logo192.png +0 -0
  12. package/build/logo512.png +0 -0
  13. package/build/manifest.json +0 -25
  14. package/build/robots.txt +0 -3
  15. package/components/AuthingDropdown/index.tsx +0 -52
  16. package/components/AuthingDropdown/style.less +0 -43
  17. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  18. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  19. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  20. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  21. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  22. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  23. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  24. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  25. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  26. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  27. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  28. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  29. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  30. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  31. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  32. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  33. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  34. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  35. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  36. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  37. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  38. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  39. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  40. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  41. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  42. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  43. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  44. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  45. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  46. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  47. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  48. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  49. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  50. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  51. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  52. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  53. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  54. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  55. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  56. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  57. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  58. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  59. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  60. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  61. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  62. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  63. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  64. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  65. package/components/AuthingGuard/Forms/index.ts +0 -13
  66. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  67. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  68. package/components/AuthingGuard/Header/index.tsx +0 -25
  69. package/components/AuthingGuard/Header/style.less +0 -52
  70. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  71. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  72. package/components/AuthingGuard/IconFont/style.less +0 -6
  73. package/components/AuthingGuard/IconFont/svg.js +0 -2
  74. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  75. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  76. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  77. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  78. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  79. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  80. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  81. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  82. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  83. package/components/AuthingGuard/api/appConfig.ts +0 -146
  84. package/components/AuthingGuard/api/index.ts +0 -3
  85. package/components/AuthingGuard/api/sso.ts +0 -29
  86. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  87. package/components/AuthingGuard/constants.ts +0 -105
  88. package/components/AuthingGuard/hooks/index.tsx +0 -70
  89. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  90. package/components/AuthingGuard/index.tsx +0 -126
  91. package/components/AuthingGuard/style.less +0 -103
  92. package/components/AuthingGuard/types/Forms.ts +0 -94
  93. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  94. package/components/AuthingGuard/types/GuardState.ts +0 -7
  95. package/components/AuthingGuard/types/Locales.ts +0 -12
  96. package/components/AuthingGuard/types/index.ts +0 -4
  97. package/components/AuthingTabs/index.tsx +0 -98
  98. package/components/AuthingTabs/style.less +0 -135
  99. package/components/BindTotp/core/bindSuccess.tsx +0 -61
  100. package/components/BindTotp/core/securityCode.tsx +0 -119
  101. package/components/BindTotp/index.tsx +0 -134
  102. package/components/BindTotp/props.ts +0 -30
  103. package/components/BindTotp/styles.less +0 -56
  104. package/components/ChangeLanguage/index.tsx +0 -35
  105. package/components/ChangePassword/core/firstLoginReset.tsx +0 -104
  106. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  107. package/components/ChangePassword/index.tsx +0 -59
  108. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  109. package/components/CompleteInfo/index.tsx +0 -45
  110. package/components/CompleteInfo/props.ts +0 -40
  111. package/components/CompleteInfo/styles.less +0 -7
  112. package/components/CompleteUserInfo/index.tsx +0 -49
  113. package/components/CompleteUserInfo/props.ts +0 -25
  114. package/components/ComponentsRender/index.back +0 -64
  115. package/components/CopyAbleText/index.tsx +0 -54
  116. package/components/CopyAbleText/style.less +0 -13
  117. package/components/DownloadAuthenticator/index.tsx +0 -97
  118. package/components/DownloadAuthenticator/props.ts +0 -22
  119. package/components/DownloadAuthenticator/styles.less +0 -52
  120. package/components/ForgetPassword/core/resetPassword.tsx +0 -150
  121. package/components/ForgetPassword/index.tsx +0 -51
  122. package/components/Guard/Guard.tsx +0 -226
  123. package/components/Guard/authClient.ts +0 -55
  124. package/components/Guard/config.ts +0 -19
  125. package/components/Guard/event.ts +0 -18
  126. package/components/Guard/index.tsx +0 -10
  127. package/components/Guard/module.ts +0 -19
  128. package/components/Guard/stateMachine.ts +0 -133
  129. package/components/Guard/styles.less +0 -444
  130. package/components/IconFont/iconfont.js +0 -74
  131. package/components/IconFont/index.tsx +0 -16
  132. package/components/IconFont/style.less +0 -6
  133. package/components/IconFont/svg.js +0 -2
  134. package/components/ImagePro/index.tsx +0 -52
  135. package/components/ImagePro/styles.less +0 -40
  136. package/components/Login/codemap.ts +0 -35
  137. package/components/Login/core/withAD.tsx +0 -9
  138. package/components/Login/core/withAppQrcode.tsx +0 -49
  139. package/components/Login/core/withLDAP.tsx +0 -145
  140. package/components/Login/core/withPassword.tsx +0 -176
  141. package/components/Login/core/withPhonecode.tsx +0 -135
  142. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  143. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  144. package/components/Login/index.tsx +0 -359
  145. package/components/Login/props.ts +0 -90
  146. package/components/Login/socialLogin/index.tsx +0 -413
  147. package/components/Login/socialLogin/style.less +0 -61
  148. package/components/Login/styles.less +0 -53
  149. package/components/MFA/codemap.ts +0 -21
  150. package/components/MFA/core/email.tsx +0 -226
  151. package/components/MFA/core/face.tsx +0 -297
  152. package/components/MFA/core/face_deps.tsx +0 -37
  153. package/components/MFA/core/sms.tsx +0 -222
  154. package/components/MFA/core/totp.tsx +0 -137
  155. package/components/MFA/index.tsx +0 -135
  156. package/components/MFA/mfaMethods/index.tsx +0 -81
  157. package/components/MFA/mfaMethods/style.less +0 -39
  158. package/components/MFA/props.ts +0 -51
  159. package/components/MFA/styles.less +0 -92
  160. package/components/NeedHelpView/core/describeQuestions.tsx +0 -227
  161. package/components/NeedHelpView/index.tsx +0 -99
  162. package/components/RecoveryCode/core/useCode.tsx +0 -71
  163. package/components/RecoveryCode/index.tsx +0 -27
  164. package/components/RecoveryCode/interface.ts +0 -31
  165. package/components/RecoveryCode/style.less +0 -13
  166. package/components/Register/codemap.ts +0 -16
  167. package/components/Register/components/Agreements/index.tsx +0 -81
  168. package/components/Register/components/Agreements/style.less +0 -44
  169. package/components/Register/core/WithEmail.tsx +0 -250
  170. package/components/Register/core/WithPhone.tsx +0 -190
  171. package/components/Register/index.tsx +0 -122
  172. package/components/Register/props.ts +0 -50
  173. package/components/SendCode/SendCodeBtn.tsx +0 -96
  174. package/components/SendCode/index.tsx +0 -98
  175. package/components/SendCode/style.less +0 -31
  176. package/components/ShieldSpin/index.tsx +0 -27
  177. package/components/ShieldSpin/loading.svg +0 -29
  178. package/components/SubmitButton/index.tsx +0 -50
  179. package/components/Type/index.ts +0 -61
  180. package/components/VerifyCodeInput/index.tsx +0 -76
  181. package/components/VerifyCodeInput/style.less +0 -24
  182. package/components/_utils/GuardErrorCode.ts +0 -8
  183. package/components/_utils/clipboard.ts +0 -27
  184. package/components/_utils/config.ts +0 -123
  185. package/components/_utils/guradHttp.ts +0 -93
  186. package/components/_utils/hooks/index.ts +0 -56
  187. package/components/_utils/http.ts +0 -85
  188. package/components/_utils/index.ts +0 -310
  189. package/components/_utils/locales/en/common.json +0 -218
  190. package/components/_utils/locales/en/index.ts +0 -6
  191. package/components/_utils/locales/en/login.json +0 -95
  192. package/components/_utils/locales/en/map.json +0 -4
  193. package/components/_utils/locales/en/user.json +0 -82
  194. package/components/_utils/locales/index.ts +0 -45
  195. package/components/_utils/locales/zh/common.json +0 -218
  196. package/components/_utils/locales/zh/index.ts +0 -6
  197. package/components/_utils/locales/zh/login.json +0 -95
  198. package/components/_utils/locales/zh/map.json +0 -4
  199. package/components/_utils/locales/zh/user.json +0 -82
  200. package/components/_utils/popupCenter.ts +0 -48
  201. package/components/context/base.tsx +0 -28
  202. package/components/context/global/context.tsx +0 -39
  203. package/components/context/global/reducer.tsx +0 -56
  204. package/components/context/module/context.tsx +0 -23
  205. package/components/index.ts +0 -10
  206. package/config/antdReplacer.js +0 -51
  207. package/config/env.js +0 -104
  208. package/config/getHttpsConfig.js +0 -66
  209. package/config/jest/cssTransform.js +0 -14
  210. package/config/jest/fileTransform.js +0 -40
  211. package/config/modules.js +0 -134
  212. package/config/paths.js +0 -71
  213. package/config/pnpTs.js +0 -35
  214. package/config/webpack.config.js +0 -835
  215. package/config/webpackDevServer.config.js +0 -130
  216. package/examples.tsx +0 -100
  217. package/index.js +0 -1
  218. package/logo.svg +0 -7
  219. package/public/favicon.ico +0 -0
  220. package/public/index.html +0 -43
  221. package/public/logo192.png +0 -0
  222. package/public/logo512.png +0 -0
  223. package/public/manifest.json +0 -25
  224. package/public/robots.txt +0 -3
  225. package/react-app-env.d.ts +0 -71
  226. package/reportWebVitals.ts +0 -15
  227. package/scripts/build.js +0 -208
  228. package/scripts/lib.js +0 -200
  229. package/scripts/start.js +0 -162
  230. package/scripts/test.js +0 -49
  231. package/setupTests.ts +0 -5
  232. package/tsconfig.json +0 -30
@@ -1,59 +0,0 @@
1
- import React from 'react'
2
- import { GuardModuleType } from '../Guard/module'
3
- import { ImagePro } from '../ImagePro'
4
- import { FirstLoginReset } from './core/firstLoginReset'
5
- import { RotateReset } from './core/rotateReset'
6
-
7
- // 手动修改密码,并非「忘记密码」
8
- // 进入的场景是读取配置:1开了首次登录修改密码 || 2开了密码轮换
9
- export const GuardChangePassword = (props: any) => {
10
- let { initData, config } = props
11
- let publicConfig = config.__publicConfig__
12
- // let [resetType] = useState<'inital' | 'rotate'>(initData.type) //
13
- // console.log('******', initData.type)
14
- // let publicConfig = props.config.__publicConfig__
15
-
16
- const onReset = (res: any) => {
17
- let code = res.code
18
- if (code === 200) {
19
- // 返回登录
20
- props.__changeModule(GuardModuleType.LOGIN)
21
- } else {
22
- console.log('*** reset code no catched', res)
23
- }
24
- }
25
-
26
- return (
27
- <div className="g2-view-container">
28
- <div className="g2-view-header">
29
- <ImagePro
30
- src={config?.logo}
31
- size={48}
32
- borderRadius={4}
33
- alt=""
34
- className="icon"
35
- />
36
- <div className="title">欢迎访问 {config.title}</div>
37
- <div className="title-explain">
38
- 你的密码连续使用超过 xxx,可能存在风险。请重新设置密码。
39
- </div>
40
- </div>
41
- <div className="g2-view-tabs">
42
- {initData.type === 'inital' && (
43
- <FirstLoginReset
44
- onReset={onReset}
45
- initData={initData}
46
- publicConfig={publicConfig}
47
- />
48
- )}
49
- {initData.type === 'rotate' && (
50
- <RotateReset
51
- onReset={onReset}
52
- initData={initData}
53
- publicConfig={publicConfig}
54
- />
55
- )}
56
- </div>
57
- </div>
58
- )
59
- }
@@ -1,155 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react'
2
- import { Form, Input, message, Select } from 'antd'
3
- import { useTranslation } from 'react-i18next'
4
- import { useAsyncFn } from 'react-use'
5
- import { ExtendsField } from '../../AuthingGuard/api'
6
- import { UploadImage } from '../../AuthingGuard/Forms/UploadImage'
7
- import { useAuthClient } from '../../Guard/authClient'
8
- import { i18n } from '../../_utils/locales'
9
- import { useGuardHttp } from '../../_utils/guradHttp'
10
- import { GuardCompleteInfoViewProps } from '../props'
11
- import SubmitButton from '../../SubmitButton'
12
-
13
- export interface CompleteInfoProps {
14
- extendsFields: ExtendsField[]
15
- onRegisterInfoCompleted?: GuardCompleteInfoViewProps['onRegisterInfoCompleted']
16
- onRegisterInfoCompletedError?: GuardCompleteInfoViewProps['onRegisterInfoCompletedError']
17
- }
18
-
19
- export const CompleteInfo: React.FC<CompleteInfoProps> = ({
20
- extendsFields,
21
- onRegisterInfoCompleted,
22
- onRegisterInfoCompletedError,
23
- }) => {
24
- const authClient = useAuthClient()
25
- const submitButtonRef = useRef<any>(null)
26
- const { get, post } = useGuardHttp()
27
- const { t } = useTranslation()
28
- const [form] = Form.useForm()
29
-
30
- const [definitions, setDefinitions] = useState<any[]>([])
31
-
32
- const [, loadInitData] = useAsyncFn(async () => {
33
- const user = await authClient.getCurrentUser()
34
-
35
- const { data } = await get<any>('/api/v2/udfs/definitions', undefined, {
36
- headers: {
37
- authorization: user?.token!,
38
- },
39
- })
40
-
41
- setDefinitions(data)
42
- }, [authClient, get])
43
-
44
- useEffect(() => {
45
- loadInitData()
46
- }, [loadInitData])
47
-
48
- const INPUT_MAP: Record<string, React.ReactNode | undefined> = {
49
- image: <UploadImage />,
50
- }
51
- const INTERNAL_INPUT_MAP: Record<string, React.ReactNode | undefined> = {
52
- gender: (
53
- <Select
54
- className="authing-g2-select"
55
- options={[
56
- { label: i18n.t('common.man'), value: 'M' },
57
- { label: i18n.t('common.female'), value: 'F' },
58
- ]}
59
- />
60
- ),
61
- }
62
-
63
- const formFields = extendsFields.map((def) => {
64
- const key = `${def.type} ${def.type === 'internal' ? def.name : def.id}`
65
-
66
- const label = i18n.language === 'zh-CN' ? def.label : def.name
67
-
68
- return (
69
- <Form.Item
70
- key={key}
71
- name={key}
72
- label={label}
73
- // style={{ marginBottom: 24 }}
74
- className="authing-g2-input-form"
75
- rules={[
76
- {
77
- required: true,
78
- message: `${label} ${t('login.noEmpty')}`,
79
- },
80
- ]}
81
- >
82
- {INTERNAL_INPUT_MAP[def.name] || INPUT_MAP[def.inputType] || (
83
- <Input
84
- type={def.inputType}
85
- size="large"
86
- className="authing-g2-input"
87
- autoComplete="tel"
88
- />
89
- )}
90
- </Form.Item>
91
- )
92
- })
93
-
94
- const [, onFinish] = useAsyncFn(async (values: any) => {
95
- submitButtonRef.current?.onSpin(true)
96
-
97
- const internalFields: any = {}
98
- const userFields: any[] = []
99
- Object.entries(values).forEach(([key, value]) => {
100
- const [type, nameOrId] = key.split(' ')
101
- if (type === 'internal') {
102
- internalFields[nameOrId] = value
103
- } else if (type === 'user') {
104
- userFields.push({ nameOrId, value })
105
- }
106
- })
107
-
108
- const udfs = userFields.map(({ nameOrId, value }) => ({
109
- definition: definitions.find((def) => def.id === nameOrId),
110
- value,
111
- }))
112
-
113
- try {
114
- const user = await authClient.updateProfile(internalFields)
115
-
116
- await post(
117
- `/api/v2/udfs/values`,
118
- {
119
- udfs,
120
- },
121
- {
122
- headers: {
123
- authorization: user?.token,
124
- },
125
- }
126
- )
127
- submitButtonRef.current?.onSpin(false)
128
- message.success(t('common.saveSuccess'))
129
- onRegisterInfoCompleted?.(user, udfs, authClient)
130
- } catch (e) {
131
- // TODO
132
- submitButtonRef.current?.onSpin(false)
133
- onRegisterInfoCompletedError?.(e, udfs, authClient)
134
- }
135
- }, [])
136
-
137
- return (
138
- <Form
139
- layout="vertical"
140
- form={form}
141
- onFinish={onFinish}
142
- onFinishFailed={() => submitButtonRef.current.onError()}
143
- >
144
- {formFields}
145
-
146
- <Form.Item className="authing-g2-input-form">
147
- <SubmitButton
148
- text={t('common.problem.form.submit')}
149
- ref={submitButtonRef}
150
- className="password g2-completeInfo-submit"
151
- />
152
- </Form.Item>
153
- </Form>
154
- )
155
- }
@@ -1,45 +0,0 @@
1
- import React from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { ImagePro } from '../ImagePro'
4
- import { GuardModuleType } from '../Guard/module'
5
-
6
- import { CompleteInfo } from './core/completeInfo'
7
- import { GuardCompleteInfoViewProps } from './props'
8
-
9
- import './styles.less'
10
-
11
- export const GuardCompleteInfoView: React.FC<GuardCompleteInfoViewProps> = ({
12
- config,
13
- onRegisterInfoCompleted,
14
- onRegisterInfoCompletedError,
15
- __changeModule,
16
- }) => {
17
- const { t } = useTranslation()
18
- return (
19
- <div className="g2-view-container">
20
- <div className="g2-view-header">
21
- <ImagePro
22
- src={config?.logo}
23
- size={48}
24
- borderRadius={4}
25
- alt=""
26
- className="icon"
27
- />
28
- <div className="title">{t('common.perfectUserInfo')}</div>
29
- <div className="title-explain">
30
- {t('common.welcomeDoc', { name: config.title })}
31
- </div>
32
- </div>
33
- <div className="g2-view-tabs g2-completeInfo-content">
34
- <CompleteInfo
35
- extendsFields={config?.__publicConfig__?.extendsFields!}
36
- onRegisterInfoCompleted={(user, udfs, authClient) => {
37
- onRegisterInfoCompleted?.(user, udfs, authClient)
38
- __changeModule?.(GuardModuleType.LOGIN, {})
39
- }}
40
- onRegisterInfoCompletedError={onRegisterInfoCompletedError}
41
- />
42
- </div>
43
- </div>
44
- )
45
- }
@@ -1,40 +0,0 @@
1
- import { AuthenticationClient, CommonMessage, User } from 'authing-js-sdk'
2
- import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
3
-
4
- export interface CompleteInfoConfig extends IG2Config {}
5
-
6
- const defaultConfig: CompleteInfoConfig = {
7
- ...getDefaultG2Config(),
8
- }
9
-
10
- export const getDefaultLoginConfig = (): CompleteInfoConfig => ({
11
- ...getDefaultG2Config(),
12
- ...defaultConfig,
13
- })
14
-
15
- export interface CompleteInfoEvents extends IG2Events {
16
- onRegisterInfoCompleted?: (
17
- user: User,
18
- udfs: {
19
- definition: any
20
- value: any
21
- }[],
22
- authClient: AuthenticationClient
23
- ) => void
24
- onRegisterInfoCompletedError?: (
25
- error: CommonMessage,
26
- udfs: {
27
- definition: any
28
- value: any
29
- }[],
30
- authClient: AuthenticationClient
31
- ) => void
32
- }
33
-
34
- export interface GuardCompleteInfoProps extends IG2FCProps, CompleteInfoEvents {
35
- config: Partial<CompleteInfoConfig>
36
- }
37
-
38
- export interface GuardCompleteInfoViewProps extends GuardCompleteInfoProps {
39
- config: CompleteInfoConfig
40
- }
@@ -1,7 +0,0 @@
1
- .g2-completeInfo-content {
2
- margin-bottom: 44px;
3
- }
4
-
5
- .g2-completeInfo-submit {
6
- margin-top: 30px !important;
7
- }
@@ -1,49 +0,0 @@
1
- import { Button, Form, Input } from 'antd'
2
- import React, { useState } from 'react'
3
- import { useTranslation } from 'react-i18next'
4
- import { useAsyncFn } from 'react-use'
5
- import { i18n } from '..//_utils/locales'
6
- import { useGuardHttp } from '../_utils/guradHttp'
7
- import { useAuthClient } from '../Guard/authClient'
8
- import { CompleteUserInfoProps } from './props'
9
-
10
- export const GuardCompleteUserInfo: React.FC<CompleteUserInfoProps> = ({
11
- appId,
12
- config = {},
13
- }) => {
14
- useAuthClient()
15
- useGuardHttp()
16
-
17
- const { t } = useTranslation()
18
-
19
- const { extendsFields = [] } = config
20
-
21
- const [fields, setFields] = useState([])
22
-
23
- const [loadState, loadFields] = useAsyncFn(async () => {}, [], {
24
- loading: true,
25
- })
26
-
27
- const renderFields = extendsFields.map((field) => {
28
- const key = `${field.type} ${
29
- field.type === 'internal' ? field.name : field.id
30
- }`
31
-
32
- const label = i18n.language === 'zh-CN' ? field.label : field.name
33
-
34
- return (
35
- <Form.Item key={key} name={key} label={label} style={{ marginBottom: 8 }}>
36
- <Input type={field.inputType} size="large" />
37
- </Form.Item>
38
- )
39
- })
40
-
41
- return (
42
- <Form layout="vertical">
43
- {renderFields}
44
- <Button size="large" type="primary" block htmlType="submit">
45
- {t('common.problem.form.submit')}
46
- </Button>
47
- </Form>
48
- )
49
- }
@@ -1,25 +0,0 @@
1
- import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
2
- import { ExtendsField } from '../AuthingGuard/api'
3
-
4
- export interface CompleteUserInfoConfig extends IG2Config {
5
- extendsFields?: ExtendsField[]
6
- }
7
-
8
- const defaultConfig: CompleteUserInfoConfig = {
9
- ...getDefaultG2Config(),
10
- }
11
-
12
- const getDefaultConfig = (): CompleteUserInfoConfig => ({
13
- ...getDefaultG2Config(),
14
- ...defaultConfig,
15
- })
16
-
17
- export const getDefaultCompleteUserInfoConfig = getDefaultConfig
18
-
19
- export interface CompleteUserInfoEvents extends IG2Events {}
20
-
21
- export interface CompleteUserInfoProps
22
- extends IG2FCProps,
23
- CompleteUserInfoEvents {
24
- config?: CompleteUserInfoConfig
25
- }
@@ -1,64 +0,0 @@
1
- // import { ConfigProvider } from 'antd'
2
- // import React, { useCallback, useEffect, useMemo, useState } from 'react'
3
- // import { IG2Config, IG2FCProps } from '../Type'
4
- // import { initI18n } from 'src/locales'
5
- // import { initConfig } from '../_utils/config'
6
- // import { initGuardHttp } from '../_utils/guradHttp'
7
- // import { initAuthClient } from '../Guard/authClient'
8
- // import { Spin } from '../Spin'
9
-
10
- import React from 'react'
11
- import { IG2FCProps } from '../Type'
12
-
13
- export interface ComponentsRenderProps extends IG2FCProps {
14
- component: any
15
- }
16
- // const PREFIX_CLS = 'authing-ant'
17
-
18
- export const ComponentsRender: React.FC<ComponentsRenderProps> = ({
19
- appId,
20
- config,
21
- initData,
22
- component,
23
- }) => {
24
- // const [guardConfig, setGuardConfig] = useState<IG2Config>()
25
- // const [initSettingEnd, setInitSettingEnd] = useState(false)
26
-
27
- // const init = useCallback(async () => {
28
- // const { config: mergedConfig, publicConfig } = await initConfig(
29
- // appId,
30
- // config ?? {},
31
- // {}
32
- // )
33
-
34
- // setGuardConfig(mergedConfig)
35
-
36
- // const httpClient = initGuardHttp(mergedConfig?.host!)
37
- // httpClient.setAppId(appId)
38
- // httpClient.setUserpoolId(publicConfig.userPoolId)
39
-
40
- // initI18n({}, mergedConfig.lang)
41
-
42
- // initAuthClient(config, appId)
43
-
44
- // setInitSettingEnd(true)
45
- // }, [appId, config])
46
-
47
- // useEffect(() => {
48
- // init()
49
- // }, [init])
50
-
51
- // const renderComponent = useMemo(() => {
52
- // if (initSettingEnd) {
53
- // return component({
54
- // appId,
55
- // config: guardConfig,
56
- // initData,
57
- // })
58
- // } else {
59
- // return <Spin />
60
- // }
61
- // }, [appId, component, guardConfig, initData, initSettingEnd])
62
-
63
- return <span>ComponentsRender</span>
64
- }
@@ -1,54 +0,0 @@
1
- import React, { FC, useCallback, useEffect, useRef, useState } from 'react'
2
- import { CopyOutlined, CheckOutlined } from '@ant-design/icons'
3
- import { copyToClipboard, getClassnames } from '../_utils'
4
-
5
- import './style.less'
6
- import { useTranslation } from 'react-i18next'
7
-
8
- export interface CopyTextProps extends React.HTMLAttributes<HTMLDivElement> {}
9
-
10
- export const CopyAbleText: FC<CopyTextProps> = ({ children, className }) => {
11
- const { t } = useTranslation()
12
- const divRef = useRef<HTMLDivElement>(null)
13
- const [copied, setCopied] = useState(false)
14
- const timer = useRef(-1)
15
-
16
- const startTimer = useCallback(() => {
17
- setCopied(true)
18
- clearTimeout(timer.current)
19
- timer.current = (setTimeout(
20
- () => setCopied(false),
21
- 3000
22
- ) as unknown) as number
23
- }, [timer])
24
-
25
- useEffect(() => {
26
- return () => clearTimeout(timer.current)
27
- }, [])
28
-
29
- const handleCopy = () => {
30
- copyToClipboard(divRef.current!.innerText)
31
- startTimer()
32
- }
33
-
34
- return (
35
- <div
36
- className={getClassnames(['authing-copy-text', className])}
37
- ref={divRef}
38
- >
39
- {children}
40
- {copied ? (
41
- <CheckOutlined
42
- className="authing-data-tips authing-data-tips__top authing-guard-pointer authing-copy-text-icon authing-copy-text-icon__success"
43
- data-tips={t('common.copied')}
44
- />
45
- ) : (
46
- <CopyOutlined
47
- className="authing-data-tips authing-data-tips__top authing-guard-pointer authing-copy-text-icon"
48
- data-tips={t('common.copy')}
49
- onClick={handleCopy}
50
- />
51
- )}
52
- </div>
53
- )
54
- }
@@ -1,13 +0,0 @@
1
- .authing-copy-text {
2
- display: flex;
3
- align-items: center;
4
- }
5
-
6
- .authing-copy-text-icon {
7
- margin-left: 4px;
8
- color: #396aff;
9
- }
10
-
11
- .authing-copy-text-icon__success {
12
- color: #b7eb8f;
13
- }
@@ -1,97 +0,0 @@
1
- import { Tabs } from 'antd'
2
- import React, { ReactNode, useMemo } from 'react'
3
- import { useTranslation } from 'react-i18next'
4
- import { ImagePro } from '../ImagePro'
5
- import { IconFont } from '../IconFont'
6
- import { GuardDownloadATViewProps } from './props'
7
- import './styles.less'
8
- const window: Window = require('global/window')
9
-
10
- enum DownloadType {
11
- IOS = 'ios',
12
- Android = 'Android',
13
- }
14
-
15
- export const GuardDownloadATView: React.FC<GuardDownloadATViewProps> = ({
16
- config,
17
- }) => {
18
- const { t } = useTranslation()
19
-
20
- const cdnBase = config.__publicConfig__?.cdnBase
21
-
22
- const downloadConfig: Record<DownloadType, any> = useMemo(
23
- () => ({
24
- [DownloadType.IOS]: {
25
- title: t('common.downloadTotpAppIOS'),
26
- google: `${cdnBase}/GoogleAuthenticator-Apple.png`,
27
- microsoft: `${cdnBase}/MicrosoftAuthenticator-Apple.png`,
28
- },
29
- [DownloadType.Android]: {
30
- title: t('common.downloadTotpAppAndroid'),
31
- google: `${cdnBase}/GoogleAuthenticator-Authing.png`,
32
- microsoft: `${cdnBase}/MicrosoftAuthenticator-Baidu.png`,
33
- },
34
- }),
35
- [cdnBase, t]
36
- )
37
-
38
- const renderTab = useMemo(
39
- () =>
40
- (Object.keys(downloadConfig) as DownloadType[]).map<ReactNode>(
41
- (value: DownloadType, index: number) => (
42
- <Tabs.TabPane
43
- tab={downloadConfig[value].title}
44
- key={index}
45
- className="g2-mfa-download-at-tab"
46
- >
47
- <span className="g2-mfa-totp-download-subtitle">
48
- {t('common.downloadTotpAppDocs')}
49
- </span>
50
- <div className="g2-mfa-totp-download-qrcode">
51
- <div className="g2-mfa-totp-download-qrcode-item">
52
- <ImagePro
53
- width={120}
54
- height={120}
55
- className="g2-mfa-totp-download-image"
56
- src={downloadConfig[value].google}
57
- alt="Google Authenticator"
58
- />
59
- <span className="g2-mfa-totp-download-qrcode-text">
60
- Google Authenticator
61
- </span>
62
- </div>
63
- <div className="g2-mfa-totp-download-qrcode-item">
64
- <ImagePro
65
- width={120}
66
- height={120}
67
- className="g2-mfa-totp-download-image"
68
- src={downloadConfig[value].microsoft}
69
- alt="Microsoft Authenticator"
70
- />
71
- <span className="g2-mfa-totp-download-qrcode-text">
72
- Microsoft Authenticator
73
- </span>
74
- </div>
75
- </div>
76
- </Tabs.TabPane>
77
- )
78
- ),
79
- [downloadConfig, t]
80
- )
81
-
82
- const onBack = () => window.history.back()
83
-
84
- return (
85
- <div className="g2-view-container">
86
- <div className="g2-view-back">
87
- <span onClick={onBack}>
88
- <IconFont type="authing-back" />
89
- <span>{t('common.backToMFA')}</span>
90
- </span>
91
- </div>
92
- <div className="g2-view-tabs g2-mfa-totp-download-tabs">
93
- <Tabs defaultActiveKey={DownloadType.IOS}>{renderTab}</Tabs>
94
- </div>
95
- </div>
96
- )
97
- }
@@ -1,22 +0,0 @@
1
- import { getDefaultG2Config, IG2Config, IG2Events, IG2FCProps } from '../Type'
2
-
3
- export interface DownloadATConfig extends IG2Config {}
4
-
5
- const defaultConfig: DownloadATConfig = {
6
- ...getDefaultG2Config(),
7
- }
8
-
9
- export const getDefaultLoginConfig = (): DownloadATConfig => ({
10
- ...getDefaultG2Config(),
11
- ...defaultConfig,
12
- })
13
-
14
- export interface DownloadATEvents extends IG2Events {}
15
-
16
- export interface GuardDownloadATProps extends IG2FCProps, DownloadATEvents {
17
- config: Partial<DownloadATConfig>
18
- }
19
-
20
- export interface GuardDownloadATViewProps extends GuardDownloadATProps {
21
- config: DownloadATConfig
22
- }
@@ -1,52 +0,0 @@
1
- .g2-view-container-totp-dl {
2
- width: 900px;
3
- padding: 0;
4
- }
5
- .g2-mfa-totp-title {
6
- width: 100%;
7
- height: 54px;
8
- display: flex;
9
- align-items: center;
10
- justify-content: center;
11
- font-size: 16px;
12
- color: #293350;
13
- border-bottom: 1px solid #eaebee;
14
- margin-bottom: 54px;
15
- }
16
- .g2-mfa-totp-download-tabs {
17
- margin-top: 30px;
18
- }
19
-
20
- .g2-mfa-download-at-tab {
21
- display: flex;
22
- flex-direction: column;
23
- align-items: center;
24
- margin-top: 15px;
25
-
26
- .g2-mfa-totp-download-subtitle {
27
- color: #545968;
28
- }
29
-
30
- .g2-mfa-totp-download-qrcode-item {
31
- display: flex;
32
- flex-direction: column;
33
- align-items: center;
34
-
35
- margin-top: 35px;
36
-
37
- .g2-mfa-totp-download-image {
38
- width: 130px;
39
- height: 130px;
40
- display: flex;
41
- align-items: center;
42
- justify-content: center;
43
- box-shadow: 0px 0px 30px rgba(84, 89, 104, 0.15);
44
- border-radius: 4px;
45
- }
46
-
47
- .g2-mfa-totp-download-qrcode-text {
48
- margin-top: 8px;
49
- color: #545968;
50
- }
51
- }
52
- }