diff --git a/config/FeatureFlag.json b/config/FeatureFlag.json index 6067fb9b5..2a0addeb4 100644 --- a/config/FeatureFlag.json +++ b/config/FeatureFlag.json @@ -22,5 +22,6 @@ "forgot_password": false, "user_journey_analytics": false, "surcharge": false, - "customers_module": false + "customers_module": false, + "permission_based_module": false } diff --git a/src/components/EntityScaffold.res b/src/components/EntityScaffold.res index 68afbe809..4d02b1644 100644 --- a/src/components/EntityScaffold.res +++ b/src/components/EntityScaffold.res @@ -5,28 +5,15 @@ let make = ( ~isAdminAccount=false, ~access: AuthTypes.authorization=Access, ~renderList, - ~renderNewForm=?, - ~renderShow=?, + ~renderNewForm=_ => React.null, + ~renderShow=_ => React.null, ) => { if access === NoAccess { } else { switch remainingPath { - | list{"new"} => - switch access { - | Access => - switch renderNewForm { - | Some(element) => element() - | None => React.null - } - | NoAccess => - } - | list{id} => - let page = switch renderShow { - | Some(fn) => fn(id) - | None => React.null - } - page + | list{"new"} => renderNewForm() + | list{id} => renderShow(id) | list{} => renderList() | _ => } diff --git a/src/entryPoints/hyperswitch/FeatureFlagUtils.res b/src/entryPoints/hyperswitch/FeatureFlagUtils.res index 438bc3945..dda0429d9 100644 --- a/src/entryPoints/hyperswitch/FeatureFlagUtils.res +++ b/src/entryPoints/hyperswitch/FeatureFlagUtils.res @@ -24,6 +24,7 @@ type featureFlag = { userJourneyAnalytics: bool, surcharge: bool, customersModule: bool, + permissionBasedModule: bool, } let featureFlagType = (featureFlags: Js.Json.t) => { @@ -55,6 +56,7 @@ let featureFlagType = (featureFlags: Js.Json.t) => { userJourneyAnalytics: dict->getBool("user_journey_analytics", false), surcharge: dict->getBool("surcharge", false), customersModule: dict->getBool("customers_module", false), + permissionBasedModule: dict->getBool("permission_based_module", false), } typedFeatureFlag } diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res index 0cd6e137c..8f90ad3b9 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchApp.res +++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res @@ -1,11 +1,12 @@ -open UIUtils -open HSwitchUtils -open HSLocalStorage -open HSwitchGlobalVars -open APIUtils - @react.component let make = () => { + open UIUtils + open HSwitchUtils + open HSwitchGlobalVars + open APIUtils + open PermissionUtils + open LogicUtils + let url = RescriptReactRouter.useUrl() let fetchDetails = useGetMethod() let { @@ -14,49 +15,39 @@ let make = () => { dashboardPageState, setDashboardPageState, setQuickStartPageState, + isProdIntentCompleted, } = React.useContext(GlobalProvider.defaultContext) let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) - let {isProdIntentCompleted} = React.useContext(GlobalProvider.defaultContext) let fetchBusinessProfiles = MerchantAccountUtils.useFetchBusinessProfiles() let fetchMerchantAccountDetails = MerchantAccountUtils.useFetchMerchantDetails() let fetchConnectorListResponse = ConnectorUtils.useFetchConnectorList() let enumDetails = HyperswitchAtom.enumVariantAtom ->Recoil.useRecoilValueFromAtom - ->LogicUtils.safeParse + ->safeParse ->QuickStartUtils.getTypedValueFromDict let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom + let (userPermissionJson, setuserPermissionJson) = Recoil.useRecoilState( + HyperswitchAtom.userPermissionAtom, + ) let getEnumDetails = EnumVariantHook.useFetchEnumDetails() - let verificationDays = getFromMerchantDetails("verification")->LogicUtils.getIntFromString(-1) - let userRole = getFromUserDetails("user_role") + let verificationDays = HSLocalStorage.getFromMerchantDetails("verification")->getIntFromString(-1) + let userRole = HSLocalStorage.getFromUserDetails("user_role") let modeText = featureFlagDetails.isLiveMode ? "Live Mode" : "Test Mode" - let titleComingSoonMessage = "Coming Soon!" - let subtitleComingSoonMessage = "We are currently working on this page." let modeStyles = featureFlagDetails.isLiveMode ? "bg-hyperswitch_green_trans border-hyperswitch_green_trans text-hyperswitch_green" : "bg-orange-600/80 border-orange-500 text-grey-700" - let merchantDetailsValue = HSwitchUtils.useMerchantDetailsValue() + let merchantDetailsValue = useMerchantDetailsValue() let isReconEnabled = (merchantDetailsValue->MerchantAccountUtils.getMerchantDetails).recon_status === Active let hyperSwitchAppSidebars = SidebarValues.useGetSidebarValues(~isReconEnabled) - let comingSoonPage = - - sessionExpired := false let getAgreementEnum = async () => { - open LogicUtils try { let url = #ProductionAgreement->ProdOnboardingUtils.getProdOnboardingUrl let response = await fetchDetails(url) @@ -96,12 +87,40 @@ let make = () => { } } + let fetchPermissions = async () => { + try { + let url = getURL(~entityName=USERS, ~userType=#GET_PERMISSIONS, ~methodType=Get, ()) + let response = await fetchDetails(url) + let permissionsValue = + response + ->getArrayFromJson([]) + ->Array.map(ele => ele->Js.Json.decodeString->Option.getWithDefault("")) + let permissionJson = + permissionsValue->Array.map(ele => ele->mapStringToPermissionType)->getPermissionJson + setuserPermissionJson(._ => permissionJson) + } catch { + | Js.Exn.Error(e) => { + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") + Js.Exn.raiseError(err) + } + } + } + let setUpDashboard = async () => { try { - let _ = await Window.connectorWasmInit() - let _ = await fetchBusinessProfiles() - let _ = await fetchConnectorListResponse() - let _ = await fetchMerchantAccountDetails() + if featureFlagDetails.permissionBasedModule { + let _ = await fetchPermissions() + } + + if userPermissionJson.merchantConnectorAccountRead === Access { + let _ = await Window.connectorWasmInit() + let _ = await fetchConnectorListResponse() + } + + if userPermissionJson.merchantAccountRead === Access { + let _ = await fetchBusinessProfiles() + let _ = await fetchMerchantAccountDetails() + } if featureFlagDetails.quickStart { let _ = await fetchInitialEnums() @@ -126,40 +145,30 @@ let make = () => { None }) - let setPageState = (pageState: ProviderTypes.dashboardPageStateTypes) => { - setDashboardPageState(_ => pageState) - React.null - } - let determineStripePlusPayPal = () => { - if enumDetails->checkStripePlusPayPal { - RescriptReactRouter.replace("/home") - React.null - } else { - setPageState(#STRIPE_PLUS_PAYPAL) - } + enumDetails->checkStripePlusPayPal + ? RescriptReactRouter.replace("/home") + : setDashboardPageState(_ => #STRIPE_PLUS_PAYPAL) + + React.null } let determineWooCommerce = () => { - if enumDetails->checkWooCommerce { - RescriptReactRouter.replace("/home") - React.null - } else { - setPageState(#WOOCOMMERCE_FLOW) - } + enumDetails->checkWooCommerce + ? RescriptReactRouter.replace("/home") + : setDashboardPageState(_ => #WOOCOMMERCE_FLOW) + + React.null } let determineQuickStartPageState = () => { - if ( - isProdIntentCompleted && - enumDetails.integrationCompleted && - enumDetails.testPayment.payment_id->String.length > 0 - ) { - RescriptReactRouter.replace("/home") - React.null - } else { - setPageState(#QUICK_START) - } + isProdIntentCompleted && + enumDetails.integrationCompleted && + !(enumDetails.testPayment.payment_id->isEmptyString) + ? RescriptReactRouter.replace("/home") + : setDashboardPageState(_ => #QUICK_START) + + React.null } @@ -204,12 +213,11 @@ let make = () => { className="p-6 md:px-16 md:pb-16 pt-[3rem] flex flex-col gap-10 max-w-fixedPageWidth"> {switch url.path { - | list{"home"} => - - {featureFlagDetails.quickStart ? : } - + | list{"home"} => featureFlagDetails.quickStart ? : | list{"fraud-risk-management", ...remainingPath} => - + { /> | list{"connectors", ...remainingPath} => - } - renderNewForm={() => } - renderShow={_ => } - /> + + } + renderNewForm={() => } + renderShow={_ => } + /> + | list{"payoutconnectors", ...remainingPath} => - } - renderNewForm={() => } - renderShow={_ => } - /> - | list{"payments", ...remainingPath} => - + } - renderShow={id => } + renderList={() => } + renderNewForm={() => } + renderShow={_ => } /> - + + | list{"payments", ...remainingPath} => + + + } + renderShow={id => } + /> + + | list{"refunds", ...remainingPath} => - + + + } + renderShow={id => } + /> + + + | list{"disputes", ...remainingPath} => + } - renderShow={id => } + renderList={() => } + renderShow={id => } /> - - | list{"disputes", ...remainingPath} => - } - renderShow={id => } - /> + | list{"customers", ...remainingPath} => - + { /> | list{"routing", ...remainingPath} => - } - renderShow={routingType => } - /> - | list{"users", "invite-users"} => + + } + renderShow={routingType => } + /> + + | list{"users", "invite-users"} => + + + | list{"users", ...remainingPath} => - } - renderShow={_ => } - /> + + } + renderShow={_ => } + /> + | list{"analytics-payments"} => - - - + + + + + | list{"analytics-refunds"} => - - - + + + + + | list{"analytics-user-journey"} => - + - | list{"monitoring"} => comingSoonPage - | list{"developer-api-keys"} => + | list{"developer-api-keys"} => + + + | list{"developer-system-metrics"} => - String.includes("internal_") && - featureFlagDetails.systemMetrics}> + String.includes("internal_") && + featureFlagDetails.systemMetrics} + permission=userPermissionJson.analytics> - + | list{"payment-settings", ...remainingPath} => - } - renderShow={profileId => - } - /> + + } + renderShow={profileId => + } + /> + | list{"recon"} => @@ -328,18 +368,32 @@ let make = () => { - | list{"3ds"} => + | list{"3ds"} => + + + | list{"surcharge"} => - + | list{"account-settings"} => - + - | list{"account-settings", "profile"} => + | list{"account-settings", "profile"} => + + + | list{"business-details"} => - + | list{"business-profiles"} => diff --git a/src/entryPoints/hyperswitch/HyperswitchAtom.res b/src/entryPoints/hyperswitch/HyperswitchAtom.res index 9a600b266..8f7cc5f68 100644 --- a/src/entryPoints/hyperswitch/HyperswitchAtom.res +++ b/src/entryPoints/hyperswitch/HyperswitchAtom.res @@ -14,7 +14,7 @@ let paypalAccountStatusAtom: Recoil.recoilAtom> = Recoil.atom(. +let userPermissionAtom: Recoil.recoilAtom = Recoil.atom(. "userPermissionAtom", - [], + PermissionUtils.defaultValueForPermission, ) diff --git a/src/entryPoints/hyperswitch/SidebarValues.res b/src/entryPoints/hyperswitch/SidebarValues.res index 648d74cde..dbecf02fc 100644 --- a/src/entryPoints/hyperswitch/SidebarValues.res +++ b/src/entryPoints/hyperswitch/SidebarValues.res @@ -1,4 +1,5 @@ open SidebarTypes +open PermissionUtils // * Custom Component @@ -39,6 +40,7 @@ module GetProductionAccess = { let emptyComponent = CustomComponent({ component: React.null, }) + let productionAccessComponent = isProductionAccessEnabled => isProductionAccessEnabled ? CustomComponent({ @@ -58,35 +60,48 @@ let home = isHomeEnabled => }) : emptyComponent -let payments = SubLevelLink({ - name: "Payments", - link: `/payments`, - access: Access, - searchOptions: [("View payment operations", "")], -}) +let payments = permissionJson => { + SubLevelLink({ + name: "Payments", + link: `/payments`, + access: permissionJson.paymentRead, + searchOptions: [("View payment operations", "")], + }) +} -let refunds = SubLevelLink({ - name: "Refunds", - link: `/refunds`, - access: Access, - searchOptions: [("View refund operations", "")], -}) +let refunds = permissionJson => { + SubLevelLink({ + name: "Refunds", + link: `/refunds`, + access: permissionJson.refundRead, + searchOptions: [("View refund operations", "")], + }) +} -let disputes = SubLevelLink({ - name: "Disputes", - link: `/disputes`, - access: Access, - searchOptions: [("View dispute operations", "")], -}) +let disputes = permissionJson => { + SubLevelLink({ + name: "Disputes", + link: `/disputes`, + access: permissionJson.disputeRead, + searchOptions: [("View dispute operations", "")], + }) +} -let customers = SubLevelLink({ - name: "Customers", - link: `/customers`, - access: Access, - searchOptions: [("View customers", "")], -}) +let customers = permissionJson => { + SubLevelLink({ + name: "Customers", + link: `/customers`, + access: permissionJson.customerRead, + searchOptions: [("View customers", "")], + }) +} + +let operations = (isOperationsEnabled, customersModule, ~permissionJson) => { + let payments = payments(permissionJson) + let refunds = refunds(permissionJson) + let disputes = disputes(permissionJson) + let customers = customers(permissionJson) -let operations = (isOperationsEnabled, customersModule) => { isOperationsEnabled ? Section({ name: "Operations", @@ -99,13 +114,13 @@ let operations = (isOperationsEnabled, customersModule) => { : emptyComponent } -let connectors = (isConnectorsEnabled, isLiveMode) => { +let connectors = (isConnectorsEnabled, isLiveMode, ~permissionJson) => { isConnectorsEnabled ? Link({ name: "Processors", link: `/connectors`, icon: "connectors", - access: Access, + access: permissionJson.merchantConnectorAccountRead, searchOptions: HSwitchUtils.getSearchOptionsForProcessors( ~processorList=isLiveMode ? ConnectorUtils.connectorListForLive @@ -138,45 +153,54 @@ let userJourneyAnalytics = SubLevelLink({ searchOptions: [("View analytics", "")], }) -let analytics = (isAnalyticsEnabled, userJourneyAnalyticsFlag) => +let analytics = (isAnalyticsEnabled, userJourneyAnalyticsFlag, ~permissionJson) => { isAnalyticsEnabled ? Section({ name: "Analytics", icon: "analytics", - showSection: true, + showSection: permissionJson.analytics === Access, links: userJourneyAnalyticsFlag ? [paymentAnalytcis, refundAnalytics, userJourneyAnalytics] : [paymentAnalytcis, refundAnalytics], }) : emptyComponent +} +let routing = permissionJson => { + SubLevelLink({ + name: "Routing", + link: `/routing`, + access: permissionJson.routingRead, + searchOptions: [ + ("Manage default routing configuration", "/default"), + ("Create new volume based routing", "/volume"), + ("Create new rule based routing", "/rule"), + ("Manage smart routing", ""), + ], + }) +} -let routing = SubLevelLink({ - name: "Routing", - link: `/routing`, - access: Access, - searchOptions: [ - ("Manage default routing configuration", "/default"), - ("Create new volume based routing", "/volume"), - ("Create new rule based routing", "/rule"), - ("Manage smart routing", ""), - ], -}) - -let threeDs = SubLevelLink({ - name: "3DS Decision Manager", - link: `/3ds`, - access: Access, - searchOptions: [("Configure 3ds", "")], -}) +let threeDs = permissionJson => { + SubLevelLink({ + name: "3DS Decision Manager", + link: `/3ds`, + access: permissionJson.threeDsDecisionManagerRead, + searchOptions: [("Configure 3ds", "")], + }) +} +let surcharge = permissionJson => { + SubLevelLink({ + name: "Surcharge", + link: `/surcharge`, + access: permissionJson.surchargeDecisionManagerRead, + searchOptions: [("Add Surcharge", "")], + }) +} -let surcharge = SubLevelLink({ - name: "Surcharge", - link: `/surcharge`, - access: Access, - searchOptions: [("Add Surcharge", "")], -}) +let workflow = (isWorkflowEnabled, isSurchargeEnabled, ~permissionJson) => { + let routing = routing(permissionJson) + let threeDs = threeDs(permissionJson) + let surcharge = surcharge(permissionJson) -let workflow = (isWorkflowEnabled, isSurchargeEnabled) => isWorkflowEnabled ? Section({ name: "Workflow", @@ -185,50 +209,65 @@ let workflow = (isWorkflowEnabled, isSurchargeEnabled) => links: isSurchargeEnabled ? [routing, threeDs, surcharge] : [routing, threeDs], }) : emptyComponent +} -let userManagement = SubLevelLink({ - name: "Team", - link: `/users`, - access: Access, - searchOptions: [("View team management", "")], -}) - -let accountSettings = SubLevelLink({ - name: "Account Settings", - link: `/account-settings`, - access: Access, - searchOptions: [ - ("View profile", "/profile"), - ("Change password", "/profile"), - ("Manage your personal profile and preferences", "/profile"), - ], -}) +let userManagement = permissionJson => { + SubLevelLink({ + name: "Team", + link: `/users`, + access: permissionJson.usersRead, + searchOptions: [("View team management", "")], + }) +} -let businessDetails = SubLevelLink({ - name: "Business Details", - link: `/business-details`, - access: Access, - searchOptions: [("Configure business details", "")], -}) +let accountSettings = permissionJson => { + // Because it has delete sample data + + SubLevelLink({ + name: "Account Settings", + link: `/account-settings`, + access: permissionJson.merchantAccountWrite, + searchOptions: [ + ("View profile", "/profile"), + ("Change password", "/profile"), + ("Manage your personal profile and preferences", "/profile"), + ], + }) +} -let businessProfiles = SubLevelLink({ - name: "Business Profiles", - link: `/business-profiles`, - access: Access, - searchOptions: [("Configure business profiles", "")], -}) +let businessDetails = permissionJson => { + SubLevelLink({ + name: "Business Details", + link: `/business-details`, + access: permissionJson.merchantAccountRead, + searchOptions: [("Configure business details", "")], + }) +} -let settings = (~isSampleDataEnabled, ~isUserManagementEnabled, ~isBusinessProfileEnabled) => { - let settingsLinkArray = [businessDetails] +let businessProfiles = permissionJson => { + SubLevelLink({ + name: "Business Profiles", + link: `/business-profiles`, + access: permissionJson.merchantAccountRead, + searchOptions: [("Configure business profiles", "")], + }) +} +let settings = ( + ~isSampleDataEnabled, + ~isUserManagementEnabled, + ~isBusinessProfileEnabled, + ~permissionJson, +) => { + let settingsLinkArray = [businessDetails(permissionJson)] if isBusinessProfileEnabled { - settingsLinkArray->Array.push(businessProfiles)->ignore + settingsLinkArray->Array.push(businessProfiles(permissionJson))->ignore } if isSampleDataEnabled { - settingsLinkArray->Array.push(accountSettings)->ignore + settingsLinkArray->Array.push(accountSettings(permissionJson))->ignore } if isUserManagementEnabled { - settingsLinkArray->Array.push(userManagement)->ignore + settingsLinkArray->Array.push(userManagement(permissionJson))->ignore } Section({ @@ -239,30 +278,39 @@ let settings = (~isSampleDataEnabled, ~isUserManagementEnabled, ~isBusinessProfi }) } -let apiKeys = SubLevelLink({ - name: "API Keys", - link: `/developer-api-keys`, - access: Access, - searchOptions: [("View API Keys", "")], -}) +let apiKeys = permissionJson => { + SubLevelLink({ + name: "API Keys", + link: `/developer-api-keys`, + access: permissionJson.apiKeyRead, + searchOptions: [("View API Keys", "")], + }) +} -let systemMetric = SubLevelLink({ - name: "System Metrics", - link: `/developer-system-metrics`, - access: Access, - iconTag: "betaTag", - searchOptions: [("View System Metrics", "")], -}) +let systemMetric = permissionJson => { + SubLevelLink({ + name: "System Metrics", + link: `/developer-system-metrics`, + access: permissionJson.analytics, + iconTag: "betaTag", + searchOptions: [("View System Metrics", "")], + }) +} -let paymentSettings = SubLevelLink({ - name: "Payment Settings", - link: `/payment-settings`, - access: Access, - searchOptions: [("View payment settings", ""), ("View webhooks", ""), ("View return url", "")], -}) +let paymentSettings = permissionJson => { + SubLevelLink({ + name: "Payment Settings", + link: `/payment-settings`, + access: permissionJson.merchantAccountRead, + searchOptions: [("View payment settings", ""), ("View webhooks", ""), ("View return url", "")], + }) +} -let developers = (isDevelopersEnabled, userRole, systemMetrics) => { +let developers = (isDevelopersEnabled, userRole, systemMetrics, ~permissionJson) => { let isInternalUser = userRole->String.includes("internal_") + let apiKeys = apiKeys(permissionJson) + let paymentSettings = paymentSettings(permissionJson) + let systemMetric = systemMetric(permissionJson) isDevelopersEnabled ? Section({ @@ -276,30 +324,32 @@ let developers = (isDevelopersEnabled, userRole, systemMetrics) => { : emptyComponent } -let fraudAndRisk = isfraudAndRiskEnabled => +let fraudAndRisk = (isfraudAndRiskEnabled, ~permissionJson) => { isfraudAndRiskEnabled ? Link({ name: "Fraud & Risk", icon: "shield-alt", link: `/fraud-risk-management`, - access: isfraudAndRiskEnabled ? Access : NoAccess, + access: permissionJson.merchantConnectorAccountRead, searchOptions: [], }) : emptyComponent +} -let payoutConnectors = isPayoutConnectorsEnabled => +let payoutConnectors = (isPayoutConnectorsEnabled, ~permissionJson) => { isPayoutConnectorsEnabled ? Link({ name: "Payout Processors", link: `/payoutconnectors`, icon: "connectors", - access: Access, + access: permissionJson.merchantConnectorAccountRead, searchOptions: HSwitchUtils.getSearchOptionsForProcessors( ~processorList=ConnectorUtils.payoutConnectorList, ~getNameFromString=ConnectorUtils.getConnectorNameString, ), }) : emptyComponent +} let reconTag = (recon, isReconEnabled) => recon @@ -314,6 +364,7 @@ let reconTag = (recon, isReconEnabled) => let useGetSidebarValues = (~isReconEnabled: bool) => { let userRole = HSLocalStorage.getFromUserDetails("user_role") let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom + let permissionJson = Recoil.useRecoilValueFromAtom(HyperswitchAtom.userPermissionAtom) let { productionAccess, @@ -334,18 +385,19 @@ let useGetSidebarValues = (~isReconEnabled: bool) => { let sidebar = [ productionAccess->productionAccessComponent, default->home, - default->operations(customersModule), - default->analytics(userJourneyAnalyticsFlag), - default->connectors(isLiveMode), - default->workflow(isSurchargeEnabled), - frm->fraudAndRisk, - payOut->payoutConnectors, + default->operations(customersModule, ~permissionJson), + default->analytics(userJourneyAnalyticsFlag, ~permissionJson), + default->connectors(isLiveMode, ~permissionJson), + default->workflow(isSurchargeEnabled, ~permissionJson), + frm->fraudAndRisk(~permissionJson), + payOut->payoutConnectors(~permissionJson), recon->reconTag(isReconEnabled), - default->developers(userRole, systemMetrics), + default->developers(userRole, systemMetrics, ~permissionJson), settings( ~isUserManagementEnabled=userManagement, ~isBusinessProfileEnabled=businessProfile, ~isSampleDataEnabled=sampleData, + ~permissionJson, ), ] sidebar diff --git a/src/screens/HyperSwitch/APIUtils/APIUtils.res b/src/screens/HyperSwitch/APIUtils/APIUtils.res index 641dbe13c..5dab5b6c3 100644 --- a/src/screens/HyperSwitch/APIUtils/APIUtils.res +++ b/src/screens/HyperSwitch/APIUtils/APIUtils.res @@ -161,6 +161,7 @@ let getURL = ( | _ => `${userUrl}/${(userType :> string)->String.toLowerCase}` } | #CREATE_MERCHANT => `${userUrl}/create_merchant` + | #GET_PERMISSIONS => `${userUrl}/role` | #SIGNIN | #SIGNUP | #VERIFY_EMAIL diff --git a/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res b/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res index 376659713..d0b8eddef 100644 --- a/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res +++ b/src/screens/HyperSwitch/APIUtils/APIUtilsTypes.res @@ -56,5 +56,6 @@ type userType = [ | #INVITE | #RESEND_INVITE | #CREATE_MERCHANT + | #GET_PERMISSIONS | #NONE ] diff --git a/src/screens/HyperSwitch/Routing/RoutingUtils.res b/src/screens/HyperSwitch/Routing/RoutingUtils.res index 5bce5de18..37c686daa 100644 --- a/src/screens/HyperSwitch/Routing/RoutingUtils.res +++ b/src/screens/HyperSwitch/Routing/RoutingUtils.res @@ -184,16 +184,14 @@ module SaveAndActivateButton = { try { let onSubmitResponse = await onSubmit(formState.values, false) let currentActivatedFromJson = - onSubmitResponse->Js.Nullable.toOption->Belt.Option.getWithDefault(Js.Json.null) + onSubmitResponse->Js.Nullable.toOption->Option.getWithDefault(Js.Json.null) let currentActivatedId = currentActivatedFromJson->LogicUtils.getDictFromJsonObject->LogicUtils.getString("id", "") let _ = await handleActivateConfiguration(Some(currentActivatedId)) } catch { | Js.Exn.Error(e) => - let _err = - Js.Exn.message(e)->Belt.Option.getWithDefault( - "Failed to save and activate configuration!", - ) + let _ = + Js.Exn.message(e)->Option.getWithDefault("Failed to save and activate configuration!") } }