diff --git a/package-lock.json b/package-lock.json index ebf7b5c..c7e1459 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", - "@gridsuite/commons-ui": "0.50.1", + "@gridsuite/commons-ui": "0.51.0", "@hookform/resolvers": "^3.3.1", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.75", @@ -27,6 +27,7 @@ "ag-grid-react": "^31.1.1", "core-js": "^3.6.4", "notistack": "^3.0.0", + "oidc-client": "^1.10.1", "prop-types": "^15.7.2", "react": "^18.0.0", "react-dom": "^18.0.0", @@ -2484,9 +2485,9 @@ } }, "node_modules/@gridsuite/commons-ui": { - "version": "0.50.1", - "resolved": "https://registry.npmjs.org/@gridsuite/commons-ui/-/commons-ui-0.50.1.tgz", - "integrity": "sha512-uJOBThra+6U9eMGml3z2QYuthldkSpH4MPi3+xxw50/gKKZLmflY2+o4DD3hcxLqwUQbdDbciuV2TXVdKM2dvg==", + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/@gridsuite/commons-ui/-/commons-ui-0.51.0.tgz", + "integrity": "sha512-11ESGwUUrYZ5ofGXHo4lzxdn7EyMSXXGDKm6GEg6oJN6GJwWxgfZKlFwLIjZrf6R2ScSDnSq0OcC4mjU1Y3YGg==", "dependencies": { "autosuggest-highlight": "^3.2.0", "clsx": "^1.0.4", diff --git a/package.json b/package.json index b3cbcef..f1fe50c 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "dependencies": { "@emotion/react": "^11.8.2", "@emotion/styled": "^11.8.1", - "@gridsuite/commons-ui": "0.50.1", + "@gridsuite/commons-ui": "0.51.0", "@hookform/resolvers": "^3.3.1", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.75", @@ -32,6 +32,7 @@ "ag-grid-react": "^31.1.1", "core-js": "^3.6.4", "notistack": "^3.0.0", + "oidc-client": "^1.10.1", "prop-types": "^15.7.2", "react": "^18.0.0", "react-dom": "^18.0.0", diff --git a/src/components/App/app.test.tsx b/src/components/App/app.test.tsx index 28c6928..2b954c6 100644 --- a/src/components/App/app.test.tsx +++ b/src/components/App/app.test.tsx @@ -14,7 +14,6 @@ import { ThemeProvider, } from '@mui/material/styles'; import { SnackbarProvider } from '@gridsuite/commons-ui'; -import { UserManagerMock } from '@gridsuite/commons-ui/es/utils/UserManagerMock'; import { CssBaseline } from '@mui/material'; import { appRoutes } from '../../routes'; diff --git a/src/module-commons-ui.d.ts b/src/module-commons-ui.d.ts deleted file mode 100644 index a85426f..0000000 --- a/src/module-commons-ui.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -//TODO: remove when commons-ui will include typescript definitions -declare module '@gridsuite/commons-ui'; -declare module '@gridsuite/commons-ui/es/utils/UserManagerMock'; diff --git a/src/redux/reducer.ts b/src/redux/reducer.ts index 6fdb23e..8fcb282 100644 --- a/src/redux/reducer.ts +++ b/src/redux/reducer.ts @@ -49,7 +49,7 @@ export type AppState = { [PARAM_LANGUAGE]: LanguageParameters; userManager: UserManagerState; - user: User | null; //TODO use true definition when commons-ui passed to typescript + user: User | null; //TODO delete when migrated into commons-ui signInCallbackError: unknown; authenticationRouterError: unknown; showAuthenticationRouterLogin: boolean; diff --git a/src/routes/router.tsx b/src/routes/router.tsx index f86f420..c6a6a7c 100644 --- a/src/routes/router.tsx +++ b/src/routes/router.tsx @@ -79,7 +79,7 @@ export function appRoutes(): RouteObject[] { } const AuthRouter: FunctionComponent<{ - userManager: (typeof AuthenticationRouter)['userManager']; + userManager: Parameters[0]['userManager']; }> = (props, context) => { const signInCallbackError = useSelector( (state: AppState) => state.signInCallbackError diff --git a/src/services/study.ts b/src/services/study.ts index 227015a..072844b 100644 --- a/src/services/study.ts +++ b/src/services/study.ts @@ -11,7 +11,7 @@ import { APP_NAME } from '../utils/config-params'; const STUDY_URL = `${getRestBase()}/study/v1`; -//TODO delete when commons-ui will be in typescript +//TODO delete when migrated into commons-ui export type ServerAbout = { type?: 'app' | 'server' | 'other'; name?: string; diff --git a/src/utils/language.ts b/src/utils/language.ts index 12ad114..e1b4dbd 100644 --- a/src/utils/language.ts +++ b/src/utils/language.ts @@ -7,11 +7,9 @@ import { LANG_ENGLISH, LANG_FRENCH, LANG_SYSTEM } from '@gridsuite/commons-ui'; -const supportedLanguages = [LANG_FRENCH, LANG_ENGLISH]; -//export type SupportedLanguagesType = typeof supportedLanguages[number]; //TODO when commons-ui in typescript -export type SupportedLanguages = 'en' | 'fr'; -//export type LanguageParameters = SupportedLanguages | typeof LANG_SYSTEM; //TODO when commons-ui in typescript -export type LanguageParameters = SupportedLanguages | 'sys'; +const supportedLanguages: string[] = [LANG_FRENCH, LANG_ENGLISH]; +export type SupportedLanguages = (typeof supportedLanguages)[number]; +export type LanguageParameters = SupportedLanguages | typeof LANG_SYSTEM; export function getSystemLanguage(): SupportedLanguages { const systemLanguage = navigator.language.split(/[-_]/)[0]; @@ -23,8 +21,5 @@ export function getSystemLanguage(): SupportedLanguages { export function getComputedLanguage( language: LanguageParameters ): SupportedLanguages { - return language === LANG_SYSTEM - ? getSystemLanguage() - : (language as SupportedLanguages); - //TODO remove cast when commons-ui in typescript + return language === LANG_SYSTEM ? getSystemLanguage() : language; }