@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,420 +0,0 @@
1
- import {
2
- AuthenticationClient,
3
- AuthenticationClientOptions,
4
- CommonMessage,
5
- SocialConnectionProvider,
6
- User,
7
- } from 'authing-js-sdk'
8
- import { QrCodeAuthenticationClient } from 'authing-js-sdk/build/main/lib/authentication/QrCodeAuthenticationClient'
9
-
10
- import {
11
- SocialConnectionItem,
12
- EnterpriseConnectionItem,
13
- ApplicationConfig,
14
- PasswordLoginMethods,
15
- Agreement,
16
- } from '../api'
17
- import { Lang } from './Locales'
18
-
19
- export type { AuthenticationClient, CommonMessage, User } from 'authing-js-sdk'
20
-
21
- export enum GuardMode {
22
- Modal = 'modal',
23
- Normal = 'normal',
24
- }
25
-
26
- export enum LoginMethods {
27
- LDAP = 'ldap',
28
- AppQr = 'app-qrcode',
29
- Password = 'password',
30
- PhoneCode = 'phone-code',
31
- WxMinQr = 'wechat-miniprogram-qrcode', // 对应社会化登录的 wechat:miniprogram:qrconnect(小程序扫码登录)
32
- AD = 'ad', // 对应企业身份源的 Windows AD 登录
33
- WechatMpQrcode = 'wechatmp-qrcode', // 微信扫码关注登录
34
- }
35
-
36
- export enum RegisterMethods {
37
- Email = 'email',
38
- Phone = 'phone',
39
- }
40
-
41
- export enum GuardScenes {
42
- Login = 'login',
43
- Register = 'register',
44
- MfaVerify = 'mfaVerify',
45
- AppMfaVerify = 'appMfaVerify',
46
- RestPassword = 'restPassword',
47
- CompleteUserInfo = 'completeUserInfo',
48
- }
49
-
50
- export enum ResetPwdMethods {
51
- Email = 'email',
52
- Phone = 'phone',
53
- }
54
-
55
- export enum SocialConnections {
56
- Qq = 'qq',
57
- Weibo = 'weibo',
58
- Github = 'github',
59
- Google = 'google',
60
- WxPc = 'wechat:pc',
61
- Dingtalk = 'dingtalk',
62
- WxWCorpQr = 'wechatwork:corp:qrconnect',
63
- WxWSPQr = 'wechatwork:service-provider:qrconnect',
64
- WxWSPAuth = 'wechatwork:service-provider:authorization',
65
- AlipayWeb = 'alipay:web',
66
- AppleWeb = 'apple:web',
67
- Baidu = 'baidu',
68
- LarkInternalApp = 'lark-internal',
69
- LarkMarketPlaceApp = 'lark-public',
70
- }
71
-
72
- export enum Protocol {
73
- AD = 'ad',
74
- CAS = 'cas',
75
- LDAP = 'ldap',
76
- OIDC = 'oidc',
77
- SAML = 'saml',
78
- OAUTH = 'oauth',
79
- AZURE_AD = 'azure-ad',
80
- }
81
-
82
- // export enum GuardEventsKebab {
83
- // // 加载完成,userPool 配置和应用配置(如果有 appId)加载完成
84
- // Load = 'load',
85
- // // 加载失败
86
- // LoadError = 'load-error',
87
- // // 用户登录成功
88
- // Login = 'login',
89
- // // 用户登录失败
90
- // LoginError = 'login-error',
91
- // // 注册成功
92
- // Register = 'register',
93
- // // 注册失败
94
- // RegisterError = 'register-error',
95
- // // 忘记密码邮件发送成功
96
- // PwdEmailSend = 'pwd-email-send',
97
- // // 忘记密码邮件发送失败
98
- // PwdEmailSendError = 'pwd-email-send-error',
99
- // // 忘记密码手机验证码发送成功
100
- // PwdPhoneSend = 'pwd-phone-send',
101
- // // 忘记密码手机验证码发送失败
102
- // PwdPhoneSendError = 'pwd-phone-send-error',
103
- // // 重置密码成功
104
- // PwdReset = 'pwd-reset',
105
- // // 重置密码失败
106
- // PwdResetError = 'pwd-reset-error',
107
- // // 表单关闭事件
108
- // Close = 'close',
109
- // }
110
-
111
- // export interface GuardEventsCamelCase {
112
- // // 加载完成,userPool 配置和应用配置(如果有 appId)加载完成
113
- // [GuardEvents.Load]: 'onLoad'
114
- // // 加载失败
115
- // [GuardEvents.LoadError]: 'onLoadError'
116
- // // 用户登录成功
117
- // [GuardEvents.Login]: 'onLogin'
118
- // // 用户登录失败
119
- // [GuardEvents.LoginError]: 'onLoginError'
120
- // // 注册成功
121
- // [GuardEvents.Register]: 'onRegister'
122
- // // 注册失败
123
- // [GuardEvents.RegisterError]: 'onRegisterError'
124
- // // 忘记密码邮件发送成功
125
- // [GuardEvents.PwdEmailSend]: 'onPwdEmailSend'
126
- // // 忘记密码邮件发送失败
127
- // [GuardEvents.PwdEmailSendError]: 'onPwdEmailSendError'
128
- // // 忘记密码手机验证码发送成功
129
- // [GuardEvents.PwdPhoneSend]: 'onPwdPhoneSend'
130
- // // 忘记密码手机验证码发送失败
131
- // [GuardEvents.PwdPhoneSendError]: 'onPwdPhoneSendError'
132
- // // 重置密码成功
133
- // [GuardEvents.PwdReset]: 'onPwdReset'
134
- // // 重置密码失败
135
- // [GuardEvents.PwdResetError]: 'onPwdResetError'
136
- // // 表单关闭事件
137
- // [GuardEvents.Close]: 'onClose'
138
- // }
139
-
140
- // export enum GuardEvents {
141
- // // 加载完成,userPool 配置和应用配置(如果有 appId)加载完成
142
- // Load = 'onLoad',
143
- // // 加载失败
144
- // LoadError = 'onLoadError',
145
- // // 用户登录成功
146
- // Login = 'onLogin',
147
- // // 用户登录失败
148
- // LoginError = 'onLoginError',
149
- // // 注册成功
150
- // Register = 'onRegister',
151
- // // 注册失败
152
- // RegisterError = 'onRegisterError',
153
- // // 忘记密码邮件发送成功
154
- // PwdEmailSend = 'onPwdEmailSend',
155
- // // 忘记密码邮件发送失败
156
- // PwdEmailSendError = 'onPwdEmailSendError',
157
- // // 忘记密码手机验证码发送成功
158
- // PwdPhoneSend = 'onPwdPhoneSend',
159
- // // 忘记密码手机验证码发送失败
160
- // PwdPhoneSendError = 'onPwdPhoneSendError',
161
- // // 重置密码成功
162
- // PwdReset = 'onPwdReset',
163
- // // 重置密码失败
164
- // PwdResetError = 'onPwdResetError',
165
- // // 表单关闭事件
166
- // Close = 'onClose',
167
- // }
168
-
169
- export const GuardEventsCamelToKebabMap = {
170
- onLoad: 'load',
171
- onLoadError: 'load-error',
172
- onLogin: 'login',
173
- onBeforeLogin: 'before-login',
174
- onLoginError: 'login-error',
175
- onRegister: 'register',
176
- onBeforeRegister: 'before-register',
177
- onRegisterError: 'register-error',
178
- onPwdEmailSend: 'pwd-email-send',
179
- onPwdEmailSendError: 'pwd-email-send-error',
180
- onPwdPhoneSend: 'pwd-phone-send',
181
- onPwdPhoneSendError: 'pwd-phone-send-error',
182
- onPwdReset: 'pwd-reset',
183
- onPwdResetError: 'pwd-reset-error',
184
- onClose: 'close',
185
- onLoginTabChange: 'login-tab-change',
186
- onRegisterTabChange: 'register-tab-change',
187
- onRegisterInfoCompleted: 'register-info-completed',
188
- onRegisterInfoCompletedError: 'register-info-completed-error',
189
- } as const
190
-
191
- export interface GuardEventsHandlerKebab {
192
- // 加载完成,userPool 配置和应用配置(如果有 appId)加载完成
193
- load: GuardEventsHandler['onLoad']
194
- // 加载失败
195
- 'load-error': GuardEventsHandler['onLoadError']
196
- // 登录前,即表单校验完成,请求接口前
197
- 'before-login': GuardEventsHandler['onBeforeLogin']
198
- // 用户登录成功
199
- login: GuardEventsHandler['onLogin']
200
- // 用户登录失败
201
- 'login-error': GuardEventsHandler['onLoginError']
202
- // 注册前,即表单校验完成,请求接口前
203
- 'before-register': GuardEventsHandler['onBeforeRegister']
204
- // 注册成功
205
- register: GuardEventsHandler['onRegister']
206
- // 注册失败
207
- 'register-error': GuardEventsHandler['onRegisterError']
208
- // 忘记密码邮件发送成功
209
- 'pwd-email-send': GuardEventsHandler['onPwdEmailSend']
210
- // 忘记密码邮件发送失败
211
- 'pwd-email-send-error': GuardEventsHandler['onPwdEmailSendError']
212
- // 忘记密码手机验证码发送成功
213
- 'pwd-phone-send': GuardEventsHandler['onPwdPhoneSend']
214
- // 忘记密码手机验证码发送失败
215
- 'pwd-phone-send-error': GuardEventsHandler['onPwdPhoneSendError']
216
- // 重置密码成功
217
- 'pwd-reset': GuardEventsHandler['onPwdReset']
218
- // 重置密码失败
219
- 'pwd-reset-error': GuardEventsHandler['onPwdResetError']
220
- // 表单关闭事件
221
- close: GuardEventsHandler['onClose']
222
- // 登录的 tab 切换
223
- 'login-tab-change': GuardEventsHandler['onLoginTabChange']
224
- // 注册的 tab 切换
225
- 'register-tab-change': GuardEventsHandler['onRegisterTabChange']
226
- // 注册信息补充完毕
227
- 'register-info-completed': GuardEventsHandler['onRegisterInfoCompleted']
228
- // 注册信息补充失败
229
- 'register-info-completed-error': GuardEventsHandler['onRegisterInfoCompletedError']
230
- }
231
-
232
- export interface PasswordLoginParams {
233
- type: LoginMethods.Password
234
- data: {
235
- // 标识,可能是用户名、邮箱、手机号
236
- identity: string
237
- // 密码
238
- password: string
239
- // 图形验证码
240
- captchaCode?: string
241
- }
242
- }
243
-
244
- export interface LDAPLoginParams {
245
- type: LoginMethods.LDAP
246
- data: {
247
- // 标识,可能是用户名、邮箱、手机号
248
- identity: string
249
- // 密码
250
- password: string
251
- // 图形验证码
252
- captchaCode?: string
253
- }
254
- }
255
-
256
- export interface ADLoginParams {
257
- type: LoginMethods.AD
258
- data: {
259
- // 标识,可能是用户名、邮箱、手机号
260
- identity: string
261
- // 密码
262
- password: string
263
- }
264
- }
265
-
266
- export interface PhoneCodeLoginParams {
267
- type: LoginMethods.PhoneCode
268
- data: {
269
- // 手机号
270
- phone: string
271
- // 手机验证码
272
- code: string
273
- }
274
- }
275
-
276
- export interface EmailRegisterParams {
277
- type: RegisterMethods.Email
278
- data: {
279
- // 邮箱
280
- email: string
281
- // 密码
282
- password: string
283
- }
284
- }
285
-
286
- export interface PhoneRegisterParams {
287
- type: RegisterMethods.Phone
288
- data: {
289
- // 手机号
290
- phone: string
291
- // 密码
292
- password: string
293
- // 手机验证码
294
- code: string
295
- }
296
- }
297
-
298
- export interface GuardEventsHandler {
299
- onLoad?: (authClient: AuthenticationClient) => void
300
- onLoadError?: (error: CommonMessage) => void
301
- onBeforeLogin?: (
302
- loginInfo:
303
- | PasswordLoginParams
304
- | LDAPLoginParams
305
- | ADLoginParams
306
- | PhoneCodeLoginParams,
307
- authClient: AuthenticationClient
308
- ) => boolean | Promise<boolean>
309
- onLogin?: (user: User, authClient: AuthenticationClient) => void
310
- onLoginError?: (user: User, authClient: AuthenticationClient) => void
311
- onBeforeRegister?: (
312
- registerInfo: EmailRegisterParams | PhoneRegisterParams,
313
- authClient: AuthenticationClient
314
- ) => boolean | Promise<boolean>
315
- onRegister?: (user: User, authClient: AuthenticationClient) => void
316
- onRegisterError?: (user: User, authClient: AuthenticationClient) => void
317
- onPwdEmailSend?: (authClient: AuthenticationClient) => void
318
- onPwdEmailSendError?: (
319
- error: CommonMessage,
320
- authClient: AuthenticationClient
321
- ) => void
322
- onPwdPhoneSend?: (authClient: AuthenticationClient) => void
323
- onPwdPhoneSendError?: (
324
- error: CommonMessage,
325
- authClient: AuthenticationClient
326
- ) => void
327
- onPwdReset?: (authClient: AuthenticationClient) => void
328
- onPwdResetError?: (
329
- error: CommonMessage,
330
- authClient: AuthenticationClient
331
- ) => void
332
- onClose?: () => void
333
- onLoginTabChange?: (activeTab: LoginMethods) => void
334
- onRegisterTabChange?: (activeTab: RegisterMethods) => void
335
- onRegisterInfoCompleted?: (
336
- user: User,
337
- udfs: {
338
- definition: any
339
- value: any
340
- }[],
341
- authClient: AuthenticationClient
342
- ) => void
343
- onRegisterInfoCompletedError?: (
344
- error: CommonMessage,
345
- udfs: {
346
- definition: any
347
- value: any
348
- }[],
349
- authClient: AuthenticationClient
350
- ) => void
351
- }
352
-
353
- export interface UserConfig {
354
- logo?: string
355
- title?: string
356
- zIndex?: number
357
- isSSO?: boolean
358
- mode?: GuardMode
359
- /**
360
- * @deprecated 使用 appHost
361
- */
362
- apiHost?: string
363
- /**
364
- * @deprecated 使用 appHost
365
- */
366
- appDomain?: string
367
- appHost?: string
368
- contentCss?: string
369
- text?: {
370
- loginBtn?: {
371
- normal?: string
372
- loading?: string
373
- }
374
- registerBtn?: {
375
- normal?: string
376
- loading?: string
377
- }
378
- // 登录 tab
379
- loginTabs?: Partial<Record<LoginMethods, string>>
380
- }
381
- escCloseable?: boolean
382
- autoRegister?: boolean
383
- clickCloseable?: boolean
384
- disableResetPwd?: boolean
385
- disableRegister?: boolean
386
- defaultScenes?: GuardScenes
387
- loginMethods?: LoginMethods[]
388
- target?: string | HTMLElement
389
- enterpriseConnections?: string[]
390
- defaultLoginMethod?: LoginMethods
391
- registerMethods?: RegisterMethods[]
392
- socialConnections?: (SocialConnections | SocialConnectionProvider)[]
393
- defaultRegisterMethod?: RegisterMethods
394
- qrCodeScanOptions?: Parameters<QrCodeAuthenticationClient['startScanning']>[1]
395
- /**
396
- * 国际化处理
397
- */
398
- localesConfig?: LocalesConfig
399
- lang?: Lang
400
- /**
401
- * 用于去品牌化
402
- */
403
- headers?: AuthenticationClientOptions['headers']
404
- passwordLoginMethods?: PasswordLoginMethods[]
405
- }
406
-
407
- export interface GuardConfig extends UserConfig {
408
- socialConnectionObjs: SocialConnectionItem[]
409
- enterpriseConnectionObjs: EnterpriseConnectionItem[]
410
- extendsFields: ApplicationConfig['extendsFields']
411
- publicKey: ApplicationConfig['publicKey']
412
- agreementEnabled: boolean
413
- agreements: Agreement[]
414
- }
415
-
416
- export interface LocalesConfig {
417
- defaultLang?: Lang
418
- isShowChange?: boolean
419
- onChange?: (lang: Lang) => void
420
- }
@@ -1,7 +0,0 @@
1
- import { LoginMethods, RegisterMethods } from './GuardConfig'
2
- import { GuardScenes } from './GuardConfig'
3
-
4
- export interface ActiveTabs {
5
- [GuardScenes.Login]: LoginMethods
6
- [GuardScenes.Register]: RegisterMethods
7
- }
@@ -1,12 +0,0 @@
1
- export type Lang = 'zh-CN' | 'en-US'
2
-
3
- export const LANG_MAP = [
4
- {
5
- label: '中文',
6
- value: 'zh-CN',
7
- },
8
- {
9
- label: 'English',
10
- value: 'en-US',
11
- },
12
- ]
@@ -1,4 +0,0 @@
1
- export * from './Forms'
2
- export * from './GuardState'
3
- export * from './GuardConfig'
4
- export * from './Locales'
@@ -1,98 +0,0 @@
1
- import { Button } from 'antd'
2
- import React, { FC, useMemo } from 'react'
3
- import { EllipsisOutlined } from '@ant-design/icons'
4
-
5
- import { getClassnames } from '../_utils'
6
-
7
- import './style.less'
8
-
9
- export interface AuthingTabsProps extends React.HTMLAttributes<HTMLDivElement> {
10
- activeKey?: string
11
- onTabClick: (key: string) => void
12
- showLen?: number
13
- tabs: {
14
- key: string
15
- label: string
16
- component: JSX.Element
17
- }[]
18
- }
19
-
20
- export const AuthingTabs: FC<AuthingTabsProps> = ({
21
- tabs,
22
- showLen = 3,
23
- className,
24
- activeKey,
25
- onTabClick,
26
- }) => {
27
- const activeIndex = useMemo(
28
- () => tabs.findIndex((item) => item.key === activeKey),
29
- [tabs, activeKey]
30
- )
31
-
32
- const showTabs = useMemo(() => {
33
- if (tabs.length <= showLen) {
34
- return [...tabs]
35
- }
36
-
37
- let startIndex = Math.max(activeIndex - 1, 0)
38
- if (startIndex + showLen > tabs.length - 1) {
39
- startIndex = tabs.length - showLen
40
- }
41
-
42
- return tabs.slice(startIndex, startIndex + showLen)
43
- }, [showLen, activeIndex, tabs])
44
-
45
- const hideTabs = useMemo(() => {
46
- const showKeys = showTabs.map((item) => item.key)
47
- return tabs.filter((item) => !showKeys.find((key) => item.key === key))
48
- }, [tabs, showTabs])
49
-
50
- return (
51
- <>
52
- <div className={getClassnames(['authing-tabs', className])}>
53
- <div
54
- className={getClassnames([
55
- 'authing-tabs-inner',
56
- Boolean(hideTabs.length) && 'authing-tabs-inner--more',
57
- ])}
58
- >
59
- {showTabs.map((item, index) => (
60
- <div
61
- onClick={() => onTabClick(item.key)}
62
- className={getClassnames([
63
- 'authing-tab-item',
64
- activeKey === item.key && 'authing-tab-item__active',
65
- ])}
66
- key={item.key}
67
- >
68
- {item.label}
69
- </div>
70
- ))}
71
- </div>
72
- {Boolean(hideTabs.length) && (
73
- <Button
74
- className="authing-tabs-show-more"
75
- type="text"
76
- icon={<EllipsisOutlined />}
77
- >
78
- <ul className="authing-tabs-more-panel">
79
- {hideTabs.map((item) => (
80
- <li
81
- key={item.key}
82
- onClick={() => onTabClick(item.key)}
83
- className="authing-tabs-more-panel-item"
84
- >
85
- {item.label}
86
- </li>
87
- ))}
88
- </ul>
89
- </Button>
90
- )}
91
- </div>
92
-
93
- <div className="authing-tab-pane">
94
- {tabs.find((item) => item.key === activeKey)?.component}
95
- </div>
96
- </>
97
- )
98
- }
@@ -1,135 +0,0 @@
1
- .authing-tabs {
2
- display: flex;
3
- margin-bottom: 36px;
4
- align-items: center;
5
- }
6
- .authing-tabs-inner {
7
- display: flex;
8
- justify-content: space-around;
9
- align-items: center;
10
- flex: 1;
11
- }
12
- .authing-tabs-inner--more {
13
- box-shadow: inset -10px 0 8px -8px rgba(0, 0, 0, 0.08);
14
- }
15
- .authing-tab-item {
16
- color: #aeb9d4;
17
- font-size: 16px;
18
- transition: all 0.3s ease-in-out;
19
- white-space: nowrap;
20
- cursor: pointer;
21
- position: relative;
22
- height: 28px;
23
- margin-right: 32px;
24
- &:last-child {
25
- margin-right: 12px;
26
- }
27
- &:only-child {
28
- margin-right: 0;
29
- }
30
- &::after {
31
- content: '';
32
- width: 0;
33
- height: 2px;
34
- display: block;
35
- position: absolute;
36
- left: 50%;
37
- bottom: -4px;
38
- transform: translateX(-50%);
39
- background-color: transparent;
40
- transition: all 0.3s ease-in-out;
41
- }
42
- }
43
- .authing-tab-item__active {
44
- color: #396aff;
45
- font-size: 18px;
46
- &::after {
47
- width: 26px;
48
- background-color: #396aff;
49
- }
50
- }
51
- .authing-tabs-show-more {
52
- position: relative;
53
- z-index: 2;
54
- &.ant-btn {
55
- padding: 0 12px;
56
- }
57
- &:hover,
58
- &:focus,
59
- &:active {
60
- background-color: #fff;
61
- }
62
- &:hover {
63
- .authing-tabs-more-panel {
64
- height: auto;
65
- opacity: 1;
66
- padding: 4px 0;
67
- }
68
- }
69
-
70
- &:after {
71
- content: '';
72
- display: block;
73
- width: 100%;
74
- height: 6px;
75
- top: 100%;
76
- left: 0;
77
- position: absolute;
78
- }
79
- }
80
- .authing-tabs-more-panel {
81
- position: absolute;
82
- box-sizing: border-box;
83
- transition: all 0.3s;
84
- height: 0;
85
- opacity: 0;
86
- right: 0;
87
- top: 100%;
88
- transform: translateY(6px);
89
- background-color: #fff;
90
- max-height: 200px;
91
- margin: 0;
92
- padding: 0;
93
- overflow-x: hidden;
94
- overflow-y: auto;
95
- text-align: left;
96
- list-style-type: none;
97
- background-clip: padding-box;
98
- border-radius: 2px;
99
- outline: none;
100
- box-shadow: 0 3px 6px -4px rgba(0, 0, 0, 0.12),
101
- 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 9px 28px 8px rgba(0, 0, 0, 0.05);
102
- }
103
- .authing-tabs-more-panel-item {
104
- min-width: 120px;
105
- margin: 0;
106
- padding: 5px 12px;
107
- overflow: hidden;
108
- color: rgba(0, 0, 0, 0.85);
109
- font-weight: 400;
110
- font-size: 14px;
111
- line-height: 22px;
112
- white-space: nowrap;
113
- text-overflow: ellipsis;
114
- cursor: pointer;
115
- transition: all 0.3s;
116
- &:hover {
117
- background-color: #f5f5f5;
118
- }
119
- }
120
-
121
- @media only screen and (max-width: 719px) {
122
- .authing-tabs-inner {
123
- justify-content: flex-start;
124
- }
125
- .authing-tab-item {
126
- margin-right: 40px;
127
- font-size: 14px;
128
- }
129
- .authing-tab-item__active {
130
- font-size: 16px;
131
- }
132
- .authing-tab-pane {
133
- padding-bottom: 70px;
134
- }
135
- }