From 69467ef355baeb8e093fcb8a43ec666957233b9c Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Tue, 26 Nov 2024 19:43:14 +0530 Subject: [PATCH] fix: react minified issue fixes Signed-off-by: pranalidhanavade --- src/commonComponents/ConfirmationModal.tsx | 12 +- src/commonComponents/DeviceDetailsCard.tsx | 5 +- src/commonComponents/EditPopup.tsx | 1 + src/commonComponents/PasseyAddDevicePopup.tsx | 8 +- src/components/AddOrganizationInEcosystem.tsx | 435 ------------------ .../Authentication/KeyCloakResetPassword.tsx | 11 +- .../Authentication/ResetPassword.tsx | 4 +- src/components/Authentication/SignInUser.tsx | 19 +- .../Authentication/SignInUserPasskey.tsx | 8 +- .../Authentication/SignInUserPassword.tsx | 8 +- src/components/Authentication/SignUpUser.tsx | 4 +- .../Authentication/SignUpUserPasskey.tsx | 8 +- .../Authentication/SignUpUserPassword.tsx | 4 +- src/components/ConnectionsList/index.tsx | 3 +- src/components/CreateOrgModal/index.tsx | 2 +- src/components/Issuance/BulkIssuance.tsx | 4 +- src/components/Issuance/ConnectionList.tsx | 2 +- src/components/Issuance/CredDefSelection.tsx | 3 +- src/components/Issuance/EmailIssuance.tsx | 4 +- src/components/Issuance/History.tsx | 5 +- src/components/Issuance/HistoryDetails.tsx | 2 +- src/components/Issuance/Issuance.tsx | 8 +- src/components/Issuance/IssuedCrdentials.tsx | 2 +- src/components/Profile/AddPasskey.tsx | 8 +- src/components/Profile/EditUserProfile.tsx | 8 +- src/components/Profile/UserProfile.tsx | 2 +- src/components/Resources/Schema/Create.tsx | 12 +- .../Resources/Schema/SchemasList.tsx | 2 +- .../Resources/Schema/ViewSchema.tsx | 16 +- src/components/Setting/index.tsx | 16 +- src/components/User/UserDashBoard.tsx | 15 +- .../Verification/ConnectionList.tsx | 2 +- .../Verification/CredDefSelection.tsx | 2 +- .../Verification/EmailAttributesSelection.tsx | 15 +- .../Verification/EmailCredDefSelection.tsx | 2 +- .../Verification/EmailVerification.tsx | 2 +- src/components/Verification/Verification.tsx | 14 +- .../VerificationCredentialList.tsx | 9 +- .../Verification/VerificationSchemasList.tsx | 4 +- src/components/organization/Dashboard.tsx | 14 +- .../organization/DeleteOrganization.tsx | 6 +- .../organization/EditOrgdetailsModal.tsx | 2 +- .../organization/OrganizationDetails.tsx | 6 +- .../organization/OrganizationsList.tsx | 7 +- .../PublicOrganizationDetails.tsx | 4 +- .../configuration-settings/CreateDid.tsx | 24 +- .../configuration-settings/DidList.tsx | 6 +- .../organization/interfaces/index.ts | 3 +- .../organization/invitations/Invitations.tsx | 6 +- .../invitations/ReceivedInvitations.tsx | 7 +- .../invitations/SendInvitationModal.tsx | 5 +- .../organization/users/EditUserRolesModal.tsx | 5 +- src/components/organization/users/Members.tsx | 9 +- .../SetPrivateKeyValue.tsx | 10 +- .../walletCommonComponents/WalletSpinup.tsx | 6 +- .../publicProfile/OrgWalletDetails.tsx | 2 +- .../OrganisationPublicProfile.tsx | 3 +- 57 files changed, 196 insertions(+), 620 deletions(-) delete mode 100644 src/components/AddOrganizationInEcosystem.tsx diff --git a/src/commonComponents/ConfirmationModal.tsx b/src/commonComponents/ConfirmationModal.tsx index 40a3e655a..63f1ca49c 100644 --- a/src/commonComponents/ConfirmationModal.tsx +++ b/src/commonComponents/ConfirmationModal.tsx @@ -8,10 +8,10 @@ interface IProps { onSuccess: (flag: boolean) => void; message: string | ReactElement |React.ReactNode; isProcessing: boolean; - success: string | null; - failure: string | null; - setFailure: (flag: string | null) => void; - setSuccess: (flag: string | null) => void; + success: string; + failure: string; + setFailure: (flag: string) => void; + setSuccess: (flag: string) => void; buttonTitles: string[]; loading:boolean; warning?:String @@ -83,7 +83,7 @@ const ConfirmationModal = ({ openModal, closeModal, onSuccess, message, isProces message={success} type={'success'} onAlertClose={() => { - setSuccess && setSuccess(null); + setSuccess && setSuccess(''); }} /> @@ -94,7 +94,7 @@ const ConfirmationModal = ({ openModal, closeModal, onSuccess, message, isProces message={failure} type={'failure'} onAlertClose={() => { - setFailure && setFailure(null); + setFailure && setFailure(''); }} /> diff --git a/src/commonComponents/DeviceDetailsCard.tsx b/src/commonComponents/DeviceDetailsCard.tsx index 85374e645..14fa6667c 100644 --- a/src/commonComponents/DeviceDetailsCard.tsx +++ b/src/commonComponents/DeviceDetailsCard.tsx @@ -7,14 +7,15 @@ import type { AxiosResponse } from "axios"; import { apiStatusCodes } from "../config/CommonConstant"; import { dateConversion } from "../utils/DateConversion"; import DateTooltip from "../components/Tooltip"; +import React from "react"; interface IResponseMessages {type: "error" | "success", message: string} const DeviceDetails = (props: { deviceFriendlyName: string, createDateTime: string, credentialID: string, refreshList: () => void, disableRevoke: boolean, responseMessages: (value: IResponseMessages) => void }) => { const [openModal, setOpenModal] = useState(false); const [openEditModel, setOpenEditModel] = useState(false) - const [editSuccess, setEditSuccess] = useState(null) - const [editfailure, setEditFailure] = useState(null) + const [editSuccess, setEditSuccess] = useState('') + const [editfailure, setEditFailure] = useState('') const handleDeleteModel = (flag: boolean) => { setOpenModal(flag) } diff --git a/src/commonComponents/EditPopup.tsx b/src/commonComponents/EditPopup.tsx index c37225817..7b29fb8dd 100644 --- a/src/commonComponents/EditPopup.tsx +++ b/src/commonComponents/EditPopup.tsx @@ -2,6 +2,7 @@ import { Button, Label, Modal } from 'flowbite-react'; import { Field, Form, Formik } from 'formik'; import * as yup from 'yup'; import { useRef } from 'react'; +import React from 'react'; const EditModal = (props: { openModal: boolean; diff --git a/src/commonComponents/PasseyAddDevicePopup.tsx b/src/commonComponents/PasseyAddDevicePopup.tsx index 8fd0cdb15..1f0e81fb0 100644 --- a/src/commonComponents/PasseyAddDevicePopup.tsx +++ b/src/commonComponents/PasseyAddDevicePopup.tsx @@ -20,9 +20,9 @@ const PasskeyAddDevice = (props: { registerWithPasskey: (flag: boolean) => Promise } ) => { - const [fidoUserError, setFidoUserError] = useState(null) + const [fidoUserError, setFidoUserError] = useState('') const [nextflag, setNextFlag] = useState(false) - const [success, setSuccess] = useState(null) + const [success, setSuccess] = useState('') const [passwordVisible, setPasswordVisible] = useState(false); const savePassword = async (values: PasswordValue) => { @@ -60,8 +60,8 @@ const PasskeyAddDevice = (props: { { - setSuccess(null) - setFidoUserError(null) + setSuccess('') + setFidoUserError('') } } > diff --git a/src/components/AddOrganizationInEcosystem.tsx b/src/components/AddOrganizationInEcosystem.tsx deleted file mode 100644 index 8f77a54c9..000000000 --- a/src/components/AddOrganizationInEcosystem.tsx +++ /dev/null @@ -1,435 +0,0 @@ - -import type { AxiosResponse } from 'axios'; -import { useEffect, useState } from 'react'; -import type { ChangeEvent } from 'react'; -import type { TableData } from '../commonComponents/datatable/interface'; -import { apiStatusCodes, storageKeys } from '../config/CommonConstant'; -import { AlertComponent } from './AlertComponent'; -import BreadCrumbs from './BreadCrumbs'; -import { getFromLocalStorage, removeFromLocalStorage, setToLocalStorage } from '../api/Auth'; -import SortDataTable from '../commonComponents/datatable/SortDataTable'; -import { getOrganizations } from '../api/organization'; -import CustomAvatar from '../components/Avatar'; - -import type { Organisation } from '../components/organization/interfaces'; -import { Roles } from '../utils/enums/roles'; -import { Button } from 'flowbite-react'; -import { addOrganizationInEcosystem } from '../api/ecosystem'; -import { pathRoutes } from '../config/pathRoutes'; -import React from 'react'; - - -const initialPageState = { - page: 1, - search: '', - sortingOrder: 'desc', - pageSize: 10, - role: Roles.OWNER -}; - -interface IErrorOrg { - id: string; - error: string; -} - -interface IErrorResponse { - statusCode: number; - message: string; - data?: { - orgId: string; - } - error?: string; -} - -interface ICurrentPage { - page: number; - pageSize: number; - search: string; - role: string; -} - -const AddOrganizationInEcosystem = () => { - const [listAPIParameter, setListAPIParameter] = useState(initialPageState); - const [errorList, setErrorList] = useState([]); - const [loading, setLoading] = useState(true); - const [error, setError] = useState(null); - const [success, setSuccess] = useState(null); - const [localOrgs, setLocalOrgs] = useState([]); - const [pageInfo, setPageInfo] = useState({ - totalItem: 0, - nextPage: 0, - lastPage: 0, - }); - const [totalPages, setTotalPages] = useState(0); - const [loader, setLoader] = useState(false); - const [organizationsList, setOrganizationsList] = useState | null>(null); - const [tableData, setTableData] = useState([]) - - const selectOrganization = async (item: Organisation, checked: boolean) => { - try { - const index = localOrgs?.length > 0 ? localOrgs.findIndex(ele => ele === item.id) : -1 - - if (index === -1) { - setLocalOrgs((prev: string[]) => [...prev, item.id]) - } else { - const updateLocalOrgs = [...localOrgs] - if (!checked) { - updateLocalOrgs.splice(index, 1); - } - setLocalOrgs(updateLocalOrgs) - } - } catch (error) { - throw new Error(`SELECTED ORGANIZATION:::${error}`); - } - } - - const generateTable = async (organizationsList: Organisation[] | null) => { - const id = await getFromLocalStorage(storageKeys.ECOSYSTEM_ID); - const connections = organizationsList && organizationsList?.length > 0 && organizationsList?.map((ele: Organisation) => { - const isChecked = localOrgs.includes(ele.id) - const alreadyAdded = ele.ecosystemOrgs?.some(item => item.ecosystemId === id) - const title = alreadyAdded ? "Already exists in the ecosystem" : "" - const error = errorList.find(item => item.id === ele.id)?.error || ele.error; - - return { - data: [ - { - data: ( -
- ) => { - const inputElement = event.target as HTMLInputElement; - - const updateOrgList: Organisation[] = organizationsList?.map(item => { - if (item.id === ele.id) { - selectOrganization(item, inputElement.checked) - return { - ...item, - checked: inputElement.checked - } - } - return item - }) - setOrganizationsList(updateOrgList) - }} - disabled={alreadyAdded} - defaultChecked={(ele.checked || isChecked) && !alreadyAdded} - className={`w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded-lg dark:ring-offset-gray-800 dark:bg-gray-700 dark:border-gray-600 disabled:opacity-100 ${alreadyAdded ? "cursor-not-allowed" : "cursor-pointer"}`} - /> -
- ), - }, - { - data: ( -
-
- {(ele?.logoUrl) ? - : - } -
-
- {ele.name} -
-
- ) - }, - { data: (
{ele.id}
) }, - { - data: ( -
- { - ele?.roles?.length > 0 && ele?.roles?.map(item => ( - - {item} - - )) - } -
- ), - }, - { - data: ( -
- { -
{error || "-"}
- } -
- ), - } - ], - }; - }); - setTableData(connections); - } - - useEffect(() => { - generateTable(organizationsList); - }, [organizationsList, localOrgs]) - - const getOwnerOrganizations = async (currentPage: ICurrentPage) => { - setLoading(true); - const response = await getOrganizations( - currentPage.page, - currentPage.pageSize, - currentPage.search, - currentPage.role - ); - const { data } = response as AxiosResponse; - - if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const totalPages = data?.data?.totalPages; - const orgList = data?.data?.organizations.map((userOrg: Organisation) => { - const roles: string[] = userOrg.userOrgRoles.map( - (role) => role.orgRole.name, - ); - userOrg.roles = roles; - return userOrg; - }); - setPageInfo({ - ...pageInfo, - totalItem: data?.data?.totalCount, - lastPage: data?.data?.totalPages, - nextPage: listAPIParameter?.page + 1 - }) - setOrganizationsList(orgList); - setTotalPages(totalPages); - } else { - setError(response as string); - } - setLoading(false); - }; - - const header = [ - { columnName: '', width: 'w-0.5' }, - { columnName: 'Organization' }, - { columnName: 'Id' }, - { columnName: 'Role(s)' }, - { columnName: 'Error' }, - ]; - - //onChange of Search input text - const searchInputChange = (e: ChangeEvent) => { - setListAPIParameter({ - ...listAPIParameter, - search: e.target.value, - page: 1, - }); - }; - - const refreshPage = () => { - setLocalOrgs([]); - getOwnerOrganizations(listAPIParameter); - }; - - const updateLocalOrgs = async () => { - const res = await getFromLocalStorage(storageKeys.SELECT_ORG_IN_ECOSYSTEM) - const selectedOrg = res ? JSON.parse(res) : [] - setLocalOrgs(selectedOrg); - - const err = await getFromLocalStorage(storageKeys.ERROR_ORG_IN_ECOSYSTEM) - const errOrgs = err ? JSON.parse(err) : [] - setErrorList(errOrgs); - } - - const handleAddOrganization = async () => { - const orgId = (await getFromLocalStorage(storageKeys.ORG_ID)) || ''; - const ecosystemId = - (await getFromLocalStorage(storageKeys.ECOSYSTEM_ID)) || ''; - setLoader(true); - try { - const response = await addOrganizationInEcosystem( - localOrgs, - ecosystemId, - orgId, - ); - const { data } = response as AxiosResponse; - setLoader(false); - setLocalOrgs([]); - setErrorList([]); - setOrganizationsList( - (prevState) => - prevState?.map((org) => ({ ...org, checked: false, error: '' })) || - [], - ); - - switch (data?.statusCode) { - case apiStatusCodes.API_STATUS_CREATED: - await removeFromLocalStorage(storageKeys.SELECT_ORG_IN_ECOSYSTEM); - setSuccess(data.message); - setTimeout(() => { - window.location.href = pathRoutes.ecosystem.dashboard; - }, 1000); - break; - - case apiStatusCodes.API_STATUS_PARTIALLY_COMPLETED: - await removeFromLocalStorage(storageKeys.SELECT_ORG_IN_ECOSYSTEM); - const errors = data?.data?.filter( - (item: IErrorResponse) => - item.statusCode !== apiStatusCodes.API_STATUS_CREATED, - ); - const errorData = errors.map((item: IErrorResponse) => ({ - id: item?.data?.orgId || '', - error: item.message, - })); - await setToLocalStorage( - storageKeys.ERROR_ORG_IN_ECOSYSTEM, - JSON.stringify(errorData), - ); - setErrorList(errorData); - setLocalOrgs([]); - - const updateWithError = - organizationsList && organizationsList?.length > 0 - ? organizationsList?.map((item) => ({ - ...item, - error: - errors?.find( - (ele: IErrorResponse) => ele?.data?.orgId === item.id, - )?.message || '', - checked: false - })) - : []; - setSuccess(data?.message); - setOrganizationsList(updateWithError); - setErrorList([]); - break; - default: - setError((response as string) || data?.message); - setErrorList([]); - setLocalOrgs([]); - setOrganizationsList( - (prevState) => - prevState?.map((org) => ({ - ...org, - checked: false, - error: '', - })) || [], - ); - - break; - } - } catch (error) { - setError(error.message as string); - setLoader(false); - setLocalOrgs([]); - setErrorList([]); - setOrganizationsList( - (prevState) => - prevState?.map((org) => ({ ...org, checked: false, error: '' })) || - [], - ); - } - }; - - useEffect(() => { - const clearLocalStorage = async () => { - await removeFromLocalStorage(storageKeys.SELECT_ORG_IN_ECOSYSTEM); - await removeFromLocalStorage(storageKeys.ERROR_ORG_IN_ECOSYSTEM); - }; - clearLocalStorage(); - refreshPage(); - - }, []); - - useEffect(() => { - getOwnerOrganizations(listAPIParameter); - updateLocalOrgs() - }, [listAPIParameter]); - - useEffect(() => { - updateLocalOrgs(); - (async () => { - await removeFromLocalStorage(storageKeys.SELECT_ORG_IN_ECOSYSTEM); - await removeFromLocalStorage(storageKeys.ERROR_ORG_IN_ECOSYSTEM); - })() - }, []) - - useEffect(() => { - (async () => { - await setToLocalStorage(storageKeys.SELECT_ORG_IN_ECOSYSTEM, JSON.stringify(localOrgs)) - })() - }, [localOrgs]) - - return ( -
- -
-

- Add Organizations -

-
- {(error || success) && ( - { - setError(null); - setSuccess(null); - }} - /> - )} - { - setListAPIParameter((prevState) => ({ - ...prevState, - page, - })); - }} - totalPages={totalPages} - pageInfo={pageInfo} - isHeader={true} - isSearch={true} - isRefresh={true} - isSort={false} - message={'No Organizations'} - discription={"You don't have any Organization to add"} - itemPerPage={listAPIParameter.pageSize} - > -
- -
-
- ); -}; - -export default AddOrganizationInEcosystem; diff --git a/src/components/Authentication/KeyCloakResetPassword.tsx b/src/components/Authentication/KeyCloakResetPassword.tsx index 5a439d7a1..fbebd0ad2 100644 --- a/src/components/Authentication/KeyCloakResetPassword.tsx +++ b/src/components/Authentication/KeyCloakResetPassword.tsx @@ -15,8 +15,8 @@ import CustomSpinner from '../CustomSpinner/index.js'; const KeyClockResetPassword = (props: IProps) => { const [loading, setLoading] = useState(false); - const [success, setSuccess] = useState(null); - const [error, setError] = useState(null); + const [success, setSuccess] = useState(''); + const [error, setError] = useState(''); const [passwordVisibility, setPasswordVisibility] = useState({ currentPassword: false, newPassword: false, @@ -78,8 +78,8 @@ const KeyClockResetPassword = (props: IProps) => { message={ success ?? error} type={success ? 'success' : 'failure'} onAlertClose={() => { - setError(null); - setSuccess(null); + setError(''); + setSuccess(''); }} /> { onSubmit={(values: IValues) => submitUpdatePassword(values)} > {(formikHandlers): JSX.Element => ( + <>
@@ -241,6 +242,8 @@ const KeyClockResetPassword = (props: IProps) => {
+ + )} diff --git a/src/components/Authentication/ResetPassword.tsx b/src/components/Authentication/ResetPassword.tsx index 64bbba5b5..014452ef4 100644 --- a/src/components/Authentication/ResetPassword.tsx +++ b/src/components/Authentication/ResetPassword.tsx @@ -59,7 +59,7 @@ const EyeIconInvisible = () => ( const ResetPassword = () => { const [loading, setLoading] = useState(false); - const [erroMsg, setErrMsg] = useState(null); + const [erroMsg, setErrMsg] = useState(''); const [message, setMessage] = useState(''); const [passwordVisible, setPasswordVisible] = useState(false); const [confirmPasswordVisible, setConfirmPasswordVisible] = useState(false); @@ -138,7 +138,7 @@ const ResetPassword = () => { {(message || erroMsg) && ( setErrMsg(null)} + onDismiss={() => setErrMsg('')} >

{message || erroMsg}

diff --git a/src/components/Authentication/SignInUser.tsx b/src/components/Authentication/SignInUser.tsx index a3fc01fa4..72e6d2185 100644 --- a/src/components/Authentication/SignInUser.tsx +++ b/src/components/Authentication/SignInUser.tsx @@ -13,22 +13,21 @@ import { envConfig } from '../../config/envConfig'; import { validEmail } from '../../utils/TextTransform'; interface emailValue { - email: string | null; + email: string; } const resetPasswordSuccess = '?isPasswordSet=true'; const SignInUser = () => { - const [email, setEmail] = useState(null); - const [fidoUserError, setFidoUserError] = useState(''); - const [success, setSuccess] = useState(null); - const [failure, setFailur] = useState(null); + const [email, setEmail] = useState(); + const [success, setSuccess] = useState(''); + const [failure, setFailur] = useState(''); const [loading, setLoading] = useState(false); const [currentComponent, setCurrentComponent] = useState('email'); const [isEmailValid, setIsEmailValid] = useState(false); const [isPasskeySuccess, setIsPasskeySuccess] = useState(false); - const [userLoginEmail, setUserLoginEmail] = useState(null); - const nextButtonRef = useRef(null); + const [userLoginEmail, setUserLoginEmail] = useState(''); + const nextButtonRef = useRef(); const successMessage = `Congratulations!! 🎉 You have successfully registered on ${envConfig.PLATFORM_DATA.name} 🚀` @@ -133,14 +132,14 @@ const SignInUser = () => {
- {(success || failure || fidoUserError) && ( + {(success || failure) && ( setSuccess(null)} + onDismiss={() => setSuccess('')} > -

{success || failure || fidoUserError}

+

{success || failure}

)} diff --git a/src/components/Authentication/SignInUserPasskey.tsx b/src/components/Authentication/SignInUserPasskey.tsx index f1aca8a2a..6e5042ea8 100644 --- a/src/components/Authentication/SignInUserPasskey.tsx +++ b/src/components/Authentication/SignInUserPasskey.tsx @@ -32,8 +32,8 @@ const SignInUserPasskey = (signInUserProps: signInUserProps) => { const [showSignInUserPassword, setShowSignInUserPassword] = useState(false); const [fidoLoader, setFidoLoader] = useState(false); const [fidoUserError, setFidoUserError] = useState(''); - const [failure, setFailure] = useState(null); - const [success, setSuccess] = useState(null); + const [failure, setFailure] = useState(''); + const [success, setSuccess] = useState(''); const [isDevice, setIsDevice] = useState(false); const handleSvgClick = () => { @@ -202,8 +202,8 @@ const SignInUserPasskey = (signInUserProps: signInUserProps) => { className='mb-4' color={success ? 'success' : 'failure'} onDismiss={() => { - setSuccess(null); - setFailure(null); + setSuccess(''); + setFailure(''); setFidoUserError(''); }} > diff --git a/src/components/Authentication/SignInUserPassword.tsx b/src/components/Authentication/SignInUserPassword.tsx index dec3d7768..542825ebd 100644 --- a/src/components/Authentication/SignInUserPassword.tsx +++ b/src/components/Authentication/SignInUserPassword.tsx @@ -34,8 +34,8 @@ interface SignInUser3Props { const SignInUserPassword = (signInUserProps: SignInUser3Props) => { const [email, setEmail] = useState(signInUserProps?.email); const [fidoUserError, setFidoUserError] = useState(''); - const [success, setSuccess] = useState(null); - const [failure, setFailure] = useState(null); + const [success, setSuccess] = useState(''); + const [failure, setFailure] = useState(''); const [isForgotPassLoading, setForgotPassLoading] = useState(false); const [loading, setLoading] = useState(false); const [currentComponent, setCurrentComponent] = useState('email'); @@ -174,8 +174,8 @@ const SignInUserPassword = (signInUserProps: SignInUser3Props) => { className="mb-4" color={success ? 'success' : 'failure'} onDismiss={() => { - setSuccess(null); - setFailure(null); + setSuccess(''); + setFailure(''); }} > diff --git a/src/components/Authentication/SignUpUser.tsx b/src/components/Authentication/SignUpUser.tsx index 41df2bcfc..80cdae7d3 100644 --- a/src/components/Authentication/SignUpUser.tsx +++ b/src/components/Authentication/SignUpUser.tsx @@ -26,7 +26,7 @@ const SignUpUser = () => { const [loading, setLoading] = useState(false) const [verifyLoader, setVerifyLoader] = useState(false) - const [erroMsg, setErrMsg] = useState(null) + const [erroMsg, setErrMsg] = useState('') const [verificationSuccess, setVerificationSuccess] = useState('') const [email, setEmail] = useState('') const [nextflag, setNextFlag] = useState(false) @@ -119,7 +119,7 @@ const SignUpUser = () => { { - setErrMsg(null); + setErrMsg(''); setVerificationSuccess(''); }} > diff --git a/src/components/Authentication/SignUpUserPasskey.tsx b/src/components/Authentication/SignUpUserPasskey.tsx index 18e616501..0c3e971d6 100644 --- a/src/components/Authentication/SignUpUserPasskey.tsx +++ b/src/components/Authentication/SignUpUserPasskey.tsx @@ -27,10 +27,10 @@ interface passwordValues { const SignUpUserPasskey = ({ email, firstName, lastName }: { email: string, firstName: string; lastName: string }) => { const [loading, setLoading] = useState(false) - const [erroMsg, setErrMsg] = useState(null) + const [erroMsg, setErrMsg] = useState('') const [verificationSuccess, setVerificationSuccess] = useState('') - const [addSuccess, setAddSuccess] = useState(null) - const [addfailure, setAddFailure] = useState(null) + const [addSuccess, setAddSuccess] = useState('') + const [addfailure, setAddFailure] = useState('') const [emailAutoFill, setEmailAutoFill] = useState('') const [fidoError, setFidoError] = useState("") const [currentComponent, setCurrentComponent] = useState('email'); @@ -205,7 +205,7 @@ const SignUpUserPasskey = ({ email, firstName, lastName }: { email: string, firs { - setAddSuccess(null) + setAddSuccess('') setFidoError('') setErrMsg('') }} diff --git a/src/components/Authentication/SignUpUserPassword.tsx b/src/components/Authentication/SignUpUserPassword.tsx index b0257fb8a..4f4a5a2d9 100644 --- a/src/components/Authentication/SignUpUserPassword.tsx +++ b/src/components/Authentication/SignUpUserPassword.tsx @@ -39,7 +39,7 @@ const SignUpUserPassword = ({ lastName: string; }) => { const [loading, setLoading] = useState(false); - const [erroMsg, setErrMsg] = useState(null); + const [erroMsg, setErrMsg] = useState(''); const [verificationSuccess] = useState(''); const [passwordVisible, setPasswordVisible] = useState(false); const [confirmPasswordVisible, setConfirmPasswordVisible] = useState(false); @@ -116,7 +116,7 @@ const SignUpUserPassword = ({ {(verificationSuccess || erroMsg) && ( setErrMsg(null)} + onDismiss={() => setErrMsg('')} >

{verificationSuccess || erroMsg}

diff --git a/src/components/ConnectionsList/index.tsx b/src/components/ConnectionsList/index.tsx index 480522608..978dc92b4 100644 --- a/src/components/ConnectionsList/index.tsx +++ b/src/components/ConnectionsList/index.tsx @@ -16,6 +16,7 @@ import { getFromLocalStorage } from '../../api/Auth'; import { getOrgDetails } from '../../config/ecosystem'; import type { IConnectionList } from '../../components/Issuance/interface'; import SortDataTable from '../../commonComponents/datatable/SortDataTable'; +import React from 'react'; const initialPageState = { itemPerPage: 10, @@ -29,7 +30,7 @@ const ConnectionList = () => { const [listAPIParameter, setListAPIParameter] = useState(initialPageState); const [connectionList, setConnectionList] = useState([]); const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [totalItem, setTotalItem] = useState(0); const [pageInfo, setPageInfo] = useState({ totalItem: '', diff --git a/src/components/CreateOrgModal/index.tsx b/src/components/CreateOrgModal/index.tsx index 6180a461a..10f5bebbc 100644 --- a/src/components/CreateOrgModal/index.tsx +++ b/src/components/CreateOrgModal/index.tsx @@ -50,7 +50,7 @@ const CreateOrgModal = (props: IProps) => { name: '', description: '', }); - const [errMsg, setErrMsg] = useState(''); + const [errMsg, setErrMsg] = useState(''); const [imgError, setImgError] = useState(''); diff --git a/src/components/Issuance/BulkIssuance.tsx b/src/components/Issuance/BulkIssuance.tsx index 68f3f04c1..f2fd58317 100644 --- a/src/components/Issuance/BulkIssuance.tsx +++ b/src/components/Issuance/BulkIssuance.tsx @@ -40,8 +40,8 @@ const BulkIssuance = () => { const [openModal, setOpenModal] = useState(false); const [searchText, setSearchText] = useState(''); const [uploadMessage, setUploadMessage] = useState(null) - const [success, setSuccess] = useState(''); - const [failure, setFailure] = useState(''); + const [success, setSuccess] = useState(''); + const [failure, setFailure] = useState(''); const [mounted, setMounted] = useState(false) const [schemaType, setSchemaType]= useState(); const [selectedTemplate, setSelectedTemplate] = useState(); diff --git a/src/components/Issuance/ConnectionList.tsx b/src/components/Issuance/ConnectionList.tsx index 4605982ea..1c7af8a6d 100644 --- a/src/components/Issuance/ConnectionList.tsx +++ b/src/components/Issuance/ConnectionList.tsx @@ -43,7 +43,7 @@ const ConnectionList = (props: { const [loading, setLoading] = useState(false); const [totalItem, setTotalItem] = useState(0); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [pageInfo, setPageInfo] = useState({ totalItem: '', nextPage: '', diff --git a/src/components/Issuance/CredDefSelection.tsx b/src/components/Issuance/CredDefSelection.tsx index 735d180d7..10cd833a0 100644 --- a/src/components/Issuance/CredDefSelection.tsx +++ b/src/components/Issuance/CredDefSelection.tsx @@ -17,6 +17,7 @@ import { getCredentialDefinitions } from '../../api/issuance'; import { pathRoutes } from '../../config/pathRoutes'; import DateTooltip from '../Tooltip'; import BackButton from '../../commonComponents/backbutton'; +import React from 'react'; const CredDefSelection = () => { const [schemaState, setSchemaState] = useState({ @@ -25,7 +26,7 @@ const CredDefSelection = () => { }); const [loading, setLoading] = useState(true); const [schemaLoader, setSchemaLoader] = useState(true); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [credDefList, setCredDefList] = useState([]); const [schemaDetailsState, setSchemaDetailsState] = useState({ schemaId: '', diff --git a/src/components/Issuance/EmailIssuance.tsx b/src/components/Issuance/EmailIssuance.tsx index 1e2aea52a..9db028f8e 100644 --- a/src/components/Issuance/EmailIssuance.tsx +++ b/src/components/Issuance/EmailIssuance.tsx @@ -46,8 +46,8 @@ const EmailIssuance = () => { const [batchName, setBatchName] = useState(''); const [openResetModal, setOpenResetModal] = useState(false); const [attributes, setAttributes] = useState([]); - const [success, setSuccess] = useState(''); - const [failure, setFailure] = useState(''); + const [success, setSuccess] = useState(''); + const [failure, setFailure] = useState(''); const [isEditing, setIsEditing] = useState(false); const [issueLoader, setIssueLoader] = useState(false); const inputRef = useRef(null); diff --git a/src/components/Issuance/History.tsx b/src/components/Issuance/History.tsx index da3e8a86c..30458ebe6 100644 --- a/src/components/Issuance/History.tsx +++ b/src/components/Issuance/History.tsx @@ -20,6 +20,7 @@ import { import { ToastContainer, toast } from 'react-toastify'; import SortDataTable from '../../commonComponents/datatable/SortDataTable'; import type { IConnectionListAPIParameter } from '../../api/connection'; +import React from 'react'; const HistoryBulkIssuance = () => { const initialPageState = { @@ -32,8 +33,8 @@ const HistoryBulkIssuance = () => { const [listAPIParameter, setListAPIParameter] = useState(initialPageState); const [connectionList, setConnectionList] = useState([]); const [loading, setLoading] = useState(true); - const [failure, setFailure] = useState(''); - const [success, setSuccess] = useState(''); + const [failure, setFailure] = useState(''); + const [success, setSuccess] = useState(''); const [totalItem, setTotalItem] = useState(0); const [pageInfo, setPageInfo] = useState({ totalItem: '', diff --git a/src/components/Issuance/HistoryDetails.tsx b/src/components/Issuance/HistoryDetails.tsx index f602d10fc..2f605947f 100644 --- a/src/components/Issuance/HistoryDetails.tsx +++ b/src/components/Issuance/HistoryDetails.tsx @@ -30,7 +30,7 @@ const HistoryDetails = ({ requestId }: IProps) => { const [listAPIParameter, setListAPIParameter] = useState(initialPageState); const [historyList, setHistoryList] = useState([]); const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [totalItem, setTotalItem] = useState(0); const [pageInfo, setPageInfo] = useState({ totalItem: '', diff --git a/src/components/Issuance/Issuance.tsx b/src/components/Issuance/Issuance.tsx index dc93b09b2..d734fb17b 100644 --- a/src/components/Issuance/Issuance.tsx +++ b/src/components/Issuance/Issuance.tsx @@ -46,12 +46,12 @@ const IssueCred = () => { IssuanceFormPayload[] >([]); const [issuanceLoader, setIssuanceLoader] = useState(false); - const [failure, setFailure] = useState(null); + const [failure, setFailure] = useState(''); const [schemaAttributesDetails, setSchemaAttributesDetails] = useState< IAttribute[] >([]); - const [success, setSuccess] = useState(''); - const [error, setError] = useState(''); + const [success, setSuccess] = useState(''); + const [error, setError] = useState(''); const [w3cSchema, setW3CSchema]= useState(false); const [credentialType, setCredentialType] = useState(); const [schemaType, setSchemaType] = useState(); @@ -442,7 +442,7 @@ const getSelectedUsers = async (): Promise => {
{failure && (
- setFailure(null)}> + setFailure('')}>

{failure}

diff --git a/src/components/Issuance/IssuedCrdentials.tsx b/src/components/Issuance/IssuedCrdentials.tsx index f1984d6d5..a039202c9 100644 --- a/src/components/Issuance/IssuedCrdentials.tsx +++ b/src/components/Issuance/IssuedCrdentials.tsx @@ -34,7 +34,7 @@ const initialPageState = { const CredentialList = () => { const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [issuedCredList, setIssuedCredList] = useState([]); const [walletCreated, setWalletCreated] = useState(false); const [listAPIParameter, setListAPIParameter] = diff --git a/src/components/Profile/AddPasskey.tsx b/src/components/Profile/AddPasskey.tsx index 7a9c47a45..2d0dc5e2c 100644 --- a/src/components/Profile/AddPasskey.tsx +++ b/src/components/Profile/AddPasskey.tsx @@ -33,10 +33,10 @@ const AddPasskey = ({ responseMessages }: { responseMessages: (value: IResponse const [fidoLoader, setFidoLoader] = useState(true); const [OrgUserEmail, setOrgUserEmail] = useState(''); const [deviceList, setDeviceList] = useState([]); - const [addSuccess, setAddSuccess] = useState(''); - const [editSuccess, setEditSuccess] = useState(''); - const [editFailure, setEditFailure] = useState(''); - const [addfailure, setAddFailure] = useState(''); + const [addSuccess, setAddSuccess] = useState(''); + const [editSuccess, setEditSuccess] = useState(''); + const [editFailure, setEditFailure] = useState(''); + const [addfailure, setAddFailure] = useState(''); const [disableFlag, setDisableFlag] = useState(false); const [isDevice, setIsDevice] = useState(false); diff --git a/src/components/Profile/EditUserProfile.tsx b/src/components/Profile/EditUserProfile.tsx index 8287afd8f..11f246f40 100644 --- a/src/components/Profile/EditUserProfile.tsx +++ b/src/components/Profile/EditUserProfile.tsx @@ -33,8 +33,8 @@ const EditUserProfile = ({ toggleEditProfile, userProfileInfo, updateProfile }: const [loading, setLoading] = useState(false) const [isImageEmpty, setIsImageEmpty] = useState(true) - const [success, setSuccess] = useState(null) - const [failure, setFailure] = useState(null) + const [success, setSuccess] = useState('') + const [failure, setFailure] = useState('') const [initialProfileData, setInitialProfileData] = useState({ profileImg: userProfileInfo?.profileImg || "", @@ -209,8 +209,8 @@ const EditUserProfile = ({ toggleEditProfile, userProfileInfo, updateProfile }: { - setSuccess(null) - setFailure(null) + setSuccess('') + setFailure('') }} > diff --git a/src/components/Profile/UserProfile.tsx b/src/components/Profile/UserProfile.tsx index b894c29d8..8d8f1f5d0 100644 --- a/src/components/Profile/UserProfile.tsx +++ b/src/components/Profile/UserProfile.tsx @@ -12,7 +12,7 @@ import EditUserProfile from './EditUserProfile'; const UserProfile = ({ noBreadcrumb }: { noBreadcrumb?: boolean }) => { const [isEditProfileOpen, setIsEditProfileOpen] = useState(false); - const [prePopulatedUserProfile, setPrePopulatedUserProfile] = useState(null); + const [prePopulatedUserProfile, setPrePopulatedUserProfile] = useState(); const fetchUserProfile = async () => { try { diff --git a/src/components/Resources/Schema/Create.tsx b/src/components/Resources/Schema/Create.tsx index 2f2634f56..a0b283a30 100644 --- a/src/components/Resources/Schema/Create.tsx +++ b/src/components/Resources/Schema/Create.tsx @@ -48,8 +48,8 @@ interface IPopup { } const CreateSchema = () => { - const [failure, setFailure] = useState(null); - const [success, setSuccess] = useState(null); + const [failure, setFailure] = useState(''); + const [success, setSuccess] = useState(''); const [isEcosystemData, setIsEcosystemData] = useState(); const [orgId, setOrgId] = useState(''); const [createLoader, setCreateLoader] = useState(false); @@ -166,7 +166,7 @@ const CreateSchema = () => { setCreateLoader(false); setLoading(true); setTimeout(() => { - setSuccess(null); + setSuccess(''); window.location.href = pathRoutes?.organizations?.schemas; }, 1500); setTimeout(() => { @@ -183,7 +183,7 @@ const CreateSchema = () => { setCreateLoader(false); setFailure(createSchema as string); setTimeout(() => { - setFailure(null); + setFailure(''); }, 2000); } setTimeout(() => { @@ -216,13 +216,13 @@ const CreateSchema = () => { window.location.href = `${envConfig.PUBLIC_ECOSYSTEM_FRONT_END_URL}${pathRoutes.organizations.createSchema}` setTimeout(() => { - setSuccess(null); + setSuccess(''); }, 2000); } else { setCreateLoader(false); setFailure(createSchema as string); setTimeout(() => { - setFailure(null); + setFailure(''); }, 2000); } setTimeout(() => { diff --git a/src/components/Resources/Schema/SchemasList.tsx b/src/components/Resources/Schema/SchemasList.tsx index e7edeb7a1..251cac626 100644 --- a/src/components/Resources/Schema/SchemasList.tsx +++ b/src/components/Resources/Schema/SchemasList.tsx @@ -41,7 +41,7 @@ const SchemaList = (props: { const verificationFlag = props.verificationFlag ?? false; const [schemaList, setSchemaList] = useState([]); - const [schemaListErr, setSchemaListErr] = useState(''); + const [schemaListErr, setSchemaListErr] = useState(''); const [loading, setLoading] = useState(true); const [allSchemaFlag, setAllSchemaFlag] = useState(false); const [orgId, setOrgId] = useState(''); diff --git a/src/components/Resources/Schema/ViewSchema.tsx b/src/components/Resources/Schema/ViewSchema.tsx index c52dacd19..b61bf5f4c 100644 --- a/src/components/Resources/Schema/ViewSchema.tsx +++ b/src/components/Resources/Schema/ViewSchema.tsx @@ -63,15 +63,15 @@ const initialPageState = { }; const ViewSchemas = ({ schemaId }: { schemaId: string }) => { - const [schemaDetails, setSchemaDetails] = useState(null); + const [schemaDetails, setSchemaDetails] = useState(); const [credDeffList, setCredDeffList] = useState([]); const [loading, setLoading] = useState(true); const [createloader, setCreateLoader] = useState(false); const [credDeffloader, setCredDeffloader] = useState(false); - const [success, setSuccess] = useState(null); - const [credDefListErr, setCredDefListErr] = useState(null); - const [schemaDetailErr, setSchemaDetailErr] = useState(null); - const [failure, setFailure] = useState(null); + const [success, setSuccess] = useState(''); + const [credDefListErr, setCredDefListErr] = useState(''); + const [schemaDetailErr, setSchemaDetailErr] = useState(''); + const [failure, setFailure] = useState(''); const [orgId, setOrgId] = useState(''); const [credDefAuto, setCredDefAuto] = useState(''); const [ledgerPlatformLoading, setLedgerPlatformLoading] = useState(false); @@ -438,8 +438,8 @@ const ViewSchemas = ({ schemaId }: { schemaId: string }) => { { - setSuccess(null); - setFailure(null); + setSuccess(''); + setFailure(''); }} > @@ -501,7 +501,7 @@ const ViewSchemas = ({ schemaId }: { schemaId: string }) => {
{schemaDetailErr && ( - setSchemaDetailErr(null)}> + setSchemaDetailErr('')}>

{schemaDetailErr}

diff --git a/src/components/Setting/index.tsx b/src/components/Setting/index.tsx index 254aca75c..1963facd2 100644 --- a/src/components/Setting/index.tsx +++ b/src/components/Setting/index.tsx @@ -16,14 +16,14 @@ import { EmptyListMessage } from '../EmptyListComponent'; const Index = () => { const [loading, setLoading] = useState(true); - const [clientId, setClientId] = useState(null); - const [clientSecret, setClientSecret] = useState(null); - const [success, setSuccess] = useState(''); - const [failure, setFailure] = useState(''); - const [warning, setWarning] = useState(''); + const [clientId, setClientId] = useState(''); + const [clientSecret, setClientSecret] = useState(''); + const [success, setSuccess] = useState(''); + const [failure, setFailure] = useState(''); + const [warning, setWarning] = useState(''); const [hideCopy, setHideCopy] = useState(true); const [userRoles, setUserRoles] = useState([]); - const [orgnizationId, setOrgnizationId] = useState(null); + const [orgnizationId, setOrgnizationId] = useState(''); const [buttonDisplay, setButtonDisplay] = useState(true); const [regenerate, setRegenerate] = useState(false); @@ -71,8 +71,8 @@ const Index = () => { setClientSecret(data?.data?.clientSecret); setButtonDisplay(true); } else { - setClientId(null); - setClientSecret(null); + setClientId(''); + setClientSecret(''); } } catch (error) { setFailure(error as string); diff --git a/src/components/User/UserDashBoard.tsx b/src/components/User/UserDashBoard.tsx index 5c6f5b547..3e7a991a0 100644 --- a/src/components/User/UserDashBoard.tsx +++ b/src/components/User/UserDashBoard.tsx @@ -52,20 +52,17 @@ interface ICredDef { } const UserDashBoard = () => { - const [message, setMessage] = useState(''); - const [ecoMessage, setEcoMessage] = useState(''); + const [message, setMessage] = useState(''); + const [ecoMessage, setEcoMessage] = useState(''); const [viewButton, setViewButton] = useState(false); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [currentPage, setCurrentPage] = useState(initialPageState); - const [organizationsList, setOrganizationList] = - useState | null>(null); + const [organizationsList, setOrganizationList] = useState([]); - const [activityList, setActivityList] = useState | null>( - null, - ); + const [activityList, setActivityList] = useState([]); const [orgCount, setOrgCount] = useState(0); const [schemaCount, setSchemaCount] = useState(0); - const [schemaList, setSchemaList] = useState | null>(null); + const [schemaList, setSchemaList] = useState([]); const [schemaListAPIParameter, setSchemaListAPIParameter] = useState({ itemPerPage: itemPerPage, page: 1, diff --git a/src/components/Verification/ConnectionList.tsx b/src/components/Verification/ConnectionList.tsx index 0beab7ceb..e47266b66 100644 --- a/src/components/Verification/ConnectionList.tsx +++ b/src/components/Verification/ConnectionList.tsx @@ -34,7 +34,7 @@ const ConnectionList = (props: { const [listAPIParameter, setListAPIParameter] = useState(initialPageState); const [totalItem, setTotalItem] = useState(0); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [pageInfo, setPageInfo] = useState({ totalItem: '', nextPage: '', diff --git a/src/components/Verification/CredDefSelection.tsx b/src/components/Verification/CredDefSelection.tsx index 16dfb007c..4872dbd16 100644 --- a/src/components/Verification/CredDefSelection.tsx +++ b/src/components/Verification/CredDefSelection.tsx @@ -20,7 +20,7 @@ const CredDefSelection = () => { const [schemaState, setSchemaState] = useState({ schemaName: '', version: '' }) const [loading, setLoading] = useState(true) const [schemaLoader, setSchemaLoader] = useState(true) - const [error, setError] = useState('') + const [error, setError] = useState('') const [credDefList, setCredDefList] = useState([]) const [schemaDetailsState, setSchemaDetailsState] = useState({ schemaId: '', issuerDid: '', attributes: [], createdDateTime: '' }) diff --git a/src/components/Verification/EmailAttributesSelection.tsx b/src/components/Verification/EmailAttributesSelection.tsx index 070397062..4435316cc 100644 --- a/src/components/Verification/EmailAttributesSelection.tsx +++ b/src/components/Verification/EmailAttributesSelection.tsx @@ -15,15 +15,16 @@ import CustomCheckbox from '../../commonComponents/CustomCheckbox'; import { getOrganizationById } from '../../api/organization'; import type { AxiosResponse } from 'axios'; import { DidMethod } from '../../common/enums'; +import React from 'react'; const EmailAttributesSelection = () => { const [attributeList, setAttributeList] = useState([]); - const [proofReqSuccess, setProofReqSuccess] = useState(null); - const [errMsg, setErrMsg] = useState(null); + const [proofReqSuccess, setProofReqSuccess] = useState(''); + const [errMsg, setErrMsg] = useState(''); const [display, setDisplay] = useState(false); const [loading, setLoading] = useState(true); - const [attributeData, setAttributeData] = useState( - null, + const [attributeData, setAttributeData] = useState( + [], ); const [w3cSchema, setW3cSchema] = useState(false); @@ -95,7 +96,7 @@ const EmailAttributesSelection = () => { const handleSubmit = () => { - setErrMsg(null); + setErrMsg(''); if (w3cSchema) { redirectToAppropriatePage(); @@ -358,8 +359,8 @@ const EmailAttributesSelection = () => { { - setProofReqSuccess(null); - setErrMsg(null); + setProofReqSuccess(''); + setErrMsg(''); }} > {proofReqSuccess ?? errMsg} diff --git a/src/components/Verification/EmailCredDefSelection.tsx b/src/components/Verification/EmailCredDefSelection.tsx index b5f3e95e8..49561245e 100644 --- a/src/components/Verification/EmailCredDefSelection.tsx +++ b/src/components/Verification/EmailCredDefSelection.tsx @@ -17,7 +17,7 @@ import CustomCheckbox from "../../commonComponents/CustomCheckbox"; const EmailCredDefSelection = () => { const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [credDefList, setCredDefList] = useState([]); const [searchValue, setSearchValue] = useState(''); const [selectedCredDefs, setSelectedCredDefs] = useState([]); diff --git a/src/components/Verification/EmailVerification.tsx b/src/components/Verification/EmailVerification.tsx index f41c44286..9317054fe 100644 --- a/src/components/Verification/EmailVerification.tsx +++ b/src/components/Verification/EmailVerification.tsx @@ -16,7 +16,7 @@ import React from 'react'; const EmailVerification = () => { const [loading, setLoading] = useState(false); - const [errorMessage, setErrorMessage] = useState(''); + const [errorMessage, setErrorMessage] = useState(''); const [emailInputs, setEmailInputs] = useState([{ value: '' }]); const [w3cSchema, setW3cSchema] = useState(false); diff --git a/src/components/Verification/Verification.tsx b/src/components/Verification/Verification.tsx index 0c4c420d7..a2f3b94e9 100644 --- a/src/components/Verification/Verification.tsx +++ b/src/components/Verification/Verification.tsx @@ -26,8 +26,8 @@ import { DidMethod, RequestType } from '../../common/enums'; const VerificationCred = () => { const [attributeList, setAttributeList] = useState([]); - const [proofReqSuccess, setProofReqSuccess] = useState(null); - const [errMsg, setErrMsg] = useState(null); + const [proofReqSuccess, setProofReqSuccess] = useState(''); + const [errMsg, setErrMsg] = useState(''); const [display, setDisplay] = useState(false); const [schemaDetails, setSchemaDetails] = useState({ schemaName: '', @@ -44,11 +44,11 @@ const VerificationCred = () => { }); const [w3cSchema, setW3CSchema] = useState(false); const [requestType, setRequestType] = useState(); - const [failure, setFailure] = useState(null); + const [failure, setFailure] = useState(''); const [loading, setLoading] = useState(true); const [requestLoader, setRequestLoader] = useState(false); - const [attributeData, setAttributeData] = useState( - null, + const [attributeData, setAttributeData] = useState( + [], ); useEffect(() => { @@ -541,8 +541,8 @@ const VerificationCred = () => { { - setProofReqSuccess(null); - setErrMsg(null); + setProofReqSuccess(''); + setErrMsg(''); }} > {proofReqSuccess || errMsg} diff --git a/src/components/Verification/VerificationCredentialList.tsx b/src/components/Verification/VerificationCredentialList.tsx index 145d79c4c..04ae45405 100644 --- a/src/components/Verification/VerificationCredentialList.tsx +++ b/src/components/Verification/VerificationCredentialList.tsx @@ -43,9 +43,10 @@ const VerificationCredentialList = () => { const [verificationList, setVerificationList] = useState([]); const [openModal, setOpenModal] = useState(false); const [requestId, setRequestId] = useState(''); - const [errMsg, setErrMsg] = useState(null); + const [errMsg, setErrMsg] = useState(''); const [proofReqSuccess, setProofReqSuccess] = useState(''); - const [userData, setUserData] = useState(null); + // FIXME:give initial state for userData + const [userData, setUserData] = useState(); const [view, setView] = useState(false); const [walletCreated, setWalletCreated] = useState(false); const [listAPIParameter, setListAPIParameter] = @@ -242,7 +243,7 @@ const VerificationCredentialList = () => { ); setVerificationList(credentialList); - setErrMsg(null); + setErrMsg(''); } else { setVerificationList([]); } @@ -384,7 +385,7 @@ const VerificationCredentialList = () => {
setErrMsg(null)} + onDismiss={() => setErrMsg('')} >

{proofReqSuccess || errMsg}

diff --git a/src/components/Verification/VerificationSchemasList.tsx b/src/components/Verification/VerificationSchemasList.tsx index 35a3d25cc..168c1deaa 100644 --- a/src/components/Verification/VerificationSchemasList.tsx +++ b/src/components/Verification/VerificationSchemasList.tsx @@ -22,7 +22,7 @@ import type { IAttributesDetails, ISchema, ISchemaData } from './interface'; const VerificationSchemasList = () => { const [schemasList, setSchemasList] = useState([]); - const [schemasDetailsErr, setSchemasDetailsErr] = useState(''); + const [schemasDetailsErr, setSchemasDetailsErr] = useState(''); const [loading, setLoading] = useState(true); const [allSchemasFlag, setAllSchemasFlag] = useState(false); const [schemasListParameter, setSchemasListParameter] = useState({ @@ -309,7 +309,7 @@ const VerificationSchemasList = () => {
{schemasDetailsErr && ( - setSchemasDetailsErr(null)}> + setSchemasDetailsErr('')}>

{schemasDetailsErr}

diff --git a/src/components/organization/Dashboard.tsx b/src/components/organization/Dashboard.tsx index 6a99b6702..31d04abde 100644 --- a/src/components/organization/Dashboard.tsx +++ b/src/components/organization/Dashboard.tsx @@ -27,20 +27,20 @@ const initialPageState = { const Dashboard = () => { - const [orgData, setOrgData] = useState(null); + // FIXME: initial state of setOrgData and setOrgDashboard + const [orgData, setOrgData] = useState(undefined); const [walletStatus, setWalletStatus] = useState(false); - const [orgDashboard, setOrgDashboard] = useState(null); + const [orgDashboard, setOrgDashboard] = useState(undefined); const [success, setSuccess] = useState(''); const [failure, setFailure] = useState(''); - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(true); const [userRoles, setUserRoles] = useState([]); const [orgSuccess, setOrgSuccess] = useState(''); const [openModal, setOpenModal] = useState(false); const [currentPage, setCurrentPage] = useState(initialPageState); const [ecoCount, setEcoCount] = useState(0); - const [error, setError] = useState(null); + const [error, setError] = useState(''); const [redirectToEndorsment, setRedirectToEndorsment] = useState(); - const [ecosystemUserRoles, setEcosystemUserRoles] = useState(''); @@ -163,7 +163,7 @@ const Dashboard = () => { setSuccess(''); setFailure(''); }, 3000); - }, [success !== null, failure !== null]); + }, [success !== '', failure !== '']); const setWalletSpinupStatus = (status: boolean) => { setSuccess('Wallet created successfully'); @@ -320,7 +320,7 @@ const Dashboard = () => { {(success || failure) && ( setFailure(null)} + onDismiss={() => setFailure('')} >

{success || failure}

diff --git a/src/components/organization/DeleteOrganization.tsx b/src/components/organization/DeleteOrganization.tsx index c3177dff2..df79aa1e8 100644 --- a/src/components/organization/DeleteOrganization.tsx +++ b/src/components/organization/DeleteOrganization.tsx @@ -26,11 +26,11 @@ import { EcosystemRoles } from "../../common/enums"; const DeleteOrganizations = () => { const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); - const [organizationData, setOrganizationData] = useState(null); + const [error, setError] = useState(''); + const [organizationData, setOrganizationData] = useState(); const [deleteLoading, setDeleteLoading] = useState(false); const [isWalletPresent, setIsWalletPresent] = useState(false); - const [message, setMessage] = useState(''); + const [message, setMessage] = useState(''); const [showPopup, setShowPopup] = useState(false); const [deleteAction, setDeleteAction] = useState<() => void>(() => {}); const [confirmMessage, setConfirmMessage] = useState(''); diff --git a/src/components/organization/EditOrgdetailsModal.tsx b/src/components/organization/EditOrgdetailsModal.tsx index b36069fa3..94f1e8d16 100644 --- a/src/components/organization/EditOrgdetailsModal.tsx +++ b/src/components/organization/EditOrgdetailsModal.tsx @@ -56,7 +56,7 @@ const EditOrgdetailsModal = (props: EditOrgdetailsModalProps) => { } }, [props.orgData, props.openModal]); - const [erroMsg, setErrMsg] = useState(''); + const [erroMsg, setErrMsg] = useState(''); const [imgError, setImgError] = useState(''); diff --git a/src/components/organization/OrganizationDetails.tsx b/src/components/organization/OrganizationDetails.tsx index 9a0779f93..2e2047944 100644 --- a/src/components/organization/OrganizationDetails.tsx +++ b/src/components/organization/OrganizationDetails.tsx @@ -12,15 +12,15 @@ import CopyDid from '../../commonComponents/CopyDid'; import { setToLocalStorage } from '../../api/Auth'; import { Tooltip } from 'flowbite-react'; import DIDList from './configuration-settings/DidList'; - -const OrganizationDetails = ({ orgData }: { orgData: Organisation | null }) => { +// FIXME: undefined type +const OrganizationDetails = ({ orgData }: { orgData: Organisation | undefined }) => { const { org_agents } = orgData as Organisation; const agentData: OrgAgent | null = org_agents.length > 0 ? org_agents[0] : null; const [loading, setLoading] = useState(true); - const [connectionData, setConnectionData] = useState(null); + const [connectionData, setConnectionData] = useState(); const createQrConnection = async () => { setLoading(true); diff --git a/src/components/organization/OrganizationsList.tsx b/src/components/organization/OrganizationsList.tsx index 83e78a21f..d28b04562 100644 --- a/src/components/organization/OrganizationsList.tsx +++ b/src/components/organization/OrganizationsList.tsx @@ -32,8 +32,8 @@ const initialPageState = { const OrganizationsList = () => { const [openModal, setOpenModal] = useState(false); const [loading, setLoading] = useState(true); - const [message, setMessage] = useState(''); - const [error, setError] = useState(''); + const [message, setMessage] = useState(''); + const [error, setError] = useState(''); const [currentPage, setCurrentPage] = useState(initialPageState); const onPageChange = (page: number) => { setCurrentPage({ @@ -43,8 +43,7 @@ const OrganizationsList = () => { }; const [searchText, setSearchText] = useState(''); - const [organizationsList, setOrganizationsList] = - useState | null>([]); + const [organizationsList, setOrganizationsList] =useState([]); const props = { openModal, setOpenModal }; diff --git a/src/components/organization/PublicOrganizationDetails.tsx b/src/components/organization/PublicOrganizationDetails.tsx index fee18ba7c..59b0b352c 100644 --- a/src/components/organization/PublicOrganizationDetails.tsx +++ b/src/components/organization/PublicOrganizationDetails.tsx @@ -12,9 +12,9 @@ import { Card } from "flowbite-react"; const PublicOrganizationDetails = ({ orgSlug }: { orgSlug: string }) => { - const [orgData, setOrgData] = useState(null); + const [orgData, setOrgData] = useState(); const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const getOrganizationData = async () => { setLoading(true); diff --git a/src/components/organization/configuration-settings/CreateDid.tsx b/src/components/organization/configuration-settings/CreateDid.tsx index 7456a30ac..6820a257d 100644 --- a/src/components/organization/configuration-settings/CreateDid.tsx +++ b/src/components/organization/configuration-settings/CreateDid.tsx @@ -27,17 +27,17 @@ interface IPolygonKeys { const CreateDIDModal = (props: EditOrgdetailsModalProps) => { const [loading, setLoading] = useState(false); const [isLoading, setIsLoading] = useState(false); - const [errMsg, setErrMsg] = useState(''); - const [successMsg, setSuccessMsg] = useState(''); + const [errMsg, setErrMsg] = useState(''); + const [successMsg, setSuccessMsg] = useState(''); const [seed, setSeed] = useState(''); const [generatedKeys, setGeneratedKeys] = useState(null); - const [ledgerValue, setLedgerValue] = useState(null); - const [method, setMethod] = useState(null); - const [networkValue, setNetworkValue] = useState(null); - const [completeDidMethodValue, setCompleteDidMethodValue] = useState(null); + const [ledgerValue, setLedgerValue] = useState(''); + const [method, setMethod] = useState(''); + const [networkValue, setNetworkValue] = useState(''); + const [completeDidMethodValue, setCompleteDidMethodValue] = useState(''); const [havePrivateKey, setHavePrivateKey] = useState(false); const [privateKeyValue, setPrivateKeyValue] = useState(''); - const [walletErrorMessage, setWalletErrorMessage] = useState(null); + const [walletErrorMessage, setWalletErrorMessage] = useState(''); const formikRef = useRef>(null); @@ -115,7 +115,7 @@ const CreateDIDModal = (props: EditOrgdetailsModalProps) => { if (parseFloat(etherBalance) < CommonConstants.BALANCELIMIT) { setWalletErrorMessage('You have insufficient funds.'); } else { - setWalletErrorMessage(null); + setWalletErrorMessage(''); } @@ -130,7 +130,7 @@ const CreateDIDModal = (props: EditOrgdetailsModalProps) => { if (privateKeyValue && privateKeyValue.length === 64) { checkBalance(privateKeyValue, Network.TESTNET); } else { - setWalletErrorMessage(null); + setWalletErrorMessage(''); } }, [privateKeyValue]); @@ -205,11 +205,11 @@ const CreateDIDModal = (props: EditOrgdetailsModalProps) => { useEffect(() => { if (havePrivateKey) { setPrivateKeyValue(''); - setWalletErrorMessage(null); + setWalletErrorMessage(''); setGeneratedKeys(null); } else { setPrivateKeyValue(''); - setWalletErrorMessage(null); + setWalletErrorMessage(''); } }, [havePrivateKey]); @@ -470,7 +470,7 @@ const CreateDIDModal = (props: EditOrgdetailsModalProps) => { value={formikHandlers.values.privatekey} onChange={(e) => { formikHandlers.setFieldValue('privatekey', e.target.value); - setWalletErrorMessage(null); + setWalletErrorMessage(''); checkBalance(e.target.value, Network.TESTNET); }} placeholder="Enter private key" /> diff --git a/src/components/organization/configuration-settings/DidList.tsx b/src/components/organization/configuration-settings/DidList.tsx index fccd06166..a48f3558b 100644 --- a/src/components/organization/configuration-settings/DidList.tsx +++ b/src/components/organization/configuration-settings/DidList.tsx @@ -12,9 +12,9 @@ import { Roles } from "../../../utils/enums/roles" const DIDList = () => { const [didList, setDidList] = useState([]); - const [showPopup, setShowPopup] = useState(false); - const [erroMsg, setErrMsg] = useState(''); - const [successMsg, setSuccessMsg] = useState(''); + const [showPopup, setShowPopup] = useState(false); + const [erroMsg, setErrMsg] = useState(''); + const [successMsg, setSuccessMsg] = useState(''); const [userRoles, setUserRoles] = useState([]); const setPrimaryDid = async (id: string, did: string) => { try { diff --git a/src/components/organization/interfaces/index.ts b/src/components/organization/interfaces/index.ts index e0b7b526c..c05137d7d 100644 --- a/src/components/organization/interfaces/index.ts +++ b/src/components/organization/interfaces/index.ts @@ -174,12 +174,13 @@ export interface ILogoImage { imagePreviewUrl: string | ArrayBuffer | null | File; fileName: string; } +// FIXME: export interface EditOrgdetailsModalProps { openModal: boolean; setMessage: (message: string) => void; setOpenModal: (flag: boolean) => void; onEditSucess?: () => void; - orgData: Organisation | null; + orgData: Organisation | undefined; } export interface IOrgInfo { name: string; diff --git a/src/components/organization/invitations/Invitations.tsx b/src/components/organization/invitations/Invitations.tsx index a9f2e470a..2e5cadf47 100644 --- a/src/components/organization/invitations/Invitations.tsx +++ b/src/components/organization/invitations/Invitations.tsx @@ -36,9 +36,9 @@ const Invitations = () => { const [loading, setLoading] = useState(false) const [deleteLoading, setDeleteLoading] = useState(false) const [selectedInvitation, setSelectedInvitation] = useState('') - const [message, setMessage] = useState('') + const [message, setMessage] = useState('') const [showPopup, setShowPopup] = useState(false) - const [error, setError] = useState('') + const [error, setError] = useState('') const [roles, setRoles] = useState([]); const [currentPage, setCurrentPage] = useState(initialPageState); @@ -49,7 +49,7 @@ const Invitations = () => { }) }; const [searchText, setSearchText] = useState(""); - const [invitationsList, setInvitationsList] = useState | null>(null) + const [invitationsList, setInvitationsList] = useState([]) const props = { openModal, setOpenModal }; const getAllInvitations = async () => { diff --git a/src/components/organization/invitations/ReceivedInvitations.tsx b/src/components/organization/invitations/ReceivedInvitations.tsx index fc098cd41..f14fef2f0 100644 --- a/src/components/organization/invitations/ReceivedInvitations.tsx +++ b/src/components/organization/invitations/ReceivedInvitations.tsx @@ -19,6 +19,7 @@ import { pathRoutes } from '../../../config/pathRoutes'; import { EmptyListMessage } from '../../EmptyListComponent'; import CustomSpinner from '../../CustomSpinner'; import CustomAvatar from '../../Avatar'; +import React from 'react'; const initialPageState = { pageNumber: 1, @@ -29,8 +30,8 @@ const initialPageState = { const ReceivedInvitations = () => { const [openModal, setOpenModal] = useState(false); const [loading, setLoading] = useState(false); - const [message, setMessage] = useState(''); - const [error, setError] = useState(''); + const [message, setMessage] = useState(''); + const [error, setError] = useState(''); const [currentPage, setCurrentPage] = useState(initialPageState); const timestamp = Date.now(); @@ -44,7 +45,7 @@ const ReceivedInvitations = () => { const [searchText, setSearchText] = useState(''); const [invitationsList, setInvitationsList] = - useState | null>(null); + useState([]); const props = { openModal, setOpenModal }; //Fetch the user organization list diff --git a/src/components/organization/invitations/SendInvitationModal.tsx b/src/components/organization/invitations/SendInvitationModal.tsx index d0de32c26..4004c0dc0 100644 --- a/src/components/organization/invitations/SendInvitationModal.tsx +++ b/src/components/organization/invitations/SendInvitationModal.tsx @@ -14,6 +14,7 @@ import { } from '../../../api/invitations'; import { getOrganizationRoles } from '../../../api/organization'; import { getFromLocalStorage } from '../../../api/Auth'; +import React from 'react'; interface Values { @@ -46,7 +47,7 @@ const SendInvitationModal = (props: { const [invitations, setInvitations] = useState([]); - const [memberRole, setMemberRole] = useState(null); + const [memberRole, setMemberRole] = useState(); const [initialData, setInitialData] = useState({ email: '', @@ -54,7 +55,7 @@ const SendInvitationModal = (props: { const [initialInvitationData, setInitialInvitationData] = useState({ email: '', }); - const [erroMsg, setErrMsg] = useState(''); + const [erroMsg, setErrMsg] = useState(''); const getRoles = async () => { const resRoles = await getOrganizationRoles(); diff --git a/src/components/organization/users/EditUserRolesModal.tsx b/src/components/organization/users/EditUserRolesModal.tsx index 6158b4783..25f6c4b6e 100644 --- a/src/components/organization/users/EditUserRolesModal.tsx +++ b/src/components/organization/users/EditUserRolesModal.tsx @@ -6,6 +6,7 @@ import type { AxiosResponse } from 'axios'; import { TextTittlecase } from '../../../utils/TextTransform'; import type { User } from "../interfaces/users"; import { apiStatusCodes } from "../../../config/CommonConstant"; +import React from 'react'; interface RoleI { id: string @@ -19,9 +20,9 @@ const EditUserRoleModal = (props: { openModal: boolean; user: User; setMessage: const [loading, setLoading] = useState(false) - const [roles, setRoles] = useState(null) + const [roles, setRoles] = useState([]) - const [erroMsg, setErrMsg] = useState(null) + const [erroMsg, setErrMsg] = useState('') const getRoles = async () => { diff --git a/src/components/organization/users/Members.tsx b/src/components/organization/users/Members.tsx index 476a5e79b..220cf7042 100644 --- a/src/components/organization/users/Members.tsx +++ b/src/components/organization/users/Members.tsx @@ -14,6 +14,7 @@ import type { User } from '../interfaces/users'; import { getFromLocalStorage } from '../../../api/Auth'; import { getOrganizationUsers } from '../../../api/organization'; import { EmptyListMessage } from '../../EmptyListComponent'; +import React from 'react'; const initialPageState = { pageNumber: 1, @@ -24,8 +25,8 @@ const initialPageState = { const Members = () => { const [openModal, setOpenModal] = useState(false); const [loading, setLoading] = useState(true); - const [message, setMessage] = useState(''); - const [error, setError] = useState(''); + const [message, setMessage] = useState(''); + const [error, setError] = useState(''); const [userRoles, setUserRoles] = useState([]); const [currentPage, setCurrentPage] = useState(initialPageState); @@ -37,8 +38,8 @@ const Members = () => { }; const [searchText, setSearchText] = useState(''); - const [usersList, setUsersList] = useState | null>(null); - const [selectedUser, setSelectedUser] = useState(null); + const [usersList, setUsersList] = useState([]); + const [selectedUser, setSelectedUser] = useState(); const props = { openModal, setOpenModal }; const getAllUsers = async () => { diff --git a/src/components/organization/walletCommonComponents/SetPrivateKeyValue.tsx b/src/components/organization/walletCommonComponents/SetPrivateKeyValue.tsx index 84dfa0b2e..92d2a2365 100644 --- a/src/components/organization/walletCommonComponents/SetPrivateKeyValue.tsx +++ b/src/components/organization/walletCommonComponents/SetPrivateKeyValue.tsx @@ -34,7 +34,7 @@ const SetPrivateKeyValueInput = ({ }: IProps) => { const [havePrivateKey, setHavePrivateKey] = useState(false); const [generatedKeys, setGeneratedKeys] = useState(null); - const [errorMessage, setErrorMessage] = useState(null); + const [errorMessage, setErrorMessage] = useState(''); const [loading, setLoading] = useState(false); const checkWalletBalance = async (privateKey: string, network: Network) => { @@ -57,7 +57,7 @@ const SetPrivateKeyValueInput = ({ if (parseFloat(etherBalance) < CommonConstants.BALANCELIMIT) { setErrorMessage('You have insufficient funds.'); } else { - setErrorMessage(null); + setErrorMessage(''); } return etherBalance; @@ -71,7 +71,7 @@ const SetPrivateKeyValueInput = ({ if (privateKeyValue && privateKeyValue.length === 64) { checkWalletBalance(privateKeyValue, Network.TESTNET); } else { - setErrorMessage(null); + setErrorMessage(''); } }, [privateKeyValue]); @@ -79,11 +79,11 @@ const SetPrivateKeyValueInput = ({ useEffect(() => { if (havePrivateKey) { setPrivateKeyValue(''); - setErrorMessage(null); + setErrorMessage(''); setGeneratedKeys(null); } else { setPrivateKeyValue(''); - setErrorMessage(null); + setErrorMessage(''); } }, [havePrivateKey]); diff --git a/src/components/organization/walletCommonComponents/WalletSpinup.tsx b/src/components/organization/walletCommonComponents/WalletSpinup.tsx index 37340744e..7eb75b022 100644 --- a/src/components/organization/walletCommonComponents/WalletSpinup.tsx +++ b/src/components/organization/walletCommonComponents/WalletSpinup.tsx @@ -41,12 +41,12 @@ const WalletSpinup = (props: { const [agentType, setAgentType] = useState(AgentType.SHARED); const [loading, setLoading] = useState(false); const [walletSpinStep, setWalletSpinStep] = useState(0); - const [success, setSuccess] = useState(''); + const [success, setSuccess] = useState(''); const [agentSpinupCall, setAgentSpinupCall] = useState(false); - const [failure, setFailure] = useState(''); + const [failure, setFailure] = useState(''); const [seeds, setSeeds] = useState(''); const [maskedSeeds, setMaskedSeeds] = useState(''); - const [orgData, setOrgData] = useState(null); + const [orgData, setOrgData] = useState(); const [isShared, setIsShared] = useState(false); const [isConfiguredDedicated, setIsConfiguredDedicated] = useState(false); diff --git a/src/components/publicProfile/OrgWalletDetails.tsx b/src/components/publicProfile/OrgWalletDetails.tsx index 60d2c248b..3ef7b408b 100644 --- a/src/components/publicProfile/OrgWalletDetails.tsx +++ b/src/components/publicProfile/OrgWalletDetails.tsx @@ -8,7 +8,7 @@ import CopyDid from "../../commonComponents/CopyDid"; const OrgWalletDetails = ({ orgData }: IExploreOrg) => { - const [connectionInvitation, setConnectionInvitation] = useState(null); + const [connectionInvitation, setConnectionInvitation] = useState(''); useEffect(() => { if (orgData && orgData?.org_agents?.length > 0) { diff --git a/src/components/publicProfile/OrganisationPublicProfile.tsx b/src/components/publicProfile/OrganisationPublicProfile.tsx index c67125526..90509d9cf 100644 --- a/src/components/publicProfile/OrganisationPublicProfile.tsx +++ b/src/components/publicProfile/OrganisationPublicProfile.tsx @@ -10,6 +10,7 @@ import CustomSpinner from '../CustomSpinner'; import CustomAvatar from '../Avatar'; import { EmptyListMessage } from '../EmptyListComponent'; import { AlertComponent } from '../AlertComponent'; +import React from 'react'; const OrganisationPublicProfile = () => { const initialPageState = { @@ -21,7 +22,7 @@ const OrganisationPublicProfile = () => { const [organizationList, setOrganizationList] = useState([]); const [loading, setLoading] = useState(true); - const [error, setError] = useState(''); + const [error, setError] = useState(''); const [searchText, setSearchText] = useState(''); const [currentPage, setCurrentPage] = useState(initialPageState); const onPageChange = (page: number) => {