From 5c7e549ec2d032daa5a8ce374a9fd7e0e234eec7 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 22 Aug 2024 10:09:46 +0530 Subject: [PATCH 01/10] fix: issuance schemaName issue Signed-off-by: pranalidhanavade --- src/commonComponents/SchemaCard.tsx | 29 +++-------------- src/commonComponents/interface.ts | 1 + src/components/Issuance/EmailIssuance.tsx | 31 +++++++++++-------- src/components/Issuance/Issuance.tsx | 27 ++++++++-------- .../Resources/Schema/SchemasList.tsx | 29 ++++++++++++++++- .../Verification/SchemaSelection.tsx | 6 +++- src/components/Verification/Verification.tsx | 13 ++++++-- .../VerificationCredentialList.tsx | 3 +- .../Verification/VerificationDashboard.tsx | 3 +- src/components/Verification/interface.ts | 1 + .../walletCommonComponents/DedicatedAgent.tsx | 2 +- src/config/CommonConstant.ts | 2 ++ src/config/pathRoutes.ts | 2 ++ .../schemas/connections/index.astro | 17 ++++++++++ 14 files changed, 106 insertions(+), 60 deletions(-) create mode 100644 src/pages/organizations/verification/verify-credentials/schemas/connections/index.astro diff --git a/src/commonComponents/SchemaCard.tsx b/src/commonComponents/SchemaCard.tsx index 7b25fed9a..c6910fb19 100644 --- a/src/commonComponents/SchemaCard.tsx +++ b/src/commonComponents/SchemaCard.tsx @@ -31,9 +31,12 @@ const SchemaCard = (props: ISchemaCardProps) => { if (!props.w3cSchema) { props.onClickCallback(props.schemaId, props.attributes, props.issuerDid, props.created) } + if (props.w3cSchema) { + props.onClickW3CCallback(props.schemaId, props.schemaName, props.version, props.issuerDid, props.attributes, props.created) + } }} id="schema-cards" - className={`transform transition duration-500 ${(props.isClickable !== false && !props.w3cSchema) ? "hover:scale-105 hover:bg-gray-50 cursor-pointer" : "hover:!cursor-default"} h-full w-full overflow-hidden`}> + className={`transform transition duration-500 ${(props.isClickable !== false) ? "hover:scale-105 hover:bg-gray-50 cursor-pointer" : "hover:!cursor-default"} h-full w-full overflow-hidden`}>
@@ -132,30 +135,6 @@ const SchemaCard = (props: ISchemaCardProps) => {
)} - - {props.isVerification && props.w3cSchema &&( -
- -
- )}
diff --git a/src/commonComponents/interface.ts b/src/commonComponents/interface.ts index 91defea17..2bd62a86f 100644 --- a/src/commonComponents/interface.ts +++ b/src/commonComponents/interface.ts @@ -21,6 +21,7 @@ export interface ISchemaCardProps { created: string, isClickable?: boolean onClickCallback: (schemaId: string, attributes: string[], issuerDid: string, created: string) => void; + onClickW3CCallback: (schemaId: string, schemaName: string, version: string, issuerDid: string, attributes: [], created: string) => void; onClickW3cIssue?: (schemaId: string, schemaName: string, version: string, issuerDid: string, attributes: [], created: string) => void; limitedAttributes?: boolean w3cSchema:boolean diff --git a/src/components/Issuance/EmailIssuance.tsx b/src/components/Issuance/EmailIssuance.tsx index c6bddcdb5..5d2006d9e 100644 --- a/src/components/Issuance/EmailIssuance.tsx +++ b/src/components/Issuance/EmailIssuance.tsx @@ -102,7 +102,11 @@ const EmailIssuance = () => { typeof schemaAttributes === 'string' && JSON.parse(schemaAttributes), })); + + console.log("options", options); + setCredentialOptions(options); + } else { setSuccess(null); @@ -140,12 +144,16 @@ const EmailIssuance = () => { setIssueLoader(true); const existingData = userData; + console.log("existingData1111", existingData); + const organizationDid = await getFromLocalStorage(storageKeys.ORG_DID); let transformedData: ITransformedData = { credentialOffer: [] }; if (existingData && existingData.formData) { if (schemaType === SchemaTypes.schema_INDY) { + console.log("credentialOptions333", credentialOptions); + existingData.formData.forEach((entry: { email: string; attributes: IIssueAttributes[] }) => { const transformedEntry = { emailId: entry.email, attributes: [] }; @@ -160,8 +168,10 @@ const EmailIssuance = () => { transformedData.credentialOffer.push(transformedEntry); }); transformedData.credentialDefinitionId = credDefId; + console.log("credentialOptions222", credentialOptions); } else if (schemaType=== SchemaTypes.schema_W3C) { + existingData.formData.forEach((entry: { email: string; credentialData: IEmailCredentialData; attributes:IIssueAttributes[] }) => { const credentialOffer = { emailId: entry.email, @@ -172,7 +182,7 @@ const EmailIssuance = () => { ], "type": [ "VerifiableCredential", - credentialOptions[0].schemaName + credentialSelected?.schemaName ], "issuer": { "id": organizationDid @@ -180,19 +190,14 @@ const EmailIssuance = () => { "issuanceDate": new Date().toISOString(), credentialSubject: entry?.attributes?.reduce((acc, attr) => { - if (attr.value === null && !attr.isRequired && typeof attr.value === 'number') { + if (attr.value === null || attr.value === '' || (typeof attr.value === 'number' && isNaN(attr.value))) { + return acc; + } else { + acc[attr.name] = attr.value; return acc; - } else { - if (attr.name === 'rollno' && attr.value === '') { - return acc; - } else { - acc[attr.name] = attr.value; - return acc; - } - } - }, { - }), - }, + } + }, {}), + }, options: { proofType: schemaTypeValue===SchemaTypeValue.POLYGON ? ProofType.polygon : ProofType.no_ledger, proofPurpose: proofPurpose diff --git a/src/components/Issuance/Issuance.tsx b/src/components/Issuance/Issuance.tsx index 5da3ad377..3c97ee23d 100644 --- a/src/components/Issuance/Issuance.tsx +++ b/src/components/Issuance/Issuance.tsx @@ -333,21 +333,18 @@ const getSelectedUsers = async (): Promise => { "id": w3cSchemaDetails.issuerDid }, issuanceDate: new Date().toISOString(), + credentialSubject: item?.attributes?.reduce((acc, attr) => { - if (attr.value === null && !attr.isRequired && typeof attr.value === 'number') { - return acc; - } else { - if (attr.name === 'rollno' && attr.value === '') { - return acc; - } else { - acc[attr.name] = attr.value; - return acc; - } - } - }, { - }), - }, - + if ( + (attr.value === null || attr.value === '') + ) { + return acc; + } else { + acc[attr.name] = attr.value; + return acc; + } + }, {}), + }, options: { proofType: schemaType=== SchemaTypeValue.POLYGON ? ProofType.polygon : ProofType.no_ledger, proofPurpose: proofPurpose @@ -356,6 +353,8 @@ const getSelectedUsers = async (): Promise => { }), orgId: values.orgId, }; + console.log("issuancePayload",issuancePayload); + } const convertedAttributesValues = { diff --git a/src/components/Resources/Schema/SchemasList.tsx b/src/components/Resources/Schema/SchemasList.tsx index 22b0fa0f8..a46d8befd 100644 --- a/src/components/Resources/Schema/SchemasList.tsx +++ b/src/components/Resources/Schema/SchemasList.tsx @@ -14,7 +14,7 @@ import { EmptyListMessage } from '../../EmptyListComponent'; import { Features } from '../../../utils/enums/features'; import RoleViewButton from '../../RoleViewButton'; import SchemaCard from '../../../commonComponents/SchemaCard'; -import type { SchemaDetails } from '../../Verification/interface'; +import type { IW3cSchemaDetails, SchemaDetails } from '../../Verification/interface'; import SearchInput from '../../SearchInput'; import { getFromLocalStorage, setToLocalStorage } from '../../../api/Auth'; import { pathRoutes } from '../../../config/pathRoutes'; @@ -30,6 +30,12 @@ const SchemaList = (props: { schemaId: string, schemaDetails: SchemaDetails, ) => void; + + schemaW3CSelectionCallback: ( + schemaId: string, + w3cSchemaDetails: IW3cSchemaDetails, + ) => void; + verificationFlag?: boolean; }) => { @@ -148,6 +154,26 @@ const SchemaList = (props: { props.schemaSelectionCallback(schemaId, schemaDetails); }; + const schemaW3CSelectionCallback = async ( + schemaId: string, + schemaName: string, + version: string, + issuerDid: string, + attributes: [], + created: string + ) => { + const w3cSchemaDetails = { + schemaId, + schemaName, + version, + issuerDid, + attributes, + created, + }; + props.schemaW3CSelectionCallback(schemaId, w3cSchemaDetails); + await setToLocalStorage(storageKeys.W3C_SCHEMA_DATA, w3cSchemaDetails); + }; + const handleW3CIssue = async ( schemaId: string, schemaName: string, @@ -305,6 +331,7 @@ const SchemaList = (props: { attributes={element['attributes']} created={element['createDateTime']} onClickCallback={schemaSelectionCallback} + onClickW3CCallback={schemaW3CSelectionCallback} onClickW3cIssue={handleW3CIssue} w3cSchema={w3cSchema} noLedger={isNoLedger} diff --git a/src/components/Verification/SchemaSelection.tsx b/src/components/Verification/SchemaSelection.tsx index a6316b45d..8707368ed 100644 --- a/src/components/Verification/SchemaSelection.tsx +++ b/src/components/Verification/SchemaSelection.tsx @@ -15,8 +15,12 @@ const SchemaSelection = () => { window.location.href = `${pathRoutes.organizations.verification.credDef}` } + const schemaW3CSelectionCallback = async () => { + window.location.href = `${pathRoutes.organizations.verification.W3CConnections}` + } + return ( - + ) } diff --git a/src/components/Verification/Verification.tsx b/src/components/Verification/Verification.tsx index bdcd165ae..51fd2cd3b 100644 --- a/src/components/Verification/Verification.tsx +++ b/src/components/Verification/Verification.tsx @@ -318,8 +318,12 @@ const VerificationCred = () => { if(w3cSchema){ - const getW3cAttributes = await getFromLocalStorage(storageKeys.W3C_SCHEMA_DETAILS); + const getW3cAttributes = await getFromLocalStorage(storageKeys.W3C_SCHEMA_DATA); + console.log("getW3cAttributes",getW3cAttributes); + const parsedSchemaAttributes = JSON.parse(getW3cAttributes) || []; + console.log("parsedSchemaAttributes",parsedSchemaAttributes); + const w3cInputArray: SelectedUsers[] = parsedSchemaAttributes.attributes.map( (attribute: IAttribute) => { return { @@ -448,6 +452,8 @@ const VerificationCred = () => { }); setAttributeList(attributes); + console.log("attributes",attributes); + setDisplay( attributeData?.some((attribute) => attribute?.dataType === 'number'), @@ -467,7 +473,8 @@ const VerificationCred = () => { if(isW3c){ const orgId = await getFromLocalStorage(storageKeys.ORG_ID); - const getW3cSchemaDetails = await getFromLocalStorage(storageKeys.W3C_SCHEMA_DETAILS); + const getW3cSchemaDetails = await getFromLocalStorage(storageKeys.W3C_SCHEMA_DATA); + const parsedW3cSchemaDetails = JSON.parse(getW3cSchemaDetails); const schemaId = parsedW3cSchemaDetails?.schemaId createW3cSchemaPayload(schemaId,parsedW3cSchemaDetails) @@ -499,6 +506,7 @@ const VerificationCred = () => { display && !w3cSchema && { columnName: 'Condition' }, display && !w3cSchema && { columnName: 'Value', width: 'w-0.75' }, ]; +console.log("attributeList",attributeList); return (
@@ -531,7 +539,6 @@ const VerificationCred = () => { version={w3cSchemaDetails.version} hideCredDefId={true} /> - ) )} {(proofReqSuccess || errMsg) && ( diff --git a/src/components/Verification/VerificationCredentialList.tsx b/src/components/Verification/VerificationCredentialList.tsx index a87872cb4..510209747 100644 --- a/src/components/Verification/VerificationCredentialList.tsx +++ b/src/components/Verification/VerificationCredentialList.tsx @@ -324,7 +324,8 @@ const VerificationCredentialList = () => { }, [listAPIParameter]); const schemeSelection = () => { - window.location.href = pathRoutes.organizations.verification.schema; + window.location.href = pathRoutes.organizations.verification.requestProof; + }; const refreshPage = () => { diff --git a/src/components/Verification/VerificationDashboard.tsx b/src/components/Verification/VerificationDashboard.tsx index 24ef11367..9471de377 100644 --- a/src/components/Verification/VerificationDashboard.tsx +++ b/src/components/Verification/VerificationDashboard.tsx @@ -6,7 +6,8 @@ const VerificationDashboard = () => { { heading: 'Connection', description: 'Verify credential(s) by selecting existing connections', - path: pathRoutes.organizations.verification.connections, + path: pathRoutes.organizations.verification.schema, + }, { heading: 'Email', diff --git a/src/components/Verification/interface.ts b/src/components/Verification/interface.ts index c45d81145..e3032a185 100644 --- a/src/components/Verification/interface.ts +++ b/src/components/Verification/interface.ts @@ -66,6 +66,7 @@ export interface IW3cSchemaDetails { schemaId: string; w3cAttributes?: IAttributesData[]; issuerDid?:string; + created?:string; } export interface IAttributesData { diff --git a/src/components/organization/walletCommonComponents/DedicatedAgent.tsx b/src/components/organization/walletCommonComponents/DedicatedAgent.tsx index a82cd6115..60817dcfe 100644 --- a/src/components/organization/walletCommonComponents/DedicatedAgent.tsx +++ b/src/components/organization/walletCommonComponents/DedicatedAgent.tsx @@ -501,7 +501,7 @@ const networkRenderOptions = (formikHandlers: { handleChange: (e: React.ChangeEv name="did-method" value={selectedDid} readOnly - className="mt-2 bg-[#F4F4F4] dark:bg-gray-700" /> + className="mt-2 bg-[#F4F4F4] dark:bg-gray-700 text-gray-900 dark:text-gray-300" />
diff --git a/src/config/CommonConstant.ts b/src/config/CommonConstant.ts index d32f5537f..eccdfdb45 100644 --- a/src/config/CommonConstant.ts +++ b/src/config/CommonConstant.ts @@ -30,6 +30,8 @@ export const storageKeys = { SELECTED_USER:'selected_user', SELECTED_CONNECTIONS: 'selected_connections', SCHEMA_ID:'schema_id', + W3C_SCHEMA_DATA:'w3cSchemaDetails', + W3C_SCHEMA_ATTRIBUTES: 'w3c_schema_attributes', SCHEMA_ATTR:'schema_attr', W3C_SCHEMA_DETAILS:'schemaDetails', CRED_DEF_ID:'cred_def_id', diff --git a/src/config/pathRoutes.ts b/src/config/pathRoutes.ts index 5fd85b4f0..d6bacd29c 100644 --- a/src/config/pathRoutes.ts +++ b/src/config/pathRoutes.ts @@ -55,6 +55,8 @@ export const pathRoutes = { attributes: '/organizations/verification/verify-credentials/schemas/cred-defs/attributes', emailCredDef: '/organizations/verification/verify-credentials/email/schemas/cred-defs', connections: '/organizations/verification/verify-credentials/schemas/cred-defs/connections', + W3CConnections: '/organizations/verification/verify-credentials/schemas/connections', + verify: '/organizations/verification/verify-credentials/schemas/cred-defs/connections/verification', }, diff --git a/src/pages/organizations/verification/verify-credentials/schemas/connections/index.astro b/src/pages/organizations/verification/verify-credentials/schemas/connections/index.astro new file mode 100644 index 000000000..0ea57bf87 --- /dev/null +++ b/src/pages/organizations/verification/verify-credentials/schemas/connections/index.astro @@ -0,0 +1,17 @@ +--- +import LayoutSidebar from "../../../../../../app/LayoutSidebar.astro"; +import Connections from "../../../../../../components/Verification/Connections"; +import { pathRoutes } from "../../../../../../config/pathRoutes"; +import { checkUserSession } from "../../../../../../utils/check-session"; + + +const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname}); +const route: string = pathRoutes.auth.sinIn +if (!response.authorized) { + return Astro.redirect(response.redirect); +} +--- + + + + From c178a1ec907b9c1d9997eb298042d779f6097342 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 22 Aug 2024 11:47:18 +0530 Subject: [PATCH 02/10] fix: verification breadcrumb fixes Signed-off-by: pranalidhanavade --- src/components/Issuance/EmailIssuance.tsx | 8 +------- src/components/Issuance/Issuance.tsx | 1 - .../Resources/Schema/SchemasList.tsx | 8 ++++---- src/components/Verification/Connections.tsx | 20 ++++++++++++++++--- .../Verification/SchemaSelection.tsx | 4 ++-- src/components/Verification/Verification.tsx | 7 +------ src/config/pathRoutes.ts | 2 ++ .../schemas/connections/verification.astro | 17 ++++++++++++++++ 8 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 src/pages/organizations/verification/verify-credentials/schemas/connections/verification.astro diff --git a/src/components/Issuance/EmailIssuance.tsx b/src/components/Issuance/EmailIssuance.tsx index 5d2006d9e..3ec162dd4 100644 --- a/src/components/Issuance/EmailIssuance.tsx +++ b/src/components/Issuance/EmailIssuance.tsx @@ -102,9 +102,6 @@ const EmailIssuance = () => { typeof schemaAttributes === 'string' && JSON.parse(schemaAttributes), })); - - console.log("options", options); - setCredentialOptions(options); @@ -144,7 +141,6 @@ const EmailIssuance = () => { setIssueLoader(true); const existingData = userData; - console.log("existingData1111", existingData); const organizationDid = await getFromLocalStorage(storageKeys.ORG_DID); @@ -152,8 +148,6 @@ const EmailIssuance = () => { if (existingData && existingData.formData) { if (schemaType === SchemaTypes.schema_INDY) { - console.log("credentialOptions333", credentialOptions); - existingData.formData.forEach((entry: { email: string; attributes: IIssueAttributes[] }) => { const transformedEntry = { emailId: entry.email, attributes: [] }; @@ -168,7 +162,7 @@ const EmailIssuance = () => { transformedData.credentialOffer.push(transformedEntry); }); transformedData.credentialDefinitionId = credDefId; - console.log("credentialOptions222", credentialOptions); + } else if (schemaType=== SchemaTypes.schema_W3C) { diff --git a/src/components/Issuance/Issuance.tsx b/src/components/Issuance/Issuance.tsx index 3c97ee23d..a64e62625 100644 --- a/src/components/Issuance/Issuance.tsx +++ b/src/components/Issuance/Issuance.tsx @@ -353,7 +353,6 @@ const getSelectedUsers = async (): Promise => { }), orgId: values.orgId, }; - console.log("issuancePayload",issuancePayload); } diff --git a/src/components/Resources/Schema/SchemasList.tsx b/src/components/Resources/Schema/SchemasList.tsx index a46d8befd..87d688071 100644 --- a/src/components/Resources/Schema/SchemasList.tsx +++ b/src/components/Resources/Schema/SchemasList.tsx @@ -31,7 +31,7 @@ const SchemaList = (props: { schemaDetails: SchemaDetails, ) => void; - schemaW3CSelectionCallback: ( + W3CSchemaSelectionCallback: ( schemaId: string, w3cSchemaDetails: IW3cSchemaDetails, ) => void; @@ -154,7 +154,7 @@ const SchemaList = (props: { props.schemaSelectionCallback(schemaId, schemaDetails); }; - const schemaW3CSelectionCallback = async ( + const W3CSchemaSelectionCallback = async ( schemaId: string, schemaName: string, version: string, @@ -170,7 +170,7 @@ const SchemaList = (props: { attributes, created, }; - props.schemaW3CSelectionCallback(schemaId, w3cSchemaDetails); + props.W3CSchemaSelectionCallback(schemaId, w3cSchemaDetails); await setToLocalStorage(storageKeys.W3C_SCHEMA_DATA, w3cSchemaDetails); }; @@ -331,7 +331,7 @@ const SchemaList = (props: { attributes={element['attributes']} created={element['createDateTime']} onClickCallback={schemaSelectionCallback} - onClickW3CCallback={schemaW3CSelectionCallback} + onClickW3CCallback={W3CSchemaSelectionCallback} onClickW3cIssue={handleW3CIssue} w3cSchema={w3cSchema} noLedger={isNoLedger} diff --git a/src/components/Verification/Connections.tsx b/src/components/Verification/Connections.tsx index ffa84f497..c0f3ee76e 100644 --- a/src/components/Verification/Connections.tsx +++ b/src/components/Verification/Connections.tsx @@ -1,7 +1,7 @@ import { Button } from "flowbite-react"; -import { useState } from "react"; -import { setToLocalStorage } from "../../api/Auth"; +import { useEffect, useState } from "react"; +import { getFromLocalStorage, setToLocalStorage } from "../../api/Auth"; import DataTable from "../../commonComponents/datatable"; import type { TableData } from "../../commonComponents/datatable/interface"; import { storageKeys } from "../../config/CommonConstant"; @@ -10,8 +10,10 @@ import BreadCrumbs from "../BreadCrumbs"; import ConnectionList from "./ConnectionList"; import EmailList from "./EmailList"; import BackButton from '../../commonComponents/backbutton' +import { DidMethod } from "../../common/enums"; const Connections = () => { + const [isW3cDid, setIsW3cDid] = useState(false); const [selectedConnectionList, setSelectedConnectionList] = useState([]) const selectedConnectionHeader = [ { columnName: 'User' }, @@ -21,13 +23,25 @@ const Connections = () => { const selectConnection = (connections: TableData[]) => { setSelectedConnectionList(connections) } + const fetchOrgData = async () => { + const orgDid = await getFromLocalStorage(storageKeys.ORG_DID); + + if (orgDid.includes(DidMethod.POLYGON) || orgDid.includes(DidMethod.KEY) || orgDid.includes(DidMethod.WEB)) { + setIsW3cDid(true); + } else { + setIsW3cDid(false); + } + }; + useEffect(() => { + fetchOrgData(); + }, []); const continueToVerify = async () => { const selectedConnections = selectedConnectionList.map(ele =>{ return {userName: ele.data[0].data, connectionId:ele.data[1].data} }) await setToLocalStorage(storageKeys.SELECTED_USER, selectedConnections) - window.location.href = `${pathRoutes.organizations.verification.verify}` + window.location.href = isW3cDid ? `${pathRoutes.organizations.verification.W3CVerification}` : `${pathRoutes.organizations.verification.verify}` } return ( diff --git a/src/components/Verification/SchemaSelection.tsx b/src/components/Verification/SchemaSelection.tsx index 8707368ed..94f361889 100644 --- a/src/components/Verification/SchemaSelection.tsx +++ b/src/components/Verification/SchemaSelection.tsx @@ -15,12 +15,12 @@ const SchemaSelection = () => { window.location.href = `${pathRoutes.organizations.verification.credDef}` } - const schemaW3CSelectionCallback = async () => { + const W3CSchemaSelectionCallback = async () => { window.location.href = `${pathRoutes.organizations.verification.W3CConnections}` } return ( - + ) } diff --git a/src/components/Verification/Verification.tsx b/src/components/Verification/Verification.tsx index 51fd2cd3b..14864b373 100644 --- a/src/components/Verification/Verification.tsx +++ b/src/components/Verification/Verification.tsx @@ -319,10 +319,8 @@ const VerificationCred = () => { if(w3cSchema){ const getW3cAttributes = await getFromLocalStorage(storageKeys.W3C_SCHEMA_DATA); - console.log("getW3cAttributes",getW3cAttributes); const parsedSchemaAttributes = JSON.parse(getW3cAttributes) || []; - console.log("parsedSchemaAttributes",parsedSchemaAttributes); const w3cInputArray: SelectedUsers[] = parsedSchemaAttributes.attributes.map( (attribute: IAttribute) => { @@ -451,9 +449,7 @@ const VerificationCred = () => { }; }); - setAttributeList(attributes); - console.log("attributes",attributes); - + setAttributeList(attributes); setDisplay( attributeData?.some((attribute) => attribute?.dataType === 'number'), @@ -506,7 +502,6 @@ const VerificationCred = () => { display && !w3cSchema && { columnName: 'Condition' }, display && !w3cSchema && { columnName: 'Value', width: 'w-0.75' }, ]; -console.log("attributeList",attributeList); return (
diff --git a/src/config/pathRoutes.ts b/src/config/pathRoutes.ts index d6bacd29c..90baf60dd 100644 --- a/src/config/pathRoutes.ts +++ b/src/config/pathRoutes.ts @@ -59,6 +59,8 @@ export const pathRoutes = { verify: '/organizations/verification/verify-credentials/schemas/cred-defs/connections/verification', + W3CVerification: + '/organizations/verification/verify-credentials/schemas/connections/verification', }, }, ecosystem: { diff --git a/src/pages/organizations/verification/verify-credentials/schemas/connections/verification.astro b/src/pages/organizations/verification/verify-credentials/schemas/connections/verification.astro new file mode 100644 index 000000000..2dbff36f5 --- /dev/null +++ b/src/pages/organizations/verification/verify-credentials/schemas/connections/verification.astro @@ -0,0 +1,17 @@ +--- +import LayoutSidebar from "../../../../../../app/LayoutSidebar.astro"; +import VerificationCred from "../../../../../../components/Verification/Verification"; +import { pathRoutes } from "../../../../../../config/pathRoutes"; +import { checkUserSession } from "../../../../../../utils/check-session"; + + +const response = await checkUserSession({cookies: Astro.cookies, currentPath: Astro.url.pathname}); +const route: string = pathRoutes.auth.sinIn +if (!response.authorized) { + return Astro.redirect(response.redirect); +} +--- + + + + From 0aabc9e04675089e5f231f7f0dd4a7868a556423 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 22 Aug 2024 17:55:26 +0530 Subject: [PATCH 03/10] fix: schema card hover issue Signed-off-by: pranalidhanavade --- src/commonComponents/SchemaCard.tsx | 3 ++- src/components/Issuance/EmailIssuance.tsx | 23 ++++++++++++--------- src/components/Issuance/Issuance.tsx | 25 ++++++++++++++--------- 3 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/commonComponents/SchemaCard.tsx b/src/commonComponents/SchemaCard.tsx index c6910fb19..ddb53286a 100644 --- a/src/commonComponents/SchemaCard.tsx +++ b/src/commonComponents/SchemaCard.tsx @@ -36,7 +36,8 @@ const SchemaCard = (props: ISchemaCardProps) => { } }} id="schema-cards" - className={`transform transition duration-500 ${(props.isClickable !== false) ? "hover:scale-105 hover:bg-gray-50 cursor-pointer" : "hover:!cursor-default"} h-full w-full overflow-hidden`}> + className={`transform transition duration-500 ${props.w3cSchema ? "" : (props.isClickable !== false) ? "hover:scale-105 hover:bg-gray-50 cursor-pointer" : "hover:!cursor-default"} h-full w-full overflow-hidden`} + >
diff --git a/src/components/Issuance/EmailIssuance.tsx b/src/components/Issuance/EmailIssuance.tsx index 3ec162dd4..94032956e 100644 --- a/src/components/Issuance/EmailIssuance.tsx +++ b/src/components/Issuance/EmailIssuance.tsx @@ -182,16 +182,19 @@ const EmailIssuance = () => { "id": organizationDid }, "issuanceDate": new Date().toISOString(), - - credentialSubject: entry?.attributes?.reduce((acc, attr) => { - if (attr.value === null || attr.value === '' || (typeof attr.value === 'number' && isNaN(attr.value))) { - return acc; - } else { - acc[attr.name] = attr.value; - return acc; - } - }, {}), - }, + + //FIXME: + credentialSubject: entry?.attributes?.reduce((acc, attr) => { + if (attr.schemaDataType === 'number' && (attr.value === '' || attr.value === null)) { + acc[attr.name] = 0; + } else if (attr.schemaDataType === 'string' && attr.value === '') { + acc[attr.name] = ''; + } else if (attr.value !== null) { + acc[attr.name] = attr.value; + } + return acc; + }, {}), + }, options: { proofType: schemaTypeValue===SchemaTypeValue.POLYGON ? ProofType.polygon : ProofType.no_ledger, proofPurpose: proofPurpose diff --git a/src/components/Issuance/Issuance.tsx b/src/components/Issuance/Issuance.tsx index a64e62625..612e6b1dd 100644 --- a/src/components/Issuance/Issuance.tsx +++ b/src/components/Issuance/Issuance.tsx @@ -333,18 +333,23 @@ const getSelectedUsers = async (): Promise => { "id": w3cSchemaDetails.issuerDid }, issuanceDate: new Date().toISOString(), - + //FIXME: credentialSubject: item?.attributes?.reduce((acc, attr) => { - if ( - (attr.value === null || attr.value === '') - ) { - return acc; - } else { - acc[attr.name] = attr.value; - return acc; + + if (attr.dataType === 'number' && (attr.value === '' || attr.value === null)) { + + acc[attr.name] = 0; + } else if (attr.dataType === 'string' && attr.value === '') { + + acc[attr.name] = ''; + } else if (attr.value !== null) { + + acc[attr.name] = attr.value; } - }, {}), - }, + return acc; + }, {}), + }, + options: { proofType: schemaType=== SchemaTypeValue.POLYGON ? ProofType.polygon : ProofType.no_ledger, proofPurpose: proofPurpose From 627b202608cae76183e36b2b9a56cac890f5b639 Mon Sep 17 00:00:00 2001 From: pranalidhanavade Date: Thu, 22 Aug 2024 19:52:24 +0530 Subject: [PATCH 04/10] fix: delete organization delete svg issue Signed-off-by: pranalidhanavade --- src/commonComponents/SchemaCard.tsx | 68 +++++++++++++------ src/components/Tooltip/dataTooltip.tsx | 21 ++++++ .../organization/DeleteOrganizationsCard.tsx | 11 +-- 3 files changed, 76 insertions(+), 24 deletions(-) create mode 100644 src/components/Tooltip/dataTooltip.tsx diff --git a/src/commonComponents/SchemaCard.tsx b/src/commonComponents/SchemaCard.tsx index ddb53286a..ea5c13638 100644 --- a/src/commonComponents/SchemaCard.tsx +++ b/src/commonComponents/SchemaCard.tsx @@ -1,6 +1,8 @@ import { Button, Card } from 'flowbite-react'; import { dateConversion } from '../utils/DateConversion'; import DateTooltip from '../components/Tooltip'; +import DataTooltip from '../components/Tooltip/dataTooltip' + import CopyDid from './CopyDid'; import React, { useEffect } from 'react'; import { pathRoutes } from '../config/pathRoutes'; @@ -92,26 +94,54 @@ const SchemaCard = (props: ISchemaCardProps) => {
-
- Attributes: -
- {attributes && attributes.length > 0 && ( - <> - {attributes?.map((element) => ( -
- - {element?.attributeName} - -
- ))} - {props?.limitedAttributes !== false && props?.attributes?.length > 3 && ...} - - )} + {props.w3cSchema ? ( + attribute.attributeName} + > +
+ Attributes: +
+ {attributes && attributes.length > 0 && ( + <> + {attributes.map((element) => ( +
+ + {element?.attributeName} + +
+ ))} + {props.limitedAttributes !== false && props.attributes.length > 3 && ...} + + )} +
+
+
+ ) : ( +
+ Attributes: +
+ {attributes && attributes.length > 0 && ( + <> + {attributes.map((element) => ( +
+ + {element?.attributeName} + +
+ ))} + {props.limitedAttributes !== false && props.attributes.length > 3 && ...} + + )} +
-
+ )}
{props.w3cSchema && !props.isVerification && (
diff --git a/src/components/Tooltip/dataTooltip.tsx b/src/components/Tooltip/dataTooltip.tsx new file mode 100644 index 000000000..41e885046 --- /dev/null +++ b/src/components/Tooltip/dataTooltip.tsx @@ -0,0 +1,21 @@ +import { Tooltip } from 'flowbite-react'; +import React from 'react'; + +interface TooltipProps { + data: Type[]; + renderItem: (item: Type) => string; + id?: string; + children?: React.ReactNode; +} + +const DataTooltip = ({ data, renderItem, children }: TooltipProps) => { + const content = data.map(renderItem).join(', '); + + return ( + + {children} + + ); +}; + +export default DataTooltip; diff --git a/src/components/organization/DeleteOrganizationsCard.tsx b/src/components/organization/DeleteOrganizationsCard.tsx index a6677dffa..69625d6f8 100644 --- a/src/components/organization/DeleteOrganizationsCard.tsx +++ b/src/components/organization/DeleteOrganizationsCard.tsx @@ -30,11 +30,12 @@ const DeleteOrganizationsCard: React.FC = ({ {count &&

Total:{count}

}