diff --git a/CHANGELOG.md b/CHANGELOG.md index 301474b1d..314ce0818 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +## [0.74.5](https://github.com/juspay/hyperswitch-web/compare/v0.74.4...v0.74.5) (2024-07-12) + + +### Bug Fixes + +* error string ([#498](https://github.com/juspay/hyperswitch-web/issues/498)) ([213daf7](https://github.com/juspay/hyperswitch-web/commit/213daf793498b7e23d0da74a1e17975c8591bc9e)) + +## [0.74.4](https://github.com/juspay/hyperswitch-web/compare/v0.74.3...v0.74.4) (2024-07-12) + +## [0.74.3](https://github.com/juspay/hyperswitch-web/compare/v0.74.2...v0.74.3) (2024-07-11) + + +### Bug Fixes + +* premount loader fix ([#492](https://github.com/juspay/hyperswitch-web/issues/492)) ([f9d973c](https://github.com/juspay/hyperswitch-web/commit/f9d973cd19a54d73dfcbc664f9ec093ecefd3798)) + ## [0.74.2](https://github.com/juspay/hyperswitch-web/compare/v0.74.1...v0.74.2) (2024-07-10) diff --git a/package-lock.json b/package-lock.json index 4d660371d..d733151bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.74.2", + "version": "0.74.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.74.2", + "version": "0.74.5", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudfront": "^3.414.0", diff --git a/package.json b/package.json index 457ba8326..cf5de90a6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.74.2", + "version": "0.74.5", "main": "index.js", "private": true, "dependencies": { diff --git a/src/LoaderController.res b/src/LoaderController.res index 69ed06093..fcf2fa5af 100644 --- a/src/LoaderController.res +++ b/src/LoaderController.res @@ -3,7 +3,6 @@ open Utils let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTimestamp) => { open RecoilAtoms - //<...>// let (configAtom, setConfig) = Recoil.useRecoilState(configAtom) let (keys, setKeys) = Recoil.useRecoilState(keys) let (paymentMethodList, setPaymentMethodList) = Recoil.useRecoilState(paymentMethodList) @@ -579,7 +578,6 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger, ~initTime ]) None }, (divH, iframeId)) - //<...>//
ReactDOM.Ref.domRef}> children
} diff --git a/src/LocaleStrings/ArabicLocale.res b/src/LocaleStrings/ArabicLocale.res index e86f2914f..7d76d48b2 100644 --- a/src/LocaleStrings/ArabicLocale.res +++ b/src/LocaleStrings/ArabicLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `معرف VPA`, vpaIdEmptyText: `لا يمكن أن يكون معرف Vpa فارغًا`, vpaIdInvalidText: `معرف Vpa غير صالح`, + dateofBirthRequiredText: `تاريخ الميلاد مطلوب`, + dateOfBirthInvalidText: `يجب أن يكون العمر أكبر من أو يساوي 18 عامًا`, + dateOfBirthPlaceholderText: `أدخل تاريخ الميلاد`, } diff --git a/src/LocaleStrings/CatalanLocale.res b/src/LocaleStrings/CatalanLocale.res index d5e3e21b1..413718595 100644 --- a/src/LocaleStrings/CatalanLocale.res +++ b/src/LocaleStrings/CatalanLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Vpa Id`, vpaIdEmptyText: `L'identificador de Vpa no pot estar buit`, vpaIdInvalidText: `Identificador de VPA no vàlid`, + dateofBirthRequiredText: `Es requereix la data de naixement`, + dateOfBirthInvalidText: `L'edat ha de ser igual o superior a 18 anys`, + dateOfBirthPlaceholderText: `Introdueix la data de naixement`, } diff --git a/src/LocaleStrings/DeutschLocale.res b/src/LocaleStrings/DeutschLocale.res index aa3bf7b45..ea64e3395 100644 --- a/src/LocaleStrings/DeutschLocale.res +++ b/src/LocaleStrings/DeutschLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Vpa-ID`, vpaIdEmptyText: `Die VPA-ID darf nicht leer sein`, vpaIdInvalidText: `Ungültige VPA-ID`, + dateofBirthRequiredText: `Geburtsdatum ist erforderlich`, + dateOfBirthInvalidText: `Das Alter sollte 18 Jahre oder älter sein`, + dateOfBirthPlaceholderText: `Geben Sie das Geburtsdatum ein`, } diff --git a/src/LocaleStrings/DutchLocale.res b/src/LocaleStrings/DutchLocale.res index 44b55ea73..d9c0d2e3d 100644 --- a/src/LocaleStrings/DutchLocale.res +++ b/src/LocaleStrings/DutchLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Vpa-id`, vpaIdEmptyText: `Vpa-ID mag niet leeg zijn`, vpaIdInvalidText: `Ongeldige Vpa-ID`, + dateofBirthRequiredText: `Geboortedatum is vereist`, + dateOfBirthInvalidText: `De leeftijd moet groter of gelijk zijn aan 18 jaar`, + dateOfBirthPlaceholderText: `Voer geboortedatum in`, } diff --git a/src/LocaleStrings/EnglishGBLocale.res b/src/LocaleStrings/EnglishGBLocale.res index 38f9b0d91..8f9b4afd5 100644 --- a/src/LocaleStrings/EnglishGBLocale.res +++ b/src/LocaleStrings/EnglishGBLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Vpa Id`, vpaIdEmptyText: `Vpa Id cannot be empty`, vpaIdInvalidText: `Invalid Vpa Id address`, + dateofBirthRequiredText: `Date of birth is required`, + dateOfBirthInvalidText: `Age should be greater than or equal to 18 years`, + dateOfBirthPlaceholderText: `Enter Date of Birth`, } diff --git a/src/LocaleStrings/EnglishLocale.res b/src/LocaleStrings/EnglishLocale.res index 2ada38ccb..5175f0db4 100644 --- a/src/LocaleStrings/EnglishLocale.res +++ b/src/LocaleStrings/EnglishLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: "Vpa Id", vpaIdEmptyText: "Vpa Id cannot be empty", vpaIdInvalidText: "Invalid Vpa Id address", + dateofBirthRequiredText: `Date of birth is required`, + dateOfBirthInvalidText: `Age should be greater than or equal to 18 years`, + dateOfBirthPlaceholderText: `Enter Date of Birth`, } diff --git a/src/LocaleStrings/FrenchBelgiumLocale.res b/src/LocaleStrings/FrenchBelgiumLocale.res index 50a979872..235f555ae 100644 --- a/src/LocaleStrings/FrenchBelgiumLocale.res +++ b/src/LocaleStrings/FrenchBelgiumLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Identifiant Vpa`, vpaIdEmptyText: `L'identifiant Vpa ne peut pas être vide`, vpaIdInvalidText: `Identifiant Vpa invalide`, + dateofBirthRequiredText: `La date de naissance est requise`, + dateOfBirthInvalidText: `L'âge doit être supérieur ou égal à 18 ans`, + dateOfBirthPlaceholderText: `Entrez la date de naissance`, } diff --git a/src/LocaleStrings/FrenchLocale.res b/src/LocaleStrings/FrenchLocale.res index 6f477a411..ab914daa6 100644 --- a/src/LocaleStrings/FrenchLocale.res +++ b/src/LocaleStrings/FrenchLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Identifiant Vpa`, vpaIdEmptyText: `L'identifiant Vpa ne peut pas être vide`, vpaIdInvalidText: `Identifiant Vpa invalide`, + dateofBirthRequiredText: `La date de naissance est requise`, + dateOfBirthInvalidText: `L'âge doit être supérieur ou égal à 18 ans`, + dateOfBirthPlaceholderText: `Entrez la date de naissance`, } diff --git a/src/LocaleStrings/HebrewLocale.res b/src/LocaleStrings/HebrewLocale.res index a47571807..ceb94bf9c 100644 --- a/src/LocaleStrings/HebrewLocale.res +++ b/src/LocaleStrings/HebrewLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `מזהה VPA`, vpaIdEmptyText: `מזהה VPA לא יכול להיות ריק`, vpaIdInvalidText: `מזהה VPA לא חוקי`, + dateofBirthRequiredText: `תאריך לידה נדרש`, + dateOfBirthInvalidText: `הגיל צריך להיות גדול או שווה ל-18 שנים`, + dateOfBirthPlaceholderText: `הכנס תאריך לידה`, } diff --git a/src/LocaleStrings/ItalianLocale.res b/src/LocaleStrings/ItalianLocale.res index b0cd1a52a..01855ae3f 100644 --- a/src/LocaleStrings/ItalianLocale.res +++ b/src/LocaleStrings/ItalianLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Codice Vpa`, vpaIdEmptyText: `L'ID Vpa non può essere vuoto`, vpaIdInvalidText: `ID Vpa non valido`, + dateofBirthRequiredText: `La data di nascita è obbligatoria`, + dateOfBirthInvalidText: `L'età deve essere maggiore o uguale a 18 anni`, + dateOfBirthPlaceholderText: `Inserisci la data di nascita`, } diff --git a/src/LocaleStrings/JapaneseLocale.res b/src/LocaleStrings/JapaneseLocale.res index e6ef52df8..08f4802dc 100644 --- a/src/LocaleStrings/JapaneseLocale.res +++ b/src/LocaleStrings/JapaneseLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `VPA ID`, vpaIdEmptyText: `VPA ID を空にすることはできません`, vpaIdInvalidText: `無効な VPA ID`, + dateofBirthRequiredText: `生年月日が必要です`, + dateOfBirthInvalidText: `年齢は18歳以上である必要があります`, + dateOfBirthPlaceholderText: `生年月日を入力してください`, } diff --git a/src/LocaleStrings/LocaleStringTypes.res b/src/LocaleStrings/LocaleStringTypes.res index 02959934b..36c8d69cc 100644 --- a/src/LocaleStrings/LocaleStringTypes.res +++ b/src/LocaleStrings/LocaleStringTypes.res @@ -79,4 +79,7 @@ type localeStrings = { vpaIdLabel: string, vpaIdEmptyText: string, vpaIdInvalidText: string, + dateofBirthRequiredText: string, + dateOfBirthInvalidText: string, + dateOfBirthPlaceholderText: string, } diff --git a/src/LocaleStrings/PolishLocale.res b/src/LocaleStrings/PolishLocale.res index 39265917d..d2f14403c 100644 --- a/src/LocaleStrings/PolishLocale.res +++ b/src/LocaleStrings/PolishLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Identyfikator Vpa`, vpaIdEmptyText: `Identyfikator Vpa nie może być pusty`, vpaIdInvalidText: `Nieprawidłowy identyfikator Vpa`, + dateofBirthRequiredText: `Data urodzenia jest wymagana`, + dateOfBirthInvalidText: `Wiek powinien być większy lub równy 18 lat`, + dateOfBirthPlaceholderText: `Wprowadź datę urodzenia`, } diff --git a/src/LocaleStrings/PortugueseLocale.res b/src/LocaleStrings/PortugueseLocale.res index 24f343b89..308f2558b 100644 --- a/src/LocaleStrings/PortugueseLocale.res +++ b/src/LocaleStrings/PortugueseLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `ID VPA`, vpaIdEmptyText: `O ID Vpa não pode ficar vazio`, vpaIdInvalidText: `ID Vpa inválido`, + dateofBirthRequiredText: `Data de nascimento é obrigatória`, + dateOfBirthInvalidText: `A idade deve ser maior ou igual a 18 anos`, + dateOfBirthPlaceholderText: `Insira a data de nascimento`, } diff --git a/src/LocaleStrings/RussianLocale.res b/src/LocaleStrings/RussianLocale.res index 5969a7ad4..d5dff2cdf 100644 --- a/src/LocaleStrings/RussianLocale.res +++ b/src/LocaleStrings/RussianLocale.res @@ -92,4 +92,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Идентификатор ВПА`, vpaIdEmptyText: `Идентификатор VPA не может быть пустым.`, vpaIdInvalidText: `Неверный идентификатор VPA`, + dateofBirthRequiredText: `Дата рождения обязательна`, + dateOfBirthInvalidText: `Возраст должен быть не меньше 18 лет`, + dateOfBirthPlaceholderText: `Введите дату рождения`, } diff --git a/src/LocaleStrings/SpanishLocale.res b/src/LocaleStrings/SpanishLocale.res index 8fd11f1be..0e0a08b31 100644 --- a/src/LocaleStrings/SpanishLocale.res +++ b/src/LocaleStrings/SpanishLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Identificación de Vpa`, vpaIdEmptyText: `El ID de Vpa no puede estar vacío`, vpaIdInvalidText: `ID de Vpa no válido`, + dateofBirthRequiredText: `Se requiere la fecha de nacimiento`, + dateOfBirthInvalidText: `La edad debe ser mayor o igual a 18 años`, + dateOfBirthPlaceholderText: `Introduzca la fecha de nacimiento`, } diff --git a/src/LocaleStrings/SwedishLocale.res b/src/LocaleStrings/SwedishLocale.res index 0cad17fc2..c60d5c402 100644 --- a/src/LocaleStrings/SwedishLocale.res +++ b/src/LocaleStrings/SwedishLocale.res @@ -88,4 +88,7 @@ let localeStrings: LocaleStringTypes.localeStrings = { vpaIdLabel: `Vpa-id`, vpaIdEmptyText: `Vpa-id får inte vara tomt`, vpaIdInvalidText: `Ogiltigt Vpa-ID`, + dateofBirthRequiredText: `Födelsedatum krävs`, + dateOfBirthInvalidText: `Åldern bör vara större än eller lika med 18 år`, + dateOfBirthPlaceholderText: `Ange födelsedatum`, } diff --git a/src/Payments/DateOfBirth.res b/src/Payments/DateOfBirth.res index 8992a1abe..c718d3db4 100644 --- a/src/Payments/DateOfBirth.res +++ b/src/Payments/DateOfBirth.res @@ -25,13 +25,7 @@ let make = () => { let {themeObj, localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom) let (selectedDate, setSelectedDate) = Recoil.useRecoilState(RecoilAtoms.dateOfBirth) let (error, setError) = React.useState(_ => false) - let isNotEligible = React.useMemo(() => { - let isAbove18 = switch selectedDate->Nullable.toOption { - | Some(val) => val->checkIs18OrAbove - | None => false - } - !isAbove18 - }, [selectedDate]) + let (isNotEligible, setIsNotEligible) = React.useState(_ => false) let submitCallback = React.useCallback((ev: Window.event) => { let json = ev.data->JSON.parseExn @@ -47,11 +41,17 @@ let make = () => { useSubmitPaymentData(submitCallback) let onChange = date => { + let isAbove18 = switch date->Nullable.toOption { + | Some(val) => val->checkIs18OrAbove + | None => false + } setSelectedDate(_ => date) + setIsNotEligible(_ => !isAbove18) } + let errorString = error - ? "Date of birth is required" - : "Age should be equal or greater than 18 years" + ? localeString.dateofBirthRequiredText + : localeString.dateOfBirthInvalidText
{ icon={} className="w-full border border-gray-300 rounded p-2" selected={selectedDate} - onChange={date => onChange(date)} + onChange dateFormat="dd-MM-yyyy" wrapperClassName="datepicker" shouldCloseOnSelect=true - placeholderText="Enter Date of Birth" + placeholderText={localeString.dateOfBirthPlaceholderText} renderCustomHeader={val => {