diff --git a/config/FeatureFlag.json b/config/FeatureFlag.json index 9d6e08029..b2819dd0a 100644 --- a/config/FeatureFlag.json +++ b/config/FeatureFlag.json @@ -19,5 +19,6 @@ "business_profile": false, "generate_report": false, "forgot_password": false, - "oss_build": true + "oss_build": true, + "connector_success_rate": false } diff --git a/src/entryPoints/hyperswitch/FeatureFlagUtils.res b/src/entryPoints/hyperswitch/FeatureFlagUtils.res index cbc3b2dd4..1f637d3b8 100644 --- a/src/entryPoints/hyperswitch/FeatureFlagUtils.res +++ b/src/entryPoints/hyperswitch/FeatureFlagUtils.res @@ -21,6 +21,7 @@ type featureFlag = { verifyConnector: bool, forgetPassword: bool, ossBuild: bool, + connector_success_rate: bool, } let featureFlagType = (featureFlags: Js.Json.t) => { @@ -49,6 +50,7 @@ let featureFlagType = (featureFlags: Js.Json.t) => { verifyConnector: dict->getBool("verify_connector", false), forgetPassword: dict->getBool("forgot_password", false), ossBuild: dict->getBool("oss_build", false), + connector_success_rate: dict->getBool("connector_success_rate", false), } typedFeatureFlag } diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res index b4229a0e0..32e962906 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res @@ -8,6 +8,11 @@ let make = () => { let (metrics, setMetrics) = React.useState(_ => []) let (dimensions, setDimensions) = React.useState(_ => []) let fetchDetails = useGetMethod() + let {connector_success_rate} = + HyperswitchAtom.featureFlagAtom + ->Recoil.useRecoilValueFromAtom + ->LogicUtils.safeParse + ->FeatureFlagUtils.featureFlagType let loadInfo = async () => { open LogicUtils @@ -73,7 +78,7 @@ let make = () => { tabKeys tabValues options - singleStatEntity={getSingleStatEntity(metrics)} + singleStatEntity={getSingleStatEntity(metrics, connector_success_rate)} getTable={getPaymentTable} colMapper tableEntity={paymentTableEntity} diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res index c6988eccd..521985c90 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res @@ -319,19 +319,29 @@ type colT = | RetriesAmountProcessed | ConnectorSuccessRate -let defaultColumns: array> = [ +let getColumns: bool => array> = 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, + ], }, ] @@ -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}`, @@ -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}`,