From 25c9d2394cdf3aafb5739c169dfc4364259f3f07 Mon Sep 17 00:00:00 2001 From: Sagar naik Date: Mon, 9 Dec 2024 12:39:31 +0530 Subject: [PATCH] chore: smart retry tab code (#1865) --- config/config.toml | 1 + src/container/NewAnalyticsContainer.res | 15 ++++++++++++++- src/entryPoints/FeatureFlagUtils.res | 2 ++ src/entryPoints/HyperSwitchApp.res | 3 ++- .../NewAnalytics/NewAnalyticsContainerUtils.res | 6 +++++- src/screens/NewAnalytics/NewAnalyticsTypes.res | 6 ++++-- 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/config/config.toml b/config/config.toml index 68c014e9a..8b5bf4477 100644 --- a/config/config.toml +++ b/config/config.toml @@ -46,6 +46,7 @@ compliance_certificate=false pm_authentication_processor=true performance_monitor=false new_analytics=false +new_analytics_smart_retries=false down_time=false tax_processor=true transaction_view=false diff --git a/src/container/NewAnalyticsContainer.res b/src/container/NewAnalyticsContainer.res index ccfbdb3e2..ad1977e5a 100644 --- a/src/container/NewAnalyticsContainer.res +++ b/src/container/NewAnalyticsContainer.res @@ -6,6 +6,7 @@ let make = () => { let getURL = useGetURL() let updateDetails = useUpdateMethod() let url = RescriptReactRouter.useUrl() + let {newAnalyticsSmartRetries} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom let {updateExistingKeys} = React.useContext(FilterContext.filterContext) let (tabIndex, setTabIndex) = React.useState(_ => url->getPageIndex) let {filterValueJson} = React.useContext(FilterContext.filterContext) @@ -63,7 +64,7 @@ let make = () => { None }, []) - let tabs: array = [ + let defaultTabs: array = [ { title: "Payments", renderContent: () => @@ -72,6 +73,18 @@ let make = () => { , }, ] + + let tabs = if newAnalyticsSmartRetries { + defaultTabs->Array.concat([ + { + title: "Smart Retries", + renderContent: () => React.null, + }, + ]) + } else { + defaultTabs + } +
diff --git a/src/entryPoints/FeatureFlagUtils.res b/src/entryPoints/FeatureFlagUtils.res index 89241b886..0eddc173a 100644 --- a/src/entryPoints/FeatureFlagUtils.res +++ b/src/entryPoints/FeatureFlagUtils.res @@ -39,6 +39,7 @@ type featureFlag = { pmAuthenticationProcessor: bool, performanceMonitor: bool, newAnalytics: bool, + newAnalyticsSmartRetries: bool, downTime: bool, taxProcessor: bool, transactionView: bool, @@ -84,6 +85,7 @@ let featureFlagType = (featureFlags: JSON.t) => { pmAuthenticationProcessor: dict->getBool("pm_authentication_processor", false), performanceMonitor: dict->getBool("performance_monitor", false), newAnalytics: dict->getBool("new_analytics", false), + newAnalyticsSmartRetries: dict->getBool("new_analytics_smart_retries", false), downTime: dict->getBool("down_time", false), taxProcessor: dict->getBool("tax_processor", false), transactionView: dict->getBool("transaction_view", false), diff --git a/src/entryPoints/HyperSwitchApp.res b/src/entryPoints/HyperSwitchApp.res index 7f51f7408..80eb80086 100644 --- a/src/entryPoints/HyperSwitchApp.res +++ b/src/entryPoints/HyperSwitchApp.res @@ -182,7 +182,8 @@ let make = () => { | list{"analytics-refunds"} | list{"analytics-disputes"} => - | list{"new-analytics-payment"} => + | list{"new-analytics-payment"} + | list{"new-analytics-smart-retry"} => { switch string { + | "new-analytics-smart-retry" => NewAnalyticsSmartRetry | "new-analytics-payment" | _ => NewAnalyticsPayment } } let getPageIndex = (url: RescriptReactRouter.url) => { switch url.path->HSwitchUtils.urlPath { + | list{"new-analytics-smart-retry"} => 1 | list{"new-analytics-payment"} | _ => 0 } } let getPageFromIndex = index => { switch index { - | 1 | _ => NewAnalyticsPayment + | 1 => NewAnalyticsSmartRetry + | 0 | _ => NewAnalyticsPayment } } + let renderValueInp = () => (_fieldsArray: array) => { React.null } diff --git a/src/screens/NewAnalytics/NewAnalyticsTypes.res b/src/screens/NewAnalytics/NewAnalyticsTypes.res index 2a10012c0..78539d8fb 100644 --- a/src/screens/NewAnalytics/NewAnalyticsTypes.res +++ b/src/screens/NewAnalytics/NewAnalyticsTypes.res @@ -2,7 +2,9 @@ type analyticsPages = Payment type viewType = Graph | Table type statisticsDirection = Upward | Downward | No_Change -type analyticsPagesRoutes = | @as("new-analytics-payment") NewAnalyticsPayment +type analyticsPagesRoutes = + | @as("new-analytics-payment") NewAnalyticsPayment + | @as("new-analytics-smart-retry") NewAnalyticsSmartRetry type domain = [#payments | #refunds | #disputes] type dimension = [ @@ -28,7 +30,7 @@ type metrics = [ type granularity = [ | #G_ONEDAY ] -// will change this once we get the api srtcuture + type requestBodyConfig = { metrics: array, delta?: bool,