mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
[INJIMOB-2272]: Expired Vc UI changes based on error code
Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com>
This commit is contained in:
committed by
KiruthikaJeyashankar
parent
5b08ca8299
commit
d792414d29
@@ -166,7 +166,7 @@ fileignoreconfig:
|
||||
- filename: shared/storage.ts
|
||||
checksum: 181bbdfe1f4a7daa82c7e8ea1050028c4c50f72200ab2a5eff5bfe1915c7de68
|
||||
- filename: shared/constants.ts
|
||||
checksum: 69aa79ed25fee2162de7c8e065930e18168551377420a520092bdf6a86c7712d
|
||||
checksum: b183a74ebd7bdba4efe44e6fc4cc87d3f14f6f83ffc007b7ec1f1697a6c73f0e
|
||||
- filename: machines/backupAndRestore/backup.ts
|
||||
checksum: 9810de8d626df3a2cf8266e4be0c1b50aa3bce3c6e3b082afaa3e3ecab66af17
|
||||
- filename: machines/backupAndRestore/backup.typegen.ts
|
||||
|
||||
@@ -102,6 +102,7 @@ export const VCCardView: React.FC<VCItemProps> = props => {
|
||||
KEBAB_POPUP={controller.KEBAB_POPUP}
|
||||
isVerified={props.vcMetadata.isVerified}
|
||||
isInitialLaunch={props.isInitialLaunch}
|
||||
isExpired={props.vcMetadata.isExpired}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ export const VCCardViewContent: React.FC<VCItemContentProps> = props => {
|
||||
<VCVerification
|
||||
isVerified={props.isVerified}
|
||||
display={wellknownDisplayProperty}
|
||||
isExpired={props.isExpired}
|
||||
/>
|
||||
</Row>
|
||||
</Column>
|
||||
@@ -164,6 +165,7 @@ export interface VCItemContentProps {
|
||||
vcMetadata: VCMetadata;
|
||||
isVerified?: boolean;
|
||||
isInitialLaunch?: boolean;
|
||||
isExpired?: boolean;
|
||||
}
|
||||
|
||||
VCCardViewContent.defaultProps = {
|
||||
|
||||
@@ -80,6 +80,7 @@ export const getFieldValue = (
|
||||
<VCVerification
|
||||
isVerified={props.verifiableCredentialData.vcMetadata.isVerified}
|
||||
display={display}
|
||||
isExpired={props.verifiableCredentialData.vcMetadata.isExpired}
|
||||
/>
|
||||
);
|
||||
case 'idType':
|
||||
|
||||
@@ -8,13 +8,27 @@ import {useTranslation} from 'react-i18next';
|
||||
import PendingIcon from './PendingIcon';
|
||||
import {VCMetadata} from '../shared/VCMetadata';
|
||||
|
||||
export const VCVerification: React.FC<VCVerificationProps> = ({
|
||||
isVerified,
|
||||
export const VCVerification: React.FC = ({
|
||||
display,
|
||||
}) => {
|
||||
isVerified,
|
||||
isExpired,
|
||||
}: any) => {
|
||||
const {t} = useTranslation('VcDetails');
|
||||
const statusText = isVerified ? t('valid') : t('pending');
|
||||
const statusIcon = isVerified ? <VerifiedIcon /> : <PendingIcon />;
|
||||
const statusText = isVerified
|
||||
? isExpired
|
||||
? t('expired')
|
||||
: t('valid')
|
||||
: t('pending');
|
||||
|
||||
const statusIcon = isVerified ? (
|
||||
isExpired ? (
|
||||
<PendingIcon />
|
||||
) : (
|
||||
<VerifiedIcon />
|
||||
)
|
||||
) : (
|
||||
<PendingIcon />
|
||||
);
|
||||
return (
|
||||
<Row
|
||||
{...testIDProps('verified')}
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"generatedOn": "تم إنشاؤه في",
|
||||
"status": "الحالة",
|
||||
"valid": "صالح",
|
||||
"expired": "منتهي الصلاحية",
|
||||
"pending": "قيد الانتظار",
|
||||
"photo": " صورة",
|
||||
"fullName": "الاسم الكامل",
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
"status": "Status",
|
||||
"valid": "Valid",
|
||||
"pending": "Pending",
|
||||
"expired": "Expired",
|
||||
"photo": "Photo",
|
||||
"fullName": "Full Name",
|
||||
"gender": "Gender",
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
"status": "Katayuan",
|
||||
"valid": "Napatunayan",
|
||||
"pending": "Nakabinbin",
|
||||
"expired": "Nag-expire na",
|
||||
"photo": "Larawan",
|
||||
"fullName": "Buong pangalan",
|
||||
"gender": "Kasarian",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"generatedOn": "पर उत्पन्न हुआ",
|
||||
"status": "दर्जा",
|
||||
"valid": "वैध",
|
||||
"expired": "खत्म हो चुका",
|
||||
"pending": "लंबित",
|
||||
"photo": "फ़ोटो",
|
||||
"fullName": "पूरा नाम",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"generatedOn": "ಜನರೇಟೆಡ್ ಆನ್",
|
||||
"status": "ಸ್ಥಿತಿ",
|
||||
"valid": "ಮಾನ್ಯ",
|
||||
"expired": "ಅವಧಿ ಮೀರಿದೆ",
|
||||
"pending": "ಬಾಕಿಯಿದೆ",
|
||||
"photo": "ಫೋಟೋ",
|
||||
"fullName": "ಪೂರ್ಣ ಹೆಸರು",
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
"generatedOn": "உருவாக்கப்பட்டது",
|
||||
"status": "நிலை",
|
||||
"valid": "செல்லுபடியாகும்",
|
||||
"expired": "காலாவதியானது",
|
||||
"pending": "நிலுவையில் உள்ளது",
|
||||
"photo": "புகைப்படம்",
|
||||
"fullName": "முழு பெயர்",
|
||||
|
||||
@@ -4,7 +4,12 @@ import {
|
||||
OIDCErrors,
|
||||
selectCredentialRequestKey,
|
||||
} from '../../shared/openId4VCI/Utils';
|
||||
import {isIOS, MY_VCS_STORE_KEY, REQUEST_TIMEOUT} from '../../shared/constants';
|
||||
import {
|
||||
MY_VCS_STORE_KEY,
|
||||
REQUEST_TIMEOUT,
|
||||
isIOS,
|
||||
EXPIRED_VC_ERROR_CODE,
|
||||
} from '../../shared/constants';
|
||||
import {assign, send} from 'xstate';
|
||||
import {StoreEvents} from '../store';
|
||||
import {BackupEvents} from '../backupAndRestore/backup';
|
||||
@@ -40,6 +45,21 @@ export const IssuersActions = (model: any) => {
|
||||
isVerified: false,
|
||||
}),
|
||||
}),
|
||||
setIsExpired: assign({
|
||||
vcMetadata: (context: any, event: any) => {
|
||||
return new VCMetadata({
|
||||
...context.vcMetadata,
|
||||
isExpired: event.data.verificationErrorCode == EXPIRED_VC_ERROR_CODE,
|
||||
});
|
||||
},
|
||||
}),
|
||||
resetIsExpired: assign({
|
||||
vcMetadata: (context: any, event: any) =>
|
||||
new VCMetadata({
|
||||
...context.vcMetadata,
|
||||
isExpired: false,
|
||||
}),
|
||||
}),
|
||||
setIssuers: model.assign({
|
||||
issuers: (_: any, event: any) => event.data,
|
||||
}),
|
||||
@@ -106,7 +126,12 @@ export const IssuersActions = (model: any) => {
|
||||
if (error.includes(REQUEST_TIMEOUT)) {
|
||||
return ErrorMessage.REQUEST_TIMEDOUT;
|
||||
}
|
||||
if (error.includes(OIDCErrors.AUTHORIZATION_ENDPOINT_DISCOVERY.GRANT_TYPE_NOT_SUPPORTED)) {
|
||||
if (
|
||||
error.includes(
|
||||
OIDCErrors.AUTHORIZATION_ENDPOINT_DISCOVERY
|
||||
.GRANT_TYPE_NOT_SUPPORTED,
|
||||
)
|
||||
) {
|
||||
return ErrorMessage.AUTHORIZATION_GRANT_TYPE_NOT_SUPPORTED;
|
||||
}
|
||||
return ErrorMessage.GENERIC;
|
||||
|
||||
@@ -432,14 +432,18 @@ export const IssuersMachine = model.createMachine(
|
||||
src: 'verifyCredential',
|
||||
onDone: [
|
||||
{
|
||||
actions: ['sendSuccessEndEvent', 'setIsVerified'],
|
||||
actions: ['sendSuccessEndEvent', 'setIsVerified', 'setIsExpired'],
|
||||
target: 'storing',
|
||||
},
|
||||
],
|
||||
onError: [
|
||||
{
|
||||
cond: 'isVerificationPendingBecauseOfNetworkIssue',
|
||||
actions: ['resetLoadingReason', 'resetIsVerified'],
|
||||
actions: [
|
||||
'resetLoadingReason',
|
||||
'resetIsVerified',
|
||||
'resetIsExpired',
|
||||
],
|
||||
target: 'storing',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -163,6 +163,7 @@ export const IssuersService = () => {
|
||||
if (!verificationResult.isVerified) {
|
||||
throw new Error(verificationResult.verificationErrorCode);
|
||||
}
|
||||
return verificationResult;
|
||||
} else {
|
||||
return {
|
||||
isVerified: true,
|
||||
|
||||
@@ -24,6 +24,7 @@ export class VCMetadata {
|
||||
isVerified: boolean = false;
|
||||
mosipIndividualId: string = '';
|
||||
format: string = '';
|
||||
isExpired: boolean = false;
|
||||
|
||||
downloadKeyType: string = '';
|
||||
constructor({
|
||||
@@ -38,6 +39,7 @@ export class VCMetadata {
|
||||
mosipIndividualId = '',
|
||||
format = '',
|
||||
downloadKeyType = '',
|
||||
isExpired = false,
|
||||
} = {}) {
|
||||
this.idType = idType;
|
||||
this.requestId = requestId;
|
||||
@@ -50,6 +52,7 @@ export class VCMetadata {
|
||||
this.mosipIndividualId = mosipIndividualId;
|
||||
this.format = format;
|
||||
this.downloadKeyType = downloadKeyType;
|
||||
this.isExpired = isExpired;
|
||||
}
|
||||
|
||||
//TODO: Remove any typing and use appropriate typing
|
||||
|
||||
Reference in New Issue
Block a user