From 187f4a08ec2830e5f189f8283cf50cab13b7c60d Mon Sep 17 00:00:00 2001 From: Gordon Grund <80682839+ggrund-tsi@users.noreply.github.com> Date: Fri, 13 May 2022 14:33:18 +0200 Subject: [PATCH] feat: icao (#296) * initial icao * add usings * remove warnings * update json with pattern * cut react from transliteration; update licence tex * improve transliteration * exclude transliteration * remove space from pattern; fix return bug * added missing cyrillic letters * changed 0402 to 040B Co-authored-by: fOppenheimer --- package.json | 2 +- src/api.tsx | 2 +- src/assets/JSON/icao.json | 1265 +++++++++++++++++ src/components/landing-page.component.tsx | 2 +- .../modals/confirm-modal.component.tsx | 2 +- .../modals/dataprivacy.component.tsx | 2 +- .../modals/error-page.component.tsx | 2 +- .../modals/group-modal.component.tsx | 2 +- src/components/modals/imprint.component.tsx | 2 +- .../modals/notification-page.component.tsx | 2 +- .../modals/notification-toast.component.tsx | 2 +- .../modals/process-input.component.tsx | 2 +- .../modals/user-modal.component.tsx | 2 +- src/components/modules/address-inputs.tsx | 25 + .../modules/card-footer.component.tsx | 25 + .../modules/card-header.component.tsx | 25 + .../modules/disclamer-btn.component.tsx | 25 + src/components/modules/footer.component.tsx | 2 +- .../modules/form-group.component.tsx | 25 + .../modules/group-table.component.tsx | 25 + src/components/modules/header.component.tsx | 2 +- .../modules/paged-list.component.tsx | 2 +- src/components/modules/person-data-inputs.tsx | 65 +- .../modules/private-route.component.tsx | 2 +- .../modules/statistic-data.component.tsx | 2 +- src/components/modules/test-result-inputs.tsx | 25 + .../modules/user-table.component.tsx | 25 + src/components/qr-scan.component.tsx | 2 +- .../record-patient-data.component.tsx | 28 +- .../record-test-result.component.tsx | 2 +- src/components/reports.tsx | 2 +- .../show-patient-data.component.tsx | 4 +- src/components/spinner/spinner.component.tsx | 2 +- src/components/statistics.component.tsx | 2 +- src/components/user-management.component.tsx | 2 +- src/i18n.tsx | 2 +- src/index.tsx | 2 +- src/login-interceptor.component.tsx | 2 +- src/misc/appContext.tsx | 25 + src/misc/enum.tsx | 2 +- src/misc/error.tsx | 2 +- src/misc/qr-code-value.tsx | 2 +- src/misc/qt-archiv.tsx | 2 +- src/misc/quick-test.tsx | 2 +- src/misc/statistic-data.tsx | 2 +- src/misc/test-result.tsx | 2 +- src/misc/useLocalStorage.tsx | 2 +- src/misc/useNavigation.tsx | 2 +- src/misc/useOnUnload.tsx | 25 + src/misc/useTransliterate.tsx | 69 + src/misc/useValueSet.tsx | 2 +- src/misc/user.tsx | 2 +- src/misc/utils.tsx | 4 +- src/react-app-env.d.ts | 2 +- src/reportWebVitals.ts | 2 +- src/root.component.tsx | 2 +- src/routing.component.tsx | 2 +- src/setupTests.ts | 2 +- 58 files changed, 1700 insertions(+), 69 deletions(-) create mode 100644 src/assets/JSON/icao.json create mode 100644 src/misc/useTransliterate.tsx diff --git a/package.json b/package.json index 4dde904..f4829ca 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "husky": "^5.1.3", "i18next": "^19.9.2", "i18next-resource-store-loader": "^0.1.2", - "jquery": "1.9.1", + "icao-transliteration": "https://github.com/corona-warn-app/cwa-icao-transliteration.git", "keycloak-js": "^12.0.4", "lint-staged": "^10.5.4", "moment": "^2.29.1", diff --git a/src/api.tsx b/src/api.tsx index b679614..0278635 100644 --- a/src/api.tsx +++ b/src/api.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/assets/JSON/icao.json b/src/assets/JSON/icao.json new file mode 100644 index 0000000..4c5c993 --- /dev/null +++ b/src/assets/JSON/icao.json @@ -0,0 +1,1265 @@ +{ + "pattern": { + "mrz": "^[0-9A-Z<\\s]*$/g", + "findAllNonLetterNonNumber": "(?![\\p{N}<])(\\P{L})/gu", + "findAllSpaces": "[\\s\uFEFF\\xA0]+/g", + "findAllDeviding": "[\\s,-]+/g", + "findAllLessThan": "[<]+/g" + }, + "transliterations": [ + { + "utf8": "\u00C0", + "character": "À", + "description": "A grave", + "mrz": "A" + }, + { + "utf8": "\u00C1", + "character": "Á", + "description": "A acute", + "mrz": "A" + }, + { + "utf8": "\u00C2", + "character": "Â", + "description": "A circumflex", + "mrz": "A" + }, + { + "utf8": "\u00C3", + "character": "Ã", + "description": "A tilde", + "mrz": "A" + }, + { + "utf8": "\u00C4", + "character": "Ä", + "description": "A diaeresis", + "mrz": "AE" + }, + { + "utf8": "\u00C5", + "character": "Å", + "description": "A ring above", + "mrz": "AA" + }, + { + "utf8": "\u00C6", + "character": "Æ", + "description": "ligature AE", + "mrz": "AE" + }, + { + "utf8": "\u00C7", + "character": "Ç", + "description": "C cedilla", + "mrz": "C" + }, + { + "utf8": "\u00C8", + "character": "È", + "description": "E grave", + "mrz": "E" + }, + { + "utf8": "\u00C9", + "character": "É", + "description": "E acute", + "mrz": "E" + }, + { + "utf8": "\u00CA", + "character": "Ê", + "description": "E circumflex", + "mrz": "E" + }, + { + "utf8": "\u00CB", + "character": "Ë", + "description": "E diaeresis", + "mrz": "E" + }, + { + "utf8": "\u00CC", + "character": "Ì", + "description": "I grave", + "mrz": "I" + }, + { + "utf8": "\u00CD", + "character": "Í", + "description": "I acute", + "mrz": "I" + }, + { + "utf8": "\u00CE", + "character": "Î", + "description": "I circumflex", + "mrz": "I" + }, + { + "utf8": "\u00CF", + "character": "Ï", + "description": "I diaeresis", + "mrz": "I" + }, + { + "utf8": "\u00D0", + "character": "Ð", + "description": "Eth", + "mrz": "D" + }, + { + "utf8": "\u00D1", + "character": "Ñ", + "description": "N tilde N or NXX", + "mrz": "N" + }, + { + "utf8": "\u00D2", + "character": "Ò", + "description": "O grave", + "mrz": "O" + }, + { + "utf8": "\u00D3", + "character": "Ó", + "description": "O acute", + "mrz": "O" + }, + { + "utf8": "\u00D4", + "character": "Ó", + "description": "O acute", + "mrz": "O" + }, + { + "utf8": "\u00D5", + "character": "Ô", + "description": "O circumflex", + "mrz": "O" + }, + { + "utf8": "\u00D6", + "character": "Ö", + "description": "O diaeresis OE or O", + "mrz": "OE" + }, + { + "utf8": "\u00D8", + "character": "Ø", + "description": "O stroke", + "mrz": "OE" + }, + { + "utf8": "\u00D9", + "character": "Ù", + "description": "U grave", + "mrz": "U" + }, + { + "utf8": "\u00DA", + "character": "Ú", + "description": "U acute", + "mrz": "U" + }, + { + "utf8": "\u00DB", + "character": "Û", + "description": "U circumflex", + "mrz": "U" + }, + { + "utf8": "\u00DC", + "character": "Ü", + "description": "U diaeresis UE or UXX or U", + "mrz": "UE" + }, + { + "utf8": "\u00DD", + "character": "Ý", + "description": "Y acute", + "mrz": "Y" + }, + { + "utf8": "\u00DE", + "character": "Þ", + "description": "Thorn (Iceland)", + "mrz": "TH" + }, + { + "utf8": "\u0100", + "character": "Ā", + "description": "A macron", + "mrz": "A" + }, + { + "utf8": "\u0102", + "character": "Ă", + "description": "A breve", + "mrz": "A" + }, + { + "utf8": "\u0104", + "character": "Ą", + "description": "A ogonek", + "mrz": "A" + }, + { + "utf8": "\u0106", + "character": "Ć", + "description": "C acute", + "mrz": "C" + }, + { + "utf8": "\u0108", + "character": "Ĉ", + "description": "C circumflex", + "mrz": "C" + }, + { + "utf8": "\u010A", + "character": "Ċ", + "description": "C dot above", + "mrz": "C" + }, + { + "utf8": "\u010C", + "character": "Č", + "description": "C caron", + "mrz": "C" + }, + { + "utf8": "\u010E", + "character": "Ď", + "description": "D caron", + "mrz": "D" + }, + { + "utf8": "\u0110", + "character": "Ð", + "description": "D stroke", + "mrz": "D" + }, + { + "utf8": "\u0112", + "character": "Ē", + "description": "E macron", + "mrz": "E" + }, + { + "utf8": "\u0114", + "character": "Ĕ", + "description": "E breve", + "mrz": "E" + }, + { + "utf8": "\u0116", + "character": "Ė", + "description": "E dot above", + "mrz": "E" + }, + { + "utf8": "\u0118", + "character": "Ę", + "description": "E ogonek", + "mrz": "E" + }, + { + "utf8": "\u011A", + "character": "Ě", + "description": "E caron", + "mrz": "E" + }, + { + "utf8": "\u011C", + "character": "Ĝ", + "description": "G circumflex", + "mrz": "G" + }, + { + "utf8": "\u011C", + "character": "Ğ", + "description": "G breve", + "mrz": "G" + }, + { + "utf8": "\u011C", + "character": "Ġ", + "description": "G dot above", + "mrz": "G" + }, + { + "utf8": "\u011C", + "character": "Ģ", + "description": "G cedilla", + "mrz": "G" + }, + { + "utf8": "\u0124", + "character": "Ĥ", + "description": "H circumflex", + "mrz": "H" + }, + { + "utf8": "\u0126", + "character": "Ħ", + "description": "H stroke", + "mrz": "H" + }, + { + "utf8": "\u0128", + "character": "Ĩ", + "description": "I tilde", + "mrz": "I" + }, + { + "utf8": "\u012A", + "character": "Ī", + "description": "I macron", + "mrz": "I" + }, + { + "utf8": "\u012C", + "character": "Ĭ", + "description": "I breve", + "mrz": "I" + }, + { + "utf8": "\u012E", + "character": "Į", + "description": "I ogonek", + "mrz": "I" + }, + { + "utf8": "\u0130", + "character": "İ", + "description": "I dot above", + "mrz": "I" + }, + { + "utf8": "\u0131", + "character": "I", + "description": "I without dot (Turkey)", + "mrz": "I" + }, + { + "utf8": "\u0132", + "character": "IJ", + "description": "ligature IJ", + "mrz": "IJ" + }, + { + "utf8": "\u0134", + "character": "Ĵ", + "description": "J circumflex", + "mrz": "J" + }, + { + "utf8": "\u0136", + "character": "Ķ", + "description": "K cedilla", + "mrz": "K" + }, + { + "utf8": "\u0139", + "character": "Ĺ", + "description": "L acute", + "mrz": "L" + }, + { + "utf8": "\u013B", + "character": "Ļ", + "description": "L cedilla", + "mrz": "L" + }, + { + "utf8": "\u013D", + "character": "Ľ", + "description": "L caron", + "mrz": "L" + }, + { + "utf8": "\u013F", + "character": "Ŀ", + "description": "L middle dot", + "mrz": "L" + }, + { + "utf8": "\u0141", + "character": "Ł", + "description": "L stroke", + "mrz": "L" + }, + { + "utf8": "\u0143", + "character": "Ń", + "description": "N acute", + "mrz": "N" + }, + { + "utf8": "\u0145", + "character": "Ņ", + "description": "N cedilla", + "mrz": "N" + }, + { + "utf8": "\u0147", + "character": "Ň", + "description": "N caron", + "mrz": "N" + }, + { + "utf8": "\u014A", + "character": "Ŋ", + "description": "Eng", + "mrz": "N" + }, + { + "utf8": "\u014C", + "character": "Ō", + "description": "O macron", + "mrz": "O" + }, + { + "utf8": "\u014E", + "character": "Ŏ", + "description": "O breve", + "mrz": "O" + }, + { + "utf8": "\u0150", + "character": "Ő", + "description": "O double acute", + "mrz": "O" + }, + { + "utf8": "\u0152", + "character": "Œ", + "description": "ligature OE", + "mrz": "OE" + }, + { + "utf8": "\u0154", + "character": "Ŕ", + "description": "R acute", + "mrz": "R" + }, + { + "utf8": "\u0156", + "character": "Ŗ", + "description": "R cedilla", + "mrz": "R" + }, + { + "utf8": "\u0158", + "character": "Ř", + "description": "R caron", + "mrz": "R" + }, + { + "utf8": "\u015A", + "character": "Ś", + "description": "S acute", + "mrz": "S" + }, + { + "utf8": "\u015C", + "character": "Ŝ", + "description": "S circumflex", + "mrz": "S" + }, + { + "utf8": "\u015E", + "character": "Ş", + "description": "S cedilla", + "mrz": "S" + }, + { + "utf8": "\u0160", + "character": "Š", + "description": "S caron", + "mrz": "S" + }, + { + "utf8": "\u0162", + "character": "Ţ", + "description": "T cedilla", + "mrz": "T" + }, + { + "utf8": "\u0164", + "character": "Ť", + "description": "T caron", + "mrz": "T" + }, + { + "utf8": "\u0166", + "character": "Ŧ", + "description": "T stroke", + "mrz": "T" + }, + { + "utf8": "\u0168", + "character": "Ũ", + "description": "U tilde", + "mrz": "U" + }, + { + "utf8": "\u016A", + "character": "Ū", + "description": "U macron", + "mrz": "U" + }, + { + "utf8": "\u016C", + "character": "Ŭ", + "description": "U breve", + "mrz": "U" + }, + { + "utf8": "\u016E", + "character": "Ů", + "description": "U ring above", + "mrz": "U" + }, + { + "utf8": "\u0170", + "character": "Ű", + "description": "U double acute", + "mrz": "U" + }, + { + "utf8": "\u0172", + "character": "Ų", + "description": "U ogonek", + "mrz": "U" + }, + { + "utf8": "\u0174", + "character": "Ŵ", + "description": "W circumflex", + "mrz": "W" + }, + { + "utf8": "\u0176", + "character": "Ŷ", + "description": "Y circumflex", + "mrz": "Y" + }, + { + "utf8": "\u0178", + "character": "Ÿ", + "description": "Y diaeresis", + "mrz": "Y" + }, + { + "utf8": "\u0179", + "character": "Ź", + "description": "Z acute", + "mrz": "Z" + }, + { + "utf8": "\u017B", + "character": "Ż", + "description": "Z dot above", + "mrz": "Z" + }, + { + "utf8": "\u017D", + "character": "Ź", + "description": "Z caron", + "mrz": "Z" + }, + { + "utf8": "\u1E9E", + "character": "ẞ", + "description": "double s (Germany)", + "mrz": "SS" + }, + { + "utf8": "\u0401", + "character": "Ð", + "description": "Cyrillic Character Ё (except Belorussian = IO)", + "mrz": "E" + }, + { + "utf8": "\u040B", + "character": "Ћ", + "description": "Cyrillic Character D falsch lt. Windows-Zeichentabelle \u040B", + "mrz": "D" + }, + { + "utf8": "\u0404", + "character": "Є", + "description": "Cyrillic Character IE (except if Ukrainian first character, then =YE)", + "mrz": "IE" + }, + { + "utf8": "\u0405", + "character": "Ѕ", + "description": "Cyrillic Character Ѕ", + "mrz": "DZ" + }, + { + "utf8": "\u0406", + "character": "І", + "description": "Cyrillic Character І", + "mrz": "I" + }, + { + "utf8": "\u0407", + "character": "Ї", + "description": "Cyrillic Character IE I (except if Ukrainian first character, then =YI)", + "mrz": "I" + }, + { + "utf8": "\u0408", + "character": "Ј", + "description": "Cyrillic Character Ј", + "mrz": "J" + }, + { + "utf8": "\u0409", + "character": "Љ", + "description": "Cyrillic Character Љ", + "mrz": "LJ" + }, + { + "utf8": "\u040A", + "character": "Њ", + "description": "Cyrillic Character Њ", + "mrz": "NJ" + }, + { + "utf8": "\u040C", + "character": "Ќ", + "description": "Cyrillic Character K (except in the language spoken in the former Yugoslav Republic of Macedonia = KJ)", + "mrz": "K" + }, + { + "utf8": "\u040E", + "character": "ў", + "description": "Cyrillic Character U", + "mrz": "U" + }, + { + "utf8": "\u040F", + "character": "Џ", + "description": "Cyrillic Character DZ (except in the language spoken in the former Yugoslav Republic of Macedonia = DJ)", + "mrz": "DZ" + }, + { + "utf8": "\u0410", + "character": "А", + "description": "Cyrillic Character А", + "mrz": "A" + }, + { + "utf8": "\u0411", + "character": "Б", + "description": "Cyrillic Character Б", + "mrz": "B" + }, + { + "utf8": "\u0412", + "character": "В", + "description": "Cyrillic Character В", + "mrz": "V" + }, + { + "utf8": "\u0413", + "character": "Г", + "description": "Cyrillic Character G (except Belorussian, Serbian, and Ukrainian = H)", + "mrz": "G" + }, + { + "utf8": "\u0414", + "character": "Д", + "description": "Cyrillic Character Д", + "mrz": "D" + }, + { + "utf8": "\u0415", + "character": "Е", + "description": "Cyrillic Character Е", + "mrz": "E" + }, + { + "utf8": "\u0416", + "character": "Ж", + "description": "Cyrillic Character ZH (except Serbian = Z)", + "mrz": "ZH" + }, + { + "utf8": "\u0417", + "character": "З", + "description": "Cyrillic Character З", + "mrz": "Z" + }, + { + "utf8": "\u0418", + "character": "И", + "description": "Cyrillic Character I (except Ukrainian = Y)", + "mrz": "I" + }, + { + "utf8": "\u0419", + "character": "Й", + "description": "I (except if Ukrainian first character, then =Y)", + "mrz": "I" + }, + { + "utf8": "\u041A", + "character": "К", + "description": "Cyrillic Character К", + "mrz": "K" + }, + { + "utf8": "\u041B", + "character": "Л", + "description": "Cyrillic Character Л", + "mrz": "L" + }, + { + "utf8": "\u041C", + "character": "M", + "description": "Cyrillic Character M", + "mrz": "M" + }, + { + "utf8": "\u041D", + "character": "Н", + "description": "Cyrillic Character Н", + "mrz": "N" + }, + { + "utf8": "\u041E", + "character": "О", + "description": "Cyrillic Character О", + "mrz": "O" + }, + { + "utf8": "\u041F", + "character": "П", + "description": "Cyrillic Character П", + "mrz": "P" + }, + { + "utf8": "\u0420", + "character": "Р", + "description": "Cyrillic Character Р", + "mrz": "R" + }, + { + "utf8": "\u0421", + "character": "С", + "description": "Cyrillic Character С", + "mrz": "S" + }, + { + "utf8": "\u0422", + "character": "Т", + "description": "Cyrillic Character Т", + "mrz": "T" + }, + { + "utf8": "\u0423", + "character": "У", + "description": "Cyrillic Character У", + "mrz": "У" + }, + { + "utf8": "\u0424", + "character": "Ф", + "description": "Cyrillic Character Ф", + "mrz": "F" + }, + { + "utf8": "\u0425", + "character": "Х", + "description": "Cyrillic Character KH (except Serbian and in the language spoken in the former Yugoslav Republic of Macedonia = H)", + "mrz": "KH" + }, + { + "utf8": "\u0426", + "character": "Ц", + "description": "Cyrillic Character TS (except Serbian and in the language spoken in the former Yugoslav Republic of Macedonia = H", + "mrz": "TS" + }, + { + "utf8": "\u0427", + "character": "Ч", + "description": "Cyrillic Character CH (except Serbian = C)", + "mrz": "CH" + }, + { + "utf8": "\u0428", + "character": "Ш", + "description": "Cyrillic Character SH (except Serbian = S)", + "mrz": "SH" + }, + { + "utf8": "\u0429", + "character": "Щ", + "description": "Cyrillic Character SHCH (except Bulgarian = SHT)", + "mrz": "SHCH" + }, + { + "utf8": "\u042A", + "character": "Ъ", + "description": "Cyrillic Character IE", + "mrz": "IE" + }, + { + "utf8": "\u042B", + "character": "Ы", + "description": "Cyrillic Character Y", + "mrz": "Y" + }, + { + "utf8": "\u042D", + "character": "Э", + "description": "Cyrillic Character E", + "mrz": "E" + }, + { + "utf8": "\u042E", + "character": "Ю", + "description": "Cyrillic Character IU (except if Ukrainian first character, then =YU)", + "mrz": "IU" + }, + { + "utf8": "\u042F", + "character": "Я", + "description": "Cyrillic Character IA (except if Ukrainian first character, then =YA)", + "mrz": "IA" + }, + { + "utf8": "\u046A", + "character": "Ѫ", + "description": "Cyrillic Character U", + "mrz": "U" + }, + { + "utf8": "\u0474", + "character": "V", + "description": "Cyrillic Character Y", + "mrz": "Y" + }, + { + "utf8": "\u0490", + "character": "Ґ", + "description": "Cyrillic Character G", + "mrz": "G" + }, + { + "utf8": "\u0492", + "character": "Ғ", + "description": "Cyrillic Character G (except in the language spoken in the former Yugoslav Republic of Macedonia = GJ)", + "mrz": "G" + }, + { + "utf8": "\u04BA", + "character": "Һ", + "description": "Cyrillic Character C", + "mrz": "C" + }, + { + "utf8": "\u0621", + "character": "ء", + "description": "Arabic letter hamza", + "mrz": "XE" + }, + { + "utf8": "\u0622", + "character": "آ", + "description": "Arabic letter alef with madda above", + "mrz": "XAA" + }, + { + "utf8": "\u0623", + "character": "أ", + "description": "Arabic letter alef with hamza above", + "mrz": "XAE" + }, + { + "utf8": "\u0624", + "character": "ؤ", + "description": "Arabic letter waw with hamza above", + "mrz": "U" + }, + { + "utf8": "\u0625", + "character": "إ", + "description": "Arabic letter alef with hamza below", + "mrz": "I" + }, + { + "utf8": "\u0626", + "character": "ئ ", + "description": "Arabic letter yeh with hamza above", + "mrz": "XI" + }, + { + "utf8": "\u0627", + "character": "ا", + "description": "Arabic letter alef", + "mrz": "A" + }, + { + "utf8": "\u0628", + "character": "ب", + "description": "Arabic letter beh", + "mrz": "B" + }, + { + "utf8": "\u0629", + "character": "ة", + "description": "Arabic letter teh marbuta XTA/XAH todo: XTA is used generally, except if teh marbuta occurs at the end of the name component, in which case XAH is used.)", + "mrz": "XTA" + }, + { + "utf8": "\u062A", + "character": "ت", + "description": "Arabic letter teh", + "mrz": "T" + }, + { + "utf8": "\u062B", + "character": "ث", + "description": "Arabic letter theh", + "mrz": "XTH" + }, + { + "utf8": "\u062C", + "character": "ج", + "description": "Arabic letter jeem", + "mrz": "J" + }, + { + "utf8": "\u062D", + "character": "ح", + "description": "Arabic letter hah", + "mrz": "XH" + }, + { + "utf8": "\u062E", + "character": "خ", + "description": "Arabic letter khah", + "mrz": "XKH" + }, + { + "utf8": "\u062F", + "character": "د", + "description": "Arabic letter dal", + "mrz": "D" + }, + { + "utf8": "\u0630", + "character": "ذ", + "description": "Arabic letter thal", + "mrz": "XDH" + }, + { + "utf8": "\u0631", + "character": "ر", + "description": "Arabic letter reh", + "mrz": "R" + }, + { + "utf8": "\u0632", + "character": "ز", + "description": "Arabic letter zain", + "mrz": "Z" + }, + { + "utf8": "\u0633", + "character": "س", + "description": "Arabic letter seen", + "mrz": "S" + }, + { + "utf8": "\u0634", + "character": "ش", + "description": "Arabic letter sheen", + "mrz": "XSH" + }, + { + "utf8": "\u0635", + "character": "ص", + "description": "Arabic letter sad", + "mrz": "XSS" + }, + { + "utf8": "\u0636", + "character": "ض", + "description": "Arabic letter dad", + "mrz": "XDZ" + }, + { + "utf8": "\u0637", + "character": "ط", + "description": "Arabic letter tah", + "mrz": "XTT" + }, + { + "utf8": "\u0638", + "character": "ظ", + "description": "Arabic letter zah", + "mrz": "XZZ" + }, + { + "utf8": "\u0639", + "character": "ع", + "description": "Arabic letter ain", + "mrz": "E" + }, + { + "utf8": "\u063A", + "character": "غ", + "description": "Arabic letter ghain", + "mrz": "G" + }, + { + "utf8": "\u0641", + "character": "ف", + "description": "Arabic letter feh", + "mrz": "F" + }, + { + "utf8": "\u0642", + "character": "ق", + "description": "Arabic letter qaf", + "mrz": "Q" + }, + { + "utf8": "\u0643", + "character": "ك", + "description": "Arabic letter lam", + "mrz": "K" + }, + { + "utf8": "\u0644", + "character": "ل", + "description": "Arabic letter lam", + "mrz": "L" + }, + { + "utf8": "\u0645", + "character": "م", + "description": "Arabic letter meem", + "mrz": "M" + }, + { + "utf8": "\u0646", + "character": "ن", + "description": "Arabic letter noon", + "mrz": "N" + }, + { + "utf8": "\u0647", + "character": "ه", + "description": "Arabic letter heh", + "mrz": "H" + }, + { + "utf8": "\u0648", + "character": "و", + "description": "Arabic letter waw", + "mrz": "W" + }, + { + "utf8": "\u0649", + "character": "ى", + "description": "Arabic letter alef maksura", + "mrz": "XAY" + }, + { + "utf8": "\u064A", + "character": "ي", + "description": "Arabic letter yeh", + "mrz": "Y" + }, + { + "utf8": "\u0651", + "character": "shadda", + "description": "Arabic letter shadda todo: Shadda denotes doubling: Latin character or sequence is repeated", + "mrz": "TODO" + }, + { + "utf8": "\u0671", + "character": "ٱ", + "description": "Arabic letter alef wasla", + "mrz": "XXA" + }, + { + "utf8": "\u0679", + "character": "ٹ", + "description": "Arabic letter tteh", + "mrz": "XXT" + }, + { + "utf8": "\u067C", + "character": "ټ", + "description": "Arabic letter teh with ring", + "mrz": "XRT" + }, + { + "utf8": "\u067E", + "character": "پ", + "description": "Arabic letter peh", + "mrz": "P" + }, + { + "utf8": "\u0681", + "character": "ځ", + "description": "Arabic letter hah with hamza above", + "mrz": "XKE" + }, + { + "utf8": "\u0685", + "character": "څ", + "description": "Arabic letter hah with 3 dots above", + "mrz": "XXH" + }, + { + "utf8": "\u0686", + "character": "چ", + "description": "Arabic letter tcheh", + "mrz": "XC" + }, + { + "utf8": "\u0688", + "character": "ڈ", + "description": "Arabic letter ddal", + "mrz": "XXD" + }, + { + "utf8": "\u0689", + "character": "ډ", + "description": "Arabic letter dal with ring", + "mrz": "XDR" + }, + { + "utf8": "\u0691", + "character": "ڑ", + "description": "Arabic letter rreh", + "mrz": "XXR" + }, + { + "utf8": "\u0693", + "character": "ړ", + "description": "Arabic letter reh with ring", + "mrz": "XRR" + }, + { + "utf8": "\u0696", + "character": "ږ", + "description": "Arabic letter reh with dot below and dot above", + "mrz": "XRX" + }, + { + "utf8": "\u0698", + "character": "ژ", + "description": "Arabic letter jeh", + "mrz": "XJ" + }, + { + "utf8": "\u069A", + "character": "ښ", + "description": "Arabic letter seen with dot below and dot above", + "mrz": "XXS" + }, + { + "utf8": "\u06AB", + "character": "ګ", + "description": "Arabic letter kaf with ring", + "mrz": "XXK" + }, + { + "utf8": "\u06AD", + "character": "ڭ", + "description": "Arabic letter ng", + "mrz": "XNG" + }, + { + "utf8": "\u06AF", + "character": "گ", + "description": "Arabic letter gaf", + "mrz": "XGG" + }, + { + "utf8": "\u06BA", + "character": "ں", + "description": "Arabic letter noon ghunna", + "mrz": "XNN" + }, + { + "utf8": "\u06BC", + "character": "ڼ", + "description": "Arabic letter noon with ring", + "mrz": "XXN" + }, + { + "utf8": "\u06BE", + "character": "ه", + "description": "Arabic letter heh doachashmee", + "mrz": "XDO" + }, + { + "utf8": "\u06C0", + "character": "ە", + "description": "Arabic letter heh with yeh above", + "mrz": "XYH" + }, + { + "utf8": "\u06C1", + "character": "ہ", + "description": "Arabic letter heh goal", + "mrz": "XXG" + }, + { + "utf8": "\u06C2", + "character": "ہ", + "description": "Arabic letter heh goal with hamza above", + "mrz": "XGE" + }, + { + "utf8": "\u06C3", + "character": "ۃ", + "description": "Arabic letter teh marbuta goal", + "mrz": "XTG" + }, + { + "utf8": "\u06CC", + "character": "ى", + "description": "Arabic letter farsi yeh", + "mrz": "XYA" + }, + { + "utf8": "\u06CD", + "character": "ۍ", + "description": "Arabic letter yeh with tail", + "mrz": "XXY" + }, + { + "utf8": "\u06D0", + "character": "ې", + "description": "Arabic letter yeh", + "mrz": "Y" + }, + { + "utf8": "\u06D2", + "character": "ے", + "description": "Arabic letter yeh barree", + "mrz": "XYB" + }, + { + "utf8": "\u06D3", + "character": "ۓ", + "description": "Arabic letter yeh barree with hamza above", + "mrz": "XBE" + } + ] +} \ No newline at end of file diff --git a/src/components/landing-page.component.tsx b/src/components/landing-page.component.tsx index 3dbf105..ffa4ca2 100644 --- a/src/components/landing-page.component.tsx +++ b/src/components/landing-page.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/confirm-modal.component.tsx b/src/components/modals/confirm-modal.component.tsx index 2534a15..94ed6d6 100644 --- a/src/components/modals/confirm-modal.component.tsx +++ b/src/components/modals/confirm-modal.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/dataprivacy.component.tsx b/src/components/modals/dataprivacy.component.tsx index 6c55e3b..c80b228 100644 --- a/src/components/modals/dataprivacy.component.tsx +++ b/src/components/modals/dataprivacy.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/error-page.component.tsx b/src/components/modals/error-page.component.tsx index b46f24e..f9edb6b 100644 --- a/src/components/modals/error-page.component.tsx +++ b/src/components/modals/error-page.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/group-modal.component.tsx b/src/components/modals/group-modal.component.tsx index 23fd80d..a2ecf4c 100644 --- a/src/components/modals/group-modal.component.tsx +++ b/src/components/modals/group-modal.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/imprint.component.tsx b/src/components/modals/imprint.component.tsx index c411279..9f7e748 100644 --- a/src/components/modals/imprint.component.tsx +++ b/src/components/modals/imprint.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/notification-page.component.tsx b/src/components/modals/notification-page.component.tsx index 438ca86..f2c34ae 100644 --- a/src/components/modals/notification-page.component.tsx +++ b/src/components/modals/notification-page.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/notification-toast.component.tsx b/src/components/modals/notification-toast.component.tsx index dd80176..f7a1fb6 100644 --- a/src/components/modals/notification-toast.component.tsx +++ b/src/components/modals/notification-toast.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/process-input.component.tsx b/src/components/modals/process-input.component.tsx index 8667773..9c1760f 100644 --- a/src/components/modals/process-input.component.tsx +++ b/src/components/modals/process-input.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modals/user-modal.component.tsx b/src/components/modals/user-modal.component.tsx index e039123..b6e24b9 100644 --- a/src/components/modals/user-modal.component.tsx +++ b/src/components/modals/user-modal.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modules/address-inputs.tsx b/src/components/modules/address-inputs.tsx index dc5c822..4fd1667 100644 --- a/src/components/modules/address-inputs.tsx +++ b/src/components/modules/address-inputs.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import { Col, Form, Row } from "react-bootstrap"; diff --git a/src/components/modules/card-footer.component.tsx b/src/components/modules/card-footer.component.tsx index c5f0e5a..8a48525 100644 --- a/src/components/modules/card-footer.component.tsx +++ b/src/components/modules/card-footer.component.tsx @@ -1,6 +1,31 @@ import React from "react"; import { Card, Row, Col, Button } from "react-bootstrap"; +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import '../../i18n'; import { useTranslation } from 'react-i18next'; diff --git a/src/components/modules/card-header.component.tsx b/src/components/modules/card-header.component.tsx index 23bf80f..43bd010 100644 --- a/src/components/modules/card-header.component.tsx +++ b/src/components/modules/card-header.component.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import { Card, Row, Col } from "react-bootstrap"; diff --git a/src/components/modules/disclamer-btn.component.tsx b/src/components/modules/disclamer-btn.component.tsx index 71be02d..f84f2d8 100644 --- a/src/components/modules/disclamer-btn.component.tsx +++ b/src/components/modules/disclamer-btn.component.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from 'react'; import { Button, Card, Col, Modal, Row, Image, Container } from 'react-bootstrap'; diff --git a/src/components/modules/footer.component.tsx b/src/components/modules/footer.component.tsx index dc64035..1f18c2e 100644 --- a/src/components/modules/footer.component.tsx +++ b/src/components/modules/footer.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modules/form-group.component.tsx b/src/components/modules/form-group.component.tsx index 28e9686..6b09332 100644 --- a/src/components/modules/form-group.component.tsx +++ b/src/components/modules/form-group.component.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import { Form, Row, Col, Accordion, InputGroup, OverlayTrigger, Tooltip, DropdownButton } from "react-bootstrap"; diff --git a/src/components/modules/group-table.component.tsx b/src/components/modules/group-table.component.tsx index 26392b8..3f2c771 100644 --- a/src/components/modules/group-table.component.tsx +++ b/src/components/modules/group-table.component.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import { Row, Table, Button, Collapse, Container } from "react-bootstrap"; diff --git a/src/components/modules/header.component.tsx b/src/components/modules/header.component.tsx index 9a875b1..084e291 100644 --- a/src/components/modules/header.component.tsx +++ b/src/components/modules/header.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modules/paged-list.component.tsx b/src/components/modules/paged-list.component.tsx index f90bef0..e61c620 100644 --- a/src/components/modules/paged-list.component.tsx +++ b/src/components/modules/paged-list.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modules/person-data-inputs.tsx b/src/components/modules/person-data-inputs.tsx index cc8c1b4..ab4a14f 100644 --- a/src/components/modules/person-data-inputs.tsx +++ b/src/components/modules/person-data-inputs.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import { Form, Row, Col, Collapse } from "react-bootstrap"; @@ -13,12 +38,15 @@ import de from 'date-fns/locale/de'; import { Sex } from "../../misc/enum"; import { IPersonData } from "../../misc/quick-test"; import { FormGroupInput, FormGroupInlineRadio } from "./form-group.component"; +import useTransliterate from "../../misc/useTransliterate"; registerLocale('de', de) const PersonInputs = (props: any) => { const { t } = useTranslation(); + const [givenNameTransliteration, givenNameTransliterationUpdate] = useTransliterate(); + const [familyNameTransliteration, familyNameTransliterationUpdate] = useTransliterate(); const [givenName, setGivenName] = React.useState(''); const [familyName, setFamilyName] = React.useState(''); @@ -34,13 +62,13 @@ const PersonInputs = (props: any) => { const personData = props.quickTest.personData; if (personData.givenName) { - setGivenName(personData.givenName); + handleGivenNameChanged(personData.givenName); } if (personData.standardisedGivenName) { setStandardisedGivenName(personData.standardisedGivenName); } if (personData.familyName) { - setFamilyName(personData.familyName); + handleFamilyNameChanged(personData.familyName); } setStandardisedFamilyName(personData.standardisedFamilyName); @@ -70,8 +98,31 @@ const PersonInputs = (props: any) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [givenName, familyName, standardisedGivenName, standardisedFamilyName, dateOfBirth, sex, props.dccConsent]) + React.useEffect(() => { + setStandardisedGivenName(givenNameTransliteration); + }, [givenNameTransliteration]) + + React.useEffect(() => { + setStandardisedFamilyName(familyNameTransliteration); + }, [familyNameTransliteration]) + + const handleGivenNameChanged = (changedValue: string) => { + setGivenName(changedValue); + + // convert to ICAO and set the std field + givenNameTransliterationUpdate(changedValue); + // setStandardisedName(tmpICAOValue.substring(0, tmpICAOValue.length > 50 ? 50 : tmpICAOValue.length)); + } + + const handleFamilyNameChanged = (changedValue: string) => { + setFamilyName(changedValue); + + // convert to ICAO and set the std field + familyNameTransliterationUpdate(changedValue); + // setStandardisedName(tmpICAOValue.substring(0, tmpICAOValue.length > 50 ? 50 : tmpICAOValue.length)); + } - const handleStandardisedNameChanged = (changedValue: string, setStandardisedName: (value: string) => void) => { + const handleStandardisedNameChanged = (changedValue: string, setStandardisedName: (value: string) => void) => { const upperCaseChangedValue = changedValue.toUpperCase(); if (utils.isStandardisedNameValid(upperCaseChangedValue)) { @@ -104,7 +155,7 @@ const PersonInputs = (props: any) => { {/* first name input */} < FormGroupInput controlId='formGivenNameInput' title={t('translation:first-name')} value={givenName} - onChange={(evt: any) => setGivenName(evt.target.value)} + onChange={(evt: any) => handleGivenNameChanged(evt.target.value)} required maxLength={50} /> @@ -112,7 +163,7 @@ const PersonInputs = (props: any) => { {/* name input */} < FormGroupInput controlId='formNameInput' title={t('translation:name')} value={familyName} - onChange={(evt: any) => setFamilyName(evt.target.value)} + onChange={(evt: any) => handleFamilyNameChanged(evt.target.value)} required maxLength={50} /> @@ -127,7 +178,7 @@ const PersonInputs = (props: any) => { onChange={(evt: any) => handleStandardisedNameChanged(evt.target.value, setStandardisedGivenName)} required={props.dccConsent} pattern={utils.pattern.standardisedName} - maxLength={50} + maxLength={150} prepend='i' tooltip={t('translation:standardised-first-name-tooltip')} /> @@ -138,7 +189,7 @@ const PersonInputs = (props: any) => { onChange={(evt: any) => handleStandardisedNameChanged(evt.target.value, setStandardisedFamilyName)} required={props.dccConsent} pattern={utils.pattern.standardisedName} - maxLength={50} + maxLength={150} prepend='i' tooltip={t('translation:standardised-name-tooltip')} /> diff --git a/src/components/modules/private-route.component.tsx b/src/components/modules/private-route.component.tsx index 4c21560..f6d5bc7 100644 --- a/src/components/modules/private-route.component.tsx +++ b/src/components/modules/private-route.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modules/statistic-data.component.tsx b/src/components/modules/statistic-data.component.tsx index 1a7457c..98cc7fc 100644 --- a/src/components/modules/statistic-data.component.tsx +++ b/src/components/modules/statistic-data.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/modules/test-result-inputs.tsx b/src/components/modules/test-result-inputs.tsx index 267be5b..a484b6b 100644 --- a/src/components/modules/test-result-inputs.tsx +++ b/src/components/modules/test-result-inputs.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import '../../i18n'; diff --git a/src/components/modules/user-table.component.tsx b/src/components/modules/user-table.component.tsx index cbd0c13..024c2b0 100644 --- a/src/components/modules/user-table.component.tsx +++ b/src/components/modules/user-table.component.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import { Row, Table, Button, Collapse, Container, Spinner, OverlayTrigger, Tooltip } from "react-bootstrap"; diff --git a/src/components/qr-scan.component.tsx b/src/components/qr-scan.component.tsx index 1bd0c95..3ef5648 100644 --- a/src/components/qr-scan.component.tsx +++ b/src/components/qr-scan.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/record-patient-data.component.tsx b/src/components/record-patient-data.component.tsx index 85dd8f2..98b777c 100644 --- a/src/components/record-patient-data.component.tsx +++ b/src/components/record-patient-data.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache @@ -282,25 +282,21 @@ const RecordPatientData = (props: any) => { {!pcrEnabled ? <> : <> - + {t('translation:test-type') + '*'} - - setTestType(TestType.RAT)} - /> - - - - setTestType(TestType.PCR)} - required={true} - /> - + setTestType(TestType.RAT)} + /> + + setTestType(TestType.PCR)} + required={true} + /> diff --git a/src/components/record-test-result.component.tsx b/src/components/record-test-result.component.tsx index c8517b3..423c76e 100644 --- a/src/components/record-test-result.component.tsx +++ b/src/components/record-test-result.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/reports.tsx b/src/components/reports.tsx index a68ed71..295681c 100644 --- a/src/components/reports.tsx +++ b/src/components/reports.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/show-patient-data.component.tsx b/src/components/show-patient-data.component.tsx index 7b75f00..89f8721 100644 --- a/src/components/show-patient-data.component.tsx +++ b/src/components/show-patient-data.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache @@ -90,7 +90,7 @@ const ShowPatientData = (props: any) => { React.useEffect(() => { if (qrCodeValue && qrCodeValue.length > 1) { - console.log(qrCodeValue); + // console.log(qrCodeValue); quickTest!.testResultHash = qrCodeValue[1]; } // eslint-disable-next-line react-hooks/exhaustive-deps diff --git a/src/components/spinner/spinner.component.tsx b/src/components/spinner/spinner.component.tsx index 4d4d6bb..1a35070 100644 --- a/src/components/spinner/spinner.component.tsx +++ b/src/components/spinner/spinner.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/statistics.component.tsx b/src/components/statistics.component.tsx index ef3975b..537e5ed 100644 --- a/src/components/statistics.component.tsx +++ b/src/components/statistics.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/components/user-management.component.tsx b/src/components/user-management.component.tsx index 7a81fa6..4e390d8 100644 --- a/src/components/user-management.component.tsx +++ b/src/components/user-management.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/i18n.tsx b/src/i18n.tsx index b03d080..a6f7ad2 100644 --- a/src/i18n.tsx +++ b/src/i18n.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/index.tsx b/src/index.tsx index fb41777..7a1250e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/login-interceptor.component.tsx b/src/login-interceptor.component.tsx index d5f9b26..5a8dc91 100644 --- a/src/login-interceptor.component.tsx +++ b/src/login-interceptor.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/appContext.tsx b/src/misc/appContext.tsx index 9e76e21..ed82cc8 100644 --- a/src/misc/appContext.tsx +++ b/src/misc/appContext.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from "react"; import { INavigation } from "./useNavigation"; import { IValueSetList } from "./useValueSet"; diff --git a/src/misc/enum.tsx b/src/misc/enum.tsx index 02abffb..15ee48a 100644 --- a/src/misc/enum.tsx +++ b/src/misc/enum.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/error.tsx b/src/misc/error.tsx index 6883279..acd2d98 100644 --- a/src/misc/error.tsx +++ b/src/misc/error.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/qr-code-value.tsx b/src/misc/qr-code-value.tsx index 10c9bd0..de493da 100644 --- a/src/misc/qr-code-value.tsx +++ b/src/misc/qr-code-value.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/qt-archiv.tsx b/src/misc/qt-archiv.tsx index c6d99a5..231b62f 100644 --- a/src/misc/qt-archiv.tsx +++ b/src/misc/qt-archiv.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/quick-test.tsx b/src/misc/quick-test.tsx index c5bb42c..b6c5586 100644 --- a/src/misc/quick-test.tsx +++ b/src/misc/quick-test.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/statistic-data.tsx b/src/misc/statistic-data.tsx index 02b02a9..47a04d8 100644 --- a/src/misc/statistic-data.tsx +++ b/src/misc/statistic-data.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/test-result.tsx b/src/misc/test-result.tsx index 0e2a79a..f19411d 100644 --- a/src/misc/test-result.tsx +++ b/src/misc/test-result.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/useLocalStorage.tsx b/src/misc/useLocalStorage.tsx index c95deda..de5b42c 100644 --- a/src/misc/useLocalStorage.tsx +++ b/src/misc/useLocalStorage.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/useNavigation.tsx b/src/misc/useNavigation.tsx index 6893684..a10049a 100644 --- a/src/misc/useNavigation.tsx +++ b/src/misc/useNavigation.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/useOnUnload.tsx b/src/misc/useOnUnload.tsx index 1c4dcec..2d35682 100644 --- a/src/misc/useOnUnload.tsx +++ b/src/misc/useOnUnload.tsx @@ -1,3 +1,28 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + + import React from 'react'; const initBeforeUnLoad = (onUnload?: () => void) => { diff --git a/src/misc/useTransliterate.tsx b/src/misc/useTransliterate.tsx new file mode 100644 index 0000000..05d6054 --- /dev/null +++ b/src/misc/useTransliterate.tsx @@ -0,0 +1,69 @@ +/* + * Corona-Warn-App / cwa-quick-test-frontend + * + * (C) 2022, T-Systems International GmbH + * + * Deutsche Telekom AG and all other contributors / + * copyright owners license this file to you under the Apache + * License, Version 2.0 (the 'License'); you may not use this + * file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * Used character transliteration from + * https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf + */ + +import icaoJson from '../assets/JSON/icao.json'; +import React from 'react'; +import { IIcao, normalize, parsePattern, transliterate } from 'icao-transliteration'; + +const useTransliterate = (onError?: (msg: string) => void) => { + const icao: IIcao = icaoJson; + const [result, setResult] = React.useState(''); + + const update = (input: string) => { + let output = ''; + + try { + // some validation + if (!input && input !== '') throw new Error('input string is not valid!'); + if (!icao) throw new Error('transliterations are not valid!'); + + // normalize input string for mrz transliteration + const normalizedInput = normalize(input, icao); + + // transliterate normalized input with transliterations from json + output = transliterate(normalizedInput, icao); + + // in the end transliterated output should pass regEx + if (!parsePattern(icao.pattern.mrz).test(output)) new Error('Could not transliterate some characters: ' + output + '.'); + } + catch (error: any) { + if (onError) { + onError(error.message) + } + + console.log(error.message); + output = ''; + } + + setResult(output); + } + + const clear = () => { + setResult(''); + } + + return [result, update, clear] as const; +} + +export default useTransliterate; diff --git a/src/misc/useValueSet.tsx b/src/misc/useValueSet.tsx index 582eb07..e794786 100644 --- a/src/misc/useValueSet.tsx +++ b/src/misc/useValueSet.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/user.tsx b/src/misc/user.tsx index e94b4e5..b94491f 100644 --- a/src/misc/user.tsx +++ b/src/misc/user.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/misc/utils.tsx b/src/misc/utils.tsx index eb9cb02..67bc89f 100644 --- a/src/misc/utils.tsx +++ b/src/misc/utils.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache @@ -48,7 +48,7 @@ const pattern = { houseNo: '^([1-9]{1}[0-9a-zA-Z-\\s/]{0,14})$', tel: '^([+]{1}[1-9]{1,2}|[0]{1}[1-9]{1})[0-9]{5,}$', eMail: '^[\\w\\d\\.!#$%&’*+/=?^_`{|}~-]{1,}[@]{1}[\\w\\d\\.-]{1,}[\\.]{1}[\\w]{2,}$', - standardisedName: '^[A-Z<]*$', + standardisedName: '^[0-9A-Z<]*$', url: '^(www\\.|http:\\/\\/|https:\\/\\/){0,1}?[a-z0-9]+([\\-\\.]{1}[a-z0-9]+)*\\.[a-z]{2,10}(:[0-9]{1,5})?(\\/.*)?$', BSNR: '^[1-9]{1}\\d{8}$', //openingHours:'^[\\w-\\d\\s]{0,64}$/gm' diff --git a/src/react-app-env.d.ts b/src/react-app-env.d.ts index 796f382..f4c70bc 100644 --- a/src/react-app-env.d.ts +++ b/src/react-app-env.d.ts @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/reportWebVitals.ts b/src/reportWebVitals.ts index 4444f41..b4580f6 100644 --- a/src/reportWebVitals.ts +++ b/src/reportWebVitals.ts @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/root.component.tsx b/src/root.component.tsx index f7d77cc..f988de1 100644 --- a/src/root.component.tsx +++ b/src/root.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/routing.component.tsx b/src/routing.component.tsx index a5d7509..a7ba460 100644 --- a/src/routing.component.tsx +++ b/src/routing.component.tsx @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache diff --git a/src/setupTests.ts b/src/setupTests.ts index cc999b1..7046948 100644 --- a/src/setupTests.ts +++ b/src/setupTests.ts @@ -1,7 +1,7 @@ /* * Corona-Warn-App / cwa-quick-test-frontend * - * (C) 2021, T-Systems International GmbH + * (C) 2022, T-Systems International GmbH * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache