From fd967b20e16e6ad36a5baa071fbd15c55f9f8b40 Mon Sep 17 00:00:00 2001 From: Saksham Sharma Date: Tue, 20 Aug 2024 15:21:33 +0530 Subject: [PATCH 1/3] refactor: sdk pay now always enabled --- src/Components/PayNowButton.res | 12 ++---------- src/Hooks/UtilityHooks.res | 6 ------ src/TabCard.res | 3 --- src/Utilities/RecoilAtoms.res | 1 - 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/Components/PayNowButton.res b/src/Components/PayNowButton.res index 5c043baff..a6affdced 100644 --- a/src/Components/PayNowButton.res +++ b/src/Components/PayNowButton.res @@ -16,15 +16,10 @@ let make = () => { let (showLoader, setShowLoader) = 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 @@ -32,7 +27,6 @@ let make = () => { switch dict->Dict.get("submitSuccessful") { | Some(submitSuccessfulVal) => if !(submitSuccessfulVal->JSON.Decode.bool->Option.getOr(false)) { - setIsPayNowButtonDisable(_ => false) setShowLoader(_ => false) } | None => () @@ -40,7 +34,6 @@ let make = () => { } let handleOnClick = _ => { - setIsPayNowButtonDisable(_ => true) setShowLoader(_ => true) EventListenerManager.addSmartEventListener("message", handleMessage, "onSubmitSuccessful") handlePostMessage([("handleSdkConfirm", confirmPayload)]) @@ -48,15 +41,14 @@ let make = () => {