From 089c05142ad9591adac3ef94f66c48321fe6ec65 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja <1805317@kiit.ac.in> Date: Tue, 30 Jan 2024 11:48:53 +0530 Subject: [PATCH] chore: remove Belt API from codebase (#310) --- src/components/Button.res | 2 +- src/components/Calendar.res | 22 +++---- src/components/CalendarList.res | 18 +++--- src/components/CollapsableTableRow.res | 7 +- src/components/CustomCharts/FunnelChart.res | 42 ++++++------ .../HighchartHorizontalBarChart.res | 8 +-- .../CustomCharts/HighchartPieChart.res | 6 +- .../CustomCharts/HighchartTimeSeriesChart.res | 12 ++-- .../CustomCharts/LineChartUtils.res | 22 +++---- src/components/CustomExpandableTable.res | 4 +- src/components/CustomizeTableColumns.res | 2 +- src/components/DateRangePicker.res | 11 ++-- src/components/DynamicSingleStat.res | 4 +- src/components/DynamicTable.res | 2 +- src/components/DynamicTableUtils.res | 4 +- src/components/DynamicTabs.res | 6 +- src/components/HSwitchSingleStatWidget.res | 2 +- src/components/HandlingEvents.res | 2 +- src/components/InfraCalendar.res | 20 +++--- src/components/InfraCalendarList.res | 35 +++++----- src/components/LoadedTable.res | 10 +-- src/components/LocalFilters.res | 2 +- src/components/MultiLineTextInput.res | 2 +- src/components/MultipleFileUpload.res | 7 +- src/components/NewCalendar.res | 42 ++++++------ src/components/NewCalendarList.res | 16 ++--- src/components/NewPagination.res | 2 +- src/components/OrderUtils.res | 2 +- src/components/Pagination.res | 12 ++-- src/components/Paginator.res | 8 +-- src/components/RangeSlider.res | 20 +++--- src/components/RatingOptions.res | 2 +- src/components/ReactWindowTable.res | 10 +-- src/components/RemoteFilter.res | 20 +++--- src/components/RemoteFiltersUtils.res | 2 +- src/components/SelectBox.res | 32 +++++----- src/components/SelectModal.res | 4 +- src/components/Table.res | 13 ++-- src/components/TableUtils.res | 12 ++-- src/components/Tabs.res | 2 +- src/components/TabularInput.res | 4 +- src/components/TimeInput.res | 19 +++--- src/components/custom-icons/Loadericon.res | 4 +- src/components/form/FormRenderer.res | 2 +- src/components/form/NumericTextInput.res | 8 +-- src/components/form/PasswordStrengthInput.res | 4 +- .../form/PasswordStrengthInputAsChips.res | 4 +- src/components/form/TextInput.res | 4 +- .../priority-logics/AddPLGateway.res | 6 +- src/components/tooltip/ToolTip.res | 64 +++++++++---------- src/context/ChartContext.res | 10 +-- src/context/SingleStatContext.res | 6 +- src/context/UserPrefContext.res | 5 +- src/entities/analytics/AnalyticsUtils.res | 24 ++++--- .../hyperswitch/HyperSwitchEntry.res | 2 +- src/genericUtils/BreadCrumbNavigation.res | 2 +- src/hooks/DateRefreshHooks.res | 6 +- src/hooks/TimeZoneHook.res | 6 +- .../PDFViewer/ReactPDFViewerSinglePage.res | 2 +- src/libraries/RRule.res | 17 +++-- .../HyperSwitch/Analytics/Analytics.res | 4 +- .../HyperSwitch/Analytics/ErrorReasons.res | 4 +- .../Analytics/HSAnalyticsUtils.res | 11 +--- .../PaymentAnalyticsEntity.res | 35 +++++----- .../RefundsAnalytics/RefundsAnalytics.res | 2 +- .../RefundsAnalyticsEntity.res | 24 ++++--- .../SystemMetrics/SystemMetricsAnalytics.res | 2 +- .../SystemMetricsAnalyticsUtils.res | 18 +++--- .../UserJourneyAnalyticsEntity.res | 57 +++++++---------- .../Connectors/ConnectorAccountDetails.res | 2 +- .../HyperSwitch/Connectors/ConnectorHome.res | 6 +- .../Connectors/ConnectorTableUtils.res | 2 +- .../Wallets/ApplePayWalletIntegration.res | 4 +- .../HyperSwitch/Connectors/Wallets/Wallet.res | 2 +- .../HyperSwitch/Customers/ShowCustomers.res | 2 +- .../Developer/APIKeys/KeyManagement.res | 6 +- .../PaymentSettings/PaymentSettings.res | 4 +- .../HyperSwitch/Disputes/DisputesEntity.res | 2 +- .../HyperSwitch/Disputes/ShowDisputes.res | 3 +- .../HyperSwitch/FraudAndRisk/FRMConfigure.res | 2 +- .../FraudAndRisk/FRMIntegrationFields.res | 2 +- .../HyperSwitch/FraudAndRisk/FRMSelect.res | 2 +- .../FraudAndRisk/FRMTableUtils.res | 3 +- .../HyperSwitch/HSwitchRemoteFilter.res | 2 +- src/screens/HyperSwitch/Home/HomeUtils.res | 2 +- src/screens/HyperSwitch/Order/OrderEntity.res | 14 ++-- .../HyperSwitch/Order/OrderRefundForm.res | 4 +- src/screens/HyperSwitch/Order/Orders.res | 2 +- src/screens/HyperSwitch/Order/ShowOrder.res | 2 +- src/screens/HyperSwitch/Refunds/Refund.res | 2 +- .../HyperSwitch/Refunds/RefundEntity.res | 2 +- .../HyperSwitch/Refunds/ShowRefund.res | 4 +- .../AdvancedRouting/RoutingPreviewer.res | 2 +- .../HyperSwitch/Routing/RoutingStack.res | 2 +- .../HyperSwitch/Routing/RoutingUtils.res | 10 +-- .../RoutingRevamp/AddRuleGateway.res | 4 +- .../RoutingRevamp/AdvancedRoutingUIUtils.res | 2 +- .../RoutingRevamp/AdvancedRoutingUtils.res | 6 +- .../Previewers/RulePreviewer.res | 15 ++--- src/screens/HyperSwitch/SDKPayment/WebSDK.res | 2 +- .../ProdOnboardingLanding.res | 6 +- .../SetupConnectorCredentials.res | 2 +- .../HyperSwitch/Settings/BusinessDetails.res | 2 +- src/screens/HyperSwitch/Sidebar/Sidebar.res | 2 +- .../UserManagement/ShowUserData.res | 2 +- .../HyperSwitch/Utils/HSSelfServeSidebar.res | 13 ++-- .../HyperSwitch/Utils/HSwitchUtils.res | 2 +- src/screens/componentsDemo/CardTable.res | 2 +- src/screens/componentsDemo/DragDrop.res | 5 +- .../componentsDemo/DragDropComponent.res | 4 +- src/screens/componentsDemo/DragNDropDemo.res | 4 +- .../HSwitchLoginFlow/HyperSwitchAuthUtils.res | 2 +- src/screens/login/ResendBtn.res | 2 +- src/server/Server.res | 5 +- src/utils/AnalyticsNewUtils.res | 2 +- src/utils/DateRangeUtils.res | 17 ++--- src/utils/DateTimeUtils.res | 4 +- src/utils/HyperSwitchUtils.res | 2 +- src/utils/LogicUtils.res | 42 ++++++------ src/utils/NumericUtils.res | 13 ++-- 120 files changed, 489 insertions(+), 570 deletions(-) diff --git a/src/components/Button.res b/src/components/Button.res index e0c5f1d1e..903ef9741 100644 --- a/src/components/Button.res +++ b/src/components/Button.res @@ -348,7 +348,7 @@ let make = ( ~customTextPaddingClass=?, ~allowButtonTextMinWidth=true, ~badge: badge={ - value: 1->Belt.Int.toString, + value: 1->Int.toString, color: NoBadge, }, ~buttonRightText=?, diff --git a/src/components/Calendar.res b/src/components/Calendar.res index b19e60905..c4a448369 100644 --- a/src/components/Calendar.res +++ b/src/components/Calendar.res @@ -163,7 +163,7 @@ module TableRow = { ) let renderingDate = ( - getDate([Belt.Float.toString(year), Belt.Float.toString(month +. 1.0), obj]) + getDate([Float.toString(year), Float.toString(month +. 1.0), obj]) ->Js.Date.toString ->DayJs.getDayJsForString ).format(. "YYYY-MM-DD") @@ -223,8 +223,8 @@ module TableRow = { startDate, endDate, obj, - Belt.Float.toString(month +. 1.0), - Belt.Float.toString(year), + Float.toString(month +. 1.0), + Float.toString(year), ) } let handleHover = () => { @@ -313,7 +313,7 @@ let make = ( let months = [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] let heading = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] let isMobileView = MatchMedia.useMobileChecker() - let getMonthInFloat = mon => Array.indexOf(months, mon)->Belt.Float.fromInt + let getMonthInFloat = mon => Array.indexOf(months, mon)->Float.fromInt let getMonthInStr = mon => { switch mon { | Jan => "January, " @@ -332,7 +332,7 @@ let make = ( } // get first day let firstDay = Js.Date.getDay( - Js.Date.makeWithYM(~year=Belt.Int.toFloat(year), ~month=getMonthInFloat(month), ()), + Js.Date.makeWithYM(~year=Int.toFloat(year), ~month=getMonthInFloat(month), ()), ) // get Days in month let daysInMonth = switch month { @@ -355,15 +355,15 @@ let make = ( let rowMapper = (row, indexRow) => { Array.mapWithIndex(row, (_item, index) => { - let subFactor = Belt.Float.toInt(firstDay) - if indexRow == 0 && index < Belt.Float.toInt(firstDay) { + let subFactor = Float.toInt(firstDay) + if indexRow == 0 && index < Float.toInt(firstDay) { "" } else if indexRow == 0 { - Belt.Int.toString(indexRow + (index + 1) - subFactor) + Int.toString(indexRow + (index + 1) - subFactor) } else if indexRow * 7 + (index + 1) - subFactor > daysInMonth { "" } else { - Belt.Int.toString(indexRow * 7 + (index + 1) - subFactor) + Int.toString(indexRow * 7 + (index + 1) - subFactor) } }) } @@ -374,7 +374,7 @@ let make = ( ? {

{React.string(month->getMonthInStr)} - {React.string(year->Belt.Int.toString)} + {React.string(year->Int.toString)}

} : { @@ -412,7 +412,7 @@ let make = ( ?cellHighlighter ?cellRenderer month={getMonthInFloat(month)} - year={Belt.Int.toFloat(year)} + year={Int.toFloat(year)} startDate endDate disablePastDates diff --git a/src/components/CalendarList.res b/src/components/CalendarList.res index 4a372feee..341116c73 100644 --- a/src/components/CalendarList.res +++ b/src/components/CalendarList.res @@ -29,11 +29,11 @@ let make = ( let _ = onDateClick // check whether month and date has value let getMonthFromFloat = value => { - let valueInt = value->Belt.Float.toInt + let valueInt = value->Float.toInt months[valueInt]->Option.getOr(Jan) } let getMonthInFloat = mon => { - Array.indexOf(months, mon)->Belt.Float.fromInt + Array.indexOf(months, mon)->Float.fromInt } let getMonthInStr = mon => { switch mon { @@ -52,14 +52,14 @@ let make = ( } } let startMonth = switch month { - | Some(m) => Belt.Int.toFloat(Belt.Float.toInt(getMonthInFloat(m))) + | Some(m) => Int.toFloat(Float.toInt(getMonthInFloat(m))) | None => { - let tMonth = Belt.Int.toFloat(Belt.Float.toInt(Js.Date.getMonth(Js.Date.make()))) + let tMonth = Int.toFloat(Float.toInt(Js.Date.getMonth(Js.Date.make()))) disableFutureDates && count > 1 ? tMonth -. 1.0 : tMonth } } let startYear = switch year { - | Some(y) => Belt.Int.toFloat(y) + | Some(y) => Int.toFloat(y) | None => Js.Date.getFullYear(Js.Date.make()) } let (currDateIm, setCurrDate) = React.useState(() => @@ -70,7 +70,7 @@ let make = ( let newDate = Js.Date.fromFloat( Js.Date.setMonth( currDateTemp, - Belt.Int.toFloat(Belt.Float.toInt(Js.Date.getMonth(currDateTemp)) + month), + Int.toFloat(Float.toInt(Js.Date.getMonth(currDateTemp)) + month), ), ) setCurrDate(_ => newDate) @@ -84,7 +84,7 @@ let make = ( let currDateTemp = Js.Date.fromFloat(Js.Date.valueOf(currDateIm)) let tempDate = Js.Date.setMonth( currDateTemp, - Belt.Int.toFloat(Belt.Float.toInt(Js.Date.getMonth(currDateTemp)) + i), + Int.toFloat(Float.toInt(Js.Date.getMonth(currDateTemp)) + i), ) let tempMonth = if disableFutureDates { (Js.Date.fromFloat(tempDate)->DayJs.getDayJsForJsDate).toString(.) @@ -99,7 +99,7 @@ let make = ( let showRight = i + 1 == Array.length(dummyRow) && !firstCalendar let monthAndYear = String.concat( getMonthInStr(getMonthFromFloat(tempMonth)), - Belt.Float.toString(tempYear), + Float.toString(tempYear), ) let iconClass = "inline-block text-jp-gray-600 dark:text-jp-gray-text_darktheme dark:text-opacity-25 cursor-pointer" @@ -142,7 +142,7 @@ let make = ( Belt.Int.toString}_td${(cellIndex + 1) - ->Belt.Int.toString}` + let location = `${title}_tr${(rowIndex + 1)->Int.toString}_td${(cellIndex + 1) + ->Int.toString}` string_of_int} attributes=[("data-table-location", location)]> React.array} - Belt.Int.toString)]> + Int.toString)]> {getRowDetails(rowIndex)} diff --git a/src/components/CustomCharts/FunnelChart.res b/src/components/CustomCharts/FunnelChart.res index 5f75d27aa..2aea59dd8 100644 --- a/src/components/CustomCharts/FunnelChart.res +++ b/src/components/CustomCharts/FunnelChart.res @@ -15,18 +15,16 @@ let make = ( let funnelData = data->Array.get(0)->Option.getOr(Js.Json.null)->LogicUtils.getDictFromJsonObject let (hoverIndex, setHoverIndex) = React.useState(_ => -1.) let (selectedMetric, setSelectedMetric) = React.useState(_ => Volume) - let length = metrics->Array.length->Belt.Float.fromInt + let length = metrics->Array.length->Float.fromInt let widths = metrics->Array.mapWithIndex((metric, i) => { let previousMetric = metrics->Array.get(i - 1) let previousMetric = switch previousMetric { | Some(prevMetric) => prevMetric.metric_name_db | None => "" } - let currentVol = funnelData->LogicUtils.getInt(metric.metric_name_db, 0)->Belt.Float.fromInt + let currentVol = funnelData->LogicUtils.getInt(metric.metric_name_db, 0)->Float.fromInt let previousVol = - funnelData - ->LogicUtils.getInt(previousMetric, currentVol->Belt.Float.toInt) - ->Belt.Float.fromInt + funnelData->LogicUtils.getInt(previousMetric, currentVol->Float.toInt)->Float.fromInt Js.Math.log10(currentVol *. 100. /. previousVol) /. 2.0 }) @@ -75,31 +73,31 @@ let make = (
{metrics ->Array.mapWithIndex((_metric, i) => { - let i = i->Belt.Float.fromInt + let i = i->Float.fromInt let opacity = (i +. 1.) /. length let borderTop = `${(size *. 14.) - ->Belt.Float.toString}rem solid rgb(0,109,249,${opacity->Belt.Float.toString})` + ->Float.toString}rem solid rgb(0,109,249,${opacity->Float.toString})` - let currentWidthRatio = switch widths->Array.get(i->Belt.Float.toInt) { + let currentWidthRatio = switch widths->Array.get(i->Float.toInt) { | Some(width) => width | None => size *. 70. } - let nextWidthRatio = switch widths->Array.get(i->Belt.Float.toInt + 1) { + let nextWidthRatio = switch widths->Array.get(i->Float.toInt + 1) { | Some(width) => width - | None => widths->Array.get(i->Belt.Float.toInt)->Option.getOr(size *. 70.) + | None => widths->Array.get(i->Float.toInt)->Option.getOr(size *. 70.) } fixedWidth := currentWidthRatio *. fixedWidth.contents let borderXFloat = (1. -. nextWidthRatio) *. fixedWidth.contents /. 2. - let borderX = `${borderXFloat->Belt.Float.toString}rem solid transparent` + let borderX = `${borderXFloat->Float.toString}rem solid transparent` - let width = `${fixedWidth.contents->Belt.Float.toString}rem` + let width = `${fixedWidth.contents->Float.toString}rem` - let marginBottom = `${(size *. 1.4)->Belt.Float.toString}rem` + let marginBottom = `${(size *. 1.4)->Float.toString}rem` let funnelElement =
Belt.Float.toString}funnelStage`} + key={`${i->Float.toString}funnelStage`} className="flex hover:cursor-pointer transition ease-in-out hover:scale-110 duration-300" style={ReactDOMStyle.make( ~borderTop, @@ -122,9 +120,9 @@ let make = ( open LogicUtils metrics ->Array.mapWithIndex((metric, i) => { - let marginBottom = `${(size *. 1.4)->Belt.Float.toString}rem` - let paddingTop = `${(size *. 4.2)->Belt.Float.toString}rem` - let metricVal = funnelData->getInt(metric.metric_name_db, 0)->Belt.Float.fromInt + let marginBottom = `${(size *. 1.4)->Float.toString}rem` + let paddingTop = `${(size *. 4.2)->Float.toString}rem` + let metricVal = funnelData->getInt(metric.metric_name_db, 0)->Float.fromInt let prevMetricVolume = switch prevMetricVol.contents { | Some(vol) => vol | None => metricVal @@ -136,7 +134,7 @@ let make = ( }
Belt.Int.toString}funnelStageVol`} + key={`${i->Int.toString}funnelStageVol`} className={`flex flex-row gap-4 h-full items-center w-max`} style={ReactDOMStyle.make(~marginBottom, ~paddingTop, ())}>
{metrics ->Array.mapWithIndex((metric, i) => { - let marginBottom = `${(size *. 2.1)->Belt.Float.toString}rem` - let paddingTop = `${(size *. 3.4 *. 1.4)->Belt.Float.toString}rem` + let marginBottom = `${(size *. 2.1)->Float.toString}rem` + let paddingTop = `${(size *. 3.4 *. 1.4)->Float.toString}rem`
Belt.Int.toString}funnelStageDesc`} + key={`${i->Int.toString}funnelStageDesc`} className={`flex flex-row gap-4 h-full items-center w-max items-start`} style={ReactDOMStyle.make(~marginBottom, ~paddingTop, ())}>
Belt.Float.fromInt + i->Float.fromInt ? "text-blue-900 scale-110" : "text-jp-gray-800 dark:text-dark_theme"}`}> {metric.metric_label->React.string} diff --git a/src/components/CustomCharts/HighchartHorizontalBarChart.res b/src/components/CustomCharts/HighchartHorizontalBarChart.res index 35e488105..c21506dbb 100644 --- a/src/components/CustomCharts/HighchartHorizontalBarChart.res +++ b/src/components/CustomCharts/HighchartHorizontalBarChart.res @@ -52,7 +52,7 @@ let xLabelFormatter: Js_OO.Callback.arity1 string> = { | None => 0 } `
${value}
` ++ - (y->Belt.Float.fromInt *. 100. /. seriesSum->Belt.Float.fromInt) + (y->Float.fromInt *. 100. /. seriesSum->Float.fromInt) ->Js.Float.toFixedWithPrecision(~digits=2) ++ `%
` } } @@ -78,11 +78,11 @@ let make = ( let barOption: Js.Json.t = React.useMemo2(() => { let colors = { - let length = barChartData->Array.length->Belt.Int.toFloat + let length = barChartData->Array.length->Int.toFloat barChartData->Array.mapWithIndex((_data, i) => { - let i = i->Belt.Int.toFloat + let i = i->Int.toFloat let opacity = (length -. i +. 1.) /. (length +. 1.) - `rgb(0,109,249,${opacity->Belt.Float.toString})` + `rgb(0,109,249,${opacity->Float.toString})` }) } let defaultOptions: HighchartsHorizontalBarChart.options = { diff --git a/src/components/CustomCharts/HighchartPieChart.res b/src/components/CustomCharts/HighchartPieChart.res index 1759f49dc..ce214cd5b 100644 --- a/src/components/CustomCharts/HighchartPieChart.res +++ b/src/components/CustomCharts/HighchartPieChart.res @@ -47,11 +47,11 @@ let make = ( let barOption: Js.Json.t = React.useMemo2(() => { let colors = { - let length = pieSeriesData->Array.length->Belt.Int.toFloat + let length = pieSeriesData->Array.length->Int.toFloat pieSeriesData->Array.mapWithIndex((_data, i) => { - let i = i->Belt.Int.toFloat + let i = i->Int.toFloat let opacity = (length -. i +. 1.) /. (length +. 1.) - `rgb(0,109,249,${opacity->Belt.Float.toString})` + `rgb(0,109,249,${opacity->Float.toString})` }) } let defaultOptions: HighchartsPieChart.options = { diff --git a/src/components/CustomCharts/HighchartTimeSeriesChart.res b/src/components/CustomCharts/HighchartTimeSeriesChart.res index 554e72b99..3693fc372 100644 --- a/src/components/CustomCharts/HighchartTimeSeriesChart.res +++ b/src/components/CustomCharts/HighchartTimeSeriesChart.res @@ -123,7 +123,7 @@ module LineChart1D = { ->Js.Date.fromFloat ->DateTimeUtils.toUtc ->Js.Date.getHours - ->Belt.Float.toString}:00` + ->Float.toString}:00` ->String.sliceToEnd(~start=-5) ->Js.Json.string } else if "run_month" === groupKey { @@ -131,11 +131,11 @@ module LineChart1D = { ->Js.Date.fromFloat ->DateTimeUtils.toUtc ->Js.Date.getDate - ->Belt.Float.toString + ->Float.toString ->Js.Json.string } else if "run_week" === groupKey { switch DateTimeUtils.daysArr[ - xAxis->Js.Date.fromFloat->DateTimeUtils.toUtc->Js.Date.getDay->Belt.Float.toInt + xAxis->Js.Date.fromFloat->DateTimeUtils.toUtc->Js.Date.getDay->Float.toInt ] { | Some(ele) => DateTimeUtils.dayMapper(ele) | None => "" @@ -622,7 +622,7 @@ module LineChart1D = { let positions = NumericUtils.pretty([lower_bound, upper_bound], 5) let positionArr = - Belt.Array.concat(positions, [threshold])->Js.Array2.sortInPlaceWith( + Array.concat(positions, [threshold])->Js.Array2.sortInPlaceWith( numericArraySortComperator, ) positionArr @@ -801,7 +801,7 @@ module LegendItem = { module RenderMultiDimensionalChart = { type config = { - chartDictData: Dict.t>, + chartDictData: Dict.t>, class: string, selectedMetrics: LineChartUtils.metricsConfig, groupBy: string, @@ -853,7 +853,7 @@ module RenderMultiDimensionalChart = { let (key, value) = item Belt.Int.toString} + key={index->Int.toString} class=config.class rawChartData=value commonColorsArr={LineChartUtils.removeDuplicates(chartNames)} diff --git a/src/components/CustomCharts/LineChartUtils.res b/src/components/CustomCharts/LineChartUtils.res index f76e33e51..5ca3e5e67 100644 --- a/src/components/CustomCharts/LineChartUtils.res +++ b/src/components/CustomCharts/LineChartUtils.res @@ -112,8 +112,8 @@ let reduceOpacity = str => { switch match { | Some(val) => { let opacity = val->Array.get(1)->Option.flatMap(a => a)->Option.getOr("0") - let newOpacity = opacity->Belt.Float.fromString->Option.getOr(0.0) /. 10.0 - str->String.replace(opacity, newOpacity->Belt.Float.toString) + let newOpacity = opacity->Float.fromString->Option.getOr(0.0) /. 10.0 + str->String.replace(opacity, newOpacity->Float.toString) } | None => "0" } @@ -190,7 +190,7 @@ let legendTypeBasedOnMetric = (metric_type: dropDownMetricType) => { } let appendToDictValue = (dict, key, value) => { let updatedValue = switch dict->Dict.get(key) { - | Some(val) => Belt.Array.concat(val, [value]) + | Some(val) => Array.concat(val, [value]) | None => [value] } dict->Dict.set(key, updatedValue) @@ -297,7 +297,7 @@ let timeSeriesDataMaker = ( (xAxisDataPoint->DateTimeUtils.parseAsFloat, yAxisDataPoint, secondryAxisPoint), ) groupedByTime->addToDictValueFloat( - xAxisDataPoint->DateTimeUtils.parseAsFloat->Belt.Float.toString, + xAxisDataPoint->DateTimeUtils.parseAsFloat->Float.toString, yAxisDataPoint, ) } @@ -318,7 +318,7 @@ let timeSeriesDataMaker = ( ->Array.map(item => { let (key, value, secondryMetrix) = item let trafficValue = - value *. 100. /. groupedByTime->Dict.get(key->Belt.Float.toString)->Option.getOr(1.) + value *. 100. /. groupedByTime->Dict.get(key->Float.toString)->Option.getOr(1.) (key, trafficValue, secondryMetrix) }) ->Js.Array2.sortInPlaceWith(chartDataSortBasedOnTime) @@ -414,7 +414,7 @@ let getLegendDataForCurrentMetrix = ( let value: legendTableData = { groupByName: key, overall, - average: overall /. arrLen->Belt.Int.toFloat, + average: overall /. arrLen->Int.toFloat, current: currentVal, } value @@ -447,7 +447,7 @@ let getLegendDataForCurrentMetrix = ( Js.Math.max_float(totalOverall, 1.)) ->Js.Float.toFixedWithPrecision(~digits=2) ->removeTrailingZero - ->Belt.Float.fromString + ->Float.fromString ->Option.getOr(0.) } else { currentOverall->Dict.get(metricsName)->Option.getOr(0.) @@ -461,7 +461,7 @@ let getLegendDataForCurrentMetrix = ( let value: legendTableData = { groupByName: metricsName, overall, - average: overall /. arrLen->Belt.Int.toFloat, + average: overall /. arrLen->Int.toFloat, current: currentVal, } value @@ -531,9 +531,7 @@ let legendClickItem = (s: Highcharts.legendItem, e, setState) => { if x === legendItemAsBool(s) { setState(prev => { let value = - prev->Array.includes(x) - ? prev->Array.filter(item => item !== x) - : Belt.Array.concat(prev, [x]) + prev->Array.includes(x) ? prev->Array.filter(item => item !== x) : Array.concat(prev, [x]) if value->Array.length === 0 { Array.forEach( @@ -752,7 +750,7 @@ let getGranularityNewStr = (~startTime, ~endTime) => { unit } } else { - `${val->Belt.Int.toString} ${unit}` + `${val->Int.toString} ${unit}` } }) } diff --git a/src/components/CustomExpandableTable.res b/src/components/CustomExpandableTable.res index 7708bb563..f6bd7a593 100644 --- a/src/components/CustomExpandableTable.res +++ b/src/components/CustomExpandableTable.res @@ -40,7 +40,7 @@ let make = ( let rowInfo: array> = { let a = rows->Array.mapWithIndex((data, i) => { if showSerial { - data->Array.unshift(Text((i + 1)->Belt.Int.toString))->ignore + data->Array.unshift(Text((i + 1)->Int.toString))->ignore } data }) @@ -57,7 +57,7 @@ let make = ( switch setFilterObj { | Some(fn) => fn((prevFilterObj: option>) => { - prevFilterObj->Belt.Option.map(prevObj => { + prevFilterObj->Option.map(prevObj => { prevObj->Array.map( obj => { if obj.key === string_of_int(i) { diff --git a/src/components/CustomizeTableColumns.res b/src/components/CustomizeTableColumns.res index 0292caebe..761f9ea5d 100644 --- a/src/components/CustomizeTableColumns.res +++ b/src/components/CustomizeTableColumns.res @@ -18,7 +18,7 @@ let make = ( heading ->Array.mapWithIndex((item, index) => ( getHeading(item).title, - index->Belt.Int.toFloat->Js.Json.number, + index->Int.toFloat->Js.Json.number, )) ->Dict.fromArray diff --git a/src/components/DateRangePicker.res b/src/components/DateRangePicker.res index e60941f0e..612a97110 100644 --- a/src/components/DateRangePicker.res +++ b/src/components/DateRangePicker.res @@ -231,7 +231,7 @@ module Base = { switch dateRangeLimit { | Some(maxLen) => { let diff = getStartEndDiff(localStartDate, localEndDate) - if diff > (maxLen->Belt.Int.toFloat *. 24. *. 60. *. 60. -. 1.) *. 1000. { + if diff > (maxLen->Int.toFloat *. 24. *. 60. *. 60. -. 1.) *. 1000. { setShowMsg(_ => true) resetStartEndInput() } @@ -385,9 +385,9 @@ module Base = { } let onDateClick = str => { - let data = switch Belt.Array.getBy(clickedDates, x => x == str) { + let data = switch Array.find(clickedDates, x => x == str) { | Some(_d) => Belt.Array.keep(clickedDates, x => x != str) - | None => Belt.Array.concat(clickedDates, [str]) + | None => Array.concat(clickedDates, [str]) } let dat = data->Array.map(x => x) setClickedDates(_ => dat) @@ -663,8 +663,7 @@ module Base = { switch dateRangeLimit { | Some(limit) => predefinedDays->Array.filter(item => { - getDiffForPredefined(item) <= - (limit->Belt.Float.fromInt *. 24. *. 60. *. 60. -. 1.) *. 1000. + getDiffForPredefined(item) <= (limit->Float.fromInt *. 24. *. 60. *. 60. -. 1.) *. 1000. }) | None => predefinedDays } @@ -788,7 +787,7 @@ module Base = { } else if showMsg { let msg = `Date Range should not exceed ${dateRangeLimit ->Option.getOr(0) - ->Belt.Int.toString} days` + ->Int.toString} days` {React.string(msg)} diff --git a/src/components/DynamicSingleStat.res b/src/components/DynamicSingleStat.res index e7686e14f..d726b99a9 100644 --- a/src/components/DynamicSingleStat.res +++ b/src/components/DynamicSingleStat.res @@ -323,9 +323,7 @@ let make = ( switch totalVolumeKeyVal { | Some(data) => { let (_key, value) = data - setTotalVolume( - _ => value->Js.Json.decodeNumber->Option.getOr(0.)->Belt.Float.toInt, - ) + setTotalVolume(_ => value->Js.Json.decodeNumber->Option.getOr(0.)->Float.toInt) } | None => () diff --git a/src/components/DynamicTable.res b/src/components/DynamicTable.res index ac9a4458a..9f414ae47 100644 --- a/src/components/DynamicTable.res +++ b/src/components/DynamicTable.res @@ -207,7 +207,7 @@ let make = ( let defaultFilterOffset = defaultFilters->LogicUtils.getDictFromJsonObject->LogicUtils.getInt("offset", 0) let dictValue = if val === "offset" { - defaultFilterOffset->Belt.Int.toString + defaultFilterOffset->Int.toString } else { let x = filtersFromUrl diff --git a/src/components/DynamicTableUtils.res b/src/components/DynamicTableUtils.res index f7b58882e..65452ecfa 100644 --- a/src/components/DynamicTableUtils.res +++ b/src/components/DynamicTableUtils.res @@ -147,13 +147,13 @@ let convertStrCellToFloat = (dataType: Table.cellType, str: string) => { switch dataType { | DropDown | LabelType | TextType => str->Js.Json.string | MoneyType | NumericType | ProgressType => - str->Belt.Float.fromString->Option.getOr(0.)->Js.Json.number + str->Float.fromString->Option.getOr(0.)->Js.Json.number } } let convertFloatCellToStr = (dataType: Table.cellType, num: float) => { switch dataType { - | DropDown | LabelType | TextType => num->Belt.Float.toString->Js.Json.string + | DropDown | LabelType | TextType => num->Float.toString->Js.Json.string | MoneyType | NumericType | ProgressType => num->Js.Json.number } } diff --git a/src/components/DynamicTabs.res b/src/components/DynamicTabs.res index d55a9726b..61ec267b8 100644 --- a/src/components/DynamicTabs.res +++ b/src/components/DynamicTabs.res @@ -211,7 +211,7 @@ module IndicationArrow = { } let getBoundingRectInfo = (ref: React.ref>, getter) => { - ref.current->Js.Nullable.toOption->Belt.Option.map(getBoundingClientRect)->Option.mapOr(0, getter) + ref.current->Js.Nullable.toOption->Option.map(getBoundingClientRect)->Option.mapOr(0, getter) } @react.component @@ -272,7 +272,7 @@ let make = ( ->Array.filter(item => !(defautTabValues->Array.includes(item))) let tabsFromPreference = - Belt.Array.concat(defautTabValues, tabsFromPreference)->Array.map(item => + Array.concat(defautTabValues, tabsFromPreference)->Array.map(item => item->String.split(",") ) @@ -609,7 +609,7 @@ let make = (
Belt.Int.toString} segments`} + modalHeadingDescription={`You can choose upto maximum of ${maxSelection->Int.toString} segments`} ?headerTextClass showModal setShowModal diff --git a/src/components/HSwitchSingleStatWidget.res b/src/components/HSwitchSingleStatWidget.res index 78c280bae..af3307342 100644 --- a/src/components/HSwitchSingleStatWidget.res +++ b/src/components/HSwitchSingleStatWidget.res @@ -67,7 +67,7 @@ let make = ( } else if statType === "LatencyMs" { latencyShortNum(~labelValue=value, ~includeMilliseconds=true, ()) } else { - value->Belt.Float.toString + value->Float.toString } } diff --git a/src/components/HandlingEvents.res b/src/components/HandlingEvents.res index 91e26f97c..19de49a1d 100644 --- a/src/components/HandlingEvents.res +++ b/src/components/HandlingEvents.res @@ -9,7 +9,7 @@ let getEventDict = (ev: Dom.event) => { try { objData.data ->Js.Json.decodeString - ->Belt.Option.map(Js.Json.parseExn) + ->Option.map(Js.Json.parseExn) ->Option.flatMap(parsedMsg => { parsedMsg->Js.Json.decodeObject }) diff --git a/src/components/InfraCalendar.res b/src/components/InfraCalendar.res index 498fb2486..b0f8ba698 100644 --- a/src/components/InfraCalendar.res +++ b/src/components/InfraCalendar.res @@ -143,8 +143,8 @@ module TableRow = { startDate, endDate, obj, - Belt.Float.toString(month +. 1.0), - Belt.Float.toString(year), + Float.toString(month +. 1.0), + Float.toString(year), ) } @@ -192,7 +192,7 @@ let make = ( let _ = highLightList let months = [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] let heading = ["S", "M", "T", "W", "T", "F", "S"] - let getMonthInFloat = mon => Array.indexOf(months, mon)->Belt.Float.fromInt + let getMonthInFloat = mon => Array.indexOf(months, mon)->Float.fromInt let getMonthInStr = mon => { switch mon { | Jan => "January, " @@ -211,7 +211,7 @@ let make = ( } // get first day let firstDay = Js.Date.getDay( - Js.Date.makeWithYM(~year=Belt.Int.toFloat(year), ~month=getMonthInFloat(month), ()), + Js.Date.makeWithYM(~year=Int.toFloat(year), ~month=getMonthInFloat(month), ()), ) // get Days in month let daysInMonth = switch month { @@ -234,15 +234,15 @@ let make = ( let rowMapper = (row, indexRow) => { Array.mapWithIndex(row, (_item, index) => { - let subFactor = Belt.Float.toInt(firstDay) - if indexRow == 0 && index < Belt.Float.toInt(firstDay) { + let subFactor = Float.toInt(firstDay) + if indexRow == 0 && index < Float.toInt(firstDay) { "" } else if indexRow == 0 { - Belt.Int.toString(indexRow + (index + 1) - subFactor) + Int.toString(indexRow + (index + 1) - subFactor) } else if indexRow * 7 + (index + 1) - subFactor > daysInMonth { "" } else { - Belt.Int.toString(indexRow * 7 + (index + 1) - subFactor) + Int.toString(indexRow * 7 + (index + 1) - subFactor) } }) } @@ -252,7 +252,7 @@ let make = ( {showTitle ?

{React.string(month->getMonthInStr)} - {React.string(year->Belt.Int.toString)} + {React.string(year->Int.toString)}

: React.null} @@ -281,7 +281,7 @@ let make = ( ?cellHighlighter ?cellRenderer month={getMonthInFloat(month)} - year={Belt.Int.toFloat(year)} + year={Int.toFloat(year)} startDate endDate disablePastDates diff --git a/src/components/InfraCalendarList.res b/src/components/InfraCalendarList.res index e8cbdca83..15b976619 100644 --- a/src/components/InfraCalendarList.res +++ b/src/components/InfraCalendarList.res @@ -4,7 +4,7 @@ external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFina let startYear = ref(2016) let years = [] -while Js.Date.make()->Js.Date.getFullYear->Belt.Float.toInt >= startYear.contents { +while Js.Date.make()->Js.Date.getFullYear->Float.toInt >= startYear.contents { years->Array.push(startYear.contents)->ignore startYear := startYear.contents + 1 } @@ -43,7 +43,7 @@ let getMonthInStr = (mon: InfraCalendar.month) => { } let getMonthFromFloat = value => { - let valueInt = value->Belt.Float.toInt + let valueInt = value->Float.toInt months[valueInt]->Option.getOr(Jan) } module YearItem = { @@ -51,7 +51,7 @@ module YearItem = { @react.component let make = (~tempYear, ~year, ~handleChangeMonthBy, ~setCurrDate, ~tempMonth) => { - let isSelected = year->Belt.Int.toFloat === tempYear + let isSelected = year->Int.toFloat === tempYear let yearRef = React.useRef(Js.Nullable.null) React.useEffect1(() => { @@ -65,20 +65,20 @@ module YearItem = { }, [isSelected])
  • Belt.Float.toInt + className={`p-2 ${year === tempYear->Float.toInt ? "bg-blue-950 text-white" : "dark:hover:bg-jp-gray-900 hover:bg-jp-gray-100"} cursor-pointer bg-opacity-100`} - value={year->Belt.Int.toString} + value={year->Int.toString} ref={yearRef->ReactDOM.Ref.domRef} onClick={e => { let tar: float = ReactEvent.Mouse.currentTarget(e)["value"] - let yearDiff = (tar -. tempYear)->Belt.Float.toInt + let yearDiff = (tar -. tempYear)->Float.toInt if yearDiff !== 0 { handleChangeMonthBy(yearDiff * 12) setCurrDate(_ => Js.Date.makeWithYM(~year=tar, ~month=tempMonth, ())) } }}> - {year->Belt.Int.toString->React.string} + {year->Int.toString->React.string}
  • } } @@ -95,7 +95,7 @@ module MonthItem = { ~setCurrDate, ~mon: InfraCalendar.month, ) => { - let isSelected = index->Belt.Int.toFloat === tempMonth + let isSelected = index->Int.toFloat === tempMonth let monthRef = React.useRef(Js.Nullable.null) React.useEffect1(() => { @@ -109,17 +109,17 @@ module MonthItem = { }, [isSelected])
  • Belt.Int.toString} + value={index->Int.toString} onClick={e => { let tar: float = ReactEvent.Mouse.currentTarget(e)["value"] - let monthDiff = (tar -. tempMonth)->Belt.Float.toInt + let monthDiff = (tar -. tempMonth)->Float.toInt if monthDiff !== 0 { handleChangeMonthBy(monthDiff) setCurrDate(_ => Js.Date.makeWithYM(~year=tempYear, ~month=tar, ())) } }} ref={monthRef->ReactDOM.Ref.domRef} - className={`p-2 px-4 ${index === tempMonth->Belt.Float.toInt + className={`p-2 px-4 ${index === tempMonth->Float.toInt ? "bg-blue-950 text-white" : "dark:hover:bg-jp-gray-900 hover:bg-jp-gray-100"} cursor-pointer`}> {mon->getMonthInStr->String.replaceRegExp(%re("/,/g"), "")->React.string} @@ -150,7 +150,7 @@ let make = ( let currDateTemp = Js.Date.fromFloat(Js.Date.valueOf(currDateIm)) let tempDate = Js.Date.setMonth( currDateTemp, - Belt.Int.toFloat(Belt.Float.toInt(Js.Date.getMonth(currDateTemp))), + Int.toFloat(Float.toInt(Js.Date.getMonth(currDateTemp))), ) let tempMonth = Js.Date.getMonth(Js.Date.fromFloat(tempDate)) let tempYear = Js.Date.getFullYear(Js.Date.fromFloat(tempDate)) @@ -162,7 +162,7 @@ let make = ( {months ->Array.mapWithIndex((mon, i) => Belt.Int.toString} + key={i->Int.toString} index=i tempMonth tempYear @@ -177,12 +177,7 @@ let make = ( {years ->Array.mapWithIndex((year, i) => Belt.Int.toString} - tempMonth - tempYear - handleChangeMonthBy - year - setCurrDate + key={i->Int.toString} tempMonth tempYear handleChangeMonthBy year setCurrDate /> ) ->React.array} @@ -190,7 +185,7 @@ let make = ( : false) setOffset(_ => pageDetail.offset) None - }, [url.path->Belt.List.toArray->Array.joinWith("/")]) + }, [url.path->List.toArray->Array.joinWith("/")]) React.useEffect1(_ => { if pageDetail.offset !== offset && !firstRender { @@ -499,7 +499,7 @@ let make = ( Some( showSerialNumber && tableLocalFilter ? Array.concat( - [Table.Range("s_no", 0., actualData->Array.length->Belt.Int.toFloat)], + [Table.Range("s_no", 0., actualData->Array.length->Int.toFloat)], columnFilterRow, ) : columnFilterRow, @@ -569,7 +569,7 @@ let make = ( }) let startPoint = sNoArr->Array.get(0)->Option.getOr(1.->Js.Json.number) let endPoint = sNoArr->Array.get(1)->Option.getOr(1.->Js.Json.number) - let jsonIndex = (index + 1)->Belt.Int.toFloat->Js.Json.number + let jsonIndex = (index + 1)->Int.toFloat->Js.Json.number sNoArr->Array.length > 0 ? { startPoint <= jsonIndex && endPoint >= jsonIndex ? visibleCell : [] @@ -595,9 +595,9 @@ let make = ( actualRows ->Array.unshift( Numeric( - (1 + index)->Belt.Int.toFloat, + (1 + index)->Int.toFloat, (val: float) => { - val->Belt.Float.toString + val->Float.toString }, ), ) diff --git a/src/components/LocalFilters.res b/src/components/LocalFilters.res index dd93b9580..4190c5e86 100644 --- a/src/components/LocalFilters.res +++ b/src/components/LocalFilters.res @@ -183,7 +183,7 @@ let make = ( let finalFieldList = selectedFiltersList->Array.filter(val => { val.inputNames ->Array.get(0) - ->Belt.Option.map(name => !{toBeRemoved->Array.includes(name)}) + ->Option.map(name => !{toBeRemoved->Array.includes(name)}) ->Option.getOr(false) }) let filtersAfterRemoving = diff --git a/src/components/MultiLineTextInput.res b/src/components/MultiLineTextInput.res index c03b0644e..26f8bdbcc 100644 --- a/src/components/MultiLineTextInput.res +++ b/src/components/MultiLineTextInput.res @@ -40,7 +40,7 @@ let make = ( let className = `rounded-md border border-jp-gray-lightmode_steelgray border-opacity-75 font-semibold pl-4 pt-3 pb-3 text-jp-gray-900 text-opacity-75 placeholder-jp-gray-900 placeholder-opacity-25 hover:bg-jp-gray-lightmode_steelgray hover:bg-opacity-20 hover:border-jp-gray-900 hover:border-opacity-20 focus:text-opacity-100 focus:outline-none focus:border-blue-800 focus:border-opacity-100 dark:text-jp-gray-text_darktheme dark:text-opacity-75 dark:border-jp-gray-960 dark:hover:border-jp-gray-960 dark:hover:bg-jp-gray-970 dark:bg-jp-gray-darkgray_background dark:placeholder-jp-gray-text_darktheme dark:placeholder-opacity-25 dark:focus:text-opacity-100 dark:focus:border-blue-800 ${cursorClass} ${customClass}` let value = switch input.value->Js.Json.classify { | JSONString(str) => str - | JSONNumber(num) => num->Belt.Float.toString + | JSONNumber(num) => num->Float.toString | _ => "" } diff --git a/src/components/MultipleFileUpload.res b/src/components/MultipleFileUpload.res index a7b14e97d..34ce971ef 100644 --- a/src/components/MultipleFileUpload.res +++ b/src/components/MultipleFileUpload.res @@ -136,7 +136,7 @@ let make = ( if size > sizeLimit { showToast( ~message=`File size too large, upload below ${(sizeLimit / 1000) - ->Belt.Int.toString}kb`, + ->Int.toString}kb`, ~toastType=ToastError, (), ) @@ -171,7 +171,7 @@ let make = ( toast("Invalid file", ToastError) } } - arr->Belt.Array.set(0, arr[0]->Option.getOr(0) + 1)->ignore + arr->Array.set(0, arr[0]->Option.getOr(0) + 1)->ignore } | None => () } @@ -249,8 +249,7 @@ let make = (
    {fileNames ->Array.mapWithIndex((fileName, indx) => { -
    Belt.Int.toString} className="flex items-center border p-2 gap-4 rounded-lg"> +
    Int.toString} className="flex items-center border p-2 gap-4 rounded-lg">
    Js.Date.toString ->DayJs.getDayJsForString ).format(. "YYYY-MM-DD") @@ -267,8 +267,8 @@ module TableRow = { startDate, endDate, obj, - Belt.Float.toString(month +. 1.0), - Belt.Float.toString(year), + Float.toString(month +. 1.0), + Float.toString(year), ) } @@ -277,8 +277,8 @@ module TableRow = { startDate, endDate, obj, - Belt.Float.toString(month +. 1.0), - Belt.Float.toString(year), + Float.toString(month +. 1.0), + Float.toString(year), ) } let handleHover = () => { @@ -301,7 +301,7 @@ module TableRow = { }
  • {fields ->Array.mapWithIndex((itm, i) => { @@ -28,7 +28,7 @@ module TableCell = { value: (keyValue[elemIndex]->Option.getOr([]))[i]->Option.getOr("")->Js.Json.string, checked: true, } - + }) ->React.array}
    Belt.Int.toString}X${cellIndex->Belt.Int.toString}`} + key={`${windowIndex->Int.toString}X${cellIndex->Int.toString}`} className={`${classN} ${highlightBgClass} text-sm font-normal`} onClick onMouseOver={_ => handleHover()} @@ -375,10 +375,10 @@ let make = ( let heading = ["Sun", "Mon", "Tue", "Wed", "Thr", "Fri", "Sat"] let isMobileView = MatchMedia.useMobileChecker() - let getMonthInFloat = mon => Array.indexOf(months, mon)->Belt.Float.fromInt + let getMonthInFloat = mon => Array.indexOf(months, mon)->Float.fromInt let totalMonths = disablePastDates ? 1 - : (year - 1970) * 12 + getMonthInFloat(month)->Belt.Float.toInt + 1 + : (year - 1970) * 12 + getMonthInFloat(month)->Float.toInt + 1 let futureMonths = isFutureDate && !disableFutureDates ? 120 : 0 let (lastStartDate, setLastStartDate) = React.useState(_ => "") @@ -408,15 +408,15 @@ let make = ( }) React.useEffect2(() => { - let currentMonth = getMonthInFloat(month)->Belt.Float.toInt + 1 + let currentMonth = getMonthInFloat(month)->Float.toInt + 1 if startDate != lastStartDate { let startYear = startDate != "" ? (startDate->DayJs.getDayJsForString).format(. "YYYY") : "" let startMonth = (startDate != "" ? (startDate->DayJs.getDayJsForString).format(. "MM") : "") - ->Belt.Int.fromString + ->Int.fromString ->Option.getOr(currentMonth) - let startYearDiff = year - startYear->Belt.Int.fromString->Option.getOr(2022) + let startYearDiff = year - startYear->Int.fromString->Option.getOr(2022) let startIndex = 12 * startYearDiff + (currentMonth - startMonth) @@ -428,9 +428,9 @@ let make = ( let endYear = endDate != "" ? (endDate->DayJs.getDayJsForString).format(. "YYYY") : "" let endMonth = (endDate != "" ? (endDate->DayJs.getDayJsForString).format(. "MM") : "") - ->Belt.Int.fromString + ->Int.fromString ->Option.getOr(currentMonth) - let endYearDiff = year - endYear->Belt.Int.fromString->Option.getOr(2022) + let endYearDiff = year - endYear->Int.fromString->Option.getOr(2022) let endIndex = 12 * endYearDiff + (currentMonth - endMonth) @@ -449,7 +449,7 @@ let make = ( // get first day let firstDay = Js.Date.getDay( - Js.Date.makeWithYM(~year=Belt.Int.toFloat(newYear), ~month=getMonthInFloat(updatedMonth), ()), + Js.Date.makeWithYM(~year=Int.toFloat(newYear), ~month=getMonthInFloat(updatedMonth), ()), ) // get Days in month @@ -472,15 +472,15 @@ let make = ( let rowMapper = (row, indexRow) => { Array.mapWithIndex(row, (_item, index) => { - let subFactor = Belt.Float.toInt(firstDay) - if indexRow == 0 && index < Belt.Float.toInt(firstDay) { + let subFactor = Float.toInt(firstDay) + if indexRow == 0 && index < Float.toInt(firstDay) { "" } else if indexRow == 0 { - Belt.Int.toString(indexRow + (index + 1) - subFactor) + Int.toString(indexRow + (index + 1) - subFactor) } else if indexRow * 7 + (index + 1) - subFactor > daysInMonth { "" } else { - Belt.Int.toString(indexRow * 7 + (index + 1) - subFactor) + Int.toString(indexRow * 7 + (index + 1) - subFactor) } }) } @@ -488,14 +488,14 @@ let make = (
    LogicUtils.getJsonObjectFromDict("style")->Identity.jsonToReactDOMStyle}>
    - {React.string(`${updatedMonth->getMonthInStr} ${newYear->Belt.Int.toString}`)} + {React.string(`${updatedMonth->getMonthInStr} ${newYear->Int.toString}`)}
    {rowInfo ->Array.mapWithIndex((item, rowIndex) => { Belt.Int.toString} + key={rowIndex->Int.toString} item rowIndex onDateClick @@ -504,7 +504,7 @@ let make = ( ?cellHighlighter ?cellRenderer month={getMonthInFloat(updatedMonth)} - year={Belt.Int.toFloat(newYear)} + year={Int.toFloat(newYear)} startDate endDate disablePastDates diff --git a/src/components/NewCalendarList.res b/src/components/NewCalendarList.res index e5da0343b..0bff7e519 100644 --- a/src/components/NewCalendarList.res +++ b/src/components/NewCalendarList.res @@ -35,13 +35,13 @@ let make = ( let (isDateClicked, setIsDateClicked) = React.useState(_ => false) let startYear = switch year { - | Some(y) => Belt.Int.toFloat(y) + | Some(y) => Int.toFloat(y) | None => Js.Date.getFullYear(Js.Date.make()) } React.useEffect2(() => { let fromDateJs = fromDate->DayJs.getDayJsForString let toDateJs = toDate->DayJs.getDayJsForString - let permittedMaxYears = startYear->Belt.Float.toInt + 10 + let permittedMaxYears = startYear->Float.toInt + 10 let updatedFromDate = fromDate != "" && fromDate->String.length >= 5 && @@ -119,17 +119,17 @@ let make = ( let _ = onDateClick // check whether month and date has value let getMonthFromFloat = value => { - let valueInt = value->Belt.Float.toInt + let valueInt = value->Float.toInt months->Array.get(valueInt)->Option.getOr(Jan) } let getMonthInFloat = mon => { - Array.indexOf(months, mon)->Belt.Float.fromInt + Array.indexOf(months, mon)->Float.fromInt } let startMonth = switch month { - | Some(m) => Belt.Int.toFloat(Belt.Float.toInt(getMonthInFloat(m))) + | Some(m) => Int.toFloat(Float.toInt(getMonthInFloat(m))) | None => { - let tMonth = Belt.Int.toFloat(Belt.Float.toInt(Js.Date.getMonth(Js.Date.make()))) + let tMonth = Int.toFloat(Float.toInt(Js.Date.getMonth(Js.Date.make()))) disableFutureDates && count > 1 ? tMonth -. 1.0 : tMonth } } @@ -146,7 +146,7 @@ let make = ( let currDateTemp = Js.Date.fromFloat(Js.Date.valueOf(currDateIm)) let tempDate = Js.Date.setMonth( currDateTemp, - Belt.Int.toFloat(Belt.Float.toInt(Js.Date.getMonth(currDateTemp)) + i), + Int.toFloat(Float.toInt(Js.Date.getMonth(currDateTemp)) + i), ) let tempMonth = if disableFutureDates { (Js.Date.fromFloat(tempDate)->DayJs.getDayJsForJsDate).toString(.) @@ -205,7 +205,7 @@ let make = ( { let pageNumbers = [] - let total = Js.Math.ceil(Belt.Int.toFloat(totalResults) /. Belt.Int.toFloat(resultsPerPage)) + let total = Js.Math.ceil(Int.toFloat(totalResults) /. Int.toFloat(resultsPerPage)) for x in 1 to total { Array.push(pageNumbers, x)->ignore diff --git a/src/components/OrderUtils.res b/src/components/OrderUtils.res index 094079a17..381ddca87 100644 --- a/src/components/OrderUtils.res +++ b/src/components/OrderUtils.res @@ -146,7 +146,7 @@ module Details = { {detailsFields ->Array.mapWithIndex((colType, i) => { if !(excludeColKeys->Array.includes(colType)) { -
    +
    "1-10") - let total = Js.Math.ceil(Belt.Int.toFloat(totalResults) /. Belt.Int.toFloat(resultsPerPage)) + let total = Js.Math.ceil(Int.toFloat(totalResults) /. Int.toFloat(resultsPerPage)) for x in 1 to total { Array.push(pageNumbers, x)->ignore @@ -31,16 +31,14 @@ let make = (~resultsPerPage, ~totalResults, ~currentPage, ~paginate, ~btnCount=4 let ranges = [] rangeNum->Array.forEach(ele => { - ranges->Array.push((ele - 9)->Belt.Int.toString ++ "-" ++ ele->Belt.Int.toString)->ignore + ranges->Array.push((ele - 9)->Int.toString ++ "-" ++ ele->Int.toString)->ignore }) let lastNum = rangeNum->Array.get(Array.length(rangeNum) - 1)->Option.getOr(0) if totalResults > lastNum { let start = lastNum + (totalResults - lastNum) start === totalResults - ? ranges->Array.push(start->Belt.Int.toString)->ignore - : ranges - ->Array.push(start->Belt.Int.toString ++ "-" ++ totalResults->Belt.Int.toString) - ->ignore + ? ranges->Array.push(start->Int.toString)->ignore + : ranges->Array.push(start->Int.toString ++ "-" ++ totalResults->Int.toString)->ignore } let startIndex = Js.Math.max_int(1, currentPage - pageToLeft) @@ -102,7 +100,7 @@ let make = (~resultsPerPage, ~totalResults, ~currentPage, ~paginate, ~btnCount=4 let dropDownOptions = ranges->Array.mapWithIndex((item, idx): SelectBox.dropdownOption => { { label: item, - value: (idx + 1)->Belt.Int.toString, + value: (idx + 1)->Int.toString, } }) diff --git a/src/components/Paginator.res b/src/components/Paginator.res index 19538e834..6b10000f0 100644 --- a/src/components/Paginator.res +++ b/src/components/Paginator.res @@ -40,7 +40,7 @@ let make = ( let selectInputOption = { [5, 10, 15, 25, 50, 100] ->Array.filter(val => val <= totalResults) - ->Array.map(Belt.Int.toString) + ->Array.map(Int.toString) ->SelectBox.makeOptions } let selectInput: ReactFinalForm.fieldRenderPropsInput = { @@ -48,15 +48,15 @@ let make = ( onBlur: _ev => (), onChange: ev => { setResultsPerPage(_ => { - ev->Identity.formReactEventToString->Belt.Int.fromString->Option.getOr(15) + ev->Identity.formReactEventToString->Int.fromString->Option.getOr(15) }) }, onFocus: _ev => (), - value: resultsPerPage->Belt.Int.toString->Js.Json.string, + value: resultsPerPage->Int.toString->Js.Json.string, checked: true, } let paginate = React.useCallback5(pageNumber => { - let total = Js.Math.ceil(Belt.Int.toFloat(totalResults) /. Belt.Int.toFloat(resultsPerPage)) + let total = Js.Math.ceil(Int.toFloat(totalResults) /. Int.toFloat(resultsPerPage)) // for handling page count let defaultPageNumber = Js.Math.min_int(total, pageNumber) let page = defaultPageNumber diff --git a/src/components/RangeSlider.res b/src/components/RangeSlider.res index 2b24fc6b9..1e656089d 100644 --- a/src/components/RangeSlider.res +++ b/src/components/RangeSlider.res @@ -99,8 +99,8 @@ let make = ( className={`absolute bg-transparent pointer-events-none appearance-none slider hover:sliderFocus active:sliderFocus outline-none`} type_="range" value=minsliderVal - min={min->Belt.Float.toString} - max={max->Belt.Float.toString} + min={min->Float.toString} + max={max->Float.toString} onBlur={minSlide.onBlur} onChange={ev => { minSlide.onChange(ev) @@ -118,8 +118,8 @@ let make = ( className={`absolute bg-transparent pointer-events-none appearance-none slider hover:sliderFocus active:sliderFocus outline-none`} type_="range" value=maxsliderVal - min={min->Belt.Float.toString} - max={max->Belt.Float.toString} + min={min->Float.toString} + max={max->Float.toString} onBlur={maxSlide.onBlur} onChange={ev => { maxSlide.onChange(ev) @@ -138,9 +138,9 @@ let make = ( Belt.Float.toString} - min={min->Belt.Float.toString} - max={max->Belt.Float.toString} + value={minSlideVal->Float.toString} + min={min->Float.toString} + max={max->Float.toString} onBlur={ev => { let minVal = minSlideVal let maxSliderValue = maxSlide.value->Js.Json.decodeNumber->Option.getOr(0.) @@ -176,9 +176,9 @@ let make = ( Belt.Float.toString} - min={min->Belt.Float.toString} - max={max->Belt.Float.toString} + value={maxSlideVal->Float.toString} + min={min->Float.toString} + max={max->Float.toString} onBlur={ev => { let maxVal = maxSlideVal let minSliderValue = minSlide.value->Js.Json.decodeNumber->Option.getOr(0.) diff --git a/src/components/RatingOptions.res b/src/components/RatingOptions.res index 6c77923c9..da6eb1951 100644 --- a/src/components/RatingOptions.res +++ b/src/components/RatingOptions.res @@ -14,7 +14,7 @@ let make = (~icons, ~size) => { ->Array.mapWithIndex((icon, index) => { let iconRating = index + 1 Dict.get(key) { - | Some(arr) => Dict.set(dictArrObj, key, Belt.Array.concat(arr, [value])) + | Some(arr) => Dict.set(dictArrObj, key, Array.concat(arr, [value])) | None => Dict.set(dictArrObj, key, [value]) } }, @@ -863,7 +863,7 @@ let make = ( Some( showSerialNumber && tableLocalFilter ? Array.concat( - [Table.Range("s_no", 0., actualData->Array.length->Belt.Int.toFloat)], + [Table.Range("s_no", 0., actualData->Array.length->Int.toFloat)], columnFilterRow, ) : columnFilterRow, @@ -937,7 +937,7 @@ let make = ( }) let startPoint = sNoArr->Array.get(0)->Option.getOr(1.->Js.Json.number) let endPoint = sNoArr->Array.get(1)->Option.getOr(1.->Js.Json.number) - let jsonIndex = (index + 1)->Belt.Int.toFloat->Js.Json.number + let jsonIndex = (index + 1)->Int.toFloat->Js.Json.number sNoArr->Array.length > 0 ? { startPoint <= jsonIndex && endPoint >= jsonIndex ? visibleCell : [] @@ -971,9 +971,9 @@ let make = ( actualRows ->Array.unshift( Numeric( - (1 + index)->Belt.Int.toFloat, + (1 + index)->Int.toFloat, (val: float) => { - val->Belt.Float.toString + val->Float.toString }, ), ) diff --git a/src/components/RemoteFilter.res b/src/components/RemoteFilter.res index 8168fc130..4b90d4a92 100644 --- a/src/components/RemoteFilter.res +++ b/src/components/RemoteFilter.res @@ -177,7 +177,7 @@ module ClearFilters = { }) ->Array.length > 0 }, (formState.initialValues, defaultFilterKeys)) - let text = isCountRequired ? `Clear ${count->Belt.Int.toString} Filters` : "Clear Filters" + let text = isCountRequired ? `Clear ${count->Int.toString} Filters` : "Clear Filters"
    - {tableRows(Belt.Array.range(1, totalLength)->Array.map(_ => [Text("")]), true)} + {tableRows( + Array.fromInitializer(~length=totalLength, i => i + 1)->Array.map(_ => [Text("")]), + true, + )}
    = columnFilterRow->Option.getOr([]) let filterRow = columnFilterRow->Array.get(i) Dom.Document.getElementById(`table`) ->Option.mapOr(0, ele => ele->Document.offsetWidth) - let equalColWidth = (totalTableWidth / numberOfCols)->Belt.Int.toString + let equalColWidth = (totalTableWidth / numberOfCols)->Int.toString let fixedWidthClass = enableEqualWidthCol ? `${equalColWidth}px` : "" let widthClass = if fullWidth { "min-w-full" @@ -857,7 +857,10 @@ let make = ( )}
    } diff --git a/src/components/TableUtils.res b/src/components/TableUtils.res index c26e8ee39..3db994cd8 100644 --- a/src/components/TableUtils.res +++ b/src/components/TableUtils.res @@ -196,8 +196,8 @@ module ProgressCell = {
    - {React.string(Belt.Int.toString(progressPercentage) ++ "%")} + style={ReactDOM.Style.make(~width=`${Int.toString(progressPercentage)}%`, ())}> + {React.string(Int.toString(progressPercentage) ++ "%")}
    } @@ -389,8 +389,8 @@ module Numeric = {
    {React.string(num->mapper)}
    } else { - Belt.Float.toString)]> -
    {React.string(num->Belt.Float.toString)}
    + Float.toString)]> +
    {React.string(num->Float.toString)}
    } } @@ -775,11 +775,11 @@ let getTableCellValue = cell => { | Text(x) => x | Date(x) => x | DateWithoutTime(x) => x - | Currency(val, _) => val->Belt.Float.toString + | Currency(val, _) => val->Float.toString | Link(str) => str | CustomCell(_, value) => value | EllipsisText(x, _) => x - | DeltaPercentage(x, _) | Numeric(x, _) => x->Belt.Float.toString + | DeltaPercentage(x, _) | Numeric(x, _) => x->Float.toString | ColoredText(x) => x.title | _ => "" } diff --git a/src/components/Tabs.res b/src/components/Tabs.res index 30717e671..60a8822df 100644 --- a/src/components/Tabs.res +++ b/src/components/Tabs.res @@ -127,7 +127,7 @@ module IndicationArrow = { } let getBoundingRectInfo = (ref: React.ref>, getter) => { - ref.current->Js.Nullable.toOption->Belt.Option.map(getBoundingClientRect)->Option.mapOr(0, getter) + ref.current->Js.Nullable.toOption->Option.map(getBoundingClientRect)->Option.mapOr(0, getter) } @react.component diff --git a/src/components/TabularInput.res b/src/components/TabularInput.res index 1e6f700f3..c0db28b6e 100644 --- a/src/components/TabularInput.res +++ b/src/components/TabularInput.res @@ -13,7 +13,7 @@ module TableCell = { @react.component let make = (~onClick, ~elemIndex, ~isLast, ~fields, ~onChange, ~keyValue) => {
    diff --git a/src/components/TimeInput.res b/src/components/TimeInput.res index 4ed9c3f85..2770fb5da 100644 --- a/src/components/TimeInput.res +++ b/src/components/TimeInput.res @@ -1,5 +1,5 @@ let padNum = num => { - let str = num->Belt.Int.toString + let str = num->Int.toString if str->String.length === 1 { `0${str}` } else { @@ -11,15 +11,13 @@ module OptionVals = { let make = (~upto=60, ~value, ~onChange, ~isDisabled) => { let cursorClass = isDisabled ? "cursor-not-allowed" : "" @@ -41,17 +39,16 @@ let make = ( | Some(str) => str | None => "" } - open Belt.Option let arr = value->String.split(":") - let hourVal = arr->Array.get(0)->flatMap(Belt.Int.fromString)->getWithDefault(0) - let minuteVal = arr->Array.get(1)->flatMap(Belt.Int.fromString)->getWithDefault(0) - let secondsVal = arr->Array.get(2)->flatMap(Belt.Int.fromString)->getWithDefault(0) + let hourVal = arr->Array.get(0)->Option.flatMap(Belt.Int.fromString)->Option.getOr(0) + let minuteVal = arr->Array.get(1)->Option.flatMap(Belt.Int.fromString)->Option.getOr(0) + let secondsVal = arr->Array.get(2)->Option.flatMap(Belt.Int.fromString)->Option.getOr(0) let changeVal = React.useCallback4((index, ev: ReactEvent.Form.t) => { - let newVal = {ev->ReactEvent.Form.target}["value"]->Belt.Int.fromString->getWithDefault(0) + let newVal = {ev->ReactEvent.Form.target}["value"]->Int.fromString->Option.getOr(0) let arr = [hourVal, minuteVal, secondsVal] - Belt.Array.set(arr, index, newVal)->ignore + arr[index] = newVal arr->Array.map(padNum)->Array.joinWith(":")->Identity.anyTypeToReactEvent->input.onChange }, (hourVal, minuteVal, secondsVal, input.onChange)) diff --git a/src/components/custom-icons/Loadericon.res b/src/components/custom-icons/Loadericon.res index 19c07a11e..b4b506c99 100644 --- a/src/components/custom-icons/Loadericon.res +++ b/src/components/custom-icons/Loadericon.res @@ -12,8 +12,8 @@ let make = (~iconColor=?, ~size=16) => { } diff --git a/src/components/form/FormRenderer.res b/src/components/form/FormRenderer.res index 111981bc2..b7e1fb3d2 100644 --- a/src/components/form/FormRenderer.res +++ b/src/components/form/FormRenderer.res @@ -115,7 +115,7 @@ let makeMultiInputFieldInfo = ( descriptionComponent, subText, isRequired, - comboCustomInput: comboCustomInput->Belt.Option.map(x => x.fn), + comboCustomInput: comboCustomInput->Option.map(x => x.fn), inputFields, inputNames, ?fieldPortalKey, diff --git a/src/components/form/NumericTextInput.res b/src/components/form/NumericTextInput.res index 78b2a11f9..818190ab8 100644 --- a/src/components/form/NumericTextInput.res +++ b/src/components/form/NumericTextInput.res @@ -1,4 +1,4 @@ -let getFloat = strJson => strJson->Js.Json.decodeString->Option.flatMap(Belt.Float.fromString) +let getFloat = strJson => strJson->Js.Json.decodeString->Option.flatMap(Float.fromString) @react.component let make = ( @@ -36,7 +36,7 @@ let make = ( elem ->Webapi.Dom.Element.getAttribute("placeholder") ->Option.mapOr(length, str => Js.Math.max_int(length, str->String.length)) - ->Belt.Int.toString + ->Int.toString elem->Webapi.Dom.Element.setAttribute("size", size) | None => () @@ -99,8 +99,8 @@ let make = ( let numericPrevLocalValue = prevLocalStr ->Js.Json.decodeString - ->Option.flatMap(Belt.Float.fromString) - ->Belt.Option.map(Js.Json.number) + ->Option.flatMap(Float.fromString) + ->Option.map(Js.Json.number) ->Option.getOr(Js.Json.null) if input.value === numericPrevLocalValue { prevLocalStr diff --git a/src/components/form/PasswordStrengthInput.res b/src/components/form/PasswordStrengthInput.res index e3f58068a..fa250089f 100644 --- a/src/components/form/PasswordStrengthInput.res +++ b/src/components/form/PasswordStrengthInput.res @@ -52,8 +52,8 @@ let make = ( let localVariety = nonEmptyResult ? accVariety + 1 : 0 let localScore = accScore +. - (test.weight *. result->Array.length->Belt.Int.toFloat +. - strVal->String.length->Belt.Int.toFloat *. 1.2) + (test.weight *. result->Array.length->Int.toFloat +. + strVal->String.length->Int.toFloat *. 1.2) (localVariety, localScore) }) diff --git a/src/components/form/PasswordStrengthInputAsChips.res b/src/components/form/PasswordStrengthInputAsChips.res index 79a63d079..aaae9ad3b 100644 --- a/src/components/form/PasswordStrengthInputAsChips.res +++ b/src/components/form/PasswordStrengthInputAsChips.res @@ -137,12 +137,12 @@ let make = ( tooltipWidthClass="w-fit" description=specialCharatersInfoText toolTipFor={Belt.Int.toString}`} passwordChecks chipType customTextStyle + key={`check_${index->Int.toString}`} passwordChecks chipType customTextStyle />} /> } else { Belt.Int.toString}`} passwordChecks chipType customTextStyle + key={`check_${index->Int.toString}`} passwordChecks chipType customTextStyle /> } }) diff --git a/src/components/form/TextInput.res b/src/components/form/TextInput.res index 7471fd75b..9ce7b40c9 100644 --- a/src/components/form/TextInput.res +++ b/src/components/form/TextInput.res @@ -71,7 +71,7 @@ let make = ( elem ->Webapi.Dom.Element.getAttribute("placeholder") ->Option.mapOr(length, str => Js.Math.max_int(length, str->String.length)) - ->Belt.Int.toString + ->Int.toString elem->Webapi.Dom.Element.setAttribute("size", size) | None => () @@ -171,7 +171,7 @@ let make = ( : onActiveStyle}` let value = switch input.value->Js.Json.classify { | JSONString(str) => str - | JSONNumber(num) => num->Belt.Float.toString + | JSONNumber(num) => num->Float.toString | _ => "" } diff --git a/src/components/priority-logics/AddPLGateway.res b/src/components/priority-logics/AddPLGateway.res index 36c2cb18a..296eef585 100644 --- a/src/components/priority-logics/AddPLGateway.res +++ b/src/components/priority-logics/AddPLGateway.res @@ -7,7 +7,7 @@ module GatewayView = { {gateways ->Array.mapWithIndex((ruleGateway, index) => {
    @@ -185,9 +185,9 @@ let make = ( name=key onChange={ev => { let val = ReactEvent.Form.target(ev)["value"] - updatePercentage(item, val->Belt.Int.fromString->Option.getOr(0)) + updatePercentage(item, val->Int.fromString->Option.getOr(0)) }} - value={item.split->Belt.Int.toString} + value={item.split->Int.toString} type_="text" inputMode="text" /> diff --git a/src/components/tooltip/ToolTip.res b/src/components/tooltip/ToolTip.res index 274b5aea2..3c53fa4b9 100644 --- a/src/components/tooltip/ToolTip.res +++ b/src/components/tooltip/ToolTip.res @@ -141,35 +141,32 @@ module TooltipWrapper = { ) => { let toolTipTopPosition = switch position { | Top => - tooltipArrowHeight /. componentHeight->Belt.Int.toFloat *. -100.0 +. - tooltipHeightFloat /. componentHeight->Belt.Int.toFloat *. -100.0 - | Right => 50.0 -. tooltipHeightFloat /. componentHeight->Belt.Int.toFloat *. 50.0 - | Bottom => 100.0 +. tooltipArrowHeight /. componentHeight->Belt.Int.toFloat *. 100.0 - | BottomLeft => 100.0 +. tooltipArrowHeight /. componentHeight->Belt.Int.toFloat *. 100.0 - | BottomRight => 100.0 +. tooltipArrowHeight /. componentHeight->Belt.Int.toFloat *. 100.0 - | Left => 50.0 -. tooltipHeightFloat /. componentHeight->Belt.Int.toFloat *. 50.0 + tooltipArrowHeight /. componentHeight->Int.toFloat *. -100.0 +. + tooltipHeightFloat /. componentHeight->Int.toFloat *. -100.0 + | Right => 50.0 -. tooltipHeightFloat /. componentHeight->Int.toFloat *. 50.0 + | Bottom => 100.0 +. tooltipArrowHeight /. componentHeight->Int.toFloat *. 100.0 + | BottomLeft => 100.0 +. tooltipArrowHeight /. componentHeight->Int.toFloat *. 100.0 + | BottomRight => 100.0 +. tooltipArrowHeight /. componentHeight->Int.toFloat *. 100.0 + | Left => 50.0 -. tooltipHeightFloat /. componentHeight->Int.toFloat *. 50.0 | TopLeft => - tooltipArrowHeight /. componentHeight->Belt.Int.toFloat *. -100.0 +. - tooltipHeightFloat /. componentHeight->Belt.Int.toFloat *. -100.0 + tooltipArrowHeight /. componentHeight->Int.toFloat *. -100.0 +. + tooltipHeightFloat /. componentHeight->Int.toFloat *. -100.0 | TopRight => - tooltipArrowHeight /. componentHeight->Belt.Int.toFloat *. -100.0 +. - tooltipHeightFloat /. componentHeight->Belt.Int.toFloat *. -100.0 + tooltipArrowHeight /. componentHeight->Int.toFloat *. -100.0 +. + tooltipHeightFloat /. componentHeight->Int.toFloat *. -100.0 } let toolTipLeftPosition = switch position { - | Top => 50.0 -. tooltipWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. 50.0 - | Right => - 100.0 +. tooltipArrowWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. 100.0 - | Bottom => 50.0 -. tooltipWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. 50.0 + | Top => 50.0 -. tooltipWidth->Int.toFloat /. componentWidth->Int.toFloat *. 50.0 + | Right => 100.0 +. tooltipArrowWidth->Int.toFloat /. componentWidth->Int.toFloat *. 100.0 + | Bottom => 50.0 -. tooltipWidth->Int.toFloat /. componentWidth->Int.toFloat *. 50.0 | Left => - tooltipArrowWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. -100.0 +. - tooltipWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. -100.0 - | TopLeft => tooltipWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. -50.0 - | BottomLeft => tooltipWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. -50.0 - | TopRight => - 100.0 +. tooltipWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. -60.0 - | BottomRight => - 100.0 +. tooltipWidth->Belt.Int.toFloat /. componentWidth->Belt.Int.toFloat *. -60.0 + tooltipArrowWidth->Int.toFloat /. componentWidth->Int.toFloat *. -100.0 +. + tooltipWidth->Int.toFloat /. componentWidth->Int.toFloat *. -100.0 + | TopLeft => tooltipWidth->Int.toFloat /. componentWidth->Int.toFloat *. -50.0 + | BottomLeft => tooltipWidth->Int.toFloat /. componentWidth->Int.toFloat *. -50.0 + | TopRight => 100.0 +. tooltipWidth->Int.toFloat /. componentWidth->Int.toFloat *. -60.0 + | BottomRight => 100.0 +. tooltipWidth->Int.toFloat /. componentWidth->Int.toFloat *. -60.0 } ReactDOMStyle.make( @@ -362,7 +359,7 @@ module Arrow = { | _ => positionX + componentWidth / 2 - 5 } - let tooltipArrowpixel = `${tooltipArrowSize->Belt.Int.toString}px` + let tooltipArrowpixel = `${tooltipArrowSize->Int.toString}px` let borderWidth = switch position { | Top => `${tooltipArrowpixel} ${tooltipArrowpixel} 0` | TopLeft => `${tooltipArrowpixel} ${tooltipArrowpixel} 0` @@ -427,9 +424,9 @@ module Arrow = { } let arrowLeftPosition = switch position { - | Left => 100.0 +. tooltipArrowWidth->Belt.Int.toFloat /. tooltipWidth->Belt.Int.toFloat - | Right => tooltipArrowWidth->Belt.Int.toFloat /. tooltipWidth->Belt.Int.toFloat *. -100.0 - | _ => 50.0 -. tooltipArrowWidth->Belt.Int.toFloat /. tooltipWidth->Belt.Int.toFloat *. 50.0 + | Left => 100.0 +. tooltipArrowWidth->Int.toFloat /. tooltipWidth->Int.toFloat + | Right => tooltipArrowWidth->Int.toFloat /. tooltipWidth->Int.toFloat *. -100.0 + | _ => 50.0 -. tooltipArrowWidth->Int.toFloat /. tooltipWidth->Int.toFloat *. 50.0 } let borderWidth = switch position { @@ -462,8 +459,8 @@ module Arrow = { let borderLeftColor = position === Left ? arrowColor : "transparent" ReactDOMStyle.make( - ~top=`${arrowTopPosition->Belt.Float.toString}%`, - ~left=`${arrowLeftPosition->Belt.Float.toString}%`, + ~top=`${arrowTopPosition->Float.toString}%`, + ~left=`${arrowLeftPosition->Float.toString}%`, ~borderWidth, ~width="0", ~height="0", @@ -653,17 +650,14 @@ let make = ( }, [isToolTipVisible]) let getBoundingRectInfo = (ref: React.ref>, getter) => { - ref.current - ->Js.Nullable.toOption - ->Belt.Option.map(getBoundingClientRect) - ->Option.mapOr(0, getter) + ref.current->Js.Nullable.toOption->Option.map(getBoundingClientRect)->Option.mapOr(0, getter) } let tooltipWidth = toolTipRef->getBoundingRectInfo(val => val.width) let tooltipHeight = toolTipRef->getBoundingRectInfo(val => val.height) - let tooltipHeightFloat = tooltipHeight->Belt.Int.toFloat + let tooltipHeightFloat = tooltipHeight->Int.toFloat let tooltipArrowWidth = toolTipArrowRef->getBoundingRectInfo(val => val.width) - let tooltipArrowHeight = toolTipArrowRef->getBoundingRectInfo(val => val.height)->Belt.Int.toFloat + let tooltipArrowHeight = toolTipArrowRef->getBoundingRectInfo(val => val.height)->Int.toFloat let positionX = componentRef->getBoundingRectInfo(val => val.x) let positionY = componentRef->getBoundingRectInfo(val => val.y) let componentWidth = componentRef->getBoundingRectInfo(val => val.width) diff --git a/src/context/ChartContext.res b/src/context/ChartContext.res index b4edf7780..41dcd53ea 100644 --- a/src/context/ChartContext.res +++ b/src/context/ChartContext.res @@ -47,7 +47,7 @@ let getGranularityMapper = (granularity: string) => { (1, "hour") } else { ( - granularityArr->Array.get(0)->Option.getOr("1")->Belt.Int.fromString->Option.getOr(1), + granularityArr->Array.get(0)->Option.getOr("1")->Int.fromString->Option.getOr(1), granularityArr->Array.get(1)->Option.getOr("week"), ) } @@ -377,7 +377,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF _ => Loaded( dataMerge( ~dataArr=metricsArr->Array.map(item => item->getArrayFromJson([])), - ~dictKey=Belt.Array.concat(activeTab->Option.getOr([]), ["time"]), + ~dictKey=Array.concat(activeTab->Option.getOr([]), ["time"]), )->Js.Json.array, ), ), @@ -504,7 +504,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF let data = dataMerge( ~dataArr=metricsArr->Array.map(item => item->getArrayFromJson([])), - ~dictKey=Belt.Array.concat(activeTab->Option.getOr([]), ["time"]), + ~dictKey=Array.concat(activeTab->Option.getOr([]), ["time"]), )->Js.Json.array resolve(setBottomChartData(_ => Loaded(data))) @@ -704,7 +704,7 @@ module SDKAnalyticsChartContext = { fromTime: startTimeFromUrl, toTime: endTimeFromUrl, } - let differentTimeValues = Belt.Array.concat( + let differentTimeValues = Array.concat( [currentTimeRanges], differentTimeValues->Option.getOr([]), ) @@ -998,7 +998,7 @@ module SDKAnalyticsChartContext = { // }, // ) // }) - // ->Belt.Array.concatMany + // ->Array.concatMany // ->Promise.all // ->Promise.thenResolve(dataArr => { // setBottomChartData( diff --git a/src/context/SingleStatContext.res b/src/context/SingleStatContext.res index 60452f98f..d8e5c8c85 100644 --- a/src/context/SingleStatContext.res +++ b/src/context/SingleStatContext.res @@ -203,7 +203,7 @@ let make = ( setIndividualSingleStatTime( prev => { let individualTime = prev->Dict.toArray->Dict.fromArray - individualTime->Dict.set(index->Belt.Int.toString, Js.Date.now()) + individualTime->Dict.set(index->Int.toString, Js.Date.now()) individualTime }, ) @@ -434,9 +434,9 @@ let make = ( prev => { let individualTime = prev->Dict.toArray->Dict.fromArray individualTime->Dict.set( - index->Belt.Int.toString, + index->Int.toString, Js.Date.now() -. - individualTime->Dict.get(index->Belt.Int.toString)->Option.getOr(Js.Date.now()), + individualTime->Dict.get(index->Int.toString)->Option.getOr(Js.Date.now()), ) individualTime }, diff --git a/src/context/UserPrefContext.res b/src/context/UserPrefContext.res index ad1058602..9156ad9d2 100644 --- a/src/context/UserPrefContext.res +++ b/src/context/UserPrefContext.res @@ -47,10 +47,7 @@ let make = (~children) => { } let (userPref, setUserPref) = React.useState(_ => userPrefInitialVal) let url = RescriptReactRouter.useUrl() - let urlPathConcationation = `/${url.path - ->LogicUtils.stripV4 - ->Belt.List.toArray - ->Array.joinWith("/")}` + let urlPathConcationation = `/${url.path->LogicUtils.stripV4->List.toArray->Array.joinWith("/")}` // UPDATE THE LAST VISITED TAB React.useEffect2(() => { if urlPathConcationation !== "/" { diff --git a/src/entities/analytics/AnalyticsUtils.res b/src/entities/analytics/AnalyticsUtils.res index cd6b5ba00..e7bb4c437 100644 --- a/src/entities/analytics/AnalyticsUtils.res +++ b/src/entities/analytics/AnalyticsUtils.res @@ -446,7 +446,7 @@ let generatedeltaTablePayload = ( ~showDeltaMetrics=false, ~customFilter, ) => { - let dictOfDates = Belt.Array.concatMany(deltaDateArr) + let dictOfDates = Array.flat(deltaDateArr) let tablePayload = Belt.Array.zipBy(dictOfDates, deltaPrefixArr, (x, y) => generatePayload( ~startTime=x->Dict.get("fromTime")->Option.getOr(""), @@ -557,11 +557,8 @@ let generateTablePayload = ( } else { [] } - let tableBodyValues = Belt.Array.concatMany([ - tableBodyWithNonDeltaMetrix, - tableBodyWithDeltaMetrix, - tableIndustryPayload, - ]) + let tableBodyValues = + tableBodyWithNonDeltaMetrix->Array.concatMany([tableBodyWithDeltaMetrix, tableIndustryPayload]) let distributionPayload = switch distributionArray { | Some(distributionArray) => @@ -583,7 +580,8 @@ let generateTablePayload = ( } let tableBody = - Belt.Array.concatMany([tableBodyValues, deltaPayload, distributionPayload]) + tableBodyValues + ->Array.concatMany([deltaPayload, distributionPayload]) ->Array.map(Js.Json.object_) ->Js.Json.array tableBody @@ -606,7 +604,7 @@ let singlestatDeltaTooltipFormat = (value: float, timeRanges: timeRanges, statTy if statType === "Latency" || statType === "NegativeRate" { if value > 0. { let text = "Increased by " - let value = Js.Math.abs_float(value)->Belt.Float.toString ++ "%" + let value = Js.Math.abs_float(value)->Float.toString ++ "%"
    {React.string(text)}
    @@ -620,7 +618,7 @@ let singlestatDeltaTooltipFormat = (value: float, timeRanges: timeRanges, statTy
    } else if value < 0. { let text = "Decreased by " - let value = value->Belt.Float.toString ++ "%" + let value = value->Float.toString ++ "%"
    {React.string(text)}
    @@ -634,7 +632,7 @@ let singlestatDeltaTooltipFormat = (value: float, timeRanges: timeRanges, statTy
    } else { let text = "Changed by " - let value = value->Belt.Float.toString ++ "%" + let value = value->Float.toString ++ "%"
    {React.string(text)}
    @@ -649,7 +647,7 @@ let singlestatDeltaTooltipFormat = (value: float, timeRanges: timeRanges, statTy } } else if value < 0. { let text = "Decreased by " - let value = Js.Math.abs_float(value)->Belt.Float.toString ++ "%" + let value = Js.Math.abs_float(value)->Float.toString ++ "%"
    {React.string(text)}
    @@ -663,7 +661,7 @@ let singlestatDeltaTooltipFormat = (value: float, timeRanges: timeRanges, statTy
    } else if value > 0. { let text = "Increased by " - let value = value->Belt.Float.toString ++ "%" + let value = value->Float.toString ++ "%"
    {React.string(text)}
    @@ -677,7 +675,7 @@ let singlestatDeltaTooltipFormat = (value: float, timeRanges: timeRanges, statTy
    } else { let text = "Changed by " - let value = value->Belt.Float.toString ++ "%" + let value = value->Float.toString ++ "%"
    {React.string(text)}
    diff --git a/src/entryPoints/hyperswitch/HyperSwitchEntry.res b/src/entryPoints/hyperswitch/HyperSwitchEntry.res index 1bb406fd4..401173b49 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchEntry.res +++ b/src/entryPoints/hyperswitch/HyperSwitchEntry.res @@ -51,7 +51,7 @@ module HyperSwitchEntryComponent = { | list{"user", "set_password"} => "set_password"->setPageName | list{"user", "login"} => "magic_link_verify"->setPageName | _ => - switch Belt.List.head(url.path) { + switch List.head(url.path) { | Some(pageTitle) => pageTitle->setPageName | _ => () } diff --git a/src/genericUtils/BreadCrumbNavigation.res b/src/genericUtils/BreadCrumbNavigation.res index d7a52e8bb..81bc9ccb1 100644 --- a/src/genericUtils/BreadCrumbNavigation.res +++ b/src/genericUtils/BreadCrumbNavigation.res @@ -57,7 +57,7 @@ let make = ( }, }) } - +
    {if collapse {
    { let anchor = arr[2]->Option.getOr("") let val = arr[1]->Option.getOr("") switch anchor { - | "days" => Day(val->Belt.Float.fromString->Option.getOr(0.0)) - | "hours" => Hour(val->Belt.Float.fromString->Option.getOr(0.0)) - | "mins" => Hour(val->Belt.Float.fromString->Option.getOr(0.0) /. 60.0) + | "days" => Day(val->Float.fromString->Option.getOr(0.0)) + | "hours" => Hour(val->Float.fromString->Option.getOr(0.0)) + | "mins" => Hour(val->Float.fromString->Option.getOr(0.0) /. 60.0) | _ => Today } } diff --git a/src/hooks/TimeZoneHook.res b/src/hooks/TimeZoneHook.res index 3004cafad..56584dad5 100644 --- a/src/hooks/TimeZoneHook.res +++ b/src/hooks/TimeZoneHook.res @@ -33,7 +33,7 @@ let dateTimeObjectToDate = (dateTimeObject: dateTimeFloat) => { } let stringToFloat = element => { - switch Belt.Float.fromString(element) { + switch Float.fromString(element) { | Some(a) => a | _ => 0.0 } @@ -87,7 +87,7 @@ let en_USStringToDateTimeObject = dateTimeIsoString => { let date = tempTimeDate[0] let dateComponents = date->Option.getOr("")->String.split("/") let timeComponents = time->Option.getOr("")->String.split(":") - let tempHour = switch Belt.Float.fromString(timeComponents[0]->Option.getOr("")) { + let tempHour = switch Float.fromString(timeComponents[0]->Option.getOr("")) { | Some(a) => a | _ => 0.0 } @@ -97,7 +97,7 @@ let en_USStringToDateTimeObject = dateTimeIsoString => { : tempHour < 12.0 ? tempHour +. 12.0 : tempHour - let hourInString = Belt.Float.toString(fullTempHour) + let hourInString = Float.toString(fullTempHour) let dateTimeObject: dateTimeString = { year: formatter(dateComponents[2]->Option.getOr("")), month: formatter(dateComponents[0]->Option.getOr("")), diff --git a/src/libraries/PDFViewer/ReactPDFViewerSinglePage.res b/src/libraries/PDFViewer/ReactPDFViewerSinglePage.res index 1a35e6237..832a49275 100644 --- a/src/libraries/PDFViewer/ReactPDFViewerSinglePage.res +++ b/src/libraries/PDFViewer/ReactPDFViewerSinglePage.res @@ -24,7 +24,7 @@ let make = (~url, ~className, ~loading, ~height=700, ~width=800, ~error) => {
    - {Belt.Array.makeBy(numPages, i => i + 1) + {Array.fromInitializer(~length=numPages, i => i + 1) ->Array.mapWithIndex((ele, index) => { string_of_int}`} diff --git a/src/libraries/RRule.res b/src/libraries/RRule.res index 4a98049e1..82c6408f0 100644 --- a/src/libraries/RRule.res +++ b/src/libraries/RRule.res @@ -44,7 +44,7 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = ) => { //check if date in date blacklist let getDay = date => { - Belt.Float.toInt(Js.Date.getDay(date)) + Float.toInt(Js.Date.getDay(date)) } let byDay = switch recipe.recurrence { | Some(recur) => @@ -62,7 +62,7 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = | None => true } let getDate = date => { - Belt.Float.toInt(Js.Date.getDate(date)) + Float.toInt(Js.Date.getDate(date)) } let byDate = switch recipe.recurrence { @@ -81,7 +81,7 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = | None => true } let getMonth = date => { - Belt.Float.toInt(Js.Date.getMonth(date)) + Float.toInt(Js.Date.getMonth(date)) } let byMonth = switch recipe.recurrence { @@ -100,7 +100,7 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = | None => true } let getYear = date => { - Belt.Float.toInt(Js.Date.getFullYear(date)) + Float.toInt(Js.Date.getFullYear(date)) } let byYear = switch recipe.recurrence { @@ -122,7 +122,7 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = let getWeek = date => { // let dat = getDate(date) // let da = getDay(date) - // let a = Js.Math.ceil_int(Belt.Int.toFloat(dat + da)) / 7 + // let a = Js.Math.ceil_int(Int.toFloat(dat + da)) / 7 // a + 1 let firstWeekDay = Js.Date.makeWithYMD( ~year=Js.Date.getFullYear(date), @@ -131,9 +131,8 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = (), ) let offsetDate = - Belt.Int.fromFloat(Js.Date.getDate(date)) + - Belt.Int.fromFloat(Js.Date.getDay(firstWeekDay)) - 1 - Js.Math.floor_int(Belt.Float.fromInt(offsetDate / 7)) + 1 + Int.fromFloat(Js.Date.getDate(date)) + Int.fromFloat(Js.Date.getDay(firstWeekDay)) - 1 + Js.Math.floor_int(Float.fromInt(offsetDate / 7)) + 1 } let byWeek = switch recipe.recurrence { | Some(recur) => @@ -141,7 +140,7 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = | Some(days) => { let day = getWeek(currentTime) switch days->Array.find(x => x == day) { - | Some(_a) => true + | Some(_) => true | None => false } } diff --git a/src/screens/HyperSwitch/Analytics/Analytics.res b/src/screens/HyperSwitch/Analytics/Analytics.res index a47c57fba..0501ea0cd 100644 --- a/src/screens/HyperSwitch/Analytics/Analytics.res +++ b/src/screens/HyperSwitch/Analytics/Analytics.res @@ -318,7 +318,7 @@ module TableWrapper = { ) ->Array.get(0) }) - ->Belt.Array.concat(allColumns) + ->Array.concat(allColumns) }, [activeTabStr]) let newAllCols = React.useMemo1(() => { @@ -327,7 +327,7 @@ module TableWrapper = { let val = item->getHeading activeTab->Option.getOr([])->Array.includes(val.key) ? Some(item) : None }) - ->Belt.Array.concat(allColumns) + ->Array.concat(allColumns) }, [activeTabStr]) let transactionTableDefaultCols = React.useMemo2(() => { diff --git a/src/screens/HyperSwitch/Analytics/ErrorReasons.res b/src/screens/HyperSwitch/Analytics/ErrorReasons.res index 6e4b5ad7e..247c9fdd5 100644 --- a/src/screens/HyperSwitch/Analytics/ErrorReasons.res +++ b/src/screens/HyperSwitch/Analytics/ErrorReasons.res @@ -51,8 +51,8 @@ let getHeading = colType => { let getCell = (errorObj, colType): Table.cell => { switch colType { | ErrorReason => Text(errorObj.error_reason) - | Count => Text(errorObj.count->Belt.Int.toString) - | Percentage => Text(errorObj.percentage->Belt.Float.toString) + | Count => Text(errorObj.count->Int.toString) + | Percentage => Text(errorObj.percentage->Float.toString) } } diff --git a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res index 267ac707e..1782f4cc9 100644 --- a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res +++ b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res @@ -304,15 +304,10 @@ let generateTablePayload = ( } else { [] } - let tableBodyValues = Belt.Array.concatMany([ - tableBodyWithNonDeltaMetrix, - tableBodyWithDeltaMetrix, - tableIndustryPayload, - ]) + let tableBodyValues = + tableBodyWithNonDeltaMetrix->Array.concatMany([tableBodyWithDeltaMetrix, tableIndustryPayload]) let tableBody = - Belt.Array.concatMany([tableBodyValues, deltaPayload]) - ->Array.map(Js.Json.object_) - ->Js.Json.array + tableBodyValues->Array.concat(deltaPayload)->Array.map(Js.Json.object_)->Js.Json.array tableBody } diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res index 3892ceb09..81445543c 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res @@ -260,10 +260,9 @@ let singleStateSeriesInitialValue = { } let singleStateItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { payment_success_rate: dict->getFloat("payment_success_rate", 0.0), payment_count: dict->getInt("payment_count", 0), payment_success_count: dict->getInt("payment_success_count", 0), @@ -279,10 +278,9 @@ let singleStateItemToObjMapper = json => { } let singleStateSeriesItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { payment_success_rate: dict->getFloat("payment_success_rate", 0.0)->setPrecision(), payment_count: dict->getInt("payment_count", 0), payment_success_count: dict->getInt("payment_success_count", 0), @@ -293,7 +291,7 @@ let singleStateSeriesItemToObjMapper = json => { retries_amount_processe: dict->getFloat("retries_amount_processed", 0.0), connector_success_rate: dict->getFloat("connector_success_rate", 0.0), }) - ->getWithDefault({ + ->Option.getOr({ singleStateSeriesInitialValue }) } @@ -368,16 +366,13 @@ let constructData = ( ->Js.Array2.sortInPlaceWith(compareLogic) | "payment_count" => singlestatTimeseriesData - ->Array.map(ob => ( - ob.time_series->DateTimeUtils.parseAsFloat, - ob.payment_count->Belt.Int.toFloat, - )) + ->Array.map(ob => (ob.time_series->DateTimeUtils.parseAsFloat, ob.payment_count->Int.toFloat)) ->Js.Array2.sortInPlaceWith(compareLogic) | "payment_success_count" => singlestatTimeseriesData ->Array.map(ob => ( ob.time_series->DateTimeUtils.parseAsFloat, - ob.payment_success_count->Belt.Int.toFloat, + ob.payment_success_count->Int.toFloat, )) ->Js.Array2.sortInPlaceWith(compareLogic) | "payment_processed_amount" => @@ -397,7 +392,7 @@ let constructData = ( | "retries_count" => singlestatTimeseriesData->Array.map(ob => ( ob.time_series->DateTimeUtils.parseAsFloat, - ob.retries_count->Belt.Int.toFloat, + ob.retries_count->Int.toFloat, )) | "retries_amount_processed" => singlestatTimeseriesData @@ -441,12 +436,12 @@ let getStatData = ( title: "Overall Payments", tooltipText: "Total payments initiated", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.payment_count->Belt.Int.toFloat, + singleStatData.payment_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.payment_count->Belt.Int.toFloat, + value: singleStatData.payment_count->Int.toFloat, delta: { - singleStatData.payment_count->Belt.Int.toFloat + singleStatData.payment_count->Int.toFloat }, data: constructData("payment_count", timeSeriesData), statType: "Volume", @@ -456,14 +451,14 @@ let getStatData = ( title: "Success Payments", tooltipText: "Total number of payments with status as succeeded. ", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.payment_success_count->Belt.Int.toFloat, + singleStatData.payment_success_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.payment_success_count->Belt.Int.toFloat, + value: singleStatData.payment_success_count->Int.toFloat, delta: { Js.Float.fromString( Js.Float.toFixedWithPrecision( - singleStatData.payment_success_count->Belt.Int.toFloat, + singleStatData.payment_success_count->Int.toFloat, ~digits=2, ), ) @@ -516,12 +511,12 @@ let getStatData = ( title: "Smart Retries made", tooltipText: "Total number of retries that were attempted after a failed payment attempt (Note: Only date range filters are supoorted currently)", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.retries_count->Belt.Int.toFloat, + singleStatData.retries_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.retries_count->Belt.Int.toFloat, + value: singleStatData.retries_count->Int.toFloat, delta: { - singleStatData.retries_count->Belt.Int.toFloat + singleStatData.retries_count->Int.toFloat }, data: constructData("retries_count", timeSeriesData), statType: "Volume", diff --git a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res index 80585f2e9..b67ca625d 100644 --- a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res @@ -32,7 +32,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Loading) let refundUrl = getURL(~entityName=REFUNDS, ~methodType=Post, ~id=Some("refund-post"), ()) let body = Dict.make() - body->Dict.set("limit", 100->Belt.Int.toFloat->Js.Json.number) + body->Dict.set("limit", 100->Int.toFloat->Js.Json.number) let refundDetails = await updateDetails(refundUrl, body->Js.Json.object_, Post, ()) let data = refundDetails->getDictFromJsonObject->getArrayFromDict("data", []) diff --git a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res index df5b2227c..4d0a7b9c5 100644 --- a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res @@ -132,10 +132,9 @@ let singleStateSeriesInitialValue = { } let singleStateItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { refund_success_rate: dict->getFloat("refund_success_rate", 0.0), refund_count: dict->getInt("refund_count", 0), refund_success_count: dict->getInt("refund_success_count", 0), @@ -147,17 +146,16 @@ let singleStateItemToObjMapper = json => { } let singleStateSeriesItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { refund_success_rate: dict->getFloat("refund_success_rate", 0.0)->setPrecision(), refund_count: dict->getInt("refund_count", 0), refund_success_count: dict->getInt("refund_success_count", 0), time_series: dict->getString("time_bucket", ""), refund_processed_amount: dict->getFloat("refund_processed_amount", 0.0)->setPrecision(), }) - ->getWithDefault({ + ->Option.getOr({ singleStateSeriesInitialValue }) } @@ -219,7 +217,7 @@ let constructData = (key, singlestatTimeseriesData: arrayJs.Date.fromFloat ->DateTimeUtils.utcToISTDate ->Js.Date.valueOf, - ob.refund_count->Belt.Int.toFloat, + ob.refund_count->Int.toFloat, )) ->Js.Array2.sortInPlaceWith(compareLogic) | "refund_success_count" => @@ -230,7 +228,7 @@ let constructData = (key, singlestatTimeseriesData: arrayJs.Date.fromFloat ->DateTimeUtils.utcToISTDate ->Js.Date.valueOf, - ob.refund_success_count->Belt.Int.toFloat, + ob.refund_success_count->Int.toFloat, )) ->Js.Array2.sortInPlaceWith(compareLogic) | "refund_processed_amount" => @@ -277,13 +275,13 @@ let getStatData = ( title: "Overall Refunds", tooltipText: "Total refund initiated", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.refund_count->Belt.Int.toFloat, + singleStatData.refund_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.refund_count->Belt.Int.toFloat, + value: singleStatData.refund_count->Int.toFloat, delta: { Js.Float.fromString( - Js.Float.toFixedWithPrecision(singleStatData.refund_count->Belt.Int.toFloat, ~digits=2), + Js.Float.toFixedWithPrecision(singleStatData.refund_count->Int.toFloat, ~digits=2), ) }, data: constructData("refund_count", timeSeriesData), @@ -294,14 +292,14 @@ let getStatData = ( title: "Success Refunds", tooltipText: "Total successful refunds", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.refund_success_count->Belt.Int.toFloat, + singleStatData.refund_success_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.refund_success_count->Belt.Int.toFloat, + value: singleStatData.refund_success_count->Int.toFloat, delta: { Js.Float.fromString( Js.Float.toFixedWithPrecision( - singleStatData.refund_success_count->Belt.Int.toFloat, + singleStatData.refund_success_count->Int.toFloat, ~digits=2, ), ) diff --git a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res index 5dacb3ccd..2ba23e5d3 100644 --- a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res @@ -184,7 +184,7 @@ module HSiwtchPaymentConfirmLatency = {
    {latencyShortNum( - ~labelValue=latency->Belt.Int.toFloat /. 1000.0, + ~labelValue=latency->Int.toFloat /. 1000.0, ~includeMilliseconds=true, (), ) diff --git a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res index c1521e305..a9eee7eac 100644 --- a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res +++ b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res @@ -18,10 +18,9 @@ let singleStateSeriesInitialValue = { } let singleStateItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { latency: dict->getFloat("latency", 0.0), api_count: dict->getInt("api_count", 0), status_code_count: dict->getInt("status_code_count", 0), @@ -32,16 +31,15 @@ let singleStateItemToObjMapper = json => { } let singleStateSeriesItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { latency: dict->getFloat("latency", 0.0), api_count: dict->getInt("api_count", 0), status_code_count: dict->getInt("status_code_count", 0), time_series: dict->getString("time_bucket", ""), }) - ->getWithDefault({ + ->Option.getOr({ singleStateSeriesInitialValue }) } @@ -75,13 +73,13 @@ let constructData = ( ->Js.Array2.sortInPlaceWith(compareLogic) | "api_count" => singlestatTimeseriesData - ->Array.map(ob => (ob.time_series->DateTimeUtils.parseAsFloat, ob.api_count->Belt.Int.toFloat)) + ->Array.map(ob => (ob.time_series->DateTimeUtils.parseAsFloat, ob.api_count->Int.toFloat)) ->Js.Array2.sortInPlaceWith(compareLogic) | "status_code_count" => singlestatTimeseriesData ->Array.map(ob => ( ob.time_series->DateTimeUtils.parseAsFloat, - ob.status_code_count->Belt.Int.toFloat, + ob.status_code_count->Int.toFloat, )) ->Js.Array2.sortInPlaceWith(compareLogic) | _ => [] @@ -115,12 +113,12 @@ let getStatData = ( title: "API Count", tooltipText: "API request count is the tally of requests made to the Hyperswitch APIs, reflecting the volume of interactions and usage during a defined timeframe.", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.api_count->Belt.Int.toFloat, + singleStatData.api_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.api_count->Belt.Int.toFloat, + value: singleStatData.api_count->Int.toFloat, delta: { - singleStatData.api_count->Belt.Int.toFloat + singleStatData.api_count->Int.toFloat }, data: constructData("api_count", timeSeriesData), statType: "Volume", diff --git a/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res index dd655fa3a..f9d223b8c 100644 --- a/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res @@ -22,10 +22,9 @@ let singleStateSeriesInitialValue = { } let singleStatItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { payment_attempts: dict->getInt("payment_attempts", 0), sdk_rendered_count: dict->getInt("sdk_rendered_count", 0), average_payment_time: dict->getFloat("average_payment_time", 0.0) /. 1000., @@ -36,16 +35,15 @@ let singleStatItemToObjMapper = json => { } let singleStateSeriesItemToObjMapper = json => { - open Belt.Option json ->Js.Json.decodeObject - ->map(dict => { + ->Option.map(dict => { payment_attempts: dict->getInt("payment_attempts", 0), time_series: dict->getString("time_bucket", ""), sdk_rendered_count: dict->getInt("sdk_rendered_count", 0), average_payment_time: dict->getFloat("average_payment_time", 0.0)->setPrecision() /. 1000., }) - ->getWithDefault({ + ->Option.getOr({ singleStateSeriesInitialValue }) } @@ -93,26 +91,25 @@ let constructData = (key, singlestatTimeseriesData) => { singlestatTimeseriesData ->Array.map(ob => ( ob.time_series->DateTimeUtils.parseAsFloat, - ob.payment_attempts->Belt.Int.toFloat, + ob.payment_attempts->Int.toFloat, )) ->Js.Array2.sortInPlaceWith(compareLogic) | "conversion_rate" => singlestatTimeseriesData ->Array.map(ob => ( ob.time_series->DateTimeUtils.parseAsFloat, - 100. *. ob.payment_attempts->Belt.Int.toFloat /. ob.sdk_rendered_count->Belt.Int.toFloat, + 100. *. ob.payment_attempts->Int.toFloat /. ob.sdk_rendered_count->Int.toFloat, )) ->Js.Array2.sortInPlaceWith(compareLogic) | "drop_out_rate" => singlestatTimeseriesData->Array.map(ob => ( ob.time_series->DateTimeUtils.parseAsFloat, - 100. -. - 100. *. ob.payment_attempts->Belt.Int.toFloat /. ob.sdk_rendered_count->Belt.Int.toFloat, + 100. -. 100. *. ob.payment_attempts->Int.toFloat /. ob.sdk_rendered_count->Int.toFloat, )) | "sdk_rendered_count" => singlestatTimeseriesData->Array.map(ob => ( ob.time_series->DateTimeUtils.parseAsFloat, - ob.sdk_rendered_count->Belt.Int.toFloat, + ob.sdk_rendered_count->Int.toFloat, )) | "average_payment_time" => singlestatTimeseriesData->Array.map(ob => ( @@ -135,16 +132,13 @@ let getStatData = ( title: "Checkout Page Renders", tooltipText: "Total SDK Renders", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.sdk_rendered_count->Belt.Int.toFloat, + singleStatData.sdk_rendered_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.sdk_rendered_count->Belt.Int.toFloat, + value: singleStatData.sdk_rendered_count->Int.toFloat, delta: { Js.Float.fromString( - Js.Float.toFixedWithPrecision( - singleStatData.sdk_rendered_count->Belt.Int.toFloat, - ~digits=2, - ), + Js.Float.toFixedWithPrecision(singleStatData.sdk_rendered_count->Int.toFloat, ~digits=2), ) }, data: constructData("sdk_rendered_count", timeSeriesData), @@ -155,12 +149,12 @@ let getStatData = ( title: "Total Payments", tooltipText: "Sessions where users attempted a payment", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.payment_attempts->Belt.Int.toFloat, + singleStatData.payment_attempts->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.payment_attempts->Belt.Int.toFloat, + value: singleStatData.payment_attempts->Int.toFloat, delta: { - singleStatData.payment_attempts->Belt.Int.toFloat + singleStatData.payment_attempts->Int.toFloat }, data: constructData("payment_attempts", timeSeriesData), statType: "Volume", @@ -170,20 +164,20 @@ let getStatData = ( title: "Converted User Sessions", tooltipText: "Percentage of sessions where users attempted a payment", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( - singleStatData.payment_attempts->Belt.Int.toFloat *. + singleStatData.payment_attempts->Int.toFloat *. 100. /. - singleStatData.sdk_rendered_count->Belt.Int.toFloat, + singleStatData.sdk_rendered_count->Int.toFloat, deltaTimestampData.currentSr, ), - value: singleStatData.payment_attempts->Belt.Int.toFloat *. + value: singleStatData.payment_attempts->Int.toFloat *. 100. /. - singleStatData.sdk_rendered_count->Belt.Int.toFloat, + singleStatData.sdk_rendered_count->Int.toFloat, delta: { Js.Float.fromString( Js.Float.toFixedWithPrecision( - singleStatData.payment_attempts->Belt.Int.toFloat *. + singleStatData.payment_attempts->Int.toFloat *. 100. /. - singleStatData.sdk_rendered_count->Belt.Int.toFloat, + singleStatData.sdk_rendered_count->Int.toFloat, ~digits=2, ), ) @@ -197,21 +191,18 @@ let getStatData = ( tooltipText: "Sessions where users did not attempt a payment", deltaTooltipComponent: AnalyticsUtils.singlestatDeltaTooltipFormat( 100. -. - singleStatData.payment_attempts->Belt.Int.toFloat *. + singleStatData.payment_attempts->Int.toFloat *. 100. /. - singleStatData.sdk_rendered_count->Belt.Int.toFloat, + singleStatData.sdk_rendered_count->Int.toFloat, deltaTimestampData.currentSr, ), value: 100. -. - singleStatData.payment_attempts->Belt.Int.toFloat *. + singleStatData.payment_attempts->Int.toFloat *. 100. /. - singleStatData.sdk_rendered_count->Belt.Int.toFloat, + singleStatData.sdk_rendered_count->Int.toFloat, delta: { Js.Float.fromString( - Js.Float.toFixedWithPrecision( - singleStatData.sdk_rendered_count->Belt.Int.toFloat, - ~digits=2, - ), + Js.Float.toFixedWithPrecision(singleStatData.sdk_rendered_count->Int.toFloat, ~digits=2), ) }, data: constructData("drop_out_rate", timeSeriesData), diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res index 865ebd320..36a6ec4d2 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res @@ -6,7 +6,7 @@ let make = (~setCurrentStep, ~setInitialValues, ~initialValues, ~isUpdateFlow, ~ let url = RescriptReactRouter.useUrl() let showToast = ToastState.useShowToast() let connector = UrlUtils.useGetFilterDictFromUrl("")->LogicUtils.getString("name", "") - let connectorID = url.path->Belt.List.toArray->Array.get(1)->Option.getOr("") + let connectorID = url.path->List.toArray->Array.get(1)->Option.getOr("") let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom diff --git a/src/screens/HyperSwitch/Connectors/ConnectorHome.res b/src/screens/HyperSwitch/Connectors/ConnectorHome.res index 7b23bcdb7..b1278e2b9 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorHome.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorHome.res @@ -1,7 +1,7 @@ module ConnectorCurrentStepIndicator = { @react.component let make = (~currentStep: ConnectorTypes.steps, ~stepsArr, ~borderWidth="w-8/12") => { - let cols = stepsArr->Array.length->Belt.Int.toString + let cols = stepsArr->Array.length->Int.toString let currIndex = stepsArr->Array.findIndex(item => item === currentStep)
    @@ -27,7 +27,7 @@ module ConnectorCurrentStepIndicator = { let stepLineIndicator = isPreviousStepCompleted ? "bg-gray-700" : "bg-gray-200" -
    Belt.Int.toString} className="flex flex-col gap-2 font-semibold "> +
    Int.toString} className="flex flex-col gap-2 font-semibold ">
    @@ -59,7 +59,7 @@ let make = (~isPayoutFlow=false, ~showStepIndicator=true, ~showBreadCrumb=true) open APIUtils let url = RescriptReactRouter.useUrl() let connector = UrlUtils.useGetFilterDictFromUrl("")->LogicUtils.getString("name", "") - let connectorID = url.path->Belt.List.toArray->Array.get(1)->Option.getOr("") + let connectorID = url.path->List.toArray->Array.get(1)->Option.getOr("") let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success) let (initialValues, setInitialValues) = React.useState(_ => Dict.make()->Js.Json.object_) let (currentStep, setCurrentStep) = React.useState(_ => ConnectorTypes.IntegFields) diff --git a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res index d7f18bb10..37b943fcd 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res @@ -216,7 +216,7 @@ let getArrayDataFromJson = (json, itemToObjMapper: Dict.t => connecto } let comparatorFunction = (connector1: connectorPayload, connector2: connectorPayload) => { - connector1.connector_name->String.localeCompare(connector2.connector_name)->Belt.Float.toInt + connector1.connector_name->String.localeCompare(connector2.connector_name)->Float.toInt } let sortPreviouslyConnectedList = arr => { diff --git a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res index 781874d60..e2d55794d 100644 --- a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res +++ b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res @@ -30,7 +30,7 @@ module Simplified = { let updateAPIHook = useUpdateMethod(~showErrorToast=false, ()) let showToast = ToastState.useShowToast() let fetchApi = AuthHooks.useApiFetcher() - let connectorID = url.path->Belt.List.toArray->Array.get(1)->Option.getOr("") + let connectorID = url.path->List.toArray->Array.get(1)->Option.getOr("") let merchantDetailsValue = HSwitchUtils.useMerchantDetailsValue() let merchantId = merchantDetailsValue->getDictFromJsonObject->getString("merchant_id", "") let prefix = "apple_pay_combined.simplified.session_token_data.initiative_context" @@ -166,7 +166,7 @@ module Manual = { ->Dict.keysToArray ->Array.mapWithIndex((field, index) => { let label = configurationFields->getString(field, "") -
    Belt.Int.toString}> +
    Int.toString}> Dict.keysToArray ->Array.mapWithIndex((field, index) => { let label = configurationFields->LogicUtils.getString(field, "") -
    Belt.Int.toString}> +
    Int.toString}> Array.mapWithIndex((colType, i) => { Array.includes(colType))}> -
    +
    showToast(~message="Api Key Generation Failed", ~toastType=ToastState.ToastError, ()) - - | None => Js.log("Something went wrong") + | None => () } setModalState(_ => SettingApiModalError) } @@ -229,8 +228,7 @@ module TableActionsCell = { switch Js.Exn.message(e) { | Some(_error) => showToast(~message="Failed to delete API key", ~toastType=ToastState.ToastError, ()) - - | None => Js.log("Something went wrong") + | None => () } } } diff --git a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res index 8b55e2f19..54e263a7b 100644 --- a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res +++ b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res @@ -33,7 +33,7 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { open HSwitchUtils open MerchantAccountUtils let url = RescriptReactRouter.useUrl() - let id = url.path->Belt.List.toArray->Array.get(1)->Option.getOr(profileId) + let id = url.path->List.toArray->Array.get(1)->Option.getOr(profileId) let businessProfileDetails = useGetBusinessProflile(id) let showToast = ToastState.useShowToast() @@ -133,7 +133,7 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { ->Array.filter(urlField => urlField.label === "Webhook URL" || !webhookOnly) ->Array.mapWithIndex((field, index) => Belt.Int.toString} + key={index->Int.toString} field errorClass labelClass="!text-base !text-grey-700 font-semibold" diff --git a/src/screens/HyperSwitch/Disputes/DisputesEntity.res b/src/screens/HyperSwitch/Disputes/DisputesEntity.res index db1541dea..a5c6b934d 100644 --- a/src/screens/HyperSwitch/Disputes/DisputesEntity.res +++ b/src/screens/HyperSwitch/Disputes/DisputesEntity.res @@ -121,7 +121,7 @@ let getHeading = colType => { } let amountValue = (amount, currency) => { let amountInFloat = amount->Js.Float.fromString /. 100.0 - `${amountInFloat->Belt.Float.toString} ${currency}` + `${amountInFloat->Float.toString} ${currency}` } let getCell = (disputesData, colType): Table.cell => { diff --git a/src/screens/HyperSwitch/Disputes/ShowDisputes.res b/src/screens/HyperSwitch/Disputes/ShowDisputes.res index 33acfa261..a681824b3 100644 --- a/src/screens/HyperSwitch/Disputes/ShowDisputes.res +++ b/src/screens/HyperSwitch/Disputes/ShowDisputes.res @@ -190,8 +190,7 @@ module Details = { className={`flex flex-wrap ${justifyClassName} dark:bg-jp-gray-lightgray_background dark:border-jp-gray-no_data_border`}> {detailsFields ->Array.mapWithIndex((colType, i) => { - Array.includes(colType))} key={Belt.Int.toString(i)}> + Array.includes(colType))} key={Int.toString(i)}>
    { let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let (initialValues, setInitialValues) = React.useState(_ => Dict.make()->Js.Json.object_) let frmName = UrlUtils.useGetFilterDictFromUrl("")->getString("name", "") - let frmID = url.path->Belt.List.toArray->Array.get(1)->Option.getOr("") + let frmID = url.path->List.toArray->Array.get(1)->Option.getOr("") let initStep = PaymentMethods diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res index 8f31f3bf0..2ba883248 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res @@ -127,7 +127,7 @@ module IntegrationFieldsForm = { let parse = field.encodeToBase64 ? base64Parse : leadingSpaceStrParser let format = field.encodeToBase64 ? Some(base64Format) : None -
    Belt.Int.toString}> +
    Int.toString}> getFRMNameString let frmInfo = frm->getFRMInfo - +
    String.toUpperCase} className="w-10 h-10 rounded-lg" diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMTableUtils.res b/src/screens/HyperSwitch/FraudAndRisk/FRMTableUtils.res index fc787c398..d6c4300e3 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMTableUtils.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMTableUtils.res @@ -1,8 +1,7 @@ let getArrayDataFromJson = (json, itemToObjMapper) => { - open Belt.Option json ->Js.Json.decodeArray - ->getWithDefault([]) + ->Option.getOr([]) ->Belt.Array.keepMap(Js.Json.decodeObject) ->FRMUtils.filterList(~removeFromList=Connector, ()) ->Array.map(itemToObjMapper) diff --git a/src/screens/HyperSwitch/HSwitchRemoteFilter.res b/src/screens/HyperSwitch/HSwitchRemoteFilter.res index 453c14c0e..54d3672ce 100644 --- a/src/screens/HyperSwitch/HSwitchRemoteFilter.res +++ b/src/screens/HyperSwitch/HSwitchRemoteFilter.res @@ -25,7 +25,7 @@ let getDateFilteredObject = () => { ~date=currentDate->Js.Date.getDate, (), ) - ->Js.Date.setDate((currentDate->Js.Date.getDate->Belt.Float.toInt - 7)->Belt.Int.toFloat) + ->Js.Date.setDate((currentDate->Js.Date.getDate->Float.toInt - 7)->Int.toFloat) ->Js.Date.fromFloat ->formateDateString diff --git a/src/screens/HyperSwitch/Home/HomeUtils.res b/src/screens/HyperSwitch/Home/HomeUtils.res index 92731c320..00f93a712 100644 --- a/src/screens/HyperSwitch/Home/HomeUtils.res +++ b/src/screens/HyperSwitch/Home/HomeUtils.res @@ -337,7 +337,7 @@ module DevResources = { let getGreeting = () => { let dateTime = Js.Date.now() - let hours = Js.Date.fromFloat(dateTime)->Js.Date.getHours->Belt.Int.fromFloat + let hours = Js.Date.fromFloat(dateTime)->Js.Date.getHours->Int.fromFloat if hours < 12 { "Good morning" diff --git a/src/screens/HyperSwitch/Order/OrderEntity.res b/src/screens/HyperSwitch/Order/OrderEntity.res index 16156a490..e73bfc4dc 100644 --- a/src/screens/HyperSwitch/Order/OrderEntity.res +++ b/src/screens/HyperSwitch/Order/OrderEntity.res @@ -13,7 +13,7 @@ let getRefundCell = (refunds: refunds, refundsColType: refundsColType): Table.ce | Amount => CustomCell( Belt.Float.toString} currency={refunds.currency} + amount={(refunds.amount /. 100.0)->Float.toString} currency={refunds.currency} />, "", ) @@ -50,7 +50,7 @@ let getAttemptCell = (attempt: attempts, attemptColType: attemptColType): Table. | Amount => CustomCell( Belt.Float.toString} currency={attempt.currency} + amount={(attempt.amount /. 100.0)->Float.toString} currency={attempt.currency} />, "", ) @@ -97,7 +97,7 @@ let getFrmCell = (orderDetais: order, frmColType: frmColType): Table.cell => { | Amount => CustomCell( Belt.Float.toString} currency={orderDetais.currency} + amount={(orderDetais.amount /. 100.0)->Float.toString} currency={orderDetais.currency} />, "", ) @@ -615,7 +615,7 @@ let getCellForSummary = (order, summaryColType, _): Table.cell => { | NetAmount => CustomCell( Belt.Float.toString} currency={order.currency} + amount={(order.net_amount /. 100.0)->Float.toString} currency={order.currency} />, "", ) @@ -625,7 +625,7 @@ let getCellForSummary = (order, summaryColType, _): Table.cell => { | AmountReceived => CustomCell( Belt.Float.toString} currency={order.currency} + amount={(order.amount_received /. 100.0)->Float.toString} currency={order.currency} />, "", ) @@ -727,9 +727,7 @@ let getCell = (order, colType: colType): Table.cell => { }) | Amount => CustomCell( - Belt.Float.toString} currency={order.currency} - />, + Float.toString} currency={order.currency} />, "", ) | AmountCapturable => Currency(order.amount_capturable /. 100.0, order.currency) diff --git a/src/screens/HyperSwitch/Order/OrderRefundForm.res b/src/screens/HyperSwitch/Order/OrderRefundForm.res index 841542dd6..86f333945 100644 --- a/src/screens/HyperSwitch/Order/OrderRefundForm.res +++ b/src/screens/HyperSwitch/Order/OrderRefundForm.res @@ -66,7 +66,7 @@ let make = ( let valuesDict = values ->Js.Json.decodeObject - ->Belt.Option.map(Dict.toArray) + ->Option.map(Dict.toArray) ->Option.getOr([]) ->Belt.Array.keepMap(entry => { let (key, value) = entry @@ -94,7 +94,7 @@ let make = ( } else { "00" } - let receivedValue = amoutAvailableToRefund->Js.Math.floor_float->Belt.Float.toString + let receivedValue = amoutAvailableToRefund->Js.Math.floor_float->Float.toString let formatted_amount = `${receivedValue}.${decimal}` Dict.set( errors, diff --git a/src/screens/HyperSwitch/Order/Orders.res b/src/screens/HyperSwitch/Order/Orders.res index a4a8c198d..59c788d69 100644 --- a/src/screens/HyperSwitch/Order/Orders.res +++ b/src/screens/HyperSwitch/Order/Orders.res @@ -34,7 +34,7 @@ let make = (~previewOnly=false) => { | Some(dict) => let filters = Dict.make() - filters->Dict.set("offset", offset->Belt.Int.toFloat->Js.Json.number) + filters->Dict.set("offset", offset->Int.toFloat->Js.Json.number) if !(searchText->isEmptyString) { filters->Dict.set("payment_id", searchText->String.trim->Js.Json.string) } diff --git a/src/screens/HyperSwitch/Order/ShowOrder.res b/src/screens/HyperSwitch/Order/ShowOrder.res index 8d3e570ba..4d252d30b 100644 --- a/src/screens/HyperSwitch/Order/ShowOrder.res +++ b/src/screens/HyperSwitch/Order/ShowOrder.res @@ -32,7 +32,7 @@ module OrderInfo = {
    - {`${(data.amount /. 100.00)->Belt.Float.toString} ${data.currency} `->React.string} + {`${(data.amount /. 100.00)->Float.toString} ${data.currency} `->React.string}
    { | Some(dict) => let filters = Dict.make() - filters->Dict.set("offset", offset->Belt.Int.toFloat->Js.Json.number) + filters->Dict.set("offset", offset->Int.toFloat->Js.Json.number) if !(searchText->isEmptyString) { filters->Dict.set("payment_id", searchText->String.trim->Js.Json.string) filters->Dict.set("refund_id", searchText->String.trim->Js.Json.string) diff --git a/src/screens/HyperSwitch/Refunds/RefundEntity.res b/src/screens/HyperSwitch/Refunds/RefundEntity.res index deded3984..73099bc12 100644 --- a/src/screens/HyperSwitch/Refunds/RefundEntity.res +++ b/src/screens/HyperSwitch/Refunds/RefundEntity.res @@ -114,7 +114,7 @@ let getCell = (refundData, colType): Table.cell => { | Amount => CustomCell( Belt.Float.toString} currency={refundData.currency} + amount={(refundData.amount /. 100.0)->Float.toString} currency={refundData.currency} />, "", ) diff --git a/src/screens/HyperSwitch/Refunds/ShowRefund.res b/src/screens/HyperSwitch/Refunds/ShowRefund.res index 2c9569f54..3c1d1d158 100644 --- a/src/screens/HyperSwitch/Refunds/ShowRefund.res +++ b/src/screens/HyperSwitch/Refunds/ShowRefund.res @@ -19,7 +19,7 @@ module RefundInfo = { customCssClass={`border border-jp-gray-940 border-opacity-75 dark:border-jp-gray-960 ${bgColor} rounded-md p-5`}>
    - {`${(data.amount /. 100.00)->Belt.Float.toString} ${data.currency} `->React.string} + {`${(data.amount /. 100.00)->Float.toString} ${data.currency} `->React.string}
    {getStatus(data)}
    @@ -29,7 +29,7 @@ module RefundInfo = { {detailsFields ->Array.mapWithIndex((colType, i) => { if !(excludeColKeys->Array.includes(colType)) { -
    +
    Array.mapWithIndex((ruleGateway, index) => {
    {ruleGateway.gateway_name->getGatewayName->React.string} {if ruleGateway.distribution !== 100 { diff --git a/src/screens/HyperSwitch/Routing/RoutingStack.res b/src/screens/HyperSwitch/Routing/RoutingStack.res index a470e883c..d92ec0267 100644 --- a/src/screens/HyperSwitch/Routing/RoutingStack.res +++ b/src/screens/HyperSwitch/Routing/RoutingStack.res @@ -3,7 +3,7 @@ open APIUtils let make = (~remainingPath, ~previewOnly=false) => { let fetchDetails = useGetMethod() let url = RescriptReactRouter.useUrl() - let pathVar = url.path->Belt.List.toArray->Array.joinWith("/") + let pathVar = url.path->List.toArray->Array.joinWith("/") let (records, setRecords) = React.useState(_ => []) let (activeRoutingIds, setActiveRoutingIds) = React.useState(_ => []) diff --git a/src/screens/HyperSwitch/Routing/RoutingUtils.res b/src/screens/HyperSwitch/Routing/RoutingUtils.res index 0a7e288b8..5e7cbd624 100644 --- a/src/screens/HyperSwitch/Routing/RoutingUtils.res +++ b/src/screens/HyperSwitch/Routing/RoutingUtils.res @@ -10,9 +10,9 @@ let getCurrentUTCTime = () => { let currentDate = Js.Date.now()->Js.Date.fromFloat let month = currentDate->Js.Date.getUTCMonth +. 1.0 let day = currentDate->Js.Date.getUTCDate - let currMonth = month < 10.0 ? `0${month->Belt.Float.toString}` : month->Belt.Float.toString - let currDay = day < 10.0 ? `0${day->Belt.Float.toString}` : day->Belt.Float.toString - let currYear = currentDate->Js.Date.getUTCFullYear->Belt.Float.toString + let currMonth = month < 10.0 ? `0${month->Float.toString}` : month->Float.toString + let currDay = day < 10.0 ? `0${day->Float.toString}` : day->Float.toString + let currYear = currentDate->Js.Date.getUTCFullYear->Float.toString `${currYear}-${currMonth}-${currDay}` } @@ -137,10 +137,10 @@ let getGatewayTypes = (arr: array) => { // Advanced let valueTypeMapper = dict => { - let value = switch Dict.get(dict, "value")->Belt.Option.map(Js.Json.classify) { + let value = switch Dict.get(dict, "value")->Option.map(Js.Json.classify) { | Some(JSONArray(arr)) => StringArray(arr->getStrArrayFromJsonArray) | Some(JSONString(st)) => String(st) - | Some(JSONNumber(num)) => Int(num->Belt.Float.toInt) + | Some(JSONNumber(num)) => Int(num->Float.toInt) | _ => String("") } value diff --git a/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res b/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res index 69b8bdaff..d00cba098 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res @@ -203,11 +203,11 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { name=key onChange={ev => { let val = ReactEvent.Form.target(ev)["value"] - updatePercentage(item, val->Belt.Int.fromString->Option.getOr(0)) + updatePercentage(item, val->Int.fromString->Option.getOr(0)) }} value={item ->AdvancedRoutingUtils.getSplitFromConnectorSelectionData - ->Belt.Int.toString} + ->Int.toString} type_="text" inputMode="text" /> diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res index b2f6f4603..d0add3ee3 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res @@ -439,7 +439,7 @@ module MakeRuleField = { key={i->string_of_int} onClick={_ => onCrossClick(i)} isFirst={i === 0} - id={`${ruleJsonPath}[${i->Belt.Int.toString}]`} + id={`${ruleJsonPath}[${i->Int.toString}]`} isExpanded wasm isFrom3ds diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res index 6d437939b..db8df315a 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUtils.res @@ -4,9 +4,9 @@ let getCurrentDetailedUTCTime = () => { let getCurrentShortUTCTime = () => { let currentDate = Js.Date.now()->Js.Date.fromFloat - let currMonth = currentDate->Js.Date.getUTCMonth->Belt.Float.toString - let currDay = currentDate->Js.Date.getUTCDate->Belt.Float.toString - let currYear = currentDate->Js.Date.getUTCFullYear->Belt.Float.toString + let currMonth = currentDate->Js.Date.getUTCMonth->Float.toString + let currDay = currentDate->Js.Date.getUTCDate->Float.toString + let currYear = currentDate->Js.Date.getUTCFullYear->Float.toString `${currYear}-${currMonth}-${currDay}` } diff --git a/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res b/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res index e5b30b504..e24f0a6fa 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res +++ b/src/screens/HyperSwitch/RoutingRevamp/Previewers/RulePreviewer.res @@ -12,7 +12,7 @@ module GatewayView = { | VolumeObject(obj) => (obj.connector.connector, Some(obj.split)) }
    {connectorStr->React.string} Option.isSome}> @@ -52,9 +52,7 @@ let make = (~ruleInfo: algorithmData, ~isFrom3ds=false, ~isFromSurcharge=false) } else { surchargePercent } -
    +
    @@ -78,7 +76,7 @@ let make = (~ruleInfo: algorithmData, ~isFrom3ds=false, ~isFromSurcharge=false) let value = switch statement.value.value->Js.Json.classify { | JSONArray(arr) => arr->Array.joinWithUnsafe(", ") | JSONString(str) => str - | JSONNumber(num) => num->Belt.Float.toString + | JSONNumber(num) => num->Float.toString | JSONObject(obj) => obj->LogicUtils.getString("value", "") | _ => "" } @@ -89,8 +87,7 @@ let make = (~ruleInfo: algorithmData, ~isFrom3ds=false, ~isFromSurcharge=false) } let metadataKey = metadataDict->getOptionString("key") -
    +
    - {`${surchargeType.surcharge.\"type"} -> ${surchargeTypeValue->Belt.Float.toString} | Tax on Surcharge -> ${surchargeType.tax_on_surcharge.percentage + {`${surchargeType.surcharge.\"type"} -> ${surchargeTypeValue->Float.toString} | Tax on Surcharge -> ${surchargeType.tax_on_surcharge.percentage ->Option.getOr(0.0) - ->Belt.Float.toString}` + ->Float.toString}` ->LogicUtils.capitalizeString ->React.string}
    diff --git a/src/screens/HyperSwitch/SDKPayment/WebSDK.res b/src/screens/HyperSwitch/SDKPayment/WebSDK.res index 3a765b48d..5c48b1df9 100644 --- a/src/screens/HyperSwitch/SDKPayment/WebSDK.res +++ b/src/screens/HyperSwitch/SDKPayment/WebSDK.res @@ -228,7 +228,7 @@ module CheckoutForm = { | WIDGET => }}