diff --git a/src/Components/PayNowButton.res b/src/Components/PayNowButton.res index 5c043baff..eb2207f50 100644 --- a/src/Components/PayNowButton.res +++ b/src/Components/PayNowButton.res @@ -14,17 +14,13 @@ let make = () => { open RecoilAtoms open Utils let (showLoader, setShowLoader) = React.useState(() => false) + let (isPayNowButtonDisable, setIsPayNowButtonDisable) = React.useState(() => false) let {themeObj, localeString} = configAtom->Recoil.useRecoilValueFromAtom let {sdkHandleConfirmPayment} = optionAtom->Recoil.useRecoilValueFromAtom - let (isPayNowButtonDisable, setIsPayNowButtonDisable) = payNowButtonDisable->Recoil.useRecoilState let confirmPayload = sdkHandleConfirmPayment->PaymentBody.confirmPayloadForSDKButton let buttonText = sdkHandleConfirmPayment.buttonText->Option.getOr(localeString.payNowButton) - React.useEffect1(() => { - setIsPayNowButtonDisable(_ => !sdkHandleConfirmPayment.allowButtonBeforeValidation) - None - }, [sdkHandleConfirmPayment.allowButtonBeforeValidation]) let handleMessage = (event: Types.event) => { let json = event.data->Identity.anyTypeToJson->getStringFromJson("")->safeParse diff --git a/src/Hooks/UtilityHooks.res b/src/Hooks/UtilityHooks.res index 722000f08..09a4ef605 100644 --- a/src/Hooks/UtilityHooks.res +++ b/src/Hooks/UtilityHooks.res @@ -14,14 +14,8 @@ let useHandlePostMessages = (~complete, ~empty, ~paymentType, ~savedMethod=false open RecoilAtoms let loggerState = Recoil.useRecoilValueFromAtom(loggerAtom) - let setIsPayNowButtonDisable = Recoil.useSetRecoilState(payNowButtonDisable) - let {sdkHandleConfirmPayment} = Recoil.useRecoilValueFromAtom(optionAtom) React.useEffect(() => { - if !sdkHandleConfirmPayment.allowButtonBeforeValidation { - let isCompletelyFilled = complete && paymentType !== "" - setIsPayNowButtonDisable(_ => !isCompletelyFilled) - } Utils.handlePostMessageEvents(~complete, ~empty, ~paymentType, ~loggerState, ~savedMethod) None }, (complete, empty, paymentType)) diff --git a/src/TabCard.res b/src/TabCard.res index 4d1dd7217..f9bf64793 100644 --- a/src/TabCard.res +++ b/src/TabCard.res @@ -4,8 +4,6 @@ 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 {sdkHandleConfirmPayment} = optionAtom->Recoil.useRecoilValueFromAtom - let setIsPayNowButtonDisable = Recoil.useSetRecoilState(payNowButtonDisable) let (tabClass, tabLabelClass, tabIconClass) = React.useMemo( () => isActive ? ("Tab--selected", "TabLabel--selected", "TabIcon--selected") : ("", "", ""), [isActive], @@ -17,7 +15,6 @@ let make = (~paymentOption: PaymentMethodsRecord.paymentFieldsInfo, ~isActive: b paymentOption.icon, ) let onClick = _ => { - setIsPayNowButtonDisable(_ => !sdkHandleConfirmPayment.allowButtonBeforeValidation) setSelectedOption(_ => paymentOption.paymentMethodName) }