From a76c6aa95080c09f64c135e71fd641f98a184d3e Mon Sep 17 00:00:00 2001 From: srikanth716 Date: Fri, 29 Nov 2024 14:52:48 +0530 Subject: [PATCH 1/3] [INJIVER-829] fix ovp error message translation Signed-off-by: srikanth716 --- ui/public/env.config.js | 2 +- .../Home/VerificationSection/QrScanner.tsx | 8 ++------ ui/src/locales/ar.json | 7 +++++-- ui/src/locales/en.json | 7 +++++-- ui/src/locales/es.json | 7 +++++-- ui/src/locales/fr.json | 7 +++++-- ui/src/locales/hi.json | 7 +++++-- ui/src/locales/km.json | 7 +++++-- ui/src/locales/kn.json | 7 +++++-- ui/src/locales/pt.json | 7 +++++-- ui/src/locales/ta.json | 7 +++++-- ui/src/pages/OvpRedirect.tsx | 14 ++++---------- ui/src/utils/config.ts | 7 +++++-- 13 files changed, 57 insertions(+), 37 deletions(-) diff --git a/ui/public/env.config.js b/ui/public/env.config.js index 42c3382a..39f955b8 100644 --- a/ui/public/env.config.js +++ b/ui/public/env.config.js @@ -7,5 +7,5 @@ OVP_QR_HEADER: "INJI_OVP://", DEFAULT_FAVICON: "favicon.ico", INTERNET_CONNECTIVITY_CHECK_ENDPOINT: "https://dns.google/", INTERNET_CONNECTIVITY_CHECK_TIMEOUT: "10000", -VERIFY_SERVICE_API_URL:"/v1/verify" +VERIFY_SERVICE_API_URL: "/v1/verify", } diff --git a/ui/src/components/Home/VerificationSection/QrScanner.tsx b/ui/src/components/Home/VerificationSection/QrScanner.tsx index ed69cca3..5a6ba952 100644 --- a/ui/src/components/Home/VerificationSection/QrScanner.tsx +++ b/ui/src/components/Home/VerificationSection/QrScanner.tsx @@ -9,6 +9,7 @@ import { ZOOM_STEP, ScanSessionExpiryTime, THROTTLE_FRAMES_PER_SEC, + AlertMessages, } from "../../../utils/config"; import { useAppDispatch } from "../../../redux/hooks"; import { @@ -142,12 +143,7 @@ function QrScanner() { timer = setTimeout(() => { dispatch(goToHomeScreen({})); dispatch( - raiseAlert({ - open: true, - message: - "The scan session has expired due to inactivity. Please initiate a new scan.", - severity: "error", - }) + raiseAlert({ ...AlertMessages().scanSessionExpired, open: true }) ); }, ScanSessionExpiryTime); diff --git a/ui/src/locales/ar.json b/ui/src/locales/ar.json index 4e3f24e6..d771ea3f 100644 --- a/ui/src/locales/ar.json +++ b/ui/src/locales/ar.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "حجم الملف غير مدعوم. ", "verificationMethodComingSoon": "قريباً", "unsupportedFileType": "تنسيق الملف غير معتمد. ", - "pageNotFound": "الصفحة غير موجودة!!" + "pageNotFound": "الصفحة غير موجودة!!", + "scanSessionExpired": "انتهت صلاحية جلسة الفحص بسبب عدم النشاط. يرجى بدء فحص جديد." }, "OvpErrors": { "invalidScope": "النطاق غير صالح", @@ -83,7 +84,9 @@ "internalServerError": "نواجه مشكلة في معالجة طلبك. ", "serverUnavailable": "الخدمة غير متوفرة حاليا. ", "invalidVpToken": "أوراق الاعتماد لا تفي بالمتطلبات. ", - "unsupportedFormat": "تنسيقات VP غير مدعومة" + "unsupportedFormat": "تنسيقات VP غير مدعومة", + "invalidResources": "المورد المطلوب غير صالح.", + "invalidParams": "معلمات غير صالحة!!" }, "CopyRight": { "content": "2024 © موسيب - جميع الحقوق محفوظة." diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index 6cf4d503..3dbc11a0 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "File size not supported. The file size should be between 10 KB and 5 MB.", "verificationMethodComingSoon": "Coming soon", "unsupportedFileType": "Unsupported file format. Allowed file formats are: png, jpeg, jpg, pdf", - "pageNotFound": "Page Not Found!!" + "pageNotFound": "Page Not Found!!", + "scanSessionExpired": "The scan session has expired due to inactivity. Please initiate a new scan." }, "OvpErrors": { "invalidScope": "Invalid Scope", @@ -83,7 +84,9 @@ "internalServerError": "We're having trouble processing your request. Please try again later.", "serverUnavailable": "The service is currently unavailable. Please try again later", "invalidVpToken": "The credentials don't meet the requirements. Please check and try again.", - "unsupportedFormat": "VP Formats Not Supported" + "unsupportedFormat": "VP Formats Not Supported", + "invalidResources": "The requested resource is invalid.", + "invalidParams": "Invalid Parameters!!" }, "CopyRight": { "content": "2024 © MOSIP - All rights reserved." diff --git a/ui/src/locales/es.json b/ui/src/locales/es.json index a6733006..e2906964 100644 --- a/ui/src/locales/es.json +++ b/ui/src/locales/es.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "El tamaño del archivo no es compatible. El tamaño del archivo debe estar entre 10 KB y 5 MB", "verificationMethodComingSoon": "Muy pronto", "unsupportedFileType": "Formato de archivo no compatible. Los formatos de archivo permitidos son: png, jpeg, jpg, pdf", - "pageNotFound": "¡¡Página no encontrada!!" + "pageNotFound": "¡¡Página no encontrada!!", + "scanSessionExpired": "La sesión de escaneo ha caducado debido a inactividad. Inicie un nuevo análisis." }, "OvpErrors": { "invalidScope": "Alcance no válido", @@ -83,7 +84,9 @@ "internalServerError": "Estamos teniendo problemas para procesar su solicitud. Vuelva a intentarlo más tarde", "serverUnavailable": "El servicio no está disponible actualmente. Vuelva a intentarlo más tarde", "invalidVpToken": "Las credenciales no cumplen con los requisitos. Verifique e inténtelo nuevamente", - "unsupportedFormat": "Formatos VP no admitidos" + "unsupportedFormat": "Formatos VP no admitidos", + "invalidResources": "El recurso solicitado no es válido.", + "invalidParams": "¡¡Parámetros no válidos!!" }, "CopyRight": { "content": "2024 © MOSIP - Todos los derechos reservados." diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index 7ca912ed..432d2cba 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "Taille de fichier non prise en charge. ", "verificationMethodComingSoon": "À venir", "unsupportedFileType": "Format de fichier non pris en charge. ", - "pageNotFound": "Page introuvable !!" + "pageNotFound": "Page introuvable !!", + "scanSessionExpired": "La session d'analyse a expiré pour cause d'inactivité. Veuillez lancer une nouvelle analyse." }, "OvpErrors": { "invalidScope": "Portée invalide", @@ -83,7 +84,9 @@ "internalServerError": "Nous rencontrons des difficultés pour traiter votre demande. ", "serverUnavailable": "Le service est actuellement indisponible. ", "invalidVpToken": "Les informations d'identification ne répondent pas aux exigences. ", - "unsupportedFormat": "Formats VP non pris en charge" + "unsupportedFormat": "Formats VP non pris en charge", + "invalidResources": "La ressource demandée n'est pas valide.", + "invalidParams": "Paramètres invalides !!" }, "CopyRight": { "content": "2024 © MOSIP - Tous droits réservés." diff --git a/ui/src/locales/hi.json b/ui/src/locales/hi.json index f3b2236f..f61d0850 100644 --- a/ui/src/locales/hi.json +++ b/ui/src/locales/hi.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "फ़ाइल का आकार समर्थित नहीं है. ", "verificationMethodComingSoon": "जल्द आ रहा है", "unsupportedFileType": "असमर्थित फ़ाइल स्वरूप। ", - "pageNotFound": "पृष्ठ नहीं मिला!!" + "pageNotFound": "पृष्ठ नहीं मिला!!", + "scanSessionExpired": "निष्क्रियता के कारण स्कैन सत्र समाप्त हो गया है। कृपया एक नया स्कैन आरंभ करें." }, "OvpErrors": { "invalidScope": "अमान्य दायरा", @@ -83,7 +84,9 @@ "internalServerError": "हमें आपका अनुरोध संसाधित करने में परेशानी हो रही है. ", "serverUnavailable": "सेवा वर्तमान में अनुपलब्ध है. ", "invalidVpToken": "क्रेडेंशियल आवश्यकताओं को पूरा नहीं करते. ", - "unsupportedFormat": "वीपी प्रारूप समर्थित नहीं हैं" + "unsupportedFormat": "वीपी प्रारूप समर्थित नहीं हैं", + "invalidResources": "अनुरोधित संसाधन अमान्य है.", + "invalidParams": "अमान्य मापदण्ड!!" }, "CopyRight": { "content": "2024 © MOSIP - सर्वाधिकार सुरक्षित।" diff --git a/ui/src/locales/km.json b/ui/src/locales/km.json index 4f837dd9..e752ae72 100644 --- a/ui/src/locales/km.json +++ b/ui/src/locales/km.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "ទំហំឯកសារមិនត្រូវបានគាំទ្រ។ ទំហំឯកសារគួរមានចន្លោះពី 10 KB និង 5 MB", "verificationMethodComingSoon": "មកដល់ឆាប់ៗនេះ", "unsupportedFileType": "ទម្រង់ឯកសារមិនគាំទ្រ។ ទម្រង់ឯកសារដែលបានអនុញ្ញាតគឺ៖ png, jpeg, jpg, pdf", - "pageNotFound": "រកមិនឃើញទំព័រ!!" + "pageNotFound": "រកមិនឃើញទំព័រ!!", + "scanSessionExpired": "វគ្គស្កេនបានផុតកំណត់ដោយសារអសកម្ម។ សូមចាប់ផ្តើមការស្កេនថ្មី។" }, "OvpErrors": { "invalidScope": "វិសាលភាពមិនត្រឹមត្រូវ", @@ -83,7 +84,9 @@ "internalServerError": "យើងមានបញ្ហាក្នុងដំណើរការសំណើរបស់អ្នក។ សូមព្យាយាមម្តងទៀតពេលក្រោយ។", "serverUnavailable": "សេវាកម្មបច្ចុប្បន្នមិនអាចប្រើបាន។ សូមព្យាយាមម្តងទៀតនៅពេលក្រោយ", "invalidVpToken": "ព័ត៌មានបញ្ជាក់អត្តសញ្ញាណមិនបំពេញតាមតម្រូវការ។ សូមពិនិត្យ ហើយព្យាយាមម្តងទៀត។", - "unsupportedFormat": "ទម្រង់ VP មិនត្រូវបានគាំទ្រ" + "unsupportedFormat": "ទម្រង់ VP មិនត្រូវបានគាំទ្រ", + "invalidResources": "ធនធានដែលបានស្នើគឺមិនត្រឹមត្រូវ។", + "invalidParams": "ប៉ារ៉ាម៉ែត្រ​មិន​ត្រឹមត្រូវ!!" }, "CopyRight": { "content": "2024 © MOSIP - រក្សាសិទ្ធិគ្រប់យ៉ាង។" diff --git a/ui/src/locales/kn.json b/ui/src/locales/kn.json index 3b13d244..0daaa3cb 100644 --- a/ui/src/locales/kn.json +++ b/ui/src/locales/kn.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "ಫೈಲ್ ಗಾತ್ರವು ಬೆಂಬಲಿತವಾಗಿಲ್ಲ. ", "verificationMethodComingSoon": "ಶೀಘ್ರದಲ್ಲೇ ಬರಲಿದೆ", "unsupportedFileType": "ಬೆಂಬಲಿಸದ ಫೈಲ್ ಫಾರ್ಮ್ಯಾಟ್. ", - "pageNotFound": "ಪುಟ ಕಂಡುಬಂದಿಲ್ಲ!!" + "pageNotFound": "ಪುಟ ಕಂಡುಬಂದಿಲ್ಲ!!", + "scanSessionExpired": "ನಿಷ್ಕ್ರಿಯತೆಯಿಂದಾಗಿ ಸ್ಕ್ಯಾನ್ ಸೆಷನ್ ಅವಧಿ ಮೀರಿದೆ. ದಯವಿಟ್ಟು ಹೊಸ ಸ್ಕ್ಯಾನ್ ಅನ್ನು ಪ್ರಾರಂಭಿಸಿ." }, "OvpErrors": { "invalidScope": "ಅಮಾನ್ಯ ವ್ಯಾಪ್ತಿ", @@ -83,7 +84,9 @@ "internalServerError": "ನಿಮ್ಮ ವಿನಂತಿಯನ್ನು ಪ್ರಕ್ರಿಯೆಗೊಳಿಸುವಲ್ಲಿ ನಾವು ಸಮಸ್ಯೆಯನ್ನು ಎದುರಿಸುತ್ತಿದ್ದೇವೆ. ", "serverUnavailable": "ಸೇವೆಯು ಪ್ರಸ್ತುತ ಲಭ್ಯವಿಲ್ಲ. ", "invalidVpToken": "ರುಜುವಾತುಗಳು ಅವಶ್ಯಕತೆಗಳನ್ನು ಪೂರೈಸುವುದಿಲ್ಲ. ", - "unsupportedFormat": "VP ಫಾರ್ಮ್ಯಾಟ್‌ಗಳು ಬೆಂಬಲಿತವಾಗಿಲ್ಲ" + "unsupportedFormat": "VP ಫಾರ್ಮ್ಯಾಟ್‌ಗಳು ಬೆಂಬಲಿತವಾಗಿಲ್ಲ", + "invalidResources": "ವಿನಂತಿಸಿದ ಸಂಪನ್ಮೂಲವು ಅಮಾನ್ಯವಾಗಿದೆ.", + "invalidParams": "ಅಮಾನ್ಯ ಪ್ಯಾರಾಮೀಟರ್‌ಗಳು!!" }, "CopyRight": { "content": "2024 © MOSIP - ಎಲ್ಲಾ ಹಕ್ಕುಗಳನ್ನು ಕಾಯ್ದಿರಿಸಲಾಗಿದೆ." diff --git a/ui/src/locales/pt.json b/ui/src/locales/pt.json index 267aa673..22850641 100644 --- a/ui/src/locales/pt.json +++ b/ui/src/locales/pt.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "Tamanho do arquivo não suportado. O tamanho do arquivo deve estar entre 10 KB e 5 MB.", "verificationMethodComingSoon": "Em breve", "unsupportedFileType": "Formato de arquivo não suportado. Os formatos de arquivo permitidos são: png, jpeg, jpg, pdf", - "pageNotFound": "Página não encontrada!!" + "pageNotFound": "Página não encontrada!!", + "scanSessionExpired": "A sessão de verificação expirou devido à inatividade. Por favor, inicie uma nova verificação." }, "OvpErrors": { "invalidScope": "Escopo inválido", @@ -83,7 +84,9 @@ "internalServerError": "Estamos com problemas para processar sua solicitação. Por favor, tente novamente mais tarde.", "serverUnavailable": "O serviço não está disponível no momento. Tente novamente mais tarde.", "invalidVpToken": "O serviço está indisponível no momento. Por favor, tente novamente mais tarde.", - "unsupportedFormat": "Formatos VP não suportados" + "unsupportedFormat": "Formatos VP não suportados", + "invalidResources": "O recurso solicitado é inválido.", + "invalidParams": "Parâmetros inválidos!!" }, "CopyRight": { "content": "2024 © MOSIP – Todos os direitos reservados." diff --git a/ui/src/locales/ta.json b/ui/src/locales/ta.json index 691626e2..59bacf1c 100644 --- a/ui/src/locales/ta.json +++ b/ui/src/locales/ta.json @@ -68,7 +68,8 @@ "unsupportedFileSize": "கோப்பு அளவு ஆதரிக்கப்படவில்லை. ", "verificationMethodComingSoon": "விரைவில் வரும்", "unsupportedFileType": "ஆதரிக்கப்படாத கோப்பு வடிவம். ", - "pageNotFound": "பக்கம் கிடைக்கவில்லை!!" + "pageNotFound": "பக்கம் கிடைக்கவில்லை!!", + "scanSessionExpired": "செயலற்ற தன்மை காரணமாக ஸ்கேன் அமர்வு காலாவதியானது. தயவுசெய்து புதிய ஸ்கேனைத் தொடங்கவும்." }, "OvpErrors": { "invalidScope": "தவறான நோக்கம்", @@ -83,7 +84,9 @@ "internalServerError": "உங்கள் கோரிக்கையைச் செயல்படுத்துவதில் சிக்கல் உள்ளது. ", "serverUnavailable": "சேவை தற்போது கிடைக்கவில்லை. ", "invalidVpToken": "நற்சான்றிதழ்கள் தேவைகளைப் பூர்த்தி செய்யவில்லை. ", - "unsupportedFormat": "VP வடிவங்கள் ஆதரிக்கப்படவில்லை" + "unsupportedFormat": "VP வடிவங்கள் ஆதரிக்கப்படவில்லை", + "invalidResources": "கோரப்பட்ட ஆதாரம் தவறானது.", + "invalidParams": "தவறான அளவுருக்கள்!!" }, "CopyRight": { "content": "2024 © MOSIP - அனைத்து உரிமைகளும் பாதுகாக்கப்பட்டவை." diff --git a/ui/src/pages/OvpRedirect.tsx b/ui/src/pages/OvpRedirect.tsx index 31b0e0c2..ffc921f4 100644 --- a/ui/src/pages/OvpRedirect.tsx +++ b/ui/src/pages/OvpRedirect.tsx @@ -13,7 +13,7 @@ function OvpRedirect(props: any) { const dispatch = useAppDispatch(); useEffect(() => { - let vpToken, presentationSubmission, error, errorDescription; + let vpToken, presentationSubmission, error; try { const params = new URLSearchParams(location.hash.substring(1)); const queryParams = new URLSearchParams(location.search.substring(1)); @@ -26,7 +26,6 @@ function OvpRedirect(props: any) { : undefined; error = queryParams.get("error"); - errorDescription = queryParams.get("error_description"); } catch (error) { console.error("Error occurred while reading params in redirect url, Error: ", error); @@ -37,15 +36,10 @@ function OvpRedirect(props: any) { dispatch(verificationInit({ovp: {vpToken, presentationSubmission}})); } else if (!!error) { const OvpErrorMessages = OvpErrors(); - dispatch(raiseAlert( - { - message: OvpErrorMessages[error] - ?? errorDescription - ?? "Something Went Wrong!!", - severity: "error" - })); + dispatch(raiseAlert({message: OvpErrorMessages.error ?? OvpErrorMessages.error ?? OvpErrorMessages.resourceNotFound, severity: "error"})); } else { - dispatch(raiseAlert({message: "Invalid Parameters!!", severity: "error"})) + const OvpErrorMessages = OvpErrors(); + dispatch(raiseAlert({message: OvpErrorMessages.invalid_params, severity: "error"})) } } }, [location, navigate, dispatch]); diff --git a/ui/src/utils/config.ts b/ui/src/utils/config.ts index 60ba6c40..3d45025a 100644 --- a/ui/src/utils/config.ts +++ b/ui/src/utils/config.ts @@ -79,7 +79,8 @@ export const AlertMessages =()=> { unsupportedFileSize: {message: i18next.t("AlertMessages:unsupportedFileSize"), severity: "error"} as AlertInfo, verificationMethodComingSoon: {message: i18next.t("AlertMessages:verificationMethodComingSoon"), severity: "warning"} as AlertInfo, unsupportedFileType: {message: i18next.t("AlertMessages:unsupportedFileType"), severity: "error"} as AlertInfo, - pageNotFound: {message: i18next.t("AlertMessages:pageNotFound"), severity: "error"} as AlertInfo + pageNotFound: {message: i18next.t("AlertMessages:pageNotFound"), severity: "error"} as AlertInfo, + scanSessionExpired: {message: i18next.t("AlertMessages:scanSessionExpired"), severity: "error"} as AlertInfo } }; @@ -99,7 +100,9 @@ export const OvpErrors: any = () => { internal_server_error: i18next.t("OvpErrors:internalServerError"), server_unavailable: i18next.t("OvpErrors:serverUnavailable"), invalid_vp_token: i18next.t("OvpErrors:invalidVpToken"), - unsupported_format: i18next.t("OvpErrors:unsupportedFormat") + unsupported_format: i18next.t("OvpErrors:unsupportedFormat"), + invalid_resource:i18next.t("OvpErrors:invalidResources"), + invalid_params:i18next.t("OvpErrors:invalidParams"), }; }; From bdc97a95a9a9bde84c82b71eae250fe118afed7e Mon Sep 17 00:00:00 2001 From: srikanth716 Date: Mon, 2 Dec 2024 11:48:16 +0530 Subject: [PATCH 2/3] [INJIVER-829] fix ovp error message translation Signed-off-by: srikanth716 --- ui/src/pages/OvpRedirect.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/pages/OvpRedirect.tsx b/ui/src/pages/OvpRedirect.tsx index ffc921f4..bebd68e0 100644 --- a/ui/src/pages/OvpRedirect.tsx +++ b/ui/src/pages/OvpRedirect.tsx @@ -36,10 +36,10 @@ function OvpRedirect(props: any) { dispatch(verificationInit({ovp: {vpToken, presentationSubmission}})); } else if (!!error) { const OvpErrorMessages = OvpErrors(); - dispatch(raiseAlert({message: OvpErrorMessages.error ?? OvpErrorMessages.error ?? OvpErrorMessages.resourceNotFound, severity: "error"})); + dispatch(raiseAlert({message: OvpErrorMessages[error] ?? OvpErrorMessages[error] ?? OvpErrorMessages["resource_not_found"], severity: "error"})); } else { const OvpErrorMessages = OvpErrors(); - dispatch(raiseAlert({message: OvpErrorMessages.invalid_params, severity: "error"})) + dispatch(raiseAlert({message: OvpErrorMessages["invalid_params"], severity: "error"})) } } }, [location, navigate, dispatch]); From de445485fdc753027bfcf6647e4d09bb34183e3e Mon Sep 17 00:00:00 2001 From: srikanth716 Date: Mon, 2 Dec 2024 12:16:23 +0530 Subject: [PATCH 3/3] [INJIVER-829] fix ovp error message translation Signed-off-by: srikanth716 --- ui/src/pages/OvpRedirect.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/pages/OvpRedirect.tsx b/ui/src/pages/OvpRedirect.tsx index bebd68e0..42413103 100644 --- a/ui/src/pages/OvpRedirect.tsx +++ b/ui/src/pages/OvpRedirect.tsx @@ -36,10 +36,10 @@ function OvpRedirect(props: any) { dispatch(verificationInit({ovp: {vpToken, presentationSubmission}})); } else if (!!error) { const OvpErrorMessages = OvpErrors(); - dispatch(raiseAlert({message: OvpErrorMessages[error] ?? OvpErrorMessages[error] ?? OvpErrorMessages["resource_not_found"], severity: "error"})); + dispatch(raiseAlert({message: OvpErrorMessages.error ?? OvpErrorMessages[error] ?? OvpErrorMessages.resource_not_found, severity: "error"})); } else { const OvpErrorMessages = OvpErrors(); - dispatch(raiseAlert({message: OvpErrorMessages["invalid_params"], severity: "error"})) + dispatch(raiseAlert({message: OvpErrorMessages.invalid_params, severity: "error"})) } } }, [location, navigate, dispatch]);