@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,94 +0,0 @@
|
|
|
1
|
-
import { Col, message, Row } from 'antd'
|
|
2
|
-
import React, { FC } from 'react'
|
|
3
|
-
import { EmailScene } from 'authing-js-sdk'
|
|
4
|
-
|
|
5
|
-
import { SendCodeBtn } from './SendCodeBtn'
|
|
6
|
-
|
|
7
|
-
import './style.less'
|
|
8
|
-
import { useTranslation } from 'react-i18next'
|
|
9
|
-
import { useAuthClient } from '../Guard/authClient'
|
|
10
|
-
import { validate } from '../_utils'
|
|
11
|
-
import { InputProps } from 'antd/lib/input'
|
|
12
|
-
import { InputNumber } from '../InputNumber'
|
|
13
|
-
|
|
14
|
-
export interface SendPhoneCodeProps extends InputProps {
|
|
15
|
-
method: 'phone' | 'email'
|
|
16
|
-
data: string
|
|
17
|
-
form?: any
|
|
18
|
-
onSendCodeBefore?: any // 点击的时候先做这个
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const SendCode: FC<SendPhoneCodeProps> = ({
|
|
22
|
-
method,
|
|
23
|
-
data,
|
|
24
|
-
value,
|
|
25
|
-
onChange,
|
|
26
|
-
form,
|
|
27
|
-
onSendCodeBefore,
|
|
28
|
-
maxLength,
|
|
29
|
-
...inputProps
|
|
30
|
-
}) => {
|
|
31
|
-
const { t } = useTranslation()
|
|
32
|
-
|
|
33
|
-
const authClient = useAuthClient()
|
|
34
|
-
|
|
35
|
-
const sendEmail = async (email: string) => {
|
|
36
|
-
if (!email) {
|
|
37
|
-
message.error(t('login.inputEmail'))
|
|
38
|
-
return false
|
|
39
|
-
}
|
|
40
|
-
if (!validate('email', email)) {
|
|
41
|
-
message.error(t('common.emailFormatError'))
|
|
42
|
-
return false
|
|
43
|
-
}
|
|
44
|
-
try {
|
|
45
|
-
await authClient.sendEmail(email, EmailScene.ResetPassword)
|
|
46
|
-
// onSend?.()
|
|
47
|
-
return true
|
|
48
|
-
} catch (error) {
|
|
49
|
-
// onError?.(error)
|
|
50
|
-
return false
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const sendPhone = async (phone: string) => {
|
|
55
|
-
try {
|
|
56
|
-
await authClient.sendSmsCode(phone)
|
|
57
|
-
return true
|
|
58
|
-
} catch (error) {
|
|
59
|
-
return false
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<>
|
|
65
|
-
<Row justify="space-between" align="middle">
|
|
66
|
-
<Col span={15} className="g2-send-code-input-col">
|
|
67
|
-
<InputNumber
|
|
68
|
-
value={value}
|
|
69
|
-
onChange={onChange}
|
|
70
|
-
{...inputProps}
|
|
71
|
-
maxLength={maxLength}
|
|
72
|
-
/>
|
|
73
|
-
</Col>
|
|
74
|
-
<Col offset={1} span={8}>
|
|
75
|
-
<SendCodeBtn
|
|
76
|
-
beforeSend={() => {
|
|
77
|
-
return onSendCodeBefore()
|
|
78
|
-
.then(async (b: any) => {
|
|
79
|
-
let phoneData = form ? form.getFieldValue(method) : data
|
|
80
|
-
return method === 'phone'
|
|
81
|
-
? await sendPhone(phoneData)
|
|
82
|
-
: await sendEmail(phoneData)
|
|
83
|
-
})
|
|
84
|
-
.catch((e: any) => {
|
|
85
|
-
// console.log('e', e)
|
|
86
|
-
return false
|
|
87
|
-
})
|
|
88
|
-
}}
|
|
89
|
-
/>
|
|
90
|
-
</Col>
|
|
91
|
-
</Row>
|
|
92
|
-
</>
|
|
93
|
-
)
|
|
94
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
.authing-g2-send-code-btn {
|
|
2
|
-
height: 46px;
|
|
3
|
-
width: 100%;
|
|
4
|
-
border: 1px solid #d4d6dc;
|
|
5
|
-
border-radius: 4px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.authing-g2-send-code-btn:hover {
|
|
9
|
-
background: rgba(57, 106, 255, 0.1);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.authing-g2-send-code-btn:focus {
|
|
13
|
-
outline: none;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.authing-g2-send-code-btn[disabled] {
|
|
17
|
-
cursor: not-allowed;
|
|
18
|
-
filter: opacity(0.5);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@media only screen and (max-width: 719px) {
|
|
22
|
-
.authing-g2-send-code-btn {
|
|
23
|
-
font-size: 14px;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.g2-loading-btn-center {
|
|
28
|
-
.authing-ant-btn-loading-icon .anticon {
|
|
29
|
-
padding-right: 0;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { ReactComponent as LoadShielding } from './loading.svg'
|
|
3
|
-
|
|
4
|
-
interface IG2SpinProps {
|
|
5
|
-
size?: number
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const ShieldSpin = (props: IG2SpinProps) => {
|
|
9
|
-
let size = props.size ? props.size : 50
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<div
|
|
13
|
-
style={{
|
|
14
|
-
width: size,
|
|
15
|
-
height: size,
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
<LoadShielding />
|
|
19
|
-
</div>
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const Spin = () => (
|
|
24
|
-
<div className="g2-init-setting-loading">
|
|
25
|
-
<ShieldSpin size={100} />
|
|
26
|
-
</div>
|
|
27
|
-
)
|
|
@@ -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>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
forwardRef,
|
|
3
|
-
useState,
|
|
4
|
-
useImperativeHandle,
|
|
5
|
-
useEffect,
|
|
6
|
-
} from 'react'
|
|
7
|
-
import { Button } from 'antd'
|
|
8
|
-
|
|
9
|
-
interface SubmitButtonProps {
|
|
10
|
-
text?: string
|
|
11
|
-
className?: string
|
|
12
|
-
onClick?: any
|
|
13
|
-
}
|
|
14
|
-
const SubmitButton = (props: SubmitButtonProps, ref: any) => {
|
|
15
|
-
let [spin, setSpin] = useState(false) // spin 状态需要手动设置关闭
|
|
16
|
-
let [shaking, setShaking] = useState(false) // 抖动状态会自动关闭
|
|
17
|
-
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
if (shaking === true) {
|
|
20
|
-
setTimeout(() => {
|
|
21
|
-
setShaking(false)
|
|
22
|
-
}, 1000)
|
|
23
|
-
}
|
|
24
|
-
}, [shaking])
|
|
25
|
-
|
|
26
|
-
useImperativeHandle(ref, () => ({
|
|
27
|
-
onError: (text?: string) => {
|
|
28
|
-
setShaking(true)
|
|
29
|
-
},
|
|
30
|
-
onSpin: (sp: boolean) => {
|
|
31
|
-
setSpin(sp)
|
|
32
|
-
},
|
|
33
|
-
}))
|
|
34
|
-
|
|
35
|
-
let propsCls = props.className ? props.className : ''
|
|
36
|
-
let shakingCls = shaking ? 'shaking' : ''
|
|
37
|
-
return (
|
|
38
|
-
<Button
|
|
39
|
-
size="large"
|
|
40
|
-
type="primary"
|
|
41
|
-
htmlType="submit"
|
|
42
|
-
loading={spin}
|
|
43
|
-
onClick={props.onClick ? props.onClick : () => {}}
|
|
44
|
-
className={`authing-g2-submit-button ${propsCls} ${shakingCls}`}
|
|
45
|
-
>
|
|
46
|
-
{props.text}
|
|
47
|
-
</Button>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
export default forwardRef(SubmitButton)
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
-
import { useTranslation } from 'react-i18next'
|
|
3
|
-
import { GuardModuleType } from '..'
|
|
4
|
-
import { ImagePro } from '../ImagePro'
|
|
5
|
-
import SubmitButton from '../SubmitButton'
|
|
6
|
-
import { GuardSubmitSuccessViewProps } from './interface'
|
|
7
|
-
|
|
8
|
-
export const GuardSubmitSuccessView: React.FC<GuardSubmitSuccessViewProps> = (
|
|
9
|
-
props
|
|
10
|
-
) => {
|
|
11
|
-
const { t } = useTranslation()
|
|
12
|
-
const { initData, config } = props
|
|
13
|
-
const [countDown, setCountDown] = useState(5)
|
|
14
|
-
|
|
15
|
-
const timerRef = useRef<any>(0)
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
title = t('common.problem.successTip'),
|
|
19
|
-
message = t('common.problem.successTipMsg'),
|
|
20
|
-
} = initData ?? {}
|
|
21
|
-
|
|
22
|
-
const cdnBase = config?.__publicConfig__?.cdnBase
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
timerRef.current = setInterval(() => {
|
|
26
|
-
setCountDown((prev) => {
|
|
27
|
-
return prev - 1
|
|
28
|
-
})
|
|
29
|
-
}, 1000)
|
|
30
|
-
|
|
31
|
-
return () => clearInterval(timerRef.current)
|
|
32
|
-
}, [])
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (countDown <= 0) {
|
|
36
|
-
clearInterval(timerRef.current)
|
|
37
|
-
props.__changeModule?.(GuardModuleType.LOGIN)
|
|
38
|
-
}
|
|
39
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
40
|
-
}, [countDown])
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<div className="g2-view-container">
|
|
44
|
-
<div className="g2-view-tabs g2-questions-send-success-page">
|
|
45
|
-
<ImagePro
|
|
46
|
-
className="plate"
|
|
47
|
-
src={`${cdnBase}/questions-send-ok.png`}
|
|
48
|
-
alt=""
|
|
49
|
-
width={191}
|
|
50
|
-
height={146}
|
|
51
|
-
/>
|
|
52
|
-
<div className="title">{title}</div>
|
|
53
|
-
<div className="message">{message}</div>
|
|
54
|
-
<SubmitButton
|
|
55
|
-
onClick={() => {
|
|
56
|
-
props.__changeModule?.(GuardModuleType.LOGIN)
|
|
57
|
-
}}
|
|
58
|
-
text={t('common.backLoginPage')}
|
|
59
|
-
/>
|
|
60
|
-
<div className="timer-tip">
|
|
61
|
-
{countDown} {t('common.pToLogin')}
|
|
62
|
-
</div>
|
|
63
|
-
</div>
|
|
64
|
-
</div>
|
|
65
|
-
)
|
|
66
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IG2Config, IG2Events, IG2FCViewProps } from '../Type'
|
|
2
|
-
|
|
3
|
-
export interface SubmitSuccessEvents extends IG2Events {}
|
|
4
|
-
|
|
5
|
-
export interface SubmitSuccessConfig extends IG2Config {}
|
|
6
|
-
|
|
7
|
-
export interface SubmitSuccessInitData {
|
|
8
|
-
title?: string
|
|
9
|
-
message?: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface GuardSubmitSuccessViewProps
|
|
13
|
-
extends IG2FCViewProps,
|
|
14
|
-
SubmitSuccessEvents {
|
|
15
|
-
config: SubmitSuccessConfig
|
|
16
|
-
initData?: SubmitSuccessInitData
|
|
17
|
-
}
|
package/components/Type/index.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { AuthenticationClient, CommonMessage } from 'authing-js-sdk'
|
|
2
|
-
import { Lang } from 'authing-js-sdk/build/main/types'
|
|
3
|
-
import { GuardMode } from '..'
|
|
4
|
-
import { ApplicationConfig } from '../AuthingGuard/api'
|
|
5
|
-
import { GuardModuleType } from '../Guard/module'
|
|
6
|
-
export interface IG2FCProps extends IG2Events {
|
|
7
|
-
appId: string
|
|
8
|
-
config?: Partial<IG2Config>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface IG2FCViewProps extends IG2FCProps {
|
|
12
|
-
config: IG2Config
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IG2Config {
|
|
16
|
-
title: string
|
|
17
|
-
logo: string
|
|
18
|
-
lang: Lang
|
|
19
|
-
langRange: Lang[]
|
|
20
|
-
host: string
|
|
21
|
-
mode: GuardMode
|
|
22
|
-
clickCloseable: boolean
|
|
23
|
-
escCloseable: boolean
|
|
24
|
-
userpool?: string
|
|
25
|
-
contentCss?: string
|
|
26
|
-
target?: HTMLElement | string
|
|
27
|
-
__appHost__?: string
|
|
28
|
-
__publicConfig__?: ApplicationConfig
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const defaultG2Config: IG2Config = {
|
|
32
|
-
lang: 'zh-CN',
|
|
33
|
-
langRange: ['zh-CN', 'en-US'],
|
|
34
|
-
title: 'Authing',
|
|
35
|
-
escCloseable: true,
|
|
36
|
-
clickCloseable: true,
|
|
37
|
-
mode: GuardMode.Normal,
|
|
38
|
-
host: 'https://core.authing.cn',
|
|
39
|
-
logo:
|
|
40
|
-
'https://files.authing.co/user-contents/photos/0a4c99ff-b8ce-4030-aaaf-584c807cb21c.png',
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface IG2Events {
|
|
44
|
-
onLoad?: (authClient: AuthenticationClient) => void
|
|
45
|
-
onLoadError?: (error: CommonMessage) => void
|
|
46
|
-
onClose?: () => void
|
|
47
|
-
onLangChange?: (lang: Lang) => void
|
|
48
|
-
// __codePaser?: (code: number) => Function
|
|
49
|
-
__changeModule?: (moduleName: GuardModuleType, initData?: any) => void
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const getDefaultG2Config = (): IG2Config => defaultG2Config
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { Form } from 'antd'
|
|
2
|
-
import React, {
|
|
3
|
-
forwardRef,
|
|
4
|
-
useCallback,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useMemo,
|
|
7
|
-
useState,
|
|
8
|
-
} from 'react'
|
|
9
|
-
import { fieldRequiredRule, sleep, VALIDATE_PATTERN } from '../_utils'
|
|
10
|
-
import { useGuardHttp } from '../_utils/guradHttp'
|
|
11
|
-
import { useTranslation } from 'react-i18next'
|
|
12
|
-
import {
|
|
13
|
-
ICheckProps,
|
|
14
|
-
ValidatorFormItemMetaProps,
|
|
15
|
-
ValidatorFormItemProps,
|
|
16
|
-
} from '.'
|
|
17
|
-
import { Rule } from 'antd/lib/form'
|
|
18
|
-
import { useDebounce } from '../_utils/hooks'
|
|
19
|
-
|
|
20
|
-
const checkError = (message: string) => Promise.reject(new Error(message))
|
|
21
|
-
|
|
22
|
-
const checkSuccess = (message?: string) => Promise.resolve(message ?? '')
|
|
23
|
-
|
|
24
|
-
const ValidatorFormItem = forwardRef<ICheckProps, ValidatorFormItemMetaProps>(
|
|
25
|
-
(props, ref) => {
|
|
26
|
-
const {
|
|
27
|
-
userPoolId,
|
|
28
|
-
form,
|
|
29
|
-
checkRepeat = false,
|
|
30
|
-
method,
|
|
31
|
-
...formItemProps
|
|
32
|
-
} = props
|
|
33
|
-
|
|
34
|
-
const { get } = useGuardHttp()
|
|
35
|
-
const { t } = useTranslation()
|
|
36
|
-
const [checked, setChecked] = useState(false)
|
|
37
|
-
|
|
38
|
-
const [isReady, setIsReady] = useState(false)
|
|
39
|
-
|
|
40
|
-
const methodContent = useMemo(() => {
|
|
41
|
-
if (method === 'email')
|
|
42
|
-
return {
|
|
43
|
-
field: t('common.emailLabel'),
|
|
44
|
-
checkErrorMessage: t('common.checkEmail'),
|
|
45
|
-
pattern: VALIDATE_PATTERN.email,
|
|
46
|
-
}
|
|
47
|
-
else
|
|
48
|
-
return {
|
|
49
|
-
field: t('common.phone'),
|
|
50
|
-
checkErrorMessage: t('common.phoneFormateError'),
|
|
51
|
-
pattern: VALIDATE_PATTERN.phone,
|
|
52
|
-
}
|
|
53
|
-
}, [method, t])
|
|
54
|
-
|
|
55
|
-
const checkField = useDebounce(async (value: string) => {
|
|
56
|
-
if (!(value && methodContent.pattern.test(value))) {
|
|
57
|
-
setIsReady(true)
|
|
58
|
-
return
|
|
59
|
-
}
|
|
60
|
-
let { data } = await get<boolean>(`/api/v2/users/find`, {
|
|
61
|
-
userPoolId: userPoolId,
|
|
62
|
-
key: value,
|
|
63
|
-
type: method,
|
|
64
|
-
})
|
|
65
|
-
setChecked(Boolean(data))
|
|
66
|
-
form?.validateFields([method])
|
|
67
|
-
setIsReady(true)
|
|
68
|
-
}, 500)
|
|
69
|
-
|
|
70
|
-
useImperativeHandle(ref, () => ({
|
|
71
|
-
check: (values: any) => {
|
|
72
|
-
setChecked(false)
|
|
73
|
-
if (values[method]) {
|
|
74
|
-
console.log('check', isReady)
|
|
75
|
-
setIsReady(false)
|
|
76
|
-
checkField(values[method])
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
}))
|
|
80
|
-
|
|
81
|
-
const checkReady = useCallback(async (): Promise<boolean> => {
|
|
82
|
-
if (isReady) return true
|
|
83
|
-
do {
|
|
84
|
-
await sleep(200)
|
|
85
|
-
} while (isReady)
|
|
86
|
-
|
|
87
|
-
return true
|
|
88
|
-
}, [isReady])
|
|
89
|
-
|
|
90
|
-
const validator = useCallback(async () => {
|
|
91
|
-
if ((await checkReady()) && checked)
|
|
92
|
-
return checkError(methodContent.checkErrorMessage)
|
|
93
|
-
else return checkSuccess()
|
|
94
|
-
}, [checkReady, checked, methodContent.checkErrorMessage])
|
|
95
|
-
|
|
96
|
-
const rules = useMemo<Rule[]>(() => {
|
|
97
|
-
const rules = [
|
|
98
|
-
...fieldRequiredRule(methodContent.field),
|
|
99
|
-
{
|
|
100
|
-
validator: (_: any, value: any) => {
|
|
101
|
-
if (!methodContent.pattern.test(value))
|
|
102
|
-
return checkError(methodContent.checkErrorMessage)
|
|
103
|
-
|
|
104
|
-
return checkSuccess()
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
]
|
|
108
|
-
checkRepeat &&
|
|
109
|
-
rules.push({
|
|
110
|
-
validator,
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
return rules
|
|
114
|
-
}, [
|
|
115
|
-
checkRepeat,
|
|
116
|
-
methodContent.checkErrorMessage,
|
|
117
|
-
methodContent.field,
|
|
118
|
-
methodContent.pattern,
|
|
119
|
-
validator,
|
|
120
|
-
])
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
<Form.Item
|
|
124
|
-
validateFirst={true}
|
|
125
|
-
rules={[...rules, ...(formItemProps?.rules ?? [])]}
|
|
126
|
-
{...formItemProps}
|
|
127
|
-
name={method}
|
|
128
|
-
/>
|
|
129
|
-
)
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
export const EmailFormItem = forwardRef<ICheckProps, ValidatorFormItemProps>(
|
|
134
|
-
(props, ref) => <ValidatorFormItem ref={ref} {...props} method="email" />
|
|
135
|
-
)
|
|
136
|
-
|
|
137
|
-
export const PhoneFormItem = forwardRef<ICheckProps, ValidatorFormItemProps>(
|
|
138
|
-
(props, ref) => <ValidatorFormItem ref={ref} {...props} method="phone" />
|
|
139
|
-
)
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FormInstance, FormItemProps } from 'antd/lib/form'
|
|
2
|
-
|
|
3
|
-
export interface ValidatorFormItemProps extends FormItemProps {
|
|
4
|
-
userPoolId?: string
|
|
5
|
-
form?: FormInstance
|
|
6
|
-
checkRepeat?: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ValidatorFormItemMetaProps extends ValidatorFormItemProps {
|
|
10
|
-
userPoolId?: string
|
|
11
|
-
form?: FormInstance
|
|
12
|
-
checkRepeat?: boolean
|
|
13
|
-
method: 'email' | 'phone'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface ICheckProps {
|
|
17
|
-
check: (values: any) => void
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { EmailFormItem, PhoneFormItem } from './ValidatorFormItem'
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { LoginMethods, RegisterMethods } from 'authing-js-sdk'
|
|
2
|
-
import { IG2Config } from '../Type'
|
|
3
|
-
import { ApplicationConfig } from '../AuthingGuard/api'
|
|
4
|
-
import { assembledAppHost } from '.'
|
|
5
|
-
import { getGuardHttp } from './guradHttp'
|
|
6
|
-
import { AuthingResponse } from './http'
|
|
7
|
-
import { GuardComponentConifg, GuardLocalConfig } from '../Guard/config'
|
|
8
|
-
|
|
9
|
-
let publicConfigMap: Record<string, ApplicationConfig> = {}
|
|
10
|
-
|
|
11
|
-
const getPublicConfig = (appId: string) => publicConfigMap?.[appId]
|
|
12
|
-
|
|
13
|
-
const setPublicConfig = (appId: string, config: ApplicationConfig) =>
|
|
14
|
-
(publicConfigMap[appId] = config)
|
|
15
|
-
|
|
16
|
-
export const initConfig = async (
|
|
17
|
-
appId: string,
|
|
18
|
-
config: Partial<IG2Config>,
|
|
19
|
-
defaultConfig: IG2Config
|
|
20
|
-
): Promise<{ config: GuardLocalConfig; publicConfig: ApplicationConfig }> => {
|
|
21
|
-
if (!getPublicConfig(appId)) await requestPublicConfig(appId)
|
|
22
|
-
const mergedConfig = mergeConfig(
|
|
23
|
-
config,
|
|
24
|
-
defaultConfig,
|
|
25
|
-
getPublicConfig(appId)
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
config: {
|
|
30
|
-
...mergedConfig,
|
|
31
|
-
__publicConfig__: getPublicConfig(appId),
|
|
32
|
-
__appHost__: assembledAppHost(
|
|
33
|
-
getPublicConfig(appId).identifier,
|
|
34
|
-
mergedConfig?.host!
|
|
35
|
-
),
|
|
36
|
-
},
|
|
37
|
-
publicConfig: getPublicConfig(appId),
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const mergeConfig = (
|
|
42
|
-
config: GuardComponentConifg,
|
|
43
|
-
defaultConfig: IG2Config,
|
|
44
|
-
publicConfig: ApplicationConfig
|
|
45
|
-
): GuardLocalConfig => {
|
|
46
|
-
const mergedPublicConfig: GuardLocalConfig = {
|
|
47
|
-
...defaultConfig,
|
|
48
|
-
...config,
|
|
49
|
-
title: config.title ?? publicConfig.name,
|
|
50
|
-
logo: !!config.logo ? config.logo : publicConfig.logo,
|
|
51
|
-
loginMethods:
|
|
52
|
-
config?.loginMethods ??
|
|
53
|
-
(publicConfig.loginTabs?.list as LoginMethods[]) ??
|
|
54
|
-
[],
|
|
55
|
-
passwordLoginMethods:
|
|
56
|
-
config?.passwordLoginMethods ??
|
|
57
|
-
publicConfig.passwordTabConfig?.enabledLoginMethods ??
|
|
58
|
-
[],
|
|
59
|
-
// 默认登录方式
|
|
60
|
-
defaultLoginMethod:
|
|
61
|
-
config.defaultLoginMethod ??
|
|
62
|
-
(publicConfig.loginTabs.default as LoginMethods),
|
|
63
|
-
// 禁止重制密码
|
|
64
|
-
disableResetPwd: !!(
|
|
65
|
-
config.disableResetPwd ??
|
|
66
|
-
!publicConfig.ssoPageComponentDisplay?.forgetPasswordBtn
|
|
67
|
-
),
|
|
68
|
-
// 是否自动注册
|
|
69
|
-
autoRegister:
|
|
70
|
-
config.autoRegister ??
|
|
71
|
-
publicConfig.ssoPageComponentDisplay.autoRegisterThenLoginHintInfo,
|
|
72
|
-
registerMethods:
|
|
73
|
-
config.registerMethods ??
|
|
74
|
-
(publicConfig.registerTabs?.list as RegisterMethods[]),
|
|
75
|
-
defaultRegisterMethod:
|
|
76
|
-
config.defaultRegisterMethod ??
|
|
77
|
-
(publicConfig.registerTabs.default as RegisterMethods),
|
|
78
|
-
// 禁止注册
|
|
79
|
-
disableRegister: !!(
|
|
80
|
-
config.disableRegister ??
|
|
81
|
-
!publicConfig.ssoPageComponentDisplay.registerBtn
|
|
82
|
-
),
|
|
83
|
-
// publicKey
|
|
84
|
-
publicKey: config.publicKey ?? publicConfig.publicKey,
|
|
85
|
-
// 注册协议
|
|
86
|
-
agreementEnabled: config.agreementEnabled ?? publicConfig.agreementEnabled,
|
|
87
|
-
agreements: config.agreements ?? publicConfig.agreements,
|
|
88
|
-
contentCss: config.contentCss ?? publicConfig.css,
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return mergedPublicConfig
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const requestPublicConfig = async (
|
|
95
|
-
appId: string
|
|
96
|
-
): Promise<ApplicationConfig> => {
|
|
97
|
-
let res: AuthingResponse<ApplicationConfig>
|
|
98
|
-
|
|
99
|
-
const { get } = getGuardHttp()
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
res = await get<ApplicationConfig>(
|
|
103
|
-
`/api/v2/applications/${appId}/public-config`
|
|
104
|
-
)
|
|
105
|
-
} catch (error) {
|
|
106
|
-
console.error('Please check your config or network')
|
|
107
|
-
throw new Error('Please check your config or network')
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (res.code !== 200 || !res.data)
|
|
111
|
-
throw new Error(res?.message ?? 'Please check your config')
|
|
112
|
-
|
|
113
|
-
setPublicConfig(appId, res.data)
|
|
114
|
-
|
|
115
|
-
return getPublicConfig(appId)
|
|
116
|
-
}
|