Skip to content

Commit

Permalink
Merge branch 'main' into chore/signin-signup-changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Nov 28, 2023
2 parents 0dd7c8e + 967de86 commit 23c774a
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @juspay/hyperswitch-control-center-maintainers
29 changes: 29 additions & 0 deletions public/hyperswitch/Gateway/BANKOFAMERICA.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 7 additions & 5 deletions src/entryPoints/hyperswitch/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -65,6 +64,7 @@ let make = () => {
let hyperSwitchAppSidebars = SidebarValues.getHyperSwitchAppSidebars(
~isReconEnabled,
~featureFlagDetails,
~userRole,
(),
)

Expand Down Expand Up @@ -208,7 +208,7 @@ let make = () => {
<div className="w-full max-w-fixedPageWidth px-9">
<Navbar
headerActions={<div className="relative flex items-center gap-4 my-2 ">
// <HSwitchGlobalSearchBar />
<HSwitchGlobalSearchBar />
<RenderIf condition={featureFlagDetails.switchMerchant}>
<SwitchMerchant userRole={userRole} />
</RenderIf>
Expand Down Expand Up @@ -315,9 +315,11 @@ let make = () => {
| list{"monitoring"} => comingSoonPage
| list{"developer-api-keys"} => <KeyManagement.KeysManagement />
| list{"developer-system-metrics"} =>
<AnalyticsUrlUpdaterContext key="SystemMetrics">
<SystemMetricsAnalytics />
</AnalyticsUrlUpdaterContext>
<UIUtils.RenderIf condition={userRole->Js.String2.includes("internal_")}>
<AnalyticsUrlUpdaterContext key="SystemMetrics">
<SystemMetricsAnalytics />
</AnalyticsUrlUpdaterContext>
</UIUtils.RenderIf>
| list{"webhooks", ...remainingPath} =>
<EntityScaffold
entityName="WebHooks"
Expand Down
10 changes: 7 additions & 3 deletions src/entryPoints/hyperswitch/SidebarValues.res
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,18 @@ let webhooks = SubLevelLink({
searchOptions: [("View Webhooks", "")],
})

let developers = isDevelopersEnabled =>
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

Expand Down Expand Up @@ -276,6 +279,7 @@ let reconTag = (recon, isReconEnabled) =>
let getHyperSwitchAppSidebars = (
~isReconEnabled=false,
~featureFlagDetails: FeatureFlagUtils.featureFlag,
~userRole,
(),
) => {
let {productionAccess, frm, payOut, recon, default, userManagement} = featureFlagDetails
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ let make = (
connectorMetaDataFields,
isVerifyConnector,
connectorWebHookDetails,
connectorLabelDetailField,
) = getConnectorFields(connectorDetails)

let (showModal, setShowModal) = React.useState(_ => false)
Expand Down Expand Up @@ -440,6 +441,7 @@ let make = (
connectorAccountFields,
connectorMetaDataFields,
connectorWebHookDetails,
connectorLabelDetailField,
errors->Js.Json.object_,
)
}
Expand Down
4 changes: 3 additions & 1 deletion src/screens/HyperSwitch/Connectors/ConnectorPreview.res
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ module ConnectorSummaryGrid = {
}
}
}, [connector])
let (_, connectorAccountFields, _, _, _) = ConnectorUtils.getConnectorFields(connectorDetails)
let (_, connectorAccountFields, _, _, _, _) = ConnectorUtils.getConnectorFields(
connectorDetails,
)
let webhooksUrl = ConnectorUtils.getWebhooksUrl(~connectorName=connector, ~merchantId)

<div className="p-2 md:px-10">
Expand Down
1 change: 1 addition & 0 deletions src/screens/HyperSwitch/Connectors/ConnectorTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type connectorName =
| ADYEN
| CHECKOUT
| BRAINTREE
| BANKOFAMERICA
| AUTHORIZEDOTNET
| STRIPE
| KLARNA
Expand Down
22 changes: 22 additions & 0 deletions src/screens/HyperSwitch/Connectors/ConnectorUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ let connectorList: array<connectorName> = [
ADYEN,
AIRWALLEX,
AUTHORIZEDOTNET,
BANKOFAMERICA,
BAMBORA,
BITPAY,
BLUESNAP,
Expand Down Expand Up @@ -459,6 +460,10 @@ let unknownConnectorInfo = {
description: "unkown connector",
}

let bankOfAmericaInfo = {
description: "A top financial firm offering banking, investing, and risk solutions to individuals and businesses.",
}

let getConnectorNameString = connector => {
switch connector {
| ADYEN => "adyen"
Expand Down Expand Up @@ -510,6 +515,7 @@ let getConnectorNameString = connector => {
| GOCARDLESS => "gocardless"
| VOLT => "volt"
| PROPHETPAY => "prophetpay"
| BANKOFAMERICA => "bankofamerica"
| UnknownConnector(str) => str
}
}
Expand Down Expand Up @@ -564,6 +570,7 @@ let getConnectorNameTypeFromString = connector => {
| "cryptopay" => CRYPTOPAY
| "gocardless" => GOCARDLESS
| "volt" => VOLT
| "bankofamerica" => BANKOFAMERICA
| "prophetpay" => PROPHETPAY
| _ => UnknownConnector("Not known")
}
Expand Down Expand Up @@ -620,6 +627,7 @@ let getConnectorInfo = (connector: connectorName) => {
| STAX => staxInfo
| VOLT => voltInfo
| PROPHETPAY => prophetpayInfo
| BANKOFAMERICA => bankOfAmericaInfo
| UnknownConnector(_) => unknownConnectorInfo
}
}
Expand Down Expand Up @@ -877,6 +885,7 @@ let validateConnectorRequiredFields = (
connectorAccountFields,
connectorMetaDataFields,
connectorWebHookDetails,
connectorLabelDetailField,
errors,
) => {
open LogicUtils
Expand Down Expand Up @@ -935,6 +944,15 @@ let validateConnectorRequiredFields = (
Js.Dict.set(newDict, key, `Please enter ${errorKey}`->Js.Json.string)
}
})
connectorLabelDetailField
->Js.Dict.keys
->Js.Array2.forEach(fieldName => {
let errorKey = connectorLabelDetailField->LogicUtils.getString(fieldName, "")
let value = valuesFlattenJson->LogicUtils.getString(fieldName, "")
if value->Js.String2.length === 0 {
Js.Dict.set(newDict, fieldName, `Please enter ${errorKey}`->Js.Json.string)
}
})
newDict->Js.Json.object_
}

