From 5f5a02a1ab0413985c1c563c31d26895bcd0f163 Mon Sep 17 00:00:00 2001 From: Vrishab Srivatsa Date: Wed, 20 Mar 2024 16:32:02 +0530 Subject: [PATCH] refactor: upgrading to rescript v11 changes --- src/CardUtils.res | 2 +- src/Components/SurchargeUtils.res | 2 +- src/LoaderController.res | 2 +- src/Payment.res | 6 +++--- src/Payments/CardPayment.res | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/CardUtils.res b/src/CardUtils.res index 29d6fb75a..296ba722e 100644 --- a/src/CardUtils.res +++ b/src/CardUtils.res @@ -570,7 +570,7 @@ let clientTimeZone = dateTimeFormat().resolvedOptions().timeZone let clientCountry = Utils.getClientCountry(clientTimeZone) let postalRegex = (postalCodes: array, ~country=?, ()) => { - let country = country->Belt.Option.getWithDefault(clientCountry.isoAlpha2) + let country = country->Option.getOr(clientCountry.isoAlpha2) let countryPostal = Utils.getCountryPostal(country, postalCodes) countryPostal.regex } diff --git a/src/Components/SurchargeUtils.res b/src/Components/SurchargeUtils.res index 44a3a0338..355f63d99 100644 --- a/src/Components/SurchargeUtils.res +++ b/src/Components/SurchargeUtils.res @@ -18,7 +18,7 @@ let useSurchargeDetailsForOneClickWallets = (~list) => { RecoilAtoms.areOneClickWalletsRendered, ) - React.useMemo2(() => { + React.useMemo(() => { oneClickWallets->Array.reduce([], (acc, wallet) => { let isWalletBtnRendered = switch wallet.paymentMethodType { | "apple_pay" => areOneClickWalletsRendered.isApplePay diff --git a/src/LoaderController.res b/src/LoaderController.res index 6d047e59f..424d688ac 100644 --- a/src/LoaderController.res +++ b/src/LoaderController.res @@ -105,7 +105,7 @@ let make = (~children, ~paymentMode, ~setIntegrateErrorError, ~logger) => { let appearance = optionsAppearance == CardTheme.defaultAppearance ? config.appearance : optionsAppearance let localeString = CardTheme.getLocaleObject(localeString == "" ? config.locale : localeString) - setConfig(._ => { + setConfig(_ => { config: { appearance, locale: config.locale, diff --git a/src/Payment.res b/src/Payment.res index d8abe6182..bcd401b08 100644 --- a/src/Payment.res +++ b/src/Payment.res @@ -344,14 +344,14 @@ let make = (~paymentMode, ~integrateError, ~logger) => { React.useEffect(() => { setCardError(_ => - isCardValid->Belt.Option.getWithDefault(true) ? "" : localeString.inValidCardErrorText + isCardValid->Option.getOr(true) ? "" : localeString.inValidCardErrorText ) None }, [isCardValid]) React.useEffect(() => { setCvcError(_ => - isCVCValid->Belt.Option.getWithDefault(true) ? "" : localeString.inCompleteCVCErrorText + isCVCValid->Option.getOr(true) ? "" : localeString.inCompleteCVCErrorText ) None }, [isCVCValid]) @@ -368,7 +368,7 @@ let make = (~paymentMode, ~integrateError, ~logger) => { None }, (isExpiryValid, isExpiryComplete(cardExpiry))) - let icon = React.useMemo2(() => { + let icon = React.useMemo(() => { let animate = cardType == NOTFOUND ? "animate-slideLeft" : "animate-slideRight" let cardBrandIcon = getCardBrandIcon(cardType, paymentType)
cardBrandIcon
diff --git a/src/Payments/CardPayment.res b/src/Payments/CardPayment.res index e4681e8a3..de52853b5 100644 --- a/src/Payments/CardPayment.res +++ b/src/Payments/CardPayment.res @@ -103,7 +103,7 @@ let make = ( ~isCvcValidValue, ) - let isCustomerAcceptanceRequired = React.useMemo2(() => { + let isCustomerAcceptanceRequired = React.useMemo(() => { if displaySavedPaymentMethodsCheckbox { isSaveCardsChecked || list.payment_type === SETUP_MANDATE } else {