@authing/react-ui-components 3.1.1 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +2573 -201
- package/lib/index.min.css +2 -1
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +42 -0
- package/lib/static/media/loading.4a67a5f3.svg +29 -0
- package/package.json +54 -18
- package/.eslintignore +0 -6
- package/.eslintrc.js +0 -7
- package/.prettierrc +0 -5
- package/.vscode/settings.json +0 -31
- package/LICENSE +0 -21
- package/config/antdReplacer.js +0 -51
- package/config/env.js +0 -106
- package/config/getHttpsConfig.js +0 -66
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileTransform.js +0 -40
- package/config/modules.js +0 -134
- package/config/paths.js +0 -71
- package/config/pnpTs.js +0 -35
- package/config/webpack.config.js +0 -857
- package/config/webpackDevServer.config.js +0 -130
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -43
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/scripts/build.js +0 -212
- package/scripts/lib.js +0 -200
- package/scripts/start.js +0 -166
- package/scripts/test.js +0 -53
- package/src/common/AuthingDropdown/index.tsx +0 -52
- package/src/common/AuthingDropdown/style.less +0 -43
- package/src/common/AuthingTabs/index.tsx +0 -98
- package/src/common/AuthingTabs/style.less +0 -135
- package/src/common/CopyAbleText/index.tsx +0 -54
- package/src/common/CopyAbleText/style.less +0 -13
- package/src/common/VerifyCodeInput/index.tsx +0 -76
- package/src/common/VerifyCodeInput/style.less +0 -24
- package/src/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
- package/src/components/AuthingGuard/AppMFALayout/style.less +0 -12
- package/src/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
- package/src/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
- package/src/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
- package/src/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
- package/src/components/AuthingGuard/Forms/Agreements/style.less +0 -44
- package/src/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -86
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
- package/src/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
- package/src/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
- package/src/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
- package/src/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -161
- package/src/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
- package/src/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
- package/src/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
- package/src/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
- package/src/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
- package/src/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
- package/src/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
- package/src/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
- package/src/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
- package/src/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -61
- package/src/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
- package/src/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
- package/src/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
- package/src/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
- package/src/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
- package/src/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
- package/src/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
- package/src/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
- package/src/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
- package/src/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
- package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
- package/src/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
- package/src/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
- package/src/components/AuthingGuard/Forms/index.ts +0 -13
- package/src/components/AuthingGuard/GuardLayout/index.tsx +0 -488
- package/src/components/AuthingGuard/GuardLayout/style.less +0 -111
- package/src/components/AuthingGuard/Header/index.tsx +0 -28
- package/src/components/AuthingGuard/Header/style.less +0 -64
- package/src/components/AuthingGuard/IconFont/iconfont.js +0 -74
- package/src/components/AuthingGuard/IconFont/index.tsx +0 -19
- package/src/components/AuthingGuard/IconFont/style.less +0 -6
- package/src/components/AuthingGuard/IconFont/svg.js +0 -2
- package/src/components/AuthingGuard/LoginLayout/index.tsx +0 -205
- package/src/components/AuthingGuard/LoginLayout/style.less +0 -0
- package/src/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
- package/src/components/AuthingGuard/MfaLayout/index.tsx +0 -49
- package/src/components/AuthingGuard/MfaLayout/style.less +0 -3
- package/src/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
- package/src/components/AuthingGuard/RegisterLayout/style.less +0 -0
- package/src/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
- package/src/components/AuthingGuard/ToggleLang/index.tsx +0 -51
- package/src/components/AuthingGuard/api/appConfig.ts +0 -154
- package/src/components/AuthingGuard/api/http.ts +0 -88
- package/src/components/AuthingGuard/api/index.ts +0 -3
- package/src/components/AuthingGuard/api/sso.ts +0 -29
- package/src/components/AuthingGuard/api/userPoolConfig.ts +0 -112
- package/src/components/AuthingGuard/constants.ts +0 -107
- package/src/components/AuthingGuard/hooks/index.tsx +0 -70
- package/src/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
- package/src/components/AuthingGuard/index.tsx +0 -134
- package/src/components/AuthingGuard/locales/en/common.json +0 -185
- package/src/components/AuthingGuard/locales/en/index.ts +0 -6
- package/src/components/AuthingGuard/locales/en/login.json +0 -94
- package/src/components/AuthingGuard/locales/en/map.json +0 -4
- package/src/components/AuthingGuard/locales/en/user.json +0 -81
- package/src/components/AuthingGuard/locales/index.ts +0 -45
- package/src/components/AuthingGuard/locales/zh/common.json +0 -185
- package/src/components/AuthingGuard/locales/zh/index.ts +0 -6
- package/src/components/AuthingGuard/locales/zh/login.json +0 -94
- package/src/components/AuthingGuard/locales/zh/map.json +0 -4
- package/src/components/AuthingGuard/locales/zh/user.json +0 -81
- package/src/components/AuthingGuard/style.less +0 -104
- package/src/components/AuthingGuard/types/Forms.ts +0 -95
- package/src/components/AuthingGuard/types/GuardConfig.ts +0 -424
- package/src/components/AuthingGuard/types/GuardState.ts +0 -7
- package/src/components/AuthingGuard/types/Locales.ts +0 -12
- package/src/components/AuthingGuard/types/index.ts +0 -4
- package/src/components/index.ts +0 -7
- package/src/context/base.tsx +0 -28
- package/src/context/global/context.tsx +0 -39
- package/src/context/global/reducer.tsx +0 -56
- package/src/index.tsx +0 -142
- package/src/logo.svg +0 -7
- package/src/react-app-env.d.ts +0 -71
- package/src/reportWebVitals.ts +0 -15
- package/src/setupTests.ts +0 -5
- package/src/utils/clipboard.ts +0 -27
- package/src/utils/index.ts +0 -180
- package/src/utils/popupCenter.ts +0 -48
- package/tsconfig.json +0 -24
package/src/index.tsx
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { Button } from 'antd'
|
|
2
|
-
import React, { useState } from 'react'
|
|
3
|
-
import ReactDOM from 'react-dom'
|
|
4
|
-
import { Lang } from './components'
|
|
5
|
-
import { AuthingGuard } from './components/AuthingGuard'
|
|
6
|
-
|
|
7
|
-
import { SocialConnectionProvider } from 'authing-js-sdk'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
GuardMode,
|
|
11
|
-
// LoginMethods,
|
|
12
|
-
UserConfig,
|
|
13
|
-
// LoginMethods,
|
|
14
|
-
// RegisterMethods,
|
|
15
|
-
// GuardScenes,
|
|
16
|
-
// SocialConnections,
|
|
17
|
-
} from './components/AuthingGuard/types/GuardConfig'
|
|
18
|
-
import reportWebVitals from './reportWebVitals'
|
|
19
|
-
|
|
20
|
-
const App = () => {
|
|
21
|
-
const [lang, setLang] = useState<Lang>('zh-CN')
|
|
22
|
-
const [title, setTitle] = useState('标题')
|
|
23
|
-
|
|
24
|
-
const config: UserConfig = {
|
|
25
|
-
mode: GuardMode.Modal,
|
|
26
|
-
// appHost: 'https://core.dev2.authing-inc.co',
|
|
27
|
-
apiHost: 'http://console.authing.localhost:3000',
|
|
28
|
-
// appHost: 'http://0w9ugz.authing.localhost:3000',
|
|
29
|
-
// apiHost: 'http://192.168.50.57:3000',
|
|
30
|
-
// loginMethods: Object.values(LoginMethods),
|
|
31
|
-
// logo:
|
|
32
|
-
// 'https://files.authing.co/user-contents/photos/0a4c99ff-b8ce-4030-aaaf-584c807cb21c.png',
|
|
33
|
-
// title: 'Authing',
|
|
34
|
-
// defaultLoginMethod: LoginMethods.LDAP,
|
|
35
|
-
// registerMethods: Object.values(RegisterMethods),
|
|
36
|
-
// defaultRegisterMethod: RegisterMethods.Email,
|
|
37
|
-
// defaultScenes: GuardScenes.Login,
|
|
38
|
-
// socialConnections: Object.values(SocialConnections),
|
|
39
|
-
// enterpriseConnections: ["oidc1"],
|
|
40
|
-
// appDomain: 'oidc1.authing.cn',
|
|
41
|
-
// appId: '5f17a529f64fb009b794a2ff',
|
|
42
|
-
// isSSO: true,
|
|
43
|
-
// zIndex: 300,
|
|
44
|
-
// text: {
|
|
45
|
-
// loginTabs: {
|
|
46
|
-
// [LoginMethods.Password]: '密码登录一下',
|
|
47
|
-
// },
|
|
48
|
-
// loginBtn: {
|
|
49
|
-
// loading: 'fuck',
|
|
50
|
-
// },
|
|
51
|
-
// },
|
|
52
|
-
// mode: GuardMode.Modal,
|
|
53
|
-
// contentCss: `
|
|
54
|
-
// html, body {
|
|
55
|
-
// background-color: #fff;
|
|
56
|
-
// }
|
|
57
|
-
// `,
|
|
58
|
-
// // autoRegister: true,
|
|
59
|
-
socialConnections: [SocialConnectionProvider.WECHATPC],
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const [visible, setVisible] = useState(false)
|
|
63
|
-
|
|
64
|
-
// useEffect(() => {
|
|
65
|
-
// setTimeout(() => setVisible(true), 3000)
|
|
66
|
-
// }, [])
|
|
67
|
-
|
|
68
|
-
// initAuthClient({
|
|
69
|
-
// appId: '60c02a89a9e0431e271d9ff0',
|
|
70
|
-
// // appHost: 'http://console.authing.localhost:3000',
|
|
71
|
-
// })
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
// eslint-disable-next-line react/jsx-no-undef
|
|
75
|
-
<>
|
|
76
|
-
<Button
|
|
77
|
-
type="primary"
|
|
78
|
-
onClick={() => {
|
|
79
|
-
//
|
|
80
|
-
}}
|
|
81
|
-
>
|
|
82
|
-
add socialConnections
|
|
83
|
-
</Button>
|
|
84
|
-
<Button
|
|
85
|
-
type="primary"
|
|
86
|
-
onClick={() => {
|
|
87
|
-
setVisible(!visible)
|
|
88
|
-
}}
|
|
89
|
-
>
|
|
90
|
-
开关
|
|
91
|
-
</Button>
|
|
92
|
-
<Button
|
|
93
|
-
type="primary"
|
|
94
|
-
onClick={() => {
|
|
95
|
-
setLang('zh-CN')
|
|
96
|
-
}}
|
|
97
|
-
>
|
|
98
|
-
中文
|
|
99
|
-
</Button>
|
|
100
|
-
<Button
|
|
101
|
-
type="primary"
|
|
102
|
-
onClick={() => {
|
|
103
|
-
setLang('en-US')
|
|
104
|
-
}}
|
|
105
|
-
>
|
|
106
|
-
English
|
|
107
|
-
</Button>
|
|
108
|
-
<input
|
|
109
|
-
value={title}
|
|
110
|
-
onChange={(evt) => setTitle(evt.target.value)}
|
|
111
|
-
></input>
|
|
112
|
-
<AuthingGuard
|
|
113
|
-
onLoad={(v) => console.log(v)}
|
|
114
|
-
visible={visible}
|
|
115
|
-
// onLoginTabChange={(v) => console.log(v)}
|
|
116
|
-
// onRegisterTabChange={(v) => console.log(v)}
|
|
117
|
-
// onClose={() => {
|
|
118
|
-
// setVisible(false)
|
|
119
|
-
// setTimeout(() => {
|
|
120
|
-
// setVisible(true)
|
|
121
|
-
// }, 2000)
|
|
122
|
-
// }}
|
|
123
|
-
onClose={() => {
|
|
124
|
-
setVisible(false)
|
|
125
|
-
}}
|
|
126
|
-
// onLoad={(a) => console.log(a, '加载完成')}
|
|
127
|
-
// onPwdResetError={(e) => console.log(e)}
|
|
128
|
-
appId="61ada57aef5ed526528ed5b6"
|
|
129
|
-
// tenantId="61a5ed126cddae656cce9007"
|
|
130
|
-
// appId="5fd877fb0ba0421962eced94"
|
|
131
|
-
config={config}
|
|
132
|
-
/>
|
|
133
|
-
</>
|
|
134
|
-
)
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
ReactDOM.render(<App />, document.getElementById('root'))
|
|
138
|
-
|
|
139
|
-
// If you want to start measuring performance in your app, pass a function
|
|
140
|
-
// to log results (for example: reportWebVitals(console.log))
|
|
141
|
-
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
142
|
-
reportWebVitals()
|
package/src/logo.svg
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
|
|
2
|
-
<g fill="#61DAFB">
|
|
3
|
-
<path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
|
|
4
|
-
<circle cx="420.9" cy="296.5" r="45.7"/>
|
|
5
|
-
<path d="M520.5 78.1z"/>
|
|
6
|
-
</g>
|
|
7
|
-
</svg>
|
package/src/react-app-env.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
/// <reference types="react-dom" />
|
|
4
|
-
|
|
5
|
-
declare namespace NodeJS {
|
|
6
|
-
interface ProcessEnv {
|
|
7
|
-
readonly NODE_ENV: 'development' | 'production' | 'test'
|
|
8
|
-
readonly PUBLIC_URL: string
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare module '*.avif' {
|
|
13
|
-
const src: string
|
|
14
|
-
export default src
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
declare module '*.bmp' {
|
|
18
|
-
const src: string
|
|
19
|
-
export default src
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
declare module '*.gif' {
|
|
23
|
-
const src: string
|
|
24
|
-
export default src
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
declare module '*.jpg' {
|
|
28
|
-
const src: string
|
|
29
|
-
export default src
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
declare module '*.jpeg' {
|
|
33
|
-
const src: string
|
|
34
|
-
export default src
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
declare module '*.png' {
|
|
38
|
-
const src: string
|
|
39
|
-
export default src
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
declare module '*.webp' {
|
|
43
|
-
const src: string
|
|
44
|
-
export default src
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
declare module '*.svg' {
|
|
48
|
-
import * as React from 'react'
|
|
49
|
-
|
|
50
|
-
export const ReactComponent: React.FunctionComponent<
|
|
51
|
-
React.SVGProps<SVGSVGElement> & { title?: string }
|
|
52
|
-
>
|
|
53
|
-
|
|
54
|
-
const src: string
|
|
55
|
-
export default src
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
declare module '*.module.css' {
|
|
59
|
-
const classes: { readonly [key: string]: string }
|
|
60
|
-
export default classes
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
declare module '*.module.scss' {
|
|
64
|
-
const classes: { readonly [key: string]: string }
|
|
65
|
-
export default classes
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
declare module '*.module.sass' {
|
|
69
|
-
const classes: { readonly [key: string]: string }
|
|
70
|
-
export default classes
|
|
71
|
-
}
|
package/src/reportWebVitals.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReportHandler } from 'web-vitals'
|
|
2
|
-
|
|
3
|
-
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
-
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
-
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
-
getCLS(onPerfEntry)
|
|
7
|
-
getFID(onPerfEntry)
|
|
8
|
-
getFCP(onPerfEntry)
|
|
9
|
-
getLCP(onPerfEntry)
|
|
10
|
-
getTTFB(onPerfEntry)
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default reportWebVitals
|
package/src/setupTests.ts
DELETED
package/src/utils/clipboard.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { i18n } from 'src/components/AuthingGuard/locales'
|
|
2
|
-
|
|
3
|
-
// https://juejin.im/post/6844903857290477582
|
|
4
|
-
export const copyToClipboard = (str: string) => {
|
|
5
|
-
const el = document.createElement('textarea') // 创建一个 <textarea> 元素
|
|
6
|
-
el.value = str // 设置它的值为你想复制的字符串
|
|
7
|
-
el.setAttribute('readonly', '') // 设置为只读以防止干扰
|
|
8
|
-
el.style.position = 'absolute'
|
|
9
|
-
el.style.left = '-9999px' // 移出屏幕外以使其不可见
|
|
10
|
-
document.body.appendChild(el) // 插入 <textarea> 元素到 HTML 文档中
|
|
11
|
-
try {
|
|
12
|
-
const selected =
|
|
13
|
-
document.getSelection()!.rangeCount > 0 // 检查是否之前曾选中过内容
|
|
14
|
-
? document.getSelection()!.getRangeAt(0) // 如果找到,则保存选中
|
|
15
|
-
: false // 标记为 false 以表示不存在之前选中的内容
|
|
16
|
-
el.select() // 选中 <textarea> 的内容
|
|
17
|
-
document.execCommand('copy') // 复制 - 仅当作为用户操作的响应结果时才可以工作(比如,点击事件)
|
|
18
|
-
document.body.removeChild(el) // 移除 <textarea> 元素
|
|
19
|
-
if (selected) {
|
|
20
|
-
// 如果在复制前已存在选中的内容
|
|
21
|
-
document.getSelection()!.removeAllRanges() // 取消 HTML 文档中所有的选中部分
|
|
22
|
-
document.getSelection()!.addRange(selected) // 恢复原来的选中
|
|
23
|
-
}
|
|
24
|
-
} catch (e) {
|
|
25
|
-
console.warn(i18n.t('common.copyFailed'))
|
|
26
|
-
}
|
|
27
|
-
}
|
package/src/utils/index.ts
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react'
|
|
2
|
-
import { Rule } from 'antd/lib/form'
|
|
3
|
-
import { useGuardContext } from '../context/global/context'
|
|
4
|
-
import qs from 'qs'
|
|
5
|
-
|
|
6
|
-
export * from './popupCenter'
|
|
7
|
-
export * from './clipboard'
|
|
8
|
-
|
|
9
|
-
export const VALIDATE_PATTERN = {
|
|
10
|
-
// https://emailregex.com/
|
|
11
|
-
// eslint-disable-next-line no-control-regex
|
|
12
|
-
email: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
|
13
|
-
// 以下的来自 authing-user-portal 项目
|
|
14
|
-
phone: /^1[3-9]\d{9}$/,
|
|
15
|
-
ip: /^((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}$/,
|
|
16
|
-
host: /^[a-zA-Z0-9][-a-zA-Z0-9]{0,62}(.[a-zA-Z0-9][-a-zA-Z0-9]{0,62})+.?$/,
|
|
17
|
-
} as const
|
|
18
|
-
|
|
19
|
-
export const validate = (type: keyof typeof VALIDATE_PATTERN, val: string) => {
|
|
20
|
-
return VALIDATE_PATTERN[type].test(val)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const getRequiredRules = (msg: string): Rule[] => {
|
|
24
|
-
return [
|
|
25
|
-
{
|
|
26
|
-
required: true,
|
|
27
|
-
message: msg,
|
|
28
|
-
},
|
|
29
|
-
]
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function getDeviceName() {
|
|
33
|
-
if (typeof window === 'undefined') {
|
|
34
|
-
return null
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const userAgent = window.navigator.userAgent
|
|
38
|
-
const platform = window.navigator.platform
|
|
39
|
-
const macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K']
|
|
40
|
-
const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE']
|
|
41
|
-
const iosPlatforms = ['iPhone', 'iPad', 'iPod']
|
|
42
|
-
|
|
43
|
-
let os = null
|
|
44
|
-
|
|
45
|
-
if (macosPlatforms.indexOf(platform) !== -1) {
|
|
46
|
-
os = 'Mac OS'
|
|
47
|
-
} else if (iosPlatforms.indexOf(platform) !== -1) {
|
|
48
|
-
os = 'iOS'
|
|
49
|
-
} else if (windowsPlatforms.indexOf(platform) !== -1) {
|
|
50
|
-
os = 'Windows'
|
|
51
|
-
} else if (/Android/.test(userAgent)) {
|
|
52
|
-
os = 'Android'
|
|
53
|
-
} else if (!os && /Linux/.test(platform)) {
|
|
54
|
-
os = 'Linux'
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return os
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type STYLE_RECORD_KEY = 'appConfig' | 'userConfig'
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* 传对象 {'background-color': 'red'}
|
|
64
|
-
* 传字符串 "CSS 样式"
|
|
65
|
-
*/
|
|
66
|
-
const insertedRecord: Record<STYLE_RECORD_KEY, any> = {
|
|
67
|
-
appConfig: null,
|
|
68
|
-
userConfig: null,
|
|
69
|
-
}
|
|
70
|
-
export const insertStyles = (
|
|
71
|
-
styles: string | any,
|
|
72
|
-
recordKey: STYLE_RECORD_KEY
|
|
73
|
-
) => {
|
|
74
|
-
let styleElt, styleSheet
|
|
75
|
-
if ((document as any).createStyleSheet) {
|
|
76
|
-
// IE
|
|
77
|
-
styleSheet = (document as any).createStyleSheet()
|
|
78
|
-
} else {
|
|
79
|
-
let head = document.getElementsByTagName('head')[0]
|
|
80
|
-
styleElt = document.createElement('style')
|
|
81
|
-
head.appendChild(styleElt)
|
|
82
|
-
styleSheet = document.styleSheets[document.styleSheets.length - 1]
|
|
83
|
-
}
|
|
84
|
-
if (typeof styles === 'string') {
|
|
85
|
-
if (styleElt) styleElt.innerHTML = styles
|
|
86
|
-
else styleSheet.cssText = styles // IE
|
|
87
|
-
} else {
|
|
88
|
-
let i = 0
|
|
89
|
-
for (let selector in styles) {
|
|
90
|
-
if (styleSheet.insertRule) {
|
|
91
|
-
let rule = selector + ' {' + styles[selector] + '}'
|
|
92
|
-
styleSheet.insertRule(rule, i++)
|
|
93
|
-
} else {
|
|
94
|
-
styleSheet.addRule(selector, styles[selector], i++)
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
insertedRecord[recordKey] = styleElt
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export const removeStyles = (recordKey: STYLE_RECORD_KEY) => {
|
|
103
|
-
if (!insertedRecord[recordKey]) {
|
|
104
|
-
return
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const styleElt = insertedRecord[recordKey]
|
|
108
|
-
|
|
109
|
-
styleElt.parentNode?.removeChild(styleElt)
|
|
110
|
-
|
|
111
|
-
insertedRecord[recordKey] = null
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export const useTitle = (title: string, prefix?: string) => {
|
|
115
|
-
const {
|
|
116
|
-
state: { config },
|
|
117
|
-
} = useGuardContext()
|
|
118
|
-
|
|
119
|
-
useEffect(() => {
|
|
120
|
-
document.title = `${prefix ?? `${config.title} `} ${title}`
|
|
121
|
-
}, [config.title, prefix, title])
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export const getClassnames = (classnames: (string | boolean | undefined)[]) => {
|
|
125
|
-
return classnames.filter(Boolean).join(' ')
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* https://www.itranslater.com/qa/details/2115518846294557696
|
|
130
|
-
* Simple object check.
|
|
131
|
-
* @param item
|
|
132
|
-
* @returns {boolean}
|
|
133
|
-
*/
|
|
134
|
-
export function isObject(item: any) {
|
|
135
|
-
return item && typeof item === 'object' && !Array.isArray(item)
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* https://www.itranslater.com/qa/details/2115518846294557696
|
|
140
|
-
* Deep merge two objects.
|
|
141
|
-
* @param target
|
|
142
|
-
* @param ...sources
|
|
143
|
-
*/
|
|
144
|
-
export function deepMerge<T extends any = any>(
|
|
145
|
-
target: T,
|
|
146
|
-
...sources: any[]
|
|
147
|
-
): T {
|
|
148
|
-
if (!sources.length) return target
|
|
149
|
-
const source = sources.shift()
|
|
150
|
-
|
|
151
|
-
if (isObject(target) && isObject(source)) {
|
|
152
|
-
for (const key in source) {
|
|
153
|
-
if (isObject(source[key])) {
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
if (!target[key]) {
|
|
156
|
-
Object.assign(target, { [key]: {} })
|
|
157
|
-
}
|
|
158
|
-
// @ts-ignore
|
|
159
|
-
deepMerge(target[key], source[key])
|
|
160
|
-
} else {
|
|
161
|
-
Object.assign(target, { [key]: source[key] })
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
return deepMerge(target, ...sources)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
export const getUserRegisterParams = () => {
|
|
170
|
-
const query = qs.parse(window.location.search, {
|
|
171
|
-
ignoreQueryPrefix: true,
|
|
172
|
-
})
|
|
173
|
-
return Object.keys(query).map((key) => ({
|
|
174
|
-
key,
|
|
175
|
-
value: query[key],
|
|
176
|
-
}))
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export const isWechatBrowser = () =>
|
|
180
|
-
/MicroMessenger/i.test(navigator?.userAgent)
|
package/src/utils/popupCenter.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 在屏幕中心弹出新窗口加载 url
|
|
3
|
-
* @param url
|
|
4
|
-
* @param param1
|
|
5
|
-
*/
|
|
6
|
-
export const popupCenter = (
|
|
7
|
-
url: string,
|
|
8
|
-
{ w, h }: { w: number; h: number } = { w: 585, h: 649 }
|
|
9
|
-
) => {
|
|
10
|
-
// Fixes dual-screen position Most browsers Firefox
|
|
11
|
-
const dualScreenLeft =
|
|
12
|
-
window.screenLeft !== undefined ? window.screenLeft : window.screenX
|
|
13
|
-
const dualScreenTop =
|
|
14
|
-
window.screenTop !== undefined ? window.screenTop : window.screenY
|
|
15
|
-
|
|
16
|
-
const width = window.innerWidth
|
|
17
|
-
? window.innerWidth
|
|
18
|
-
: document.documentElement.clientWidth
|
|
19
|
-
? document.documentElement.clientWidth
|
|
20
|
-
: window.screen.width
|
|
21
|
-
const height = window.innerHeight
|
|
22
|
-
? window.innerHeight
|
|
23
|
-
: document.documentElement.clientHeight
|
|
24
|
-
? document.documentElement.clientHeight
|
|
25
|
-
: window.screen.height
|
|
26
|
-
|
|
27
|
-
const systemZoom = width / window.screen.availWidth
|
|
28
|
-
const left = (width - w) / 2 / systemZoom + dualScreenLeft
|
|
29
|
-
const top = (height - h) / 2 / systemZoom + dualScreenTop
|
|
30
|
-
const newWindow = window.open(
|
|
31
|
-
url,
|
|
32
|
-
'_blank',
|
|
33
|
-
`
|
|
34
|
-
toolbar=no,
|
|
35
|
-
menubar=no,
|
|
36
|
-
scrollbars=no,
|
|
37
|
-
resizable=no,
|
|
38
|
-
location=no,
|
|
39
|
-
status=no
|
|
40
|
-
width=${w / systemZoom},
|
|
41
|
-
height=${h / systemZoom},
|
|
42
|
-
top=${top},
|
|
43
|
-
left=${left}
|
|
44
|
-
`
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
newWindow?.focus()
|
|
48
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"outDir": "lib/",
|
|
5
|
-
"target": "es5",
|
|
6
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"skipLibCheck": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"noFallthroughCasesInSwitch": true,
|
|
14
|
-
"module": "esnext",
|
|
15
|
-
"moduleResolution": "node",
|
|
16
|
-
"resolveJsonModule": true,
|
|
17
|
-
"isolatedModules": true,
|
|
18
|
-
"declaration": true,
|
|
19
|
-
"noEmit": false,
|
|
20
|
-
"jsx": "react"
|
|
21
|
-
},
|
|
22
|
-
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json"],
|
|
23
|
-
"exclude": ["node_modules", "lib", "build"]
|
|
24
|
-
}
|