Skip to content

Commit

Permalink
chore: smart retry tab code (#1865)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnaikjuspay authored Dec 9, 2024
1 parent c5c5542 commit 25c9d23
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion src/container/NewAnalyticsContainer.res
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -63,7 +64,7 @@ let make = () => {
None
}, [])

let tabs: array<Tabs.tab> = [
let defaultTabs: array<Tabs.tab> = [
{
title: "Payments",
renderContent: () =>
Expand All @@ -72,6 +73,18 @@ let make = () => {
</div>,
},
]

let tabs = if newAnalyticsSmartRetries {
defaultTabs->Array.concat([
{
title: "Smart Retries",
renderContent: () => React.null,
},
])
} else {
defaultTabs
}

<PageLoaderWrapper screenState>
<div>
<PageUtils.PageHeading title="Insights" />
Expand Down
2 changes: 2 additions & 0 deletions src/entryPoints/FeatureFlagUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type featureFlag = {
pmAuthenticationProcessor: bool,
performanceMonitor: bool,
newAnalytics: bool,
newAnalyticsSmartRetries: bool,
downTime: bool,
taxProcessor: bool,
transactionView: bool,
Expand Down Expand Up @@ -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),
Expand Down
3 changes: 2 additions & 1 deletion src/entryPoints/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ let make = () => {
| list{"analytics-refunds"}
| list{"analytics-disputes"} =>
<AnalyticsContainer />
| list{"new-analytics-payment"} =>
| list{"new-analytics-payment"}
| list{"new-analytics-smart-retry"} =>
<AccessControl
isEnabled={featureFlagDetails.newAnalytics &&
useIsFeatureEnabledForMerchant(merchantSpecificConfig.newAnalytics)}
Expand Down
6 changes: 5 additions & 1 deletion src/screens/NewAnalytics/NewAnalyticsContainerUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,25 @@ open NewAnalyticsTypes

let getPageVariant = string => {
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<ReactFinalForm.fieldRenderProps>) => {
React.null
}
Expand Down
6 changes: 4 additions & 2 deletions src/screens/NewAnalytics/NewAnalyticsTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -28,7 +30,7 @@ type metrics = [
type granularity = [
| #G_ONEDAY
]
// will change this once we get the api srtcuture

type requestBodyConfig = {
metrics: array<metrics>,
delta?: bool,
Expand Down

0 comments on commit 25c9d23

Please sign in to comment.