Expand Down Expand Up @@ -990,12 +1008,16 @@ let getConnectorFields = connectorDetails => {
connectorDetails
->LogicUtils.getDictFromJsonObject
->LogicUtils.getDictfromDict("connector_webhook_details")
let connectorLabelDetailField = Js.Dict.fromArray([
("connector_label", "Connector label"->Js.Json.string),
])
(
bodyType,
connectorAccountFields,
connectorMetaDataFields,
isVerifyConnector,
connectorWebHookDetails,
connectorLabelDetailField,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ module ConfigureProcessor = {
connectorMetaDataFields,
_,
connectorWebHookDetails,
connectorLabelDetailField,
) = getConnectorFields(connectorDetails)

let onSubmit = async (values, _) => {
Expand Down Expand Up @@ -113,6 +114,7 @@ module ConfigureProcessor = {
connectorAccountFields,
connectorMetaDataFields,
connectorWebHookDetails,
connectorLabelDetailField,
errors->Js.Json.object_,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module ConnectorDetailsForm = {
connectorMetaDataFields,
_,
connectorWebHookDetails,
_,
) = getConnectorFields(connectorDetails)
let connectorVariant = connectorName->getConnectorNameTypeFromString

Expand Down Expand Up @@ -110,6 +111,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => {
connectorMetaDataFields,
isVerifyConnector,
connectorWebHookDetails,
connectorLabelDetailField,
) = getConnectorFields(connectorDetails)

let (suggestedAction, suggestedActionExists) = getSuggestedAction(
Expand Down Expand Up @@ -221,6 +223,7 @@ let make = (~selectedConnector, ~pageView, ~setPageView, ~setConnectorID) => {
connectorAccountFields,
connectorMetaDataFields,
connectorWebHookDetails,
connectorLabelDetailField,
errors->Js.Json.object_,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ let constructBody = (~connectorName, ~json, ~profileId) => {
~values=[
("profile_id", profileId->Js.Json.string),
("connector_account_details", connectorAccountDetails),
("connector_label", `${connectorName}_default`->Js.Json.string),
]
->Js.Dict.fromArray
->Js.Json.object_,
Expand Down
4 changes: 3 additions & 1 deletion src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -187,7 +189,7 @@ let make = () => {
acc->Js.Array2.concat(matchedSearchValues)
}

| Heading(_) | CustomComponent(_) => []
| Heading(_) | CustomComponent(_) => acc->Js.Array2.concat([])
}
})
setArr(_ => matchedList)
Expand Down
2 changes: 1 addition & 1 deletion src/utils/HSwitchGlobalVars.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@val external appVersion: string = "appVersion"

let mixpanelToken = "773ae99db494f9e23d86ab7a160bc21b" // add your mixpanel token here
let mixpanelToken = "" // add your mixpanel token here

type hostType = Live | Sandbox | Local | Netlify

Expand Down

0 comments on commit 23c774a

Please sign in to comment.