@deix/rossini-core 2.0.0 → 2.1.0
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/components/buttons/Avatar/Avatar.js +2 -2
- package/lib/components/buttons/LanguageSelect/LanguageSelect.d.ts.map +1 -1
- package/lib/components/buttons/LanguageSelect/LanguageSelect.js +3 -0
- package/lib/components/display/StyledValue/StyledValue.d.ts +1 -1
- package/lib/components/display/StyledValue/StyledValue.d.ts.map +1 -1
- package/lib/components/display/StyledValue/StyledValue.js +2 -2
- package/lib/components/index.d.ts +2 -2
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/layout/MinimalLayout/MinimalLayout.js +8 -8
- package/lib/components/layout/StandardLayout/StandardLayout.js +8 -8
- package/lib/components/layout/components/Footer/Footer.js +2 -2
- package/lib/components/layout/components/Sidebar/Sidebar.d.ts +4 -0
- package/lib/components/layout/components/Sidebar/Sidebar.d.ts.map +1 -1
- package/lib/components/layout/components/Sidebar/Sidebar.js +10 -0
- package/lib/components/provider/PageProvider.d.ts +3 -0
- package/lib/components/provider/PageProvider.d.ts.map +1 -1
- package/lib/components/provider/PageProvider.js +1 -1
- package/lib/components/provider/UserInfoProvider.d.ts +28 -0
- package/lib/components/provider/UserInfoProvider.d.ts.map +1 -0
- package/lib/components/provider/UserInfoProvider.js +22 -0
- package/lib/components/provider/index.d.ts +2 -0
- package/lib/components/provider/index.d.ts.map +1 -1
- package/lib/components/provider/index.js +1 -0
- package/lib/index.d.ts +3 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/hooks/index.d.ts +2 -3
- package/lib/utils/hooks/index.d.ts.map +1 -1
- package/lib/utils/hooks/index.js +1 -2
- package/lib/utils/hooks/useAPI.d.ts +8 -1
- package/lib/utils/hooks/useAPI.d.ts.map +1 -1
- package/lib/utils/hooks/useAPI.js +14 -0
- package/lib/utils/index.d.ts +2 -2
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +2 -2
- package/lib/utils/middleware/index.d.ts +2 -0
- package/lib/utils/middleware/index.d.ts.map +1 -0
- package/lib/utils/middleware/index.js +1 -0
- package/package.json +1 -1
- package/lib/utils/hooks/useUserInfo.d.ts +0 -17
- package/lib/utils/hooks/useUserInfo.d.ts.map +0 -1
- package/lib/utils/hooks/useUserInfo.js +0 -25
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { default as useAPI } from './useAPI';
|
|
2
|
-
export {
|
|
3
|
-
export type { UserInfo } from './useUserInfo';
|
|
1
|
+
export { default as useAPI, useOptionalAPI } from './useAPI';
|
|
2
|
+
export type { UserInfo } from '../../components/provider/UserInfoProvider';
|
|
4
3
|
export { useLocale } from './useLocale';
|
|
5
4
|
export { usePathname } from './usePathname';
|
|
6
5
|
export { default as usePersistedState } from './usePersistedState';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC7D,YAAY,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/lib/utils/hooks/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { default as useAPI } from './useAPI';
|
|
2
|
-
export { useUserInfo } from './useUserInfo';
|
|
1
|
+
export { default as useAPI, useOptionalAPI } from './useAPI';
|
|
3
2
|
export { useLocale } from './useLocale';
|
|
4
3
|
export { usePathname } from './usePathname';
|
|
5
4
|
export { default as usePersistedState } from './usePersistedState';
|
|
@@ -5,6 +5,13 @@ import { AxiosInstance } from 'axios';
|
|
|
5
5
|
* @param {string} baseURL the API address.
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
|
-
declare const useAPI: (baseURL
|
|
8
|
+
declare const useAPI: (baseURL: string) => AxiosInstance;
|
|
9
|
+
/**
|
|
10
|
+
* Create an Axios instance.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} baseURL the API address.
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const useOptionalAPI: (baseURL?: string) => AxiosInstance | undefined;
|
|
9
16
|
export default useAPI;
|
|
10
17
|
//# sourceMappingURL=useAPI.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAPI.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useAPI.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,QAAA,MAAM,MAAM,aAAc,MAAM,KAAG,aAAa,GAAG,
|
|
1
|
+
{"version":3,"file":"useAPI.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useAPI.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7C;;;;;GAKG;AACH,QAAA,MAAM,MAAM,YAAa,MAAM,KAAG,aAOjC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,aAAc,MAAM,KAAG,aAAa,GAAG,SASjE,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -6,6 +6,20 @@ import axios from 'axios';
|
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
8
|
const useAPI = (baseURL) => {
|
|
9
|
+
return axios.create({
|
|
10
|
+
baseURL,
|
|
11
|
+
headers: {
|
|
12
|
+
Accept: 'application/json',
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Create an Axios instance.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} baseURL the API address.
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export const useOptionalAPI = (baseURL) => {
|
|
9
23
|
if (baseURL) {
|
|
10
24
|
return axios.create({
|
|
11
25
|
baseURL,
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { camelToSnake, colorToRgb, commonStart, dateDiff, getTextColor, getTimeStr, hexToRgb, interpolate, isValidDate, stringToColor, toLocalStandardDateString, toTitleCase, } from './helpers';
|
|
2
|
-
export { useAPI, useLocale, usePathname, usePersistedState,
|
|
2
|
+
export { useAPI, useOptionalAPI, useLocale, usePathname, usePersistedState, } from './hooks';
|
|
3
3
|
export type { UserInfo } from './hooks';
|
|
4
|
-
export { createI18nMiddleware } from './middleware
|
|
4
|
+
export { createI18nMiddleware } from './middleware';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,aAAa,EACb,yBAAyB,EACzB,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,MAAM,EACN,SAAS,EACT,WAAW,EACX,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,WAAW,EACX,WAAW,EACX,aAAa,EACb,yBAAyB,EACzB,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,MAAM,EACN,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAiB,GAClB,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC"}
|
package/lib/utils/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { camelToSnake, colorToRgb, commonStart, dateDiff, getTextColor, getTimeStr, hexToRgb, interpolate, isValidDate, stringToColor, toLocalStandardDateString, toTitleCase, } from './helpers';
|
|
2
|
-
export { useAPI, useLocale, usePathname, usePersistedState,
|
|
3
|
-
export { createI18nMiddleware } from './middleware
|
|
2
|
+
export { useAPI, useOptionalAPI, useLocale, usePathname, usePersistedState, } from './hooks';
|
|
3
|
+
export { createI18nMiddleware } from './middleware';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/middleware/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createI18nMiddleware } from './createI18nMiddleware';
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
export interface UserInfo {
|
|
3
|
-
/**
|
|
4
|
-
* The email address of the user.
|
|
5
|
-
*/
|
|
6
|
-
email: string;
|
|
7
|
-
/**
|
|
8
|
-
* The user id.
|
|
9
|
-
*/
|
|
10
|
-
user: string;
|
|
11
|
-
/**
|
|
12
|
-
* The user name.
|
|
13
|
-
*/
|
|
14
|
-
preferredUsername: string;
|
|
15
|
-
}
|
|
16
|
-
export declare const useUserInfo: () => UseQueryResult<UserInfo, Error>;
|
|
17
|
-
//# sourceMappingURL=useUserInfo.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useUserInfo.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks/useUserInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAY,MAAM,uBAAuB,CAAC;AAEjE,MAAM,WAAW,QAAQ;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAqBD,eAAO,MAAM,WAAW,QAAO,eAAe,QAAQ,EAAE,KAAK,CAKzD,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { useQuery } from '@tanstack/react-query';
|
|
3
|
-
const getUserInfo = async () => {
|
|
4
|
-
const fetch = axios
|
|
5
|
-
.get('/oauth2/userinfo')
|
|
6
|
-
.then((result) => {
|
|
7
|
-
console.log('User Info', result.data);
|
|
8
|
-
return result.data;
|
|
9
|
-
})
|
|
10
|
-
.catch((err) => {
|
|
11
|
-
console.error('Could not get user info');
|
|
12
|
-
console.error(err);
|
|
13
|
-
return {
|
|
14
|
-
email: '',
|
|
15
|
-
user: 'anonymous',
|
|
16
|
-
preferredUsername: 'anonymous',
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
return await fetch;
|
|
20
|
-
};
|
|
21
|
-
export const useUserInfo = () => useQuery({
|
|
22
|
-
queryKey: ['user-info'],
|
|
23
|
-
queryFn: () => getUserInfo(),
|
|
24
|
-
staleTime: Infinity,
|
|
25
|
-
});
|