Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: hide connector sr #81

Merged
merged 4 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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