diff --git a/src/commonComponents/CustomCheckbox.tsx b/src/commonComponents/CustomCheckbox.tsx index 09a94ac03..e1d228608 100644 --- a/src/commonComponents/CustomCheckbox.tsx +++ b/src/commonComponents/CustomCheckbox.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { setToLocalStorage } from '../api/Auth'; +import { getFromLocalStorage, setToLocalStorage } from '../api/Auth'; import { storageKeys } from '../config/CommonConstant'; import type { ICustomCheckboxProps, ISchemaData } from './interface'; @@ -7,15 +7,21 @@ const CustomCheckbox: React.FC = ({ showCheckbox, isVerifi const [checked, setChecked] = useState(false); useEffect(() => { - if (schemaData) { - try { - const selectedSchemas = JSON.parse(localStorage.getItem('selectedSchemas') ?? '[]'); - const isChecked = selectedSchemas.some((schema: ISchemaData) => schema.schemaId === schemaData.schemaId); - setChecked(isChecked); - } catch (error) { - console.error('Error parsing JSON from localStorage:', error); + const fetchSelectedSchemas = async () => { + if (schemaData) { + try { + const storedSchemaData = await getFromLocalStorage(storageKeys.SELECTED_SCHEMAS); + if(storedSchemaData){ + const selectedSchemas= JSON.parse(storedSchemaData); + const isChecked = selectedSchemas.some((schema: ISchemaData) => schema.schemaId === schemaData.schemaId); + setChecked(isChecked); + } + } catch (error) { + console.error('Error parsing JSON from localStorage:', error); + } } - } + }; + fetchSelectedSchemas(); }, [schemaData]); const handleCheckboxChange = async () => { @@ -24,17 +30,22 @@ const CustomCheckbox: React.FC = ({ showCheckbox, isVerifi onChange(newChecked, schemaData); try { - const selectedSchemas = JSON.parse(localStorage.getItem('selectedSchemas') ?? '[]'); - - if (newChecked) { - selectedSchemas.push(schemaData); - } else { - const index = selectedSchemas.findIndex((schema: ISchemaData) => schema.schemaId === schemaData?.schemaId); - if (index > -1) { - selectedSchemas.splice(index, 1); + const storedSchemaData = await getFromLocalStorage(storageKeys.SELECTED_SCHEMAS); + if(storedSchemaData){ + const selectedSchemas = JSON.parse(storedSchemaData); + if (newChecked) { + selectedSchemas.push(schemaData); + } else { + const index = selectedSchemas.findIndex((schema: ISchemaData) => schema.schemaId === schemaData?.schemaId); + if (index > -1) { + selectedSchemas.splice(index, 1); + } } + await setToLocalStorage(storageKeys.SELECTED_SCHEMAS, JSON.stringify(selectedSchemas)); + } else { + throw new Error('Schema data is empty.'); + } - await setToLocalStorage(storageKeys.SELECTED_SCHEMAS, JSON.stringify(selectedSchemas)); } catch (error) { console.error('Error updating localStorage:', error); } diff --git a/src/commonComponents/SchemaCard.tsx b/src/commonComponents/SchemaCard.tsx index 92a420024..fcea3a8b5 100644 --- a/src/commonComponents/SchemaCard.tsx +++ b/src/commonComponents/SchemaCard.tsx @@ -11,6 +11,7 @@ import { limitedAttributesLength, storageKeys } from '../config/CommonConstant'; import type { IAttribute, ISchemaCardProps, ISchemaData } from './interface'; import CustomCheckbox from './CustomCheckbox'; import { Ledgers, Network, PolygonNetworks } from '../common/enums'; +import React from 'react'; const SchemaCard = (props: ISchemaCardProps) => { const orgDidDetails = async () => { @@ -65,16 +66,14 @@ const handleCheckboxChange = (checked: boolean, schemaData?: ISchemaData) => { } }; +const SchemaData = { + schemaId: props.schemaId, + attributes: props.attributes, + issuerDid: props.issuerDid, + created: props.created, +}; - return ( - { - - if (!props.w3cSchema) { - props.onClickCallback(props.schemaId, props.attributes, props.issuerDid, props.created) - } - - if (props.w3cSchema) { - const W3CSchemaData = { + const W3CSchemaData = { schemaId: props.schemaId, schemaName: props.schemaName, version: props.version, @@ -83,6 +82,12 @@ const handleCheckboxChange = (checked: boolean, schemaData?: ISchemaData) => { created: props.created, }; + return ( + { + if (!props.w3cSchema && props.onClickCallback) { + props.onClickCallback(SchemaData); + } + if (props.w3cSchema && props.onClickW3CCallback) { props.onClickW3CCallback(W3CSchemaData); } }} diff --git a/src/commonComponents/datatable/index.tsx b/src/commonComponents/datatable/index.tsx index 3726e40eb..a1548d900 100644 --- a/src/commonComponents/datatable/index.tsx +++ b/src/commonComponents/datatable/index.tsx @@ -1,9 +1,9 @@ -import type { TableData, TableHeader } from './interface'; +import type { ITableData, TableHeader } from './interface'; import CustomSpinner from '../../components/CustomSpinner'; interface DataTableProps { header: TableHeader[]; - data: TableData[]; + data: ITableData[]; loading: boolean; callback?: (clickId: string | null | undefined) => void; displaySelect?: boolean; diff --git a/src/commonComponents/interface.ts b/src/commonComponents/interface.ts index 272af59f9..ebcc55aa1 100644 --- a/src/commonComponents/interface.ts +++ b/src/commonComponents/interface.ts @@ -40,7 +40,11 @@ export interface ISchemaCardProps { created: string; isClickable?: boolean; showCheckbox?: boolean; - onClickCallback: (schemaId: string, attributes: string[], issuerDid: string, created: string) => void; + onClickCallback: (SchemaData:{ + schemaId: string; + attributes: string[]; + issuerDid: string; + created: string}) => void; onClickW3CCallback: (W3CSchemaData: { schemaId: string; diff --git a/src/components/AddOrganizationInEcosystem.tsx b/src/components/AddOrganizationInEcosystem.tsx deleted file mode 100644 index ebfb9b1f1..000000000 --- a/src/components/AddOrganizationInEcosystem.tsx +++ /dev/null @@ -1,434 +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'; - - -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/ConnectionsList/index.tsx b/src/components/ConnectionsList/index.tsx index eadaaf2c3..dc6505e5d 100644 --- a/src/components/ConnectionsList/index.tsx +++ b/src/components/ConnectionsList/index.tsx @@ -6,7 +6,7 @@ import { getConnectionsByOrg, } from '../../api/connection'; import type { IConnectionListAPIParameter } from '../../api/connection'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; import { AlertComponent } from '../AlertComponent'; import { dateConversion } from '../../utils/DateConversion'; @@ -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, @@ -27,7 +28,7 @@ const initialPageState = { }; const ConnectionList = () => { const [listAPIParameter, setListAPIParameter] = useState(initialPageState); - const [connectionList, setConnectionList] = useState([]); + const [connectionList, setConnectionList] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [totalItem, setTotalItem] = useState(0); diff --git a/src/components/Issuance/ConnectionList.tsx b/src/components/Issuance/ConnectionList.tsx index a0d60ee9c..dbb5d05b2 100644 --- a/src/components/Issuance/ConnectionList.tsx +++ b/src/components/Issuance/ConnectionList.tsx @@ -5,7 +5,7 @@ import type { ChangeEvent } from 'react'; import {getConnectionsByOrg, } from '../../api/connection'; import type {IConnectionListAPIParameter} from '../../api/connection' -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; import { AlertComponent } from '../AlertComponent'; import { dateConversion } from '../../utils/DateConversion'; @@ -37,7 +37,7 @@ const ConnectionList = (props: { selectConnection: (connections: IConnectionList[]) => void; }) => { const [listAPIParameter, setListAPIParameter] = useState(initialPageState); - const [tableData, setTableData] = useState([]); + const [tableData, setTableData] = useState([]); const [connectionList, setConnectionList] = useState([]); const [localOrgs, setLocalOrgs] = useState([]); diff --git a/src/components/Issuance/Connections.tsx b/src/components/Issuance/Connections.tsx index 107e4daba..722e7abc1 100644 --- a/src/components/Issuance/Connections.tsx +++ b/src/components/Issuance/Connections.tsx @@ -3,7 +3,7 @@ import { Button } from 'flowbite-react'; import { useEffect, useState } from 'react'; import { getFromLocalStorage, setToLocalStorage } from '../../api/Auth'; import DataTable from '../../commonComponents/datatable'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { storageKeys } from '../../config/CommonConstant'; import { pathRoutes } from '../../config/pathRoutes'; import BreadCrumbs from '../BreadCrumbs'; @@ -17,7 +17,7 @@ import { DidMethod } from '../../common/enums'; const Connections = () => { const [selectedConnections, setSelectedConnections] = useState< - TableData[] + ITableData[] >([]); const selectedConnectionHeader = [ diff --git a/src/components/Issuance/CredDefSelection.tsx b/src/components/Issuance/CredDefSelection.tsx index 9b531130c..2a2137482 100644 --- a/src/components/Issuance/CredDefSelection.tsx +++ b/src/components/Issuance/CredDefSelection.tsx @@ -11,7 +11,7 @@ import { Button } from 'flowbite-react'; import CustomSpinner from '../CustomSpinner'; import DataTable from '../../commonComponents/datatable'; import SchemaCard from '../../commonComponents/SchemaCard'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { dateConversion } from '../../utils/DateConversion'; import { getCredentialDefinitions } from '../../api/issuance'; import { pathRoutes } from '../../config/pathRoutes'; @@ -26,7 +26,7 @@ const CredDefSelection = () => { const [loading, setLoading] = useState(true); const [schemaLoader, setSchemaLoader] = useState(true); const [error, setError] = useState(null); - const [credDefList, setCredDefList] = useState([]); + const [credDefList, setCredDefList] = useState([]); const [schemaDetailsState, setSchemaDetailsState] = useState({ schemaId: '', issuerDid: '', diff --git a/src/components/Issuance/History.tsx b/src/components/Issuance/History.tsx index 8dff2b4e3..82557c3c0 100644 --- a/src/components/Issuance/History.tsx +++ b/src/components/Issuance/History.tsx @@ -2,7 +2,7 @@ import 'react-toastify/dist/ReactToastify.css'; import type { AxiosResponse } from 'axios'; import { useEffect, useState } from 'react'; import type { ChangeEvent } from 'react'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { apiStatusCodes } from '../../config/CommonConstant'; import { AlertComponent } from '../AlertComponent'; import { dateConversion } from '../../utils/DateConversion'; @@ -30,7 +30,7 @@ const HistoryBulkIssuance = () => { sortingOrder: 'desc', }; const [listAPIParameter, setListAPIParameter] = useState(initialPageState); - const [connectionList, setConnectionList] = useState([]); + const [connectionList, setConnectionList] = useState([]); const [loading, setLoading] = useState(true); const [failure, setFailure] = useState(null); const [success, setSuccess] = useState(null); diff --git a/src/components/Issuance/HistoryDetails.tsx b/src/components/Issuance/HistoryDetails.tsx index 08409f0b3..6e7cbba64 100644 --- a/src/components/Issuance/HistoryDetails.tsx +++ b/src/components/Issuance/HistoryDetails.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react'; import type { ChangeEvent } from 'react'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { apiStatusCodes } from '../../config/CommonConstant'; import { AlertComponent } from '../AlertComponent'; import BreadCrumbs from '../BreadCrumbs'; @@ -27,7 +27,7 @@ const HistoryDetails = ({ requestId }: IProps) => { }; const [listAPIParameter, setListAPIParameter] = useState(initialPageState); - const [historyList, setHistoryList] = useState([]); + const [historyList, setHistoryList] = useState([]); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [totalItem, setTotalItem] = useState(0); diff --git a/src/components/Issuance/IssuedCrdentials.tsx b/src/components/Issuance/IssuedCrdentials.tsx index b10b846d6..cf2fde20e 100644 --- a/src/components/Issuance/IssuedCrdentials.tsx +++ b/src/components/Issuance/IssuedCrdentials.tsx @@ -9,7 +9,7 @@ import BreadCrumbs from '../BreadCrumbs'; import { Button, Pagination } from 'flowbite-react'; import DateTooltip from '../Tooltip'; import { EmptyListMessage } from '../EmptyListComponent'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; import { dateConversion } from '../../utils/DateConversion'; import { getIssuedCredentials } from '../../api/issuance'; @@ -35,7 +35,7 @@ const initialPageState = { const CredentialList = () => { const [loading, setLoading] = useState(true); const [error, setError] = useState(null); - const [issuedCredList, setIssuedCredList] = useState([]); + const [issuedCredList, setIssuedCredList] = useState([]); const [walletCreated, setWalletCreated] = useState(false); const [listAPIParameter, setListAPIParameter] = useState(initialPageState); diff --git a/src/components/Resources/Schema/SchemasList.tsx b/src/components/Resources/Schema/SchemasList.tsx index e7edeb7a1..0e8f33a95 100644 --- a/src/components/Resources/Schema/SchemasList.tsx +++ b/src/components/Resources/Schema/SchemasList.tsx @@ -145,14 +145,20 @@ const SchemaList = (props: { }; const schemaSelectionCallback = ( - schemaId: string, - attributes: string[], - issuerId: string, - created: string, - ) => { + { + schemaId, + attributes, + issuerDid, + created, + }: { + schemaId: string; + attributes: string[]; + issuerDid: string; + created: string; + }) => { const schemaDetails = { attribute: attributes, - issuerDid: issuerId, + issuerDid, createdDate: created, }; props.schemaSelectionCallback(schemaId, schemaDetails); diff --git a/src/components/Verification/Connections.tsx b/src/components/Verification/Connections.tsx index 67afe93f7..1c9a7a65f 100644 --- a/src/components/Verification/Connections.tsx +++ b/src/components/Verification/Connections.tsx @@ -3,7 +3,7 @@ import { Alert, Button } from "flowbite-react"; import { useEffect, useState } from "react"; import { getFromLocalStorage, removeFromLocalStorage, setToLocalStorage } from "../../api/Auth"; import DataTable from "../../commonComponents/datatable"; -import type { TableData } from "../../commonComponents/datatable/interface"; +import type { ITableData } from "../../commonComponents/datatable/interface"; import { apiStatusCodes, storageKeys } from "../../config/CommonConstant"; import { pathRoutes } from "../../config/pathRoutes"; import BreadCrumbs from "../BreadCrumbs"; @@ -22,7 +22,7 @@ import { getOrganizationById } from "../../api/organization"; const Connections = () => { const [isW3cDid, setIsW3cDid] = useState(false); - const [selectedConnectionList, setSelectedConnectionList] = useState([]) + const [selectedConnectionList, setSelectedConnectionList] = useState([]) const [proofReqSuccess, setProofReqSuccess] = useState(null); const [errMsg, setErrMsg] = useState(null); const [requestLoader, setRequestLoader] = useState(false); diff --git a/src/components/Verification/CredDefSelection.tsx b/src/components/Verification/CredDefSelection.tsx index 9fca2c9b3..c9b8960b8 100644 --- a/src/components/Verification/CredDefSelection.tsx +++ b/src/components/Verification/CredDefSelection.tsx @@ -9,18 +9,19 @@ import { pathRoutes } from "../../config/pathRoutes"; import BreadCrumbs from "../BreadCrumbs"; import { AlertComponent } from "../AlertComponent"; import type { SchemaState, CredDefData } from "./interface"; -import type { TableData } from "../../commonComponents/datatable/interface"; +import type { ITableData } from "../../commonComponents/datatable/interface"; import DataTable from "../../commonComponents/datatable"; import { getCredentialDefinitionsForVerification } from "../../api/verification"; import CustomSpinner from "../CustomSpinner"; import BackButton from '../../commonComponents/backbutton' +import React from "react"; const CredDefSelection = () => { const [schemaState, setSchemaState] = useState({ schemaName: '', version: '' }) const [loading, setLoading] = useState(true) const [schemaLoader, setSchemaLoader] = useState(true) const [error, setError] = useState(null) - const [credDefList, setCredDefList] = useState([]) + const [credDefList, setCredDefList] = useState([]) const [schemaDetailsState, setSchemaDetailsState] = useState({ schemaId: '', issuerDid: '', attributes: [], createdDateTime: '' }) useEffect(() => { diff --git a/src/components/Verification/EmailAttributesSelection.tsx b/src/components/Verification/EmailAttributesSelection.tsx index 044d1a8be..f88eb9063 100644 --- a/src/components/Verification/EmailAttributesSelection.tsx +++ b/src/components/Verification/EmailAttributesSelection.tsx @@ -5,7 +5,7 @@ import { getFromLocalStorage, setToLocalStorage } from '../../api/Auth'; import { apiStatusCodes, predicatesConditions, storageKeys } from '../../config/CommonConstant'; import BreadCrumbs from '../BreadCrumbs'; import DataTable from '../../commonComponents/datatable'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { pathRoutes } from '../../config/pathRoutes'; import BackButton from '../../commonComponents/backbutton'; import type { @@ -18,7 +18,7 @@ import { DidMethod } from '../../common/enums'; import React from 'react'; const EmailAttributesSelection = () => { - const [attributeList, setAttributeList] = useState([]); + const [attributeList, setAttributeList] = useState([]); const [proofReqSuccess, setProofReqSuccess] = useState(null); const [errMsg, setErrMsg] = useState(null); const [display, setDisplay] = useState(false); diff --git a/src/components/Verification/EmailCredDefSelection.tsx b/src/components/Verification/EmailCredDefSelection.tsx index 9652e06fe..af8ed56c1 100644 --- a/src/components/Verification/EmailCredDefSelection.tsx +++ b/src/components/Verification/EmailCredDefSelection.tsx @@ -6,7 +6,7 @@ import { pathRoutes } from "../../config/pathRoutes"; import BreadCrumbs from "../BreadCrumbs"; import { AlertComponent } from "../AlertComponent"; import type { CredDefData } from "./interface"; -import type { TableData } from "../../commonComponents/datatable/interface"; +import type { ITableData } from "../../commonComponents/datatable/interface"; import DataTable from "../../commonComponents/datatable"; import { getCredentialDefinitionsForVerification } from "../../api/verification"; import BackButton from '../../commonComponents/backbutton'; @@ -18,7 +18,7 @@ import CustomCheckbox from "../../commonComponents/CustomCheckbox"; const EmailCredDefSelection = () => { const [loading, setLoading] = useState(true); const [error, setError] = useState(null); - const [credDefList, setCredDefList] = useState([]); + const [credDefList, setCredDefList] = useState([]); const [searchValue, setSearchValue] = useState(''); const [selectedCredDefs, setSelectedCredDefs] = useState([]); @@ -51,7 +51,7 @@ const EmailCredDefSelection = () => { const getCredDefs = async (schemaIds: string[]) => { setLoading(true); const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - let allCredDefs: TableData[] = []; + let allCredDefs: ITableData[] = []; let rawCredDefs: CredDefData[] = []; for (const schemaId of schemaIds) { diff --git a/src/components/Verification/Verification.tsx b/src/components/Verification/Verification.tsx index 0c4c420d7..bf5be947c 100644 --- a/src/components/Verification/Verification.tsx +++ b/src/components/Verification/Verification.tsx @@ -6,7 +6,7 @@ import { getFromLocalStorage } from '../../api/Auth'; import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; import BreadCrumbs from '../BreadCrumbs'; import DataTable from '../../commonComponents/datatable'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { verifyCredential } from '../../api/verification'; import { pathRoutes } from '../../config/pathRoutes'; import CustomSpinner from '../CustomSpinner'; @@ -25,7 +25,7 @@ import { getOrganizationById } from '../../api/organization'; import { DidMethod, RequestType } from '../../common/enums'; const VerificationCred = () => { - const [attributeList, setAttributeList] = useState([]); + const [attributeList, setAttributeList] = useState([]); const [proofReqSuccess, setProofReqSuccess] = useState(null); const [errMsg, setErrMsg] = useState(null); const [display, setDisplay] = useState(false); diff --git a/src/components/Verification/VerificationCredentialList.tsx b/src/components/Verification/VerificationCredentialList.tsx index 145d79c4c..53eb93276 100644 --- a/src/components/Verification/VerificationCredentialList.tsx +++ b/src/components/Verification/VerificationCredentialList.tsx @@ -21,7 +21,7 @@ import { Features } from '../../utils/enums/features'; import ProofRequest from './ProofRequestPopup'; import type { RequestProof } from './interface'; import RoleViewButton from '../RoleViewButton'; -import type { TableData } from '../../commonComponents/datatable/interface'; +import type { ITableData } from '../../commonComponents/datatable/interface'; import { dateConversion } from '../../utils/DateConversion'; import { pathRoutes } from '../../config/pathRoutes'; import { getFromLocalStorage } from '../../api/Auth'; @@ -40,7 +40,7 @@ const initialPageState = { const VerificationCredentialList = () => { const [loading, setLoading] = useState(true); - const [verificationList, setVerificationList] = useState([]); + const [verificationList, setVerificationList] = useState([]); const [openModal, setOpenModal] = useState(false); const [requestId, setRequestId] = useState(''); const [errMsg, setErrMsg] = useState(null);