From 1ddbe6874c93dccee2cfc1d73281ba6ce9008323 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <77892330+PritishBudhiraja@users.noreply.github.com> Date: Fri, 15 Dec 2023 14:37:21 +0530 Subject: [PATCH] refactor: Refactoring key errors (#100) --- src/components/CustomExpandableTable.res | 5 +++-- src/components/DynamicSingleStat.res | 19 +++++++++---------- src/components/SelectBox.res | 7 +++++-- src/components/Table.res | 3 ++- src/components/tooltip/ToolTip.res | 4 ++-- .../ConnectorAccountDetailsHelper.res | 4 ++-- .../FraudAndRisk/FRMPaymentMethods.res | 10 ++++++---- .../HyperSwitch/FraudAndRisk/FRMSummary.res | 12 ++++++------ .../RoutingRevamp/AdvancedRouting.res | 1 + .../HyperSwitch/Settings/BusinessDetails.res | 4 +++- 10 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src/components/CustomExpandableTable.res b/src/components/CustomExpandableTable.res index 5f8a0453c..b2287f40c 100644 --- a/src/components/CustomExpandableTable.res +++ b/src/components/CustomExpandableTable.res @@ -107,8 +107,9 @@ let make = ( let fontWeight = "font-bold" let fontSize = "text-sm" let paddingClass = "px-4 py-3" - - + string_of_int}> +
diff --git a/src/components/DynamicSingleStat.res b/src/components/DynamicSingleStat.res index 9965eaef5..53ccbe53d 100644 --- a/src/components/DynamicSingleStat.res +++ b/src/components/DynamicSingleStat.res @@ -466,6 +466,7 @@ let make = ( ) string_of_int} title=info.title tooltipText=info.tooltipText deltaTooltipComponent={info.deltaTooltipComponent(info.statType)} @@ -485,6 +486,7 @@ let make = ( | None => string_of_int} title="" tooltipText="" deltaTooltipComponent=React.null @@ -520,16 +522,15 @@ let make = ( } }) - -
Belt.Int.toString}> - {if sectionName === "" { - React.null - } else { + string_of_int}> +
+
{sectionName->React.string}
- }} +
{switch urlConfig.sectionInfo { | Some(info) =>
{singleStateArr ->Array.mapWithIndex((element, index) => { - if index < 4 || showStats { + string_of_int}>
element
- } else { - React.null - } +
}) ->React.array}
diff --git a/src/components/SelectBox.res b/src/components/SelectBox.res index 6e36e5bcd..5d93c86b4 100644 --- a/src/components/SelectBox.res +++ b/src/components/SelectBox.res @@ -252,7 +252,8 @@ module ListItem = { Js.String2.toLowerCase("_" ++ searchString)) && Js.String2.length(searchString) > 0 ) { - + string_of_int} attributes=[("data-searched-text", item)]> string_of_int} className={`${searchMatchTextColor} bg-transparent`}> {item->React.string} @@ -268,7 +269,8 @@ module ListItem = { } let selectOptions = - + string_of_int}> string_of_int} className=textClass value=labelText> {item->React.string} @@ -277,6 +279,7 @@ module ListItem = { { if showToolTipOptions { string_of_int} description=item toolTipFor=selectOptions contentAlign=Default diff --git a/src/components/Table.res b/src/components/Table.res index 0c225c706..0305c456a 100644 --- a/src/components/Table.res +++ b/src/components/Table.res @@ -197,7 +197,8 @@ module TableRow = { } let location = `${title}_tr${(rowIndex + 1)->Belt.Int.toString}_td${(cellIndex + 1) ->Belt.Int.toString}` - + string_of_int} attributes=[("data-table-location", location)]> Js.String2.split("\n") ->Js.Array2.filter(str => str !== "") - ->Js.Array2.map(item => { - + ->Js.Array2.mapi((item, i) => { + string_of_int}>
{React.string(item)}
}) diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res index d5684ede0..72040836b 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res @@ -105,10 +105,10 @@ module RenderConnectorInputFields = { let keys = details->Js.Dict.keys->Js.Array2.filter(ele => !Js.Array2.includes(keysToIgnore, ele)) keys - ->Array.map(field => { + ->Array.mapWithIndex((field, i) => { let label = details->getString(field, "") let formName = isLabelNested ? `${name}.${field}` : name - Js.String2.length > 0}> + Js.String2.length > 0} key={i->string_of_int}>
{frmConfigInfo.payment_methods - ->Js.Array2.map(paymentMethodInfo => { - + ->Js.Array2.mapi((paymentMethodInfo, index) => { + string_of_int}> {paymentMethodInfo.payment_method_types - ->Js.Array2.map(paymentMethodTypeInfo => { + ->Js.Array2.mapi((paymentMethodTypeInfo, i) => { string_of_int} initialExpandedArray=[0] accordion={[ { @@ -310,8 +311,9 @@ module PaymentMethodsRenderer = {
{frmConfigs - ->Js.Array2.map(configInfo => { + ->Js.Array2.mapi((configInfo, i) => { string_of_int} frmConfigInfo={configInfo} frmConfigs connectorPaymentMethods={connectorConfig->Js.Dict.get(configInfo.gateway)} diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res index a967599f2..6beb375e6 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMSummary.res @@ -25,18 +25,18 @@ module ConfigInfo = { @react.component let make = (~frmConfigs) => { frmConfigs - ->Js.Array2.map(config => { -
+ ->Js.Array2.mapi((config, i) => { +
string_of_int}>

{config.gateway->snakeToTitle->React.string}

{config.payment_methods - ->Js.Array2.map(paymentMethod => { -
+ ->Js.Array2.mapi((paymentMethod, ind) => { +
string_of_int}> {paymentMethod.payment_method_types ->Array.mapWithIndex( - (paymentMethodType, i) => { + (paymentMethodType, index) => { string_of_int} + key={index->string_of_int} label={paymentMethodType.payment_method_type} flowTypeValue={paymentMethodType.flow} actionTypeValue={paymentMethodType.action} diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res index 076b6c8cd..5bafd13d7 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res @@ -281,6 +281,7 @@ For example: If card_type = credit && amount > 100, route 60% to Stripe and 40% let id = {`${rulesJsonPath}[${string_of_int(index)}]`} string_of_int} id heading={`Rule ${string_of_int(index + 1)}`} onClickAdd={_ => addRule(index, false)} diff --git a/src/screens/HyperSwitch/Settings/BusinessDetails.res b/src/screens/HyperSwitch/Settings/BusinessDetails.res index 04897eeed..359d36484 100644 --- a/src/screens/HyperSwitch/Settings/BusinessDetails.res +++ b/src/screens/HyperSwitch/Settings/BusinessDetails.res @@ -141,7 +141,9 @@ let make = () => { className="flex flex-col md:flex-row justify-between bg-white p-7 gap-8 rounded-sm border border-jp-gray-border_gray">
{renderingArray - ->Js.Array2.map(details => ) + ->Js.Array2.mapi((details, i) => + string_of_int} details formState merchantInfo /> + ) ->React.array}
{switch formState {