Skip to content

Commit

Permalink
fix: hide connector sr (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnaikjuspay authored Dec 8, 2023
1 parent 0e59c4a commit 0880fd8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ let make = () => {
let (metrics, setMetrics) = React.useState(_ => [])
let (dimensions, setDimensions) = React.useState(_ => [])
let fetchDetails = useGetMethod()
let {isLiveMode} =
HyperswitchAtom.featureFlagAtom
->Recoil.useRecoilValueFromAtom
->LogicUtils.safeParse
->FeatureFlagUtils.featureFlagType

let loadInfo = async () => {
open LogicUtils
Expand Down Expand Up @@ -73,7 +78,7 @@ let make = () => {
tabKeys
tabValues
options
singleStatEntity={getSingleStatEntity(metrics)}
singleStatEntity={getSingleStatEntity(metrics, !isLiveMode)}
getTable={getPaymentTable}
colMapper
tableEntity={paymentTableEntity}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,29 @@ type colT =
| RetriesAmountProcessed
| ConnectorSuccessRate

let defaultColumns: array<DynamicSingleStat.columns<colT>> = [
let getColumns: bool => array<DynamicSingleStat.columns<colT>> = connector_success_rate => [
{
sectionName: "",
columns: [
SuccessRate,
Count,
SuccessCount,
ProcessedAmount,
AvgTicketSize,
RetriesCount,
RetriesAmountProcessed,
ConnectorSuccessRate,
],
columns: connector_success_rate
? [
SuccessRate,
Count,
SuccessCount,
ProcessedAmount,
AvgTicketSize,
RetriesCount,
RetriesAmountProcessed,
ConnectorSuccessRate,
]
: [
SuccessRate,
Count,
SuccessCount,
ProcessedAmount,
AvgTicketSize,
RetriesCount,
RetriesAmountProcessed,
],
},
]

Expand Down Expand Up @@ -413,7 +423,7 @@ let getStatData = (
) => {
switch colType {
| SuccessRate => {
title: "Overall conversion rate",
title: "Overall Conversion Rate",
tooltipText: "Total successful payments processed out of total payments created (This includes user dropouts at shopping cart and checkout page)",
deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat(
singleStatData.payment_success_rate,
Expand Down Expand Up @@ -504,7 +514,7 @@ let getStatData = (
}
| RetriesCount => {
title: "Smart Retries made",
tooltipText: "Total number of retries that were attempted after a failed payment attempt",
tooltipText: "Total number of retries that were attempted after a failed payment attempt (Note: Only date range filters are supoorted currently)",
deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat(
singleStatData.retries_count->Belt.Int.toFloat,
deltaTimestampData.currentSr,
Expand All @@ -518,8 +528,8 @@ let getStatData = (
showDelta: false,
}
| RetriesAmountProcessed => {
title: `Smart retries savings`,
tooltipText: "Total savings in amount terms from retrying failed payments again through a second processor",
title: `Smart Retries Savings`,
tooltipText: "Total savings in amount terms from retrying failed payments again through a second processor (Note: Only date range filters are supoorted currently)",
deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat(
singleStatData.retries_amount_processe /. 100.00,
deltaTimestampData.currentSr,
Expand All @@ -538,7 +548,7 @@ let getStatData = (
showDelta: false,
}
| ConnectorSuccessRate => {
title: "Payment success rate",
title: "Payment Success Rate",
tooltipText: "Total successful payments processed out of all user confirmed payments",
deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat(
singleStatData.connector_success_rate,
Expand All @@ -555,7 +565,7 @@ let getStatData = (
}
}

let getSingleStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> = metrics => {
let getSingleStatEntity = (metrics, connector_success_rate) => {
urlConfig: [
{
uri: `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`,
Expand All @@ -564,7 +574,7 @@ let getSingleStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> =
],
getObjects: itemToObjMapper,
getTimeSeriesObject: timeSeriesObjMapper,
defaultColumns,
defaultColumns: getColumns(connector_success_rate),
getData: getStatData,
totalVolumeCol: None,
matrixUriMapper: _ => `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`,
Expand Down

0 comments on commit 0880fd8

Please sign in to comment.