From e1144ac0fe0c7573891097fbb1a8fc2b5ac6ff48 Mon Sep 17 00:00:00 2001 From: Lokesh Jain Date: Mon, 15 Jan 2024 16:07:30 +0530 Subject: [PATCH] refactor: cleanup routing previewer --- .../AdvancedRouting/RoutingPreviewer.res | 125 +----------------- 1 file changed, 1 insertion(+), 124 deletions(-) diff --git a/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res b/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res index 578ca6eb4..95f691b4a 100644 --- a/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res +++ b/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res @@ -1,5 +1,4 @@ open RoutingTypes -open RoutingUtils module SimplePreview = { @react.component @@ -26,6 +25,7 @@ module SimplePreview = { } } + module GatewayView = { @react.component let make = (~gateways, ~connectorList=?) => { @@ -56,126 +56,3 @@ module GatewayView = { } } -module RulePreviewer = { - @react.component - let make = (~ruleInfo: ruleInfoType, ~isFrom3ds=false) => { - open LogicUtils -
-
-
- {ruleInfo.rules - ->Array.mapWithIndex((rule, index) => { - let headingText = `Rule ${string_of_int(index + 1)}` - let marginStyle = index === ruleInfo.rules->Array.length - 1 ? "mt-2" : "my-2" - let threeDsType = - rule.routingOutput->Belt.Option.getWithDefault(defaultThreeDsObjectValue) -
-
- {headingText->React.string} -
-
-
- {rule.conditions - ->RoutingUtils.filterEmptyValues - ->Array.mapWithIndex((condition, index) => { - let logical = logicalOperatorTypeToStringMapper(condition.logicalOperator) - let operator = operatorTypeToStringMapper(condition.operator) - let field = condition.field->String.length > 0 ? condition.field : "" - - let value = switch condition.value { - | StringArray(arr) => arr->Array.joinWith(", ") - | String(str) => str - | Int(int) => int->Belt.Int.toString - } - let metadataKey = switch condition.metadata { - | Some(json) => json->getDictFromJsonObject->getOptionString("key") - | _ => None - } - -
- - - - - {switch metadataKey { - | Some(key) => - | None => React.null - }} - - -
- }) - ->React.array} -
- Array.length > 0}> - - - -
- {threeDsType.override_3ds->LogicUtils.capitalizeString->React.string} -
-
- - - -
-
- }) - ->React.array} -
- -
-
- ()} - /> -
- {React.string("Default Processors")} - {React.string(" *")} -
-
-
- {ruleInfo.default_gateways - ->Array.mapWithIndex((gateway, index) => { -
-
- {React.string(string_of_int(index + 1))} -
-
{gateway->React.string}
- Array.length - 1}> - ()} - /> - -
- }) - ->React.array} -
-
-
-
-
- } -}