@gridsuite/commons-ui 0.61.1 → 0.61.4
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/README.md +6 -7
- package/dist/components/AuthenticationRouter/AuthenticationRouter.d.ts +20 -19
- package/dist/components/AuthenticationRouter/AuthenticationRouter.js +10 -8
- package/dist/components/AuthenticationRouter/index.d.ts +1 -0
- package/dist/components/SignInCallbackHandler/SignInCallbackHandler.d.ts +1 -1
- package/dist/components/SilentRenewCallbackHandler/SilentRenewCallbackHandler.d.ts +1 -1
- package/dist/components/TopBar/AboutDialog.d.ts +1 -1
- package/dist/components/TopBar/AboutDialog.js +16 -12
- package/dist/components/TopBar/TopBar.d.ts +3 -2
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1 -1
- package/dist/redux/authActions.d.ts +56 -0
- package/dist/redux/commonStore.d.ts +4 -3
- package/dist/redux/commonStore.js +2 -1
- package/dist/utils/AuthService.d.ts +8 -7
- package/dist/utils/AuthService.js +3 -3
- package/package.json +1 -1
- package/dist/redux/actions.d.ts +0 -54
- /package/dist/redux/{actions.js → authActions.js} +0 -0
package/README.md
CHANGED
|
@@ -33,13 +33,12 @@ you need to follow the steps below:
|
|
|
33
33
|
- Update to the new version in [package.json](https://github.com/gridsuite/commons-ui/blob/main/package.json) (example `0.6.0`)
|
|
34
34
|
- Build it: `npm install`
|
|
35
35
|
- Commit the package.json and package-lock.json files, push to a branch, make a PR, have it reviewed and merged to main.
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
- [Publish the package](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages#publishing-scoped-public-packages): `npm publish`
|
|
36
|
+
- [Make a release](https://github.com/gridsuite/commons-ui/releases/new) on GitHub by creating a new tag on the last commit. On the release creation page:
|
|
37
|
+
- In "Choose a tag": type the tag you want to create (ex.: v0.6.0) and select "create new tag"
|
|
38
|
+
- In "Target": click on "recent commit" tab and select your release commit
|
|
39
|
+
- Click on "Generate release note"
|
|
40
|
+
- Click on "Publish release"
|
|
41
|
+
- It will trigger a job that will publish the release on NPM
|
|
43
42
|
|
|
44
43
|
#### License Headers and dependencies checking
|
|
45
44
|
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
+
import { AuthenticationActions } from '../../redux/authActions';
|
|
1
2
|
import { UserManager } from 'oidc-client';
|
|
3
|
+
import { Location, NavigateFunction } from 'react-router-dom';
|
|
2
4
|
import { Dispatch } from 'react';
|
|
3
5
|
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
error:
|
|
8
|
-
};
|
|
9
|
-
signInCallbackError: {
|
|
10
|
-
message: string;
|
|
6
|
+
export type AuthenticationRouterErrorState = {
|
|
7
|
+
userName?: string;
|
|
8
|
+
userValidationError?: {
|
|
9
|
+
error: Error;
|
|
11
10
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
userValidationError?: {
|
|
15
|
-
error: Error;
|
|
16
|
-
};
|
|
17
|
-
logoutError?: {
|
|
18
|
-
error: Error;
|
|
19
|
-
};
|
|
20
|
-
unauthorizedUserInfo?: string;
|
|
21
|
-
error: string;
|
|
11
|
+
logoutError?: {
|
|
12
|
+
error: Error;
|
|
22
13
|
};
|
|
14
|
+
unauthorizedUserInfo?: string;
|
|
15
|
+
};
|
|
16
|
+
export type UserManagerState = {
|
|
17
|
+
instance: UserManager | null;
|
|
18
|
+
error: string | null;
|
|
19
|
+
};
|
|
20
|
+
export interface AuthenticationRouterProps {
|
|
21
|
+
userManager: UserManagerState;
|
|
22
|
+
signInCallbackError: Error | null;
|
|
23
|
+
authenticationRouterError: AuthenticationRouterErrorState | null;
|
|
23
24
|
showAuthenticationRouterLogin: boolean;
|
|
24
|
-
dispatch: Dispatch<
|
|
25
|
-
navigate:
|
|
25
|
+
dispatch: Dispatch<AuthenticationActions>;
|
|
26
|
+
navigate: NavigateFunction;
|
|
26
27
|
location: Location;
|
|
27
28
|
}
|
|
28
29
|
declare const AuthenticationRouter: ({ userManager, signInCallbackError, authenticationRouterError, showAuthenticationRouterLogin, dispatch, navigate, location, }: AuthenticationRouterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,14 +17,16 @@ const AuthenticationRouter = ({
|
|
|
17
17
|
navigate,
|
|
18
18
|
location
|
|
19
19
|
}) => {
|
|
20
|
-
const handleSigninCallbackClosure = useCallback(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const handleSigninCallbackClosure = useCallback(() => {
|
|
21
|
+
if (userManager.instance != null) {
|
|
22
|
+
handleSigninCallback(dispatch, navigate, userManager.instance);
|
|
23
|
+
}
|
|
24
|
+
}, [dispatch, navigate, userManager.instance]);
|
|
25
|
+
const handleSilentRenewCallbackClosure = useCallback(() => {
|
|
26
|
+
if (userManager.instance != null) {
|
|
27
|
+
handleSilentRenewCallback(userManager.instance);
|
|
28
|
+
}
|
|
29
|
+
}, [userManager.instance]);
|
|
28
30
|
return /* @__PURE__ */ jsxs(
|
|
29
31
|
Grid,
|
|
30
32
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UserManager } from 'oidc-client';
|
|
2
2
|
|
|
3
3
|
export interface SignInCallbackHandlerProps {
|
|
4
|
-
userManager: UserManager;
|
|
4
|
+
userManager: UserManager | null;
|
|
5
5
|
handleSignInCallback: () => void;
|
|
6
6
|
}
|
|
7
7
|
declare const SignInCallbackHandler: ({ userManager, handleSignInCallback, }: SignInCallbackHandlerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UserManager } from 'oidc-client';
|
|
2
2
|
|
|
3
3
|
export interface SilentRenewCallbackHandlerProps {
|
|
4
|
-
userManager: UserManager;
|
|
4
|
+
userManager: UserManager | null;
|
|
5
5
|
handleSilentRenewCallback: () => void;
|
|
6
6
|
}
|
|
7
7
|
declare const SilentRenewCallbackHandler: ({ userManager, handleSilentRenewCallback, }: SilentRenewCallbackHandlerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect,
|
|
2
|
+
import { useState, useEffect, useCallback } from "react";
|
|
3
3
|
import { useTheme, Dialog, useMediaQuery, DialogTitle, Collapse, Alert, Box, Fade, CircularProgress, Typography, DialogContent, Accordion, AccordionSummary, AccordionDetails, Grid, DialogActions, Button, Tooltip, Zoom, Stack, tooltipClasses } from "@mui/material";
|
|
4
4
|
import { LoadingButton } from "@mui/lab";
|
|
5
5
|
import { Refresh, ExpandMore, Gavel, Apps, WidgetsOutlined, DnsOutlined, QuestionMark } from "@mui/icons-material";
|
|
@@ -115,18 +115,15 @@ const AboutDialog = ({
|
|
|
115
115
|
}, [open, globalVersionPromise]);
|
|
116
116
|
const [loadingAdditionalModules, setLoadingAdditionalModules] = useState(false);
|
|
117
117
|
const [modules, setModules] = useState(null);
|
|
118
|
-
const currentApp = useMemo(
|
|
119
|
-
() => ({
|
|
120
|
-
name: !!logo && appName || `Grid${appName}`,
|
|
121
|
-
type: "app",
|
|
122
|
-
version: appVersion,
|
|
123
|
-
gitTag: appGitTag,
|
|
124
|
-
license: appLicense
|
|
125
|
-
}),
|
|
126
|
-
[logo, appName, appVersion, appGitTag, appLicense]
|
|
127
|
-
);
|
|
128
118
|
useEffect(() => {
|
|
129
119
|
if (open) {
|
|
120
|
+
const currentApp = {
|
|
121
|
+
name: `Grid${appName}`,
|
|
122
|
+
type: "app",
|
|
123
|
+
version: appVersion,
|
|
124
|
+
gitTag: appGitTag,
|
|
125
|
+
license: appLicense
|
|
126
|
+
};
|
|
130
127
|
(additionalModulesPromise ? Promise.resolve(setLoadingAdditionalModules(true)).then(
|
|
131
128
|
() => additionalModulesPromise()
|
|
132
129
|
) : Promise.reject(new Error("no getter"))).then(
|
|
@@ -136,7 +133,14 @@ const AboutDialog = ({
|
|
|
136
133
|
setModules([currentApp, ...values]);
|
|
137
134
|
}).finally(() => setLoadingAdditionalModules(false));
|
|
138
135
|
}
|
|
139
|
-
}, [
|
|
136
|
+
}, [
|
|
137
|
+
open,
|
|
138
|
+
additionalModulesPromise,
|
|
139
|
+
appName,
|
|
140
|
+
appVersion,
|
|
141
|
+
appGitTag,
|
|
142
|
+
appLicense
|
|
143
|
+
]);
|
|
140
144
|
const handleClose = useCallback(() => {
|
|
141
145
|
if (onClose) {
|
|
142
146
|
onClose();
|
|
@@ -11,12 +11,13 @@ export declare const LIGHT_THEME = "Light";
|
|
|
11
11
|
export declare const LANG_SYSTEM = "sys";
|
|
12
12
|
export declare const LANG_ENGLISH = "en";
|
|
13
13
|
export declare const LANG_FRENCH = "fr";
|
|
14
|
-
export type
|
|
14
|
+
export type GsLangUser = typeof LANG_ENGLISH | typeof LANG_FRENCH;
|
|
15
|
+
export type GsLang = GsLangUser | typeof LANG_SYSTEM;
|
|
15
16
|
export type GsTheme = typeof LIGHT_THEME | typeof DARK_THEME;
|
|
16
17
|
export type TopBarProps = Omit<GridLogoProps, 'onClick'> & Omit<LogoutProps, 'disabled'> & Omit<AboutDialogProps, 'open' | 'onClose'> & {
|
|
17
18
|
onParametersClick?: () => void;
|
|
18
19
|
onLogoClick: GridLogoProps['onClick'];
|
|
19
|
-
user
|
|
20
|
+
user?: User;
|
|
20
21
|
onAboutClick?: () => void;
|
|
21
22
|
logoAboutDialog?: ReactNode;
|
|
22
23
|
appsAndUrls: CommonMetadata[];
|
package/dist/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
export { default as TreeViewFinder } from './components/TreeViewFinder';
|
|
8
8
|
export { default as TopBar } from './components/TopBar';
|
|
9
9
|
export { default as AboutDialog } from './components/TopBar/AboutDialog';
|
|
10
|
+
export type { GridSuiteModule } from './components/TopBar/AboutDialog';
|
|
10
11
|
export { default as SnackbarProvider } from './components/SnackbarProvider';
|
|
11
12
|
export { default as AuthenticationRouter } from './components/AuthenticationRouter';
|
|
13
|
+
export type { AuthenticationRouterErrorState, AuthenticationRouterProps, UserManagerState, } from './components/AuthenticationRouter';
|
|
12
14
|
export { default as MuiVirtualizedTable } from './components/MuiVirtualizedTable';
|
|
13
15
|
export { KeyedColumnsRowIndexer, CHANGE_WAYS, } from './components/MuiVirtualizedTable';
|
|
14
16
|
export { default as ReportViewer } from './components/ReportViewer';
|
|
@@ -38,7 +40,9 @@ export { initializeAuthenticationDev, initializeAuthenticationProd, logout, disp
|
|
|
38
40
|
export { getFileIcon } from './utils/ElementIcon';
|
|
39
41
|
export { DEFAULT_CELL_PADDING, DEFAULT_HEADER_HEIGHT, DEFAULT_ROW_HEIGHT, } from './components/MuiVirtualizedTable/MuiVirtualizedTable';
|
|
40
42
|
export { DARK_THEME, LIGHT_THEME, LANG_SYSTEM, LANG_ENGLISH, LANG_FRENCH, } from './components/TopBar/TopBar';
|
|
41
|
-
export {
|
|
43
|
+
export type { GsLang, GsLangUser, GsTheme } from './components/TopBar/TopBar';
|
|
44
|
+
export { USER, setLoggedUser, SIGNIN_CALLBACK_ERROR, setSignInCallbackError, UNAUTHORIZED_USER_INFO, LOGOUT_ERROR, USER_VALIDATION_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, } from './redux/authActions';
|
|
45
|
+
export type { AuthenticationActions, AuthenticationRouterErrorBase, AuthenticationRouterErrorAction, LogoutErrorAction, ShowAuthenticationRouterLoginAction, SignInCallbackErrorAction, UnauthorizedUserAction, UserAction, UserValidationErrorAction, } from './redux/authActions';
|
|
42
46
|
export { default as report_viewer_en } from './components/translations/report-viewer-en';
|
|
43
47
|
export { default as report_viewer_fr } from './components/translations/report-viewer-fr';
|
|
44
48
|
export { default as login_en } from './components/translations/login-en';
|
|
@@ -119,6 +123,7 @@ export type { FormEquipment } from './components/filter/utils/filter-form-utils'
|
|
|
119
123
|
export { getCriteriaBasedFormData, getCriteriaBasedSchema, } from './components/filter/criteria-based/criteria-based-filter-utils';
|
|
120
124
|
export { mergeSx } from './utils/styles';
|
|
121
125
|
export { setCommonStore } from './redux/commonStore';
|
|
126
|
+
export type { CommonStoreState } from './redux/commonStore';
|
|
122
127
|
export type { EquipmentInfos } from './utils/EquipmentType';
|
|
123
128
|
export * from './services';
|
|
124
129
|
export type * from './services';
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import { ElementType } from "./utils/ElementType.js";
|
|
|
32
32
|
import { EQUIPMENT_TYPE, EquipmentType, equipmentStyles, getEquipmentsInfosForSearchBar } from "./utils/EquipmentType.js";
|
|
33
33
|
import { dispatchUser, getPreLoginPath, initializeAuthenticationDev, initializeAuthenticationProd, logout } from "./utils/AuthService.js";
|
|
34
34
|
import { getFileIcon } from "./utils/ElementIcon.js";
|
|
35
|
-
import { LOGOUT_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, SIGNIN_CALLBACK_ERROR, UNAUTHORIZED_USER_INFO, USER, USER_VALIDATION_ERROR, setLoggedUser, setSignInCallbackError } from "./redux/
|
|
35
|
+
import { LOGOUT_ERROR, RESET_AUTHENTICATION_ROUTER_ERROR, SHOW_AUTH_INFO_LOGIN, SIGNIN_CALLBACK_ERROR, UNAUTHORIZED_USER_INFO, USER, USER_VALIDATION_ERROR, setLoggedUser, setSignInCallbackError } from "./redux/authActions.js";
|
|
36
36
|
import { default as default17 } from "./components/translations/report-viewer-en.js";
|
|
37
37
|
import { default as default18 } from "./components/translations/report-viewer-fr.js";
|
|
38
38
|
import { default as default19 } from "./components/translations/login-en.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { User } from 'oidc-client';
|
|
2
|
+
|
|
3
|
+
export interface Action<T> {
|
|
4
|
+
type: T;
|
|
5
|
+
}
|
|
6
|
+
type ReadonlyAction<T> = Readonly<Action<T>>;
|
|
7
|
+
export declare const USER = "USER";
|
|
8
|
+
export type UserAction = ReadonlyAction<typeof USER> & {
|
|
9
|
+
user: User | null;
|
|
10
|
+
};
|
|
11
|
+
export declare function setLoggedUser(user: User | null): UserAction;
|
|
12
|
+
export declare const SIGNIN_CALLBACK_ERROR = "SIGNIN_CALLBACK_ERROR";
|
|
13
|
+
export type SignInCallbackErrorAction = ReadonlyAction<typeof SIGNIN_CALLBACK_ERROR> & {
|
|
14
|
+
signInCallbackError: Error | null;
|
|
15
|
+
};
|
|
16
|
+
export declare function setSignInCallbackError(signInCallbackError: Error | null): SignInCallbackErrorAction;
|
|
17
|
+
export type AuthenticationRouterErrorBase<T> = {
|
|
18
|
+
authenticationRouterError: {
|
|
19
|
+
userName?: string;
|
|
20
|
+
} & T;
|
|
21
|
+
};
|
|
22
|
+
export declare const UNAUTHORIZED_USER_INFO = "UNAUTHORIZED_USER_INFO";
|
|
23
|
+
export type UnauthorizedUserAction = ReadonlyAction<typeof UNAUTHORIZED_USER_INFO> & AuthenticationRouterErrorBase<{
|
|
24
|
+
unauthorizedUserInfo: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function setUnauthorizedUserInfo(userName: string | undefined, unauthorizedUserInfo: string): UnauthorizedUserAction;
|
|
27
|
+
export declare const LOGOUT_ERROR = "LOGOUT_ERROR";
|
|
28
|
+
export type LogoutErrorAction = ReadonlyAction<typeof LOGOUT_ERROR> & AuthenticationRouterErrorBase<{
|
|
29
|
+
logoutError: {
|
|
30
|
+
error: Error;
|
|
31
|
+
};
|
|
32
|
+
}>;
|
|
33
|
+
export declare function setLogoutError(userName: string | undefined, logoutError: {
|
|
34
|
+
error: Error;
|
|
35
|
+
}): LogoutErrorAction;
|
|
36
|
+
export declare const USER_VALIDATION_ERROR = "USER_VALIDATION_ERROR";
|
|
37
|
+
export type UserValidationErrorAction = ReadonlyAction<typeof USER_VALIDATION_ERROR> & AuthenticationRouterErrorBase<{
|
|
38
|
+
userValidationError: {
|
|
39
|
+
error: Error;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
export declare function setUserValidationError(userName: string | undefined, userValidationError: {
|
|
43
|
+
error: Error;
|
|
44
|
+
}): UserValidationErrorAction;
|
|
45
|
+
export declare const RESET_AUTHENTICATION_ROUTER_ERROR = "RESET_AUTHENTICATION_ROUTER_ERROR";
|
|
46
|
+
export type AuthenticationRouterErrorAction = ReadonlyAction<typeof RESET_AUTHENTICATION_ROUTER_ERROR> & {
|
|
47
|
+
authenticationRouterError: null;
|
|
48
|
+
};
|
|
49
|
+
export declare function resetAuthenticationRouterError(): AuthenticationRouterErrorAction;
|
|
50
|
+
export declare const SHOW_AUTH_INFO_LOGIN = "SHOW_AUTH_INFO_LOGIN";
|
|
51
|
+
export type ShowAuthenticationRouterLoginAction = ReadonlyAction<typeof SHOW_AUTH_INFO_LOGIN> & {
|
|
52
|
+
showAuthenticationRouterLogin: boolean;
|
|
53
|
+
};
|
|
54
|
+
export declare function setShowAuthenticationRouterLogin(showAuthenticationRouterLogin: boolean): ShowAuthenticationRouterLoginAction;
|
|
55
|
+
export type AuthenticationActions = UserAction | SignInCallbackErrorAction | UnauthorizedUserAction | LogoutErrorAction | UserValidationErrorAction | AuthenticationRouterErrorAction | ShowAuthenticationRouterLoginAction;
|
|
56
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { User } from 'oidc-client';
|
|
2
2
|
|
|
3
|
+
export type CommonStoreState = {
|
|
4
|
+
user: User | null;
|
|
5
|
+
};
|
|
3
6
|
interface CommonStore {
|
|
4
|
-
getState: () =>
|
|
5
|
-
user: User;
|
|
6
|
-
};
|
|
7
|
+
getState: () => CommonStoreState;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* Set a copy of the reference to the store to be able to access it from this library.
|
|
@@ -3,7 +3,8 @@ function setCommonStore(store) {
|
|
|
3
3
|
commonStore = store;
|
|
4
4
|
}
|
|
5
5
|
function getUserToken() {
|
|
6
|
-
|
|
6
|
+
var _a;
|
|
7
|
+
return (_a = commonStore == null ? void 0 : commonStore.getState().user) == null ? void 0 : _a.id_token;
|
|
7
8
|
}
|
|
8
9
|
export {
|
|
9
10
|
getUserToken,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { NavigateFunction } from 'react-router-dom';
|
|
1
|
+
import { Location, NavigateFunction } from 'react-router-dom';
|
|
2
2
|
import { Dispatch } from 'react';
|
|
3
|
+
import { AuthenticationActions } from '../redux/authActions';
|
|
3
4
|
import { User, UserManager } from 'oidc-client';
|
|
4
5
|
|
|
5
6
|
type UserValidationFunc = (user: User) => Promise<boolean>;
|
|
@@ -9,12 +10,12 @@ type CustomUserManager = UserManager & {
|
|
|
9
10
|
maxExpiresIn?: number;
|
|
10
11
|
};
|
|
11
12
|
};
|
|
12
|
-
declare function initializeAuthenticationDev(dispatch: Dispatch<
|
|
13
|
-
declare function initializeAuthenticationProd(dispatch: Dispatch<
|
|
14
|
-
declare function login(location: Location, userManagerInstance: UserManager): Promise<void
|
|
15
|
-
declare function logout(dispatch: Dispatch<
|
|
16
|
-
declare function dispatchUser(dispatch: Dispatch<
|
|
13
|
+
declare function initializeAuthenticationDev(dispatch: Dispatch<AuthenticationActions>, isSilentRenew: boolean, validateUser: UserValidationFunc, isSigninCallback: boolean): Promise<UserManager>;
|
|
14
|
+
declare function initializeAuthenticationProd(dispatch: Dispatch<AuthenticationActions>, isSilentRenew: boolean, idpSettings: Promise<Response>, validateUser: UserValidationFunc, authorizationCodeFlowEnabled: boolean, isSigninCallback: boolean): Promise<CustomUserManager>;
|
|
15
|
+
declare function login(location: Location, userManagerInstance: UserManager | null): Promise<void> | undefined;
|
|
16
|
+
declare function logout(dispatch: Dispatch<AuthenticationActions>, userManagerInstance: UserManager | null): Promise<void | undefined> | undefined;
|
|
17
|
+
declare function dispatchUser(dispatch: Dispatch<AuthenticationActions>, userManagerInstance: CustomUserManager, validateUser: UserValidationFunc): Promise<void | undefined>;
|
|
17
18
|
declare function getPreLoginPath(): string | null;
|
|
18
|
-
declare function handleSigninCallback(dispatch: Dispatch<
|
|
19
|
+
declare function handleSigninCallback(dispatch: Dispatch<AuthenticationActions>, navigate: NavigateFunction, userManagerInstance: UserManager): void;
|
|
19
20
|
declare function handleSilentRenewCallback(userManagerInstance: UserManager): void;
|
|
20
21
|
export { initializeAuthenticationDev, initializeAuthenticationProd, handleSilentRenewCallback, login, logout, dispatchUser, handleSigninCallback, getPreLoginPath, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Log, UserManager } from "oidc-client";
|
|
2
2
|
import { UserManagerMock } from "./UserManagerMock.js";
|
|
3
|
-
import { setShowAuthenticationRouterLogin, setLoggedUser, setLogoutError, setUnauthorizedUserInfo, setUserValidationError, setSignInCallbackError, resetAuthenticationRouterError } from "../redux/
|
|
3
|
+
import { setShowAuthenticationRouterLogin, setLoggedUser, setLogoutError, setUnauthorizedUserInfo, setUserValidationError, setSignInCallbackError, resetAuthenticationRouterError } from "../redux/authActions.js";
|
|
4
4
|
import { jwtDecode } from "jwt-decode";
|
|
5
5
|
window.OIDCLog = Log;
|
|
6
6
|
const hackAuthorityKey = "oidc.hack.authority";
|
|
@@ -167,11 +167,11 @@ function computeMinExpiresIn(expiresIn, idToken, maxExpiresIn) {
|
|
|
167
167
|
}
|
|
168
168
|
function login(location, userManagerInstance) {
|
|
169
169
|
sessionStorage.setItem(pathKey, location.pathname + location.search);
|
|
170
|
-
return userManagerInstance.signinRedirect().then(() => console.debug("login"));
|
|
170
|
+
return userManagerInstance == null ? void 0 : userManagerInstance.signinRedirect().then(() => console.debug("login"));
|
|
171
171
|
}
|
|
172
172
|
function logout(dispatch, userManagerInstance) {
|
|
173
173
|
sessionStorage.removeItem(hackAuthorityKey);
|
|
174
|
-
return userManagerInstance.getUser().then((user) => {
|
|
174
|
+
return userManagerInstance == null ? void 0 : userManagerInstance.getUser().then((user) => {
|
|
175
175
|
if (user) {
|
|
176
176
|
return userManagerInstance.signoutRedirect({
|
|
177
177
|
extraQueryParams: {
|
package/package.json
CHANGED
package/dist/redux/actions.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { User } from 'oidc-client';
|
|
2
|
-
|
|
3
|
-
export declare const USER = "USER";
|
|
4
|
-
export declare function setLoggedUser(user: User | null): {
|
|
5
|
-
type: string;
|
|
6
|
-
user: User | null;
|
|
7
|
-
};
|
|
8
|
-
export declare const SIGNIN_CALLBACK_ERROR = "SIGNIN_CALLBACK_ERROR";
|
|
9
|
-
export declare function setSignInCallbackError(signInCallbackError: string | null): {
|
|
10
|
-
type: string;
|
|
11
|
-
signInCallbackError: string | null;
|
|
12
|
-
};
|
|
13
|
-
export declare const UNAUTHORIZED_USER_INFO = "UNAUTHORIZED_USER_INFO";
|
|
14
|
-
export declare function setUnauthorizedUserInfo(userName: string | undefined, unauthorizedUserInfo: string): {
|
|
15
|
-
type: string;
|
|
16
|
-
authenticationRouterError: {
|
|
17
|
-
userName: string | undefined;
|
|
18
|
-
unauthorizedUserInfo: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export declare const LOGOUT_ERROR = "LOGOUT_ERROR";
|
|
22
|
-
export declare function setLogoutError(userName: string | undefined, logoutError: {
|
|
23
|
-
error: Error;
|
|
24
|
-
}): {
|
|
25
|
-
type: string;
|
|
26
|
-
authenticationRouterError: {
|
|
27
|
-
userName: string | undefined;
|
|
28
|
-
logoutError: {
|
|
29
|
-
error: Error;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
export declare const USER_VALIDATION_ERROR = "USER_VALIDATION_ERROR";
|
|
34
|
-
export declare function setUserValidationError(userName: string | undefined, userValidationError: {
|
|
35
|
-
error: Error;
|
|
36
|
-
}): {
|
|
37
|
-
type: string;
|
|
38
|
-
authenticationRouterError: {
|
|
39
|
-
userName: string | undefined;
|
|
40
|
-
userValidationError: {
|
|
41
|
-
error: Error;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
export declare const RESET_AUTHENTICATION_ROUTER_ERROR = "RESET_AUTHENTICATION_ROUTER_ERROR";
|
|
46
|
-
export declare function resetAuthenticationRouterError(): {
|
|
47
|
-
type: string;
|
|
48
|
-
authenticationRouterError: null;
|
|
49
|
-
};
|
|
50
|
-
export declare const SHOW_AUTH_INFO_LOGIN = "SHOW_AUTH_INFO_LOGIN";
|
|
51
|
-
export declare function setShowAuthenticationRouterLogin(showAuthenticationRouterLogin: boolean): {
|
|
52
|
-
type: string;
|
|
53
|
-
showAuthenticationRouterLogin: boolean;
|
|
54
|
-
};
|
|
File without changes
|