@authing/react-ui-components 2.4.54-alpha.0 → 2.4.55-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/build/asset-manifest.json +18 -18
  2. package/build/index.html +1 -1
  3. package/build/static/css/{2.40c24d2f.chunk.css → 2.e5f4a1ca.chunk.css} +2 -2
  4. package/build/static/css/2.e5f4a1ca.chunk.css.map +1 -0
  5. package/build/static/css/main.4dd73333.chunk.css +2 -0
  6. package/build/static/css/main.4dd73333.chunk.css.map +1 -0
  7. package/build/static/js/2.b28e1968.chunk.js +3 -0
  8. package/build/static/js/2.b28e1968.chunk.js.LICENSE.txt +70 -0
  9. package/build/static/js/2.b28e1968.chunk.js.map +1 -0
  10. package/build/static/js/{3.edcab7cd.chunk.js → 3.584da164.chunk.js} +2 -2
  11. package/build/static/js/{3.edcab7cd.chunk.js.map → 3.584da164.chunk.js.map} +1 -1
  12. package/build/static/js/main.eeb41586.chunk.js +2 -0
  13. package/build/static/js/main.eeb41586.chunk.js.map +1 -0
  14. package/build/static/js/{runtime-main.1b4b9135.js → runtime-main.6174f3e9.js} +2 -2
  15. package/build/static/js/{runtime-main.1b4b9135.js.map → runtime-main.6174f3e9.js.map} +1 -1
  16. package/lib/index.min.css +1 -2
  17. package/lib/index.min.js +1 -1
  18. package/lib/index.min.js.LICENSE.txt +0 -64
  19. package/package.json +3 -5
  20. package/src/common/AuthingDropdown/index.tsx +20 -58
  21. package/src/common/AuthingDropdown/style.less +8 -33
  22. package/src/components/AuthingGuard/AppMFALayout/index.tsx +15 -30
  23. package/src/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +3 -1
  24. package/src/components/AuthingGuard/GuardLayout/index.tsx +16 -32
  25. package/src/components/AuthingGuard/GuardLayout/style.less +0 -4
  26. package/src/components/AuthingGuard/Header/index.tsx +5 -2
  27. package/src/components/AuthingGuard/Header/style.less +23 -11
  28. package/src/components/AuthingGuard/IconFont/iconfont.js +74 -1
  29. package/src/components/AuthingGuard/LoginLayout/index.tsx +53 -22
  30. package/src/components/AuthingGuard/api/appConfig.ts +3 -2
  31. package/src/components/AuthingGuard/api/http.ts +32 -9
  32. package/src/components/AuthingGuard/constants.ts +2 -0
  33. package/src/components/AuthingGuard/hooks/index.tsx +0 -37
  34. package/src/components/AuthingGuard/index.tsx +8 -3
  35. package/src/components/AuthingGuard/locales/en/common.json +1 -2
  36. package/src/components/AuthingGuard/locales/en/login.json +1 -1
  37. package/src/components/AuthingGuard/locales/zh/common.json +1 -16
  38. package/src/components/AuthingGuard/types/Forms.ts +1 -2
  39. package/src/components/AuthingGuard/types/GuardConfig.ts +2 -1
  40. package/src/context/global/reducer.tsx +0 -4
  41. package/src/index.tsx +16 -28
  42. package/src/utils/index.ts +0 -23
  43. package/yarn-error.log +19616 -0
  44. package/build/static/css/2.40c24d2f.chunk.css.map +0 -1
  45. package/build/static/css/main.ee0e3901.chunk.css +0 -2
  46. package/build/static/css/main.ee0e3901.chunk.css.map +0 -1
  47. package/build/static/js/2.354276b9.chunk.js +0 -3
  48. package/build/static/js/2.354276b9.chunk.js.LICENSE.txt +0 -156
  49. package/build/static/js/2.354276b9.chunk.js.map +0 -1
  50. package/build/static/js/main.6c028b56.chunk.js +0 -2
  51. package/build/static/js/main.6c028b56.chunk.js.map +0 -1
  52. package/lib/index.d.ts +0 -1374
  53. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/AppDownload.tsx +0 -198
  54. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/BindSuccess.tsx +0 -48
  55. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/CopyIcon.tsx +0 -52
  56. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/InputSaftyCode.tsx +0 -25
  57. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/SaveSecretKey.tsx +0 -34
  58. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/ScanQrcode.tsx +0 -44
  59. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/index.tsx +0 -40
  60. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/BindTotpForm/styles.less +0 -454
  61. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/MobileSteps/index.tsx +0 -49
  62. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/MobileSteps/style.less +0 -10
  63. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/UserMfa/index.tsx +0 -361
  64. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/UserMfa/style.less +0 -12
  65. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/VerifyTotpForm.tsx +0 -120
  66. package/src/components/AuthingGuard/Forms/TotpMfaVerifyForm/index.tsx +0 -35
