@authing/react-ui-components 3.0.2-beta.3 → 3.0.2-beta.7

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 (60) hide show
  1. package/build/asset-manifest.json +18 -18
  2. package/build/index.html +1 -1
  3. package/build/static/css/2.5c23c9b8.chunk.css +3 -0
  4. package/build/static/css/2.5c23c9b8.chunk.css.map +1 -0
  5. package/build/static/css/main.6a8701e8.chunk.css +2 -0
  6. package/build/static/css/main.6a8701e8.chunk.css.map +1 -0
  7. package/build/static/js/2.142555a1.chunk.js +3 -0
  8. package/build/static/js/{2.1105ecfb.chunk.js.LICENSE.txt → 2.142555a1.chunk.js.LICENSE.txt} +0 -0
  9. package/build/static/js/2.142555a1.chunk.js.map +1 -0
  10. package/build/static/js/{3.fd17f196.chunk.js → 3.ed27e06b.chunk.js} +2 -2
  11. package/build/static/js/{3.fd17f196.chunk.js.map → 3.ed27e06b.chunk.js.map} +1 -1
  12. package/build/static/js/main.8d075e4d.chunk.js +2 -0
  13. package/build/static/js/main.8d075e4d.chunk.js.map +1 -0
  14. package/build/static/js/{runtime-main.ef138021.js → runtime-main.9a428724.js} +2 -2
  15. package/build/static/js/{runtime-main.ef138021.js.map → runtime-main.9a428724.js.map} +1 -1
  16. package/components/BindTotp/interface.ts +1 -1
  17. package/components/ChangePassword/core/firstLoginReset.tsx +14 -7
  18. package/components/ChangePassword/core/rotateReset.tsx +19 -8
  19. package/components/ChangePassword/index.tsx +21 -8
  20. package/components/CompleteInfo/interface.ts +1 -1
  21. package/components/Guard/Guard.tsx +99 -59
  22. package/components/Guard/config.ts +2 -2
  23. package/components/Guard/event.ts +2 -2
  24. package/components/Guard/stateMachine.ts +19 -0
  25. package/components/Login/codemap.ts +3 -1
  26. package/components/Login/core/withPassword/index.tsx +3 -3
  27. package/components/Login/index.tsx +6 -5
  28. package/components/Login/{props.ts → interface.ts} +0 -0
  29. package/components/Login/socialLogin/index.tsx +1 -1
  30. package/components/MFA/core/email.tsx +1 -1
  31. package/components/MFA/core/sms.tsx +1 -1
  32. package/components/MFA/core/totp.tsx +1 -1
  33. package/components/MFA/index.tsx +1 -1
  34. package/components/MFA/{props.ts → interface.ts} +0 -0
  35. package/components/MFA/mfaMethods/index.tsx +1 -1
  36. package/components/Register/index.tsx +1 -1
  37. package/components/Register/{props.ts → interface.ts} +0 -0
  38. package/components/_utils/config.ts +2 -4
  39. package/components/_utils/guradHttp.ts +4 -0
  40. package/components/_utils/index.ts +5 -1
  41. package/components/_utils/locales/en/common.json +3 -1
  42. package/components/_utils/locales/zh/common.json +3 -1
  43. package/components/_utils/locales/zh/user.json +1 -0
  44. package/components/index.ts +4 -7
  45. package/examples.tsx +35 -35
  46. package/package.json +1 -1
  47. package/.vscode/settings.json +0 -31
  48. package/build/static/css/2.9512539b.chunk.css +0 -3
  49. package/build/static/css/2.9512539b.chunk.css.map +0 -1
  50. package/build/static/css/main.0ff9e24a.chunk.css +0 -2
  51. package/build/static/css/main.0ff9e24a.chunk.css.map +0 -1
  52. package/build/static/js/2.1105ecfb.chunk.js +0 -3
  53. package/build/static/js/2.1105ecfb.chunk.js.map +0 -1
  54. package/build/static/js/main.a47645ff.chunk.js +0 -2
  55. package/build/static/js/main.a47645ff.chunk.js.map +0 -1
  56. package/lib/index.d.ts +0 -2278
  57. package/lib/index.min.css +0 -2
  58. package/lib/index.min.js +0 -2
  59. package/lib/index.min.js.LICENSE.txt +0 -69
  60. package/lib/static/media/loading.4a67a5f3.svg +0 -29
@@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'
4
4
  import { useAsyncFn } from 'react-use'
5
5
  import { GuardModuleType } from '../../Guard/module'
6
6
  import { useGuardHttp } from '../../_utils/guradHttp'
7
- import { GuardMFAInitData, MFAConfig } from '../props'
7
+ import { GuardMFAInitData, MFAConfig } from '../interface'
8
8
  import { message as Message } from 'antd'
9
9
  import SubmitButton from '../../SubmitButton'
