@authing/react-ui-components 3.0.2-alpha.2 → 3.0.2-beta.12

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 (254) hide show
  1. package/lib/index.d.ts +620 -52
  2. package/lib/index.min.css +2 -2
  3. package/lib/index.min.js +1 -1
  4. package/package.json +29 -8
  5. package/.eslintignore +0 -6
  6. package/.eslintrc.js +0 -7
  7. package/.prettierrc +0 -5
  8. package/.vscode/settings.json +0 -31
  9. package/build/asset-manifest.json +0 -26
  10. package/build/favicon.ico +0 -0
  11. package/build/index.html +0 -1
  12. package/build/logo192.png +0 -0
  13. package/build/logo512.png +0 -0
  14. package/build/manifest.json +0 -25
  15. package/build/robots.txt +0 -3
  16. package/build/static/css/2.9512539b.chunk.css +0 -3
  17. package/build/static/css/2.9512539b.chunk.css.map +0 -1
  18. package/build/static/css/main.0ff9e24a.chunk.css +0 -2
  19. package/build/static/css/main.0ff9e24a.chunk.css.map +0 -1
  20. package/build/static/js/2.1105ecfb.chunk.js +0 -3
  21. package/build/static/js/2.1105ecfb.chunk.js.LICENSE.txt +0 -102
  22. package/build/static/js/2.1105ecfb.chunk.js.map +0 -1
  23. package/build/static/js/3.fd17f196.chunk.js +0 -2
  24. package/build/static/js/3.fd17f196.chunk.js.map +0 -1
  25. package/build/static/js/main.a47645ff.chunk.js +0 -2
  26. package/build/static/js/main.a47645ff.chunk.js.map +0 -1
  27. package/build/static/js/runtime-main.ef138021.js +0 -2
  28. package/build/static/js/runtime-main.ef138021.js.map +0 -1
  29. package/build/static/media/loading.4a67a5f3.svg +0 -29
  30. package/components/AuthingDropdown/index.tsx +0 -52
  31. package/components/AuthingDropdown/style.less +0 -43
  32. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  33. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  34. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  35. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  36. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  37. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  38. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  39. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  40. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  41. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  42. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  43. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  44. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  45. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  46. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  47. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  48. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  49. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  50. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  51. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  52. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  53. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  54. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  55. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  56. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  57. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  58. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  59. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  60. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  61. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  62. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  63. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  64. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  65. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  66. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  67. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  68. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  69. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  70. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  71. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  72. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  73. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  74. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  75. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  76. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  77. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  78. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  79. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  80. package/components/AuthingGuard/Forms/index.ts +0 -13
  81. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  82. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  83. package/components/AuthingGuard/Header/index.tsx +0 -25
  84. package/components/AuthingGuard/Header/style.less +0 -52
  85. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  86. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  87. package/components/AuthingGuard/IconFont/style.less +0 -6
  88. package/components/AuthingGuard/IconFont/svg.js +0 -2
  89. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  90. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  91. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  92. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  93. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  94. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  95. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  96. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  97. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  98. package/components/AuthingGuard/api/appConfig.ts +0 -146
  99. package/components/AuthingGuard/api/index.ts +0 -3
  100. package/components/AuthingGuard/api/sso.ts +0 -29
  101. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  102. package/components/AuthingGuard/constants.ts +0 -105
  103. package/components/AuthingGuard/hooks/index.tsx +0 -70
  104. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  105. package/components/AuthingGuard/index.tsx +0 -126
  106. package/components/AuthingGuard/style.less +0 -103
  107. package/components/AuthingGuard/types/Forms.ts +0 -94
  108. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  109. package/components/AuthingGuard/types/GuardState.ts +0 -7
  110. package/components/AuthingGuard/types/Locales.ts +0 -12
  111. package/components/AuthingGuard/types/index.ts +0 -4
  112. package/components/AuthingTabs/index.tsx +0 -98
  113. package/components/AuthingTabs/style.less +0 -135
  114. package/components/BindTotp/core/bindSuccess.tsx +0 -61
  115. package/components/BindTotp/core/securityCode.tsx +0 -119
  116. package/components/BindTotp/index.tsx +0 -134
  117. package/components/BindTotp/interface.ts +0 -30
  118. package/components/BindTotp/styles.less +0 -57
  119. package/components/ChangeLanguage/index.tsx +0 -35
  120. package/components/ChangePassword/core/firstLoginReset.tsx +0 -104
  121. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  122. package/components/ChangePassword/index.tsx +0 -59
  123. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  124. package/components/CompleteInfo/index.tsx +0 -45
  125. package/components/CompleteInfo/interface.ts +0 -40
  126. package/components/CompleteInfo/styles.less +0 -7
  127. package/components/CopyAbleText/index.tsx +0 -54
  128. package/components/CopyAbleText/style.less +0 -13
  129. package/components/DownloadAuthenticator/index.tsx +0 -97
  130. package/components/DownloadAuthenticator/interface.ts +0 -22
  131. package/components/DownloadAuthenticator/styles.less +0 -52
  132. package/components/Error/index.tsx +0 -21
  133. package/components/Error/interface.ts +0 -9
  134. package/components/Error/styles.less +0 -12
  135. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  136. package/components/ForgetPassword/index.tsx +0 -75
  137. package/components/ForgetPassword/interface.ts +0 -32
  138. package/components/Guard/Guard.tsx +0 -242
  139. package/components/Guard/authClient.ts +0 -55
  140. package/components/Guard/config.ts +0 -19
  141. package/components/Guard/event.ts +0 -52
  142. package/components/Guard/index.tsx +0 -4
  143. package/components/Guard/module.ts +0 -19
  144. package/components/Guard/stateMachine.ts +0 -133
  145. package/components/Guard/styles.less +0 -444
  146. package/components/IconFont/iconfont.js +0 -74
  147. package/components/IconFont/index.tsx +0 -16
  148. package/components/IconFont/style.less +0 -6
  149. package/components/IconFont/svg.js +0 -2
  150. package/components/ImagePro/index.tsx +0 -52
  151. package/components/ImagePro/styles.less +0 -40
  152. package/components/InputNumber/index.tsx +0 -33
  153. package/components/Login/codemap.ts +0 -39
  154. package/components/Login/core/withAD.tsx +0 -9
  155. package/components/Login/core/withAppQrcode.tsx +0 -49
  156. package/components/Login/core/withLDAP.tsx +0 -146
  157. package/components/Login/core/withPassword.tsx +0 -176
  158. package/components/Login/core/withPhonecode.tsx +0 -121
  159. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  160. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  161. package/components/Login/index.tsx +0 -368
  162. package/components/Login/props.ts +0 -74
  163. package/components/Login/socialLogin/index.tsx +0 -413
  164. package/components/Login/socialLogin/style.less +0 -61
  165. package/components/Login/styles.less +0 -53
  166. package/components/MFA/codemap.ts +0 -21
  167. package/components/MFA/core/email.tsx +0 -225
  168. package/components/MFA/core/face.tsx +0 -297
  169. package/components/MFA/core/face_deps.tsx +0 -37
  170. package/components/MFA/core/sms.tsx +0 -229
  171. package/components/MFA/core/totp.tsx +0 -137
  172. package/components/MFA/index.tsx +0 -137
  173. package/components/MFA/mfaMethods/index.tsx +0 -81
  174. package/components/MFA/mfaMethods/style.less +0 -39
  175. package/components/MFA/props.ts +0 -51
  176. package/components/MFA/styles.less +0 -93
  177. package/components/NeedHelpView/core/describeQuestions.tsx +0 -223
  178. package/components/NeedHelpView/index.tsx +0 -99
  179. package/components/RecoveryCode/core/useCode.tsx +0 -71
  180. package/components/RecoveryCode/index.tsx +0 -27
  181. package/components/RecoveryCode/interface.ts +0 -31
  182. package/components/RecoveryCode/style.less +0 -13
  183. package/components/Register/codemap.ts +0 -16
  184. package/components/Register/components/Agreements/index.tsx +0 -81
  185. package/components/Register/components/Agreements/style.less +0 -44
  186. package/components/Register/core/WithEmail.tsx +0 -236
  187. package/components/Register/core/WithPhone.tsx +0 -184
  188. package/components/Register/index.tsx +0 -123
  189. package/components/Register/props.ts +0 -50
  190. package/components/SendCode/SendCodeBtn.tsx +0 -96
  191. package/components/SendCode/index.tsx +0 -94
  192. package/components/SendCode/style.less +0 -31
  193. package/components/ShieldSpin/index.tsx +0 -27
  194. package/components/ShieldSpin/loading.svg +0 -29
  195. package/components/SubmitButton/index.tsx +0 -50
  196. package/components/Type/index.ts +0 -52
  197. package/components/ValidatorRules/EmailFormItem.tsx +0 -81
  198. package/components/ValidatorRules/PhoneFormItem.tsx +0 -90
  199. package/components/ValidatorRules/index.ts +0 -14
  200. package/components/VerifyCodeInput/index.tsx +0 -76
  201. package/components/VerifyCodeInput/style.less +0 -24
  202. package/components/_utils/GuardErrorCode.ts +0 -8
  203. package/components/_utils/clipboard.ts +0 -27
  204. package/components/_utils/config.ts +0 -121
  205. package/components/_utils/guradHttp.ts +0 -93
  206. package/components/_utils/hooks/index.ts +0 -64
  207. package/components/_utils/http.ts +0 -85
  208. package/components/_utils/index.ts +0 -319
  209. package/components/_utils/locales/en/common.json +0 -223
  210. package/components/_utils/locales/en/index.ts +0 -6
  211. package/components/_utils/locales/en/login.json +0 -96
  212. package/components/_utils/locales/en/map.json +0 -4
  213. package/components/_utils/locales/en/user.json +0 -82
  214. package/components/_utils/locales/index.ts +0 -45
  215. package/components/_utils/locales/zh/common.json +0 -223
  216. package/components/_utils/locales/zh/index.ts +0 -6
  217. package/components/_utils/locales/zh/login.json +0 -96
  218. package/components/_utils/locales/zh/map.json +0 -4
  219. package/components/_utils/locales/zh/user.json +0 -82
  220. package/components/_utils/popupCenter.ts +0 -48
  221. package/components/assets/images/error.png +0 -0
  222. package/components/context/base.tsx +0 -28
  223. package/components/context/global/context.tsx +0 -39
  224. package/components/context/global/reducer.tsx +0 -56
  225. package/components/context/module/context.tsx +0 -23
  226. package/components/index.ts +0 -12
  227. package/config/antdReplacer.js +0 -51
  228. package/config/env.js +0 -104
  229. package/config/getHttpsConfig.js +0 -66
  230. package/config/jest/cssTransform.js +0 -14
  231. package/config/jest/fileTransform.js +0 -40
  232. package/config/modules.js +0 -134
  233. package/config/paths.js +0 -71
  234. package/config/pnpTs.js +0 -35
  235. package/config/webpack.config.js +0 -835
  236. package/config/webpackDevServer.config.js +0 -130
  237. package/examples.tsx +0 -107
  238. package/index.js +0 -1
  239. package/lib/static/media/loading.4a67a5f3.svg +0 -29
  240. package/logo.svg +0 -7
  241. package/public/favicon.ico +0 -0
  242. package/public/index.html +0 -43
  243. package/public/logo192.png +0 -0
  244. package/public/logo512.png +0 -0
  245. package/public/manifest.json +0 -25
  246. package/public/robots.txt +0 -3
  247. package/react-app-env.d.ts +0 -71
  248. package/reportWebVitals.ts +0 -15
  249. package/scripts/build.js +0 -208
  250. package/scripts/lib.js +0 -200
  251. package/scripts/start.js +0 -162
  252. package/scripts/test.js +0 -49
  253. package/setupTests.ts +0 -5
  254. package/tsconfig.json +0 -30