@@ -1,198 +0,0 @@
1
- import React, { FC } from 'react'
2
- import { Button } from 'antd'
3
- import { useTranslation } from 'react-i18next'
4
- import { IconFont } from '../../../IconFont'
5
- import './styles.less'
6
- import { getOS } from '../../../../../utils'
7
-
8
- export interface AppDownloadProps {}
9
-
10
- export const download_authenticator_config = {
11
- Android: {
12
- google:
13
- 'https://authing-public-cn.oss-cn-beijing.aliyuncs.com/public/Google%20Authenticator.apk',
14
- microsoft: 'https://mobile.baidu.com/item?docid=27175919',
15
- googleQRcode:
16
- 'https://files.authing.co/authing-user-portal/GoogleAuthenticator-Authing.png',
17
- microsoftQRcode:
18
- 'https://files.authing.co/authing-user-portal/MicrosoftAuthenticator-Baidu.png',
19
- },
20
- iOS: {
21
- google: 'https://apps.apple.com/us/app/google-authenticator/id388497605',
22
- microsoft:
23
- 'https://apps.apple.com/us/app/microsoft-authenticator/id983156458',
24
- googleQRcode:
25
- 'https://files.authing.co/authing-user-portal/GoogleAuthenticator-Apple.png',
26
- microsoftQRcode:
27
- 'https://files.authing.co/authing-user-portal/MicrosoftAuthenticator-Apple.png',
28
- },
29
- }
30
-
31
- const GoogleApple = download_authenticator_config.iOS.googleQRcode
32
- const MicrosoftApple = download_authenticator_config.iOS.microsoftQRcode
33
- const GoogleAuthing = download_authenticator_config.Android.googleQRcode
34
- const MicrosoftBaidu = download_authenticator_config.Android.microsoftQRcode
35
-
36
- export const AppDownload: FC<AppDownloadProps> = () => {
37
- const { t } = useTranslation()
38
-
39
- return (
40
- <div className="appDownload">
41
- <div className="item">
42
- <div
43
- className="logo"
44
- style={{
45
- background: '#EFF2F6',
46
- }}
47
- >
48
- <IconFont
49
- type="authing-apple-web"
50
- style={{
51
- fontSize: 30,
52
- color: '#293350',
53
- }}
54
- />
55
- </div>
56
- <span className="title">{t('common.downloadTotpAppIOS')}</span>
57
- <span className="subtitle">{t('common.downloadTotpAppDocs')}</span>
58
- <div className="QRCode">
59
- <div className="QRCodeItem">
60
- <div
61
- className="image"
62
- style={{
63
- backgroundSize: 'contain',
64
- backgroundRepeat: 'no-repeat',
65
- backgroundPosition: 'center',
66
- backgroundImage: `url('${GoogleApple}')`,
67
- }}
68
- />
69
- <span className="QRCodeText">Google Authenticator</span>
70
- </div>
71
- <div className="QRCodeItem">
72
- <div
73
- className="image"
74
- style={{
75
- backgroundSize: 'contain',
76
- backgroundRepeat: 'no-repeat',
77
- backgroundPosition: 'center',
78
- backgroundImage: `url('${MicrosoftApple}')`,
79
- }}
80
- />
81
- <span className="QRCodeText">Microsoft Authenticator</span>
82
- </div>
83
- </div>
84
- </div>
85
- <div className="item">
86
- <div
87
- className="logo"
88
- style={{
89
- background: '#28B1B0',
90
- }}
91
- >
92
- <IconFont
93
- type="authing-anzhuo"
94
- style={{
95
- fontSize: 30,
96
- color: '#FFF',
97
- }}
98
- />
99
- </div>
100
- <span className="title">{t('common.downloadTotpAppAndroid')}</span>
101
- <span className="subtitle">{t('common.downloadTotpAppDocs')}</span>
102
- <div className="QRCode">
103
- <div className="QRCodeItem">
104
- <div
105
- className="image"
106
- style={{
107
- backgroundSize: 'contain',
108
- backgroundRepeat: 'no-repeat',
109
- backgroundPosition: 'center',
110
- backgroundImage: `url('${GoogleAuthing}')`,
111
- }}
112
- />
113
- <span className="QRCodeText">Google Authenticator</span>
114
- </div>
115
- <div className="QRCodeItem">
116
- <div
117
- className="image"
118
- style={{
119
- backgroundSize: 'contain',
120
- backgroundRepeat: 'no-repeat',
121
- backgroundPosition: 'center',
122
- backgroundImage: `url('${MicrosoftBaidu}')`,
123
- }}
124
- />
125
- <span className="QRCodeText">Microsoft Authenticator</span>
126
- </div>
127
- </div>
128
- </div>
129
- </div>
130
- )
131
- }
132
-
133
- export const DOWNLOAD_AUTHENTICATOR_CONFIG = {
134
- Android: {
135
- google:
136
- 'https://authing-public-cn.oss-cn-beijing.aliyuncs.com/public/Google%20Authenticator.apk',
137
- microsoft: 'https://mobile.baidu.com/item?docid=27175919',
138
- },
139
- iOS: {
140
- google: 'https://apps.apple.com/us/app/google-authenticator/id388497605',
141
- microsoft:
142
- 'https://apps.apple.com/us/app/microsoft-authenticator/id983156458',
143
- },
144
- }
145
-
146
- export const MediaAppDownload: FC = () => {
147
- const { t } = useTranslation()
148
- const os = getOS()
149
-
150
- const appDownloadConfig = [
151
- {
152
- name: 'Google Authenticator',
153
- imageUrl:
154
- 'https://files.authing.co/authing-user-portal/logo-google%402x.png',
155
- download: () => {
156
- if (os && Object.keys(DOWNLOAD_AUTHENTICATOR_CONFIG).includes(os)) {
157
- // @ts-ignore
158
- window.open(`${DOWNLOAD_AUTHENTICATOR_CONFIG?.[os as never].google}`)
159
- }
160
- },
161
- },
162
- {
163
- name: 'Microsoft Authenticator',
164
- imageUrl:
165
- 'https://files.authing.co/authing-user-portal/logo-microsoft%402x.png',
166
- download: () => {
167
- if (os && Object.keys(DOWNLOAD_AUTHENTICATOR_CONFIG).includes(os)) {
168
- window.open(
169
- // @ts-ignore
170
- `${DOWNLOAD_AUTHENTICATOR_CONFIG?.[os as never].microsoft}`
171
- )
172
- }
173
- },
174
- },
175
- ]
176
-
177
- return (
178
- <div className={'mediaAppDownload'}>
179
- {appDownloadConfig.map((item, index) => (
180
- <div className={'mediaAppDownloadItem'} key={index}>
181
- <div className={'itemHeader'}>
182
- <img src={item.imageUrl} alt="app logo" />
183
- <span className="authing-mfa-dowload-item-title">{item.name}</span>
184
- <span className=""></span>
185
- </div>
186
- <Button
187
- className={'btnItem'}
188
- size="large"
189
- type="primary"
190
- onClick={item.download}
191
- >
192
- {t('common.download')}
193
- </Button>
194
- </div>
195
- ))}
196
- </div>
197
- )
198
- }
@@ -1,48 +0,0 @@
1
- import React, { FC, useEffect } from 'react'
2
- import { Space } from 'antd'
3
- import { TotpSource } from '../UserMfa'
4
- import { User } from 'authing-js-sdk'
5
- import { useTranslation } from 'react-i18next'
6
- import { useGuardContext } from '../../../../../context/global/context'
7
-
8
- export const BindSuccess: FC<{
9
- totpSource?: TotpSource
10
- user?: User
11
- }> = ({ totpSource = TotpSource.SELF, user }) => {
12
- const { t } = useTranslation()
13
-
14
- const {
15
- state: { guardEvents, authClient },
16
- } = useGuardContext()
17
-
18
- useEffect(() => {
19
- if (user && totpSource === TotpSource.APPLICATION) {
20
- setTimeout(() => {
21
- guardEvents.onLogin?.(user as any, authClient)
22
- }, 1000)
23
- }
24
- }, [guardEvents, user, totpSource, authClient])
25
-
26
- return (
27
- <Space size={16} direction="vertical">
28
- <img
29
- width="148"
30
- height="148"
31
- style={{
32
- marginBottom: '34px',
33
- }}
34
- src={
35
- 'https://files.authing.co/authing-user-portal/mfa-bind-success.png'
36
- }
37
- alt="bind success"
38
- />
39
- <h4 className={'subtitle'}>{t('user.bindSuccess')}</h4>
40
- {/* {totpSource === TotpSource.APPLICATION ? (
41
- <p className={'desc'}>{t('common.bindAppTotp')}</p>
42
- ) : (
43
- <p className={'desc'}>{t('user.bindedMfa')}</p>
44
- )} */}
45
- <p className={'desc'}>{t('user.bindedMfa')}</p>
46
- </Space>
47
- )
48
- }
@@ -1,52 +0,0 @@
1
- import React, { FC, useState } from 'react'
2
- import { CheckOutlined, CopyOutlined } from '@ant-design/icons'
3
- import { Tooltip } from 'antd'
4
- import { useTranslation } from 'react-i18next'
5
-
6
- export interface CopyIconProps {
7
- copyValue: string
8
- style?: React.CSSProperties
9
- className?: string
10
- }
11
- const CopyIcon: FC<CopyIconProps> = ({ copyValue, className, style }) => {
12
- const { t } = useTranslation()
13
-
14
- const [isCopy, setIsCopy] = useState(false)
15
-
16
- const onCopy = () => {
17
- setIsCopy(true)
18
-
19
- copyFunction(copyValue)
20
-
21
- setTimeout(() => {
22
- setIsCopy(false)
23
- }, 1000)
24
- }
25
-
26
- return !isCopy ? (
27
- <div className={className} style={style}>
28
- <CopyOutlined onClick={onCopy} />
29
- </div>
30
- ) : (
31
- <div className={className} style={style}>
32
- <Tooltip title={t('common.copyed')} visible={true}>
33
- <CheckOutlined style={{ color: '#52c41a' }} />
34
- </Tooltip>
35
- </div>
36
- )
37
- }
38
-
39
- export const copyFunction = (copyValue: string) => {
40
- let transfer = document.createElement('input')
41
- document.body.appendChild(transfer)
42
- transfer.value = copyValue
43
- transfer.focus()
44
- transfer.select()
45
- if (document.execCommand('copy')) {
46
- document.execCommand('copy')
47
- }
48
- transfer.blur()
49
- document.body.removeChild(transfer)
50
- }
51
-
52
- export default CopyIcon
@@ -1,25 +0,0 @@
1
- import React, { FC } from 'react'
2
- import { Space } from 'antd'
3
- import { useTranslation } from 'react-i18next'
4
- import { VerifyCodeInput } from '../../../../../common/VerifyCodeInput'
5
-
6
- export const InputSaftyCode: FC<{
7
- saftyCode: string[]
8
- isPhoneMedia: boolean
9
- setSaftyCode: (code: string[]) => void
10
- }> = ({ saftyCode, setSaftyCode, isPhoneMedia }) => {
11
- const { t } = useTranslation()
12
-
13
- return (
14
- <Space size={14} direction="vertical">
15
- <h4 className={'subtitle'}>{t('user.inputSafteyCode')}</h4>
16
- <p className={'desc'}>{t('user.viewInputSixCode')}</p>
17
- <VerifyCodeInput
18
- className={'saftyCodeInput'}
19
- verifyCode={saftyCode}
20
- setVerifyCode={setSaftyCode}
21
- />
22
- <p className={'saftyCodeTip'}>{t('user.numberSafteyCode')}</p>
23
- </Space>
24
- )
25
- }
@@ -1,34 +0,0 @@
1
- import React, { FC } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { Checkbox, Typography, Space } from 'antd'
4
-
5
- const { Paragraph } = Typography
6
-
7
- export const SaveSecretKey: FC<{
8
- setIsSaved: Function
9
- isSaved: boolean
10
- secret: string
11
- }> = ({ secret, isSaved, setIsSaved }) => {
12
- const { t } = useTranslation()
13
-
14
- const handleChange = (val: boolean) => {
15
- setIsSaved(val)
16
- }
17
- return (
18
- <Space size={16} direction="vertical">
19
- <h4 className="subtitle">{t('user.saveSecret')}</h4>
20
- <p className={'desc'}>{t('user.resetCodeDoWhat')}</p>
21
-
22
- <Paragraph className={'secretParagraph'} copyable>
23
- {secret}
24
- </Paragraph>
25
-
26
- <Checkbox
27
- onChange={(evt: any) => handleChange(evt.target.checked)}
28
- checked={isSaved}
29
- >
30
- {t('login.rememberedSecret')}
31
- </Checkbox>
32
- </Space>
33
- )
34
- }
@@ -1,44 +0,0 @@
1
- import React, { FC, useMemo } from 'react'
2
- import { useTranslation } from 'react-i18next'
3
- import { IconFont } from '../../../IconFont'
4
- import CopyIcon from './CopyIcon'
5
-
6
- export const ScanQrcode: FC<{
7
- qrcode: string
8
- secret: string
9
- isPhoneMedia: boolean
10
- userpoolName: string
11
- }> = ({ qrcode, secret, isPhoneMedia, userpoolName }) => {
12
- const { t } = useTranslation()
13
-
14
- const desc = useMemo(
15
- () =>
16
- isPhoneMedia
17
- ? t('user.pleaseDownloadAuthenticatorMedia')
18
- : t('user.pleaseDownloadAuthenticator'),
19
- [t, isPhoneMedia]
20
- )
21
-
22
- return (
23
- <div className="ScanQrcode">
24
- {!isPhoneMedia ? (
25
- <>
26
- <h4 className="subtitle">{t('user.scanQrcode')}</h4>
27
- <p className="desc">{desc}</p>
28
- <img className="qrcode" src={qrcode} alt="qrcode" />
29
- </>
30
- ) : (
31
- <>
32
- <h4 className="subtitle">{t('user.saveSecret')}</h4>
33
- <div className="secretInput">
34
- <div className="iconBox">
35
- <IconFont type="authing-key-2-line" />
36
- </div>
37
- {t('common.secret')}: {secret}
38
- <CopyIcon copyValue={secret} style={{ marginLeft: 'auto' }} />
39
- </div>
40
- </>
41
- )}
42
- </div>
43
- )
44
- }
@@ -1,40 +0,0 @@
1
- import React, { FC, useEffect } from 'react'
2
- import { useGuardContext } from 'src/context/global/context'
3
- import { UserMfa, TotpSource } from '../UserMfa/'
4
-
5
- export const BindTotpForm: FC<any> = (props) => {
6
- const { onSuccess, onFail } = props
7
- const {
8
- state: { mfaData, userPoolId, appId },
9
- setValue,
10
- } = useGuardContext()
11
-
12
- const { state } = useGuardContext()
13
-
14
- console.log(state)
15
-
16
- // 略微调整一下 Layout
17
- useEffect(() => {
18
- setValue('guardSize', 'large')
19
- setValue('showHeader', false)
20
- setValue('showBottom', false)
21
-
22
- return () => {
23
- setValue('guardSize', 'middle')
24
- setValue('showHeader', true)
25
- setValue('showBottom', true)
26
- }
27
- }, [setValue])
28
-
29
- return (
30
- <UserMfa
31
- userpoolName={''}
32
- userPoolId={userPoolId}
33
- appId={appId}
34
- totpSource={TotpSource.APPLICATION}
35
- MFAToken={mfaData.mfaToken as string}
36
- onSuccess={onSuccess}
37
- onFail={onFail}
38
- />
39
- )
40
- }