Files
inji-wallet/components/VPShareActivityLogEvent.ts
PuBHARGAVI d103bb5da4 [Injimob 2135] ovp enhancements UI (#1658)
* [INJIMOB-2135] get the authentication response as instance of Authorization request rather than as map and make necessary changes for the same in js layer

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] in vp sharing flow use json path library to extract the path value from the VC json data

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] add logic in openid4vp actions to filter the credentials based on the format and proof types and if input descriptor doesn't have format but presentation definition has use it for filtering

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] change the postion of checkbox in VC to the right side during the VP sharing flow

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] show verifier name in vp sharing screen header

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] add log event types for different flows in vp sharing and add translations for log messages in all languages

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] create an interface and use it as a blueprint for vc and vp share activity log classes and override necessary methods

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] show all the VCs available in the wallet if none of the input descriptors have format or constraints

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] notify verifier when user declined the consent for sharing VP by calling sendErrorToVerifier method

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] add logs for different flows of VP sharing

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] add translations for some of the vp sharing flows

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] in vp sharing fix the logic of filtering the VCs matching request and add actions to show the logs properly for normal and retry attempts

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] rename vp sharing activity logs header text into camel case

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] add translations for retry attempt failure and technical error scenarios in vp sharing flow

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] update no credential and credential mismatch error & log messages to show the list of claims requested by verifier

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2215]: expose api in openid4vp module to send error to verifier

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2215]: expose api in openid4vp module to send error to verifier

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2215]: expose api in openid4vp module to send error to verifier

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2215]: refactor native modules and styles for header in send vp screen

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2215]: refactor native modules and styles for header in send vp screen

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2135] show normal failure message in history screen if sharing is failed because of technical error and before retry attempt

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135] exclude bcpkix-jdk15on module to avoid transitive dependency issues occuring while building the app

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* Revert "[INJIMOB-2135] exclude bcpkix-jdk15on module to avoid transitive dependency issues occuring while building the app"

This reverts commit 8c7e4572c1.

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

* [INJIMOB-2135]: update openid4vp swift package

Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>

* [INJIMOB-2135] specify the type of t in getActionText method of vc and vp Activity log events file

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>

---------

Signed-off-by: PuBHARGAVI <46226958+PuBHARGAVI@users.noreply.github.com>
Signed-off-by: adityankannan-tw <adityan410pm@gmail.com>
Co-authored-by: adityankannan-tw <adityan410pm@gmail.com>
2024-11-05 17:51:04 +05:30

62 lines
1.6 KiB
TypeScript

import {formatDistanceToNow} from 'date-fns';
import {ActivityLog} from './ActivityLogEvent';
import * as DateFnsLocale from 'date-fns/locale';
import {VCItemContainerFlowType, VCShareFlowType} from '../shared/Utils';
import {TFunction} from 'react-i18next';
export type VPActivityLogType =
| '' // replacement for undefined
| 'SHARED_SUCCESSFULLY'
| 'SHARED_WITH_FACE_VERIFIACTION'
| 'VERIFIER_AUTHENTICATION_FAILED'
| 'INVALID_AUTH_REQUEST'
| 'USER_DECLINED_CONSENT'
| 'SHARED_AFTER_RETRY'
| 'SHARED_WITH_FACE_VERIFICATION_AFTER_RETRY'
| 'RETRY_ATTEMPT_FAILED'
| 'MAX_RETRY_ATTEMPT_FAILED'
| 'FACE_VERIFICATION_FAILED'
| 'FACE_VERIFICATION_FAILED_AFTER_RETRY_ATTEMPT'
| 'NO_SELECTED_VC_HAS_IMAGE'
| 'CREDENTIAL_MISMATCH_FROM_KEBAB'
| 'NO_CREDENTIAL_MATCHING_REQUEST'
| 'TECHNICAL_ERROR';
export class VPShareActivityLog implements ActivityLog {
timestamp: number;
type: VPActivityLogType;
flow: string;
info: string;
constructor({
type = '' as VPActivityLogType,
timestamp = Date.now(),
flow = VCItemContainerFlowType.VP_SHARE,
info = '',
}) {
this.type = type;
this.timestamp = timestamp;
this.flow = flow;
this.info = info;
}
getActionText(t: TFunction) {
return `${t('ActivityLogText:vpSharing:' + this.type, {info: this.info})}`;
}
static getLogFromObject(data: Object): VPShareActivityLog {
return new VPShareActivityLog(data);
}
getActionLabel(language: string) {
return [
formatDistanceToNow(this.timestamp, {
addSuffix: true,
locale: DateFnsLocale[language],
}),
]
.filter(label => label?.trim() !== '')
.join(' · ');
}
}