@authing/react-ui-components 2.4.52 → 2.4.55

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 (41) hide show
  1. package/build/asset-manifest.json +19 -18
  2. package/build/index.html +1 -1
  3. package/build/static/css/2.51c07e65.chunk.css +3 -0
  4. package/build/static/css/2.51c07e65.chunk.css.map +1 -0
  5. package/build/static/css/main.779f221a.chunk.css +2 -0
  6. package/build/static/css/main.779f221a.chunk.css.map +1 -0
  7. package/build/static/js/2.bbae9fdb.chunk.js +3 -0
  8. package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +102 -0
  9. package/build/static/js/2.bbae9fdb.chunk.js.map +1 -0
  10. package/build/static/js/{3.1e47fbc9.chunk.js → 3.fd17f196.chunk.js} +2 -2
  11. package/build/static/js/3.fd17f196.chunk.js.map +1 -0
  12. package/build/static/js/main.5f341531.chunk.js +2 -0
  13. package/build/static/js/main.5f341531.chunk.js.map +1 -0
  14. package/build/static/js/{runtime-main.be57cc78.js → runtime-main.ef138021.js} +2 -2
  15. package/build/static/js/runtime-main.ef138021.js.map +1 -0
  16. package/build/static/media/loading.4a67a5f3.svg +29 -0
  17. package/lib/index.d.ts +8 -0
  18. package/lib/index.min.css +1 -1
  19. package/lib/index.min.js +1 -1
  20. package/lib/index.min.js.LICENSE.txt +8 -63
  21. package/package.json +3 -3
  22. package/src/components/AuthingGuard/GuardLayout/index.tsx +3 -0
  23. package/src/components/AuthingGuard/Header/index.tsx +5 -2
  24. package/src/components/AuthingGuard/Header/style.less +23 -11
  25. package/src/components/AuthingGuard/api/appConfig.ts +1 -0
  26. package/src/components/AuthingGuard/api/http.ts +32 -9
  27. package/src/components/AuthingGuard/constants.ts +2 -0
  28. package/src/components/AuthingGuard/index.tsx +8 -0
  29. package/src/components/AuthingGuard/types/GuardConfig.ts +1 -0
  30. package/src/index.tsx +8 -18
  31. package/build/static/css/2.4c71a9fd.chunk.css +0 -2
  32. package/build/static/css/2.4c71a9fd.chunk.css.map +0 -1
  33. package/build/static/css/main.ee0e3901.chunk.css +0 -2
  34. package/build/static/css/main.ee0e3901.chunk.css.map +0 -1
  35. package/build/static/js/2.d19cf3a9.chunk.js +0 -3
  36. package/build/static/js/2.d19cf3a9.chunk.js.LICENSE.txt +0 -156
  37. package/build/static/js/2.d19cf3a9.chunk.js.map +0 -1
  38. package/build/static/js/3.1e47fbc9.chunk.js.map +0 -1
  39. package/build/static/js/main.e5a9f524.chunk.js +0 -2
  40. package/build/static/js/main.e5a9f524.chunk.js.map +0 -1
  41. package/build/static/js/runtime-main.be57cc78.js.map +0 -1
@@ -4,69 +4,14 @@
4
4
  http://jedwatson.github.io/classnames
5
5
  */
6
6
 
7
- /*!**********************!*\
8
- !*** ./lib/index.js ***!
9
- \**********************/
10
-
11
- /*!**************************!*\
12
- !*** ./lib/JSEncrypt.js ***!
13
- \**************************/
14
-
15
- /*!**************************!*\
16
- !*** ./lib/version.json ***!
17
- \**************************/
18
-
19
- /*!*****************************!*\
20
- !*** ./lib/lib/jsbn/rng.js ***!
21
- \*****************************/
22
-
23
- /*!*****************************!*\
24
- !*** ./lib/lib/jsbn/rsa.js ***!
25
- \*****************************/
26
-
27
- /*!******************************!*\
28
- !*** ./lib/lib/jsbn/jsbn.js ***!
29
- \******************************/
30
-
31
- /*!******************************!*\
32
- !*** ./lib/lib/jsbn/util.js ***!
33
- \******************************/
34
-
35
- /*!*******************************!*\
36
- !*** ./lib/lib/asn1js/hex.js ***!
37
- \*******************************/
38
-
39
- /*!*******************************!*\
40
- !*** ./lib/lib/jsbn/prng4.js ***!
41
- \*******************************/
42
-
43
- /*!********************************!*\
44
- !*** ./lib/JSEncryptRSAKey.js ***!
45
- \********************************/
46
-
47
- /*!********************************!*\
48
- !*** ./lib/lib/asn1js/asn1.js ***!
49
- \********************************/
50
-
51
- /*!********************************!*\
52
- !*** ./lib/lib/jsbn/base64.js ***!
53
- \********************************/
54
-
55
- /*!*********************************!*\
56
- !*** ./lib/lib/asn1js/int10.js ***!
57
- \*********************************/
58
-
59
- /*!**********************************!*\
60
- !*** ./lib/lib/asn1js/base64.js ***!
61
- \**********************************/
62
-
63
- /*!************************************!*\
64
- !*** ./lib/lib/jsrsasign/yahoo.js ***!
65
- \************************************/
66
-
67
- /*!***************************************!*\
68
- !*** ./lib/lib/jsrsasign/asn1-1.0.js ***!
69
- \***************************************/
7
+ /**
8
+ * @license
9
+ * Lodash <https://lodash.com/>
10
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
11
+ * Released under MIT license <https://lodash.com/license>
12
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
13
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
14
+ */
70
15
 
