@authing/react-ui-components 3.0.2-beta.5 → 3.1.1-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/.vscode/settings.json +1 -1
  2. package/LICENSE +21 -0
  3. package/config/env.js +26 -24
  4. package/config/paths.js +3 -3
  5. package/config/webpack.config.js +29 -7
  6. package/lib/index.d.ts +211 -1252
  7. package/lib/index.min.css +1 -2
  8. package/lib/index.min.js +1 -1
  9. package/lib/index.min.js.LICENSE.txt +0 -32
  10. package/package.json +14 -20
  11. package/scripts/build.js +83 -79
  12. package/scripts/start.js +73 -69
  13. package/scripts/test.js +23 -19
  14. package/{components → src/common}/AuthingDropdown/index.tsx +1 -1
  15. package/{components → src/common}/AuthingDropdown/style.less +0 -0
  16. package/{components → src/common}/AuthingTabs/index.tsx +1 -1
  17. package/{components → src/common}/AuthingTabs/style.less +0 -0
  18. package/{components → src/common}/CopyAbleText/index.tsx +1 -1
  19. package/{components → src/common}/CopyAbleText/style.less +0 -0
  20. package/{components → src/common}/VerifyCodeInput/index.tsx +0 -0
  21. package/{components → src/common}/VerifyCodeInput/style.less +0 -0
  22. package/{components → src/components}/AuthingGuard/AppMFALayout/index.tsx +2 -2
  23. package/{components → src/components}/AuthingGuard/AppMFALayout/style.less +0 -0
  24. package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/index.tsx +1 -1
  25. package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/style.less +0 -0
  26. package/{components → src/components}/AuthingGuard/Forms/ADLoginForm/index.tsx +2 -2
  27. package/{components → src/components}/AuthingGuard/Forms/Agreements/index.tsx +1 -1
  28. package/{components → src/components}/AuthingGuard/Forms/Agreements/style.less +0 -0
  29. package/{components → src/components}/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +3 -3
  30. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +4 -2
  31. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +2 -2
  32. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +1 -1
  33. package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  34. package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/index.tsx +2 -2
  35. package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  36. package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/index.tsx +4 -9
  37. package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  38. package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/index.tsx +1 -1
  39. package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/style.less +0 -0
  40. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +2 -2
  41. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +1 -1
  42. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +1 -1
  43. package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -0
  44. package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/index.tsx +2 -2
  45. package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -0
  46. package/{components → src/components}/AuthingGuard/Forms/PasswordLoginForm/index.tsx +3 -3
  47. package/{components → src/components}/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +2 -2
  48. package/{components → src/components}/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +2 -2
  49. package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +4 -2
  50. package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -0
  51. package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/index.tsx +1 -1
  52. package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  53. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +1 -1
  54. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +2 -2
  55. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +2 -2
  56. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +2 -2
  57. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +1 -1
  58. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/index.tsx +1 -1
  59. package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/style.less +0 -0
  60. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -0
  61. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/index.tsx +2 -2
  62. package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/style.less +0 -0
  63. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +2 -2
  64. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +2 -2
  65. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +1 -1
  66. package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -0
  67. package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +7 -7
  68. package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -0
  69. package/{components → src/components}/AuthingGuard/Forms/UploadImage/index.tsx +1 -1
  70. package/{components → src/components}/AuthingGuard/Forms/index.ts +0 -0
  71. package/{components → src/components}/AuthingGuard/GuardLayout/index.tsx +17 -3
  72. package/{components → src/components}/AuthingGuard/GuardLayout/style.less +0 -0
  73. package/{components → src/components}/AuthingGuard/Header/index.tsx +6 -3
  74. package/{components → src/components}/AuthingGuard/Header/style.less +23 -11
  75. package/{components → src/components}/AuthingGuard/IconFont/iconfont.js +0 -0
  76. package/{components → src/components}/AuthingGuard/IconFont/index.tsx +1 -1
  77. package/{components → src/components}/AuthingGuard/IconFont/style.less +0 -0
  78. package/{components → src/components}/AuthingGuard/IconFont/svg.js +0 -0
  79. package/{components → src/components}/AuthingGuard/LoginLayout/index.tsx +69 -25
  80. package/{components → src/components}/AuthingGuard/LoginLayout/style.less +0 -0
  81. package/{components → src/components}/AuthingGuard/MfaLayout/Steps.ts +0 -0
  82. package/{components → src/components}/AuthingGuard/MfaLayout/index.tsx +1 -1
  83. package/{components → src/components}/AuthingGuard/MfaLayout/style.less +0 -0
  84. package/{components → src/components}/AuthingGuard/RegisterLayout/index.tsx +2 -2
  85. package/{components → src/components}/AuthingGuard/RegisterLayout/style.less +0 -0
  86. package/{components → src/components}/AuthingGuard/ResetPwdLayout/index.tsx +1 -1
  87. package/{components → src/components}/AuthingGuard/ToggleLang/index.tsx +2 -2
  88. package/{components → src/components}/AuthingGuard/api/appConfig.ts +22 -14
  89. package/{components/_utils → src/components/AuthingGuard/api}/http.ts +33 -30
  90. package/{components → src/components}/AuthingGuard/api/index.ts +0 -0
  91. package/{components → src/components}/AuthingGuard/api/sso.ts +1 -1
  92. package/{components → src/components}/AuthingGuard/api/userPoolConfig.ts +3 -2
  93. package/{components → src/components}/AuthingGuard/constants.ts +2 -2
  94. package/{components → src/components}/AuthingGuard/hooks/index.tsx +0 -0
  95. package/{components → src/components}/AuthingGuard/hooks/useScreenSize.tsx +0 -0
  96. package/{components → src/components}/AuthingGuard/index.tsx +11 -3
  97. package/{components/_utils → src/components/AuthingGuard}/locales/en/common.json +26 -70
  98. package/{components/_utils → src/components/AuthingGuard}/locales/en/index.ts +0 -0
  99. package/{components/_utils → src/components/AuthingGuard}/locales/en/login.json +19 -21
  100. package/{components/_utils → src/components/AuthingGuard}/locales/en/map.json +0 -0
  101. package/{components/_utils → src/components/AuthingGuard}/locales/en/user.json +3 -4
  102. package/{components/_utils → src/components/AuthingGuard}/locales/index.ts +2 -2
  103. package/{components/_utils → src/components/AuthingGuard}/locales/zh/common.json +9 -53
  104. package/{components/_utils → src/components/AuthingGuard}/locales/zh/index.ts +0 -0
  105. package/{components/_utils → src/components/AuthingGuard}/locales/zh/login.json +4 -6
  106. package/{components/_utils → src/components/AuthingGuard}/locales/zh/map.json +0 -0
  107. package/{components/_utils → src/components/AuthingGuard}/locales/zh/user.json +1 -3
  108. package/{components → src/components}/AuthingGuard/style.less +5 -0
  109. package/{components → src/components}/AuthingGuard/types/Forms.ts +2 -1
  110. package/{components → src/components}/AuthingGuard/types/GuardConfig.ts +5 -1
  111. package/{components → src/components}/AuthingGuard/types/GuardState.ts +1 -1
  112. package/{components → src/components}/AuthingGuard/types/Locales.ts +0 -0
  113. package/{components → src/components}/AuthingGuard/types/index.ts +0 -0
  114. package/src/components/index.ts +7 -0
  115. package/{components → src}/context/base.tsx +0 -0
  116. package/{components → src}/context/global/context.tsx +0 -0
  117. package/{components → src}/context/global/reducer.tsx +2 -2
  118. package/src/index.tsx +142 -0
  119. package/{logo.svg → src/logo.svg} +0 -0
  120. package/{react-app-env.d.ts → src/react-app-env.d.ts} +0 -0
  121. package/{reportWebVitals.ts → src/reportWebVitals.ts} +0 -0
  122. package/{setupTests.ts → src/setupTests.ts} +0 -0
  123. package/{components/_utils → src/utils}/clipboard.ts +1 -1
  124. package/{components/_utils → src/utils}/index.ts +3 -149
  125. package/{components/_utils → src/utils}/popupCenter.ts +0 -0
  126. package/tsconfig.json +2 -8
  127. package/build/asset-manifest.json +0 -26
  128. package/build/favicon.ico +0 -0
  129. package/build/index.html +0 -1
  130. package/build/logo192.png +0 -0
  131. package/build/logo512.png +0 -0
  132. package/build/manifest.json +0 -25
  133. package/build/robots.txt +0 -3
  134. package/build/static/css/2.51c07e65.chunk.css +0 -3
  135. package/build/static/css/2.51c07e65.chunk.css.map +0 -1
  136. package/build/static/css/main.779f221a.chunk.css +0 -2
  137. package/build/static/css/main.779f221a.chunk.css.map +0 -1
  138. package/build/static/js/2.bbae9fdb.chunk.js +0 -3
  139. package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
  140. package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
  141. package/build/static/js/3.fd17f196.chunk.js +0 -2
  142. package/build/static/js/3.fd17f196.chunk.js.map +0 -1
  143. package/build/static/js/main.5f341531.chunk.js +0 -2
  144. package/build/static/js/main.5f341531.chunk.js.map +0 -1
  145. package/build/static/js/runtime-main.ef138021.js +0 -2
  146. package/build/static/js/runtime-main.ef138021.js.map +0 -1
  147. package/build/static/media/loading.4a67a5f3.svg +0 -29
  148. package/components/BindTotp/core/bindSuccess.tsx +0 -72
  149. package/components/BindTotp/core/securityCode.tsx +0 -108
  150. package/components/BindTotp/index.tsx +0 -134
  151. package/components/BindTotp/interface.ts +0 -30
  152. package/components/BindTotp/styles.less +0 -57
  153. package/components/ChangeLanguage/index.tsx +0 -35
  154. package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
  155. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  156. package/components/ChangePassword/index.tsx +0 -72
  157. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  158. package/components/CompleteInfo/index.tsx +0 -45
  159. package/components/CompleteInfo/interface.ts +0 -40
  160. package/components/CompleteInfo/styles.less +0 -7
  161. package/components/DownloadAuthenticator/index.tsx +0 -97
  162. package/components/DownloadAuthenticator/interface.ts +0 -22
  163. package/components/DownloadAuthenticator/styles.less +0 -52
  164. package/components/Error/index.tsx +0 -21
  165. package/components/Error/interface.ts +0 -9
  166. package/components/Error/styles.less +0 -12
  167. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  168. package/components/ForgetPassword/index.tsx +0 -78
  169. package/components/ForgetPassword/interface.ts +0 -32
  170. package/components/Guard/Guard.tsx +0 -295
  171. package/components/Guard/authClient.ts +0 -44
  172. package/components/Guard/config.ts +0 -19
  173. package/components/Guard/event.ts +0 -52
  174. package/components/Guard/index.tsx +0 -4
  175. package/components/Guard/module.ts +0 -20
  176. package/components/Guard/stateMachine.ts +0 -152
  177. package/components/Guard/styles.less +0 -461
  178. package/components/IconFont/iconfont.js +0 -74
  179. package/components/IconFont/index.tsx +0 -16
  180. package/components/IconFont/style.less +0 -6
  181. package/components/IconFont/svg.js +0 -2
  182. package/components/ImagePro/index.tsx +0 -53
  183. package/components/ImagePro/styles.less +0 -40
  184. package/components/InputNumber/index.tsx +0 -33
  185. package/components/Login/codemap.ts +0 -49
  186. package/components/Login/core/withAD.tsx +0 -9
  187. package/components/Login/core/withAppQrcode.tsx +0 -49
  188. package/components/Login/core/withLDAP.tsx +0 -146
  189. package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
  190. package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
  191. package/components/Login/core/withPassword/InputAccount.tsx +0 -64
  192. package/components/Login/core/withPassword/index.tsx +0 -173
  193. package/components/Login/core/withPhonecode.tsx +0 -122
  194. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  195. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  196. package/components/Login/index.tsx +0 -374
  197. package/components/Login/props.ts +0 -74
  198. package/components/Login/socialLogin/index.tsx +0 -407
  199. package/components/Login/socialLogin/style.less +0 -69
  200. package/components/Login/styles.less +0 -53
  201. package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
  202. package/components/MFA/VerifyCodeInput/index.tsx +0 -145
  203. package/components/MFA/VerifyCodeInput/style.less +0 -35
  204. package/components/MFA/codemap.ts +0 -24
  205. package/components/MFA/core/email.tsx +0 -203
  206. package/components/MFA/core/face.tsx +0 -297
  207. package/components/MFA/core/face_deps.tsx +0 -37
  208. package/components/MFA/core/sms.tsx +0 -203
  209. package/components/MFA/core/totp.tsx +0 -122
  210. package/components/MFA/index.tsx +0 -143
  211. package/components/MFA/mfaMethods/index.tsx +0 -88
  212. package/components/MFA/mfaMethods/style.less +0 -39
  213. package/components/MFA/props.ts +0 -51
  214. package/components/MFA/styles.less +0 -100
  215. package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
  216. package/components/NeedHelpView/index.tsx +0 -47
  217. package/components/RecoveryCode/core/useCode.tsx +0 -71
  218. package/components/RecoveryCode/index.tsx +0 -27
  219. package/components/RecoveryCode/interface.ts +0 -31
  220. package/components/RecoveryCode/style.less +0 -13
  221. package/components/Register/codemap.ts +0 -12
  222. package/components/Register/components/Agreements/index.tsx +0 -81
  223. package/components/Register/components/Agreements/style.less +0 -44
  224. package/components/Register/core/WithEmail.tsx +0 -242
  225. package/components/Register/core/WithPhone.tsx +0 -184
  226. package/components/Register/index.tsx +0 -139
  227. package/components/Register/props.ts +0 -50
  228. package/components/SendCode/SendCodeBtn.tsx +0 -96
  229. package/components/SendCode/index.tsx +0 -94
  230. package/components/SendCode/style.less +0 -31
  231. package/components/ShieldSpin/index.tsx +0 -27
  232. package/components/ShieldSpin/loading.svg +0 -29
  233. package/components/SubmitButton/index.tsx +0 -50
  234. package/components/SubmitSuccess/index.tsx +0 -66
  235. package/components/SubmitSuccess/interface.ts +0 -17
  236. package/components/Type/index.ts +0 -52
  237. package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
  238. package/components/ValidatorRules/index.ts +0 -20
  239. package/components/_utils/GuardErrorCode.ts +0 -9
  240. package/components/_utils/config.ts +0 -116
  241. package/components/_utils/guradHttp.ts +0 -101
  242. package/components/_utils/hooks/index.ts +0 -64
  243. package/components/assets/images/error.png +0 -0
  244. package/components/context/module/context.tsx +0 -23
  245. package/components/index.ts +0 -12
  246. package/examples.tsx +0 -87
  247. package/index.js +0 -1
  248. package/lib/static/media/loading.4a67a5f3.svg +0 -29
  249. package/scripts/publish.js +0 -57
