Merge pull request #1721 from tw-mosip/injimob-2462-fix-error-cta-not-working

[INJIMOB-2462] fix error screen CTAs not working in VC download flow
This commit is contained in:
Sreenadh S
2024-12-02 17:33:51 +05:30
committed by GitHub
12 changed files with 42 additions and 39 deletions

View File

@@ -222,7 +222,7 @@
},
"technicalDifficulty": {
"title": "حدث خطأ!",
"message": "شكرًا على صبرك! نحن نواجه صعوبات تقنية في الوقت الحالي. يُرجى المحاولة مرة أخرى لاحقًا أو الاتصال بالمسؤول للحصول على مزيد من المساعدة!"
"message": "شكرا لك على صبركم! نواجه حاليًا صعوبات فنية. يرجى محاولة التنزيل مرة أخرى قريبًا."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "نوع المنحة غير مدعوم خطأ في التفويض!",

View File

@@ -223,7 +223,7 @@
},
"technicalDifficulty": {
"title": "An error occurred!",
"message": "Thanks for your patience! We're experiencing technical difficulties right now. Please try again later or contact the admin for further assistance!"
"message": "Thank you for your patience! We're currently experiencing technical difficulties. Please try downloading again shortly."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "Grant type not supported authorization error!",

View File

@@ -222,7 +222,7 @@
},
"technicalDifficulty": {
"title": "May naganap na error!",
"message": "Salamat sa iyong pasensya! Nakakaranas kami ng mga teknikal na paghihirap ngayon. Pakisubukang muli mamaya o makipag-ugnayan sa admin para sa karagdagang tulong!"
"message": "Salamat sa iyong pasensya! Kasalukuyan kaming nakakaranas ng mga teknikal na paghihirap. Pakisubukang mag-download muli sa ilang sandali."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "Ang uri ng grant ay hindi sinusuportahan ng error sa pahintulot!",

View File

@@ -223,7 +223,7 @@
},
"technicalDifficulty": {
"title": "एक त्रुटि पाई गई!",
"message": "आपके धैर्य के लिए धन्यवाद! हम अभी तकनीकी समस्याओं का सामना कर रहे हैं। कृपया बाद में पुनः प्रयास करें या आगे की सहायता के लिए व्यवस्थापक से संपर्क करें!"
"message": "आपके धैर्य के लिए धन्यवाद! हम वर्तमान में तकनीकी कठिनाइयों का सामना कर रहे हैं। कृपया शीघ्र ही पुनः डाउनलोड करने का प्रयास करें"
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "अनुदान प्रकार समर्थित नहीं प्राधिकरण त्रुटि!",

View File

@@ -222,7 +222,7 @@
},
"technicalDifficulty": {
"title": "ದೋಷ ಸಂಭವಿಸಿದೆ!",
"message": "ನಿಮ್ಮ ತಾಳ್ಮೆಗೆ ಧನ್ಯವಾದಗಳು! ನಾವು ಇದೀಗ ತಾಂತ್ರಿಕ ತೊಂದರೆಗಳನ್ನು ಎದುರಿಸುತ್ತಿದ್ದೇವೆ. ದಯವಿಟ್ಟು ನಂತರ ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ ಅಥವಾ ಹೆಚ್ಚಿನ ಸಹಾಯಕ್ಕಾಗಿ ನಿರ್ವಾಹಕರನ್ನು ಸಂಪರ್ಕಿಸಿ!"
"message": "ನಿಮ್ಮ ತಾಳ್ಮೆಗೆ ಧನ್ಯವಾದಗಳು! ನಾವು ಪ್ರಸ್ತುತ ತಾಂತ್ರಿಕ ತೊಂದರೆಗಳನ್ನು ಎದುರಿಸುತ್ತಿದ್ದೇವೆ. ದಯವಿಟ್ಟು ಸ್ವಲ್ಪ ಸಮಯದ ನಂತರ ಡೌನ್‌ಲೋಡ್ ಮಾಡಲು ಪ್ರಯತ್ನಿಸಿ."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "ಅನುದಾನದ ಪ್ರಕಾರವನ್ನು ಬೆಂಬಲಿಸುವುದಿಲ್ಲ ದೃಢೀಕರಣ ದೋಷ!",

View File

@@ -222,7 +222,7 @@
},
"technicalDifficulty": {
"title": "பிழை ஏற்பட்டது!",
"message": "உங்கள் பொறுமைக்கு நன்றி! நாங்கள் தற்போது தொழில்நுட்ப சிக்கல்களை எதிர்கொள்கிறோம். ிறகு முயற்சிக்கவும் அல்லது கூடுதல் உதவிக்கு நிர்வாகியைத் தொடர்பு கொள்ளவும்!"
"message": "உங்கள் பொறுமைக்கு நன்றி! தற்போது தொழில்நுட்ப சிக்கல்களை சந்தித்து வருகிறோம். ிறிது நேரத்தில் மீண்டும் பதிவிக்க முயற்சிக்கவும்."
},
"authorizationGrantTypeNotSupportedByWallet": {
"title": "கிராண்ட் வகை ஆதரிக்கப்படவில்லை அங்கீகார பிழை!",

View File

@@ -4,12 +4,7 @@ import {
OIDCErrors,
selectCredentialRequestKey,
} from '../../shared/openId4VCI/Utils';
import {
MY_VCS_STORE_KEY,
NETWORK_REQUEST_FAILED,
REQUEST_TIMEOUT,
isIOS,
} from '../../shared/constants';
import {isIOS, MY_VCS_STORE_KEY, REQUEST_TIMEOUT} from '../../shared/constants';
import {assign, send} from 'xstate';
import {StoreEvents} from '../store';
import {BackupEvents} from '../backupAndRestore/backup';
@@ -26,6 +21,7 @@ import {TelemetryConstants} from '../../shared/telemetry/TelemetryConstants';
import {NativeModules} from 'react-native';
import {KeyTypes} from '../../shared/cryptoutil/KeyTypes';
import {VCActivityLog} from '../../components/ActivityLogEvent';
import {isNetworkError} from '../../shared/Utils';
const {RNSecureKeystoreModule} = NativeModules;
export const IssuersActions = (model: any) => {
@@ -80,19 +76,20 @@ export const IssuersActions = (model: any) => {
resetSelectedCredentialType: model.assign({
selectedCredentialType: {},
}),
setFetchWellknownError: model.assign({
setNetworkOrTechnicalError: 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;
console.error(
`Error occurred during ${event} flow`,
event.data.message,
);
return isNetworkError(event.data.message)
? ErrorMessage.NO_INTERNET
: ErrorMessage.TECHNICAL_DIFFICULTIES;
},
}),
setCredentialTypeListDownloadFailureError: model.assign({
errorMessage: (_: any, event: any) => {
const error = event.data.message;
if (error.includes(NETWORK_REQUEST_FAILED)) {
if (isNetworkError(event.data.message)) {
return ErrorMessage.NO_INTERNET;
}
return ErrorMessage.CREDENTIAL_TYPE_DOWNLOAD_FAILURE;
@@ -103,7 +100,7 @@ export const IssuersActions = (model: any) => {
errorMessage: (_: any, event: any) => {
console.error(`Error occurred while ${event} -> `, event.data.message);
const error = event.data.message;
if (error.includes(NETWORK_REQUEST_FAILED)) {
if (isNetworkError(error)) {
return ErrorMessage.NO_INTERNET;
}
if (error.includes(REQUEST_TIMEOUT)) {

View File

@@ -101,7 +101,7 @@ export const IssuersMachine = model.createMachine(
target: 'downloadCredentialTypes',
},
onError: {
actions: ['setFetchWellknownError', 'resetLoadingReason'],
actions: ['setNetworkOrTechnicalError', 'resetLoadingReason'],
target: 'error',
},
},
@@ -234,16 +234,15 @@ export const IssuersMachine = model.createMachine(
{
actions: [
'resetSelectedCredentialType',
'setError',
'setNetworkOrTechnicalError',
'resetLoadingReason',
'sendDownloadingFailedToVcMeta',
(_, event) =>
console.error(
'Error Occurred while invoking Auth - ',
event.data,
),
],
target: 'selectingIssuer',
target: 'error',
},
],
},
@@ -265,7 +264,7 @@ export const IssuersMachine = model.createMachine(
'sendDownloadingFailedToVcMeta',
(_, event) =>
console.error(
'Error Occurred while invoking Auth - ',
'Error Occurred while getting key order - ',
event.data,
),
],
@@ -294,7 +293,7 @@ export const IssuersMachine = model.createMachine(
'sendDownloadingFailedToVcMeta',
(_, event) =>
console.error(
'Error Occurred while invoking Auth - ',
'Error Occurred while getting keypair from keystore - ',
event.data,
),
],

View File

@@ -131,10 +131,10 @@ export interface Typegen0 {
| 'loadKeyPair'
| 'logDownloaded'
| 'resetError'
| 'resetIsVerified'
| 'resetLoadingReason'
| 'resetSelectedCredentialType'
| 'resetVerificationErrorMessage'
| 'resetVerificationResult'
| 'sendBackupEvent'
| 'sendDownloadingFailedToVcMeta'
| 'sendErrorEndEvent'
@@ -143,12 +143,13 @@ export interface Typegen0 {
| 'setCredentialTypeListDownloadFailureError'
| 'setCredentialWrapper'
| 'setError'
| 'setFetchWellknownError'
| 'setIsVerified'
| 'setIssuers'
| 'setLoadingReasonAsDisplayIssuers'
| 'setLoadingReasonAsDownloadingCredentials'
| 'setLoadingReasonAsSettingUp'
| 'setMetadataInCredentialData'
| 'setNetworkOrTechnicalError'
| 'setNoInternet'
| 'setOIDCConfigError'
| 'setPrivateKey'
@@ -161,7 +162,6 @@ export interface Typegen0 {
| 'setTokenResponse'
| 'setVCMetadata'
| 'setVerifiableCredential'
| 'setVerificationResult'
| 'storeKeyPair'
| 'storeVcMetaContext'
| 'storeVcsContext'
@@ -210,6 +210,7 @@ export interface Typegen0 {
| 'RESET_ERROR'
| 'TRY_AGAIN'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
resetIsVerified: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
resetLoadingReason:
| 'RESET_ERROR'
| 'done.invoke.checkInternet'
@@ -229,13 +230,11 @@ export interface Typegen0 {
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
resetVerificationErrorMessage: 'RESET_VERIFY_ERROR';
resetVerificationResult: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
sendBackupEvent: 'done.invoke.issuersMachine.storing:invocation[0]';
sendDownloadingFailedToVcMeta:
| 'error.platform.issuersMachine.downloadCredentials:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.getKeyPairFromKeystore:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]';
sendErrorEndEvent: 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
sendImpressionEvent: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
sendSuccessEndEvent: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
@@ -246,9 +245,8 @@ export interface Typegen0 {
| 'error.platform.issuersMachine.downloadCredentials:invocation[0]'
| 'error.platform.issuersMachine.fetchAuthorizationEndpoint:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.getKeyPairFromKeystore:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
setFetchWellknownError: 'error.platform.issuersMachine.downloadIssuerWellknown:invocation[0]';
| 'error.platform.issuersMachine.performAuthorization.setSelectedKey:invocation[0]';
setIsVerified: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
setIssuers: 'done.invoke.issuersMachine.displayIssuers:invocation[0]';
setLoadingReasonAsDisplayIssuers: 'TRY_AGAIN';
setLoadingReasonAsDownloadingCredentials:
@@ -264,6 +262,9 @@ export interface Typegen0 {
setMetadataInCredentialData:
| 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'
| 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
setNetworkOrTechnicalError:
| 'error.platform.issuersMachine.downloadIssuerWellknown:invocation[0]'
| 'error.platform.issuersMachine.performAuthorization:invocation[0]';
setNoInternet: 'done.invoke.checkInternet';
setOIDCConfigError: 'error.platform.issuersMachine.performAuthorization:invocation[0]';
setPrivateKey: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
@@ -278,7 +279,6 @@ export interface Typegen0 {
| 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'
| 'error.platform.issuersMachine.verifyingCredential:invocation[0]';
setVerifiableCredential: 'done.invoke.issuersMachine.downloadCredentials:invocation[0]';
setVerificationResult: 'done.invoke.issuersMachine.verifyingCredential:invocation[0]';
storeKeyPair: 'done.invoke.issuersMachine.generateKeyPair:invocation[0]';
storeVcMetaContext:
| 'done.invoke.issuersMachine.verifyingCredential:invocation[0]'

View File

@@ -52,6 +52,7 @@ export function useIssuerScreenController({route, navigation}) {
service,
selectVerificationErrorMessage,
),
isError: useSelector(service, selectIsError),
CANCEL: () => service.send(IssuerScreenTabEvents.CANCEL()),
SELECTED_ISSUER: id =>

View File

@@ -41,6 +41,7 @@ export const IssuersScreen: React.FC<
const [search, setSearch] = useState('');
const [tapToSearch, setTapToSearch] = useState(false);
const [clearSearchIcon, setClearSearchIcon] = useState(false);
const showFullScreenError = controller.isError && controller.errorMessageType;
const isVerificationFailed = controller.verificationErrorMessage !== '';
@@ -51,7 +52,7 @@ export const IssuersScreen: React.FC<
: t(`errors.verificationFailed.ERR_GENERIC`);
useLayoutEffect(() => {
if (controller.loadingReason || controller.errorMessageType) {
if (controller.loadingReason || showFullScreenError) {
props.navigation.setOptions({
headerShown: false,
});
@@ -202,7 +203,7 @@ export const IssuersScreen: React.FC<
</MessageOverlay>
);
}
if (controller.errorMessageType) {
if (showFullScreenError) {
return (
<Error
testID={`${controller.errorMessageType}Error`}

View File

@@ -1,4 +1,5 @@
import {VCMetadata} from './VCMetadata';
import {NETWORK_REQUEST_FAILED} from './constants';
import {groupBy} from './javascript';
import {Issuers} from './openId4VCI/Utils';
@@ -49,3 +50,7 @@ export const parseJSON = (input: any) => {
}
return result;
};
export const isNetworkError = (error: string) => {
return error.includes(NETWORK_REQUEST_FAILED);
};