10
10
  import { VerifyCodeFormItem } from '../VerifyCodeInput/VerifyCodeFormItem'
@@ -7,7 +7,7 @@ import { MFASms } from './core/sms'
7
7
  import { MFAFace } from './core/face'
8
8
  import { MFATotp } from './core/totp'
9
9
  import { MFAMethods } from './mfaMethods'
10
- import { GuardMFAViewProps, MFAType } from './props'
10
+ import { GuardMFAViewProps, MFAType } from './interface'
11
11
  import { useAuthClient } from '../Guard/authClient'
12
12
  import { codeMap } from './codemap'
13
13
  import './styles.less'
File without changes
@@ -2,7 +2,7 @@ import React, { useMemo, useState } from 'react'
2
2
  import { useTranslation } from 'react-i18next'
3
3
  import { Button } from 'antd'
4
4
  import { IconFont } from '../../IconFont'
5
- import { GuardMFAInitData, MFAType } from '../props'
5
+ import { GuardMFAInitData, MFAType } from '../interface'
6
6
  import { i18n } from '../../_utils/locales'
7
7
  import './style.less'
8
8
 
@@ -7,7 +7,7 @@ import { useAuthClient } from '../Guard/authClient'
7
7
  import { GuardModuleType } from '../Guard/module'
8
8
  import { RegisterWithEmail } from './core/WithEmail'
9
9
  import { RegisterWithPhone } from './core/WithPhone'
10
- import { GuardRegisterViewProps } from './props'
10
+ import { GuardRegisterViewProps } from './interface'
11
11
  import { codeMap } from './codemap'
12
12
 
