From 04e39b4cf940dd0ce7d033ab8d6dceb9f08944cc Mon Sep 17 00:00:00 2001 From: Sagar Naik Date: Fri, 24 Nov 2023 16:02:46 +0530 Subject: [PATCH] system metrics changes --- src/entryPoints/hyperswitch/HyperSwitchApp.res | 10 ++++++---- src/entryPoints/hyperswitch/SidebarValues.res | 10 +++++++--- .../HyperSwitch/Utils/HSwitchGlobalSearchBar.res | 2 ++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res index 279f38ef7..afccd08b1 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchApp.res +++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res @@ -50,7 +50,6 @@ let make = () => { let getEnumDetails = EnumVariantHook.useFetchEnumDetails() let verificationDays = getFromMerchantDetails("verification")->LogicUtils.getIntFromString(-1) let userRole = getFromUserDetails("user_role") - let modeText = featureFlagDetails.testLiveMode ? "Live Mode" : "Test Mode" let titleComingSoonMessage = "Coming Soon!" let subtitleComingSoonMessage = "We are currently working on this page." @@ -65,6 +64,7 @@ let make = () => { let hyperSwitchAppSidebars = SidebarValues.getHyperSwitchAppSidebars( ~isReconEnabled, ~featureFlagDetails, + ~userRole, (), ) @@ -315,9 +315,11 @@ let make = () => { | list{"monitoring"} => comingSoonPage | list{"developer-api-keys"} => | list{"developer-system-metrics"} => - - - + Js.String2.includes("internal_")}> + + + + | list{"webhooks", ...remainingPath} => +let developers = (isDevelopersEnabled, ~userRole) => { + let isInternalUser = userRole->Js.String2.includes("internal_") + isDevelopersEnabled ? Section({ name: "Developers", icon: "developer", showSection: true, - links: [apiKeys, webhooks, systemMetrics], + links: isInternalUser ? [apiKeys, webhooks, systemMetrics] : [apiKeys, webhooks], }) : emptyComponent +} // * PRO Features @@ -276,6 +279,7 @@ let reconTag = (recon, isReconEnabled) => let getHyperSwitchAppSidebars = ( ~isReconEnabled=false, ~featureFlagDetails: FeatureFlagUtils.featureFlag, + ~userRole, (), ) => { let {productionAccess, frm, payOut, recon, default, userManagement} = featureFlagDetails @@ -286,7 +290,7 @@ let getHyperSwitchAppSidebars = ( default->analytics, default->connectors, default->workflow, - default->developers, + default->developers(~userRole), default->settings, [frm, payOut, recon]->Js.Array2.includes(true)->proFeatures, frm->fraudAndRisk, diff --git a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res index 05216c02e..ba66bf049 100644 --- a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res +++ b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res @@ -89,12 +89,14 @@ let make = () => { ->LogicUtils.safeParse ->FeatureFlagUtils.featureFlagType let merchentDetails = HSwitchUtils.useMerchantDetailsValue() + let userRole = HSLocalStorage.getFromUserDetails("user_role") let isReconEnabled = (merchentDetails->HSwitchMerchantAccountUtils.getMerchantDetails).recon_status === Active let hswitchTabs = SidebarValues.getHyperSwitchAppSidebars( ~isReconEnabled, ~featureFlagDetails, + ~userRole, (), ) let url = RescriptReactRouter.useUrl()