-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: tipusinghaw <tipu.singh@ayanworks.com>
- Loading branch information
Showing
40 changed files
with
1,280 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { apiRoutes } from '../config/apiRoutes'; | ||
import { storageKeys } from '../config/CommonConstant'; | ||
import { getHeaderConfigs } from '../config/GetHeaderConfigs'; | ||
import { axiosGet } from '../services/apiRequests'; | ||
import { getFromLocalStorage } from './Auth'; | ||
|
||
export const getConnectionsByOrg = async () => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.Issuance.getAllConnections}?orgId=${orgId}`; | ||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type { IssueCredential } from '../common/enums'; | ||
import { apiRoutes } from '../config/apiRoutes'; | ||
import { storageKeys } from '../config/CommonConstant'; | ||
import { getHeaderConfigs } from '../config/GetHeaderConfigs'; | ||
import { axiosGet, axiosPost } from '../services/apiRequests'; | ||
import { getFromLocalStorage } from './Auth'; | ||
|
||
export const getIssuedCredentials = async (state: IssueCredential) => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.Issuance.getIssuedCredentials}?orgId=${orgId}&state=${state}`; | ||
|
||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
export const getCredentialDefinitions = async (schemaId: string) => { | ||
const orgId = await getFromLocalStorage(storageKeys.ORG_ID); | ||
const url = `${apiRoutes.Issuance.getCredDefBySchemaId}?schemaId=${schemaId}&orgId=${orgId}`; | ||
const axiosPayload = { | ||
url, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosGet(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; | ||
|
||
|
||
export const issueCredential = async (data: object) => { | ||
const url = apiRoutes.Issuance.issueCredential; | ||
const payload = data; | ||
const axiosPayload = { | ||
url, | ||
payload, | ||
config: await getHeaderConfigs(), | ||
}; | ||
|
||
try { | ||
return await axiosPost(axiosPayload); | ||
} catch (error) { | ||
const err = error as Error; | ||
return err?.message; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export enum IssueCredential { | ||
proposalSent = 'proposal-sent', | ||
proposalReceived = 'proposal-received', | ||
offerSent = 'offer-sent', | ||
offerReceived = 'offer-received', | ||
declined = 'decliend', | ||
requestSent = 'request-sent', | ||
requestReceived = 'request-received', | ||
credentialIssued = 'credential-issued', | ||
credentialReceived = 'credential-received', | ||
done = 'done', | ||
abandoned = 'abandoned', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import type { TableData, TableHeader } from "./interface" | ||
import { Spinner, Tooltip } from "flowbite-react"; | ||
|
||
interface DataTableProps { | ||
header: TableHeader[]; | ||
data: TableData[]; | ||
loading: boolean; | ||
callback?: (clickId: string | null | undefined) => void; | ||
} | ||
|
||
const DataTable: React.FC<DataTableProps> = ({ header, data, loading, callback }) => { | ||
|
||
return ( | ||
<div className="flex flex-col "> | ||
{loading | ||
? <div className="flex items-center justify-center mb-4"> | ||
<Spinner | ||
color="info" | ||
/> | ||
</div> | ||
: <div className="overflow-x-auto rounded-lg"> | ||
<div className="inline-block min-w-full align-middle"> | ||
<div className="overflow-hidden shadow sm:rounded-lg"> | ||
<table | ||
className="min-w-full divide-y divide-gray-200 dark:divide-gray-600" | ||
> | ||
<thead className="bg-gray-50 dark:bg-gray-700"> | ||
<tr> | ||
{header && header.length > 0 && | ||
header.map(ele => ( | ||
<th | ||
scope="col" | ||
className={`p-4 text-xs font-medium tracking-wider text-left text-gray-500 uppercase dark:text-white ${ele.width && ele.width}`} | ||
> | ||
<div>{ele.columnName}</div> | ||
{ele.subColumnName && <div className="flex text-gray-500">{ele.subColumnName} </div>} | ||
|
||
</th> | ||
))} | ||
</tr> | ||
</thead> | ||
<tbody className="bg-white dark:bg-gray-800"> | ||
{data.length ? data.map((ele, index) => ( | ||
<tr className={`${index % 2 !== 0 ? 'bg-gray-50 dark:bg-gray-700' : ''} ${callback && ele.clickId ? 'cursor-pointer' : ''}`} onClick={() => callback ? callback(ele?.clickId) : ''}> | ||
{ele.data.map(subEle => ( | ||
<td className={` p-4 text-sm font-normal text-gray-900 whitespace-nowrap dark:text-white align-middle `}> | ||
<div>{subEle.data}</div> | ||
{subEle.subData && subEle.subData} | ||
</td> | ||
))} | ||
</tr> | ||
)) : <tr className="text-center"><td className="p-2 text-center text-gray-500" colSpan={header.length}>No Data Found</td></tr>} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
} | ||
</div > | ||
) | ||
} | ||
|
||
|
||
export default DataTable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export interface TableHeader { | ||
columnName: string; | ||
subColumnName?: string; | ||
width?: string; | ||
} | ||
|
||
export interface TableData { | ||
clickId?: string | null; | ||
data: Data[]; | ||
} | ||
|
||
interface Data { | ||
data: string | JSX.Element; | ||
subData?: string; | ||
} |
Oops, something went wrong.