13
13
  export const GuardRegisterView: React.FC<GuardRegisterViewProps> = ({
File without changes
@@ -18,8 +18,7 @@ export const initConfig = async (
18
18
  config: Partial<IG2Config>,
19
19
  defaultConfig: IG2Config
20
20
  ): Promise<{ config: GuardLocalConfig; publicConfig: ApplicationConfig }> => {
21
- if (!getPublicConfig(appId))
22
- await requestPublicConfig(appId, config.host ?? defaultConfig.host)
21
+ if (!getPublicConfig(appId)) await requestPublicConfig(appId)
23
22
  const mergedConfig = mergeConfig(
24
23
  config,
25
24
  defaultConfig,
@@ -93,8 +92,7 @@ const mergeConfig = (
93
92
  }
94
93
 
95
94
  const requestPublicConfig = async (
96
- appId: string,
97
- host: string
95
+ appId: string
98
96
  ): Promise<ApplicationConfig> => {
99
97
  let res: AuthingResponse<ApplicationConfig>
100
98
 
@@ -36,6 +36,10 @@ export class GuardHttp {
36
36
  this.headers['x-authing-app-tenant-id'] = tenantId
37
37
  }
38
38
 
39
+ setBaseUrl(baseUrl: string) {
40
+ this.getRequestClient().setBaseUrl(baseUrl)
41
+ }
42
+
39
43
  public getHeaders = () => this.headers
40
44
 
41
45
  public get = async <T>(
@@ -198,9 +198,13 @@ export const assembledAppHost = (identifier: string, host: string) => {
198
198
 
199
199
  const splitHost = hostUrl.hostname.split('.')
200
200
 
201
+ const port = hostUrl.port
202
+
201
203
  splitHost.shift()
202
204
 
203
- return `${hostUrl.protocol}//${identifier}.${splitHost.join('.')}`
205
+ return `${hostUrl.protocol}//${identifier}.${splitHost.join('.')}${
206
+ port && `:${port}`
207
+ }`
204
208
  }
205
209
 
206
210
  export enum PasswordStrength {
@@ -223,5 +223,7 @@
223
223
  "pToLogin": "seconds later back",
224
224
  "resetSuccess": "Reset successfully",
225
225
  "resetSuccessMessage": "The password is reset successfully, you can continue to log in with the new password",
226
- "totpCode": "Security code"
226
+ "totpCode": "Security code",
227
+ "welcome": "Welcome",
228
+ "initPasswordText": "To ensure account security, please set your initial password."
227
229
  }
@@ -223,5 +223,7 @@
223
223
  "pToLogin": "秒后返回登录",
224
224
  "resetSuccess": "重置成功",
225
225
  "resetSuccessMessage": "密码重置成功,您可以使用新密码继续登录",
226
- "totpCode": "安全码"
226
+ "totpCode": "安全码",
227
+ "welcome": "欢迎访问",
228
+ "initPasswordText": "为了保障账号安全,请设置你的初始密码。"
227
229
  }
@@ -27,6 +27,7 @@
27
27
  "needSameWithNewPwd": "需要与新密码一致",
28
28
  "confirmModify": "确认修改",
29
29
  "modifyPwd": "修改密码",
30
+ "modifyPwdText": "你的密码连续使用超过 {{number}} 个月,可能存在风险。请重新设置密码。",
30
31
  "personalInfo": "个人信息",
31
32
  "accPwd": "账号密码",
32
33
  "authenticationInfo": "认证信息",
@@ -1,12 +1,9 @@
1
+ export * from './_utils/config'
2
+ export type { AuthenticationClientOptions } from 'authing-js-sdk'
3
+
1
4
  export * from './AuthingGuard/types'
2
5
  export * from './AuthingGuard/hooks'
3
- export type { AuthenticationClientOptions } from 'authing-js-sdk'
6
+ export * from './AuthingGuard'
4
7
 
5
8
  export * from './Guard'
6
9
  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 CHANGED
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom'
3
3
 
4
4
  import reportWebVitals from './reportWebVitals'
5
5
  import { message } from 'antd'
6
- import { Guard } from './components/Guard'
6
+ import { Guard } from './components'
7
7
 
8
8
  const App = () => {
9
9
  return (
@@ -15,8 +15,9 @@ const App = () => {
15
15
  }}
16
16
  >
17
17
  <Guard
18
- appId="618e093c3a9138c729fe7d0b"
19
- // tenantId="6194a41abf23c1d5268b362a"
18
+ appId="619747787da1b9eb2e9ee7d5"
19
+ // appId="6191cf610f772aa56dc70637"
20
+ // tenantId="6194a41abf23c1d5268b362a1"
20
21
  onLogin={(u) => {
21
22
  message.info('🏁 用户业务层终点,登录完成。')
22
23
  console.log(u)
@@ -42,38 +43,37 @@ const App = () => {
42
43
  onRegisterTabChange={(registerMethod) => {
43
44
  console.log('📁 onRegisterTabChange 触发', registerMethod)
44
45
  }}
45
- config={
46
- {
47
- // host: 'https://core.dev2.authing-inc.co/',
48
- // registerMethods: [RegisterMethods.Email],
49
- // autoRegister: true,
50
- // defaultRegisterMethod: RegisterMethods.Phone,
51
- // disableRegister: false,
52
- // disableResetPwd: false,
53
- // defaultLoginMethod: LoginMethods.WxMinQr, // 指定默认登录方式,如果这个方式不存在于 LoginMethods,那么就当作没有传入
54
- // loginMethods: [],
55
- // LoginMethods.Password,
56
- // LoginMethods.PhoneCode,
57
- // LoginMethods.WxMinQr,
58
- // ],
59
- // socialConnections: [
60
- // SocialConnectionProvider.ALIPAY,
61
- // SocialConnectionProvider.APPLE_WEB,
62
- // ], // 指定可选的社会化登录方式
63
- // qrCodeScanOptions?: Parameters<QrCodeAuthenticationClient['startScanning']>[1]
64
- // passwordLoginMethods?: PasswordLoginMethods[]
65
- // enterpriseConnections: [] // 这个有啥用?
66
- // publicKey?: string
67
- // lang: 'en-US',
68
- // lang: 'zh-CN',
69
- // mode: GuardMode.Modal,
70
- // logo: '',
71
- // clickCloseable: false, // clickCloseable Modal 模式时是否隐藏登录框右上角的关闭按钮
72
- // escCloseable: true, //
73
- // target: '#c1',
74
- // socialConnectionsBtnShape: 'rectangle',
75
- }
76
- }
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
77
  />
78
78
  </div>
79
79
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authing/react-ui-components",
3
- "version": "3.0.2-beta.3",
3
+ "version": "3.0.2-beta.7",
4
4
  "framework": "React",
5
5
  "private": false,
6
6
  "main": "lib/index.min.js",
@@ -1,31 +0,0 @@
1
- {
2
- "eslint.validate": [
3
- "javascript",
4
- "javascriptreact",
5
- "typescript",
6
- "typescriptreact"
7
- ],
8
- "files.associations": {
9
- "*.mw.json": "jsonc",
10
- "*.icon": "xml"
11
- },
12
- "cssModules.camelCase": true,
13
- "editor.snippetSuggestions": "top",
14
- "emmet.showSuggestionsAsSnippets": true,
15
- "editor.formatOnSave": true,
16
- "editor.defaultFormatter": "esbenp.prettier-vscode",
17
- "typescript.tsdk": "node_modules/typescript/lib",
18
- "editor.codeActionsOnSave": {
19
- "source.fixAll": true
20
- },
21
- "prettier.printWidth": 120,
22
- "prettier.singleQuote": false,
23
- "prettier.semi": true,
24
- "i18n-ally.localesPaths": "components/_utils/locales",
25
- "i18n-ally.displayLanguage": "zh",
26
- "i18n-ally.keystyle": "nested",
27
- "i18n-ally.annotations": true,
28
- "i18n-ally.extract.targetPickingStrategy": "file-previous",
29
- "i18n-ally.namespace": true,
30
- "i18n-ally.sourceLanguage": "zh"
31
- }