Skip to content

Commit

Permalink
fix: update connector url on preview (#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Sep 25, 2024
1 parent abc1852 commit de870b5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
39 changes: 24 additions & 15 deletions src/screens/Connectors/ConnectorPreview.res
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ module ConnectorSummaryGrid = {
~updateStepValue=None,
~getConnectorDetails=None,
) => {
let url = RescriptReactRouter.useUrl()
let mixpanelEvent = MixpanelHook.useSendEvent()
let businessProfiles = HyperswitchAtom.businessProfilesAtom->Recoil.useRecoilValueFromAtom
let defaultBusinessProfile = businessProfiles->MerchantAccountUtils.getValueFromBusinessProfile
Expand Down Expand Up @@ -170,6 +171,10 @@ module ConnectorSummaryGrid = {
let (_, connectorAccountFields, _, _, _, _, _) = ConnectorUtils.getConnectorFields(
connectorDetails,
)
let isUpdateFlow = switch url.path->HSwitchUtils.urlPath {
| list{_, "new"} => false
| _ => true
}

<div className="p-2 md:px-10">
<div className="grid grid-cols-4 my-12">
Expand Down Expand Up @@ -222,7 +227,9 @@ module ConnectorSummaryGrid = {
})
->React.array}
</div>
<ConnectorUpdateAuthCreds connectorInfo getConnectorDetails />
<RenderIf condition={isUpdateFlow}>
<ConnectorUpdateAuthCreds connectorInfo getConnectorDetails />
</RenderIf>
</div>
</div>
<div />
Expand Down Expand Up @@ -256,21 +263,23 @@ module ConnectorSummaryGrid = {
})
->React.array}
</div>
<div
className="cursor-pointer"
onClick={_ => {
mixpanelEvent(~eventName=`processor_update_payment_methods_${connector}`)
<RenderIf condition={isUpdateFlow}>
<div
className="cursor-pointer"
onClick={_ => {
mixpanelEvent(~eventName=`processor_update_payment_methods_${connector}`)

setCurrentStep(_ => state)
}}>
<ToolTip
height=""
description={`Update the ${connector} payment methods`}
toolTipFor={<Icon size=18 name="edit" className={` ml-2`} />}
toolTipPosition=Top
tooltipWidthClass="w-fit"
/>
</div>
setCurrentStep(_ => state)
}}>
<ToolTip
height=""
description={`Update the ${connector} payment methods`}
toolTipFor={<Icon size=18 name="edit" className={` ml-2`} />}
toolTipPosition=Top
tooltipWidthClass="w-fit"
/>
</div>
</RenderIf>
</div>
<div
className="flex border items-start bg-blue-800 border-blue-810 text-sm rounded-md gap-2 px-4 py-3">
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Connectors/ConnectorUpdateAuthCreds.res
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let make = (~connectorInfo: ConnectorTypes.connectorPayload, ~getConnectorDetail
| AuthenticationProcessor => Window.getAuthenticationConnectorConfig(connectorName)
| PMAuthProcessor => Window.getPMAuthenticationProcessorConfig(connectorName)
| TaxProcessor => Window.getTaxProcessorConfig(connectorName)
| _ => JSON.Encode.null
| PaymentVas => JSON.Encode.null
}
dict
} else {
Expand Down
1 change: 1 addition & 0 deletions src/screens/Connectors/ConnectorUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -1695,6 +1695,7 @@ let connectorTypeTuple = connectorType => {
| "payout_processor" => (PayoutProcessor, PayoutConnector)
| "authentication_processor" => (AuthenticationProcessor, ThreeDsAuthenticator)
| "payment_method_auth" => (PMAuthProcessor, PMAuthenticationProcessor)
| "tax_processor" => (TaxProcessor, TaxProcessor)
| _ => (PaymentProcessor, Processor)
}
}
Expand Down

0 comments on commit de870b5

Please sign in to comment.