71
16
  /** @license React v16.13.1
72
17
  * react-is.production.min.js
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@authing/react-ui-components",
3
- "version": "2.4.52",
3
+ "version": "2.4.55",
4
4
  "private": false,
5
5
  "main": "lib/index.min.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "dependencies": {
8
8
  "antd": "^4.8.0",
9
- "authing-js-sdk": "4.20.23",
9
+ "authing-js-sdk": "4.22.24-alpha",
10
10
  "qs": "^6.9.4"
11
11
  },
12
12
  "peerDependencies": {
@@ -185,5 +185,5 @@
185
185
  "webpack-manifest-plugin": "2.2.0",
186
186
  "workbox-webpack-plugin": "5.1.4"
187
187
  },
188
- "gitHead": "d76e4b19e4748ed1e487de4c557f10b0aed41061"
188
+ "gitHead": "8c8162fd4a91c1d1376bf68d4592f90572cc3a7e"
189
189
  }
@@ -184,6 +184,8 @@ const useGuardConfig = () => {
184
184
  ? ''
185
185
  : userConfig.title ?? appConfig.name ?? defaultGuardConfig.title
186
186
 
187
+ const description = loading ? '' : appConfig.description ?? ''
188
+
187
189
  // 应用 logo
188
190
  const logo = loading
189
191
  ? ''
@@ -218,6 +220,7 @@ const useGuardConfig = () => {
218
220
  {
219
221
  logo,
220
222
  title,
223
+ description,
221
224
  autoRegister,
222
225
  loginMethods,
223
226
  passwordLoginMethods,
@@ -10,7 +10,7 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {}
10
10
  export const GuardHeader: FC<HeaderProps> = (props) => {
11
11
  const {
12
12
  state: {
13
- config: { logo, title },
13
+ config: { logo, title, description },
14
14
  },
15
15
  } = useGuardContext()
16
16
 
@@ -19,7 +19,10 @@ export const GuardHeader: FC<HeaderProps> = (props) => {
19
19
  {Boolean(logo) && (
20
20
  <Avatar className="authing-guard-logo" src={logo} size={50}></Avatar>
21
21
  )}
22
- <div className="authing-guard-title">{title}</div>
22
+ <div className="authing-guard-title-container">
23
+ <div className="authing-guard-title">{title}</div>
24
+ <div className="authing-guard-description">{description}</div>
25
+ </div>
23
26
  </div>
24
27
  )
25
28
  }
@@ -13,23 +13,26 @@
13
13
  object-fit: contain;
14
14
  }
15
15
 
16
+ .authing-guard-title-container {
17
+ display: flex;
18
+ justify-content: center;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ }
22
+
16
23
  .authing-guard-title {
17
- color: #abb9d7;
24
+ color: #282d3c;
18
25
  font-size: 24px;
19
- margin-bottom: 24px;
26
+ margin-bottom: 4px;
20
27
  width: 100%;
21
28
  word-break: break-all;
22
29
  text-align: center;
23
30
  }
24
-
25
- // .large .logo {
26
- // margin-bottom: 16px;
27
- // }
28
-
29
- // .large .title {
30
- // color: #333333;
31
- // font-size: 32px;
32
- // }
31
+ .authing-guard-description {
32
+ font-size: 16px;
33
+ color: #878a95;
34
+ margin-bottom: 23px;
35
+ }
33
36
 
34
37
  @media only screen and (max-width: 719px) {
35
38
  .authing-guard-header {
@@ -45,8 +48,17 @@
45
48
  padding-left: 8px;
46
49
  color: #333333;
47
50
  font-weight: 500;
51
+ text-align: unset;
48
52
  }
49
53
  .authing-guard-logo {
50
54
  margin: 0;
51
55
  }
56
+ .authing-guard-title-container {
57
+ flex-direction: column;
58
+ align-items: flex-start;
59
+ }
60
+ .authing-guard-description {
61
+ margin-bottom: 0px;
62
+ padding-left: 8px;
63
+ }
52
64
  }
@@ -75,6 +75,7 @@ export interface ApplicationConfig {
75
75
  css: string
76
76
  name: string
77
77
  logo: string
78
+ description?: string
78
79
  redirectUris: string[]
79
80
  registerDisabled: boolean
80
81
  registerTabs: {
@@ -17,6 +17,15 @@ requestClient.get = async <T>(
17
17
  query: Record<string, any> = {},
18
18
  init?: RequestInit
19
19
  ): Promise<AuthingResponse<T>> => {
20
+ const headers: Record<string, any> = {
21
+ ...init?.headers,
22
+ 'Content-Type': 'application/json',
23
+ [requestClient.langHeader]: i18n.language,
24
+ }
25
+
26
+ if (requestClient.tenantId !== '')
27
+ headers[requestClient.tenantHeader] = requestClient.tenantId
28
+
20
29
  const res = await fetch(
21
30
  `${requestClient.baseUrl}${path}${qs.stringify(query, {
22
31
  addQueryPrefix: true,
@@ -24,10 +33,7 @@ requestClient.get = async <T>(
24
33
  {
25
34
  ...init,
26
35
  credentials: 'include',
27
- headers: {
28
- ...init?.headers,
29
- [requestClient.langHeader]: i18n.language,
30
- },
36
+ headers,
31
37
  }
32
38
  )
33
39
 
@@ -41,15 +47,20 @@ requestClient.post = async <T>(
41
47
  headers: any
42
48
  }
43
49
  ): Promise<AuthingResponse<T>> => {
50
+ const headers: Record<string, any> = {
51
+ ...config?.headers,
52
+ 'Content-Type': 'application/json',
53
+ [requestClient.langHeader]: i18n.language,
54
+ }
55
+
56
+ if (requestClient.tenantId !== '')
57
+ headers[requestClient.tenantHeader] = requestClient.tenantId
58
+
44
59
  const res = await fetch(`${requestClient.baseUrl}${path}`, {
45
60
  method: 'POST',
46
61
  body: JSON.stringify(data),
47
62
  credentials: 'include',
48
- headers: {
49
- ...config?.headers,
50
- 'Content-Type': 'application/json',
51
- [requestClient.langHeader]: i18n.language,
52
- },
63
+ headers: headers,
53
64
  })
54
65
  return res.json()
55
66
  }
@@ -59,7 +70,19 @@ requestClient.setBaseUrl = (base: string) => {
59
70
  requestClient.baseUrl = base.replace(/\/$/, '')
60
71
  }
61
72
  const DEFAULT_LANG_HEADER = 'x-authing-lang'
73
+ const DEFAULT_TENANT_HEADER = 'x-authing-app-tenant-idåå'
62
74
  requestClient.langHeader = DEFAULT_LANG_HEADER
75
+ requestClient.tenantHeader = DEFAULT_TENANT_HEADER
76
+ requestClient.tenantId = ''
77
+
63
78
  requestClient.setLangHeader = (key: string | undefined) => {
64
79
  requestClient.langHeader = key || DEFAULT_LANG_HEADER
65
80
  }
81
+
82
+ requestClient.setTenantHeader = (key: string | undefined) => {
83
+ requestClient.tenantHeader = key || DEFAULT_LANG_HEADER
84
+ }
85
+
86
+ requestClient.setTenantId = (tenantId: string) => {
87
+ requestClient.tenantId = tenantId
88
+ }
@@ -95,10 +95,12 @@ export const defaultHeaders: {
95
95
  'app-id': string
96
96
  'sdk-version': string
97
97
  'request-from': string
98
+ 'tenant-id': string
98
99
  lang: string
99
100
  } = {
100
101
  'userpool-id': 'x-authing-userpool-id',
101
102
  'app-id': 'x-authing-app-id',
103
+ 'tenant-id': 'x-authing-app-tenant-id',
102
104
  'request-from': 'x-authing-request-from',
103
105
  'sdk-version': 'x-authing-sdk-version',
104
106
  lang: 'x-authing-lang',
@@ -28,6 +28,7 @@ message.config({
28
28
 
29
29
  interface AuthingGuardProps extends GuardEventsHandler {
30
30
  appId: string
31
+ tenantId?: string
31
32
  config?: UserConfig
32
33
  visible?: boolean
33
34
  className?: string
@@ -36,6 +37,7 @@ interface AuthingGuardProps extends GuardEventsHandler {
36
37
 
37
38
  export const AuthingGuard: FC<AuthingGuardProps> = ({
38
39
  appId,
40
+ tenantId,
39
41
  config = {},
40
42
  visible,
41
43
  className,
@@ -71,9 +73,15 @@ export const AuthingGuard: FC<AuthingGuardProps> = ({
71
73
  requestClient.setBaseUrl(realHost)
72
74
  requestClient.setLangHeader(headers?.lang)
73
75
 
76
+ if (tenantId) {
77
+ requestClient.setTenantHeader(headers?.['tenant-id'])
78
+ requestClient.setTenantId(tenantId)
79
+ }
80
+
74
81
  const authClient = new AuthenticationClient({
75
82
  appHost: realHost!,
76
83
  appId,
84
+ tenantId,
77
85
  requestFrom: 'ui-components',
78
86
  lang: localesConfig.defaultLang ?? lang,
79
87
  headers,
@@ -353,6 +353,7 @@ export interface GuardEventsHandler {
353
353
  export interface UserConfig {
354
354
  logo?: string
355
355
  title?: string
356
+ description?: string
356
357
  zIndex?: number
357
358
  isSSO?: boolean
358
359
  mode?: GuardMode
package/src/index.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Button } from 'antd'
2
2
  import React, { useState } from 'react'
3
3
  import ReactDOM from 'react-dom'
4
- import { initAuthClient, Lang } from './components'
4
+ import { Lang } from './components'
5
5
  import { AuthingGuard } from './components/AuthingGuard'
6
6
 
7
7
  import {
@@ -20,9 +20,8 @@ const App = () => {
20
20
  const [title, setTitle] = useState('标题')
21
21
 
22
22
  const config: UserConfig = {
23
- title,
24
23
  mode: GuardMode.Modal,
25
- // appHost: 'https://sample-sso.authing.cn',
24
+ appHost: 'https://core.dev2.authing-inc.co/',
26
25
  // apiHost: 'http://console.authing.localhost:3000',
27
26
  // apiHost: 'http://192.168.50.57:3000',
28
27
  // loginMethods: Object.values(LoginMethods),
@@ -55,16 +54,6 @@ const App = () => {
55
54
  // `,
56
55
  // // autoRegister: true,
57
56
  // socialConnections: [SocialConnections.AppleWeb],
58
- passwordLoginMethods: ['username-password'],
59
- localesConfig: {
60
- defaultLang: 'en-US',
61
- isShowChange: true,
62
- onChange: (value) => {
63
- console.log('...........')
64
- console.log(value)
65
- },
66
- },
67
- lang: lang,
68
57
  }
69
58
 
70
59
  const [visible, setVisible] = useState(false)
@@ -73,10 +62,10 @@ const App = () => {
73
62
  // setTimeout(() => setVisible(true), 3000)
74
63
  // }, [])
75
64
 
76
- initAuthClient({
77
- appId: '60c02a89a9e0431e271d9ff0',
78
- // appHost: 'http://console.authing.localhost:3000',
79
- })
65
+ // initAuthClient({
66
+ // appId: '60c02a89a9e0431e271d9ff0',
67
+ // // appHost: 'http://console.authing.localhost:3000',
68
+ // })
80
69
 
81
70
  return (
82
71
  // eslint-disable-next-line react/jsx-no-undef
@@ -125,7 +114,8 @@ const App = () => {
125
114
  }}
126
115
  // onLoad={(a) => console.log(a, '加载完成')}
127
116
  // onPwdResetError={(e) => console.log(e)}
128
- appId="60c02a89a9e0431e271d9ff0"
117
+ appId="6191cf610f772aa56dc70637"
118
+ tenantId="6194a41abf23c1d5268b362a"
129
119
  // appId="5fd877fb0ba0421962eced94"
130
120
  config={config}
131
121
  />