From 4efbced44a76372b65c7f6eb9788b7d78c9bc50a Mon Sep 17 00:00:00 2001 From: "sanjay.khatal" Date: Wed, 27 Mar 2024 18:57:51 +0530 Subject: [PATCH 1/3] fix: user-profiule payload Signed-off-by: sanjay.khatal --- src/components/Authentication/SignInUserPasskey.tsx | 6 +++++- src/components/Authentication/SignInUserPassword.tsx | 6 +++++- src/components/Profile/UserProfile.tsx | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/Authentication/SignInUserPasskey.tsx b/src/components/Authentication/SignInUserPasskey.tsx index 64bd2fce1..8ca8ed299 100644 --- a/src/components/Authentication/SignInUserPasskey.tsx +++ b/src/components/Authentication/SignInUserPasskey.tsx @@ -70,8 +70,12 @@ const SignInUserPasskey = (signInUserProps: signInUserProps) => { (element: { orgRole: { name: string } }) => permissionArray.push(element?.orgRole?.name), ); + const { id, profileImg, firstName, email, enableEcosystem, multiEcosystemSupport } = data?.data || {} + const userProfile = { + id, profileImg, firstName, email, enableEcosystem, multiEcosystemSupport + } await setToLocalStorage(storageKeys.PERMISSIONS, permissionArray); - await setToLocalStorage(storageKeys.USER_PROFILE, data?.data); + await setToLocalStorage(storageKeys.USER_PROFILE, userProfile); await setToLocalStorage(storageKeys.USER_EMAIL, data?.data?.email); return { role: role?.orgRole || "" diff --git a/src/components/Authentication/SignInUserPassword.tsx b/src/components/Authentication/SignInUserPassword.tsx index 832f82b96..4690b0b97 100644 --- a/src/components/Authentication/SignInUserPassword.tsx +++ b/src/components/Authentication/SignInUserPassword.tsx @@ -56,7 +56,11 @@ const SignInUserPassword = (signInUserProps: SignInUser3Props) => { (element: { orgRole: { name: string } }) => permissionArray.push(element?.orgRole?.name), ); - await setToLocalStorage(storageKeys.USER_PROFILE, data?.data); + const { id, profileImg, firstName, email, enableEcosystem, multiEcosystemSupport } = data?.data || {} + const userProfile = { + id, profileImg, firstName, email, enableEcosystem, multiEcosystemSupport + } + await setToLocalStorage(storageKeys.USER_PROFILE, userProfile); await setToLocalStorage(storageKeys.USER_EMAIL, data?.data?.email); return { role: role?.orgRole ?? '', diff --git a/src/components/Profile/UserProfile.tsx b/src/components/Profile/UserProfile.tsx index 92b76503b..8d81ec438 100644 --- a/src/components/Profile/UserProfile.tsx +++ b/src/components/Profile/UserProfile.tsx @@ -28,7 +28,11 @@ const UserProfile = ({ noBreadcrumb }: { noBreadcrumb?: boolean }) => { if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { setPrePopulatedUserProfile(data?.data); - await setToLocalStorage(storageKeys.USER_PROFILE, data?.data) + const { id, profileImg, firstName, email, enableEcosystem, multiEcosystemSupport } = data?.data || {} + const userProfile = { + id, profileImg, firstName, email, enableEcosystem, multiEcosystemSupport + } + await setToLocalStorage(storageKeys.USER_PROFILE, userProfile) await setToLocalStorage(storageKeys.USER_EMAIL, data?.data?.email) } } catch (error) { From 889b1a58fea2640cf45c6be163b87e691af44542 Mon Sep 17 00:00:00 2001 From: "sanjay.khatal" Date: Wed, 27 Mar 2024 19:16:43 +0530 Subject: [PATCH 2/3] fix: upgrade crypto-js package Signed-off-by: sanjay.khatal --- package-lock.json | 22 +++++++++++++++------- package.json | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5811ff266..05c3e17d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "astro": "^2.9.0", "axios": "^1.4.0", "cookie": "^0.5.0", - "crypto-js": "^4.1.1", + "crypto-js": "^4.2.0", "dom-to-image": "^2.6.0", "downloadjs": "^1.4.7", "flowbite": "^1.8.1", @@ -2870,9 +2870,9 @@ } }, "node_modules/crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, "node_modules/css-line-break": { "version": "2.1.0", @@ -9297,6 +9297,8 @@ }, "node_modules/npm/node_modules/string-width": { "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "inBundle": true, "license": "MIT", "dependencies": { @@ -9324,6 +9326,8 @@ }, "node_modules/npm/node_modules/strip-ansi": { "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "inBundle": true, "license": "MIT", "dependencies": { @@ -14604,9 +14608,9 @@ "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" }, "crypto-js": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", - "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" }, "css-line-break": { "version": "2.1.0", @@ -18897,6 +18901,8 @@ }, "string-width": { "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "bundled": true, "requires": { "emoji-regex": "^8.0.0", @@ -18915,6 +18921,8 @@ }, "strip-ansi": { "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "bundled": true, "requires": { "ansi-regex": "^5.0.1" diff --git a/package.json b/package.json index 1405581ee..f598c638a 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "astro": "^2.9.0", "axios": "^1.4.0", "cookie": "^0.5.0", - "crypto-js": "^4.1.1", + "crypto-js": "^4.2.0", "dom-to-image": "^2.6.0", "downloadjs": "^1.4.7", "flowbite": "^1.8.1", From 2df89c507bec020bfd58fe7d3430121b951c47eb Mon Sep 17 00:00:00 2001 From: "sanjay.khatal" Date: Thu, 28 Mar 2024 12:37:11 +0530 Subject: [PATCH 3/3] fix: ecosystem role issue Signed-off-by: sanjay.khatal --- src/config/ecosystem.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/ecosystem.ts b/src/config/ecosystem.ts index f3e5e93a9..7771a63d8 100644 --- a/src/config/ecosystem.ts +++ b/src/config/ecosystem.ts @@ -64,7 +64,7 @@ const checkEcosystem = async (): Promise => { return { isEnabledEcosystem, isMultiEcosystem, - isEcosystemMember: !isLead, + isEcosystemMember: !isLead && isEnabledEcosystem, isEcosystemLead: isLead, }; };