From 1f24bcb9ca9e66710627639c9e65f1537953fcce Mon Sep 17 00:00:00 2001 From: nidhigarg-bmw <101316912+nidhigarg-bmw@users.noreply.github.com> Date: Wed, 21 Feb 2024 13:37:42 +0530 Subject: [PATCH] fix(portal osp login): fix reapper overlay on every page (#530) --- CHANGELOG.md | 2 ++ DEPENDENCIES | 2 +- package.json | 2 +- src/components/overlays/OSPConsent/index.tsx | 19 +++++++++++++++++-- src/features/admin/networkApiSlice.ts | 9 ++++++++- yarn.lock | 8 ++++---- 6 files changed, 33 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7611fc7c..408e1c970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ - Connect listing page, upload certificate and details page to back end api - 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/DEPENDENCIES b/DEPENDENCIES index 32dc58a63..e0f4c9e47 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1156,7 +1156,7 @@ npm/npmjs/@babel/traverse/7.23.3, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD npm/npmjs/@babel/types/7.23.0, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #11521 npm/npmjs/@babel/types/7.23.3, MIT AND (BSD-2-Clause AND ISC AND MIT) AND BSD-2-Clause AND BSD-3-Clause, approved, #11521 npm/npmjs/@bcoe/v8-coverage/0.2.3, ISC AND MIT, approved, clearlydefined -npm/npmjs/@catena-x/portal-shared-components/2.1.30, Apache-2.0 AND CC-BY-4.0, approved, #10502 +npm/npmjs/@catena-x/portal-shared-components/2.1.31, Apache-2.0 AND CC-BY-4.0, approved, #10502 npm/npmjs/@csstools/normalize.css/12.0.0, CC0-1.0, approved, clearlydefined npm/npmjs/@csstools/postcss-cascade-layers/1.1.1, CC0-1.0, approved, clearlydefined npm/npmjs/@csstools/postcss-color-function/1.1.1, CC0-1.0 AND (MIT AND W3C-20150513) AND W3C-20150513 AND MIT, approved, #3022 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"