@@ -1,103 +0,0 @@
1
- @import '~antd/lib/style/mixins/index.less';
2
-
3
- *[class*='authing-'] {
4
- @import '~antd/lib/style/core/global.less';
5
- }
6
-
7
- .authing-guard-text-btn {
8
- color: #396aff;
9
- padding: 0;
10
-
11
- &:hover,
12
- &:focus {
13
- color: #6b90ff;
14
- background-color: transparent;
15
- }
16
- }
17
-
18
- .authing-text-center {
19
- text-align: center;
20
- .authing-code-input {
21
- justify-content: center;
22
- }
23
- .authing-dropdown-menu-container {
24
- text-align: left;
25
- }
26
- }
27
-
28
- .authing-guard-form-actions {
29
- display: flex;
30
- justify-content: space-between;
31
- margin-top: 8px;
32
- align-items: center;
33
- .authing-ant-divider-vertical {
34
- visibility: hidden;
35
- }
36
- }
37
-
38
- .authing-guard-tip {
39
- color: #999;
40
- }
41
-
42
- .authing-guard-tip-btn-comb {
43
- margin-left: auto;
44
- }
45
-
46
- .authing-guard-full-width-space {
47
- width: 100%;
48
- }
49
-
50
- .authing-data-tips {
51
- position: relative;
52
- &::after {
53
- content: attr(data-tips);
54
- position: absolute;
55
- white-space: nowrap;
56
- top: 100%;
57
- left: 50%;
58
- transform: translateX(-50%) translateY(6px);
59
- display: none;
60
- background-color: rgba(0, 0, 0, 0.75);
61
- font-size: 12px;
62
- padding: 12px;
63
- z-index: 500;
64
- border-radius: 4px;
65
- color: #fff;
66
- }
67
- &:hover {
68
- &::after {
69
- display: block;
70
- }
71
- }
72
- }
73
- .authing-data-tips__top {
74
- position: relative;
75
- &::after {
76
- top: auto;
77
- bottom: 100%;
78
- transform: translateX(-50%) translateY(-6px);
79
- }
80
- }
81
-
82
- .authing-guard-pointer {
83
- cursor: pointer;
84
- }
85
-
86
- @media only screen and (max-width: 719px) {
87
- .authing-guard-form-actions {
88
- .authing-ant-divider-vertical {
89
- visibility: initial;
90
- }
91
- justify-content: flex-end !important;
92
- .authing-guard-text-btn {
93
- color: #999999;
94
- font-size: 12px;
95
- }
96
- .authing-guard-tip-btn-comb {
97
- margin-left: initial !important;
98
- font-size: 12px;
99
- font-weight: 400;
100
- color: #999999;
101
- }
102
- }
103
- }
@@ -1,94 +0,0 @@
1
- import { User } from 'authing-js-sdk'
2
- import { LoginMethods } from './GuardConfig'
3
- import { ResetPwdMethods } from './GuardConfig'
4
-
5
- export interface BaseFormProps extends React.HTMLAttributes<HTMLDivElement> {
6
- onSuccess?: (user: User) => void
7
- onFail?: (error: any) => void
8
- }
9
-
10
- export interface CompleteUserInfoFormProps extends BaseFormProps {}
11
-
12
- export interface PasswordLoginFormProps extends BaseFormProps {
13
- onValidateFail?: (error: any) => void
14
- }
15
-
16
- export interface ADLoginFormProps extends BaseFormProps {
17
- onValidateFail?: (error: any) => void
18
- }
19
-
20
- export interface PhoneCodeLoginFormProps extends BaseFormProps {
21
- onValidateFail?: (error: any) => void
22
- }
23
-
24
- export interface LdapLoginFormProps extends BaseFormProps {
25
- onValidateFail?: (error: any) => void
26
- }
27
-
28
- export interface QrLoginFormProps extends BaseFormProps {
29
- type: LoginMethods.AppQr | LoginMethods.WxMinQr | LoginMethods.WechatMpQrcode
30
- }
31
-
32
- export interface EmailRegisterFormProps extends BaseFormProps {
33
- onValidateFail?: (error: any) => void
34
- }
35
-
36
- export interface PhoneRegisterFormProps extends BaseFormProps {
37
- onValidateFail?: (error: any) => void
38
- }
39
-
40
- export interface ResetPasswordFormProps {
41
- onSuccess?: () => void
42
- onFail?: (error: any) => void
43
- }
44
-
45
- export interface ResetPasswordStep1Props {
46
- onSuccess: (resetMethod: ResetPwdMethods, val: string) => void
47
- }
48
-
49
- export interface ResetPasswordStep2Props {
50
- phone: string
51
- onSuccess: () => void
52
- onFail?: (error: any) => void
53
- }
54
-
55
- export interface ResetPasswordStep3Props {
56
- email: string
57
- onSuccess: () => void
58
- onFail?: (error: any) => void
59
- }
60
-
61
- export interface SocialAndIdpLoginProps extends BaseFormProps {}
62
-
63
- export interface MfaVerifyForm extends BaseFormProps {
64
- goReset: () => void
65
- }
66
- export interface SmsMFAVerifyFormProps extends BaseFormProps {
67
- phone?: string
68
- mfaToken: string
69
- sendCodeRef: React.RefObject<HTMLButtonElement>
70
- }
71
-
72
- export interface SmsMFAFormProps extends BaseFormProps {}
73
-
74
- export interface MFACheckPhoneFormProps {
75
- mfaToken: string
76
- onSuccess: (phone: string) => void
77
- }
78
-
79
- export interface EmailMFAVerifyFormProps extends BaseFormProps {
80
- email?: string
81
- mfaToken: string
82
- sendCodeRef: React.RefObject<HTMLButtonElement>
83
- }
84
-
85
- export interface EmailMFAFormProps extends BaseFormProps {}
86
-
87
- export interface MFACheckEmailFormProps {
88
- mfaToken: string
89
- onSuccess: (email: string) => void
90
- }
91
-
92
- export interface MfaResetForm extends BaseFormProps {
93
- goVerify: () => void
94
- }
@@ -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'