diff --git a/CHANGELOG.md b/CHANGELOG.md index bbe0dabbc..ac2b26d85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - Updated dataspace provider links with quick links - Delete ownuser Redirect URL - fixed logout redirect url issue +- Consent Pop-Up after registration + - fix reappear overlay on every page even after consent updated ### Bugfix diff --git a/package.json b/package.json index 3bc2fa703..12f87b608 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ] }, "dependencies": { - "@catena-x/portal-shared-components": "^2.1.30", + "@catena-x/portal-shared-components": "^2.1.31", "@emotion/react": "^11.11.1", "@emotion/styled": "^11.11.0", "@hookform/error-message": "^2.0.1", diff --git a/src/components/overlays/OSPConsent/index.tsx b/src/components/overlays/OSPConsent/index.tsx index cd8cf6a2b..0cc51c327 100644 --- a/src/components/overlays/OSPConsent/index.tsx +++ b/src/components/overlays/OSPConsent/index.tsx @@ -29,7 +29,7 @@ import { } from '@catena-x/portal-shared-components' import { useDispatch } from 'react-redux' import { closeOverlay } from 'features/control/overlay' -import { useState } from 'react' +import { useEffect, useState } from 'react' import { OSPConsentContent } from './OSPConsentContent' import { error, success } from 'services/NotifyService' import { @@ -39,6 +39,7 @@ import { emptyPartnerRegistrationConsent, useFetchRegistrationApplicationsQuery, useFetchRegistrationApplicationDataQuery, + REGISTRATION_APPLICATION_STATUS, } from 'features/admin/networkApiSlice' export const OSPApplicationConsent = ({ id }: { id: string }) => { @@ -130,7 +131,21 @@ export const OSPApplicationConsent = ({ id }: { id: string }) => { } export const OSPConsent = () => { - const applications = useFetchRegistrationApplicationsQuery().data + const dispatch = useDispatch() + const { data: applications, refetch } = + useFetchRegistrationApplicationsQuery() + + useEffect(() => { + refetch() + if ( + applications && + applications?.length > 0 && + applications[0].applicationStatus === + REGISTRATION_APPLICATION_STATUS.SUBMITTED + ) + dispatch(closeOverlay()) + }, [refetch, applications]) + return applications && applications.length > 0 ? ( ) : ( diff --git a/src/features/admin/networkApiSlice.ts b/src/features/admin/networkApiSlice.ts index 7748bfb2d..d60f4834c 100644 --- a/src/features/admin/networkApiSlice.ts +++ b/src/features/admin/networkApiSlice.ts @@ -41,8 +41,15 @@ export enum CONSENT_STATUS { } export enum REGISTRATION_APPLICATION_STATUS { - PENDING = 'PENDING', CREATED = 'CREATED', + ADD_COMPANY_DATA = 'ADD_COMPANY_DATA', + INVITE_USER = 'INVITE_USER', + SELECT_COMPANY_ROLE = 'SELECT_COMPANY_ROLE', + UPLOAD_DOCUMENTS = 'UPLOAD_DOCUMENTS', + VERIFY = 'VERIFY', + SUBMITTED = 'SUBMITTED', + DECLINED = 'DECLINED', + CONFIRMED = 'CONFIRMED', } export enum REGISTRATION_APPLICATION_ITEM_TYPE { diff --git a/yarn.lock b/yarn.lock index 6641aa04a..74529c346 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1193,10 +1193,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@catena-x/portal-shared-components@^2.1.30": - version "2.1.30" - resolved "https://registry.yarnpkg.com/@catena-x/portal-shared-components/-/portal-shared-components-2.1.30.tgz#0c9082a576d5c1cb5fabf1e731f81f5ca7f10c80" - integrity sha512-BHO/2OOUihdOAA/Uql+s/VUBfl9ToHVQRL8mFMXhb9DuYPi213+LDXP3422sGLNQrlzIdCdD2U6yRHh8CVMlEQ== +"@catena-x/portal-shared-components@^2.1.31": + version "2.1.31" + resolved "https://registry.yarnpkg.com/@catena-x/portal-shared-components/-/portal-shared-components-2.1.31.tgz#43b80ca8587aa546268bb29309d56314e7135cc4" + integrity sha512-UaUqjZpf+PVV6aOa/QoB3dtZH3/HpEa3QAeY/GIOrfAQfHe3FI4sbxdAfMV8tPUcl1D/4NPitTGon6M3ZzBc7g== dependencies: "@mui/base" "^5.0.0-beta.3" "@mui/system" "^5.13.2"