@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.
- package/.vscode/settings.json +1 -1
- package/LICENSE +21 -0
- package/config/env.js +26 -24
- package/config/paths.js +3 -3
- package/config/webpack.config.js +29 -7
- package/lib/index.d.ts +211 -1252
- package/lib/index.min.css +1 -2
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +0 -32
- package/package.json +14 -20
- package/scripts/build.js +83 -79
- package/scripts/start.js +73 -69
- package/scripts/test.js +23 -19
- package/{components → src/common}/AuthingDropdown/index.tsx +1 -1
- package/{components → src/common}/AuthingDropdown/style.less +0 -0
- package/{components → src/common}/AuthingTabs/index.tsx +1 -1
- package/{components → src/common}/AuthingTabs/style.less +0 -0
- package/{components → src/common}/CopyAbleText/index.tsx +1 -1
- package/{components → src/common}/CopyAbleText/style.less +0 -0
- package/{components → src/common}/VerifyCodeInput/index.tsx +0 -0
- package/{components → src/common}/VerifyCodeInput/style.less +0 -0
- package/{components → src/components}/AuthingGuard/AppMFALayout/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/AppMFALayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/ADLoginForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/Agreements/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/Agreements/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +3 -3
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +4 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/index.tsx +4 -9
- package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/PasswordLoginForm/index.tsx +3 -3
- package/{components → src/components}/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +4 -2
- package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +7 -7
- package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/UploadImage/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/index.ts +0 -0
- package/{components → src/components}/AuthingGuard/GuardLayout/index.tsx +17 -3
- package/{components → src/components}/AuthingGuard/GuardLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Header/index.tsx +6 -3
- package/{components → src/components}/AuthingGuard/Header/style.less +23 -11
- package/{components → src/components}/AuthingGuard/IconFont/iconfont.js +0 -0
- package/{components → src/components}/AuthingGuard/IconFont/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/IconFont/style.less +0 -0
- package/{components → src/components}/AuthingGuard/IconFont/svg.js +0 -0
- package/{components → src/components}/AuthingGuard/LoginLayout/index.tsx +69 -25
- package/{components → src/components}/AuthingGuard/LoginLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/MfaLayout/Steps.ts +0 -0
- package/{components → src/components}/AuthingGuard/MfaLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/MfaLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/RegisterLayout/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/RegisterLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/ResetPwdLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/ToggleLang/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/api/appConfig.ts +22 -14
- package/{components/_utils → src/components/AuthingGuard/api}/http.ts +33 -30
- package/{components → src/components}/AuthingGuard/api/index.ts +0 -0
- package/{components → src/components}/AuthingGuard/api/sso.ts +1 -1
- package/{components → src/components}/AuthingGuard/api/userPoolConfig.ts +3 -2
- package/{components → src/components}/AuthingGuard/constants.ts +2 -2
- package/{components → src/components}/AuthingGuard/hooks/index.tsx +0 -0
- package/{components → src/components}/AuthingGuard/hooks/useScreenSize.tsx +0 -0
- package/{components → src/components}/AuthingGuard/index.tsx +11 -3
- package/{components/_utils → src/components/AuthingGuard}/locales/en/common.json +26 -70
- package/{components/_utils → src/components/AuthingGuard}/locales/en/index.ts +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/en/login.json +19 -21
- package/{components/_utils → src/components/AuthingGuard}/locales/en/map.json +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/en/user.json +3 -4
- package/{components/_utils → src/components/AuthingGuard}/locales/index.ts +2 -2
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/common.json +9 -53
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/index.ts +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/login.json +4 -6
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/map.json +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/user.json +1 -3
- package/{components → src/components}/AuthingGuard/style.less +5 -0
- package/{components → src/components}/AuthingGuard/types/Forms.ts +2 -1
- package/{components → src/components}/AuthingGuard/types/GuardConfig.ts +5 -1
- package/{components → src/components}/AuthingGuard/types/GuardState.ts +1 -1
- package/{components → src/components}/AuthingGuard/types/Locales.ts +0 -0
- package/{components → src/components}/AuthingGuard/types/index.ts +0 -0
- package/src/components/index.ts +7 -0
- package/{components → src}/context/base.tsx +0 -0
- package/{components → src}/context/global/context.tsx +0 -0
- package/{components → src}/context/global/reducer.tsx +2 -2
- package/src/index.tsx +142 -0
- package/{logo.svg → src/logo.svg} +0 -0
- package/{react-app-env.d.ts → src/react-app-env.d.ts} +0 -0
- package/{reportWebVitals.ts → src/reportWebVitals.ts} +0 -0
- package/{setupTests.ts → src/setupTests.ts} +0 -0
- package/{components/_utils → src/utils}/clipboard.ts +1 -1
- package/{components/_utils → src/utils}/index.ts +3 -149
- package/{components/_utils → src/utils}/popupCenter.ts +0 -0
- package/tsconfig.json +2 -8
- package/build/asset-manifest.json +0 -26
- package/build/favicon.ico +0 -0
- package/build/index.html +0 -1
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/build/static/css/2.51c07e65.chunk.css +0 -3
- package/build/static/css/2.51c07e65.chunk.css.map +0 -1
- package/build/static/css/main.779f221a.chunk.css +0 -2
- package/build/static/css/main.779f221a.chunk.css.map +0 -1
- package/build/static/js/2.bbae9fdb.chunk.js +0 -3
- package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
- package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
- package/build/static/js/3.fd17f196.chunk.js +0 -2
- package/build/static/js/3.fd17f196.chunk.js.map +0 -1
- package/build/static/js/main.5f341531.chunk.js +0 -2
- package/build/static/js/main.5f341531.chunk.js.map +0 -1
- package/build/static/js/runtime-main.ef138021.js +0 -2
- package/build/static/js/runtime-main.ef138021.js.map +0 -1
- package/build/static/media/loading.4a67a5f3.svg +0 -29
- package/components/BindTotp/core/bindSuccess.tsx +0 -72
- package/components/BindTotp/core/securityCode.tsx +0 -108
- package/components/BindTotp/index.tsx +0 -134
- package/components/BindTotp/interface.ts +0 -30
- package/components/BindTotp/styles.less +0 -57
- package/components/ChangeLanguage/index.tsx +0 -35
- package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
- package/components/ChangePassword/core/rotateReset.tsx +0 -114
- package/components/ChangePassword/index.tsx +0 -72
- package/components/CompleteInfo/core/completeInfo.tsx +0 -155
- package/components/CompleteInfo/index.tsx +0 -45
- package/components/CompleteInfo/interface.ts +0 -40
- package/components/CompleteInfo/styles.less +0 -7
- package/components/DownloadAuthenticator/index.tsx +0 -97
- package/components/DownloadAuthenticator/interface.ts +0 -22
- package/components/DownloadAuthenticator/styles.less +0 -52
- package/components/Error/index.tsx +0 -21
- package/components/Error/interface.ts +0 -9
- package/components/Error/styles.less +0 -12
- package/components/ForgetPassword/core/resetPassword.tsx +0 -162
- package/components/ForgetPassword/index.tsx +0 -78
- package/components/ForgetPassword/interface.ts +0 -32
- package/components/Guard/Guard.tsx +0 -295
- package/components/Guard/authClient.ts +0 -44
- package/components/Guard/config.ts +0 -19
- package/components/Guard/event.ts +0 -52
- package/components/Guard/index.tsx +0 -4
- package/components/Guard/module.ts +0 -20
- package/components/Guard/stateMachine.ts +0 -152
- package/components/Guard/styles.less +0 -461
- package/components/IconFont/iconfont.js +0 -74
- package/components/IconFont/index.tsx +0 -16
- package/components/IconFont/style.less +0 -6
- package/components/IconFont/svg.js +0 -2
- package/components/ImagePro/index.tsx +0 -53
- package/components/ImagePro/styles.less +0 -40
- package/components/InputNumber/index.tsx +0 -33
- package/components/Login/codemap.ts +0 -49
- package/components/Login/core/withAD.tsx +0 -9
- package/components/Login/core/withAppQrcode.tsx +0 -49
- package/components/Login/core/withLDAP.tsx +0 -146
- package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
- package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
- package/components/Login/core/withPassword/InputAccount.tsx +0 -64
- package/components/Login/core/withPassword/index.tsx +0 -173
- package/components/Login/core/withPhonecode.tsx +0 -122
- package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
- package/components/Login/core/withWechatmpQrcode.tsx +0 -53
- package/components/Login/index.tsx +0 -374
- package/components/Login/props.ts +0 -74
- package/components/Login/socialLogin/index.tsx +0 -407
- package/components/Login/socialLogin/style.less +0 -69
- package/components/Login/styles.less +0 -53
- package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
- package/components/MFA/VerifyCodeInput/index.tsx +0 -145
- package/components/MFA/VerifyCodeInput/style.less +0 -35
- package/components/MFA/codemap.ts +0 -24
- package/components/MFA/core/email.tsx +0 -203
- package/components/MFA/core/face.tsx +0 -297
- package/components/MFA/core/face_deps.tsx +0 -37
- package/components/MFA/core/sms.tsx +0 -203
- package/components/MFA/core/totp.tsx +0 -122
- package/components/MFA/index.tsx +0 -143
- package/components/MFA/mfaMethods/index.tsx +0 -88
- package/components/MFA/mfaMethods/style.less +0 -39
- package/components/MFA/props.ts +0 -51
- package/components/MFA/styles.less +0 -100
- package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
- package/components/NeedHelpView/index.tsx +0 -47
- package/components/RecoveryCode/core/useCode.tsx +0 -71
- package/components/RecoveryCode/index.tsx +0 -27
- package/components/RecoveryCode/interface.ts +0 -31
- package/components/RecoveryCode/style.less +0 -13
- package/components/Register/codemap.ts +0 -12
- package/components/Register/components/Agreements/index.tsx +0 -81
- package/components/Register/components/Agreements/style.less +0 -44
- package/components/Register/core/WithEmail.tsx +0 -242
- package/components/Register/core/WithPhone.tsx +0 -184
- package/components/Register/index.tsx +0 -139
- package/components/Register/props.ts +0 -50
- package/components/SendCode/SendCodeBtn.tsx +0 -96
- package/components/SendCode/index.tsx +0 -94
- package/components/SendCode/style.less +0 -31
- package/components/ShieldSpin/index.tsx +0 -27
- package/components/ShieldSpin/loading.svg +0 -29
- package/components/SubmitButton/index.tsx +0 -50
- package/components/SubmitSuccess/index.tsx +0 -66
- package/components/SubmitSuccess/interface.ts +0 -17
- package/components/Type/index.ts +0 -52
- package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
- package/components/ValidatorRules/index.ts +0 -20
- package/components/_utils/GuardErrorCode.ts +0 -9
- package/components/_utils/config.ts +0 -116
- package/components/_utils/guradHttp.ts +0 -101
- package/components/_utils/hooks/index.ts +0 -64
- package/components/assets/images/error.png +0 -0
- package/components/context/module/context.tsx +0 -23
- package/components/index.ts +0 -12
- package/examples.tsx +0 -87
- package/index.js +0 -1
- package/lib/static/media/loading.4a67a5f3.svg +0 -29
- package/scripts/publish.js +0 -57
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import packageConfig from '../../package.json'
|
|
2
|
-
import { requestClient } from './http'
|
|
3
|
-
|
|
4
|
-
let httpClient: GuardHttp
|
|
5
|
-
|
|
6
|
-
export class GuardHttp {
|
|
7
|
-
private requestClient: any
|
|
8
|
-
private headers: Record<string, string> = {
|
|
9
|
-
'x-authing-userpool-id': '',
|
|
10
|
-
'x-authing-app-id': '',
|
|
11
|
-
'x-authing-sdk-version': packageConfig.version,
|
|
12
|
-
'x-authing-request-from': `Guard-${packageConfig.framework}@${packageConfig.version}`,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
constructor(baseUrl: string) {
|
|
16
|
-
this.getRequestClient().setBaseUrl(baseUrl)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
private getRequestClient() {
|
|
20
|
-
if (!this.requestClient) {
|
|
21
|
-
this.requestClient = requestClient
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return this.requestClient
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
setUserpoolId(userpoolId: string) {
|
|
28
|
-
this.headers['x-authing-userpool-id'] = userpoolId
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
setAppId(appId: string) {
|
|
32
|
-
this.headers['x-authing-app-id'] = appId
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
setTenantId(tenantId: string) {
|
|
36
|
-
this.headers['x-authing-app-tenant-id'] = tenantId
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
setBaseUrl(baseUrl: string) {
|
|
40
|
-
this.getRequestClient().setBaseUrl(baseUrl)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public getHeaders = () => this.headers
|
|
44
|
-
|
|
45
|
-
public get = async <T>(
|
|
46
|
-
path: string,
|
|
47
|
-
query: Record<string, any> = {},
|
|
48
|
-
config?: RequestInit
|
|
49
|
-
) =>
|
|
50
|
-
await requestClient.get<T>(path, query, {
|
|
51
|
-
...config,
|
|
52
|
-
headers: { ...this.headers, ...config?.headers },
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
public post = async <T>(
|
|
56
|
-
path: string,
|
|
57
|
-
data: any,
|
|
58
|
-
config?: {
|
|
59
|
-
headers: any
|
|
60
|
-
}
|
|
61
|
-
) =>
|
|
62
|
-
await requestClient.post<T>(path, data, {
|
|
63
|
-
headers: {
|
|
64
|
-
...this.headers,
|
|
65
|
-
...config?.headers,
|
|
66
|
-
},
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
public postForm = async <T>(
|
|
70
|
-
path: string,
|
|
71
|
-
formData: any,
|
|
72
|
-
config?: {
|
|
73
|
-
headers: any
|
|
74
|
-
}
|
|
75
|
-
) =>
|
|
76
|
-
await requestClient.postForm<T>(path, formData, {
|
|
77
|
-
headers: {
|
|
78
|
-
...this.headers,
|
|
79
|
-
...config?.headers,
|
|
80
|
-
},
|
|
81
|
-
})
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export const initGuardHttp = (baseUrl: string) => {
|
|
85
|
-
if (!httpClient) {
|
|
86
|
-
const guardHttp = new GuardHttp(baseUrl)
|
|
87
|
-
httpClient = guardHttp
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return httpClient
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export const getGuardHttp = () => {
|
|
94
|
-
if (!httpClient) {
|
|
95
|
-
throw new Error('Please initialize Http Client')
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return httpClient
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export const useGuardHttp = () => getGuardHttp()
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { useRef, useCallback, useEffect } from 'react'
|
|
2
|
-
import { GuardModuleType } from '../../Guard/module'
|
|
3
|
-
import { useModule } from '../../context/module/context'
|
|
4
|
-
|
|
5
|
-
export const useChangeModule = () => {
|
|
6
|
-
const { module, changeModule, setInitData } = useModule()
|
|
7
|
-
|
|
8
|
-
const nextModule = (nextModuleType: GuardModuleType, nextData?: any) => {
|
|
9
|
-
if (nextModuleType !== module) changeModule(nextModuleType)
|
|
10
|
-
|
|
11
|
-
setInitData(nextData ?? {})
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return nextModule
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let thisAppId: string = ''
|
|
18
|
-
|
|
19
|
-
export const useAppId = (appId?: string) => {
|
|
20
|
-
if (appId) {
|
|
21
|
-
thisAppId = appId
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return thisAppId
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const useDebounce = (
|
|
28
|
-
// 回调函数
|
|
29
|
-
fn: any,
|
|
30
|
-
// 延迟时间
|
|
31
|
-
delay: number
|
|
32
|
-
) => {
|
|
33
|
-
const timer = useRef<{ time: any }>({ time: null })
|
|
34
|
-
const errorBody = useRef<{ body: any }>({ body: null })
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
return () => {
|
|
38
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
39
|
-
timer.current.time && clearInterval(timer.current.time)
|
|
40
|
-
}
|
|
41
|
-
}, [])
|
|
42
|
-
|
|
43
|
-
return useCallback(
|
|
44
|
-
(...args: any[]) => {
|
|
45
|
-
if (timer.current.time) {
|
|
46
|
-
clearTimeout(timer.current.time)
|
|
47
|
-
timer.current.time = null
|
|
48
|
-
}
|
|
49
|
-
timer.current.time = setTimeout(() => {
|
|
50
|
-
// fn.apply(this, args);
|
|
51
|
-
const res = fn(...args)
|
|
52
|
-
timer.current.time = null
|
|
53
|
-
errorBody.current.body = res
|
|
54
|
-
}, delay)
|
|
55
|
-
// if (errorBody.current.body) {
|
|
56
|
-
// return Promise.reject(errorBody.current.body)
|
|
57
|
-
// } else {
|
|
58
|
-
// return Promise.resolve()
|
|
59
|
-
// }
|
|
60
|
-
},
|
|
61
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
|
-
[timer.current, delay]
|
|
63
|
-
)
|
|
64
|
-
}
|
|
Binary file
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React, { FC } from 'react'
|
|
2
|
-
import { GuardModuleType } from '../../Guard/module'
|
|
3
|
-
import { createBaseContext } from '../base'
|
|
4
|
-
|
|
5
|
-
export interface IModuleContext {
|
|
6
|
-
module: string
|
|
7
|
-
changeModule: React.Dispatch<GuardModuleType>
|
|
8
|
-
setInitData: React.Dispatch<any>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const [Context, useBaseContext] = createBaseContext<IModuleContext>()
|
|
12
|
-
|
|
13
|
-
export const useModule: () => IModuleContext = () => {
|
|
14
|
-
const guardContext = useBaseContext()
|
|
15
|
-
|
|
16
|
-
return guardContext
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const ModuleContext: FC<{
|
|
20
|
-
value: IModuleContext
|
|
21
|
-
}> = ({ children = null, value }) => {
|
|
22
|
-
return <Context.Provider value={value}>{children}</Context.Provider>
|
|
23
|
-
}
|
package/components/index.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export * from './AuthingGuard/types'
|
|
2
|
-
export * from './AuthingGuard/hooks'
|
|
3
|
-
export type { AuthenticationClientOptions } from 'authing-js-sdk'
|
|
4
|
-
|
|
5
|
-
export * from './Guard'
|
|
6
|
-
export * from './Type'
|
|
7
|
-
export * from './BindTotp/interface'
|
|
8
|
-
export * from './CompleteInfo/interface'
|
|
9
|
-
export * from './DownloadAuthenticator/interface'
|
|
10
|
-
export * from './Error/interface'
|
|
11
|
-
export * from './ForgetPassword/interface'
|
|
12
|
-
export * from './_utils/config'
|
package/examples.tsx
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import ReactDOM from 'react-dom'
|
|
3
|
-
|
|
4
|
-
import reportWebVitals from './reportWebVitals'
|
|
5
|
-
import { message } from 'antd'
|
|
6
|
-
import { Guard } from './components/Guard'
|
|
7
|
-
|
|
8
|
-
const App = () => {
|
|
9
|
-
return (
|
|
10
|
-
<div
|
|
11
|
-
style={{
|
|
12
|
-
display: 'flex',
|
|
13
|
-
width: '100vw',
|
|
14
|
-
justifyContent: 'center',
|
|
15
|
-
}}
|
|
16
|
-
>
|
|
17
|
-
<Guard
|
|
18
|
-
appId="619747787da1b9eb2e9ee7d5"
|
|
19
|
-
// appId="6191cf610f772aa56dc70637"
|
|
20
|
-
// tenantId="6194a41abf23c1d5268b362a1"
|
|
21
|
-
onLogin={(u) => {
|
|
22
|
-
message.info('🏁 用户业务层终点,登录完成。')
|
|
23
|
-
console.log(u)
|
|
24
|
-
}}
|
|
25
|
-
onLoad={(authClint) => console.log('🪝 onLoad', authClint)}
|
|
26
|
-
onLoadError={(error) => console.log('🪝 onLoadError', error)}
|
|
27
|
-
onBeforeLogin={(m) => {
|
|
28
|
-
console.log('🪝onBeforeLogin 触发,返回 promise 或布尔', m)
|
|
29
|
-
return new Promise((resolve) => {
|
|
30
|
-
resolve(true)
|
|
31
|
-
})
|
|
32
|
-
}}
|
|
33
|
-
onRegister={(user, authClint) => {
|
|
34
|
-
console.log('🪝 onRegister 触发', user, authClint)
|
|
35
|
-
}}
|
|
36
|
-
onRegisterError={(e) => console.log('🪝 onRegisterError 触发', e)}
|
|
37
|
-
onLoginError={() => {
|
|
38
|
-
console.log('❌ onLoginError 触发')
|
|
39
|
-
}}
|
|
40
|
-
onLoginTabChange={(key) => {
|
|
41
|
-
console.log('📁 onLoginTabChange 触发', key)
|
|
42
|
-
}}
|
|
43
|
-
onRegisterTabChange={(registerMethod) => {
|
|
44
|
-
console.log('📁 onRegisterTabChange 触发', registerMethod)
|
|
45
|
-
}}
|
|
46
|
-
config={{
|
|
47
|
-
// host: 'https://core.dev2.authing-inc.co/',
|
|
48
|
-
host: 'http://core.authing.localhost:3000/',
|
|
49
|
-
// registerMethods: [RegisterMethods.Email],
|
|
50
|
-
// autoRegister: true,
|
|
51
|
-
// defaultRegisterMethod: RegisterMethods.Phone,
|
|
52
|
-
// disableRegister: false,
|
|
53
|
-
// disableResetPwd: false,
|
|
54
|
-
// defaultLoginMethod: LoginMethods.WxMinQr, // 指定默认登录方式,如果这个方式不存在于 LoginMethods,那么就当作没有传入
|
|
55
|
-
// loginMethods: [],
|
|
56
|
-
// LoginMethods.Password,
|
|
57
|
-
// LoginMethods.PhoneCode,
|
|
58
|
-
// LoginMethods.WxMinQr,
|
|
59
|
-
// ],
|
|
60
|
-
// socialConnections: [
|
|
61
|
-
// SocialConnectionProvider.ALIPAY,
|
|
62
|
-
// SocialConnectionProvider.APPLE_WEB,
|
|
63
|
-
// ], // 指定可选的社会化登录方式
|
|
64
|
-
// qrCodeScanOptions?: Parameters<QrCodeAuthenticationClient['startScanning']>[1]
|
|
65
|
-
// passwordLoginMethods?: PasswordLoginMethods[]
|
|
66
|
-
// enterpriseConnections: [] // 这个有啥用?
|
|
67
|
-
// publicKey?: string
|
|
68
|
-
// lang: 'en-US',
|
|
69
|
-
// lang: 'zh-CN',
|
|
70
|
-
// mode: GuardMode.Modal,
|
|
71
|
-
// logo: '',
|
|
72
|
-
// clickCloseable: false, // clickCloseable Modal 模式时是否隐藏登录框右上角的关闭按钮
|
|
73
|
-
// escCloseable: true, //
|
|
74
|
-
// target: '#c1',
|
|
75
|
-
// socialConnectionsBtnShape: 'rectangle',
|
|
76
|
-
}}
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
ReactDOM.render(<App />, document.getElementById('root'))
|
|
83
|
-
|
|
84
|
-
// If you want to start measuring performance in your app, pass a function
|
|
85
|
-
// to log results (for example: reportWebVitals(console.log))
|
|
86
|
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
87
|
-
reportWebVitals()
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./components')
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
<svg width="100%" height="100%"
|
|
2
|
-
viewBox="0 0 150 150" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
-
<style>
|
|
4
|
-
#path-f {
|
|
5
|
-
fill: none;
|
|
6
|
-
stroke: #eaebee;
|
|
7
|
-
stroke-width: 10;
|
|
8
|
-
stroke-dasharray: 100 220;
|
|
9
|
-
animation: dash 40s infinite linear forwards;
|
|
10
|
-
}
|
|
11
|
-
#path-b {
|
|
12
|
-
fill: none;
|
|
13
|
-
stroke: #0080ff;
|
|
14
|
-
stroke-width: 8;
|
|
15
|
-
stroke-linecap: round;
|
|
16
|
-
stroke-linejoin: round;
|
|
17
|
-
}
|
|
18
|
-
@keyframes dash {
|
|
19
|
-
to {
|
|
20
|
-
stroke-dashoffset: 12000;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
</style>
|
|
24
|
-
<title>Loading</title>
|
|
25
|
-
<g id="单独" transform="translate(25.000000, 16.000000)" fill-rule="nonzero" stroke-width="2" >
|
|
26
|
-
<path d="M50,0 L0,30 C0,31 0,32 0,33 C0,69 20,100 50,116 C79,100 100,69 100,33 C100,32 99,31 99,30 L50,0 Z" id="path-b"/>
|
|
27
|
-
<path d="M50,0 L0,30 C0,31 0,32 0,33 C0,69 20,100 50,116 C79,100 100,69 100,33 C100,32 99,31 99,30 L50,0 Z" id="path-f"/>
|
|
28
|
-
</g>
|
|
29
|
-
</svg>
|
package/scripts/publish.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var $ = require('shelljs')
|
|
2
|
-
var Package = require('../package.json')
|
|
3
|
-
|
|
4
|
-
var version = Package.version
|
|
5
|
-
var name = Package.name
|
|
6
|
-
|
|
7
|
-
const getVersionTag = (version) => {
|
|
8
|
-
const tagArr = ['alpha', 'beta', 'rc']
|
|
9
|
-
|
|
10
|
-
const tagIndexArr = tagArr
|
|
11
|
-
.map((type) => version.search(type))
|
|
12
|
-
.filter((index) => index !== -1)
|
|
13
|
-
|
|
14
|
-
if (tagIndexArr.length === 0) return ''
|
|
15
|
-
|
|
16
|
-
const tagName = tagIndexArr[0]
|
|
17
|
-
|
|
18
|
-
return tagName
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
var build = $.exec('yarn build:lib')
|
|
22
|
-
|
|
23
|
-
if (build.code !== 0) {
|
|
24
|
-
$.echo('build 失败了~')
|
|
25
|
-
$.exit(1)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// $.exec(`git tab ${version}`)
|
|
29
|
-
|
|
30
|
-
var tag = getVersionTag(version)
|
|
31
|
-
|
|
32
|
-
let publish
|
|
33
|
-
|
|
34
|
-
if (tag !== '') {
|
|
35
|
-
publish = $.exec(`npm publish --tag ${tag}`)
|
|
36
|
-
} else {
|
|
37
|
-
publish = $.exec('npm publish')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (publish.code !== 0) {
|
|
41
|
-
$.echo(`publish 失败了~`)
|
|
42
|
-
$.exit(1)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if ($.which('cnpm')) {
|
|
46
|
-
$.echo(`正在同步到 淘宝源......`)
|
|
47
|
-
|
|
48
|
-
$.exec(`cnpm sync name`)
|
|
49
|
-
} else if ($.which('open')) {
|
|
50
|
-
$.exec(`open https://npmmirror.com/sync/${name}`)
|
|
51
|
-
} else {
|
|
52
|
-
$.echo(`记得手动同步到淘宝源~`)
|
|
53
|
-
|
|
54
|
-
$.echo(`https://npmmirror.com/sync/${name}`)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
$.exit(0)
|