[INJIMOB-1816]: update logic to sent all errorMessage of issuer to UI (#1581)

* [INJIMOB-1816]: update logic to sent all errorMessage of issuer to UI

Signed-off-by: Alka Prasad <prasadalka1998@gmail.com>

* [INJIMOB-1816] update error text for wellknown fetch error

Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>

---------

Signed-off-by: Alka Prasad <prasadalka1998@gmail.com>
Signed-off-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
Co-authored-by: Abhishek Paul <paul.apaul.abhishek.ap@gmail.com>
This commit is contained in:
Alka Prasad
2024-08-23 19:03:25 +05:30
committed by GitHub
parent 78b4b48c50
commit ced3afeded
14 changed files with 190 additions and 330 deletions

View File

@@ -62,6 +62,15 @@ export const IssuersActions = (model: any) => {
resetSelectedCredentialType: model.assign({
selectedCredentialType: {},
}),
setFetchWellknownError:model.assign({
errorMessage:(_: any, event: any)=>{
const error = event.data.message;
if (error.includes(NETWORK_REQUEST_FAILED)) {
return ErrorMessage.NO_INTERNET;
}
return ErrorMessage.TECHNICAL_DIFFICULTIES
}
}),
setError: model.assign({
errorMessage: (_: any, event: any) => {
console.error('Error occurred ', event.data.message);

View File

@@ -98,7 +98,7 @@ export const IssuersMachine = model.createMachine(
target: 'downloadCredentialTypes',
},
onError: {
actions: ['setError', 'resetLoadingReason'],
actions: ['setFetchWellknownError', 'resetLoadingReason'],
target: 'error',
},
},

View File

@@ -34,7 +34,7 @@
"verifyCredential": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
};
missingImplementations: {
actions: "getKeyPairFromStore" | "loadKeyPair" | "logDownloaded" | "resetError" | "resetIsVerified" | "resetLoadingReason" | "resetSelectedCredentialType" | "resetVerificationErrorMessage" | "sendBackupEvent" | "sendDownloadingFailedToVcMeta" | "sendErrorEndEvent" | "sendImpressionEvent" | "sendSuccessEndEvent" | "setCredentialWrapper" | "setError" | "setIsVerified" | "setIssuers" | "setLoadingReasonAsDisplayIssuers" | "setLoadingReasonAsDownloadingCredentials" | "setLoadingReasonAsSettingUp" | "setMetadataInCredentialData" | "setNoInternet" | "setOIDCConfigError" | "setPrivateKey" | "setPublicKey" | "setSelectedCredentialType" | "setSelectedIssuerId" | "setSelectedIssuers" | "setSupportedCredentialTypes" | "setTokenResponse" | "setVCMetadata" | "setVerifiableCredential" | "storeKeyPair" | "storeVcMetaContext" | "storeVcsContext" | "storeVerifiableCredentialData" | "storeVerifiableCredentialMeta" | "updateIssuerFromWellknown" | "updateVerificationErrorMessage";
actions: "getKeyPairFromStore" | "loadKeyPair" | "logDownloaded" | "resetError" | "resetIsVerified" | "resetLoadingReason" | "resetSelectedCredentialType" | "resetVerificationErrorMessage" | "sendBackupEvent" | "sendDownloadingFailedToVcMeta" | "sendErrorEndEvent" | "sendImpressionEvent" | "sendSuccessEndEvent" | "setCredentialWrapper" | "setError" | "setFetchWellknownError" | "setIsVerified" | "setIssuers" | "setLoadingReasonAsDisplayIssuers" | "setLoadingReasonAsDownloadingCredentials" | "setLoadingReasonAsSettingUp" | "setMetadataInCredentialData" | "setNoInternet" | "setOIDCConfigError" | "setPrivateKey" | "setPublicKey" | "setSelectedCredentialType" | "setSelectedIssuerId" | "setSelectedIssuers" | "setSupportedCredentialTypes" | "setTokenResponse" | "setVCMetadata" | "setVerifiableCredential" | "storeKeyPair" | "storeVcMetaContext" | "storeVcsContext" | "storeVerifiableCredentialData" | "storeVerifiableCredentialMeta" | "updateIssuerFromWellknown" | "updateVerificationErrorMessage";
delays: never;
guards: "canSelectIssuerAgain" | "hasKeyPair" | "hasUserCancelledBiometric" | "isCustomSecureKeystore" | "isGenericError" | "isInternetConnected" | "isOIDCConfigError" | "isOIDCflowCancelled" | "isSignedIn" | "isVerificationPendingBecauseOfNetworkIssue" | "shouldFetchIssuersAgain";
services: "checkInternet" | "downloadCredential" | "downloadCredentialTypes" | "downloadIssuerWellknown" | "downloadIssuersList" | "generateKeyPair" | "invokeAuthorization" | "isUserSignedAlready" | "verifyCredential";
@@ -54,7 +54,8 @@
"sendImpressionEvent": "done.invoke.issuersMachine.displayIssuers:invocation[0]";
"sendSuccessEndEvent": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
"setCredentialWrapper": "done.invoke.issuersMachine.downloadCredentials:invocation[0]";
"setError": "error.platform.issuersMachine.displayIssuers:invocation[0]" | "error.platform.issuersMachine.downloadCredentialTypes:invocation[0]" | "error.platform.issuersMachine.downloadCredentials:invocation[0]" | "error.platform.issuersMachine.downloadIssuerWellknown:invocation[0]" | "error.platform.issuersMachine.performAuthorization:invocation[0]";
"setError": "error.platform.issuersMachine.displayIssuers:invocation[0]" | "error.platform.issuersMachine.downloadCredentialTypes:invocation[0]" | "error.platform.issuersMachine.downloadCredentials:invocation[0]" | "error.platform.issuersMachine.performAuthorization:invocation[0]";
"setFetchWellknownError": "error.platform.issuersMachine.downloadIssuerWellknown:invocation[0]";
"setIsVerified": "done.invoke.issuersMachine.verifyingCredential:invocation[0]";
"setIssuers": "done.invoke.issuersMachine.displayIssuers:invocation[0]";
"setLoadingReasonAsDisplayIssuers": "TRY_AGAIN";

View File

@@ -13,10 +13,7 @@ export function selectSelectedIssuer(state: State) {
}
export function selectErrorMessageType(state: State) {
const nonGenericErrors = ['', ErrorMessage.NO_INTERNET];
return nonGenericErrors.includes(state.context.errorMessage)
? state.context.errorMessage
: null;
return state.context.errorMessage;
}
export function selectLoadingReason(state: State) {