@@ -6,10 +6,10 @@ import {
6
6
  GuardEventsHandler,
7
7
  LocalesConfig,
8
8
  Lang,
9
- } from '../../AuthingGuard/types'
9
+ } from '../../components/AuthingGuard/types'
10
10
  import { AuthenticationClient } from 'authing-js-sdk'
11
11
  import { IBaseAction } from '../base'
12
- import { ApplicationMfaType } from '../../AuthingGuard/api/appConfig'
12
+ import { ApplicationMfaType } from '../../components/AuthingGuard/api/appConfig'
13
13
 
14
14
  export type IState = {
15
15
  config: GuardConfig // 处理后的 Guard 配置
package/src/index.tsx ADDED
@@ -0,0 +1,142 @@
1
+ import { Button } from 'antd'
2
+ import React, { useState } from 'react'
3
+ import ReactDOM from 'react-dom'
4
+ import { Lang } from './components'
5
+ import { AuthingGuard } from './components/AuthingGuard'
6
+
7
+ import { SocialConnectionProvider } from 'authing-js-sdk'
8
+
9
+ import {
10
+ GuardMode,
11
+ // LoginMethods,
12
+ UserConfig,
13
+ // LoginMethods,
14
+ // RegisterMethods,
15
+ // GuardScenes,
16
+ // SocialConnections,
17
+ } from './components/AuthingGuard/types/GuardConfig'
18
+ import reportWebVitals from './reportWebVitals'
19
+
20
+ const App = () => {
21
+ const [lang, setLang] = useState<Lang>('zh-CN')
22
+ const [title, setTitle] = useState('标题')
23
+
24
+ const config: UserConfig = {
25
+ mode: GuardMode.Modal,
26
+ // appHost: 'https://core.dev2.authing-inc.co',
27
+ apiHost: 'http://console.authing.localhost:3000',
28
+ // appHost: 'http://0w9ugz.authing.localhost:3000',
29
+ // apiHost: 'http://192.168.50.57:3000',
30
+ // loginMethods: Object.values(LoginMethods),
31
+ // logo:
32
+ // 'https://files.authing.co/user-contents/photos/0a4c99ff-b8ce-4030-aaaf-584c807cb21c.png',
33
+ // title: 'Authing',
34
+ // defaultLoginMethod: LoginMethods.LDAP,
35
+ // registerMethods: Object.values(RegisterMethods),
36
+ // defaultRegisterMethod: RegisterMethods.Email,
37
+ // defaultScenes: GuardScenes.Login,
38
+ // socialConnections: Object.values(SocialConnections),
39
+ // enterpriseConnections: ["oidc1"],
40
+ // appDomain: 'oidc1.authing.cn',
41
+ // appId: '5f17a529f64fb009b794a2ff',
42
+ // isSSO: true,
43
+ // zIndex: 300,
44
+ // text: {
45
+ // loginTabs: {
46
+ // [LoginMethods.Password]: '密码登录一下',
47
+ // },
48
+ // loginBtn: {
49
+ // loading: 'fuck',
50
+ // },
51
+ // },
52
+ // mode: GuardMode.Modal,
53
+ // contentCss: `
54
+ // html, body {
55
+ // background-color: #fff;
56
+ // }
57
+ // `,
58
+ // // autoRegister: true,
59
+ socialConnections: [SocialConnectionProvider.WECHATPC],
60
+ }
61
+
62
+ const [visible, setVisible] = useState(false)
63
+
64
+ // useEffect(() => {
65
+ // setTimeout(() => setVisible(true), 3000)
66
+ // }, [])
67
+
68
+ // initAuthClient({
69
+ // appId: '60c02a89a9e0431e271d9ff0',
70
+ // // appHost: 'http://console.authing.localhost:3000',
71
+ // })
72
+
73
+ return (
74
+ // eslint-disable-next-line react/jsx-no-undef
75
+ <>
76
+ <Button
77
+ type="primary"
78
+ onClick={() => {
79
+ //
80
+ }}
81
+ >
82
+ add socialConnections
83
+ </Button>
84
+ <Button
85
+ type="primary"
86
+ onClick={() => {
87
+ setVisible(!visible)
88
+ }}
89
+ >
90
+ 开关
91
+ </Button>
92
+ <Button
93
+ type="primary"
94
+ onClick={() => {
95
+ setLang('zh-CN')
96
+ }}
97
+ >
98
+ 中文
99
+ </Button>
100
+ <Button
101
+ type="primary"
102
+ onClick={() => {
103
+ setLang('en-US')
104
+ }}
105
+ >
106
+ English
107
+ </Button>
108
+ <input
109
+ value={title}
110
+ onChange={(evt) => setTitle(evt.target.value)}
111
+ ></input>
112
+ <AuthingGuard
113
+ onLoad={(v) => console.log(v)}
114
+ visible={visible}
115
+ // onLoginTabChange={(v) => console.log(v)}
116
+ // onRegisterTabChange={(v) => console.log(v)}
117
+ // onClose={() => {
118
+ // setVisible(false)
119
+ // setTimeout(() => {
120
+ // setVisible(true)
121
+ // }, 2000)
122
+ // }}
123
+ onClose={() => {
124
+ setVisible(false)
125
+ }}
126
+ // onLoad={(a) => console.log(a, '加载完成')}
127
+ // onPwdResetError={(e) => console.log(e)}
128
+ appId="61ada57aef5ed526528ed5b6"
129
+ // tenantId="61a5ed126cddae656cce9007"
130
+ // appId="5fd877fb0ba0421962eced94"
131
+ config={config}
132
+ />
133
+ </>
134
+ )
135
+ }
136
+
137
+ ReactDOM.render(<App />, document.getElementById('root'))
138
+
139
+ // If you want to start measuring performance in your app, pass a function
140
+ // to log results (for example: reportWebVitals(console.log))
141
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
142
+ reportWebVitals()
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,4 @@
1
- import { i18n } from './locales'
1
+ import { i18n } from 'src/components/AuthingGuard/locales'
2
2
 
3
3
  // https://juejin.im/post/6844903857290477582
4
4
  export const copyToClipboard = (str: string) => {
@@ -1,8 +1,7 @@
1
1
  import { useEffect } from 'react'
2
2
  import { Rule } from 'antd/lib/form'
3
- import qs from 'qs'
4
3
  import { useGuardContext } from '../context/global/context'
5
- import { i18n } from './locales'
4
+ import qs from 'qs'
6
5
 
7
6
  export * from './popupCenter'
8
7
  export * from './clipboard'
@@ -30,17 +29,6 @@ export const getRequiredRules = (msg: string): Rule[] => {
30
29
  ]
31
30
  }
32
31
 
33
- export const fieldRequiredRule = (fieldRequiredRule: string): Rule[] => {
34
- return [
35
- {
36
- required: true,
37
- message: i18n.t('common.isMissing', {
38
- name: fieldRequiredRule,
39
- }),
40
- },
41
- ]
42
- }
43
-
44
32
  export function getDeviceName() {
45
33
  if (typeof window === 'undefined') {
46
34
  return null
@@ -81,7 +69,7 @@ const insertedRecord: Record<STYLE_RECORD_KEY, any> = {
81
69
  }
82
70
  export const insertStyles = (
83
71
  styles: string | any,
84
- recordKey?: STYLE_RECORD_KEY
72
+ recordKey: STYLE_RECORD_KEY
85
73
  ) => {
86
74
  let styleElt, styleSheet
87
75
  if ((document as any).createStyleSheet) {
@@ -108,9 +96,7 @@ export const insertStyles = (
108
96
  }
109
97
  }
110
98
 
111
- if (recordKey) {
112
- insertedRecord[recordKey] = styleElt
113
- }
99
+ insertedRecord[recordKey] = styleElt
114
100
  }
115
101
 
116
102
  export const removeStyles = (recordKey: STYLE_RECORD_KEY) => {
@@ -192,135 +178,3 @@ export const getUserRegisterParams = () => {
192
178
 
193
179
  export const isWechatBrowser = () =>
194
180
  /MicroMessenger/i.test(navigator?.userAgent)
195
-
196
- export const assembledAppHost = (identifier: string, host: string) => {
197
- const hostUrl = new URL(host)
198
-
199
- const splitHost = hostUrl.hostname.split('.')
200
-
201
- const port = hostUrl.port
202
-
203
- splitHost.shift()
204
-
205
- return `${hostUrl.protocol}//${identifier}.${splitHost.join('.')}${
206
- port && `:${port}`
207
- }`
208
- }
209
-
210
- export enum PasswordStrength {
211
- NoCheck,
212
- Low,
213
- Middle,
214
- High,
215
- AUTO,
216
- }
217
-
218
- export const PASSWORD_STRENGTH_TEXT_MAP: Record<
219
- PasswordStrength,
220
- {
221
- placeholder: () => string
222
- validateMessage: () => string
223
- }
224
- > = {
225
- [PasswordStrength.NoCheck]: {
226
- placeholder: () => i18n.t('login.inputPwd'),
227
- validateMessage: () => i18n.t('login.inputPwd'),
228
- },
229
- [PasswordStrength.Low]: {
230
- placeholder: () => i18n.t('login.setPwdLimit1'),
231
- validateMessage: () => i18n.t('login.setPwdLimitMsg1'),
232
- },
233
- [PasswordStrength.Middle]: {
234
- placeholder: () => i18n.t('login.login.setPwdLimit2'),
235
- validateMessage: () => i18n.t('login.setPwdLimitMsg2'),
236
- },
237
- [PasswordStrength.High]: {
238
- placeholder: () => i18n.t('login.login.setPwdLimit3'),
239
- validateMessage: () => i18n.t('login.setPwdLimitMsg3'),
240
- },
241
- [PasswordStrength.AUTO]: {
242
- placeholder: () => i18n.t('login.inputPwd'),
243
- validateMessage: () => i18n.t('login.inputPwd'),
244
- },
245
- }
246
-
247
- const SYMBOL_TYPE_PATTERNS = [
248
- /\d+/,
249
- /[a-zA-Z]/,
250
- /[-!$%^&*()_+|~=`{}[\]:";'<>?,@./]/,
251
- ]
252
-
253
- export const getSymbolTypeLength = (pwd: string) => {
254
- return SYMBOL_TYPE_PATTERNS.map((pattern) => pattern.test(pwd)).filter(
255
- (item) => item
256
- ).length
257
- }
258
-
259
- export const getPasswordValidate = (
260
- strength: PasswordStrength = PasswordStrength.NoCheck,
261
- customPasswordStrength: any = {}
262
- ): Rule[] => {
263
- const required = fieldRequiredRule(i18n.t('common.password'))[0]
264
-
265
- const validateMap: Record<PasswordStrength, Rule[]> = {
266
- [PasswordStrength.NoCheck]: [required],
267
- [PasswordStrength.Low]: [
268
- required,
269
- {
270
- validator(r, v) {
271
- if (v && v.length < 6) {
272
- return Promise.reject(
273
- PASSWORD_STRENGTH_TEXT_MAP[PasswordStrength.Low].validateMessage()
274
- )
275
- }
276
- return Promise.resolve()
277
- },
278
- },
279
- ],
280
- [PasswordStrength.Middle]: [
281
- required,
282
- {
283
- validator(r, v) {
284
- if (v && (v.length < 6 || getSymbolTypeLength(v) < 2)) {
285
- return Promise.reject(
286
- PASSWORD_STRENGTH_TEXT_MAP[
287
- PasswordStrength.Middle
288
- ].validateMessage()
289
- )
290
- }
291
- return Promise.resolve()
292
- },
293
- },
294
- ],
295
- [PasswordStrength.High]: [
296
- required,
297
- {
298
- validator(r, v) {
299
- if (v && (v.length < 6 || getSymbolTypeLength(v) < 3)) {
300
- console.log(
301
- PASSWORD_STRENGTH_TEXT_MAP[PasswordStrength.High].validateMessage
302
- )
303
- return Promise.reject(
304
- PASSWORD_STRENGTH_TEXT_MAP[
305
- PasswordStrength.High
306
- ].validateMessage()
307
- )
308
- }
309
- return Promise.resolve(true)
310
- },
311
- },
312
- ],
313
- [PasswordStrength.AUTO]: [
314
- required,
315
- {
316
- pattern: customPasswordStrength?.regex,
317
- message: customPasswordStrength?.message,
318
- },
319
- ],
320
- }
321
-
322
- return validateMap[strength]
323
- }
324
-
325
- export const sleep = (delay: number) =>
326
- new Promise((resolve) => setTimeout(resolve, delay))
File without changes
package/tsconfig.json CHANGED
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
+ "baseUrl": ".",
3
4
  "outDir": "lib/",
4
5
  "target": "es5",
5
6
  "lib": ["dom", "dom.iterable", "esnext"],
@@ -18,13 +19,6 @@
18
19
  "noEmit": false,
19
20
  "jsx": "react"
20
21
  },
21
- "include": [
22
- "components/**/*.ts",
23
- "components/**/*.tsx",
24
- "components/**/*.json",
25
- "react-app-env.d.ts",
26
- "reportWebVitals.ts",
27
- "setupTests.ts"
28
- ],
22
+ "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json"],
29
23
  "exclude": ["node_modules", "lib", "build"]
30
24
  }
@@ -1,26 +0,0 @@
1
- {
2
- "files": {
3
- "main.css": "/static/css/main.779f221a.chunk.css",
4
- "main.js": "/static/js/main.5f341531.chunk.js",
5
- "main.js.map": "/static/js/main.5f341531.chunk.js.map",
6
- "runtime-main.js": "/static/js/runtime-main.ef138021.js",
7
- "runtime-main.js.map": "/static/js/runtime-main.ef138021.js.map",
8
- "static/css/2.51c07e65.chunk.css": "/static/css/2.51c07e65.chunk.css",
9
- "static/js/2.bbae9fdb.chunk.js": "/static/js/2.bbae9fdb.chunk.js",
10
- "static/js/2.bbae9fdb.chunk.js.map": "/static/js/2.bbae9fdb.chunk.js.map",
11
- "static/js/3.fd17f196.chunk.js": "/static/js/3.fd17f196.chunk.js",
12
- "static/js/3.fd17f196.chunk.js.map": "/static/js/3.fd17f196.chunk.js.map",
13
- "index.html": "/index.html",
14
- "static/css/2.51c07e65.chunk.css.map": "/static/css/2.51c07e65.chunk.css.map",
15
- "static/css/main.779f221a.chunk.css.map": "/static/css/main.779f221a.chunk.css.map",
16
- "static/js/2.bbae9fdb.chunk.js.LICENSE.txt": "/static/js/2.bbae9fdb.chunk.js.LICENSE.txt",
17
- "static/media/loading.4a67a5f3.svg": "/static/media/loading.4a67a5f3.svg"
18
- },
19
- "entrypoints": [
20
- "static/js/runtime-main.ef138021.js",
21
- "static/css/2.51c07e65.chunk.css",
22
- "static/js/2.bbae9fdb.chunk.js",
23
- "static/css/main.779f221a.chunk.css",
24
- "static/js/main.5f341531.chunk.js"
25
- ]
26
- }
package/build/favicon.ico DELETED
Binary file
package/build/index.html DELETED
@@ -1 +0,0 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><link href="/static/css/2.51c07e65.chunk.css" rel="stylesheet"><link href="/static/css/main.779f221a.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function t(t){for(var n,i,a=t[0],c=t[1],l=t[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(t);p.length;)p.shift()();return u.push.apply(u,l||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,a=1;a<r.length;a++){var c=r[a];0!==o[c]&&(n=!1)}n&&(u.splice(t--,1),e=i(i.s=r[0]))}return e}var n={},o={1:0},u=[];function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],r=o[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise((function(t,n){r=o[e]=[t,n]}));t.push(r[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"fd17f196"}[e]+".chunk.js"}(e);var c=new Error;u=function(t){a.onerror=a.onload=null,clearTimeout(l);var r=o[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),u=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,r[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,r){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(r,n,function(t){return e[t]}.bind(null,n));return r},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/",i.oe=function(e){throw console.error(e),e};var a=this["webpackJsonp@authing/react-ui-components"]=this["webpackJsonp@authing/react-ui-components"]||[],c=a.push.bind(a);a.push=t,a=a.slice();for(var l=0;l<a.length;l++)t(a[l]);var f=c;r()}([])</script><script src="/static/js/2.bbae9fdb.chunk.js"></script><script src="/static/js/main.5f341531.chunk.js"></script></body></html>
package/build/logo192.png DELETED
Binary file
package/build/logo512.png DELETED
Binary file
@@ -1,25 +0,0 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
package/build/robots.txt DELETED
@@ -1,3 +0,0 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow: