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

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 (235) hide show
  1. package/dist/index.min.css +2 -0
  2. package/dist/index.min.js +2 -0
  3. package/dist/index.min.js.LICENSE.txt +71 -0
  4. package/{components/ShieldSpin/loading.svg → dist/static/media/loading.4a67a5f3.svg} +0 -0
  5. package/lib/index.d.ts +2108 -118
  6. package/lib/index.min.css +2 -2
  7. package/lib/index.min.js +1 -1
  8. package/lib/index.min.js.LICENSE.txt +2 -0
  9. package/package.json +32 -10
  10. package/.eslintignore +0 -6
  11. package/.eslintrc.js +0 -7
  12. package/.prettierrc +0 -5
  13. package/.vscode/settings.json +0 -31
  14. package/build/favicon.ico +0 -0
  15. package/build/logo192.png +0 -0
  16. package/build/logo512.png +0 -0
  17. package/build/manifest.json +0 -25
  18. package/build/robots.txt +0 -3
  19. package/components/AuthingDropdown/index.tsx +0 -52
  20. package/components/AuthingDropdown/style.less +0 -43
  21. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  22. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  23. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  24. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  25. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  26. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  27. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  28. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  29. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  30. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  31. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  32. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  33. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  34. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  35. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  36. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  37. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  38. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  39. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  40. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  41. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  42. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  43. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  44. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  45. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  46. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  47. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  48. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  49. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  50. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  51. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  52. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  53. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  54. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  55. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  56. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  57. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  58. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  59. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  60. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  61. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  62. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  63. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  64. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  65. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  66. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  67. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  68. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  69. package/components/AuthingGuard/Forms/index.ts +0 -13
  70. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  71. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  72. package/components/AuthingGuard/Header/index.tsx +0 -25
  73. package/components/AuthingGuard/Header/style.less +0 -52
  74. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  75. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  76. package/components/AuthingGuard/IconFont/style.less +0 -6
  77. package/components/AuthingGuard/IconFont/svg.js +0 -2
  78. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  79. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  80. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  81. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  82. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  83. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  84. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  85. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  86. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  87. package/components/AuthingGuard/api/appConfig.ts +0 -146
  88. package/components/AuthingGuard/api/index.ts +0 -3
  89. package/components/AuthingGuard/api/sso.ts +0 -29
  90. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  91. package/components/AuthingGuard/constants.ts +0 -105
  92. package/components/AuthingGuard/hooks/index.tsx +0 -70
  93. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  94. package/components/AuthingGuard/index.tsx +0 -126
  95. package/components/AuthingGuard/style.less +0 -103
  96. package/components/AuthingGuard/types/Forms.ts +0 -94
  97. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  98. package/components/AuthingGuard/types/GuardState.ts +0 -7
  99. package/components/AuthingGuard/types/Locales.ts +0 -12
  100. package/components/AuthingGuard/types/index.ts +0 -4
  101. package/components/AuthingTabs/index.tsx +0 -98
  102. package/components/AuthingTabs/style.less +0 -135
  103. package/components/BindTotp/core/bindSuccess.tsx +0 -61
  104. package/components/BindTotp/core/securityCode.tsx +0 -119
  105. package/components/BindTotp/index.tsx +0 -134
  106. package/components/BindTotp/props.ts +0 -30
  107. package/components/BindTotp/styles.less +0 -56
  108. package/components/ChangeLanguage/index.tsx +0 -35
  109. package/components/ChangePassword/core/firstLoginReset.tsx +0 -104
  110. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  111. package/components/ChangePassword/index.tsx +0 -59
  112. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  113. package/components/CompleteInfo/index.tsx +0 -45
  114. package/components/CompleteInfo/props.ts +0 -40
  115. package/components/CompleteInfo/styles.less +0 -7
  116. package/components/CompleteUserInfo/index.tsx +0 -49
  117. package/components/CompleteUserInfo/props.ts +0 -25
  118. package/components/ComponentsRender/index.back +0 -64
  119. package/components/CopyAbleText/index.tsx +0 -54
  120. package/components/CopyAbleText/style.less +0 -13
  121. package/components/DownloadAuthenticator/index.tsx +0 -97
  122. package/components/DownloadAuthenticator/props.ts +0 -22
  123. package/components/DownloadAuthenticator/styles.less +0 -52
  124. package/components/ForgetPassword/core/resetPassword.tsx +0 -150
  125. package/components/ForgetPassword/index.tsx +0 -51
  126. package/components/Guard/Guard.tsx +0 -226
  127. package/components/Guard/authClient.ts +0 -55
  128. package/components/Guard/config.ts +0 -19
  129. package/components/Guard/event.ts +0 -18
  130. package/components/Guard/index.tsx +0 -10
  131. package/components/Guard/module.ts +0 -19
  132. package/components/Guard/stateMachine.ts +0 -133
  133. package/components/Guard/styles.less +0 -444
  134. package/components/IconFont/iconfont.js +0 -74
  135. package/components/IconFont/index.tsx +0 -16
  136. package/components/IconFont/style.less +0 -6
  137. package/components/IconFont/svg.js +0 -2
  138. package/components/ImagePro/index.tsx +0 -52
  139. package/components/ImagePro/styles.less +0 -40
  140. package/components/Login/codemap.ts +0 -35
  141. package/components/Login/core/withAD.tsx +0 -9
  142. package/components/Login/core/withAppQrcode.tsx +0 -49
  143. package/components/Login/core/withLDAP.tsx +0 -145
  144. package/components/Login/core/withPassword.tsx +0 -176
  145. package/components/Login/core/withPhonecode.tsx +0 -135
  146. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  147. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  148. package/components/Login/index.tsx +0 -359
  149. package/components/Login/props.ts +0 -90
  150. package/components/Login/socialLogin/index.tsx +0 -413
  151. package/components/Login/socialLogin/style.less +0 -61
  152. package/components/Login/styles.less +0 -53
  153. package/components/MFA/codemap.ts +0 -21
  154. package/components/MFA/core/email.tsx +0 -226
  155. package/components/MFA/core/face.tsx +0 -297
  156. package/components/MFA/core/face_deps.tsx +0 -37
  157. package/components/MFA/core/sms.tsx +0 -222
  158. package/components/MFA/core/totp.tsx +0 -137
  159. package/components/MFA/index.tsx +0 -135
  160. package/components/MFA/mfaMethods/index.tsx +0 -81
  161. package/components/MFA/mfaMethods/style.less +0 -39
  162. package/components/MFA/props.ts +0 -51
  163. package/components/MFA/styles.less +0 -92
  164. package/components/NeedHelpView/core/describeQuestions.tsx +0 -227
  165. package/components/NeedHelpView/index.tsx +0 -99
  166. package/components/RecoveryCode/core/useCode.tsx +0 -71
  167. package/components/RecoveryCode/index.tsx +0 -27
  168. package/components/RecoveryCode/interface.ts +0 -31
  169. package/components/RecoveryCode/style.less +0 -13
  170. package/components/Register/codemap.ts +0 -16
  171. package/components/Register/components/Agreements/index.tsx +0 -81
  172. package/components/Register/components/Agreements/style.less +0 -44
  173. package/components/Register/core/WithEmail.tsx +0 -250
  174. package/components/Register/core/WithPhone.tsx +0 -190
  175. package/components/Register/index.tsx +0 -122
  176. package/components/Register/props.ts +0 -50
  177. package/components/SendCode/SendCodeBtn.tsx +0 -96
  178. package/components/SendCode/index.tsx +0 -98
  179. package/components/SendCode/style.less +0 -31
  180. package/components/ShieldSpin/index.tsx +0 -27
  181. package/components/SubmitButton/index.tsx +0 -50
  182. package/components/Type/index.ts +0 -61
  183. package/components/VerifyCodeInput/index.tsx +0 -76
  184. package/components/VerifyCodeInput/style.less +0 -24
  185. package/components/_utils/GuardErrorCode.ts +0 -8
  186. package/components/_utils/clipboard.ts +0 -27
  187. package/components/_utils/config.ts +0 -123
  188. package/components/_utils/guradHttp.ts +0 -93
  189. package/components/_utils/hooks/index.ts +0 -56
  190. package/components/_utils/http.ts +0 -85
  191. package/components/_utils/index.ts +0 -310
  192. package/components/_utils/locales/en/common.json +0 -218
  193. package/components/_utils/locales/en/index.ts +0 -6
  194. package/components/_utils/locales/en/login.json +0 -95
  195. package/components/_utils/locales/en/map.json +0 -4
  196. package/components/_utils/locales/en/user.json +0 -82
  197. package/components/_utils/locales/index.ts +0 -45
  198. package/components/_utils/locales/zh/common.json +0 -218
  199. package/components/_utils/locales/zh/index.ts +0 -6
  200. package/components/_utils/locales/zh/login.json +0 -95
  201. package/components/_utils/locales/zh/map.json +0 -4
  202. package/components/_utils/locales/zh/user.json +0 -82
  203. package/components/_utils/popupCenter.ts +0 -48
  204. package/components/context/base.tsx +0 -28
  205. package/components/context/global/context.tsx +0 -39
  206. package/components/context/global/reducer.tsx +0 -56
  207. package/components/context/module/context.tsx +0 -23
  208. package/components/index.ts +0 -10
  209. package/config/antdReplacer.js +0 -51
  210. package/config/env.js +0 -104
  211. package/config/getHttpsConfig.js +0 -66
  212. package/config/jest/cssTransform.js +0 -14
  213. package/config/jest/fileTransform.js +0 -40
  214. package/config/modules.js +0 -134
  215. package/config/paths.js +0 -71
  216. package/config/pnpTs.js +0 -35
  217. package/config/webpack.config.js +0 -835
  218. package/config/webpackDevServer.config.js +0 -130
  219. package/examples.tsx +0 -100
  220. package/index.js +0 -1
  221. package/logo.svg +0 -7
  222. package/public/favicon.ico +0 -0
  223. package/public/index.html +0 -43
  224. package/public/logo192.png +0 -0
  225. package/public/logo512.png +0 -0
  226. package/public/manifest.json +0 -25
  227. package/public/robots.txt +0 -3
  228. package/react-app-env.d.ts +0 -71
  229. package/reportWebVitals.ts +0 -15
  230. package/scripts/build.js +0 -208
  231. package/scripts/lib.js +0 -200
  232. package/scripts/start.js +0 -162
  233. package/scripts/test.js +0 -49
  234. package/setupTests.ts +0 -5
  235. 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
- }