diff --git a/src/App.res b/src/App.res index c2c4b7b05..da44f7b5d 100644 --- a/src/App.res +++ b/src/App.res @@ -7,10 +7,10 @@ let make = () => { let paymentMode = CardUtils.getQueryParamsDictforKey(url.search, "componentName") let fullscreenMode = CardUtils.getQueryParamsDictforKey(url.search, "fullscreenType") - let logger = React.useMemo0(() => { + let logger = React.useMemo(() => { let log = OrcaLogger.make() log - }) + }, []) React.useEffect1(() => { setLoggerState(_ => logger) diff --git a/src/CardUtils.res b/src/CardUtils.res index 8e4c8467d..7b2932f03 100644 --- a/src/CardUtils.res +++ b/src/CardUtils.res @@ -652,7 +652,7 @@ let setRightIconForCvc = (~cardEmpty, ~cardInvalid, ~color, ~cardComplete) => { } let useCardDetails = (~cvcNumber, ~isCvcValidValue, ~isCVCValid) => { - React.useMemo3(() => { + React.useMemo(() => { let isCardDetailsEmpty = String.length(cvcNumber) == 0 let isCardDetailsValid = isCvcValidValue == "valid" let isCardDetailsInvalid = isCvcValidValue == "invalid" diff --git a/src/Components/Accordion.res b/src/Components/Accordion.res index 5f3dc5570..37de1d309 100644 --- a/src/Components/Accordion.res +++ b/src/Components/Accordion.res @@ -16,7 +16,7 @@ let make = ( accordionItemLabelClass, accordionItemIconClass, radioClass, - ) = React.useMemo1( + ) = React.useMemo( () => isActive ? ( diff --git a/src/Components/DropdownField.res b/src/Components/DropdownField.res index 39ebd53a6..45c496e76 100644 --- a/src/Components/DropdownField.res +++ b/src/Components/DropdownField.res @@ -25,7 +25,7 @@ let make = ( let value = target["value"] setValue(value) } - let disbaledBG = React.useMemo1(() => { + let disbaledBG = React.useMemo(() => { themeObj.colorBackground }, [themeObj]) React.useEffect0(() => { diff --git a/src/Components/DynamicFields.res b/src/Components/DynamicFields.res index 79aeca8af..8338e5cec 100644 --- a/src/Components/DynamicFields.res +++ b/src/Components/DynamicFields.res @@ -27,7 +27,7 @@ let make = ( ~paymentMethodType, ) - let requiredFieldsWithBillingDetails = React.useMemo3(() => { + let requiredFieldsWithBillingDetails = React.useMemo(() => { if paymentMethod === "card" { paymentMethodTypes.required_fields } else if ( @@ -39,18 +39,18 @@ let make = ( } }, (paymentMethod, paymentMethodTypes.required_fields, paymentMethodType)) - let requiredFields = React.useMemo1(() => { + let requiredFields = React.useMemo(() => { requiredFieldsWithBillingDetails->DynamicFieldsUtils.removeBillingDetailsIfUseBillingAddress( billingAddress, ) }, [requiredFieldsWithBillingDetails]) - let isAllStoredCardsHaveName = React.useMemo1(() => { + let isAllStoredCardsHaveName = React.useMemo(() => { PaymentType.getIsAllStoredCardsHaveName(savedCards) }, [savedCards]) //<...>// - let fieldsArr = React.useMemo3(() => { + let fieldsArr = React.useMemo(() => { PaymentMethodsRecord.getPaymentMethodFields( paymentMethodType, requiredFields, @@ -257,11 +257,11 @@ let make = ( } } - let dynamicFieldsToRenderOutsideBilling = React.useMemo1(() => { + let dynamicFieldsToRenderOutsideBilling = React.useMemo(() => { fieldsArr->Array.filter(DynamicFieldsUtils.isFieldTypeToRenderOutsideBilling) }, [fieldsArr]) - let dynamicFieldsToRenderInsideBilling = React.useMemo1(() => { + let dynamicFieldsToRenderInsideBilling = React.useMemo(() => { fieldsArr->Array.filter(field => !(field->DynamicFieldsUtils.isFieldTypeToRenderOutsideBilling)) }, [fieldsArr]) diff --git a/src/Components/InputField.res b/src/Components/InputField.res index 74d977ee9..111819c88 100644 --- a/src/Components/InputField.res +++ b/src/Components/InputField.res @@ -88,7 +88,7 @@ let make = ( let isValidValue = CardUtils.getBoolOptionVal(isValid) - let (cardEmpty, cardComplete, cardInvalid, cardFocused) = React.useMemo5(() => { + let (cardEmpty, cardComplete, cardInvalid, cardFocused) = React.useMemo(() => { let isCardDetailsEmpty = String.length(value) == 0 ? `${options.classes.base} ${options.classes.empty} ` diff --git a/src/Components/Modal.res b/src/Components/Modal.res index 149594b94..1718f54e0 100644 --- a/src/Components/Modal.res +++ b/src/Components/Modal.res @@ -33,7 +33,7 @@ let make = ( }, [loader]) let loaderVisibility = loader ? "visible" : "hidden" - let contentVisibility = React.useMemo1(() => { + let contentVisibility = React.useMemo(() => { !openModal ? "hidden" : "visible" }, [openModal]) diff --git a/src/Components/PaymentDropDownField.res b/src/Components/PaymentDropDownField.res index 17f7b6644..0bee9b8b5 100644 --- a/src/Components/PaymentDropDownField.res +++ b/src/Components/PaymentDropDownField.res @@ -70,7 +70,7 @@ let make = ( errorString: "", }) } - let disbaledBG = React.useMemo1(() => { + let disbaledBG = React.useMemo(() => { themeObj.colorBackground }, [themeObj]) let cursorClass = !disabled ? "cursor-pointer" : "cursor-not-allowed" 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/Hooks/UtilityHooks.res b/src/Hooks/UtilityHooks.res index 0a0136302..8aec51c0b 100644 --- a/src/Hooks/UtilityHooks.res +++ b/src/Hooks/UtilityHooks.res @@ -1,7 +1,7 @@ let useIsGuestCustomer = () => { let {customerPaymentMethods} = RecoilAtoms.optionAtom->Recoil.useRecoilValueFromAtom - React.useMemo1(() => { + React.useMemo(() => { switch customerPaymentMethods { | LoadedSavedCards(_, false) | NoResult(false) => false diff --git a/src/Payment.res b/src/Payment.res index 0ac441e61..80f47cb38 100644 --- a/src/Payment.res +++ b/src/Payment.res @@ -45,7 +45,7 @@ let make = (~paymentMode, ~integrateError, ~logger) => { let (isCVCValid, setIsCVCValid) = React.useState(_ => None) let (isZipValid, setIsZipValid) = React.useState(_ => None) - let (cardBrand, maxCardLength) = React.useMemo3(() => { + let (cardBrand, maxCardLength) = React.useMemo(() => { let brand = getCardBrand(cardNumber) let maxLength = getMaxLength(cardNumber) let isNotBancontact = selectedOption !== "bancontact_card" && brand == "" @@ -166,7 +166,7 @@ let make = (~paymentMode, ~integrateError, ~logger) => { } } - let handleElementFocus = React.useMemo4(() => { + let handleElementFocus = React.useMemo(() => { isFocus => { setIsFocus(_ => isFocus) } diff --git a/src/PaymentElement.res b/src/PaymentElement.res index cb1dc8a4d..d4bfe331a 100644 --- a/src/PaymentElement.res +++ b/src/PaymentElement.res @@ -118,7 +118,7 @@ let make = ( ~paymentMethodType="apple_pay", ) - let (walletList, paymentOptionsList, actualList) = React.useMemo6(() => { + let (walletList, paymentOptionsList, actualList) = React.useMemo(() => { switch methodslist { | Loaded(paymentlist) => let paymentOrder = @@ -213,7 +213,7 @@ let make = ( } None }, (cardsContainerWidth, paymentOptions)) - let cardShimmerCount = React.useMemo1(() => { + let cardShimmerCount = React.useMemo(() => { cardsToRender(cardsContainerWidth) }, [cardsContainerWidth]) let submitCallback = React.useCallback1((ev: Window.event) => { diff --git a/src/Payments/ApplePay.res b/src/Payments/ApplePay.res index 9eac6d67a..a32842116 100644 --- a/src/Payments/ApplePay.res +++ b/src/Payments/ApplePay.res @@ -26,7 +26,7 @@ let make = ( let isWallet = walletOptions->Array.includes("apple_pay") let areOneClickWalletsRendered = Recoil.useSetRecoilState(RecoilAtoms.areOneClickWalletsRendered) - let applePayPaymentMethodType = React.useMemo1(() => { + let applePayPaymentMethodType = React.useMemo(() => { switch PaymentMethodsRecord.getPaymentMethodTypeFromList( ~list, ~paymentMethod="wallet", @@ -37,14 +37,14 @@ let make = ( } }, [list]) - let paymentExperience = React.useMemo1(() => { + let paymentExperience = React.useMemo(() => { switch applePayPaymentMethodType.payment_experience[0] { | Some(paymentExperience) => paymentExperience.payment_experience_type | None => PaymentMethodsRecord.RedirectToURL } }, [applePayPaymentMethodType]) - let isInvokeSDKFlow = React.useMemo1(() => { + let isInvokeSDKFlow = React.useMemo(() => { paymentExperience == PaymentMethodsRecord.InvokeSDK && isApplePaySDKFlow }, [sessionObj]) diff --git a/src/Payments/BankTransfersPopup.res b/src/Payments/BankTransfersPopup.res index d3476975f..810541e80 100644 --- a/src/Payments/BankTransfersPopup.res +++ b/src/Payments/BankTransfersPopup.res @@ -22,7 +22,7 @@ let make = (~transferType) => { let (isCopied, setIsCopied) = React.useState(_ => false) let (openModal, setOpenModal) = React.useState(_ => false) - let (buttonElement, text) = React.useMemo1(() => { + let (buttonElement, text) = React.useMemo(() => { !isCopied ? ( <> diff --git a/src/Payments/Boleto.res b/src/Payments/Boleto.res index 6dd4c0992..f56e9724f 100644 --- a/src/Payments/Boleto.res +++ b/src/Payments/Boleto.res @@ -37,7 +37,7 @@ let make = (~paymentType: CardThemeType.mode, ~list: PaymentMethodsRecord.list) let socialSecurityNumberRef = React.useRef(Nullable.null) - let (complete, empty) = React.useMemo1(() => { + let (complete, empty) = React.useMemo(() => { ( socialSecurityNumber->cleanSocialSecurityNumber->String.length == 11, socialSecurityNumber->String.length == 0, diff --git a/src/Payments/CardPayment.res b/src/Payments/CardPayment.res index fb523f017..11d9181f4 100644 --- a/src/Payments/CardPayment.res +++ b/src/Payments/CardPayment.res @@ -32,7 +32,7 @@ let make = ( maxCardLength, ) = cardProps - let cardBrand = React.useMemo1(() => { + let cardBrand = React.useMemo(() => { cardNumber->CardUtils.getCardBrand }, [cardNumber]) @@ -88,7 +88,7 @@ let make = ( None }, (empty, complete)) - let (savedMethods, isGuestCustomer) = React.useMemo1(() => { + let (savedMethods, isGuestCustomer) = React.useMemo(() => { switch customerPaymentMethods { | LoadedSavedCards(savedMethods, isGuest) => (savedMethods, isGuest) | NoResult(isGuest) => ([], isGuest) @@ -103,7 +103,7 @@ let make = ( ~isCvcValidValue, ) - let isCustomerAcceptanceRequired = React.useMemo2(() => { + let isCustomerAcceptanceRequired = React.useMemo(() => { if displaySavedPaymentMethodsCheckbox { isSaveCardsChecked || list.payment_type === SETUP_MANDATE } else { diff --git a/src/Payments/GPay.res b/src/Payments/GPay.res index cc64fc7df..eb26348aa 100644 --- a/src/Payments/GPay.res +++ b/src/Payments/GPay.res @@ -24,10 +24,10 @@ let make = ( let areRequiredFieldsValid = Recoil.useRecoilValueFromAtom(RecoilAtoms.areRequiredFieldsValid) let areRequiredFieldsEmpty = Recoil.useRecoilValueFromAtom(RecoilAtoms.areRequiredFieldsEmpty) let status = CommonHooks.useScript("https://pay.google.com/gp/p/js/pay.js") - let isGooglePaySDKFlow = React.useMemo1(() => { + let isGooglePaySDKFlow = React.useMemo(() => { sessionObj->Option.isSome }, [sessionObj]) - let isGooglePayThirdPartyFlow = React.useMemo1(() => { + let isGooglePayThirdPartyFlow = React.useMemo(() => { thirdPartySessionObj->Option.isSome }, [sessionObj]) @@ -50,7 +50,7 @@ let make = ( | None => PaymentMethodsRecord.RedirectToURL } - let isInvokeSDKFlow = React.useMemo1(() => { + let isInvokeSDKFlow = React.useMemo(() => { (isGooglePaySDKFlow || isGooglePayThirdPartyFlow) && paymentExperience == PaymentMethodsRecord.InvokeSDK }, [sessionObj]) @@ -58,7 +58,7 @@ let make = ( ? list->PaymentUtils.getConnectors(Wallets(Gpay(SDK))) : list->PaymentUtils.getConnectors(Wallets(Gpay(Redirect))) - let isDelayedSessionToken = React.useMemo1(() => { + let isDelayedSessionToken = React.useMemo(() => { thirdPartySessionObj ->Option.flatMap(JSON.Decode.object) ->Option.flatMap(x => x->Dict.get("delayed_session_token")) diff --git a/src/Payments/PaymentRequestButtonElement.res b/src/Payments/PaymentRequestButtonElement.res index e1f034b2d..685deea76 100644 --- a/src/Payments/PaymentRequestButtonElement.res +++ b/src/Payments/PaymentRequestButtonElement.res @@ -40,8 +40,8 @@ let make = (~sessions, ~walletOptions, ~list: PaymentMethodsRecord.list) => { open SessionsType let dict = sessions->Utils.getDictFromJson - let sessionObj = React.useMemo1(() => itemToObjMapper(dict, Others), [dict]) - let paypalToken = React.useMemo1( + let sessionObj = React.useMemo(() => itemToObjMapper(dict, Others), [dict]) + let paypalToken = React.useMemo( () => getPaymentSessionObj(sessionObj.sessionsToken, Paypal), [sessionObj], ) diff --git a/src/Payments/QRCodeDisplay.res b/src/Payments/QRCodeDisplay.res index fcf488784..4858d6b1c 100644 --- a/src/Payments/QRCodeDisplay.res +++ b/src/Payments/QRCodeDisplay.res @@ -120,7 +120,7 @@ let make = () => { ->ignore } - let expiryString = React.useMemo1(() => { + let expiryString = React.useMemo(() => { let minutes = (expiryTime /. 60000.0)->Belt.Float.toInt->Belt.Int.toString let seconds = mod(expiryTime->Belt.Float.toInt, 60000)->Belt.Int.toString->String.slice(~start=0, ~end=2) diff --git a/src/SingleLineCardPayment.res b/src/SingleLineCardPayment.res index 8de6123c1..65b618bb5 100644 --- a/src/SingleLineCardPayment.res +++ b/src/SingleLineCardPayment.res @@ -66,7 +66,7 @@ let make = ( let isExpiryValidValue = getBoolOptionVal(isExpiryValid) let isCVCValidValue = getBoolOptionVal(isCVCValid) let isZipValidValue = getBoolOptionVal(isZipValid) - let (showPincode, pincodeClass) = React.useMemo1( + let (showPincode, pincodeClass) = React.useMemo( () => displayPincode ? ("block", "animate-slideLeft") : ("none", "animate-slideRight "), [displayPincode], ) @@ -74,7 +74,7 @@ let make = ( let checkValueIsValid = item => item == "valid" let checkValueIsInvalid = item => item == "invalid" - let (cardEmpty, cardComplete, cardInvalid, cardFocused) = React.useMemo4(() => { + let (cardEmpty, cardComplete, cardInvalid, cardFocused) = React.useMemo(() => { let isCardDetailsEmpty = Array.every( [cardNumber, cardExpiry, cvcNumber, zipCode], checkLengthIsZero, diff --git a/src/TabCard.res b/src/TabCard.res index f6da1f5f4..f6b4aaa5e 100644 --- a/src/TabCard.res +++ b/src/TabCard.res @@ -4,7 +4,7 @@ let make = (~paymentOption: PaymentMethodsRecord.paymentFieldsInfo, ~isActive: b let {themeObj, localeString} = Recoil.useRecoilValueFromAtom(configAtom) let {readOnly, customMethodNames} = Recoil.useRecoilValueFromAtom(optionAtom) let setSelectedOption = Recoil.useSetRecoilState(selectedOptionAtom) - let (tabClass, tabLabelClass, tabIconClass) = React.useMemo1( + let (tabClass, tabLabelClass, tabIconClass) = React.useMemo( () => isActive ? ("Tab--selected", "TabLabel--selected", "TabIcon--selected") : ("", "", ""), [isActive], ) diff --git a/src/Utilities/DynamicFieldsUtils.res b/src/Utilities/DynamicFieldsUtils.res index 01c89feb2..0980acd32 100644 --- a/src/Utilities/DynamicFieldsUtils.res +++ b/src/Utilities/DynamicFieldsUtils.res @@ -701,7 +701,7 @@ let useSubmitCallback = () => { } let usePaymentMethodTypeFromList = (~list, ~paymentMethod, ~paymentMethodType) => { - React.useMemo3(() => { + React.useMemo(() => { PaymentMethodsRecord.getPaymentMethodTypeFromList( ~list, ~paymentMethod,