mirror of
https://github.com/mosip/inji-wallet.git
synced 2026-01-09 13:38:01 -05:00
* [INJIMOB-2670]: Enable Auto Vc Activation (#1) * [INJIMOB-2670]: Enable Auto Vc Activation (#1759) * [INJIMOB-2670]: Hide Success Banner during Auto Activation. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Locales for Auto Activation Error message Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Enable Auto Vc Activation and handle error scenarios Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Remove activation sections from Help content Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Update Event name to be generic Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Remove communication details and add default OTP into constants Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> --------- Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Removing Mosip specific condition for mosipInidividualId Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> --------- Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * add spanish language (#2) Signed-off-by: Sk Mijan Hossain <skmijanhossain@gmail.com> Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Individual Id fix and add prefix to face image (#4) * [INJIMOB-2670]: Individual Id fix and appending image format for face image. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Add Utils to append Png Base64 Prefix to faceImage. Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> --------- Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Update artifact Id and App name in fastlane scripts and build.gradle. (#3) Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Add enable_auth and remove lilveness_detection in internal-build yml (#5) Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Spanish locale updates. (#6) Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> * [INJIMOB-2670]: Liveness detection flag type changed to string Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> --------- Signed-off-by: BalachandarG <balachandar.g@thoughtworks.com> Signed-off-by: Sk Mijan Hossain <skmijanhossain@gmail.com> Co-authored-by: mijan32 <74153970+mijan32@users.noreply.github.com>
98 lines
2.6 KiB
TypeScript
98 lines
2.6 KiB
TypeScript
import {StateFrom} from 'xstate';
|
|
import {VCMetadata} from '../../../shared/VCMetadata';
|
|
import {vcMetaMachine} from './VCMetaMachine';
|
|
import {VC} from './vc';
|
|
|
|
type State = StateFrom<typeof vcMetaMachine>;
|
|
|
|
export function selectVerificationStatus(state: State) {
|
|
return state.context.verificationStatus;
|
|
}
|
|
|
|
export function selectMyVcsMetadata(state: State): VCMetadata[] {
|
|
return state.context.myVcsMetadata;
|
|
}
|
|
|
|
export function selectShareableVcsMetadata(state: State): VCMetadata[] {
|
|
return state.context.myVcsMetadata.filter(
|
|
vcMetadata =>
|
|
state.context.myVcs[vcMetadata.getVcKey()]?.verifiableCredential != null,
|
|
);
|
|
}
|
|
|
|
export function selectShareableVcs(state: State): VC[] {
|
|
return Object.values(state.context.myVcs).filter(
|
|
vc => vc?.verifiableCredential != null,
|
|
);
|
|
}
|
|
|
|
export function selectReceivedVcsMetadata(state: State): VCMetadata[] {
|
|
return state.context.receivedVcsMetadata;
|
|
}
|
|
|
|
export function selectIsRefreshingMyVcs(state: State) {
|
|
return state.matches('ready.myVcs');
|
|
}
|
|
|
|
export function selectIsRefreshingReceivedVcs(state: State) {
|
|
return state.matches('ready.receivedVcs');
|
|
}
|
|
|
|
export function selectAreAllVcsDownloaded(state: State) {
|
|
return state.context.areAllVcsDownloaded;
|
|
}
|
|
|
|
/*
|
|
this methods returns all the binded vc's in the wallet.
|
|
*/
|
|
export function selectBindedVcsMetadata(state: State): VCMetadata[] {
|
|
return state.context.myVcsMetadata.filter(vcMetadata => {
|
|
const walletBindingResponse =
|
|
state.context.myVcs[vcMetadata.getVcKey()]?.walletBindingResponse;
|
|
return (
|
|
!isEmpty(walletBindingResponse) &&
|
|
!isEmpty(walletBindingResponse?.walletBindingId)
|
|
);
|
|
});
|
|
}
|
|
|
|
export function selectInProgressVcDownloads(state: State) {
|
|
return state.context.inProgressVcDownloads;
|
|
}
|
|
|
|
function isEmpty(object) {
|
|
return object == null || object == '' || object == undefined;
|
|
}
|
|
|
|
export function selectWalletBindingSuccess(state: State) {
|
|
return state.context.walletBindingSuccess;
|
|
}
|
|
|
|
export function selectAutoWalletBindingSuccess(state: State) {
|
|
return state.context.autoWalletBindingSuccess;
|
|
}
|
|
|
|
export function selectIsTampered(state: State) {
|
|
return state.matches('ready.tamperedVCs');
|
|
}
|
|
|
|
export function selectDownloadingFailedVcs(state: State) {
|
|
return state.context.downloadingFailedVcs;
|
|
}
|
|
|
|
export function selectMyVcs(state: State) {
|
|
return state.context.myVcs;
|
|
}
|
|
|
|
export function selectVerificationErrorMessage(state: State) {
|
|
return state.context.verificationErrorMessage;
|
|
}
|
|
|
|
export function selectIsDownloadingFailed(state: State) {
|
|
return state.context.DownloadingCredentialsFailed;
|
|
}
|
|
|
|
export function selectIsDownloadingSuccess(state: State) {
|
|
return state.context.DownloadingCredentialsSuccess;
|
|
}
|