diff --git a/src/components/AdvancedSearchComponent.res b/src/components/AdvancedSearchComponent.res index 8c04ec049..ffdad215d 100644 --- a/src/components/AdvancedSearchComponent.res +++ b/src/components/AdvancedSearchComponent.res @@ -30,14 +30,14 @@ let make = ( fetchApi(url, ~bodyStr=Js.Json.stringify(values), ~method_=Fetch.Post, ()) ->then(Fetch.Response.json) ->then(json => { - let jsonData = json->Js.Json.decodeObject->Belt.Option.flatMap(dict => dict->Dict.get("rows")) + let jsonData = json->Js.Json.decodeObject->Option.flatMap(dict => dict->Dict.get("rows")) let newData = switch jsonData { | Some(actualJson) => actualJson->getObjects->Array.map(obj => obj->Js.Nullable.return) | None => [] } let summaryData = - json->Js.Json.decodeObject->Belt.Option.flatMap(dict => dict->Dict.get("summary")) + json->Js.Json.decodeObject->Option.flatMap(dict => dict->Dict.get("summary")) let summary = switch summaryData { | Some(x) => x->getSummary diff --git a/src/components/AdvancedSearchModal.res b/src/components/AdvancedSearchModal.res index c82079d6a..e1c6c6d38 100644 --- a/src/components/AdvancedSearchModal.res +++ b/src/components/AdvancedSearchModal.res @@ -49,8 +49,7 @@ module AdvanceSearch = { let statusStr = getString(jsonDict, "status", "FAILURE") if statusStr === "SUCCESS" { - let payloadDict = - jsonDict->Dict.get(detailsKey)->Belt.Option.flatMap(Js.Json.decodeObject) + let payloadDict = jsonDict->Dict.get(detailsKey)->Option.flatMap(Js.Json.decodeObject) switch payloadDict { | Some(dict) => { @@ -90,12 +89,12 @@ module AdvanceSearch = { } let errors = Dict.make() requiredSearchFieldsList->Array.forEach(key => { - if Dict.get(valuesDict, key)->Js.Option.isNone { + if Dict.get(valuesDict, key)->Option.isNone { Dict.set(errors, key, "Required"->Js.Json.string) } }) let isSubmitEnabled = optionalSearchFieldsList->Array.some(key => { - Dict.get(valuesDict, key)->Js.Option.isSome + Dict.get(valuesDict, key)->Option.isSome }) if !isSubmitEnabled { diff --git a/src/components/AuthWrapperUtils.res b/src/components/AuthWrapperUtils.res index 1124c89c2..7143a03b4 100644 --- a/src/components/AuthWrapperUtils.res +++ b/src/components/AuthWrapperUtils.res @@ -17,9 +17,9 @@ let useLocalStorageToken = tokenType => { let lcToken = LocalStorage.useStorageValue("login")->getValidToken let switchToken = LocalStorage.useStorageValue("switchToken")->getValidToken - if switchToken->Js.Option.isSome && switchToken !== Some("__failed") && tokenType !== Original { + if switchToken->Option.isSome && switchToken !== Some("__failed") && tokenType !== Original { switchToken - } else if lcToken->Js.Option.isSome && lcToken !== Some("__failed") && tokenType !== SwitchOnly { + } else if lcToken->Option.isSome && lcToken !== Some("__failed") && tokenType !== SwitchOnly { lcToken } else { None diff --git a/src/components/Button.res b/src/components/Button.res index 59b89f0a2..eca8476c4 100644 --- a/src/components/Button.res +++ b/src/components/Button.res @@ -382,7 +382,7 @@ let make = ( } let buttonSize: buttonSize = - buttonSize->Belt.Option.getWithDefault( + buttonSize->Option.getWithDefault( MatchMedia.useMatchMedia("(max-width: 800px)") ? Small : Medium, ) @@ -419,7 +419,7 @@ let make = ( } } - let heightClass = customHeightClass->Belt.Option.getWithDefault({ + let heightClass = customHeightClass->Option.getWithDefault({ switch buttonSize { | XSmall => "h-fit" | Small => "h-fit" @@ -433,7 +433,7 @@ let make = ( | _ => "cursor-pointer" } - let paddingClass = customPaddingClass->Belt.Option.getWithDefault( + let paddingClass = customPaddingClass->Option.getWithDefault( switch buttonSize { | XSmall => "py-3 px-4" | Small => @@ -447,7 +447,7 @@ let make = ( }, ) - let textPaddingClass = customTextPaddingClass->Belt.Option.getWithDefault( + let textPaddingClass = customTextPaddingClass->Option.getWithDefault( switch buttonSize { | XSmall => "px-1" | Small => "px-1" @@ -456,7 +456,7 @@ let make = ( }, ) - let textSize = customTextSize->Belt.Option.getWithDefault( + let textSize = customTextSize->Option.getWithDefault( switch buttonSize { | XSmall => "text-fs-11" | Small => "text-fs-13" @@ -468,7 +468,7 @@ let make = ( let ellipsisClass = ellipsisOnly ? "truncate" : "" let ellipsisParentClass = ellipsisOnly ? "max-w-[250px] md:max-w-xs" : "" - let iconSize = customIconSize->Belt.Option.getWithDefault( + let iconSize = customIconSize->Option.getWithDefault( switch buttonSize { | XSmall => 12 | Small => 14 @@ -493,7 +493,7 @@ let make = ( | Large => "" } - let iconMargin = customIconMargin->Belt.Option.getWithDefault( + let iconMargin = customIconMargin->Option.getWithDefault( switch buttonSize { | XSmall | Small => "ml-1" @@ -670,7 +670,7 @@ let make = ( | _ => "text-sm font-medium leading-5" } - let textId = text->Belt.Option.getWithDefault("") + let textId = text->Option.getWithDefault("") let iconId = switch leftIcon { | FontAwesome(iconName) | Euler(iconName) => iconName @@ -692,9 +692,9 @@ let make = ( let relativeClass = isRelative ? "relative" : "" let conditionalButtonStyles = `${allowButtonTextMinWidth ? "min-w-min" - : ""} ${customBackColor->Belt.Option.getWithDefault( + : ""} ${customBackColor->Option.getWithDefault( backColor, - )} ${customRoundedClass->Belt.Option.getWithDefault(roundedClass)}` + )} ${customRoundedClass->Option.getWithDefault(roundedClass)}` let newThemeGap = "" diff --git a/src/components/Calendar.res b/src/components/Calendar.res index a08bfd4e7..0200ee39d 100644 --- a/src/components/Calendar.res +++ b/src/components/Calendar.res @@ -21,7 +21,7 @@ module TableRow = { switch obj { | Some(a) => { let day = String.split(a, "-") - React.string(day[2]->Belt.Option.getWithDefault("")) + React.string(day[2]->Option.getWithDefault("")) } | None => React.string("") @@ -149,11 +149,11 @@ module TableRow = { } let getDate = date => { let datevalue = Js.Date.makeWithYMD( - ~year=Js.Float.fromString(date[0]->Belt.Option.getWithDefault("")), + ~year=Js.Float.fromString(date[0]->Option.getWithDefault("")), ~month=Js.Float.fromString( - String.make(Js.Float.fromString(date[1]->Belt.Option.getWithDefault("")) -. 1.0), + String.make(Js.Float.fromString(date[1]->Option.getWithDefault("")) -. 1.0), ), - ~date=Js.Float.fromString(date[2]->Belt.Option.getWithDefault("")), + ~date=Js.Float.fromString(date[2]->Option.getWithDefault("")), (), ) datevalue diff --git a/src/components/CalendarList.res b/src/components/CalendarList.res index b6b81ef03..4ab53c226 100644 --- a/src/components/CalendarList.res +++ b/src/components/CalendarList.res @@ -30,7 +30,7 @@ let make = ( // check whether month and date has value let getMonthFromFloat = value => { let valueInt = value->Belt.Float.toInt - months[valueInt]->Belt.Option.getWithDefault(Jan) + months[valueInt]->Option.getWithDefault(Jan) } let getMonthInFloat = mon => { Array.indexOf(months, mon)->Belt.Float.fromInt diff --git a/src/components/CollapsableTableRow.res b/src/components/CollapsableTableRow.res index 00dd8d410..c5e499392 100644 --- a/src/components/CollapsableTableRow.res +++ b/src/components/CollapsableTableRow.res @@ -81,7 +81,7 @@ let make = (
{item ->Array.mapWithIndex((obj, index) => { - let heading = headingArray->Belt.Array.get(index)->Belt.Option.getWithDefault("") + let heading = headingArray->Belt.Array.get(index)->Option.getWithDefault("") string_of_int}>
diff --git a/src/components/CustomCharts/FunnelChart.res b/src/components/CustomCharts/FunnelChart.res index 8f5c0287f..f075eb3e9 100644 --- a/src/components/CustomCharts/FunnelChart.res +++ b/src/components/CustomCharts/FunnelChart.res @@ -13,10 +13,7 @@ let make = ( isMobileView ? (0.16, "w-full", "flex-col") : (size, "w-1/2", "flex-row") }, [isMobileView]) let funnelData = - data - ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.null) - ->LogicUtils.getDictFromJsonObject + data->Belt.Array.get(0)->Option.getWithDefault(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 @@ -92,7 +89,7 @@ let make = ( let nextWidthRatio = switch widths->Belt.Array.get(i->Belt.Float.toInt + 1) { | Some(width) => width | None => - widths->Belt.Array.get(i->Belt.Float.toInt)->Belt.Option.getWithDefault(size *. 70.) + widths->Belt.Array.get(i->Belt.Float.toInt)->Option.getWithDefault(size *. 70.) } fixedWidth := currentWidthRatio *. fixedWidth.contents diff --git a/src/components/CustomCharts/HighchartHorizontalBarChart.res b/src/components/CustomCharts/HighchartHorizontalBarChart.res index e38b1cf71..fe65d4175 100644 --- a/src/components/CustomCharts/HighchartHorizontalBarChart.res +++ b/src/components/CustomCharts/HighchartHorizontalBarChart.res @@ -44,7 +44,7 @@ let xLabelFormatter: Js_OO.Callback.arity1 string> = { | Some(series) => { let options = series.options switch options { - | Some(options) => options.data->Belt.Array.get(index)->Belt.Option.getWithDefault(0) + | Some(options) => options.data->Belt.Array.get(index)->Option.getWithDefault(0) | None => 0 } } @@ -74,7 +74,7 @@ let make = ( selectedMetrics.metric_name_db, ) }, (rawData, groupKey, selectedMetrics.metric_name_db)) - let titleKey = titleKey->Belt.Option.getWithDefault(groupKey) + let titleKey = titleKey->Option.getWithDefault(groupKey) let barOption: Js.Json.t = React.useMemo2(() => { let colors = { diff --git a/src/components/CustomCharts/HighchartPieChart.res b/src/components/CustomCharts/HighchartPieChart.res index 9eb369681..214f6b092 100644 --- a/src/components/CustomCharts/HighchartPieChart.res +++ b/src/components/CustomCharts/HighchartPieChart.res @@ -43,7 +43,7 @@ let make = ( let color = theme === Dark ? "white" : "black" let borderColor = theme === Dark ? "black" : "white" let opacity = theme === Dark ? "0.5" : "1" - let titleKey = titleKey->Belt.Option.getWithDefault(groupKey) + let titleKey = titleKey->Option.getWithDefault(groupKey) let barOption: Js.Json.t = React.useMemo2(() => { let colors = { diff --git a/src/components/CustomCharts/HighchartTimeSeriesChart.res b/src/components/CustomCharts/HighchartTimeSeriesChart.res index e3d47e37a..c4965629e 100644 --- a/src/components/CustomCharts/HighchartTimeSeriesChart.res +++ b/src/components/CustomCharts/HighchartTimeSeriesChart.res @@ -169,12 +169,12 @@ module LineChart1D = { let (x, y, secondryMetrics) = axes xAxisMapInfo->LineChartUtils.appendToDictValue( ["run_date", "run_month", "run_week"]->Array.includes(groupKey) - ? x->Js.Json.decodeString->Belt.Option.getWithDefault("") + ? x->Js.Json.decodeString->Option.getWithDefault("") : x->Js.Json.stringify, ( item.name, { - item.color->Belt.Option.getWithDefault("#000000") + item.color->Option.getWithDefault("#000000") }, y, secondryMetrics, @@ -299,7 +299,7 @@ module LineChart1D = { } }) ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") let color = chartData ->Belt.Array.keepMap(item => { @@ -309,7 +309,7 @@ module LineChart1D = { } }) ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(`${colorOrig}`) + ->Option.getWithDefault(`${colorOrig}`) let transformValue = num => { num->HSAnalyticsUtils.setPrecision() @@ -611,12 +611,12 @@ module LineChart1D = { let upper_bound = upper_bound <= threshold - ? threshold +. stepUpFromThreshold->Belt.Option.getWithDefault(0.) + ? threshold +. stepUpFromThreshold->Option.getWithDefault(0.) : upper_bound let lower_bound = lower_bound >= threshold - ? threshold -. stepUpFromThreshold->Belt.Option.getWithDefault(0.) + ? threshold -. stepUpFromThreshold->Option.getWithDefault(0.) : lower_bound let positions = NumericUtils.pretty([lower_bound, upper_bound], 5) @@ -661,8 +661,7 @@ module LineChart1D = { let labelsValue = { "formatter": Some( @this - param => - formatLabels(selectedMetrics, param.value->Belt.Option.getWithDefault(0.0)), + param => formatLabels(selectedMetrics, param.value->Option.getWithDefault(0.0)), ), "enabled": true, "style": { @@ -778,7 +777,7 @@ module LegendItem = {
selectedRow->Belt.Option.isSome ? setSelectedRow(_ => None) : ()} + onDoubleClick={_ => selectedRow->Option.isSome ? setSelectedRow(_ => None) : ()} onClick={_ => setSelectedRow(prev => { switch prev { @@ -837,7 +836,7 @@ module RenderMultiDimensionalChart = { ), legendIndex: i.legendIndex, name: i.name, - color: i.color->Belt.Option.getWithDefault("#000000"), + color: i.color->Option.getWithDefault("#000000"), }) ) ->ignore @@ -895,8 +894,8 @@ module LineChart2D = { ) => { let (groupBy1, groupBy2) = switch groupBy { | Some(value) => ( - value->Belt.Array.get(0)->Belt.Option.getWithDefault(""), - value->Belt.Array.get(1)->Belt.Option.getWithDefault(""), + value->Belt.Array.get(0)->Option.getWithDefault(""), + value->Belt.Array.get(1)->Option.getWithDefault(""), ) | None => ("", "") } @@ -940,9 +939,9 @@ module LineChart3D = { ) => { let (groupBy1, groupBy2, groupby3) = switch groupBy { | Some(value) => ( - value->Belt.Array.get(0)->Belt.Option.getWithDefault(""), - value->Belt.Array.get(1)->Belt.Option.getWithDefault(""), - value->Belt.Array.get(2)->Belt.Option.getWithDefault(""), + value->Belt.Array.get(0)->Option.getWithDefault(""), + value->Belt.Array.get(1)->Option.getWithDefault(""), + value->Belt.Array.get(2)->Option.getWithDefault(""), ) | None => ("", "", "") } diff --git a/src/components/CustomCharts/LineChartUtils.res b/src/components/CustomCharts/LineChartUtils.res index dc4e46d67..9d6d5d89d 100644 --- a/src/components/CustomCharts/LineChartUtils.res +++ b/src/components/CustomCharts/LineChartUtils.res @@ -111,9 +111,8 @@ let reduceOpacity = str => { switch match { | Some(val) => { - let opacity = - val->Belt.Array.get(1)->Belt.Option.flatMap(a => a)->Belt.Option.getWithDefault("0") - let newOpacity = opacity->Belt.Float.fromString->Belt.Option.getWithDefault(0.0) /. 10.0 + let opacity = val->Belt.Array.get(1)->Option.flatMap(a => a)->Option.getWithDefault("0") + let newOpacity = opacity->Belt.Float.fromString->Option.getWithDefault(0.0) /. 10.0 str->String.replace(opacity, newOpacity->Belt.Float.toString) } | None => "0" @@ -131,7 +130,7 @@ let removeDuplicates = (arr: array>) => { arr->Array.forEach(item => { let value = item.name - if uniqueItemsMap->Dict.get(value)->Belt.Option.isNone { + if uniqueItemsMap->Dict.get(value)->Option.isNone { uniqueItemsMap->Dict.set(value, item) } }) @@ -283,7 +282,7 @@ let timeSeriesDataMaker = ( let groupByName = dict->getString( groupKey, - Dict.get(dict, groupKey)->Belt.Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify, + Dict.get(dict, groupKey)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify, ) let xAxisDataPoint = dict->getString(xAxis, "")->String.split(" ")->Array.joinWith("T") ++ "Z" // right now it is time string let yAxisDataPoint = dict->getFloat(yAxis, 0.) @@ -321,7 +320,7 @@ let timeSeriesDataMaker = ( let trafficValue = value *. 100. /. - groupedByTime->Dict.get(key->Belt.Float.toString)->Belt.Option.getWithDefault(1.) + groupedByTime->Dict.get(key->Belt.Float.toString)->Option.getWithDefault(1.) (key, trafficValue, secondryMetrix) }) ->Js.Array2.sortInPlaceWith(chartDataSortBasedOnTime) @@ -330,17 +329,17 @@ let timeSeriesDataMaker = ( let color = switch colors->Array.find(item => item.name == key) { | Some(val) => val.color | None => - legendColor[mod(index, legendColor->Array.length)]->Belt.Option.getWithDefault(defaultColor) + legendColor[mod(index, legendColor->Array.length)]->Option.getWithDefault(defaultColor) } let fillColor = switch legendColorGradients(topGradient, bottomGradient)->Array.find(item => - item.color->Belt.Option.getWithDefault("#000000") == color + item.color->Option.getWithDefault("#000000") == color ) { | Some(val) => val | None => legendColorGradients(topGradient, bottomGradient)[ mod(index, legendColor->Array.length) - ]->Belt.Option.getWithDefault(defaultLegendColorGradients(topGradient, bottomGradient)) + ]->Option.getWithDefault(defaultLegendColorGradients(topGradient, bottomGradient)) } let value: timeSeriesDictWithSecondryMetrics = { color: Some(color), @@ -367,7 +366,7 @@ let getLegendDataForCurrentMetrix = ( getString( dict, activeTab, - Dict.get(dict, activeTab)->Belt.Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify, + Dict.get(dict, activeTab)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify, ) }) timeSeriesData->Belt.Array.forEach(item => { @@ -377,9 +376,7 @@ let getLegendDataForCurrentMetrix = ( getString( dict, activeTab, - Dict.get(dict, activeTab) - ->Belt.Option.getWithDefault(""->Js.Json.string) - ->Js.Json.stringify, + Dict.get(dict, activeTab)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify, ), time_overall_statsAtTime, ) @@ -397,7 +394,7 @@ let getLegendDataForCurrentMetrix = ( ->Array.map(item => { let (_, value) = item let (_, currentVal) = - value->Belt.Array.get(value->Array.length - 1)->Belt.Option.getWithDefault(("", 0.)) + value->Belt.Array.get(value->Array.length - 1)->Option.getWithDefault(("", 0.)) currentVal }) ->AnalyticsUtils.sumOfArrFloat @@ -409,7 +406,7 @@ let getLegendDataForCurrentMetrix = ( let sortedValueBasedOnTime = value->Js.Array2.sortInPlaceWith(sortBasedOnTimeLegend) let arrLen = sortedValueBasedOnTime->Array.length let (_, currentVal) = - sortedValueBasedOnTime->Belt.Array.get(arrLen - 1)->Belt.Option.getWithDefault(("", 1.0)) + sortedValueBasedOnTime->Belt.Array.get(arrLen - 1)->Option.getWithDefault(("", 1.0)) let overall = sortedValueBasedOnTime @@ -447,18 +444,18 @@ let getLegendDataForCurrentMetrix = ( let (metricsName, value) = item let sortedValueBasedOnTime = value->Js.Array2.sortInPlaceWith(sortBasedOnTimeLegend) let arrLen = sortedValueBasedOnTime->Array.length - let (_, currentVal) = sortedValueBasedOnTime[arrLen - 1]->Belt.Option.getWithDefault(("", 0.)) + let (_, currentVal) = sortedValueBasedOnTime[arrLen - 1]->Option.getWithDefault(("", 0.)) // the avg stat won't work correct for Sr case have to find another way or avoid using the avg for Sr let overall = if metrixType === Traffic { - (currentOverall->Dict.get(metricsName)->Belt.Option.getWithDefault(0.) *. + (currentOverall->Dict.get(metricsName)->Option.getWithDefault(0.) *. 100. /. Js.Math.max_float(totalOverall, 1.)) ->Js.Float.toFixedWithPrecision(~digits=2) ->removeTrailingZero ->Belt.Float.fromString - ->Belt.Option.getWithDefault(0.) + ->Option.getWithDefault(0.) } else { - currentOverall->Dict.get(metricsName)->Belt.Option.getWithDefault(0.) + currentOverall->Dict.get(metricsName)->Option.getWithDefault(0.) } let currentVal = if metrixType === Traffic { currentVal *. 100. /. currentValueOverallSum @@ -491,7 +488,7 @@ let barChartDataMaker = (~yAxis: string, ~rawData: array, ~activeTab: let selectedSegmentVal = getString( dict, activeTab, - Dict.get(dict, activeTab)->Belt.Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify, + Dict.get(dict, activeTab)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify, ) // groupby/ selected segment let stats = getFloat(dict, yAxis, 0.) // overall metrics @@ -593,7 +590,7 @@ let getTooltipHTML = (metrics, data, onCursorName) => { | Some(secondryMetrics) => `${formatStatsAccToMetrix( secondryMetrics.metric_type, - secondry_metrix->Belt.Option.getWithDefault(0.), + secondry_metrix->Option.getWithDefault(0.), )}` | None => "" } @@ -619,10 +616,10 @@ let tooltipFormatter = ( let dataArr = if ["run_date", "run_month", "run_week"]->Array.includes(groupKey) { let x = points->getString("name", "") - xAxisMapInfo->Dict.get(x)->Belt.Option.getWithDefault([]) + xAxisMapInfo->Dict.get(x)->Option.getWithDefault([]) } else { let x = points->getFloat("x", 0.) - xAxisMapInfo->Dict.get(x->Js.Float.toString)->Belt.Option.getWithDefault([]) + xAxisMapInfo->Dict.get(x->Js.Float.toString)->Option.getWithDefault([]) } let onCursorName = series->getString("name", "") diff --git a/src/components/CustomExpandableTable.res b/src/components/CustomExpandableTable.res index 6854aa1e6..67e1b39fa 100644 --- a/src/components/CustomExpandableTable.res +++ b/src/components/CustomExpandableTable.res @@ -23,7 +23,7 @@ let make = ( let isMobileView = MatchMedia.useMobileChecker() - let filterPresent = heading->Array.find(head => head.showFilter)->Js.Option.isSome + let filterPresent = heading->Array.find(head => head.showFilter)->Option.isSome let highlightEnabledFieldsArray = heading->Array.reduceWithIndex([], (acc, item, index) => { if item.highlightCellOnHover { let _ = Array.push(acc, index) @@ -147,13 +147,13 @@ let make = ( {if item.showFilter { let (options, selected) = filterObj - ->Belt.Option.flatMap(obj => + ->Option.flatMap(obj => switch obj[i] { | Some(ele) => (ele.options, ele.selected) | None => ([], []) }->Some ) - ->Belt.Option.getWithDefault(([], [])) + ->Option.getWithDefault(([], [])) if options->Array.length > 1 { let filterInput: ReactFinalForm.fieldRenderPropsInput = { diff --git a/src/components/DatePicker.res b/src/components/DatePicker.res index 46d360840..2e909cc0a 100644 --- a/src/components/DatePicker.res +++ b/src/components/DatePicker.res @@ -32,9 +32,9 @@ let make = ( let (date, setDate) = React.useState(_ => { if selectedDate !== "" { let date = String.split(selectedDate, "-") - let dateDay = date->Belt.Array.get(2)->Belt.Option.getWithDefault("1") - let dateMonth = date->Belt.Array.get(1)->Belt.Option.getWithDefault("1") - let dateYear = date->Belt.Array.get(0)->Belt.Option.getWithDefault("1970") + let dateDay = date->Belt.Array.get(2)->Option.getWithDefault("1") + let dateMonth = date->Belt.Array.get(1)->Option.getWithDefault("1") + let dateYear = date->Belt.Array.get(0)->Option.getWithDefault("1970") let timeSplit = switch input.value->Js.Json.decodeString { @@ -44,11 +44,9 @@ let make = ( ->DateRangePicker.getTimeStringForValue(isoStringToCustomTimeZone) ->String.split(":") - let timeHour = timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault(currentDateHourFormat) - let timeMinute = - timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault(currentDateMinuteFormat) - let timeSecond = - timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault(currentDateSecondsFormat) + let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault(currentDateHourFormat) + let timeMinute = timeSplit->Belt.Array.get(1)->Option.getWithDefault(currentDateMinuteFormat) + let timeSecond = timeSplit->Belt.Array.get(2)->Option.getWithDefault(currentDateSecondsFormat) let dateTimeCheck = customTimezoneToISOString( dateYear, dateMonth, @@ -76,9 +74,9 @@ let make = ( setSelectedDate(_ => str) let currentDateSplit = String.split(str, "-") - let currentDateDay = currentDateSplit->Belt.Array.get(2)->Belt.Option.getWithDefault("1") - let currentDateYear = currentDateSplit->Belt.Array.get(0)->Belt.Option.getWithDefault("1970") - let currentDateMonth = currentDateSplit->Belt.Array.get(1)->Belt.Option.getWithDefault("1") + let currentDateDay = currentDateSplit->Belt.Array.get(2)->Option.getWithDefault("1") + let currentDateYear = currentDateSplit->Belt.Array.get(0)->Option.getWithDefault("1970") + let currentDateMonth = currentDateSplit->Belt.Array.get(1)->Option.getWithDefault("1") let currentDateTimeCheck = customTimezoneToISOString( currentDateYear, @@ -132,12 +130,10 @@ let make = ( ? `${currentDateHourFormat}:${currentDateMinuteFormat}${showSeconds ? ":" ++ currentDateSecondsFormat : ""}` - : splitTime->Belt.Array.get(0)->Belt.Option.getWithDefault("NA") ++ + : splitTime->Belt.Array.get(0)->Option.getWithDefault("NA") ++ ":" ++ - splitTime->Belt.Array.get(1)->Belt.Option.getWithDefault("NA") ++ ( - showSeconds - ? ":" ++ splitTime->Belt.Array.get(2)->Belt.Option.getWithDefault("NA") - : "" + splitTime->Belt.Array.get(1)->Option.getWithDefault("NA") ++ ( + showSeconds ? ":" ++ splitTime->Belt.Array.get(2)->Option.getWithDefault("NA") : "" )}` } startDateStr @@ -158,7 +154,7 @@ let make = ( | Some(icon) => icon | None => FontAwesome("calendar") } - let fullLengthWidthClass = fullLength->Belt.Option.getWithDefault(false) ? "2xl:w-full" : "" + let fullLengthWidthClass = fullLength->Option.getWithDefault(false) ? "2xl:w-full" : "" let startTimeInput: ReactFinalForm.fieldRenderPropsInput = { name: "string", @@ -175,16 +171,15 @@ let make = ( timeVal } let date = String.split(selectedDate, "-") - let dateDay = date->Belt.Array.get(2)->Belt.Option.getWithDefault("1") - let dateMonth = date->Belt.Array.get(1)->Belt.Option.getWithDefault("1") - let dateYear = date->Belt.Array.get(0)->Belt.Option.getWithDefault("1970") + let dateDay = date->Belt.Array.get(2)->Option.getWithDefault("1") + let dateMonth = date->Belt.Array.get(1)->Option.getWithDefault("1") + let dateYear = date->Belt.Array.get(0)->Option.getWithDefault("1970") let timeSplit = String.split(timeVal, ":") - let timeHour = - timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault(currentDateHourFormat) + let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault(currentDateHourFormat) let timeMinute = - timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault(currentDateMinuteFormat) + timeSplit->Belt.Array.get(1)->Option.getWithDefault(currentDateMinuteFormat) let timeSecond = - timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault(currentDateSecondsFormat) + timeSplit->Belt.Array.get(2)->Option.getWithDefault(currentDateSecondsFormat) let dateTimeCheck = customTimezoneToISOString( dateYear, dateMonth, diff --git a/src/components/DateRangePicker.res b/src/components/DateRangePicker.res index f425b7fa0..290bb0a08 100644 --- a/src/components/DateRangePicker.res +++ b/src/components/DateRangePicker.res @@ -64,11 +64,11 @@ let getFormattedDate = (date, format) => { let isStartBeforeEndDate = (start, end) => { let getDate = date => { let datevalue = Js.Date.makeWithYMD( - ~year=Js.Float.fromString(date[0]->Belt.Option.getWithDefault("")), + ~year=Js.Float.fromString(date[0]->Option.getWithDefault("")), ~month=Js.Float.fromString( - String.make(Js.Float.fromString(date[1]->Belt.Option.getWithDefault("")) -. 1.0), + String.make(Js.Float.fromString(date[1]->Option.getWithDefault("")) -. 1.0), ), - ~date=Js.Float.fromString(date[2]->Belt.Option.getWithDefault("")), + ~date=Js.Float.fromString(date[2]->Option.getWithDefault("")), (), ) datevalue @@ -291,9 +291,9 @@ module Base = { setEndDateVal(_ => "") } else { let endDateSplit = String.split(ele, "-") - let endDateDate = endDateSplit[2]->Belt.Option.getWithDefault("") - let endDateYear = endDateSplit[0]->Belt.Option.getWithDefault("") - let endDateMonth = endDateSplit[1]->Belt.Option.getWithDefault("") + let endDateDate = endDateSplit[2]->Option.getWithDefault("") + let endDateYear = endDateSplit[0]->Option.getWithDefault("") + let endDateMonth = endDateSplit[1]->Option.getWithDefault("") let splitTime = switch time { | Some(val) => val | None => @@ -305,9 +305,9 @@ module Base = { } let timeSplit = String.split(splitTime, ":") - let timeHour = timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault("00") - let timeMinute = timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault("00") - let timeSecond = timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault("00") + let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault("00") + let timeMinute = timeSplit->Belt.Array.get(1)->Option.getWithDefault("00") + let timeSecond = timeSplit->Belt.Array.get(2)->Option.getWithDefault("00") let endDateTimeCheck = customTimezoneToISOString( endDateYear, endDateMonth, @@ -322,9 +322,9 @@ module Base = { let changeStartDate = (ele, isFromCustomInput, time) => { let setDate = str => { let startDateSplit = String.split(str, "-") - let startDateDay = startDateSplit[2]->Belt.Option.getWithDefault("") - let startDateYear = startDateSplit[0]->Belt.Option.getWithDefault("") - let startDateMonth = startDateSplit[1]->Belt.Option.getWithDefault("") + let startDateDay = startDateSplit[2]->Option.getWithDefault("") + let startDateYear = startDateSplit[0]->Option.getWithDefault("") + let startDateMonth = startDateSplit[1]->Option.getWithDefault("") let splitTime = switch time { | Some(val) => val | None => @@ -335,9 +335,9 @@ module Base = { } } let timeSplit = String.split(splitTime, ":") - let timeHour = timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault("00") - let timeMinute = timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault("00") - let timeSecond = timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault("00") + let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault("00") + let timeMinute = timeSplit->Belt.Array.get(1)->Option.getWithDefault("00") + let timeSecond = timeSplit->Belt.Array.get(2)->Option.getWithDefault("00") let startDateTimeCheck = customTimezoneToISOString( startDateYear, startDateMonth, @@ -507,17 +507,17 @@ module Base = { let endTimeStr = { let timeArr = endTimeStr->String.split(":") - let endTimeTxt = `${timeArr[0]->Belt.Option.getWithDefault( + let endTimeTxt = `${timeArr[0]->Option.getWithDefault( "00", - )}:${timeArr[1]->Belt.Option.getWithDefault("00")}` - showSeconds ? `${endTimeTxt}:${timeArr[2]->Belt.Option.getWithDefault("00")}` : endTimeTxt + )}:${timeArr[1]->Option.getWithDefault("00")}` + showSeconds ? `${endTimeTxt}:${timeArr[2]->Option.getWithDefault("00")}` : endTimeTxt } let startTimeStr = { let timeArr = startTimeStr->String.split(":") - let startTimeTxt = `${timeArr[0]->Belt.Option.getWithDefault( + let startTimeTxt = `${timeArr[0]->Option.getWithDefault( "00", - )}:${timeArr[1]->Belt.Option.getWithDefault("00")}` - showSeconds ? `${startTimeTxt}:${timeArr[2]->Belt.Option.getWithDefault("00")}` : startTimeTxt + )}:${timeArr[1]->Option.getWithDefault("00")}` + showSeconds ? `${startTimeTxt}:${timeArr[2]->Option.getWithDefault("00")}` : startTimeTxt } let buttonText = { @@ -615,7 +615,7 @@ module Base = { None }, (startDate, endDate, localStartDate, localEndDate)) - let btnStyle = customButtonStyle->Belt.Option.getWithDefault("") + let btnStyle = customButtonStyle->Option.getWithDefault("") let customStyleForBtn = btnStyle->String.length > 0 ? btnStyle : "" @@ -791,7 +791,7 @@ module Base = {
} else if showMsg { let msg = `Date Range should not exceed ${dateRangeLimit - ->Belt.Option.getWithDefault(0) + ->Option.getWithDefault(0) ->Belt.Int.toString} days` @@ -867,7 +867,7 @@ module Base = { let useStateForInput = (input: ReactFinalForm.fieldRenderPropsInput) => { React.useMemo1(() => { - let val = input.value->Js.Json.decodeString->Belt.Option.getWithDefault("") + let val = input.value->Js.Json.decodeString->Option.getWithDefault("") let onChange = fn => { let newVal = fn(val) input.onChange(newVal->Identity.stringToFormReactEvent) diff --git a/src/components/DynamicChart.res b/src/components/DynamicChart.res index bf646e583..160ec2e3d 100644 --- a/src/components/DynamicChart.res +++ b/src/components/DynamicChart.res @@ -39,7 +39,7 @@ let getTimeSeriesChart = (chartEntity: chartEntity) => { ~endDateTime=chartEntity.end_time, ~cardinality=chartEntity.cardinality, ~mode=chartEntity.mode, - ~customFilter=chartEntity.customFilter->Belt.Option.getWithDefault(""), + ~customFilter=chartEntity.customFilter->Option.getWithDefault(""), ~prefix=chartEntity.prefix, ~source=chartEntity.source, (), @@ -63,7 +63,7 @@ let getLegendBody = (chartEntity: chartEntity) => { ~endDateTime=chartEntity.end_time, ~cardinality=chartEntity.cardinality, ~mode=chartEntity.mode, - ~customFilter=chartEntity.customFilter->Belt.Option.getWithDefault(""), + ~customFilter=chartEntity.customFilter->Option.getWithDefault(""), ~prefix=chartEntity.prefix, ~source=chartEntity.source, (), @@ -329,8 +329,8 @@ let make = ( ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") - let fitlerName = keyArr->Belt.Array.get(1)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") + let fitlerName = keyArr->Belt.Array.get(1)->Option.getWithDefault("") // when chart id is not there then there won't be any prefix so the prefix will the filter name if chartId === "" { @@ -351,7 +351,7 @@ let make = ( ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") if prefix === chartId && prefix !== "" { None @@ -369,7 +369,7 @@ let make = ( let {allFilterDimension, dateFilterKeys, currentMetrics, uriConfig, source} = entity - let enableLoaders = entity.enableLoaders->Belt.Option.getWithDefault(true) + let enableLoaders = entity.enableLoaders->Option.getWithDefault(true) let entityAllMetrics = uriConfig->Array.reduce([], (acc, item) => Array.concat( @@ -387,7 +387,7 @@ let make = ( let chartType = getChartCompFilters->LogicUtils.getString( "chartType", - entity.chartTypes->Belt.Array.get(0)->Belt.Option.getWithDefault(Line)->chartMapper, + entity.chartTypes->Belt.Array.get(0)->Option.getWithDefault(Line)->chartMapper, ) let chartTopMetric = getChartCompFilters->LogicUtils.getString("chartTopMetric", currentTopMatrix) @@ -403,10 +403,7 @@ let make = ( } else if cardinalityArr->Array.includes("TOP_5") { dict->Dict.set("cardinality", "TOP_5") } else { - dict->Dict.set( - "cardinality", - cardinalityArr->Belt.Array.get(0)->Belt.Option.getWithDefault(""), - ) + dict->Dict.set("cardinality", cardinalityArr->Belt.Array.get(0)->Option.getWithDefault("")) } chartTypeArr->Array.includes(chartType) ? dict->Dict.set("chartType", chartType) @@ -417,10 +414,7 @@ let make = ( } else if chartMatrixArr->Array.includes(currentTopMatrix) { dict->Dict.set("chartTopMetric", currentTopMatrix) } else { - dict->Dict.set( - "chartTopMetric", - chartMatrixArr->Belt.Array.get(0)->Belt.Option.getWithDefault(""), - ) + dict->Dict.set("chartTopMetric", chartMatrixArr->Belt.Array.get(0)->Option.getWithDefault("")) } if chartMatrixArr->Array.includes(chartBottomMetric) { @@ -430,7 +424,7 @@ let make = ( } else { dict->Dict.set( "chartBottomMetric", - chartMatrixArr->Belt.Array.get(0)->Belt.Option.getWithDefault(""), + chartMatrixArr->Belt.Array.get(0)->Option.getWithDefault(""), ) } @@ -547,13 +541,13 @@ let make = ( React.useEffect2(() => { setGranularity(prev => { - current_granularity->Array.includes(prev->Belt.Option.getWithDefault("")) + current_granularity->Array.includes(prev->Option.getWithDefault("")) ? prev : current_granularity->Belt.Array.get(0) }) None }, (startTimeFromUrl, endTimeFromUrl)) - let selectedTabStr = selectedTab->Belt.Option.getWithDefault([])->Array.joinWith("") + let selectedTabStr = selectedTab->Option.getWithDefault([])->Array.joinWith("") let updatedChartConfigArr = React.useMemo7(() => { uriConfig->Array.map(item => { @@ -570,10 +564,7 @@ let make = ( ) ->Dict.fromArray let activeTab = - selectedTab - ->Belt.Option.getWithDefault([]) - ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("") + selectedTab->Option.getWithDefault([])->Belt.Array.get(0)->Option.getWithDefault("") let granularity = if activeTab === "run_date" { "G_ONEHOUR"->Some } else if activeTab === "run_week" { @@ -623,7 +614,7 @@ let make = ( url: item.uri, body: item.timeSeriesBody(chartconfig), legendBody: ?( - chartconfig.groupByNames->Belt.Option.getWithDefault([])->Array.length === 1 + chartconfig.groupByNames->Option.getWithDefault([])->Array.length === 1 ? legendBody : None ), @@ -642,12 +633,12 @@ let make = ( let (groupKeyFromTab, titleKey) = React.useMemo1(() => { switch (tabTitleMapper, selectedTab) { | (Some(dict), Some(arr)) => { - let groupKey = arr->Belt.Array.get(0)->Belt.Option.getWithDefault("") - (groupKey, dict->Dict.get(groupKey)->Belt.Option.getWithDefault(groupKey)) + let groupKey = arr->Belt.Array.get(0)->Option.getWithDefault("") + (groupKey, dict->Dict.get(groupKey)->Option.getWithDefault(groupKey)) } | (None, Some(arr)) => ( - arr->Belt.Array.get(0)->Belt.Option.getWithDefault(""), - arr->Belt.Array.get(0)->Belt.Option.getWithDefault(""), + arr->Belt.Array.get(0)->Option.getWithDefault(""), + arr->Belt.Array.get(0)->Option.getWithDefault(""), ) | _ => ("", "") } @@ -656,7 +647,7 @@ let make = ( let setRawChartData = (data: array) => { let chartData = data->Array.map(mappedData => { let rawdata = mappedData.rawData->Array.map(item => { - let dict = item->Js.Json.decodeObject->Belt.Option.getWithDefault(Dict.make()) + let dict = item->Js.Json.decodeObject->Option.getWithDefault(Dict.make()) switch dict->Dict.get("time_range") { | Some(jsonObj) => { @@ -664,7 +655,7 @@ let make = ( switch timeDict->Dict.get("startTime") { | Some(startValue) => { - let sTime = startValue->Js.Json.decodeString->Belt.Option.getWithDefault("") + let sTime = startValue->Js.Json.decodeString->Option.getWithDefault("") if sTime->String.length > 0 { let {date, hour, minute, month, second, year} = @@ -683,14 +674,14 @@ let make = ( } selectedTab - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.forEach( tabName => { let metric = Dict.get(dict, tabName) - ->Belt.Option.getWithDefault(""->Js.Json.string) + ->Option.getWithDefault(""->Js.Json.string) ->Js.Json.decodeString - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") let label = metric == "" ? "other" : metric Dict.set(dict, tabName, label->Js.Json.string) @@ -700,9 +691,9 @@ let make = ( if key->String.includes("amount") { let amount = Dict.get(dict, key) - ->Belt.Option.getWithDefault(Js.Json.number(0.0)) + ->Option.getWithDefault(Js.Json.number(0.0)) ->Js.Json.decodeNumber - ->Belt.Option.getWithDefault(0.0) + ->Option.getWithDefault(0.0) let amount = (amount /. 100.0)->Js.Float.toFixedWithPrecision(~digits=2) @@ -751,13 +742,13 @@ let make = ( let chartType = getChartCompFilters->LogicUtils.getString( "chartType", - entity.chartTypes->Belt.Array.get(0)->Belt.Option.getWithDefault(Line)->chartMapper, + entity.chartTypes->Belt.Array.get(0)->Option.getWithDefault(Line)->chartMapper, ) if ( startTimeFromUrl !== "" && endTimeFilterKey !== "" && - (granularity->Belt.Option.isSome || chartType !== "Line Chart") && - current_granularity->Array.includes(granularity->Belt.Option.getWithDefault("")) + (granularity->Option.isSome || chartType !== "Line Chart") && + current_granularity->Array.includes(granularity->Option.getWithDefault("")) ) { setChartLoading(_ => enableLoaders) fetchChartData(updatedChartBody, setRawChartData) @@ -886,7 +877,7 @@ let make = ( let (data, legendData, timeCol) = switch metricsUri { | Some(val) => switch rawChartData - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.find(item => item.metricsUrl === val.uri) { | Some(dataVal) => (dataVal.rawData, dataVal.legendData, val.timeCol) | None => ([], [], "") @@ -982,7 +973,7 @@ let make = ( let (data, legendData, timeCol) = switch metricsUri { | Some(val) => switch rawChartData - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.find(item => item.metricsUrl === val.uri) { | Some(dataVal) => (dataVal.rawData, dataVal.legendData, val.timeCol) | None => ([], [], "") diff --git a/src/components/DynamicFilter.res b/src/components/DynamicFilter.res index c27dda177..f0a004eb6 100644 --- a/src/components/DynamicFilter.res +++ b/src/components/DynamicFilter.res @@ -51,7 +51,7 @@ module CustomFilters = { ->String.replaceRegExp(%re("/ LIKE /gi"), "@@") ->String.split("@@") - let firstEle = Belt.Array.get(mArr, 0)->Belt.Option.getWithDefault("") + let firstEle = Belt.Array.get(mArr, 0)->Option.getWithDefault("") if ( firstEle != "" && tabNames->Array.indexOf(firstEle->String.trim->String.toLowerCase) < 0 ) { @@ -164,15 +164,14 @@ let make = ( ~hideFiltersDefaultValue=?, ~refreshFilters=true, ) => { - let localFilters = initialFilters->Array.filter(item => item.localFilter->Js.Option.isSome) - let remoteOptions = options->Array.filter(item => item.localFilter->Js.Option.isNone) + let localFilters = initialFilters->Array.filter(item => item.localFilter->Option.isSome) + let remoteOptions = options->Array.filter(item => item.localFilter->Option.isNone) let defaultFilters = ""->Js.Json.string let (showModal, setShowModal) = React.useState(_ => false) let {updateExistingKeys, filterValue, removeKeys} = React.useContext(FilterContext.filterContext) - let currentCustomFilterValue = - filterValue->Dict.get(customFilterKey)->Belt.Option.getWithDefault("") + let currentCustomFilterValue = filterValue->Dict.get(customFilterKey)->Option.getWithDefault("") let setCustomFilter = customFilter => { updateExistingKeys(Dict.fromArray([(customFilterKey, customFilter)])) diff --git a/src/components/DynamicSingleStat.res b/src/components/DynamicSingleStat.res index a585c2159..22a562b9a 100644 --- a/src/components/DynamicSingleStat.res +++ b/src/components/DynamicSingleStat.res @@ -100,7 +100,7 @@ let deltaTimeRangeMapper: array => deltaRange = (arrJson: arrayDict.get("currentSr") - ->Belt.Option.getWithDefault({ + ->Option.getWithDefault({ fromTime: "", toTime: "", }), @@ -139,7 +139,7 @@ let make = ( ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") if prefix === moduleName && prefix !== "" { None } else { @@ -159,14 +159,14 @@ let make = ( | _ => "BATCH" } - let enableLoaders = entity.enableLoaders->Belt.Option.getWithDefault(true) + let enableLoaders = entity.enableLoaders->Option.getWithDefault(true) let customFilterKey = switch entity { | {customFilterKey} => customFilterKey | _ => "" } let allFilterKeys = Array.concat( - [startTimeFilterKey, endTimeFilterKey, mode->Belt.Option.getWithDefault("")], + [startTimeFilterKey, endTimeFilterKey, mode->Option.getWithDefault("")], filterKeys, ) @@ -222,7 +222,7 @@ let make = ( let homePageCss = isHomePage || chartAlignment === #row ? "flex-col" : "flex-row" let wrapperClass = - wrapperClass->Belt.Option.getWithDefault( + wrapperClass->Option.getWithDefault( `flex mt-5 flex-col md:${homePageCss} flex-wrap justify-start items-stretch relative`, ) @@ -263,7 +263,7 @@ let make = ( entity.urlConfig ->Array.map(urlConfig => { let {uri, metrics} = urlConfig - let domain = String.split("/", uri)->Belt.Array.get(4)->Belt.Option.getWithDefault("") + let domain = String.split("/", uri)->Belt.Array.get(4)->Option.getWithDefault("") let startTime = if domain === "mandate" { (endTimeFromUrl->DayJs.getDayJsForString).subtract(. 1, @@ -285,7 +285,7 @@ let make = ( prefix: ?urlConfig.prefix, } let singleStatBodyMakerFn = - urlConfig.singleStatBody->Belt.Option.getWithDefault(singleStatBodyMake) + urlConfig.singleStatBody->Option.getWithDefault(singleStatBodyMake) let singleStatBody = singleStatBodyMakerFn(singleStatBodyEntity) fetchApi( @@ -296,7 +296,7 @@ let make = ( (), ) ->addLogsAroundFetch(~logTitle="SingleStat Data Api") - ->then(json => resolve((`${urlConfig.prefix->Belt.Option.getWithDefault("")}${uri}`, json))) + ->then(json => resolve((`${urlConfig.prefix->Option.getWithDefault("")}${uri}`, json))) ->catch(_err => resolve(("", Js.Json.object_(Dict.make())))) }) ->Promise.all @@ -312,7 +312,7 @@ let make = ( ->LogicUtils.getJsonObjectFromDict("queryData") ->LogicUtils.getArrayFromJson([]) ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.object_(Dict.make())) + ->Option.getWithDefault(Js.Json.object_(Dict.make())) ->LogicUtils.getDictFromJsonObject ->Dict.toArray ->Array.find( @@ -325,11 +325,7 @@ let make = ( | Some(data) => { let (_key, value) = data setTotalVolume( - _ => - value - ->Js.Json.decodeNumber - ->Belt.Option.getWithDefault(0.) - ->Belt.Float.toInt, + _ => value->Js.Json.decodeNumber->Option.getWithDefault(0.)->Belt.Float.toInt, ) } @@ -367,7 +363,7 @@ let make = ( entity.urlConfig ->Array.map(urlConfig => { let {uri, metrics} = urlConfig - let domain = String.split("/", uri)->Belt.Array.get(4)->Belt.Option.getWithDefault("") + let domain = String.split("/", uri)->Belt.Array.get(4)->Option.getWithDefault("") let startTime = if domain === "mandate" { (endTimeFromUrl->DayJs.getDayJsForString).subtract(. 1, @@ -391,7 +387,7 @@ let make = ( prefix: ?urlConfig.prefix, } let singleStatBodyMakerFn = - urlConfig.singleStatTimeSeriesBody->Belt.Option.getWithDefault(singleStatBodyMake) + urlConfig.singleStatTimeSeriesBody->Option.getWithDefault(singleStatBodyMake) fetchApi( uri, ~method_=Post, @@ -402,7 +398,7 @@ let make = ( ->addLogsAroundFetch(~logTitle="SingleStatTimeseries Data Api") ->then( json => { - resolve((`${urlConfig.prefix->Belt.Option.getWithDefault("")}${uri}`, json)) + resolve((`${urlConfig.prefix->Option.getWithDefault("")}${uri}`, json)) }, ) ->catch( @@ -437,7 +433,7 @@ let make = ( let uri = col->entity.matrixUriMapper let timeSeriesData = singlestatDataCombined.singleStatTimeData - ->Belt.Option.getWithDefault([("--", [])]) + ->Option.getWithDefault([("--", [])]) ->Belt.Array.keepMap( item => { let (timeSectionName, timeSeriesObj) = item @@ -463,7 +459,7 @@ let make = ( timeSeriesData, data.deltaTime, col, - mode->Belt.Option.getWithDefault("ORDER"), + mode->Option.getWithDefault("ORDER"), ) Belt.Option.getWithDefault(false) + prefixAddition->Option.getWithDefault(false) ? title->String.replaceRegExp(_, %re("/ /g"), "-")->String.toLowerCase->Some : None let (defaultFilters, setDefaultFilters) = React.useState(() => entity.defaultFilters) @@ -129,19 +129,15 @@ let make = ( let searchParams = disableURIdecode ? url.search : url.search->Js.Global.decodeURI let (refreshData, _setRefreshData) = React.useContext(RefreshStateContext.refreshStateContext) let (offset, setOffset) = React.useState(() => 0) - let remoteFilters = initialFilters->Array.filter(item => item.localFilter->Js.Option.isNone) + let remoteFilters = initialFilters->Array.filter(item => item.localFilter->Option.isNone) let filtersFromUrl = LogicUtils.getDictFromUrlSearchParams(searchParams) - let localFilters = initialFilters->Array.filter(item => item.localFilter->Js.Option.isSome) + let localFilters = initialFilters->Array.filter(item => item.localFilter->Option.isSome) let showToast = ToastState.useShowToast() let localOptions = - Array.concat(options, popupFilterFields)->Array.filter(item => - item.localFilter->Js.Option.isSome - ) + Array.concat(options, popupFilterFields)->Array.filter(item => item.localFilter->Option.isSome) let remoteOptions = - Array.concat(options, popupFilterFields)->Array.filter(item => - item.localFilter->Js.Option.isNone - ) + Array.concat(options, popupFilterFields)->Array.filter(item => item.localFilter->Option.isNone) let remoteFiltersFromUrl = useRemoteFilter( ~searchParams, ~remoteFilters, @@ -201,7 +197,7 @@ let make = ( } setData(prevData => { - let newData = prevData->Belt.Option.getWithDefault([])->Array.concat(sampleRes) + let newData = prevData->Option.getWithDefault([])->Array.concat(sampleRes) Some(newData) }) } @@ -216,9 +212,7 @@ let make = ( let x = filtersFromUrl ->Dict.get(val) - ->Belt.Option.getWithDefault( - searchValueDict->Dict.get(val)->Belt.Option.getWithDefault(""), - ) + ->Option.getWithDefault(searchValueDict->Dict.get(val)->Option.getWithDefault("")) if requireDateFormatting && (val == "startTime" || val == "endTime") { (x->DayJs.getDayJsForString).format(. "YYYY-MM-DD+HH:mm:ss") } else if requireDateFormatting && (val == "start_date" || val == "end_date") { @@ -301,15 +295,15 @@ let make = ( setRefetchCounter(p => p + 1) }, [setRefetchCounter]) - let visibleColumns = visibleColumnsProp->Belt.Option.getWithDefault(defaultColumns) + let visibleColumns = visibleColumnsProp->Option.getWithDefault(defaultColumns) let handleRefetch = () => { - let rowFetched = data->Belt.Option.getWithDefault([])->Array.length + let rowFetched = data->Option.getWithDefault([])->Array.length if rowFetched !== summary.totalCount { setTableDataLoading(_ => true) let newDefaultFilter = defaultFilters ->Js.Json.decodeObject - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getWithDefault(Dict.make()) ->Dict.toArray ->Dict.fromArray @@ -320,14 +314,14 @@ let make = ( let showLocalFilter = (localFilters->Array.length > 0 || localOptions->Array.length > 0) && - (applyFilters ? finalData : data)->Belt.Option.getWithDefault([])->Array.length > 0 + (applyFilters ? finalData : data)->Option.getWithDefault([])->Array.length > 0 let showRemoteFilter = remoteFilters->Array.length > 0 || remoteOptions->Array.length > 0 let filters = { if ( (Array.length(initialFilters) > 0 || Array.length(options) > 0) && (showLocalFilter || showRemoteFilter) && - (!hideFiltersOnNoData || data->Belt.Option.getWithDefault([])->Array.length > 0) + (!hideFiltersOnNoData || data->Option.getWithDefault([])->Array.length > 0) ) { let children =
@@ -422,7 +416,7 @@ let make = ( for i in 0 to cols->Array.length - 1 { checkLength := checkLength.contents && - switch obj[cols[i]->Belt.Option.getWithDefault(0)] { + switch obj[cols[i]->Option.getWithDefault(0)] { | Some(ele) => Array.length(ele.selected) > 0 | None => false } @@ -473,9 +467,7 @@ let make = ( currrentFetchCount } let customizeColumn = if ( - activeColumnsAtom->Js.Option.isSome && - entity.allColumns->Js.Option.isSome && - totalResults > 0 + activeColumnsAtom->Option.isSome && entity.allColumns->Option.isSome && totalResults > 0 ) {
: React.null} diff --git a/src/components/Table.res b/src/components/Table.res index 205091a92..a51eba898 100644 --- a/src/components/Table.res +++ b/src/components/Table.res @@ -127,7 +127,7 @@ module TableRow = { | _ => false } }) - ->Belt.Option.isSome + ->Option.isSome let bgColor = coloredRow ? selectedRowColor : "bg-white dark:bg-jp-gray-lightgray_background" let fontSize = "text-fs-13" let fontWeight = "" @@ -265,7 +265,7 @@ module SortAction = { ~isLastCol=false, ~filterRow: option, ) => { - if item.showSort || filterRow->Belt.Option.isSome { + if item.showSort || filterRow->Option.isSome { let order: sortOrder = switch sortedObj { | Some(obj: sortedObject) => obj.key === item.key ? obj.order : NONE | None => NONE @@ -358,8 +358,8 @@ module TableHeadingCell = { } let headerBgColor = - headerCustomBgColor->Belt.Option.isSome - ? headerCustomBgColor->Belt.Option.getWithDefault("") + headerCustomBgColor->Option.isSome + ? headerCustomBgColor->Option.getWithDefault("") : "bg-gray-50 dark:bg-jp-gray-darkgray_background" let paddingClass = "px-4 py-3" let roundedClass = if isFirstCol { @@ -382,7 +382,7 @@ module TableHeadingCell = { : ""}` } else { let heightHeadingClass2 = frozenUpto == 0 ? "" : heightHeadingClass - `tableHeader ${lastColProp} ${item.customWidth->Belt.Option.getWithDefault( + `tableHeader ${lastColProp} ${item.customWidth->Option.getWithDefault( "", )} justify-between items-center ${headerTextClass} whitespace-pre select-none ${headerBgColor} ${paddingClass} ${roundedClass} ${heightHeadingClass2} ${tableheadingClass} ${isLastCol ? lastHeadingClass @@ -394,7 +394,7 @@ module TableHeadingCell = { `${fontWeight} ${fontSize} ${tableHeadingTextClass}` } let (isAllSelected, isSelectedStateMinus, checkboxDimension) = ( - selectAllCheckBox->Belt.Option.isSome, + selectAllCheckBox->Option.isSome, selectAllCheckBox === Some(PARTIAL), "h-4 w-4", ) @@ -417,7 +417,7 @@ module TableHeadingCell = {
Belt.Option.getWithDefault(false)}> + condition={item.showMultiSelectCheckBox->Option.getWithDefault(false)}>
headerElement | _ =>
{React.string(item.title)}
}} - Belt.Option.isSome}> + Option.isSome}> Belt.Option.getWithDefault("")), - ]> + attributes=[("data-heading-value", item.data->Option.getWithDefault(""))]>
- {React.string(` (${item.data->Belt.Option.getWithDefault("")})`)} + {React.string(` (${item.data->Option.getWithDefault("")})`)}
- {if item.showFilter || item.showSort || filterRow->Belt.Option.isSome { + {if item.showFilter || item.showSort || filterRow->Option.isSome { let selfClass = "self-end"
- Belt.Option.getWithDefault(false)}> + Option.getWithDefault(false)}>
{React.string("*")}
- Belt.Option.getWithDefault("") !== ""}> + Option.getWithDefault("") !== ""}>
Belt.Option.getWithDefault("")} + description={item.description->Option.getWithDefault("")} toolTipPosition={ToolTip.Bottom} />
@@ -561,7 +558,7 @@ module TableHeadingRow = { {headingArray ->Array.mapWithIndex((item, i) => { - let columnFilterRow: array = columnFilterRow->Belt.Option.getWithDefault([]) + let columnFilterRow: array = columnFilterRow->Option.getWithDefault([]) let filterRow = columnFilterRow->Belt.Array.get(i) Array.find(head => head.showFilter)->Js.Option.isSome + let filterPresent = heading->Array.find(head => head.showFilter)->Option.isSome let highlightEnabledFieldsArray = heading->Array.reduceWithIndex([], (acc, item, index) => { if item.highlightCellOnHover { @@ -702,7 +699,7 @@ let make = ( | Some(actualData) => switch getRowDetails { | Some(fn) => - fn(actualData->Belt.Array.get(rowIndex)->Belt.Option.getWithDefault(Js.Nullable.null)) + fn(actualData->Belt.Array.get(rowIndex)->Option.getWithDefault(Js.Nullable.null)) | None => React.null } | None => React.null @@ -760,7 +757,7 @@ let make = ( | None => None } let tableheadingClass = - customizeColumnNewTheme->Belt.Option.isSome + customizeColumnNewTheme->Option.isSome ? `${tableheadingClass} ${heightHeadingClass}` : tableheadingClass @@ -896,7 +893,7 @@ let make = ( let parentBorderRadius = !isHighchartLegend ? "rounded-t-lg" : "" let parentBorderClass = !isHighchartLegend ? "border border-jp-2-light-gray-300" : ""
Belt.Option.getWithDefault( + className={`flex flex-row items-stretch ${scrollBarClass} loadedTable ${parentMinWidthClass} ${customBorderClass->Option.getWithDefault( parentBorderClass ++ " " ++ parentBorderRadius, )}`} style={ReactDOMStyle.make( diff --git a/src/components/TableLocalFilters.res b/src/components/TableLocalFilters.res index e73d288a7..a608a0fd8 100644 --- a/src/components/TableLocalFilters.res +++ b/src/components/TableLocalFilters.res @@ -96,7 +96,7 @@ module FilterDropDown = { let options = dummyDict->Dict.keysToArray->Array.filter(item => item != "")->SelectBox.makeOptions - let selectedValue = Dict.get(lclFiltrState, val)->Belt.Option.getWithDefault([]) + let selectedValue = Dict.get(lclFiltrState, val)->Option.getWithDefault([]) let filterInput: ReactFinalForm.fieldRenderPropsInput = { name: val, @@ -176,9 +176,9 @@ module TextFilterCell = { let selectedValue = Dict.get(lclFiltrState, val) - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(""->Js.Json.string) + ->Option.getWithDefault(""->Js.Json.string) let localInput = React.useMemo1((): ReactFinalForm.fieldRenderPropsInput => { { name: "--", @@ -233,7 +233,7 @@ module RangeFilterCell = { let minVal = Js.Math.floor_float(minVal) let maxVal = Js.Math.ceil_float(maxVal) let selectedValueStr = - Dict.get(lclFiltrState, val)->Belt.Option.getWithDefault([ + Dict.get(lclFiltrState, val)->Option.getWithDefault([ minVal->Js.Json.number, maxVal->Js.Json.number, ]) @@ -246,14 +246,14 @@ module RangeFilterCell = { let value = {ev->ReactEvent.Form.target}["value"] let leftVal = value->Js.Float.fromString->Js.Json.number - let rightvalue = selectedValueStr[1]->Belt.Option.getWithDefault(Js.Json.null) + let rightvalue = selectedValueStr[1]->Option.getWithDefault(Js.Json.null) switch selectedValueStr[1] { | Some(ele) => setLclFltrState(val, [leftVal > rightvalue ? rightvalue : leftVal, ele]) | None => () } }, onFocus: _ev => (), - value: selectedValueStr[0]->Belt.Option.getWithDefault(Js.Json.number(0.0)), + value: selectedValueStr[0]->Option.getWithDefault(Js.Json.number(0.0)), checked: false, } }, [selectedValueStr]) @@ -272,7 +272,7 @@ module RangeFilterCell = { } }, onFocus: _ev => (), - value: selectedValueStr[1]->Belt.Option.getWithDefault(Js.Json.number(0.0)), + value: selectedValueStr[1]->Option.getWithDefault(Js.Json.number(0.0)), checked: false, } }, [selectedValueStr]) diff --git a/src/components/TableUtils.res b/src/components/TableUtils.res index c9a3521b4..146a3c9e8 100644 --- a/src/components/TableUtils.res +++ b/src/components/TableUtils.res @@ -399,8 +399,8 @@ module Numeric = { module MoneyCell = { let getAmountValue = (amount, currency) => { let amountSplitArr = Js.Float.toFixedWithPrecision(amount, ~digits=2)->String.split(".") - let decimal = amountSplitArr[1]->Belt.Option.getWithDefault("00") - let receivedValue = amountSplitArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let decimal = amountSplitArr[1]->Option.getWithDefault("00") + let receivedValue = amountSplitArr->Belt.Array.get(0)->Option.getWithDefault("") let formattedAmount = if receivedValue->String.includes("e") { receivedValue @@ -560,7 +560,7 @@ module EllipsisText = { text ->String.split(ellipsisIdentifier) ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("") ++ "..." + ->Option.getWithDefault("") ++ "..." } : text let ellipsesCondition = diff --git a/src/components/Tabs.res b/src/components/Tabs.res index db6603948..2b891bfc9 100644 --- a/src/components/Tabs.res +++ b/src/components/Tabs.res @@ -78,7 +78,7 @@ module TabInfo = { if isSelected && isScrollIntoViewRequired { tabRef.current ->Js.Nullable.toOption - ->Belt.Option.forEach(input => + ->Option.forEach(input => input->scrollIntoView(_, {behavior: "smooth", block: "nearest", inline: "nearest"}) ) } @@ -109,7 +109,7 @@ module IndicationArrow = { _ev => refElement.current ->Js.Nullable.toOption - ->Belt.Option.forEach(input => + ->Option.forEach(input => input->scrollIntoView(_, {behavior: "smooth", block: "nearest", inline: "start"}) ) } @@ -169,7 +169,7 @@ let make = ( // ~icon=React.null, let _ = defaultClasses - let initialIndex = initialIndex->Belt.Option.getWithDefault(0) + let initialIndex = initialIndex->Option.getWithDefault(0) let (selectedIndex, setSelectedIndex) = React.useState(() => initialIndex) let tabOuterClass = `${tabBottomShadow} ${gapBetweenTabs}` let bottomBorderClass = "border-b border-jp-gray-500 dark:border-jp-gray-960" diff --git a/src/components/TabularInput.res b/src/components/TabularInput.res index 89801d919..5e42f0e53 100644 --- a/src/components/TabularInput.res +++ b/src/components/TabularInput.res @@ -25,8 +25,8 @@ module TableCell = { onChange(elemIndex, i, event["value"]) }, onFocus: _ev => (), - value: (keyValue[elemIndex]->Belt.Option.getWithDefault([]))[i] - ->Belt.Option.getWithDefault("") + value: (keyValue[elemIndex]->Option.getWithDefault([]))[i] + ->Option.getWithDefault("") ->Js.Json.string, checked: true, } diff --git a/src/components/form/FormRenderer.res b/src/components/form/FormRenderer.res index ba4e04ef0..b24d77e15 100644 --- a/src/components/form/FormRenderer.res +++ b/src/components/form/FormRenderer.res @@ -39,14 +39,14 @@ let makeInputFieldInfo = ( ~validate: option<(option, Js.Json.t) => Js.Promise.t>>=?, (), ) => { - let label = label->Belt.Option.getWithDefault(name) + let label = label->Option.getWithDefault(name) let newCustomInput = - customInput->Belt.Option.getWithDefault(InputFields.textInput(~isDisabled=disabled, ())) + customInput->Option.getWithDefault(InputFields.textInput(~isDisabled=disabled, ())) { name, - placeholder: placeholder->Belt.Option.getWithDefault(label), + placeholder: placeholder->Option.getWithDefault(label), customInput: newCustomInput, disabled, format, @@ -144,10 +144,10 @@ let makeFieldInfo = ( ~validate: option<(option, Js.Json.t) => Js.Promise.t>>=?, (), ) => { - let label = label->Belt.Option.getWithDefault(name) + let label = label->Option.getWithDefault(name) let newCustomInput = - customInput->Belt.Option.getWithDefault(InputFields.textInput(~isDisabled=disabled, ())) + customInput->Option.getWithDefault(InputFields.textInput(~isDisabled=disabled, ())) makeMultiInputFieldInfo( ~label, @@ -267,7 +267,7 @@ module FieldWrapper = { }} } children - {switch subText->Belt.Option.flatMap(LogicUtils.getNonEmptyString) { + {switch subText->Option.flatMap(LogicUtils.getNonEmptyString) { | Some(subText) =>
{React.string(subText)}
| None => React.null }} @@ -398,8 +398,7 @@ module ComboFieldsRenderer3 = { if inputFields->Array.length === 0 { renderInputs(fieldsState) } else { - let inputField = - inputFields[0]->Belt.Option.getWithDefault(makeInputFieldInfo(~name="", ())) + let inputField = inputFields[0]->Option.getWithDefault(makeInputFieldInfo(~name="", ())) let restInputFields = Js.Array2.sliceFrom(inputFields, 1) @@ -495,7 +494,7 @@ module FieldRenderer = { dataId=names> {if field.inputFields->Array.length === 1 { let field = - field.inputFields[0]->Belt.Option.getWithDefault(makeInputFieldInfo(~name="", ())) + field.inputFields[0]->Option.getWithDefault(makeInputFieldInfo(~name="", ())) diff --git a/src/components/form/MultipleTextInput.res b/src/components/form/MultipleTextInput.res index 8f8a2a47a..a56dccf07 100644 --- a/src/components/form/MultipleTextInput.res +++ b/src/components/form/MultipleTextInput.res @@ -44,7 +44,7 @@ let make = ( let currentTags = React.useMemo1(() => { input.value ->Js.Json.decodeArray - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Belt.Array.keepMap(Js.Json.decodeString) }, [input.value]) @@ -53,7 +53,7 @@ let make = ( } let (text, setText) = React.useState(_ => "") - let customStyleClass = customStyle->Belt.Option.getWithDefault("gap-2 w-full px-1 py-1") + let customStyleClass = customStyle->Option.getWithDefault("gap-2 w-full px-1 py-1") let onTagRemove = text => { setTags(currentTags->Array.filter(tag => tag !== text)) } @@ -72,7 +72,7 @@ let make = ( let isEmpty = text->String.length === 0 if isEmpty && (e->key === "Backspace" || e->keyCode === 8) && currentTags->Array.length > 0 { - setText(_ => currentTags[currentTags->Array.length - 1]->Belt.Option.getWithDefault("")) + setText(_ => currentTags[currentTags->Array.length - 1]->Option.getWithDefault("")) setTags(currentTags->Array.slice(~start=0, ~end=-1)) } else if text->String.length !== 0 { if e->key === "Enter" || e->keyCode === 13 || e->key === "Tab" || e->keyCode === 9 { diff --git a/src/components/form/NumericTextInput.res b/src/components/form/NumericTextInput.res index 63152df73..56f9cd35b 100644 --- a/src/components/form/NumericTextInput.res +++ b/src/components/form/NumericTextInput.res @@ -1,4 +1,4 @@ -let getFloat = strJson => strJson->Js.Json.decodeString->Belt.Option.flatMap(Belt.Float.fromString) +let getFloat = strJson => strJson->Js.Json.decodeString->Option.flatMap(Belt.Float.fromString) @react.component let make = ( @@ -53,18 +53,15 @@ let make = ( onChange: ev => { let value = ReactEvent.Form.target(ev)["value"] - let strValue = value->Js.Json.decodeString->Belt.Option.getWithDefault("") + let strValue = value->Js.Json.decodeString->Option.getWithDefault("") let cleanedValue = switch strValue->Js.String2.match_(%re("/[\d\.]/g")) { | Some(strArr) => let str = strArr->Array.joinWith("")->String.split(".")->Array.slice(~start=0, ~end=2) let result = if removeLeadingZeroes { + str[0] = str[0]->Option.getWithDefault("")->String.replaceRegExp(%re("/\b0+/g"), "") str[0] = - str[0]->Belt.Option.getWithDefault("")->String.replaceRegExp(%re("/\b0+/g"), "") - str[0] = - str[0]->Belt.Option.getWithDefault("") === "" - ? "0" - : str[0]->Belt.Option.getWithDefault("") + str[0]->Option.getWithDefault("") === "" ? "0" : str[0]->Option.getWithDefault("") str->Array.joinWith(".") } else { str->Array.joinWith(".") @@ -102,9 +99,9 @@ let make = ( let numericPrevLocalValue = prevLocalStr ->Js.Json.decodeString - ->Belt.Option.flatMap(Belt.Float.fromString) + ->Option.flatMap(Belt.Float.fromString) ->Belt.Option.map(Js.Json.number) - ->Belt.Option.getWithDefault(Js.Json.null) + ->Option.getWithDefault(Js.Json.null) if input.value === numericPrevLocalValue { prevLocalStr } else { diff --git a/src/components/form/TextInput.res b/src/components/form/TextInput.res index 52977f0ec..bee08fc34 100644 --- a/src/components/form/TextInput.res +++ b/src/components/form/TextInput.res @@ -83,7 +83,7 @@ let make = ( }, (inputRef.current, input.name)) React.useEffect1(() => { - let val = input.value->Js.Json.decodeString->Belt.Option.getWithDefault("") + let val = input.value->Js.Json.decodeString->Option.getWithDefault("") if val->String.includes("") { showPopUp({ @@ -138,8 +138,7 @@ let make = ( ? "border-red-500 focus:border-red-500 dark:border-red-500 dark:hover:border-red-500 dark:focus:border-red-500 focus:shadow-text_input_shadow focus:shadow-red-500" : "border-jp-gray-lightmode_steelgray focus:border-blue-800 dark:border-jp-gray-960 dark:hover:border-jp-gray-960 dark:focus:border-blue-800 focus:shadow-text_input_shadow focus:shadow-blue-800" - let dashboardClass = - customDashboardClass->Belt.Option.getWithDefault("h-10 text-sm font-semibold") + let dashboardClass = customDashboardClass->Option.getWithDefault("h-10 text-sm font-semibold") let rightPaddingClass = if description !== "" || isInValid { "pr-10" } else { @@ -156,7 +155,7 @@ let make = ( let placeholderClass = "" let textAndBgClass = `${customDarkBackground} text-jp-gray-900 text-opacity-75 focus:text-opacity-100 dark:text-jp-gray-text_darktheme dark:text-opacity-75 dark:placeholder-jp-gray-text_darktheme dark:placeholder-opacity-25 dark:focus:text-opacity-100` - let width = widthMatchwithPlaceholderLength->Belt.Option.isSome ? "" : customWidth + let width = widthMatchwithPlaceholderLength->Option.isSome ? "" : customWidth let textPaddingClass = type_ !== "range" && customPaddingClass == "" ? `${rightPaddingClass} ${leftPaddingClass} ${verticalPadding}` diff --git a/src/components/priority-logics/AddPLGateway.res b/src/components/priority-logics/AddPLGateway.res index f9dafd0bc..24696bfaf 100644 --- a/src/components/priority-logics/AddPLGateway.res +++ b/src/components/priority-logics/AddPLGateway.res @@ -41,7 +41,7 @@ let make = ( let gatewayName = name => { let res = connectorList - ->Belt.Option.getWithDefault([Dict.make()->ConnectorTableUtils.getProcessorPayloadType]) + ->Option.getWithDefault([Dict.make()->ConnectorTableUtils.getProcessorPayloadType]) ->ConnectorTableUtils.getConnectorNameViaId(name) res.connector_name } @@ -59,11 +59,11 @@ let make = ( let selectedOptions = gateWaysInput.value ->Js.Json.decodeArray - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Belt.Array.keepMap(item => item ->Js.Json.decodeObject - ->Belt.Option.flatMap(dict => { + ->Option.flatMap(dict => { let connectorDict = dict->LogicUtils.getDictfromDict("connector") let obj: gateway = { connector: { @@ -185,10 +185,7 @@ let make = ( name=key onChange={ev => { let val = ReactEvent.Form.target(ev)["value"] - updatePercentage( - item, - val->Belt.Int.fromString->Belt.Option.getWithDefault(0), - ) + updatePercentage(item, val->Belt.Int.fromString->Option.getWithDefault(0)) }} value={item.split->Belt.Int.toString} type_="text" diff --git a/src/components/tooltip/ToolTip.res b/src/components/tooltip/ToolTip.res index 6b7a46bdd..9c67b4689 100644 --- a/src/components/tooltip/ToolTip.res +++ b/src/components/tooltip/ToolTip.res @@ -234,7 +234,7 @@ module TooltipWrapper = { ~tooltipArrowSize, ~componentWidth, ~componentHeight, - ~position=toolTipPosition->Belt.Option.getWithDefault(defaultPosition), + ~position=toolTipPosition->Option.getWithDefault(defaultPosition), ) } else { getToolTipAbsoluteStyling( @@ -244,7 +244,7 @@ module TooltipWrapper = { ~tooltipWidth, ~componentWidth, ~componentHeight, - ~position=toolTipPosition->Belt.Option.getWithDefault(defaultPosition), + ~position=toolTipPosition->Option.getWithDefault(defaultPosition), ) } diff --git a/src/context/ChartContext.res b/src/context/ChartContext.res index 2fc567139..5dca95021 100644 --- a/src/context/ChartContext.res +++ b/src/context/ChartContext.res @@ -49,10 +49,10 @@ let getGranularityMapper = (granularity: string) => { ( granularityArr ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("1") + ->Option.getWithDefault("1") ->Belt.Int.fromString - ->Belt.Option.getWithDefault(1), - granularityArr->Belt.Array.get(1)->Belt.Option.getWithDefault("week"), + ->Option.getWithDefault(1), + granularityArr->Belt.Array.get(1)->Option.getWithDefault("week"), ) } } @@ -70,10 +70,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF let (activeTab, activeTabStr) = React.useMemo1(() => { let activeTabOptionalArr = getAllFilter->getOptionStrArrayFromDict(`${chartEntity.moduleName}.tabName`) - ( - activeTabOptionalArr, - activeTabOptionalArr->Belt.Option.getWithDefault([])->Array.joinWith(","), - ) + (activeTabOptionalArr, activeTabOptionalArr->Option.getWithDefault([])->Array.joinWith(",")) }, [getAllFilter]) let parentToken = AuthWrapperUtils.useTokenParent(Original) @@ -129,7 +126,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") if prefix === chartId && prefix !== "" { None } else { @@ -172,8 +169,8 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") - let fitlerName = keyArr->Belt.Array.get(1)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") + let fitlerName = keyArr->Belt.Array.get(1)->Option.getWithDefault("") // when chart id is not there then there won't be any prefix so the prefix will the filter name if chartId === "" { @@ -217,7 +214,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF React.useEffect2(() => { setGranularity(prev => { - current_granularity->Array.includes(prev->Belt.Option.getWithDefault("")) + current_granularity->Array.includes(prev->Option.getWithDefault("")) ? prev : current_granularity->Belt.Array.get(0) }) @@ -240,15 +237,15 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF "chartType", chartEntity.chartTypes ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Line) + ->Option.getWithDefault(Line) ->DynamicChart.chartMapper, ) if ( startTimeFromUrl !== "" && endTimeFromUrl !== "" && - parentToken->Belt.Option.isSome && - (granularity->Belt.Option.isSome || chartType !== "Line Chart") && - current_granularity->Array.includes(granularity->Belt.Option.getWithDefault("")) + parentToken->Option.isSome && + (granularity->Option.isSome || chartType !== "Line Chart") && + current_granularity->Array.includes(granularity->Option.getWithDefault("")) ) { setTopChartFetchWithCurrentDependecyChange(_ => false) } @@ -257,7 +254,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF }, ( parentToken, current_granularity->Array.joinWith("-") ++ - granularity->Belt.Option.getWithDefault("") ++ + granularity->Option.getWithDefault("") ++ cardinalityFromUrl ++ chartTopMetricFromUrl ++ customFilter ++ @@ -274,15 +271,15 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF "chartType", chartEntity.chartTypes ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Line) + ->Option.getWithDefault(Line) ->DynamicChart.chartMapper, ) if ( startTimeFromUrl !== "" && endTimeFromUrl !== "" && - parentToken->Belt.Option.isSome && - (granularity->Belt.Option.isSome || chartType !== "Line Chart") && - current_granularity->Array.includes(granularity->Belt.Option.getWithDefault("")) + parentToken->Option.isSome && + (granularity->Option.isSome || chartType !== "Line Chart") && + current_granularity->Array.includes(granularity->Option.getWithDefault("")) ) { setBottomChartFetchWithCurrentDependecyChange(_ => false) } @@ -291,7 +288,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF }, ( parentToken, current_granularity->Array.joinWith("-") ++ - granularity->Belt.Option.getWithDefault("") ++ + granularity->Option.getWithDefault("") ++ chartBottomMetricFromUrl ++ startTimeFromUrl ++ cardinalityFromUrl ++ @@ -332,7 +329,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF | None => [metric] } - let granularityConfig = granularity->Belt.Option.getWithDefault("")->getGranularityMapper + let granularityConfig = granularity->Option.getWithDefault("")->getGranularityMapper metricsArr ->Array.map(metric => { @@ -349,7 +346,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF ~customFilterValue=customFilter, ~sortingParams?, ~timeCol, - ~domain=value.domain->Belt.Option.getWithDefault(""), + ~domain=value.domain->Option.getWithDefault(""), (), )->Js.Json.stringify, ~authToken=parentToken, @@ -390,7 +387,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF _ => Loaded( dataMerge( ~dataArr=metricsArr->Array.map(item => item->getArrayFromJson([])), - ~dictKey=Belt.Array.concat(activeTab->Belt.Option.getWithDefault([]), ["time"]), + ~dictKey=Belt.Array.concat(activeTab->Option.getWithDefault([]), ["time"]), )->Js.Json.array, ), ), @@ -409,7 +406,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF ~filterValueFromUrl?, ~customFilterValue=customFilter, ~sortingParams?, - ~domain=value.domain->Belt.Option.getWithDefault(""), + ~domain=value.domain->Option.getWithDefault(""), (), )->Js.Json.stringify, ~authToken=parentToken, @@ -462,7 +459,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF } let timeCol = value.timeCol - let granularityConfig = granularity->Belt.Option.getWithDefault("")->getGranularityMapper + let granularityConfig = granularity->Option.getWithDefault("")->getGranularityMapper metricsArr ->Array.map(metric => { fetchApi( @@ -478,7 +475,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF ~customFilterValue=customFilter, ~sortingParams?, ~timeCol=value.timeCol, - ~domain=value.domain->Belt.Option.getWithDefault(""), + ~domain=value.domain->Option.getWithDefault(""), (), )->Js.Json.stringify, ~authToken=parentToken, @@ -517,7 +514,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF let data = dataMerge( ~dataArr=metricsArr->Array.map(item => item->getArrayFromJson([])), - ~dictKey=Belt.Array.concat(activeTab->Belt.Option.getWithDefault([]), ["time"]), + ~dictKey=Belt.Array.concat(activeTab->Option.getWithDefault([]), ["time"]), )->Js.Json.array resolve(setBottomChartData(_ => Loaded(data))) @@ -535,7 +532,7 @@ let make = (~children, ~chartEntity: DynamicChart.entity, ~chartId="", ~defaultF ~filterValueFromUrl?, ~customFilterValue=customFilter, ~sortingParams?, - ~domain=value.domain->Belt.Option.getWithDefault(""), + ~domain=value.domain->Option.getWithDefault(""), (), )->Js.Json.stringify, ~authToken=parentToken, @@ -640,7 +637,7 @@ module SDKAnalyticsChartContext = { ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") if prefix === chartId && prefix !== "" { None } else { @@ -683,8 +680,8 @@ module SDKAnalyticsChartContext = { ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") - let fitlerName = keyArr->Belt.Array.get(1)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") + let fitlerName = keyArr->Belt.Array.get(1)->Option.getWithDefault("") // when chart id is not there then there won't be any prefix so the prefix will the filter name if chartId === "" { @@ -719,7 +716,7 @@ module SDKAnalyticsChartContext = { } let differentTimeValues = Belt.Array.concat( [currentTimeRanges], - differentTimeValues->Belt.Option.getWithDefault([]), + differentTimeValues->Option.getWithDefault([]), ) let cardinalityFromUrl = getChartCompFilters->getString("cardinality", "TOP_5") let _chartTopMetricFromUrl = getChartCompFilters->getString("chartTopMetric", currentTopMatrix) @@ -735,7 +732,7 @@ module SDKAnalyticsChartContext = { React.useEffect2(() => { setGranularity(prev => { - current_granularity->Array.includes(prev->Belt.Option.getWithDefault("")) + current_granularity->Array.includes(prev->Option.getWithDefault("")) ? prev : current_granularity->Belt.Array.get(0) }) @@ -753,15 +750,15 @@ module SDKAnalyticsChartContext = { "chartType", chartEntity.chartTypes ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Line) + ->Option.getWithDefault(Line) ->DynamicChart.chartMapper, ) if ( startTimeFromUrl !== "" && endTimeFromUrl !== "" && - parentToken->Belt.Option.isSome && - (granularity->Belt.Option.isSome || chartType !== "Line Chart") && - current_granularity->Array.includes(granularity->Belt.Option.getWithDefault("")) + parentToken->Option.isSome && + (granularity->Option.isSome || chartType !== "Line Chart") && + current_granularity->Array.includes(granularity->Option.getWithDefault("")) ) { setTopChartFetchWithCurrentDependecyChange(_ => false) } @@ -770,12 +767,12 @@ module SDKAnalyticsChartContext = { }, ( parentToken, current_granularity->Array.joinWith("-") ++ - granularity->Belt.Option.getWithDefault("") ++ + granularity->Option.getWithDefault("") ++ cardinalityFromUrl ++ selectedTrends->Array.joinWith(",") ++ customFilter ++ startTimeFromUrl ++ - segmentValue->Belt.Option.getWithDefault([])->Array.joinWith(",") ++ + segmentValue->Option.getWithDefault([])->Array.joinWith(",") ++ endTimeFromUrl, filterValueFromUrl, differentTimeValues->Array.map(item => `${item.fromTime}${item.toTime}`)->Array.joinWith(","), @@ -803,8 +800,7 @@ module SDKAnalyticsChartContext = { | None => "" } - let granularityConfig = - granularity->Belt.Option.getWithDefault("")->getGranularityMapper + let granularityConfig = granularity->Option.getWithDefault("")->getGranularityMapper switch differentTimeValues->Belt.Array.get(0) { | Some(timeObjOrig) => { let timeObj = Dict.fromArray([ @@ -823,7 +819,7 @@ module SDKAnalyticsChartContext = { ~filterValueFromUrl?, ~customFilterValue=customFilter, ~timeCol, - ~domain=value.domain->Belt.Option.getWithDefault(""), + ~domain=value.domain->Option.getWithDefault(""), (), )->Js.Json.stringify, ~authToken=parentToken, @@ -840,8 +836,8 @@ module SDKAnalyticsChartContext = { ->Belt.Array.keepMap( dictOrigItem => { let (key, value) = dictOrigItem - segmentValue->Belt.Option.getWithDefault([])->Array.includes(key) - ? Some(value->Js.Json.decodeString->Belt.Option.getWithDefault("")) + segmentValue->Option.getWithDefault([])->Array.includes(key) + ? Some(value->Js.Json.decodeString->Option.getWithDefault("")) : None }, ) @@ -864,7 +860,7 @@ module SDKAnalyticsChartContext = { ~customFilterValue=customFilter, ~timeCol, ~jsonFormattedFilter=item->filterMapper, - ~domain=value.domain->Belt.Option.getWithDefault(""), + ~domain=value.domain->Option.getWithDefault(""), (), )->Js.Json.stringify, ~authToken=parentToken, @@ -888,13 +884,11 @@ module SDKAnalyticsChartContext = { ->Belt.Array.keepMap( origDictArrItem => { let (key, value) = origDictArrItem - segmentValue - ->Belt.Option.getWithDefault([]) - ->Array.includes(key) + segmentValue->Option.getWithDefault([])->Array.includes(key) ? Some( value ->Js.Json.decodeString - ->Belt.Option.getWithDefault(""), + ->Option.getWithDefault(""), ) : None }, @@ -980,7 +974,7 @@ module SDKAnalyticsChartContext = { // } // let granularityConfig = - // granularity->Belt.Option.getWithDefault("")->getGranularityMapper + // granularity->Option.getWithDefault("")->getGranularityMapper // differentTimeValues // ->Array.map(timeObjOrig => { @@ -1001,7 +995,7 @@ module SDKAnalyticsChartContext = { // ~cardinality, // ~customFilterValue=customFilter, // ~jsonFormattedFilter=item->filterMapper, - // ~domain=value.domain->Belt.Option.getWithDefault(""), + // ~domain=value.domain->Option.getWithDefault(""), // (), // )->Js.Json.stringify, // ~authToken=parentToken, diff --git a/src/context/SingleStatContext.res b/src/context/SingleStatContext.res index 5311099b2..d80a41b4c 100644 --- a/src/context/SingleStatContext.res +++ b/src/context/SingleStatContext.res @@ -64,7 +64,7 @@ let make = ( ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") if prefix === moduleName && prefix !== "" { None } else { @@ -77,7 +77,7 @@ let make = ( let (topFiltersToSearchParam, customFilter, modeValue) = React.useMemo1(() => { let modeValue = Some(getTopLevelSingleStatFilter->LogicUtils.getString(modeKey, "")) let allFilterKeys = Array.concat( - [startTimeFilterKey, endTimeFilterKey, modeValue->Belt.Option.getWithDefault("")], + [startTimeFilterKey, endTimeFilterKey, modeValue->Option.getWithDefault("")], filterKeys, ) let filterSearchParam = @@ -154,7 +154,7 @@ let make = ( ) = React.useState(_ => false) React.useEffect6(() => { - if startTimeFromUrl !== "" && endTimeFromUrl !== "" && parentToken->Belt.Option.isSome { + if startTimeFromUrl !== "" && endTimeFromUrl !== "" && parentToken->Option.isSome { setIsSingleStatFetchedWithCurrentDependency(_ => false) } None @@ -169,7 +169,7 @@ let make = ( ) let filterConfigCurrent = { source, - modeValue: modeValue->Belt.Option.getWithDefault(""), + modeValue: modeValue->Option.getWithDefault(""), filterValues: ?filterValueFromUrl, startTime: startTimeFromUrl, endTime: endTimeFromUrl, @@ -277,7 +277,7 @@ let make = ( Loaded( jsonObj ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.object_(Dict.make())), + ->Option.getWithDefault(Js.Json.object_(Dict.make())), ), ) prevDict @@ -330,7 +330,7 @@ let make = ( Loaded( jsonObj ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.object_(Dict.make())), + ->Option.getWithDefault(Js.Json.object_(Dict.make())), ), ) prevDict @@ -420,9 +420,9 @@ let make = ( ->Promise.all ->Promise.thenResolve( value => { - let ssH = value->Belt.Array.get(0)->Belt.Option.getWithDefault(LoadedError) - let ssT = value->Belt.Array.get(1)->Belt.Option.getWithDefault(LoadedError) - let ssD = value->Belt.Array.get(2)->Belt.Option.getWithDefault(LoadedError) + let ssH = value->Belt.Array.get(0)->Option.getWithDefault(LoadedError) + let ssT = value->Belt.Array.get(1)->Option.getWithDefault(LoadedError) + let ssD = value->Belt.Array.get(2)->Option.getWithDefault(LoadedError) let isLoaded = val => { switch val { | Loaded(_) => true @@ -446,7 +446,7 @@ let make = ( Js.Date.now() -. individualTime ->Dict.get(index->Belt.Int.toString) - ->Belt.Option.getWithDefault(Js.Date.now()), + ->Option.getWithDefault(Js.Date.now()), ) individualTime }, diff --git a/src/context/ThemeUtils.res b/src/context/ThemeUtils.res index 8b52a9717..9987411c0 100644 --- a/src/context/ThemeUtils.res +++ b/src/context/ThemeUtils.res @@ -4,7 +4,7 @@ let useThemeFromEvent = () => { React.useEffect0(() => { let setEventThemeVal = (eventName, dict) => { if eventName === "AuthenticationDetails" { - let payloadDict = dict->Dict.get("payload")->Belt.Option.flatMap(Js.Json.decodeObject) + let payloadDict = dict->Dict.get("payload")->Option.flatMap(Js.Json.decodeObject) let theme = payloadDict->Belt.Option.mapWithDefault("", finalDict => LogicUtils.getString(finalDict, "theme", "") @@ -22,8 +22,7 @@ let useThemeFromEvent = () => { let optionalDict = HandlingEvents.getEventDict(ev) switch optionalDict { | Some(dict) => { - let optionalEventName = - dict->Dict.get("eventType")->Belt.Option.flatMap(Js.Json.decodeString) + let optionalEventName = dict->Dict.get("eventType")->Option.flatMap(Js.Json.decodeString) switch optionalEventName { | Some(eventName) => setEventThemeVal(eventName, dict) | None => Js.log2("Event Data is not found", dict) diff --git a/src/context/TokenContextProvider.res b/src/context/TokenContextProvider.res index b44156146..3a25ab1b1 100644 --- a/src/context/TokenContextProvider.res +++ b/src/context/TokenContextProvider.res @@ -32,7 +32,7 @@ let make = (~children) => { let tokenContextObjext = React.useMemo4(() => { let parentAuthInfo = HyperSwitchAuthTypes.getAuthInfo( tokenDetailsDict->LogicUtils.getJsonObjectFromDict("tokenDict"), - token->Belt.Option.getWithDefault(""), + token->Option.getWithDefault(""), ) { diff --git a/src/context/UserPrefContext.res b/src/context/UserPrefContext.res index fb731623a..7321475b2 100644 --- a/src/context/UserPrefContext.res +++ b/src/context/UserPrefContext.res @@ -55,10 +55,10 @@ let make = (~children) => { React.useEffect2(() => { if urlPathConcationation !== "/" { setUserPref(prev => { - let currentConfig = prev->Dict.get(username)->Belt.Option.getWithDefault({}) + let currentConfig = prev->Dict.get(username)->Option.getWithDefault({}) let updatedPrev = currentConfig let updatedValue = if ( - urlPathConcationation !== updatedPrev.lastVisitedTab->Belt.Option.getWithDefault("") + urlPathConcationation !== updatedPrev.lastVisitedTab->Option.getWithDefault("") ) { {...updatedPrev, lastVisitedTab: urlPathConcationation} } else { @@ -76,7 +76,7 @@ let make = (~children) => { // UPDATE THE searchParams IN LAST VISITED TAB React.useEffect2(() => { setUserPref(prev => { - let currentConfig = prev->Dict.get(username)->Belt.Option.getWithDefault({}) + let currentConfig = prev->Dict.get(username)->Option.getWithDefault({}) let updatedPrev = currentConfig let moduleWisePref = switch updatedPrev { | {moduleVisePref} => moduleVisePref @@ -85,7 +85,7 @@ let make = (~children) => { let currentModulePerf = moduleWisePref ->Dict.get(urlPathConcationation) - ->Belt.Option.getWithDefault(defaultUserModuleWisePref) + ->Option.getWithDefault(defaultUserModuleWisePref) let filteredUrlSearch = url.search @@ -133,7 +133,7 @@ let make = (~children) => { let addConfig = (key, value) => { setUserPref(prev => { - let currentConfig = prev->Dict.get(username)->Belt.Option.getWithDefault({}) + let currentConfig = prev->Dict.get(username)->Option.getWithDefault({}) let updatedPrev = currentConfig let moduleWisePref = switch updatedPrev { | {moduleVisePref} => moduleVisePref @@ -142,7 +142,7 @@ let make = (~children) => { let currentModulePerf = moduleWisePref ->Dict.get(urlPathConcationation) - ->Belt.Option.getWithDefault(defaultUserModuleWisePref) + ->Option.getWithDefault(defaultUserModuleWisePref) let moduleConfig = switch currentModulePerf { | {moduleConfig} => moduleConfig | _ => Dict.make() @@ -161,13 +161,13 @@ let make = (~children) => { } let getConfig = key => { - let currentConfig = userPref->Dict.get(username)->Belt.Option.getWithDefault({}) + let currentConfig = userPref->Dict.get(username)->Option.getWithDefault({}) let updatedPrev = currentConfig switch updatedPrev { | {moduleVisePref} => switch moduleVisePref ->Dict.get(urlPathConcationation) - ->Belt.Option.getWithDefault(defaultUserModuleWisePref) { + ->Option.getWithDefault(defaultUserModuleWisePref) { | {moduleConfig} => moduleConfig->Dict.get(key) | _ => None } @@ -187,7 +187,7 @@ let make = (~children) => { ->Js.Json.stringify let value = React.useMemo4(() => { - let currentConfig = userPref->Dict.get(username)->Belt.Option.getWithDefault({}) + let currentConfig = userPref->Dict.get(username)->Option.getWithDefault({}) let updatedPrev = currentConfig let lastVisitedTab = switch updatedPrev { | {lastVisitedTab} => lastVisitedTab diff --git a/src/entities/analytics/AnalyticsUtils.res b/src/entities/analytics/AnalyticsUtils.res index 977f0d586..da73e5ae2 100644 --- a/src/entities/analytics/AnalyticsUtils.res +++ b/src/entities/analytics/AnalyticsUtils.res @@ -449,8 +449,8 @@ let generatedeltaTablePayload = ( let dictOfDates = Belt.Array.concatMany(deltaDateArr) let tablePayload = Belt.Array.zipBy(dictOfDates, deltaPrefixArr, (x, y) => generatePayload( - ~startTime=x->Dict.get("fromTime")->Belt.Option.getWithDefault(""), - ~endTime=x->Dict.get("toTime")->Belt.Option.getWithDefault(""), + ~startTime=x->Dict.get("fromTime")->Option.getWithDefault(""), + ~endTime=x->Dict.get("toTime")->Option.getWithDefault(""), ~metrics, ~groupByNames, ~mode, diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res index 210af2a7c..a5b9d5120 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchApp.res +++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res @@ -84,14 +84,13 @@ let make = () => { let fetchInitialEnums = async () => { try { let response = await getEnumDetails(QuickStartUtils.quickStartEnumIntialArray) - let responseValueDict = - response->Js.Nullable.toOption->Belt.Option.getWithDefault(Dict.make()) + let responseValueDict = response->Js.Nullable.toOption->Option.getWithDefault(Dict.make()) let pageStateToSet = responseValueDict->QuickStartUtils.getCurrentStep setQuickStartPageState(_ => pageStateToSet->QuickStartUtils.enumToVarinatMapper) responseValueDict } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") Js.Exn.raiseError(err) } } diff --git a/src/entryPoints/hyperswitch/HyperSwitchEntry.res b/src/entryPoints/hyperswitch/HyperSwitchEntry.res index 4fbf0b835..c3e749e1b 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchEntry.res +++ b/src/entryPoints/hyperswitch/HyperSwitchEntry.res @@ -70,7 +70,7 @@ module HyperSwitchEntryComponent = { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong!") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/genericUtils/BreadCrumbNavigation.res b/src/genericUtils/BreadCrumbNavigation.res index bf5bc26d8..8ab026299 100644 --- a/src/genericUtils/BreadCrumbNavigation.res +++ b/src/genericUtils/BreadCrumbNavigation.res @@ -45,7 +45,7 @@ let make = ( showPopUp({ popUpType: (Warning, WithIcon), heading: "Heads up!", - description: {React.string(crumb.warning->Belt.Option.getWithDefault(""))}, + description: {React.string(crumb.warning->Option.getWithDefault(""))}, handleConfirm: { text: "Yes, go back", onClick: { diff --git a/src/hooks/AuthHooks.res b/src/hooks/AuthHooks.res index e8ba39e87..bd4440a0b 100644 --- a/src/hooks/AuthHooks.res +++ b/src/hooks/AuthHooks.res @@ -21,12 +21,12 @@ let getHeaders = (~uri, ~headers, ()) => { } Fetch.HeadersInit.make(headerObj) } else { - let headerObj = headers->Dict.get("api-key")->Belt.Option.getWithDefault("")->String.length > 0 + let headerObj = headers->Dict.get("api-key")->Option.getWithDefault("")->String.length > 0 if headerObj { let headerObj = { "Content-Type": "application/json", - "api-key": headers->Dict.get("api-key")->Belt.Option.getWithDefault(""), + "api-key": headers->Dict.get("api-key")->Option.getWithDefault(""), } Fetch.HeadersInit.make(headerObj) } else { @@ -35,7 +35,7 @@ let getHeaders = (~uri, ~headers, ()) => { if token !== "" { let headerObj = { "Content-Type": "application/json", - "Authorization": `Bearer ${hyperSwitchToken->Belt.Option.getWithDefault("")}`, + "Authorization": `Bearer ${hyperSwitchToken->Option.getWithDefault("")}`, "api-key": "hyperswitch", } diff --git a/src/hooks/DateRefreshHooks.res b/src/hooks/DateRefreshHooks.res index b1ea9db43..90af76fa3 100644 --- a/src/hooks/DateRefreshHooks.res +++ b/src/hooks/DateRefreshHooks.res @@ -13,8 +13,8 @@ let useConstructQueryOnBasisOfOpt = () => { try { let arrQuery = queryString->String.split("&") let tempArr = arrQuery->Array.filter(x => x->String.includes(optKey)) - let tempArr = tempArr[0]->Belt.Option.getWithDefault("")->String.split("=") - let optVal = tempArr[1]->Belt.Option.getWithDefault("") + let tempArr = tempArr[0]->Option.getWithDefault("")->String.split("=") + let optVal = tempArr[1]->Option.getWithDefault("") let customrange: customDateRange = switch optVal { | "today" => Today @@ -25,13 +25,13 @@ let useConstructQueryOnBasisOfOpt = () => { | "next_month" => NextMonth | st => { let arr = st->String.split("_") - let _ = arr[0]->Belt.Option.getWithDefault("") == "next" - let anchor = arr[2]->Belt.Option.getWithDefault("") - let val = arr[1]->Belt.Option.getWithDefault("") + let _ = arr[0]->Option.getWithDefault("") == "next" + let anchor = arr[2]->Option.getWithDefault("") + let val = arr[1]->Option.getWithDefault("") switch anchor { - | "days" => Day(val->Belt.Float.fromString->Belt.Option.getWithDefault(0.0)) - | "hours" => Hour(val->Belt.Float.fromString->Belt.Option.getWithDefault(0.0)) - | "mins" => Hour(val->Belt.Float.fromString->Belt.Option.getWithDefault(0.0) /. 60.0) + | "days" => Day(val->Belt.Float.fromString->Option.getWithDefault(0.0)) + | "hours" => Hour(val->Belt.Float.fromString->Option.getWithDefault(0.0)) + | "mins" => Hour(val->Belt.Float.fromString->Option.getWithDefault(0.0) /. 60.0) | _ => Today } } diff --git a/src/hooks/QueryHook.res b/src/hooks/QueryHook.res index 4e04b4a52..2daee2b61 100644 --- a/src/hooks/QueryHook.res +++ b/src/hooks/QueryHook.res @@ -4,8 +4,8 @@ let parseUrlIntoDict = queryUrl => { let dict: Dict.t = Dict.make() safeArray->Array.forEach(e => { dict->Dict.set( - e->Belt.Array.get(0)->Belt.Option.getWithDefault(""), - e->Belt.Array.get(1)->Belt.Option.getWithDefault(""), + e->Belt.Array.get(0)->Option.getWithDefault(""), + e->Belt.Array.get(1)->Option.getWithDefault(""), ) }) diff --git a/src/hooks/TimeZoneHook.res b/src/hooks/TimeZoneHook.res index b775df5dc..9c9543e54 100644 --- a/src/hooks/TimeZoneHook.res +++ b/src/hooks/TimeZoneHook.res @@ -64,15 +64,15 @@ let formattedISOString = (dateTimeIsoString: string, format: string) => { let tempTimeDate = tempTimeDateString->String.split("T") let time = tempTimeDate[1] let date = tempTimeDate[0] - let dateComponents = date->Belt.Option.getWithDefault("")->String.split("-") - let timeComponents = time->Belt.Option.getWithDefault("")->String.split(":") + let dateComponents = date->Option.getWithDefault("")->String.split("-") + let timeComponents = time->Option.getWithDefault("")->String.split(":") let dateTimeObject: dateTimeFloat = { - year: dateComponents[0]->Belt.Option.getWithDefault("")->stringToFloat, - month: dateComponents[1]->Belt.Option.getWithDefault("")->stringToFloat, - date: dateComponents[2]->Belt.Option.getWithDefault("")->stringToFloat, - hour: timeComponents[0]->Belt.Option.getWithDefault("")->stringToFloat, - minute: timeComponents[1]->Belt.Option.getWithDefault("")->stringToFloat, - second: timeComponents[2]->Belt.Option.getWithDefault("")->stringToFloat, + year: dateComponents[0]->Option.getWithDefault("")->stringToFloat, + month: dateComponents[1]->Option.getWithDefault("")->stringToFloat, + date: dateComponents[2]->Option.getWithDefault("")->stringToFloat, + hour: timeComponents[0]->Option.getWithDefault("")->stringToFloat, + minute: timeComponents[1]->Option.getWithDefault("")->stringToFloat, + second: timeComponents[2]->Option.getWithDefault("")->stringToFloat, } formattedDateTimeFloat(dateTimeObject, format) } @@ -83,30 +83,30 @@ let en_USStringToDateTimeObject = dateTimeIsoString => { let tempTimeDate = tempTimeDateString ->Js.String2.splitByRe(%re("/\s/")) - ->Array.map(val => val->Belt.Option.getWithDefault("")) + ->Array.map(val => val->Option.getWithDefault("")) let time = tempTimeDate[1] let date = tempTimeDate[0] - let dateComponents = date->Belt.Option.getWithDefault("")->String.split("/") - let timeComponents = time->Belt.Option.getWithDefault("")->String.split(":") - let tempHour = switch Belt.Float.fromString(timeComponents[0]->Belt.Option.getWithDefault("")) { + let dateComponents = date->Option.getWithDefault("")->String.split("/") + let timeComponents = time->Option.getWithDefault("")->String.split(":") + let tempHour = switch Belt.Float.fromString(timeComponents[0]->Option.getWithDefault("")) { | Some(a) => a | _ => 0.0 } let fullTempHour = - tempTimeDate[2]->Belt.Option.getWithDefault("") === "AM" + tempTimeDate[2]->Option.getWithDefault("") === "AM" ? tempHour === 12.0 ? 0.0 : tempHour : tempHour < 12.0 ? tempHour +. 12.0 : tempHour let hourInString = Belt.Float.toString(fullTempHour) let dateTimeObject: dateTimeString = { - year: formatter(dateComponents[2]->Belt.Option.getWithDefault("")), - month: formatter(dateComponents[0]->Belt.Option.getWithDefault("")), - date: formatter(dateComponents[1]->Belt.Option.getWithDefault("")), + year: formatter(dateComponents[2]->Option.getWithDefault("")), + month: formatter(dateComponents[0]->Option.getWithDefault("")), + date: formatter(dateComponents[1]->Option.getWithDefault("")), hour: formatter(hourInString), - minute: formatter(timeComponents[1]->Belt.Option.getWithDefault("")), - second: formatter(timeComponents[2]->Belt.Option.getWithDefault("")), + minute: formatter(timeComponents[1]->Option.getWithDefault("")), + second: formatter(timeComponents[2]->Option.getWithDefault("")), } dateTimeObject } diff --git a/src/screens/HyperSwitch/APIUtils/APIUtils.res b/src/screens/HyperSwitch/APIUtils/APIUtils.res index 8ede12ac5..641dbe13c 100644 --- a/src/screens/HyperSwitch/APIUtils/APIUtils.res +++ b/src/screens/HyperSwitch/APIUtils/APIUtils.res @@ -82,7 +82,7 @@ let getURL = ( | Some(key_id) => `api_keys/${merchantId}/${key_id}` | None => `api_keys/${merchantId}` } - | Delete => `api_keys/${merchantId}/${id->Belt.Option.getWithDefault("")}` + | Delete => `api_keys/${merchantId}/${id->Option.getWithDefault("")}` | _ => "" } | ORDERS => diff --git a/src/screens/HyperSwitch/Analytics/Analytics.res b/src/screens/HyperSwitch/Analytics/Analytics.res index 00c99e32d..ea06f4ef5 100644 --- a/src/screens/HyperSwitch/Analytics/Analytics.res +++ b/src/screens/HyperSwitch/Analytics/Analytics.res @@ -119,7 +119,7 @@ module TableWrapper = { let (_, setDefaultFilter) = Recoil.useRecoilState(AnalyticsHooks.defaultFilter) let (showTable, setShowTable) = React.useState(_ => false) let {getHeading, allColumns, defaultColumns} = tableEntity - let activeTabStr = activeTab->Belt.Option.getWithDefault([])->Array.joinWith("-") + let activeTabStr = activeTab->Option.getWithDefault([])->Array.joinWith("-") let (startTimeFilterKey, endTimeFilterKey) = dateKeys let (tableDataLoading, setTableDataLoading) = React.useState(_ => true) let (tableData, setTableData) = React.useState(_ => []->Array.map(Js.Nullable.return)) @@ -130,7 +130,7 @@ module TableWrapper = { ->Belt.Array.keepMap(item => { let (key, value) = item let keyArr = key->String.split(".") - let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("") if prefix === moduleName && prefix !== "" { None } else { @@ -140,7 +140,7 @@ module TableWrapper = { ->Dict.fromArray }, [filterValueDict]) - let allColumns = allColumns->Belt.Option.getWithDefault([]) + let allColumns = allColumns->Option.getWithDefault([]) let allFilterKeys = Array.concat([startTimeFilterKey, endTimeFilterKey], filterKeys) let topFiltersToSearchParam = React.useMemo1(() => { @@ -192,7 +192,7 @@ module TableWrapper = { let generateIDFromKeys = (keys, dict) => { keys - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.map(key => { dict->Dict.get(key) }) @@ -310,7 +310,7 @@ module TableWrapper = { }, (topFiltersToSearchParam, activeTabStr, customFilter)) let newDefaultCols = React.useMemo1(() => { activeTab - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Belt.Array.keepMap(item => { defaultColumns ->Belt.Array.keepMap( @@ -328,7 +328,7 @@ module TableWrapper = { defaultColumns ->Belt.Array.keepMap(item => { let val = item->getHeading - activeTab->Belt.Option.getWithDefault([])->Array.includes(val.key) ? Some(item) : None + activeTab->Option.getWithDefault([])->Array.includes(val.key) ? Some(item) : None }) ->Belt.Array.concat(allColumns) }, [activeTabStr]) @@ -343,7 +343,7 @@ module TableWrapper = { ("endTime", endTimeFromUrl->Js.Json.string), ]->Dict.fromArray - let filters = filterValueFromUrl->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + let filters = filterValueFromUrl->Option.getWithDefault(Dict.make()->Js.Json.object_) let defaultFilters = [ @@ -355,7 +355,7 @@ module TableWrapper = { [ ( "activeTab", - activeTab->Belt.Option.getWithDefault([])->Array.map(Js.Json.string)->Js.Json.array, + activeTab->Option.getWithDefault([])->Array.map(Js.Json.string)->Js.Json.array, ), ("filter", defaultFilters->Js.Json.object_), ]->Dict.fromArray @@ -384,7 +384,7 @@ module TableWrapper = { tableEntity colMapper tableGlobalFilter - activeTab={activeTab->Belt.Option.getWithDefault([])} + activeTab={activeTab->Option.getWithDefault([])} />
@@ -417,7 +417,7 @@ module TabDetails = { let id = activeTab - ->Belt.Option.getWithDefault(["tab"]) + ->Option.getWithDefault(["tab"]) ->Array.reduce("", (acc, tabName) => {acc->String.concat(tabName)}) let isMobileView = MatchMedia.useMobileChecker() @@ -534,7 +534,7 @@ let make = ( let (activeTav, setActiveTab) = React.useState(_ => filterValueDict->getStrArrayFromDict( `${moduleName}.tabName`, - [filteredTabKeys->Belt.Array.get(0)->Belt.Option.getWithDefault("")], + [filteredTabKeys->Belt.Array.get(0)->Option.getWithDefault("")], ) ) let setActiveTab = React.useMemo1(() => { @@ -622,7 +622,7 @@ let make = ( } None }, (startTimeVal, endTimeVal, filterBody->Js.Json.object_->Js.Json.stringify)) - let filterData = filterDataJson->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + let filterData = filterDataJson->Option.getWithDefault(Dict.make()->Js.Json.object_) let activeTab = React.useMemo1(() => { Some( @@ -641,7 +641,7 @@ let make = ( let hideFiltersDefaultValue = filterValue ->Dict.keysToArray - ->Array.filter(item => tabKeys->Array.find(key => key == item)->Belt.Option.isSome) + ->Array.filter(item => tabKeys->Array.find(key => key == item)->Option.isSome) ->Array.length < 1 let topFilterUi = switch filterDataJson { @@ -722,9 +722,7 @@ let make = ( moduleName setTotalVolume showPercentage=false - statSentiment={singleStatEntity.statSentiment->Belt.Option.getWithDefault( - Dict.make(), - )} + statSentiment={singleStatEntity.statSentiment->Option.getWithDefault(Dict.make())} />
diff --git a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res index f152cfaf6..31550c323 100644 --- a/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res +++ b/src/screens/HyperSwitch/Analytics/HSAnalyticsUtils.res @@ -16,7 +16,7 @@ let options: Js.Json.t => array> = json => { json ->getDictFromJsonObject ->getOptionalArrayFromDict("queryData") - ->Belt.Option.flatMap(arr => { + ->Option.flatMap(arr => { arr ->Array.map(dimensionObject => { let dimensionObject = dimensionObject->getDictFromJsonObject @@ -58,7 +58,7 @@ let options: Js.Json.t => array> = json => { }) ->Some }) - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) } let filterByData = (txnArr, value) => { @@ -76,7 +76,7 @@ let filterByData = (txnArr, value) => { value ->Js.Json.decodeString - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.toLowerCase ->String.includes(searchText) }) @@ -96,7 +96,7 @@ let initialFilterFields = json => { json ->getDictFromJsonObject ->getOptionalArrayFromDict("queryData") - ->Belt.Option.flatMap(arr => { + ->Option.flatMap(arr => { arr ->Belt.Array.keepMap(item => { let dimensionObject = item->getDictFromJsonObject @@ -130,7 +130,7 @@ let initialFilterFields = json => { }) ->Some }) - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) dropdownValue } diff --git a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res index a4eb1c441..541bf598d 100644 --- a/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res +++ b/src/screens/HyperSwitch/Analytics/HomePageOverview/HomePageOverviewComponent.res @@ -194,7 +194,7 @@ module SystemMetricsInsights = { showPercentage=false isHomePage=true wrapperClass="flex flex-wrap w-full h-full" - statSentiment={singleStatEntity.statSentiment->Belt.Option.getWithDefault(Dict.make())} + statSentiment={singleStatEntity.statSentiment->Option.getWithDefault(Dict.make())} /> } } diff --git a/src/screens/HyperSwitch/Analytics/HomePageOverview/PaymentsOverview/PaymentOverview.res b/src/screens/HyperSwitch/Analytics/HomePageOverview/PaymentsOverview/PaymentOverview.res index 07881b537..16b456c14 100644 --- a/src/screens/HyperSwitch/Analytics/HomePageOverview/PaymentsOverview/PaymentOverview.res +++ b/src/screens/HyperSwitch/Analytics/HomePageOverview/PaymentsOverview/PaymentOverview.res @@ -25,7 +25,7 @@ let make = () => { setTotalVolume showPercentage=false isHomePage=true - statSentiment={singleStatEntity.statSentiment->Belt.Option.getWithDefault(Dict.make())} + statSentiment={singleStatEntity.statSentiment->Option.getWithDefault(Dict.make())} wrapperClass="flex flex-wrap w-full h-full" /> } diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res index 2f799fe37..df922a8b5 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalytics.res @@ -20,7 +20,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -38,7 +38,7 @@ let make = () => { } } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res index f4e5dbf19..23a84d5c4 100644 --- a/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/PaymentsAnalytics/PaymentAnalyticsEntity.res @@ -273,7 +273,7 @@ let singleStateItemToObjMapper = json => { retries_amount_processe: dict->getFloat("retries_amount_processed", 0.0), connector_success_rate: dict->getFloat("connector_success_rate", 0.0), }) - ->Belt.Option.getWithDefault({ + ->Option.getWithDefault({ singleStateInitialValue }) } diff --git a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res index bf33bda3e..8135dc83e 100644 --- a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalytics.res @@ -20,7 +20,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -43,7 +43,7 @@ let make = () => { } } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res index 2badad227..d247529fc 100644 --- a/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/RefundsAnalytics/RefundsAnalyticsEntity.res @@ -141,7 +141,7 @@ let singleStateItemToObjMapper = json => { refund_success_count: dict->getInt("refund_success_count", 0), refund_processed_amount: dict->getFloat("refund_processed_amount", 0.0), }) - ->Belt.Option.getWithDefault({ + ->Option.getWithDefault({ singleStateInitialValue }) } diff --git a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res index e9a382017..384c02dca 100644 --- a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalytics.res @@ -128,7 +128,7 @@ module HSiwtchPaymentConfirmLatency = { ->getJsonObjectFromDict("queryData") ->getArrayFromJson([]) ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.object_(Dict.make())) + ->Option.getWithDefault(Js.Json.object_(Dict.make())) ->getDictFromJsonObject ->getInt("latency", 0) } @@ -285,7 +285,7 @@ module SystemMetricsAnalytics = { } None }, (startTimeVal, endTimeVal, filterBody->Js.Json.object_->Js.Json.stringify)) - let filterData = filterDataJson->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + let filterData = filterDataJson->Option.getWithDefault(Dict.make()->Js.Json.object_) Dict.toArray->Array.length > 0}> {switch chartEntity1 { @@ -317,7 +317,7 @@ module SystemMetricsAnalytics = { moduleName setTotalVolume showPercentage=false - statSentiment={singleStatEntity.statSentiment->Belt.Option.getWithDefault(Dict.make())} + statSentiment={singleStatEntity.statSentiment->Option.getWithDefault(Dict.make())} />
| _ => React.null @@ -346,7 +346,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res index 21cce4e0e..ca0df0048 100644 --- a/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res +++ b/src/screens/HyperSwitch/Analytics/SystemMetrics/SystemMetricsAnalyticsUtils.res @@ -26,7 +26,7 @@ let singleStateItemToObjMapper = json => { api_count: dict->getInt("api_count", 0), status_code_count: dict->getInt("status_code_count", 0), }) - ->Belt.Option.getWithDefault({ + ->Option.getWithDefault({ singleStateInitialValue }) } @@ -49,7 +49,7 @@ let singleStateSeriesItemToObjMapper = json => { let itemToObjMapper = json => { let data = json->getQueryData->Array.map(singleStateItemToObjMapper) - data->Belt.Array.get(0)->Belt.Option.getWithDefault(singleStateInitialValue) + data->Belt.Array.get(0)->Option.getWithDefault(singleStateInitialValue) } let timeSeriesObjMapper = json => diff --git a/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalytics.res b/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalytics.res index 5a709d526..fc0332dd9 100644 --- a/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalytics.res +++ b/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalytics.res @@ -25,7 +25,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -35,7 +35,7 @@ let make = () => { await loadInfo() } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res b/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res index e00bc393f..9d4358465 100644 --- a/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res +++ b/src/screens/HyperSwitch/Analytics/UserAnalytics/UserJourneyAnalyticsEntity.res @@ -30,7 +30,7 @@ let singleStatItemToObjMapper = json => { sdk_rendered_count: dict->getInt("sdk_rendered_count", 0), average_payment_time: dict->getFloat("average_payment_time", 0.0) /. 1000., }) - ->Belt.Option.getWithDefault({ + ->Option.getWithDefault({ singleStateInitialValue }) } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res index 1bb5880a4..50ddf3082 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->Belt.Array.get(1)->Belt.Option.getWithDefault("") + let connectorID = url.path->Belt.List.toArray->Belt.Array.get(1)->Option.getWithDefault("") let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Loading) let featureFlagDetails = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom @@ -50,7 +50,7 @@ let make = (~setCurrentStep, ~setInitialValues, ~initialValues, ~isUpdateFlow, ~ } catch { | Js.Exn.Error(e) => { Js.log2("FAILED TO LOAD CONNECTOR CONFIG", e) - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") setScreenState(_ => PageLoaderWrapper.Error(err)) Dict.make()->Js.Json.object_ } @@ -112,7 +112,7 @@ let make = (~setCurrentStep, ~setInitialValues, ~initialValues, ~isUpdateFlow, ~ switch Js.Exn.message(e) { | Some(message) => { let errMsg = message->parseIntoMyData - if errMsg.code->Belt.Option.getWithDefault("")->String.includes("HE_01") { + if errMsg.code->Option.getWithDefault("")->String.includes("HE_01") { showToast( ~message="This configuration already exists for the connector. Please try with a different country or label under advanced settings.", ~toastType=ToastState.ToastError, diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res index 93aa9822b..dee2edaa5 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetailsHelper.res @@ -79,13 +79,13 @@ module ErrorValidation = { let errorDict = formState.values->validate->getDictFromJsonObject let {touched} = ReactFinalForm.useField(fieldName).meta let err = touched ? errorDict->Dict.get(fieldName) : None - Belt.Option.isSome}> + Option.isSome}>
warning
- {React.string(err->Belt.Option.getWithDefault(""->Js.Json.string)->getStringFromJson(""))} + {React.string(err->Option.getWithDefault(""->Js.Json.string)->getStringFromJson(""))}
} @@ -192,7 +192,7 @@ module CashToCodeSelectBox = { wasmValues ->Array.find(ele => formValues->getString(ele, "")->String.length <= 0) - ->Belt.Option.isNone + ->Option.isNone }
@@ -364,7 +364,7 @@ module BusinessProfileRender = { ->Array.find((ele: HSwitchSettingTypes.profileEntity) => ele.profile_id === ev->Identity.formReactEventToString ) - ->Belt.Option.getWithDefault(defaultBusinessProfile) + ->Option.getWithDefault(defaultBusinessProfile) ).profile_name connectorLabelOnChange( `${selectedConnector}_${profileName}`->Identity.stringToFormReactEvent, @@ -447,7 +447,7 @@ module VerifyConnectorModal = {
- {`${verifyErrorMessage->Belt.Option.getWithDefault("")}`->React.string} + {`${verifyErrorMessage->Option.getWithDefault("")}`->React.string}
{suggestedAction} diff --git a/src/screens/HyperSwitch/Connectors/ConnectorHome.res b/src/screens/HyperSwitch/Connectors/ConnectorHome.res index be259e7db..73af2b051 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorHome.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorHome.res @@ -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->Belt.Array.get(1)->Belt.Option.getWithDefault("") + let connectorID = url.path->Belt.List.toArray->Belt.Array.get(1)->Option.getWithDefault("") let (screenState, setScreenState) = React.useState(_ => PageLoaderWrapper.Success) let (initialValues, setInitialValues) = React.useState(_ => Dict.make()->Js.Json.object_) let (currentStep, setCurrentStep) = React.useState(_ => ConnectorTypes.IntegFields) @@ -92,7 +92,7 @@ let make = (~isPayoutFlow=false, ~showStepIndicator=true, ~showBreadCrumb=true) setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") setScreenState(_ => Error(err)) } } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorList.res b/src/screens/HyperSwitch/Connectors/ConnectorList.res index ff9e2fcf5..0250e758b 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorList.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorList.res @@ -37,7 +37,7 @@ module NewProcessorCards = { let unConfiguredConnectors = connectorsAvailableForIntegration->Array.filter(total => - configuredConnectors->Array.find(item => item === total)->Belt.Option.isNone + configuredConnectors->Array.find(item => item === total)->Option.isNone ) let (showModal, setShowModal) = React.useState(_ => false) diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res index 45732743d..fc08d9674 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPaymentMethod.res @@ -51,7 +51,7 @@ let make = ( } let body = constructConnectorRequestBody(obj, initialValues)->ignoreFields( - connectorID->Belt.Option.getWithDefault(""), + connectorID->Option.getWithDefault(""), ConnectorUtils.connectorIgnoredField, ) let connectorUrl = getURL(~entityName=CONNECTOR, ~methodType=Post, ~id=connectorID, ()) @@ -66,7 +66,7 @@ let make = ( ) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") let errorCode = err->safeParse->getDictFromJsonObject->getString("code", "") let errorMessage = err->safeParse->getDictFromJsonObject->getString("message", "") diff --git a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res index 96f99b343..8228728ad 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorPreview.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorPreview.res @@ -1,7 +1,7 @@ module InfoField = { @react.component let make = (~render, ~label) => { - let str = render->Belt.Option.getWithDefault("") + let str = render->Option.getWithDefault("") String.length > 0}>
@@ -106,7 +106,7 @@ module ConnectorSummaryGrid = { ->Array.find((ele: HSwitchSettingTypes.profileEntity) => ele.profile_id === connectorInfo.profile_id ) - ->Belt.Option.getWithDefault(defaultBusinessProfile) + ->Option.getWithDefault(defaultBusinessProfile) let merchantId = HSLocalStorage.getFromMerchantDetails("merchant_id") let copyValueOfWebhookEndpoint = ConnectorUtils.getWebhooksUrl( ~connectorName={connectorInfo.merchant_connector_id}, @@ -126,7 +126,7 @@ module ConnectorSummaryGrid = { } catch { | Js.Exn.Error(e) => { Js.log2("FAILED TO LOAD CONNECTOR CONFIG", e) - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") setScreenState(_ => PageLoaderWrapper.Error(err)) Dict.make()->Js.Json.object_ } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res index 2caac21b0..c3f4e93c9 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorTableUtils.res @@ -86,7 +86,7 @@ let getPaymentMethodsEnabled: Js.Dict.t => paymentMethodEnabledType = payment_method: dict->getString("payment_method", ""), payment_method_types: dict ->Dict.get("payment_method_types") - ->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + ->Option.getWithDefault(Dict.make()->Js.Json.object_) ->getArrayDataFromJson(getPaymentMethodTypes), } } @@ -114,7 +114,7 @@ let getProcessorPayloadType = dict => { disabled: dict->getBool("disabled", true), payment_methods_enabled: dict ->Dict.get("payment_methods_enabled") - ->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + ->Option.getWithDefault(Dict.make()->Js.Json.object_) ->getArrayDataFromJson(getPaymentMethodsEnabled), profile_id: dict->getString("profile_id", ""), merchant_connector_id: dict->getString("merchant_connector_id", ""), @@ -138,7 +138,7 @@ let getConnectorNameViaId = ( ) => { connectorList ->Array.find(ele => {ele.merchant_connector_id == mca_id}) - ->Belt.Option.getWithDefault(Dict.make()->getProcessorPayloadType) + ->Option.getWithDefault(Dict.make()->getProcessorPayloadType) } let getAllPaymentMethods = (paymentMethodsArray: array) => { diff --git a/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res b/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res index 8b6980472..3a469e1d3 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorUIUtils/PaymentMethod.res @@ -6,9 +6,8 @@ let isSelectedAll = ( open ConnectorUtils let paymentMethodObj = selectedPaymentMethod->getSelectedPaymentObj(paymentMethod) switch paymentMethod->getPaymentMethodFromString { - | Card => - paymentMethodObj.card_provider->Belt.Option.getWithDefault([])->len == allPaymentMethods->len - | _ => paymentMethodObj.provider->Belt.Option.getWithDefault([])->len == allPaymentMethods->len + | Card => paymentMethodObj.card_provider->Option.getWithDefault([])->len == allPaymentMethods->len + | _ => paymentMethodObj.provider->Option.getWithDefault([])->len == allPaymentMethods->len } } @@ -34,11 +33,9 @@ module CardRenderer = { let paymentObj = paymentMethodsEnabled->getSelectedPaymentObj(paymentMethod) let standardProviders = - paymentObj.provider->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + paymentObj.provider->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) let cardProviders = - paymentObj.card_provider->Belt.Option.getWithDefault( - []->Js.Json.array->getPaymentMethodMapper, - ) + paymentObj.card_provider->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) let checkPaymentMethodType = ( obj: paymentMethodConfigType, @@ -79,16 +76,16 @@ module CardRenderer = { if val.payment_method_type === paymentMethod { switch paymentMethod->getPaymentMethodTypeFromString { | Credit | Debit => - let length = val.card_provider->Belt.Option.getWithDefault([])->len + let length = val.card_provider->Option.getWithDefault([])->len val.card_provider - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.splice(~start=0, ~remove=length, ~insert=arr) ->ignore | _ => - let length = val.provider->Belt.Option.getWithDefault([])->len + let length = val.provider->Option.getWithDefault([])->len val.provider - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.splice(~start=0, ~remove=length, ~insert=arr) ->ignore } diff --git a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res index 76564b73b..ef6983e16 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorUtils.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorUtils.res @@ -635,7 +635,7 @@ let getConnectorType = (connector, ~isPayoutFlow, ()) => { let getSelectedPaymentObj = (paymentMethodsEnabled: array, paymentMethod) => { paymentMethodsEnabled ->Array.find(item => item.payment_method_type->toLCase == paymentMethod->toLCase) - ->Belt.Option.getWithDefault({ + ->Option.getWithDefault({ payment_method: "unknown", payment_method_type: "unkonwn", }) @@ -648,7 +648,7 @@ let addMethod = (paymentMethodsEnabled, paymentMethod, method) => { pmts->Array.forEach((val: paymentMethodEnabled) => { if val.payment_method_type->toLCase === paymentMethod->toLCase { val.card_provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.push(method) } }) @@ -656,7 +656,7 @@ let addMethod = (paymentMethodsEnabled, paymentMethod, method) => { pmts->Array.forEach((val: paymentMethodEnabled) => { if val.payment_method_type->toLCase === paymentMethod->toLCase { val.provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.push(method) } }) @@ -672,12 +672,12 @@ let removeMethod = (paymentMethodsEnabled, paymentMethod, method: paymentMethodC if val.payment_method_type->toLCase === paymentMethod->toLCase { let indexOfRemovalItem = val.card_provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.map(ele => ele.payment_method_type) ->Array.indexOf(method.payment_method_type) val.card_provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.splice( ~start=indexOfRemovalItem, ~remove=1, @@ -691,12 +691,12 @@ let removeMethod = (paymentMethodsEnabled, paymentMethod, method: paymentMethodC if val.payment_method_type->toLCase === paymentMethod->toLCase { let indexOfRemovalItem = val.provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.map(ele => ele.payment_method_type) ->Array.indexOf(method.payment_method_type) val.provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.splice( ~start=indexOfRemovalItem, ~remove=1, @@ -741,7 +741,7 @@ let generateInitialValuesDict = ( dict->Dict.set( "connector_webhook_details", - connectorWebHookDetails->getOptionString("merchant_secret")->Belt.Option.isSome + connectorWebHookDetails->getOptionString("merchant_secret")->Option.isSome ? connectorWebHookDetails->Js.Json.object_ : Js.Json.null, ) @@ -898,7 +898,7 @@ let getConnectorFields = connectorDetails => { let connectorAccountDict = connectorDetails->LogicUtils.getDictFromJsonObject->LogicUtils.getDictfromDict("connector_auth") let bodyType = - connectorAccountDict->Dict.keysToArray->Belt.Array.get(0)->Belt.Option.getWithDefault("") + connectorAccountDict->Dict.keysToArray->Belt.Array.get(0)->Option.getWithDefault("") let connectorAccountFields = connectorAccountDict->LogicUtils.getDictfromDict(bodyType) let connectorMetaDataFields = connectorDetails->LogicUtils.getDictFromJsonObject->LogicUtils.getDictfromDict("metadata") @@ -927,7 +927,7 @@ let validateRequiredFiled = (valuesFlattenJson, dict, fieldName, errors) => { dict ->Dict.keysToArray ->Array.forEach(_value => { - let lastItem = fieldName->String.split(".")->Array.pop->Belt.Option.getWithDefault("") + let lastItem = fieldName->String.split(".")->Array.pop->Option.getWithDefault("") let errorKey = dict->getString(lastItem, "") let value = valuesFlattenJson->getString(`${fieldName}`, "") if value->String.length === 0 { @@ -942,29 +942,29 @@ let validate = (values, ~selectedConnector, ~dict, ~fieldName, ~isLiveMode) => { let valuesFlattenJson = values->JsonFlattenUtils.flattenObject(true) let labelArr = dict->Dict.valuesToArray selectedConnector.validate - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.forEachWithIndex((field, index) => { let key = field.name let value = valuesFlattenJson ->Dict.get(key) - ->Belt.Option.getWithDefault(""->Js.Json.string) + ->Option.getWithDefault(""->Js.Json.string) ->LogicUtils.getStringFromJson("") let regexToUse = isLiveMode ? field.liveValidationRegex : field.testValidationRegex let validationResult = switch regexToUse { | Some(regex) => regex->Js.Re.fromString->Js.Re.test_(value) | None => true } - if field.isRequired->Belt.Option.getWithDefault(true) && value->String.length === 0 { + if field.isRequired->Option.getWithDefault(true) && value->String.length === 0 { let errorLabel = labelArr ->Belt.Array.get(index) - ->Belt.Option.getWithDefault(""->Js.Json.string) + ->Option.getWithDefault(""->Js.Json.string) ->LogicUtils.getStringFromJson("") Dict.set(errors, key, `Please enter ${errorLabel}`->Js.Json.string) } else if !validationResult && value->String.length !== 0 { let expectedFormat = isLiveMode ? field.liveExpectedFormat : field.testExpectedFormat - let warningMessage = expectedFormat->Belt.Option.getWithDefault("") + let warningMessage = expectedFormat->Option.getWithDefault("") Dict.set(errors, key, warningMessage->Js.Json.string) } }) @@ -979,7 +979,7 @@ let validate = (values, ~selectedConnector, ~dict, ~fieldName, ~isLiveMode) => { let getSuggestedAction = (~verifyErrorMessage, ~connector) => { let (suggestedAction, suggestedActionExists) = { open SuggestedActionHelper - let msg = verifyErrorMessage->Belt.Option.getWithDefault("") + let msg = verifyErrorMessage->Option.getWithDefault("") switch connector->getConnectorNameTypeFromString { | STRIPE => ( { @@ -1074,7 +1074,7 @@ let useFetchConnectorList = () => { res } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") Js.Exn.raiseError(err) } } @@ -1106,11 +1106,9 @@ let defaultSelectAllCards = ( ->getPaymentMethodMapper let length = - val.card_provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) - ->len + val.card_provider->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper)->len val.card_provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.splice(~start=0, ~remove=length, ~insert=arr) } | BankTransfer | BankRedirect => { @@ -1121,9 +1119,9 @@ let defaultSelectAllCards = ( ->getPaymentMethodMapper let length = - val.provider->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper)->len + val.provider->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper)->len val.provider - ->Belt.Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) + ->Option.getWithDefault([]->Js.Json.array->getPaymentMethodMapper) ->Array.splice(~start=0, ~remove=length, ~insert=arr) } | _ => () @@ -1164,7 +1162,7 @@ let getConnectorPaymentMethodDetails = async ( ) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegration.res index 47e4e01f9..a5e8b19d1 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->Belt.Array.get(1)->Belt.Option.getWithDefault("") + let connectorID = url.path->Belt.List.toArray->Belt.Array.get(1)->Option.getWithDefault("") let merchantDetailsValue = HSwitchUtils.useMerchantDetailsValue() let merchantId = merchantDetailsValue->getDictFromJsonObject->getString("merchant_id", "") let prefix = "apple_pay_combined.simplified.session_token_data.initiative_context" diff --git a/src/screens/HyperSwitch/Connectors/Wallets/WalletHelper.res b/src/screens/HyperSwitch/Connectors/Wallets/WalletHelper.res index bcd1ea602..8faa8eea1 100644 --- a/src/screens/HyperSwitch/Connectors/Wallets/WalletHelper.res +++ b/src/screens/HyperSwitch/Connectors/Wallets/WalletHelper.res @@ -115,10 +115,10 @@ module SimplifiedHelper = {

{heading->React.string}

- Belt.Option.isSome}> + Option.isSome}>

- {subText->Belt.Option.getWithDefault("")->React.string} + {subText->Option.getWithDefault("")->React.string}

{switch customElement { diff --git a/src/screens/HyperSwitch/Customers/Customers.res b/src/screens/HyperSwitch/Customers/Customers.res index cefe6e2dc..1011886f3 100644 --- a/src/screens/HyperSwitch/Customers/Customers.res +++ b/src/screens/HyperSwitch/Customers/Customers.res @@ -17,7 +17,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Customers/ShowCustomers.res b/src/screens/HyperSwitch/Customers/ShowCustomers.res index da636d794..c1499a9e4 100644 --- a/src/screens/HyperSwitch/Customers/ShowCustomers.res +++ b/src/screens/HyperSwitch/Customers/ShowCustomers.res @@ -36,8 +36,8 @@ module CustomerInfo = { ->React.array}
- Belt.Option.isSome}> - {children->Belt.Option.getWithDefault(React.null)} + Option.isSome}> + {children->Option.getWithDefault(React.null)} } @@ -70,7 +70,7 @@ let make = (~id) => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res b/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res index bbd300d97..0300a362c 100644 --- a/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res +++ b/src/screens/HyperSwitch/Developer/APIKeys/KeyManagement.res @@ -64,7 +64,7 @@ module ApiEditModal = { let url = switch action { | Update => { - let key_id = keyId->Belt.Option.getWithDefault("") + let key_id = keyId->Option.getWithDefault("") APIUtils.getURL(~entityName=API_KEYS, ~methodType=Post, ~id=Some(key_id), ()) } diff --git a/src/screens/HyperSwitch/Developer/APIKeys/PublishableAndHashKeySection.res b/src/screens/HyperSwitch/Developer/APIKeys/PublishableAndHashKeySection.res index 86729a03f..2fa83fb4a 100644 --- a/src/screens/HyperSwitch/Developer/APIKeys/PublishableAndHashKeySection.res +++ b/src/screens/HyperSwitch/Developer/APIKeys/PublishableAndHashKeySection.res @@ -17,7 +17,7 @@ let make = () => { } catch { | Js.Exn.Error(e) => setScreenState(_ => PageLoaderWrapper.Error( - Js.Exn.message(e)->Belt.Option.getWithDefault("Error"), + Js.Exn.message(e)->Option.getWithDefault("Error"), )) } } @@ -27,7 +27,7 @@ let make = () => { None }) - let paymentResponsHashKey = merchantInfo.payment_response_hash_key->Belt.Option.getWithDefault("") + let paymentResponsHashKey = merchantInfo.payment_response_hash_key->Option.getWithDefault("")
diff --git a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettings.res index f70cfc574..91d965e2c 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->Belt.Array.get(1)->Belt.Option.getWithDefault(profileId) + let id = url.path->Belt.List.toArray->Belt.Array.get(1)->Option.getWithDefault(profileId) let businessProfileDetails = useGetBusinessProflile(id) let showToast = ToastState.useShowToast() @@ -122,7 +122,7 @@ let make = (~webhookOnly=false, ~showFormOnly=false, ~profileId="") => { /> Belt.Option.getWithDefault( + subHeading={businessProfileDetails.payment_response_hash_key->Option.getWithDefault( "NA", )} isCopy=true diff --git a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsListEntity.res b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsListEntity.res index 288aa2745..be453e52a 100644 --- a/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsListEntity.res +++ b/src/screens/HyperSwitch/Developer/PaymentSettings/PaymentSettingsListEntity.res @@ -24,8 +24,8 @@ let getHeading = colType => { let getCell = (item: profileEntity, colType): Table.cell => { switch colType { | ProfileName => Text(item.profile_name) - | ReturnUrl => Text(item.return_url->Belt.Option.getWithDefault("")) - | WebhookUrl => Text(item.webhook_details.webhook_url->Belt.Option.getWithDefault("")) + | ReturnUrl => Text(item.return_url->Option.getWithDefault("")) + | WebhookUrl => Text(item.webhook_details.webhook_url->Option.getWithDefault("")) } } diff --git a/src/screens/HyperSwitch/Disputes/Disputes.res b/src/screens/HyperSwitch/Disputes/Disputes.res index c796908fd..e0d4e3e59 100644 --- a/src/screens/HyperSwitch/Disputes/Disputes.res +++ b/src/screens/HyperSwitch/Disputes/Disputes.res @@ -23,7 +23,7 @@ let make = () => { } } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") if err->String.includes("HE_02") { setScreenState(_ => Custom) } else { diff --git a/src/screens/HyperSwitch/Disputes/ShowDisputes.res b/src/screens/HyperSwitch/Disputes/ShowDisputes.res index cbccaf3e9..93f259feb 100644 --- a/src/screens/HyperSwitch/Disputes/ShowDisputes.res +++ b/src/screens/HyperSwitch/Disputes/ShowDisputes.res @@ -76,8 +76,8 @@ module DisputesInfo = { ->React.array}
- Belt.Option.isSome}> - {children->Belt.Option.getWithDefault(React.null)} + Option.isSome}> + {children->Option.getWithDefault(React.null)} } @@ -111,7 +111,7 @@ let make = (~id) => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res index 2e99c03c8..bb44ccde3 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMConfigure.res @@ -11,7 +11,7 @@ let make = () => { 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->Belt.Array.get(1)->Belt.Option.getWithDefault("") + let frmID = url.path->Belt.List.toArray->Belt.Array.get(1)->Option.getWithDefault("") let initStep = PaymentMethods diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res index 078a776f7..825cdee7c 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMIntegrationFields.res @@ -75,7 +75,7 @@ module IntegrationFieldsForm = { let value = valuesFlattenJson ->Dict.get(key) - ->Belt.Option.getWithDefault(""->Js.Json.string) + ->Option.getWithDefault(""->Js.Json.string) ->LogicUtils.getStringFromJson("") if field.isRequired && value->String.length === 0 { @@ -135,7 +135,7 @@ module IntegrationFieldsForm = { ~name={field.name}, ~placeholder=field.placeholder, ~customInput=field.inputType, - ~description=field.description->Belt.Option.getWithDefault(""), + ~description=field.description->Option.getWithDefault(""), ~isRequired=true, ~parse, ~format?, @@ -216,7 +216,7 @@ let make = ( let frmID = retrivedValues - ->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + ->Option.getWithDefault(Dict.make()->Js.Json.object_) ->LogicUtils.getDictFromJsonObject ->LogicUtils.getString("merchant_connector_id", "") diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res b/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res index 816b532a9..c082f77ae 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res @@ -331,7 +331,7 @@ let make = (~setCurrentStep, ~retrivedValues=None, ~setInitialValues, ~isUpdateF open FRMInfo open FRMUtils open LogicUtils - let initialValues = retrivedValues->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + let initialValues = retrivedValues->Option.getWithDefault(Dict.make()->Js.Json.object_) let onSubmit = (values, _) => { open Promise diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res b/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res index 223e05663..76e90ab5e 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMSelect.res @@ -6,7 +6,7 @@ module NewProcessorCards = { let frmAvailableForIntegration = frmList let unConfiguredFRMs = frmAvailableForIntegration->Array.filter(total => - configuredFRMs->Array.find(item => item === total)->Belt.Option.isNone + configuredFRMs->Array.find(item => item === total)->Option.isNone ) let handleClick = frmName => { diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMUtils.res b/src/screens/HyperSwitch/FraudAndRisk/FRMUtils.res index 5c65033d7..759d52e50 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMUtils.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMUtils.res @@ -5,16 +5,16 @@ open FRMTypes @val external atob: string => string = "atob" let leadingSpaceStrParser = (. ~value, ~name as _) => { - let str = value->Js.Json.decodeString->Belt.Option.getWithDefault("") + let str = value->Js.Json.decodeString->Option.getWithDefault("") str->String.replaceRegExp(%re("/^[\s]+/"), "")->Js.Json.string } let base64Parse = (. ~value, ~name as _) => { - value->Js.Json.decodeString->Belt.Option.getWithDefault("")->btoa->Js.Json.string + value->Js.Json.decodeString->Option.getWithDefault("")->btoa->Js.Json.string } let base64Format = (. ~value, ~name as _) => { - value->Js.Json.decodeString->Belt.Option.getWithDefault("")->atob->Js.Json.string + value->Js.Json.decodeString->Option.getWithDefault("")->atob->Js.Json.string } let toggleDefaultStyle = "mb-2 relative inline-flex flex-shrink-0 h-6 w-12 border-2 rounded-full transition-colors ease-in-out duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 items-center" @@ -43,7 +43,7 @@ let generateInitialValuesDict = (~selectedFRMInfo, ~isLiveMode, ()) => { let parseFRMConfig = json => { json ->Js.Json.decodeArray - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->ConnectorTableUtils.convertFRMConfigJsonToObj } @@ -94,7 +94,7 @@ let updateConfigDict = (configDict, connectorName, paymentMethodsDict) => { updatePaymentMethodsDict( prevPaymentMethodsDict, pmName, - paymentMethodsDict->Dict.get(pmName)->Belt.Option.getWithDefault([]), + paymentMethodsDict->Dict.get(pmName)->Option.getWithDefault([]), ) ) @@ -143,7 +143,7 @@ let generateFRMPaymentMethodsConfig = paymentMethodsDict => { let paymentMethodTypesArr = paymentMethodsDict ->Dict.get(paymentMethodName) - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.map(paymentMethodType => { { payment_method_type: paymentMethodType, diff --git a/src/screens/HyperSwitch/HSLocalStorage.res b/src/screens/HyperSwitch/HSLocalStorage.res index 74a139812..39ddf5166 100644 --- a/src/screens/HyperSwitch/HSLocalStorage.res +++ b/src/screens/HyperSwitch/HSLocalStorage.res @@ -1,13 +1,12 @@ let getInfoFromLocalStorage = (~lStorageKey) => { let stringifiedJson = - LocalStorage.getItem(lStorageKey)->Js.Nullable.toOption->Belt.Option.getWithDefault("") + LocalStorage.getItem(lStorageKey)->Js.Nullable.toOption->Option.getWithDefault("") stringifiedJson->LogicUtils.safeParse->LogicUtils.getDictFromJsonObject } let getBooleanFromLocalStorage = (~key) => { - let stringifiedJson = - LocalStorage.getItem(key)->Js.Nullable.toOption->Belt.Option.getWithDefault("") + let stringifiedJson = LocalStorage.getItem(key)->Js.Nullable.toOption->Option.getWithDefault("") stringifiedJson->LogicUtils.safeParse->LogicUtils.getBoolFromJson(false) } diff --git a/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res b/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res index 39770af54..f0a5c5fa5 100644 --- a/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res +++ b/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res @@ -3,7 +3,7 @@ let getUserTimeZoneString = () => { ->Js.Date.toTimeString ->String.split(" ") ->Belt.Array.get(1) - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") } let getUserTimeZone = () => { diff --git a/src/screens/HyperSwitch/HSwitchRemoteFilter.res b/src/screens/HyperSwitch/HSwitchRemoteFilter.res index 05b0ad11b..fafea607a 100644 --- a/src/screens/HyperSwitch/HSwitchRemoteFilter.res +++ b/src/screens/HyperSwitch/HSwitchRemoteFilter.res @@ -6,7 +6,7 @@ type filterBody = { let isStringNonEmpty = str => str->String.length > 0 let getDateValue = (key, ~getModuleFilters) => { - getModuleFilters->Dict.get(key)->Belt.Option.getWithDefault("") + getModuleFilters->Dict.get(key)->Option.getWithDefault("") } let formateDateString = date => { @@ -221,7 +221,7 @@ module RemoteTableFilters = { } None }, (startTimeVal, endTimeVal, filterBody->Js.Json.object_->Js.Json.stringify)) - let filterData = filterDataJson->Belt.Option.getWithDefault(Dict.make()->Js.Json.object_) + let filterData = filterDataJson->Option.getWithDefault(Dict.make()->Js.Json.object_) React.useEffect1(() => { if filterValueJson->Dict.keysToArray->Array.length != 0 { @@ -234,7 +234,7 @@ module RemoteTableFilters = { let remoteFilters = filterData->initialFilters let initialDisplayFilters = remoteFilters->Array.filter((item: EntityType.initialFilters<'t>) => - item.localFilter->Js.Option.isSome + item.localFilter->Option.isSome ) let remoteOptions = [] @@ -246,7 +246,7 @@ module RemoteTableFilters = { filterValue ->Dict.keysToArray ->Array.filter(item => - [startTimeFilterKey, endTimeFilterKey]->Array.find(key => key == item)->Belt.Option.isNone + [startTimeFilterKey, endTimeFilterKey]->Array.find(key => key == item)->Option.isNone ) ->Array.length > 0 ) diff --git a/src/screens/HyperSwitch/HSwitchUtils.res b/src/screens/HyperSwitch/HSwitchUtils.res index deb4836e0..57d56c10a 100644 --- a/src/screens/HyperSwitch/HSwitchUtils.res +++ b/src/screens/HyperSwitch/HSwitchUtils.res @@ -52,7 +52,7 @@ let setMerchantDetails = (key, value) => { localStorageData->Dict.set(key, value) "merchant"->LocalStorage.setItem( - localStorageData->Js.Json.stringifyAny->Belt.Option.getWithDefault(""), + localStorageData->Js.Json.stringifyAny->Option.getWithDefault(""), ) } @@ -60,9 +60,7 @@ let setMerchantDetails = (key, value) => { let setUserDetails = (key, value) => { let localStorageData = getInfoFromLocalStorage(~lStorageKey="user") localStorageData->Dict.set(key, value) - "user"->LocalStorage.setItem( - localStorageData->Js.Json.stringifyAny->Belt.Option.getWithDefault(""), - ) + "user"->LocalStorage.setItem(localStorageData->Js.Json.stringifyAny->Option.getWithDefault("")) } let getSearchOptionsForProcessors = (~processorList, ~getNameFromString) => { let searchOptionsForProcessors = @@ -98,8 +96,8 @@ let useMerchantDetailsValue = () => let getClientCountry = clientTimeZone => { Country.country - ->Array.find(item => item.timeZones->Array.find(i => i == clientTimeZone)->Belt.Option.isSome) - ->Belt.Option.getWithDefault(Country.defaultTimeZone) + ->Array.find(item => item.timeZones->Array.find(i => i == clientTimeZone)->Option.isSome) + ->Option.getWithDefault(Country.defaultTimeZone) } let getBrowswerDetails = () => { @@ -130,7 +128,7 @@ module BackgroundImageWrapper = { ~isBackgroundFullScreen=true, ) => { let heightWidthCss = isBackgroundFullScreen ? "h-screen w-screen" : "h-full w-full" - Belt.Option.isSome}> + Option.isSome}>
- {children->Belt.Option.getWithDefault(React.null)} + {children->Option.getWithDefault(React.null)}
} diff --git a/src/screens/HyperSwitch/Helpers/HelperComponents.res b/src/screens/HyperSwitch/Helpers/HelperComponents.res index 9df6b03cd..277bc7520 100644 --- a/src/screens/HyperSwitch/Helpers/HelperComponents.res +++ b/src/screens/HyperSwitch/Helpers/HelperComponents.res @@ -62,8 +62,7 @@ module BluredTableComponent = { let dummyTableValue = Belt.Array.make(5, dummyTableValueDict) - let subTitle = - moduleSubtitle->Belt.Option.isSome ? moduleSubtitle->Belt.Option.getWithDefault("") : "" + let subTitle = moduleSubtitle->Option.isSome ? moduleSubtitle->Option.getWithDefault("") : ""
diff --git a/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res b/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res index 4267a689d..216e9f14b 100644 --- a/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res +++ b/src/screens/HyperSwitch/Home/CommonConnectorFlow/ConfigureConnector.res @@ -42,7 +42,7 @@ let make = (~connectProcessorValue: connectProcessor) => { setQuickStartPageState(_ => ConnectProcessor(CHECKOUT)) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to update!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to update!") Js.Exn.raiseError(err) } } @@ -92,7 +92,7 @@ let make = (~connectProcessorValue: connectProcessor) => { setButtonState(_ => Normal) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to update!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to update!") Js.Exn.raiseError(err) } } @@ -118,7 +118,7 @@ let make = (~connectProcessorValue: connectProcessor) => { let _ = await StringEnumType(connectorChoiceValue)->usePostEnumDetails(configurationType) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to update!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to update!") Js.Exn.raiseError(err) } } @@ -154,7 +154,7 @@ let make = (~connectProcessorValue: connectProcessor) => { let updateTestPaymentEnum = async (~paymentId) => { try { let paymentBody: paymentType = { - payment_id: paymentId->Belt.Option.getWithDefault("pay_default"), + payment_id: paymentId->Option.getWithDefault("pay_default"), } let _ = await PaymentType(paymentBody)->usePostEnumDetails(#TestPayment) setQuickStartPageState(_ => IntegrateApp(LANDING)) diff --git a/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res b/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res index 72216d207..327f451f4 100644 --- a/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res +++ b/src/screens/HyperSwitch/Home/CommonConnectorFlow/QuickStartConnectorFlow.res @@ -99,7 +99,7 @@ let make = ( ) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") showToast(~message=err, ~toastType=ToastError, ()) setButtonState(_ => Normal) } diff --git a/src/screens/HyperSwitch/Home/HomeUtils.res b/src/screens/HyperSwitch/Home/HomeUtils.res index ffc1a1119..ec37e0ce6 100644 --- a/src/screens/HyperSwitch/Home/HomeUtils.res +++ b/src/screens/HyperSwitch/Home/HomeUtils.res @@ -380,7 +380,7 @@ let responseDataMapper = (res: Js.Json.t) => { arrayFromJson->Array.forEach(value => { let value1 = value->getDictFromJsonObject - let key = value1->Dict.keysToArray->Belt.Array.get(0)->Belt.Option.getWithDefault("") + let key = value1->Dict.keysToArray->Belt.Array.get(0)->Option.getWithDefault("") resDict->Dict.set(key, value1->getValueMapped(key)) }) resDict diff --git a/src/screens/HyperSwitch/Home/HomeV2.res b/src/screens/HyperSwitch/Home/HomeV2.res index 017c068aa..35b353a8a 100644 --- a/src/screens/HyperSwitch/Home/HomeV2.res +++ b/src/screens/HyperSwitch/Home/HomeV2.res @@ -87,12 +87,12 @@ module QuickStart = { let firstConnectorValue = typedConnectorValue ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(getProcessorPayloadType(Dict.make())) + ->Option.getWithDefault(getProcessorPayloadType(Dict.make())) let secondConnectorValue = typedConnectorValue ->Belt.Array.get(1) - ->Belt.Option.getWithDefault(getProcessorPayloadType(Dict.make())) + ->Option.getWithDefault(getProcessorPayloadType(Dict.make())) let bodyOfFirstConnector: QuickStartTypes.processorType = { processorID: firstConnectorValue.merchant_connector_id, @@ -128,7 +128,7 @@ module QuickStart = { let firstConnectorValue = typedConnectorValue ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(getProcessorPayloadType(Dict.make())) + ->Option.getWithDefault(getProcessorPayloadType(Dict.make())) let bodyOfFirstConnector: QuickStartTypes.processorType = { processorID: firstConnectorValue.merchant_connector_id, diff --git a/src/screens/HyperSwitch/Home/QuickStart/QuickStartUIUtils.res b/src/screens/HyperSwitch/Home/QuickStart/QuickStartUIUtils.res index a226dee78..fdeb48537 100644 --- a/src/screens/HyperSwitch/Home/QuickStart/QuickStartUIUtils.res +++ b/src/screens/HyperSwitch/Home/QuickStart/QuickStartUIUtils.res @@ -17,11 +17,11 @@ module BaseComponent = {
Belt.Option.isNone && headerLeftIcon->String.length > 0}> + condition={customIcon->Option.isNone && headerLeftIcon->String.length > 0}> - Belt.Option.isSome}> - {customIcon->Belt.Option.getWithDefault(React.null)} + Option.isSome}> + {customIcon->Option.getWithDefault(React.null)}

{headerText->React.string}

@@ -88,9 +88,9 @@ module VerticalChoiceTile = { className={`p-6 flex flex-col gap-8 rounded-md cursor-pointer ${items.variantType->getBlockColor} rounded-md justify-between`} onClick={_ => setChoiceState(_ => items.variantType)}>
- Belt.Option.isSome}> + Option.isSome}> Belt.Option.getWithDefault("hyperswitch-short")} + name={items.leftIcon->Option.getWithDefault("hyperswitch-short")} size=40 className="cursor-pointer" /> @@ -105,10 +105,10 @@ module VerticalChoiceTile = {

{items.displayText->React.string}

{items.description->React.string}

- Belt.Option.isSome}> + Option.isSome}>
{items.footerTags - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.map(value =>
@@ -164,8 +164,8 @@ module HorizontalChoiceTile = { />
Belt.Option.getWithDefault("")->String.length > 0}> - Belt.Option.getWithDefault("")} /> + condition={items.imageLink->Option.getWithDefault("")->String.length > 0}> + Option.getWithDefault("")} />

{items.description->React.string}

diff --git a/src/screens/HyperSwitch/Hooks/EnumVariantHook.res b/src/screens/HyperSwitch/Hooks/EnumVariantHook.res index 6150886da..df57815c1 100644 --- a/src/screens/HyperSwitch/Hooks/EnumVariantHook.res +++ b/src/screens/HyperSwitch/Hooks/EnumVariantHook.res @@ -18,7 +18,7 @@ let useFetchEnumDetails = () => { Js.Nullable.return(responseDict) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") Js.Exn.raiseError(err) } } @@ -77,7 +77,7 @@ let usePostEnumDetails = () => { Js.Nullable.return(updatedRecoilValueDict) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") Js.Exn.raiseError(err) } } diff --git a/src/screens/HyperSwitch/MixpanelHook.res b/src/screens/HyperSwitch/MixpanelHook.res index 8fe68cad8..5a2741289 100644 --- a/src/screens/HyperSwitch/MixpanelHook.res +++ b/src/screens/HyperSwitch/MixpanelHook.res @@ -60,7 +60,7 @@ let useSendEvent = () => { ~method_=Fetch.Post, ~bodyStr=`data=${body ->Js.Json.stringifyAny - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->Js.Global.encodeURI}`, (), ) diff --git a/src/screens/HyperSwitch/Order/OrderEntity.res b/src/screens/HyperSwitch/Order/OrderEntity.res index a77d40741..b9ee9f712 100644 --- a/src/screens/HyperSwitch/Order/OrderEntity.res +++ b/src/screens/HyperSwitch/Order/OrderEntity.res @@ -263,7 +263,7 @@ let refundMetaitemToObjMapper = dict => { } let getRefundMetaData: Js.Json.t => refundMetaData = json => { - json->Js.Json.decodeObject->Belt.Option.getWithDefault(Dict.make())->refundMetaitemToObjMapper + json->Js.Json.decodeObject->Option.getWithDefault(Dict.make())->refundMetaitemToObjMapper } let refunditemToObjMapper = dict => { @@ -683,11 +683,9 @@ let getCellForOtherDetails = (order, aboutPaymentColType, _): Table.cell => { | StatementDescriptorName => Text(order.statement_descriptor_name) | StatementDescriptorSuffix => Text(order.statement_descriptor_suffix) | PaymentExperience => Text(order.payment_experience) - | FirstName => Text(splittedName->Belt.Array.get(0)->Belt.Option.getWithDefault("")) + | FirstName => Text(splittedName->Belt.Array.get(0)->Option.getWithDefault("")) | LastName => - Text( - splittedName->Belt.Array.get(splittedName->Array.length - 1)->Belt.Option.getWithDefault(""), - ) + Text(splittedName->Belt.Array.get(splittedName->Array.length - 1)->Option.getWithDefault("")) | Phone => Text(order.phone) | Email => Text(order.email) | CustomerId => Text(order.customer_id) diff --git a/src/screens/HyperSwitch/Order/OrderRefundForm.res b/src/screens/HyperSwitch/Order/OrderRefundForm.res index 6e86e4516..3de8b2d9f 100644 --- a/src/screens/HyperSwitch/Order/OrderRefundForm.res +++ b/src/screens/HyperSwitch/Order/OrderRefundForm.res @@ -67,7 +67,7 @@ let make = ( values ->Js.Json.decodeObject ->Belt.Option.map(Dict.toArray) - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Belt.Array.keepMap(entry => { let (key, value) = entry switch value->Js.Json.classify { @@ -78,19 +78,19 @@ let make = ( }) ->Dict.fromArray ["amount"]->Array.forEach(key => { - if Dict.get(valuesDict, key)->Js.Option.isNone { + if Dict.get(valuesDict, key)->Option.isNone { Dict.set(errors, key, "Required"->Js.Json.string) } }) let amountValue = Dict.get(valuesDict, "amount") - switch amountValue->Belt.Option.flatMap(Js.Json.decodeNumber) { + switch amountValue->Option.flatMap(Js.Json.decodeNumber) { | Some(floatVal) => if floatVal > amoutAvailableToRefund { let amountSplitArr = Js.Float.toFixedWithPrecision(amoutAvailableToRefund, ~digits=2)->String.split(".") let decimal = if amountSplitArr->Array.length > 1 { - amountSplitArr[1]->Belt.Option.getWithDefault("") + amountSplitArr[1]->Option.getWithDefault("") } else { "00" } diff --git a/src/screens/HyperSwitch/Order/OrderUIUtils.res b/src/screens/HyperSwitch/Order/OrderUIUtils.res index 0465df385..b936f8fc7 100644 --- a/src/screens/HyperSwitch/Order/OrderUIUtils.res +++ b/src/screens/HyperSwitch/Order/OrderUIUtils.res @@ -230,13 +230,13 @@ let getOrdersList = async ( let data = res->LogicUtils.getDictFromJsonObject->LogicUtils.getArrayFromDict("data", []) let total = res->getDictFromJsonObject->getInt("total_count", 0) - if data->Array.length === 0 && filterValueJson->Dict.get("payment_id")->Belt.Option.isSome { + if data->Array.length === 0 && filterValueJson->Dict.get("payment_id")->Option.isSome { let payment_id = filterValueJson ->Dict.get("payment_id") - ->Belt.Option.getWithDefault(""->Js.Json.string) + ->Option.getWithDefault(""->Js.Json.string) ->Js.Json.decodeString - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") if Js.Re.test_(%re(`/^[A-Za-z0-9]+_[A-Za-z0-9]+_[0-9]+/`), payment_id) { let newID = payment_id->String.replaceRegExp(%re("/_[0-9]$/g"), "") diff --git a/src/screens/HyperSwitch/Order/Orders.res b/src/screens/HyperSwitch/Order/Orders.res index 57adea0d9..195476ca1 100644 --- a/src/screens/HyperSwitch/Order/Orders.res +++ b/src/screens/HyperSwitch/Order/Orders.res @@ -24,7 +24,7 @@ let make = (~previewOnly=false) => { let defaultValue: LoadedTable.pageDetails = {offset: 0, resultsPerPage: 10} let pageDetailDict = Recoil.useRecoilValueFromAtom(LoadedTable.table_pageDetails) - let pageDetail = pageDetailDict->Dict.get("Orders")->Belt.Option.getWithDefault(defaultValue) + let pageDetail = pageDetailDict->Dict.get("Orders")->Option.getWithDefault(defaultValue) let (offset, setOffset) = React.useState(_ => pageDetail.offset) let {generateReport} = HyperswitchAtom.featureFlagAtom->Recoil.useRecoilValueFromAtom diff --git a/src/screens/HyperSwitch/Order/ShowOrder.res b/src/screens/HyperSwitch/Order/ShowOrder.res index 7467c9df7..2ebc10866 100644 --- a/src/screens/HyperSwitch/Order/ShowOrder.res +++ b/src/screens/HyperSwitch/Order/ShowOrder.res @@ -597,7 +597,7 @@ module FraudRiskBanner = { onClick={_ => { refElement.current ->Js.Nullable.toOption - ->Belt.Option.forEach(input => + ->Option.forEach(input => input->scrollIntoView(_, {behavior: "smooth", block: "start", inline: "nearest"}) ) }}> @@ -806,7 +806,7 @@ let make = (~id) => { Js.Json.stringifyAny - ->Belt.Option.getWithDefault("")} + ->Option.getWithDefault("")} overrideBackgroundColor="bg-white" />
diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res index a84e29d02..8b32d8925 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -40,10 +40,10 @@ module PrettyPrintJson = {
String.length > 0}> {<> - Belt.Option.isSome}> + Option.isSome}>

- {headerText->Belt.Option.getWithDefault("")->React.string} + {headerText->Option.getWithDefault("")->React.string}

{copyParsedJson}
@@ -67,7 +67,7 @@ module PrettyPrintJson = { String.length === 0}>

- {headerText->Belt.Option.getWithDefault("")->React.string} + {headerText->Option.getWithDefault("")->React.string}

{"Failed to load!"->React.string} @@ -94,7 +94,7 @@ module ApiDetailsComponent = { ~logsDataLength, ) => { let headerStyle = "text-fs-13 font-medium text-grey-700 break-all" - let logType = paymentDetailsValue->Dict.get("request_id")->Belt.Option.isSome ? Payment : Sdk + let logType = paymentDetailsValue->Dict.get("request_id")->Option.isSome ? Payment : Sdk let apiName = switch logType { | Payment => paymentDetailsValue->getString("api_flow", "default value")->camelCaseToTitle | Sdk => paymentDetailsValue->getString("event_name", "default value") @@ -234,7 +234,7 @@ let make = (~paymentId, ~createdAt) => { let initialData = paymentLogsArray ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.null) + ->Option.getWithDefault(Js.Json.null) ->getDictFromJsonObject let intialValueRequest = initialData->getString("request", "") @@ -246,7 +246,7 @@ let make = (~paymentId, ~createdAt) => { setScreenState1(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState1(_ => PageLoaderWrapper.Error(err)) } } @@ -334,10 +334,7 @@ let make = (~paymentId, ~createdAt) => { // setting initial data let initialData = - sdkLogsArray - ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.null) - ->getDictFromJsonObject + sdkLogsArray->Belt.Array.get(0)->Option.getWithDefault(Js.Json.null)->getDictFromJsonObject let intialValueRequest = initialData->getString("event_name", "") let intialValueResponse = initialData->getString("response", "") @@ -348,7 +345,7 @@ let make = (~paymentId, ~createdAt) => { setScreenState2(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState2(_ => PageLoaderWrapper.Error(err)) } } @@ -364,7 +361,7 @@ let make = (~paymentId, ~createdAt) => { } } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") setScreenState1(_ => PageLoaderWrapper.Error(err)) setScreenState2(_ => PageLoaderWrapper.Error(err)) } diff --git a/src/screens/HyperSwitch/PaymentMethodListType.res b/src/screens/HyperSwitch/PaymentMethodListType.res index 848562f50..698eab49d 100644 --- a/src/screens/HyperSwitch/PaymentMethodListType.res +++ b/src/screens/HyperSwitch/PaymentMethodListType.res @@ -25,8 +25,8 @@ open LogicUtils let getPaymentExperience = (dict, str) => { dict ->Dict.get(str) - ->Belt.Option.flatMap(Js.Json.decodeArray) - ->Belt.Option.getWithDefault([]) + ->Option.flatMap(Js.Json.decodeArray) + ->Option.getWithDefault([]) ->Belt.Array.keepMap(Js.Json.decodeObject) ->Array.map(json => { { @@ -43,8 +43,8 @@ let getPaymentExperience = (dict, str) => { let getBankNames = (dict, str) => { dict ->Dict.get(str) - ->Belt.Option.flatMap(Js.Json.decodeArray) - ->Belt.Option.getWithDefault([]) + ->Option.flatMap(Js.Json.decodeArray) + ->Option.getWithDefault([]) ->Belt.Array.keepMap(Js.Json.decodeObject) ->Array.map(json => { { @@ -57,7 +57,7 @@ let getBankNames = (dict, str) => { let getAchConnectors = (dict, str) => { dict ->Dict.get(str) - ->Belt.Option.flatMap(Js.Json.decodeObject) - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.flatMap(Js.Json.decodeObject) + ->Option.getWithDefault(Dict.make()) ->getStrArray("elligible_connectors") } diff --git a/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res b/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res index bfd877eb0..d61d054a9 100644 --- a/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res +++ b/src/screens/HyperSwitch/PostLoginScreen/PostLoginScreen.res @@ -107,7 +107,7 @@ let make = () => { setDashboardPageState(_ => #AUTO_CONNECTOR_INTEGRATION) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") if err->String.includes("UR_19") { showToast(~toastType=ToastWarning, ~message="Please login again!", ~autoClose=false, ()) setAuthStatus(LoggedOut) @@ -158,7 +158,7 @@ let make = () => { setCarouselDirection currentQuestionDict={questionForSurvey ->Belt.Array.get(currentStep) - ->Belt.Option.getWithDefault(defaultValueForQuestions)} + ->Option.getWithDefault(defaultValueForQuestions)} /> diff --git a/src/screens/HyperSwitch/Recon/Recon.res b/src/screens/HyperSwitch/Recon/Recon.res index 0e8406f40..027a77543 100644 --- a/src/screens/HyperSwitch/Recon/Recon.res +++ b/src/screens/HyperSwitch/Recon/Recon.res @@ -43,7 +43,7 @@ let make = () => { } } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to fetch Token!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to fetch Token!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Refunds/Refund.res b/src/screens/HyperSwitch/Refunds/Refund.res index 88f575dc4..750b1bd95 100644 --- a/src/screens/HyperSwitch/Refunds/Refund.res +++ b/src/screens/HyperSwitch/Refunds/Refund.res @@ -12,7 +12,7 @@ let make = () => { let (filters, setFilters) = React.useState(_ => None) let defaultValue: LoadedTable.pageDetails = {offset: 0, resultsPerPage: 10} let pageDetailDict = Recoil.useRecoilValueFromAtom(LoadedTable.table_pageDetails) - let pageDetail = pageDetailDict->Dict.get("Refunds")->Belt.Option.getWithDefault(defaultValue) + let pageDetail = pageDetailDict->Dict.get("Refunds")->Option.getWithDefault(defaultValue) let (offset, setOffset) = React.useState(_ => pageDetail.offset) React.useEffect3(() => { diff --git a/src/screens/HyperSwitch/Refunds/RefundHook.res b/src/screens/HyperSwitch/Refunds/RefundHook.res index 7a65c185c..91f3b3c00 100644 --- a/src/screens/HyperSwitch/Refunds/RefundHook.res +++ b/src/screens/HyperSwitch/Refunds/RefundHook.res @@ -15,7 +15,7 @@ let useGetRefundData = (refundId, setScreenState) => { } } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res b/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res index 578ca6eb4..5d6f04be5 100644 --- a/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res +++ b/src/screens/HyperSwitch/Routing/AdvancedRouting/RoutingPreviewer.res @@ -68,8 +68,7 @@ module RulePreviewer = { ->Array.mapWithIndex((rule, index) => { let headingText = `Rule ${string_of_int(index + 1)}` let marginStyle = index === ruleInfo.rules->Array.length - 1 ? "mt-2" : "my-2" - let threeDsType = - rule.routingOutput->Belt.Option.getWithDefault(defaultThreeDsObjectValue) + let threeDsType = rule.routingOutput->Option.getWithDefault(defaultThreeDsObjectValue)

diff --git a/src/screens/HyperSwitch/Routing/DefaultRouting.res b/src/screens/HyperSwitch/Routing/DefaultRouting.res index 250001539..4b67777b8 100644 --- a/src/screens/HyperSwitch/Routing/DefaultRouting.res +++ b/src/screens/HyperSwitch/Routing/DefaultRouting.res @@ -25,7 +25,7 @@ let make = () => { let connectorList = profileList ->Belt.Array.get(0) - ->Belt.Option.getWithDefault(Js.Json.null) + ->Option.getWithDefault(Js.Json.null) ->LogicUtils.getDictFromJsonObject ->LogicUtils.getArrayFromDict("connectors", []) if connectorList->Array.length > 0 { @@ -50,7 +50,7 @@ let make = () => { settingUpConnectorsState(routingRespArray) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -81,7 +81,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") setScreenState(_ => PageLoaderWrapper.Error(err)) }->ignore } diff --git a/src/screens/HyperSwitch/Routing/PriorityRouting.res b/src/screens/HyperSwitch/Routing/PriorityRouting.res index 20592a4a4..65229b779 100644 --- a/src/screens/HyperSwitch/Routing/PriorityRouting.res +++ b/src/screens/HyperSwitch/Routing/PriorityRouting.res @@ -57,7 +57,7 @@ module SimpleRoutingView = { setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) }->ignore } @@ -259,7 +259,7 @@ let make = (~routingRuleId, ~isActive) => { setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Routing/RoutingConfigure.res b/src/screens/HyperSwitch/Routing/RoutingConfigure.res index ef43fffcf..4416fe671 100644 --- a/src/screens/HyperSwitch/Routing/RoutingConfigure.res +++ b/src/screens/HyperSwitch/Routing/RoutingConfigure.res @@ -21,7 +21,7 @@ let make = (~routingType) => { let isActive = LogicUtils.getDictFromUrlSearchParams(searchParams) ->Dict.get("isActive") - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->LogicUtils.getBoolFromString(false) setIsActive(_ => isActive) None diff --git a/src/screens/HyperSwitch/Routing/RoutingStack.res b/src/screens/HyperSwitch/Routing/RoutingStack.res index a7fa81374..da0d951b4 100644 --- a/src/screens/HyperSwitch/Routing/RoutingStack.res +++ b/src/screens/HyperSwitch/Routing/RoutingStack.res @@ -51,7 +51,7 @@ let make = (~remainingPath, ~previewOnly=false) => { configuredRules ->Js.Json.array ->Js.Json.decodeArray - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Belt.Array.keepMap(Js.Json.decodeObject) ->Array.map(HistoryEntity.itemToObjMapper) @@ -77,7 +77,7 @@ let make = (~remainingPath, ~previewOnly=false) => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -108,7 +108,7 @@ let make = (~remainingPath, ~previewOnly=false) => { } } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/Routing/RoutingUtils.res b/src/screens/HyperSwitch/Routing/RoutingUtils.res index 0a4f4067a..b76b0bfba 100644 --- a/src/screens/HyperSwitch/Routing/RoutingUtils.res +++ b/src/screens/HyperSwitch/Routing/RoutingUtils.res @@ -116,7 +116,7 @@ let itemBodyGateWayObjMapper = ( dict->getDictfromDict("connector")->getString("merchant_connector_id", "") let name = connectorList - ->Belt.Option.getWithDefault([Dict.make()->ConnectorTableUtils.getProcessorPayloadType]) + ->Option.getWithDefault([Dict.make()->ConnectorTableUtils.getProcessorPayloadType]) ->ConnectorTableUtils.getConnectorNameViaId(merchantConnectorId) let newDict = [ @@ -281,7 +281,7 @@ let generateStatement = (arr, wasm) => { let statementDict = Dict.make() arr->Array.forEachWithIndex((item, index) => { let valueRes = - item->getDictFromJsonObject->Dict.get("value")->Belt.Option.getWithDefault([]->Js.Json.array) + item->getDictFromJsonObject->Dict.get("value")->Option.getWithDefault([]->Js.Json.array) if valueRes->checkIfValuePresesent { let value = item->getDictFromJsonObject->advanceRoutingConditionMapper(wasm) @@ -292,8 +292,7 @@ let generateStatement = (arr, wasm) => { let copyDict = Js.Dict.map((. val) => val, conditionDict) Dict.set(statementDict, Belt.Int.toString(index), copyDict) conditionDict->Dict.set("condition", []->Js.Json.array) - let val = - conditionDict->Dict.get("condition")->Belt.Option.getWithDefault([]->Js.Json.array) + let val = conditionDict->Dict.get("condition")->Option.getWithDefault([]->Js.Json.array) let arr = switch Js.Json.classify(val) { | JSONArray(arr) => { arr->Array.push(value) @@ -305,8 +304,7 @@ let generateStatement = (arr, wasm) => { } | _ => - let val = - conditionDict->Dict.get("condition")->Belt.Option.getWithDefault([]->Js.Json.array) + let val = conditionDict->Dict.get("condition")->Option.getWithDefault([]->Js.Json.array) let arr = switch Js.Json.classify(val) { | JSONArray(arr) => { arr->Array.push(value) @@ -512,16 +510,14 @@ module SaveAndActivateButton = { try { let onSubmitResponse = await onSubmit(formState.values, false) let currentActivatedFromJson = - onSubmitResponse->Js.Nullable.toOption->Belt.Option.getWithDefault(Js.Json.null) + onSubmitResponse->Js.Nullable.toOption->Option.getWithDefault(Js.Json.null) let currentActivatedId = currentActivatedFromJson->LogicUtils.getDictFromJsonObject->LogicUtils.getString("id", "") let _ = await handleActivateConfiguration(Some(currentActivatedId)) } catch { | Js.Exn.Error(e) => let _err = - Js.Exn.message(e)->Belt.Option.getWithDefault( - "Failed to save and activate configuration!", - ) + Js.Exn.message(e)->Option.getWithDefault("Failed to save and activate configuration!") } }
- {if requestedPlatform->Belt.Option.isSome { + {if requestedPlatform->Option.isSome { } else {
diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res index 41d200c24..a651f349c 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboarding.res @@ -73,9 +73,7 @@ let make = () => { let url = RescriptReactRouter.useUrl() let searchParams = url.search let filtersFromUrl = - LogicUtils.getDictFromUrlSearchParams(searchParams) - ->Dict.get("type") - ->Belt.Option.getWithDefault("") + LogicUtils.getDictFromUrlSearchParams(searchParams)->Dict.get("type")->Option.getWithDefault("") let (currentRoute, setCurrentRoute) = React.useState(_ => OnboardingDefault) let { integrationDetails, @@ -149,7 +147,7 @@ let make = () => { setDashboardPageState(_ => #HOME) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") Js.Exn.raiseError(err) } } diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res index 0bfebfccb..ce67883ac 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res @@ -36,7 +36,7 @@ module PaymentResponseHashKeyArea = { let detail = merchantDetailsValue->MerchantAccountUtils.getMerchantDetails Belt.Option.getWithDefault("")} + copyValue={detail.payment_response_hash_key->Option.getWithDefault("")} /> } } @@ -399,9 +399,9 @@ module LandingPageTileForIntegrateDocs = { setDashboardPageState, } = React.useContext(GlobalProvider.defaultContext) let redirect = () => { - if customRedirection->Belt.Option.isSome { + if customRedirection->Option.isSome { RescriptReactRouter.replace( - `${HSwitchGlobalVars.hyperSwitchFEPrefix}/${customRedirection->Belt.Option.getWithDefault( + `${HSwitchGlobalVars.hyperSwitchFEPrefix}/${customRedirection->Option.getWithDefault( "", )}?type=${url}`, ) @@ -440,21 +440,21 @@ module LandingPageTileForIntegrateDocs = { } else { }} - Belt.Option.isSome}> - {rightIcon->Belt.Option.getWithDefault(React.null)} + Option.isSome}> + {rightIcon->Option.getWithDefault(React.null)} {leftSection}

{headerText->React.string}

- Belt.Option.isSome}> -

{subText->Belt.Option.getWithDefault("")->React.string}

+ Option.isSome}> +

{subText->Option.getWithDefault("")->React.string}

- Belt.Option.isSome}> + Option.isSome}>
{subTextCustomValues - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.mapWithIndex((val, index) => {
string_of_int} className=subTextCss> {val->React.string}
}) @@ -530,34 +530,30 @@ module Section = { headerIcon=subSectionValue.headerIcon customIconCss=subSectionValue.customIconCss url=subSectionValue.url - displayFrontendLang={subSectionValue.displayFrontendLang->Belt.Option.getWithDefault( - "", - )} - displayBackendLang={subSectionValue.displayBackendLang->Belt.Option.getWithDefault( - "", - )} + displayFrontendLang={subSectionValue.displayFrontendLang->Option.getWithDefault("")} + displayBackendLang={subSectionValue.displayBackendLang->Option.getWithDefault("")} /> : string_of_int} headerIcon=subSectionValue.headerIcon - headerText={subSectionValue.headerText->Belt.Option.getWithDefault("")} + headerText={subSectionValue.headerText->Option.getWithDefault("")} subText=subSectionValue.subText buttonText=subSectionValue.buttonText customIconCss=subSectionValue.customIconCss url=subSectionValue.url - isIconImg={subSectionValue.isIconImg->Belt.Option.getWithDefault(false)} - imagePath={subSectionValue.imagePath->Belt.Option.getWithDefault("")} + isIconImg={subSectionValue.isIconImg->Option.getWithDefault(false)} + imagePath={subSectionValue.imagePath->Option.getWithDefault("")} leftSection={Belt.Option.getWithDefault("")} - backendLang={subSectionValue.backEndLang->Belt.Option.getWithDefault("")} + frontendLang={subSectionValue.frontEndLang->Option.getWithDefault("")} + backendLang={subSectionValue.backEndLang->Option.getWithDefault("")} />} isFromOnboardingChecklist subTextCustomValues=subSectionValue.subTextCustomValues - buttonType={subSectionValue.buttonType->Belt.Option.getWithDefault(Secondary)} - isSkipButton={subSectionValue.isSkipButton->Belt.Option.getWithDefault(false)} - isTileVisible={subSectionValue.isTileVisible->Belt.Option.getWithDefault(true)} + buttonType={subSectionValue.buttonType->Option.getWithDefault(Secondary)} + isSkipButton={subSectionValue.isSkipButton->Option.getWithDefault(false)} + isTileVisible={subSectionValue.isTileVisible->Option.getWithDefault(true)} rightIcon={subSectionValue.rightIcon} - customRedirection={customRedirection->Belt.Option.getWithDefault("")} + customRedirection={customRedirection->Option.getWithDefault("")} /> }) ->React.array} diff --git a/src/screens/HyperSwitch/Settings/BusinessDetails.res b/src/screens/HyperSwitch/Settings/BusinessDetails.res index 7d46b2b58..8e28649e1 100644 --- a/src/screens/HyperSwitch/Settings/BusinessDetails.res +++ b/src/screens/HyperSwitch/Settings/BusinessDetails.res @@ -72,7 +72,7 @@ let make = () => { let accountUrl = getURL(~entityName=MERCHANT_ACCOUNT, ~methodType=Post, ~id=uid, ()) let merchantDetails = await updateDetails( accountUrl, - values->getSettingsPayload(uid->Belt.Option.getWithDefault("")), + values->getSettingsPayload(uid->Option.getWithDefault("")), Post, ) setFormState(_ => Preview) diff --git a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res index 96b893e65..8e6d1f671 100644 --- a/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res +++ b/src/screens/HyperSwitch/Settings/BusinessMapping/BusinessMappingUtils.res @@ -62,7 +62,7 @@ let validateForm = ( let profileName = valuesDict->getUserEnteredProfileDetails item.profile_name === profileName }) - ->Belt.Option.isSome + ->Option.isSome ) { errors->Dict.set( "profile_name", diff --git a/src/screens/HyperSwitch/Settings/HSwitchSettings.res b/src/screens/HyperSwitch/Settings/HSwitchSettings.res index 8de37017a..f82409402 100644 --- a/src/screens/HyperSwitch/Settings/HSwitchSettings.res +++ b/src/screens/HyperSwitch/Settings/HSwitchSettings.res @@ -113,11 +113,11 @@ module PersonalSettings = { key={string_of_int(index)} heading={sections.heading} subHeading={sections.subHeading} - redirect={sections.redirect->Belt.Option.getWithDefault("")} - isComingSoon={sections.isComingSoon->Belt.Option.getWithDefault(false)} - buttonText={sections.buttonText->Belt.Option.getWithDefault("Add Details")} + redirect={sections.redirect->Option.getWithDefault("")} + isComingSoon={sections.isComingSoon->Option.getWithDefault(false)} + buttonText={sections.buttonText->Option.getWithDefault("Add Details")} redirectUrl={sections.redirectUrl} - isApiCall={sections.isApiCall->Belt.Option.getWithDefault(false)} + isApiCall={sections.isApiCall->Option.getWithDefault(false)} cardName={sections.cardName} /> ) diff --git a/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res b/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res index d8b504a83..d66fcfb75 100644 --- a/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res +++ b/src/screens/HyperSwitch/Settings/MerchantAccountUtils.res @@ -259,7 +259,7 @@ let getSettingsPayload = (values: Js.Json.t, merchantId) => { valuesDict->getOptionString("primary_contact_person"), ) let primaryEmail = valuesDict->getOptionString("primary_email") - if primaryEmail->Belt.Option.getWithDefault("")->String.length > 0 { + if primaryEmail->Option.getWithDefault("")->String.length > 0 { merchantDetailsValue->setOptionString("primary_email", primaryEmail) } merchantDetailsValue->setOptionString( @@ -271,7 +271,7 @@ let getSettingsPayload = (values: Js.Json.t, merchantId) => { valuesDict->getOptionString("secondary_contact_person"), ) let secondaryEmail = valuesDict->getOptionString("secondary_email") - if secondaryEmail->Belt.Option.getWithDefault("")->String.length > 0 { + if secondaryEmail->Option.getWithDefault("")->String.length > 0 { merchantDetailsValue->setOptionString( "secondary_email", valuesDict->getOptionString("secondary_email"), @@ -355,7 +355,7 @@ let checkValueChange = (~initialDict, ~valuesDict) => { initialValue !== updatedValue }) - key->Belt.Option.isSome || updatedKeys > initialKeys + key->Option.isSome || updatedKeys > initialKeys } let validateEmptyValue = (key, errors) => { @@ -462,7 +462,7 @@ let getValueFromBusinessProfile = businessProfileValue => { ->getArrayFromJson([]) ->Js.Array2.reverseInPlace ->convertObjectToType - businessDetails->Belt.Array.get(0)->Belt.Option.getWithDefault(defaultValueForBusinessProfile) + businessDetails->Belt.Array.get(0)->Option.getWithDefault(defaultValueForBusinessProfile) } let useGetBusinessProflile = profileId => { @@ -470,7 +470,7 @@ let useGetBusinessProflile = profileId => { ->Recoil.useRecoilValueFromAtom ->getArrayOfBusinessProfile ->Array.find(profile => profile.profile_id == profileId) - ->Belt.Option.getWithDefault(defaultValueForBusinessProfile) + ->Option.getWithDefault(defaultValueForBusinessProfile) } module BusinessProfile = { @@ -504,7 +504,7 @@ let useFetchBusinessProfiles = () => { Js.Nullable.return(stringifiedResponse->getValueFromBusinessProfile) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") Js.Exn.raiseError(err) } } diff --git a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccountUtils.res b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccountUtils.res index 822b5b35e..d08a0ceff 100644 --- a/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccountUtils.res +++ b/src/screens/HyperSwitch/SetupAccount/HSwitchSetupAccountUtils.res @@ -21,7 +21,7 @@ let constructBody = (~connectorName, ~json, ~profileId) => { open ConnectorUtils let connectorAccountDict = json->getDictFromJsonObject->getDictfromDict("connector_auth") let bodyType = - connectorAccountDict->Dict.keysToArray->Belt.Array.get(0)->Belt.Option.getWithDefault("") + connectorAccountDict->Dict.keysToArray->Belt.Array.get(0)->Option.getWithDefault("") let connectorAccountDetails = [("auth_type", bodyType->Js.Json.string), ("api_key", "test"->Js.Json.string)] diff --git a/src/screens/HyperSwitch/Sidebar/Sidebar.res b/src/screens/HyperSwitch/Sidebar/Sidebar.res index 43581b21b..7de7f5fae 100644 --- a/src/screens/HyperSwitch/Sidebar/Sidebar.res +++ b/src/screens/HyperSwitch/Sidebar/Sidebar.res @@ -77,7 +77,7 @@ module SidebarItem = { let make = (~tabInfo, ~isSelected, ~isExpanded) => { let sidebarItemRef = React.useRef(Js.Nullable.null) let {getSearchParamByLink} = React.useContext(UserPrefContext.userPrefContext) - let getSearchParamByLink = link => getSearchParamByLink(Js.String.substr(link, ~from=0)) + let getSearchParamByLink = link => getSearchParamByLink(String.substringToEnd(link, ~start=0)) let selectedClass = if isSelected { "border-l-2 rounded-sm border-white bg-light_white" @@ -116,7 +116,7 @@ module SidebarItem = { | RemoteLink(tabOption) => { let {name, icon, link, access, ?remoteIcon} = tabOption - let (remoteUi, link) = if remoteIcon->Belt.Option.getWithDefault(false) { + let (remoteUi, link) = if remoteIcon->Option.getWithDefault(false) { (, link) } else { (React.null, `${link}${getSearchParamByLink(link)}`) @@ -145,9 +145,9 @@ module SidebarItem = { Belt.Option.getWithDefault(26)} + size={iconSize->Option.getWithDefault(26)} name=iconTag - className={`ml-2 ${iconStyles->Belt.Option.getWithDefault("w-26 h-26")}`} + className={`ml-2 ${iconStyles->Option.getWithDefault("w-26 h-26")}`} />
@@ -202,12 +202,12 @@ module NestedSidebarItem = { onClick={_ => isMobileView ? setIsSidebarExpanded(_ => false) : ()} className={`${textColor} relative overflow-hidden flex flex-row items-center cursor-pointer rounded-lg ${paddingClass} ${selectedClass}`}> - Belt.Option.isSome && isSideBarExpanded}> + Option.isSome && isSideBarExpanded}>
Belt.Option.getWithDefault(26)} - name={iconTag->Belt.Option.getWithDefault("")} - className={iconStyles->Belt.Option.getWithDefault("w-26 h-26")} + size={iconSize->Option.getWithDefault(26)} + name={iconTag->Option.getWithDefault("")} + className={iconStyles->Option.getWithDefault("w-26 h-26")} />
@@ -324,7 +324,7 @@ module SidebarNestedSection = { let (isSectionExpanded, setIsSectionExpanded) = React.useState(_ => false) let (isElementShown, setIsElementShown) = React.useState(_ => false) - let isAnySubItemSelected = section.links->Array.find(isSubLevelItemSelected)->Js.Option.isSome + let isAnySubItemSelected = section.links->Array.find(isSubLevelItemSelected)->Option.isSome React.useEffect2(() => { if isSectionExpanded { diff --git a/src/screens/HyperSwitch/Sidebar/SidebarProvider.res b/src/screens/HyperSwitch/Sidebar/SidebarProvider.res index d2b008212..a14fa6524 100644 --- a/src/screens/HyperSwitch/Sidebar/SidebarProvider.res +++ b/src/screens/HyperSwitch/Sidebar/SidebarProvider.res @@ -3,9 +3,7 @@ open ProviderTypes let setIsSidebarDetails = (key, value) => { let localStorageData = HSLocalStorage.getInfoFromLocalStorage(~lStorageKey="sidebar") localStorageData->Dict.set(key, value) - "sidebar"->LocalStorage.setItem( - localStorageData->Js.Json.stringifyAny->Belt.Option.getWithDefault(""), - ) + "sidebar"->LocalStorage.setItem(localStorageData->Js.Json.stringifyAny->Option.getWithDefault("")) } let getFromSidebarDetails = key => { diff --git a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res index 5f582e9d7..33a12c2d4 100644 --- a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res +++ b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypal.res @@ -53,7 +53,7 @@ let make = () => { let enums = (await getEnumDetails(QuickStartUtils.quickStartEnumIntialArray)) ->Js.Nullable.toOption - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getWithDefault(Dict.make()) ->Js.Json.object_ ->QuickStartUtils.getTypedValueFromDict diff --git a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res index 9673d120c..d89fc5128 100644 --- a/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res +++ b/src/screens/HyperSwitch/StripePlusPaypal/StripePlusPaypalUIUtils.res @@ -35,7 +35,7 @@ module SelectPaymentMethods = { let _ = await StringEnumType(connectorChoiceValue)->postEnumDetails(configurationType) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to update!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to update!") Js.Exn.raiseError(err) } } diff --git a/src/screens/HyperSwitch/Surcharge/Surcharge.res b/src/screens/HyperSwitch/Surcharge/Surcharge.res index 7adf8b665..7a9273ba2 100644 --- a/src/screens/HyperSwitch/Surcharge/Surcharge.res +++ b/src/screens/HyperSwitch/Surcharge/Surcharge.res @@ -2,14 +2,14 @@ module ActiveRulePreview = { open LogicUtils @react.component let make = (~initialRule) => { - let rule = initialRule->Belt.Option.getWithDefault(Dict.make()) + let rule = initialRule->Option.getWithDefault(Dict.make()) let name = rule->getString("name", "") let description = rule->getString("description", "") let ruleInfo = rule->getDictfromDict("algorithm")->SurchargeUtils.ruleInfoTypeMapper - Belt.Option.isSome}> + Option.isSome}>
@@ -41,7 +41,7 @@ module ConfigureSurchargeRule = { let addRule = (index, _copy) => { let existingRules = ruleInput.value->LogicUtils.getArrayFromJson([]) - let newRule = existingRules[index]->Belt.Option.getWithDefault(Js.Json.null) + let newRule = existingRules[index]->Option.getWithDefault(Js.Json.null) let newRules = existingRules->Array.concat([newRule]) ruleInput.onChange(newRules->Identity.arrayOfGenericTypeToFormReactEvent) } @@ -55,7 +55,7 @@ module ConfigureSurchargeRule = {
{ let notFirstRule = ruleInput.value->LogicUtils.getArrayFromJson([])->Array.length > 1 - let rule = ruleInput.value->Js.Json.decodeArray->Belt.Option.getWithDefault([]) + let rule = ruleInput.value->Js.Json.decodeArray->Option.getWithDefault([]) let keyExtractor = (index, _rule, isDragging) => { let id = {`algorithm.rules[${string_of_int(index)}]`} { setInitialRule(_ => Some(intitialValue)) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") Js.Exn.raiseError(err) } } @@ -148,7 +148,7 @@ let make = () => { setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") if err->String.includes("HE_02") { setShowWarning(_ => false) setPageView(_ => LANDING) @@ -177,7 +177,7 @@ let make = () => { setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") showToast(~message=err, ~toastType=ToastError, ()) } Js.Nullable.null @@ -190,7 +190,7 @@ let make = () => { RoutingUtils.validateNameAndDescription(~dict, ~errors) - switch dict->Dict.get("algorithm")->Belt.Option.flatMap(Js.Json.decodeObject) { + switch dict->Dict.get("algorithm")->Option.flatMap(Js.Json.decodeObject) { | Some(jsonDict) => { let rules = jsonDict->LogicUtils.getArrayFromDict("rules", []) if rules->Array.length === 0 { diff --git a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res index c6e897dce..6b0cfa79c 100644 --- a/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res +++ b/src/screens/HyperSwitch/ThreeDSFlow/HSwitchThreeDS.res @@ -5,7 +5,7 @@ module ActiveRulePreview = { open LogicUtils @react.component let make = (~initialRule) => { - let ruleInfo = initialRule->Belt.Option.getWithDefault(Dict.make()) + let ruleInfo = initialRule->Option.getWithDefault(Dict.make()) let name = ruleInfo->getString("name", "") let description = ruleInfo->getString("description", "") @@ -15,7 +15,7 @@ module ActiveRulePreview = { ->getDictFromJsonObject ->AdvancedRoutingUtils.ruleInfoTypeMapper - Belt.Option.isSome}> + Option.isSome}>
@@ -46,7 +46,7 @@ module Configure3DSRule = { }, [rules]) let addRule = (index, _copy) => { let existingRules = ruleInput.value->LogicUtils.getArrayFromJson([]) - let newRule = existingRules[index]->Belt.Option.getWithDefault(Js.Json.null) + let newRule = existingRules[index]->Option.getWithDefault(Js.Json.null) let newRules = existingRules->Array.concat([newRule]) ruleInput.onChange(newRules->Identity.arrayOfGenericTypeToFormReactEvent) } @@ -60,7 +60,7 @@ module Configure3DSRule = {
{ let notFirstRule = ruleInput.value->LogicUtils.getArrayFromJson([])->Array.length > 1 - let rule = ruleInput.value->Js.Json.decodeArray->Belt.Option.getWithDefault([]) + let rule = ruleInput.value->Js.Json.decodeArray->Option.getWithDefault([]) let keyExtractor = (index, _rule, isDragging) => { let id = {`algorithm.rules[${string_of_int(index)}]`} let i = 1 @@ -141,7 +141,7 @@ let make = () => { setInitialRule(_ => Some(intitialValue)) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") Js.Exn.raiseError(err) } } @@ -154,7 +154,7 @@ let make = () => { setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Something went wrong") + let err = Js.Exn.message(e)->Option.getWithDefault("Something went wrong") if err->String.includes("HE_02") { setShowWarning(_ => false) setPageView(_ => LANDING) @@ -176,7 +176,7 @@ let make = () => { let filtersFromUrl = LogicUtils.getDictFromUrlSearchParams(searchParams) ->Dict.get("type") - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") setPageView(_ => filtersFromUrl->pageStateMapper) None }, [url.search]) @@ -195,7 +195,7 @@ let make = () => { setScreenState(_ => Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => Error(err)) } Js.Nullable.null @@ -208,7 +208,7 @@ let make = () => { RoutingUtils.validateNameAndDescription(~dict, ~errors) - switch dict->Dict.get("algorithm")->Belt.Option.flatMap(Js.Json.decodeObject) { + switch dict->Dict.get("algorithm")->Option.flatMap(Js.Json.decodeObject) { | Some(jsonDict) => { let index = 1 let rules = jsonDict->LogicUtils.getArrayFromDict("rules", []) diff --git a/src/screens/HyperSwitch/UserManagement/InviteUsers.res b/src/screens/HyperSwitch/UserManagement/InviteUsers.res index 9823d77ac..d0f3b9eb2 100644 --- a/src/screens/HyperSwitch/UserManagement/InviteUsers.res +++ b/src/screens/HyperSwitch/UserManagement/InviteUsers.res @@ -154,7 +154,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } @@ -162,10 +162,10 @@ let make = () => { let getRoleInfo = permissionInfoValue => { let roleTypeValue = roleDict->Dict.get(roleTypeValue) - if roleTypeValue->Belt.Option.isNone { + if roleTypeValue->Option.isNone { getRoleForUser(permissionInfoValue)->ignore } else { - settingUpValues(roleTypeValue->Belt.Option.getWithDefault(Js.Json.null), permissionInfoValue) + settingUpValues(roleTypeValue->Option.getWithDefault(Js.Json.null), permissionInfoValue) } } diff --git a/src/screens/HyperSwitch/UserManagement/ShowUserData.res b/src/screens/HyperSwitch/UserManagement/ShowUserData.res index 51e1a4459..25cb48519 100644 --- a/src/screens/HyperSwitch/UserManagement/ShowUserData.res +++ b/src/screens/HyperSwitch/UserManagement/ShowUserData.res @@ -91,7 +91,7 @@ let make = () => { setScreenState(_ => PageLoaderWrapper.Success) } catch { | Js.Exn.Error(e) => - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Failed to Fetch!") + let err = Js.Exn.message(e)->Option.getWithDefault("Failed to Fetch!") setScreenState(_ => PageLoaderWrapper.Error(err)) } } diff --git a/src/screens/HyperSwitch/UserManagement/UserManagementUtils.res b/src/screens/HyperSwitch/UserManagement/UserManagementUtils.res index df86cacda..1b069e741 100644 --- a/src/screens/HyperSwitch/UserManagement/UserManagementUtils.res +++ b/src/screens/HyperSwitch/UserManagement/UserManagementUtils.res @@ -37,7 +37,7 @@ let validateForm = (values, ~fieldsToValidate: array) => { key->validateEmptyValue(errors) } else { value->Array.forEach(ele => { - if ele->Js.Json.decodeString->Belt.Option.getWithDefault("")->HSwitchUtils.isValidEmail { + if ele->Js.Json.decodeString->Option.getWithDefault("")->HSwitchUtils.isValidEmail { errors->Dict.set("email", "Please enter a valid email"->Js.Json.string) } }) @@ -77,7 +77,7 @@ let getArrayOfPermissionData = json => { json ->LogicUtils.getDictFromJsonObject ->LogicUtils.getArrayFromDict("permissions", []) - ->Array.map(i => i->Js.Json.decodeString->Belt.Option.getWithDefault("")) + ->Array.map(i => i->Js.Json.decodeString->Option.getWithDefault("")) } let updatePresentInInfoList = (infoData, permissionsData) => { diff --git a/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res b/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res index 702b4874d..d1f2efd82 100644 --- a/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res +++ b/src/screens/HyperSwitch/Utils/HSSelfServeSidebar.res @@ -60,7 +60,7 @@ let make = (~heading, ~sidebarOptions: array=[]) => { RescriptReactRouter.replace(sidebarOption.link) } } - let subOptionsArray = sidebarOption.subOptions->Belt.Option.getWithDefault([]) + let subOptionsArray = sidebarOption.subOptions->Option.getWithDefault([])
string_of_int} className={`p-6 border-y border-gray-200 cursor-pointer ${background}`} diff --git a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res index d6e8f24ab..4b62a0045 100644 --- a/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res +++ b/src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res @@ -1,7 +1,7 @@ let matchInSearchOption = (searchOptions, searchText, name, link, ~sectionName, ()) => { open LogicUtils searchOptions - ->Belt.Option.getWithDefault([]) + ->Option.getWithDefault([]) ->Array.filter(item => { let (searchKey, _redirection) = item checkStringStartsWithSubstring(~itemToCheck=searchKey, ~searchText) @@ -274,7 +274,7 @@ let make = () => { {elementsArray ->Array.mapWithIndex((item, index) => { let elementValue = - item->Js.Json.decodeString->Belt.Option.getWithDefault("") + item->Js.Json.decodeString->Option.getWithDefault("") String.length > 0} key={index->string_of_int}> diff --git a/src/screens/componentsDemo/DragNDropDemo.res b/src/screens/componentsDemo/DragNDropDemo.res index 8025ee767..fd7697d0c 100644 --- a/src/screens/componentsDemo/DragNDropDemo.res +++ b/src/screens/componentsDemo/DragNDropDemo.res @@ -49,7 +49,7 @@ type props = { let default = (props: props) => { let {listItems, setListItems, keyExtractor} = props - let isHorizontal = props.isHorizontal->Belt.Option.getWithDefault(true) + let isHorizontal = props.isHorizontal->Option.getWithDefault(true) let onDragEnd = result => { // dropped outside the list diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res index 84c29b58e..ebb0c5c45 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuth.res @@ -154,7 +154,7 @@ let make = (~setAuthStatus: HyperSwitchAuthTypes.authStatus => unit, ~authType, } | (_, ResetPassword) => { let queryDict = url.search->getDictFromUrlSearchParams - let password_reset_token = queryDict->Dict.get("token")->Belt.Option.getWithDefault("") + let password_reset_token = queryDict->Dict.get("token")->Option.getWithDefault("") let password = getString(valuesDict, "create_password", "") let body = getResetpasswordBodyJson(password, password_reset_token) setResetPassword(body) diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res index bf399c79a..d8231829d 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res @@ -108,7 +108,7 @@ let getEmailBody = (email, ~country=?, ()) => { let parseResponseJson = (~json, ~email) => { open HSwitchUtils open LogicUtils - let valuesDict = json->Js.Json.decodeObject->Belt.Option.getWithDefault(Dict.make()) + let valuesDict = json->Js.Json.decodeObject->Option.getWithDefault(Dict.make()) // * Setting all local storage values setMerchantDetails( @@ -126,7 +126,7 @@ let parseResponseJson = (~json, ~email) => { // ) let verificationValue = - valuesDict->getOptionInt("verification_days_left")->Belt.Option.getWithDefault(-1) + valuesDict->getOptionInt("verification_days_left")->Option.getWithDefault(-1) setMerchantDetails("verification", verificationValue->Belt.Int.toString->Js.Json.string) valuesDict->getString("token", "") diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res index dc412e9b3..f67d10895 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchEmailVerifyScreen.res @@ -1,10 +1,7 @@ let generateBody = (url: RescriptReactRouter.url) => { let body = Dict.make() let val = - url.search - ->LogicUtils.getDictFromUrlSearchParams - ->Dict.get("token") - ->Belt.Option.getWithDefault("") + url.search->LogicUtils.getDictFromUrlSearchParams->Dict.get("token")->Option.getWithDefault("") body->Dict.set("token", val->Js.Json.string) body->Js.Json.object_ @@ -28,7 +25,7 @@ let make = (~setAuthType, ~setAuthStatus, ~authType) => { let email = res ->Js.Json.decodeObject - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getWithDefault(Dict.make()) ->LogicUtils.getString("email", "") let token = HyperSwitchAuthUtils.parseResponseJson(~json=res, ~email) if !(token->isEmptyString) && !(email->isEmptyString) { @@ -41,7 +38,7 @@ let make = (~setAuthType, ~setAuthStatus, ~authType) => { } } catch { | Js.Exn.Error(e) => { - let err = Js.Exn.message(e)->Belt.Option.getWithDefault("Verification Failed") + let err = Js.Exn.message(e)->Option.getWithDefault("Verification Failed") setErrorMessage(_ => err) setAuthStatus(LoggedOut) } diff --git a/src/server/Server.res b/src/server/Server.res index 027f06090..73d4c35e3 100644 --- a/src/server/Server.res +++ b/src/server/Server.res @@ -44,7 +44,7 @@ external execSync: (string, encodeType) => string = "execSync" @val external nullableGitCommitStr: option = "GIT_COMMIT_HASH" -let currentCommitHash = nullableGitCommitStr->Belt.Option.getWithDefault("no-commit-hash") +let currentCommitHash = nullableGitCommitStr->Option.getWithDefault("no-commit-hash") let serverHandler: Http.serverHandler = (request, response) => { open Belt.Option @@ -58,7 +58,7 @@ let serverHandler: Http.serverHandler = (request, response) => { if path === "/config/merchant-access" && request.method === "POST" { let path = - env->Dict.get("configPath")->Belt.Option.getWithDefault("dist/server/config/FeatureFlag.json") + env->Dict.get("configPath")->Option.getWithDefault("dist/server/config/FeatureFlag.json") Promise.make((resolve, _reject) => { configHandler(request, response, true, path) ()->resolve(. _) @@ -120,10 +120,7 @@ let serverHandlerWrapper = (req, res) => { try {serverHandler(req, res)} catch { | err => { let err = - err - ->Js.Exn.asJsExn - ->Belt.Option.flatMap(Js.Exn.message) - ->Belt.Option.getWithDefault("Error Found") + err->Js.Exn.asJsExn->Option.flatMap(Js.Exn.message)->Option.getWithDefault("Error Found") res.writeHead(. 200, Http.makeHeader({"Content-Type": "text/plain"})) `Error : ${err}`->res.write(. _) res.end(.) diff --git a/src/utils/AnalyticsNewUtils.res b/src/utils/AnalyticsNewUtils.res index 4822d35ea..3b8b8dc41 100644 --- a/src/utils/AnalyticsNewUtils.res +++ b/src/utils/AnalyticsNewUtils.res @@ -59,10 +59,8 @@ let makeFilters = (~filters: Js.Json.t, ~cardinalityArr) => { if expressionArr->Array.length === 1 { expressionArr->Belt.Array.get(0) } else if expressionArr->Array.length > 1 { - let leftInitial = - Array.pop(expressionArr)->Belt.Option.getWithDefault(Dict.make())->Js.Json.object_ - let rightInitial = - Array.pop(expressionArr)->Belt.Option.getWithDefault(Dict.make())->Js.Json.object_ + let leftInitial = Array.pop(expressionArr)->Option.getWithDefault(Dict.make())->Js.Json.object_ + let rightInitial = Array.pop(expressionArr)->Option.getWithDefault(Dict.make())->Js.Json.object_ let complexFilterDict = Dict.fromArray([ ("and", Dict.fromArray([("left", leftInitial), ("right", rightInitial)])->Js.Json.object_), @@ -104,7 +102,7 @@ let getFilterBody = ( let filterValueArr = value ->Array.mapWithIndex((item, _index) => { - if Js.String.match_(%re("/ != /gi"), item)->Belt.Option.isSome { + if Js.String.match_(%re("/ != /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ != /gi"), "@@") ->String.split("@@") @@ -112,12 +110,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "NotEquals"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->Js.Json.string, ), @@ -126,7 +124,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ > /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ > /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ > /gi"), "@@") ->String.split("@@") @@ -134,12 +132,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "Greater"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->Js.Json.string, ), @@ -148,7 +146,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ < /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ < /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ < /gi"), "@@") ->String.split("@@") @@ -156,12 +154,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "Less"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->Js.Json.string, ), @@ -170,7 +168,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ >= /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ >= /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ >= /gi"), "@@") ->String.split("@@") @@ -178,12 +176,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "GreaterThanEquall"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->Js.Json.string, ), @@ -192,7 +190,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ <= /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ <= /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ <= /gi"), "@@") ->String.split("@@") @@ -200,12 +198,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "LessThanEqual"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->Js.Json.string, ), @@ -214,7 +212,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ = /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ = /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ = /gi"), "@@") ->String.split("@@") @@ -222,12 +220,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "Equals"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->Js.Json.string, ), @@ -236,7 +234,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ IN /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ IN /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ IN /gi"), "@@") ->String.split("@@") @@ -244,12 +242,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "In"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->String.replaceRegExp(%re("/\(/g"), "") ->String.replaceRegExp(%re("/\)/g"), "") @@ -262,7 +260,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ NOT IN /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ NOT IN /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ NOT IN /gi"), "@@") ->String.split("@@") @@ -270,12 +268,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "NotIn"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->String.replaceRegExp(%re("/\(/g"), "") ->String.replaceRegExp(%re("/\)/g"), "") @@ -288,7 +286,7 @@ let getFilterBody = ( } else { None } - } else if Js.String.match_(%re("/ LIKE /gi"), item)->Belt.Option.isSome { + } else if Js.String.match_(%re("/ LIKE /gi"), item)->Option.isSome { let value = String.replaceRegExp(item, %re("/ LIKE /gi"), "@@") ->String.split("@@") @@ -296,12 +294,12 @@ let getFilterBody = ( if value->Array.length >= 2 { Some( Dict.fromArray([ - ("field", value[0]->Belt.Option.getWithDefault("")->Js.Json.string), + ("field", value[0]->Option.getWithDefault("")->Js.Json.string), ("condition", "Like"->Js.Json.string), ( "val", value[1] - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.replaceRegExp(%re("/'/gi"), "") ->Js.Json.string, ), @@ -319,9 +317,9 @@ let getFilterBody = ( if filterValueArr->Array.length === 1 { filterValueArr->Belt.Array.get(0) } else if filterValueArr->Array.length >= 2 { - let leftInitial = filterValueArr[0]->Belt.Option.getWithDefault(Dict.make()) - let rightInitial = filterValueArr[1]->Belt.Option.getWithDefault(Dict.make()) - let conditionInitital = andAndOr->Belt.Array.get(0)->Belt.Option.getWithDefault("and") + let leftInitial = filterValueArr[0]->Option.getWithDefault(Dict.make()) + let rightInitial = filterValueArr[1]->Option.getWithDefault(Dict.make()) + let conditionInitital = andAndOr->Belt.Array.get(0)->Option.getWithDefault("and") let complexFilterDict = Dict.fromArray([ ( conditionInitital, @@ -337,7 +335,7 @@ let getFilterBody = ( filterValueArr->Array.forEachWithIndex((item, index) => { let complextFilterDictCopy = complexFilterDict->Dict.toArray->Array.copy->Dict.fromArray complexFilterDict->Dict.set( - andAndOr->Belt.Array.get(index)->Belt.Option.getWithDefault("and"), + andAndOr->Belt.Array.get(index)->Option.getWithDefault("and"), Dict.fromArray([ ("left", complextFilterDictCopy->Js.Json.object_), ("right", item->Js.Json.object_), @@ -395,7 +393,7 @@ let getFilterBody = ( ])->Js.Json.object_, ), ]) - | false => jsonFormattedFilter->Js.Json.decodeObject->Belt.Option.getWithDefault(Dict.make()) + | false => jsonFormattedFilter->Js.Json.decodeObject->Option.getWithDefault(Dict.make()) } | None => filterValue } @@ -457,7 +455,7 @@ let apiBodyMaker = ( | _ => [] } - let activeTabArr = groupBy->Belt.Option.getWithDefault([])->Array.map(Js.Json.string) + let activeTabArr = groupBy->Option.getWithDefault([])->Array.map(Js.Json.string) finalBody->Dict.set("metric", metric->Js.Json.string) let filterVal = getFilterBody( filterValueFromUrl, diff --git a/src/utils/DateRangeUtils.res b/src/utils/DateRangeUtils.res index 23c31c4ed..f29dd9b3c 100644 --- a/src/utils/DateRangeUtils.res +++ b/src/utils/DateRangeUtils.res @@ -168,14 +168,14 @@ let convertTimeStamp = (~isoStringToCustomTimeZone, timestamp, format) => { let changeTimeFormat = (~customTimezoneToISOString, ~date, ~time, ~format) => { let dateSplit = String.split(date, "T") - let date = dateSplit[0]->Belt.Option.getWithDefault("")->String.split("-") - let dateDay = date[2]->Belt.Option.getWithDefault("") - let dateYear = date[0]->Belt.Option.getWithDefault("") - let dateMonth = date[1]->Belt.Option.getWithDefault("") + let date = dateSplit[0]->Option.getWithDefault("")->String.split("-") + let dateDay = date[2]->Option.getWithDefault("") + let dateYear = date[0]->Option.getWithDefault("") + let dateMonth = date[1]->Option.getWithDefault("") let timeSplit = String.split(time, ":") - let timeHour = timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault("00") - let timeMinute = timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault("00") - let timeSecond = timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault("00") + let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault("00") + let timeMinute = timeSplit->Belt.Array.get(1)->Option.getWithDefault("00") + let timeSecond = timeSplit->Belt.Array.get(2)->Option.getWithDefault("00") let dateTimeCheck = customTimezoneToISOString( dateYear, dateMonth, diff --git a/src/utils/DateTimeUtils.res b/src/utils/DateTimeUtils.res index 5b9fed88d..7705ecaa7 100644 --- a/src/utils/DateTimeUtils.res +++ b/src/utils/DateTimeUtils.res @@ -90,11 +90,11 @@ let getStartEndDiff = (startDate, endDate) => { let isStartBeforeEndDate = (start, end) => { let getDate = date => { let datevalue = Js.Date.makeWithYMD( - ~year=Js.Float.fromString(date[0]->Belt.Option.getWithDefault("")), + ~year=Js.Float.fromString(date[0]->Option.getWithDefault("")), ~month=Js.Float.fromString( - String.make(Js.Float.fromString(date[1]->Belt.Option.getWithDefault("")) -. 1.0), + String.make(Js.Float.fromString(date[1]->Option.getWithDefault("")) -. 1.0), ), - ~date=Js.Float.fromString(date[2]->Belt.Option.getWithDefault("")), + ~date=Js.Float.fromString(date[2]->Option.getWithDefault("")), (), ) datevalue diff --git a/src/utils/DictionaryUtils.res b/src/utils/DictionaryUtils.res index 6838f7534..e2452df34 100644 --- a/src/utils/DictionaryUtils.res +++ b/src/utils/DictionaryUtils.res @@ -37,14 +37,14 @@ let equalDicts = (dictionary1, dictionary2) => { let (key, value) = item dictionary2->Dict.get(key) !== Some(value) }) - ->Belt.Option.isNone && + ->Option.isNone && dictionary2 ->Dict.toArray ->Array.find(item => { let (key, value) = item dictionary1->Dict.get(key) !== Some(value) }) - ->Belt.Option.isNone + ->Option.isNone } let checkEqualJsonDicts = (~checkKeys, ~ignoreKeys, dictionary1, dictionary2) => { @@ -73,7 +73,7 @@ let checkEqualJsonDicts = (~checkKeys, ~ignoreKeys, dictionary1, dictionary2) => false } }) - ->Belt.Option.isNone && + ->Option.isNone && dictionary2 ->Dict.toArray ->Array.find(item => { @@ -93,7 +93,7 @@ let checkEqualJsonDicts = (~checkKeys, ~ignoreKeys, dictionary1, dictionary2) => false } }) - ->Belt.Option.isNone + ->Option.isNone } let copyOfDict = dict => { diff --git a/src/utils/HSwitchGlobalVars.res b/src/utils/HSwitchGlobalVars.res index 96e715d24..a1f4fac3d 100644 --- a/src/utils/HSwitchGlobalVars.res +++ b/src/utils/HSwitchGlobalVars.res @@ -1,6 +1,6 @@ @val external appVersion: string = "appVersion" -let mixpanelToken = Window.env.mixpanelToken->Belt.Option.getWithDefault("mixpanel-token") +let mixpanelToken = Window.env.mixpanelToken->Option.getWithDefault("mixpanel-token") type hostType = Live | Sandbox | Local | Netlify @@ -28,7 +28,7 @@ let netlifyUrl = Netlify->getHostURLFromVariant let isHyperSwitchDashboard = GlobalVars.dashboardAppName === #hyperswitch -let hyperSwitchApiPrefix = Window.env.apiBaseUrl->Belt.Option.getWithDefault("/api") +let hyperSwitchApiPrefix = Window.env.apiBaseUrl->Option.getWithDefault("/api") let dashboardUrl = switch hostType { | Live => Live->getHostURLFromVariant diff --git a/src/utils/HyperSwitchUtils.res b/src/utils/HyperSwitchUtils.res index 4938fd7e7..2a3d184fb 100644 --- a/src/utils/HyperSwitchUtils.res +++ b/src/utils/HyperSwitchUtils.res @@ -1,5 +1,5 @@ let fetchRequestIdFromAPI = res => { - Fetch.Headers.get("x-request-id")(res->Fetch.Response.headers)->Belt.Option.getWithDefault("") + Fetch.Headers.get("x-request-id")(res->Fetch.Response.headers)->Option.getWithDefault("") } let getMixpanelRouteName = (pageTitle, url: RescriptReactRouter.url) => { @@ -23,7 +23,7 @@ let getMixpanelRouteName = (pageTitle, url: RescriptReactRouter.url) => { let type_ = LogicUtils.getDictFromUrlSearchParams(searchParamValue) ->Dict.get("type") - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") `/${pageTitle}/${type_}` } @@ -31,7 +31,7 @@ let getMixpanelRouteName = (pageTitle, url: RescriptReactRouter.url) => { let type_ = LogicUtils.getDictFromUrlSearchParams(searchParamValue) ->Dict.get("type") - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") `/${pageTitle}/${type_}` } diff --git a/src/utils/JsonFlattenUtils.res b/src/utils/JsonFlattenUtils.res index 31c934543..b60c24aed 100644 --- a/src/utils/JsonFlattenUtils.res +++ b/src/utils/JsonFlattenUtils.res @@ -39,9 +39,9 @@ let rec setNested = (dict, keys, value) => { if keys->Array.length === 0 { () } else if keys->Array.length === 1 { - Dict.set(dict, keys[0]->Belt.Option.getWithDefault(""), value) + Dict.set(dict, keys[0]->Option.getWithDefault(""), value) } else { - let key = keys[0]->Belt.Option.getWithDefault("") + let key = keys[0]->Option.getWithDefault("") let subDict = switch Dict.get(dict, key) { | Some(json) => switch json->Js.Json.decodeObject { diff --git a/src/utils/LogicUtils.res b/src/utils/LogicUtils.res index a90dfe236..a2e3240bc 100644 --- a/src/utils/LogicUtils.res +++ b/src/utils/LogicUtils.res @@ -33,7 +33,7 @@ let safeParseOpt = st => { } // parse a string into json and return json with null default let safeParse = st => { - safeParseOpt(st)->Belt.Option.getWithDefault(Js.Json.null) + safeParseOpt(st)->Option.getWithDefault(Js.Json.null) } type numericComparisionType = @@ -100,7 +100,7 @@ let getNameFromEmail = email => { email ->String.split("@") ->Belt.Array.get(0) - ->Belt.Option.getWithDefault("") + ->Option.getWithDefault("") ->String.split(".") ->Array.map(name => { if name == "" { @@ -114,31 +114,31 @@ let getNameFromEmail = email => { } let getOptionString = (dict, key) => { - dict->Dict.get(key)->Belt.Option.flatMap(Js.Json.decodeString) + dict->Dict.get(key)->Option.flatMap(Js.Json.decodeString) } let getString = (dict, key, default) => { - getOptionString(dict, key)->Belt.Option.getWithDefault(default) + getOptionString(dict, key)->Option.getWithDefault(default) } let getStringFromJson = (json: Js.Json.t, default) => { - json->Js.Json.decodeString->Belt.Option.getWithDefault(default) + json->Js.Json.decodeString->Option.getWithDefault(default) } let getBoolFromJson = (json, defaultValue) => { - json->Js.Json.decodeBoolean->Belt.Option.getWithDefault(defaultValue) + json->Js.Json.decodeBoolean->Option.getWithDefault(defaultValue) } let getArrayFromJson = (json: Js.Json.t, default) => { - json->Js.Json.decodeArray->Belt.Option.getWithDefault(default) + json->Js.Json.decodeArray->Option.getWithDefault(default) } let getOptionalArrayFromDict = (dict, key) => { - dict->Dict.get(key)->Belt.Option.flatMap(Js.Json.decodeArray) + dict->Dict.get(key)->Option.flatMap(Js.Json.decodeArray) } let getArrayFromDict = (dict, key, default) => { - dict->getOptionalArrayFromDict(key)->Belt.Option.getWithDefault(default) + dict->getOptionalArrayFromDict(key)->Option.getWithDefault(default) } let getArrayDataFromJson = (json, itemToObjMapper) => { @@ -153,8 +153,8 @@ let getArrayDataFromJson = (json, itemToObjMapper) => { let getStrArray = (dict, key) => { dict ->getOptionalArrayFromDict(key) - ->Belt.Option.getWithDefault([]) - ->Belt.Array.map(json => json->Js.Json.decodeString->Belt.Option.getWithDefault("")) + ->Option.getWithDefault([]) + ->Belt.Array.map(json => json->Js.Json.decodeString->Option.getWithDefault("")) } let getStrArrayFromJsonArray = jsonArr => { @@ -162,10 +162,7 @@ let getStrArrayFromJsonArray = jsonArr => { } let getStrArryFromJson = arr => { - arr - ->Js.Json.decodeArray - ->Belt.Option.map(getStrArrayFromJsonArray) - ->Belt.Option.getWithDefault([]) + arr->Js.Json.decodeArray->Belt.Option.map(getStrArrayFromJsonArray)->Option.getWithDefault([]) } let getOptionStrArrayFromJson = json => { @@ -173,14 +170,11 @@ let getOptionStrArrayFromJson = json => { } let getStrArrayFromDict = (dict, key, default) => { - dict - ->Dict.get(key) - ->Belt.Option.flatMap(getOptionStrArrayFromJson) - ->Belt.Option.getWithDefault(default) + dict->Dict.get(key)->Option.flatMap(getOptionStrArrayFromJson)->Option.getWithDefault(default) } let getOptionStrArrayFromDict = (dict, key) => { - dict->Dict.get(key)->Belt.Option.flatMap(getOptionStrArrayFromJson) + dict->Dict.get(key)->Option.flatMap(getOptionStrArrayFromJson) } let getNonEmptyString = str => { @@ -200,15 +194,15 @@ let getNonEmptyArray = arr => { } let getOptionBool = (dict, key) => { - dict->Dict.get(key)->Belt.Option.flatMap(Js.Json.decodeBoolean) + dict->Dict.get(key)->Option.flatMap(Js.Json.decodeBoolean) } let getBool = (dict, key, default) => { - getOptionBool(dict, key)->Belt.Option.getWithDefault(default) + getOptionBool(dict, key)->Option.getWithDefault(default) } let getJsonObjectFromDict = (dict, key) => { - dict->Dict.get(key)->Belt.Option.getWithDefault(Js.Json.object_(Dict.make())) + dict->Dict.get(key)->Option.getWithDefault(Js.Json.object_(Dict.make())) } let getBoolFromString = (boolString, default: bool) => { @@ -299,14 +293,11 @@ let getFloat = (dict, key, default) => { dict ->Dict.get(key) ->Belt.Option.map(json => getFloatFromJson(json, default)) - ->Belt.Option.getWithDefault(default) + ->Option.getWithDefault(default) } let getObj = (dict, key, default) => { - dict - ->Dict.get(key) - ->Belt.Option.flatMap(Js.Json.decodeObject) - ->Belt.Option.getWithDefault(default) + dict->Dict.get(key)->Option.flatMap(Js.Json.decodeObject)->Option.getWithDefault(default) } let getDictFromUrlSearchParams = searchParams => { @@ -380,11 +371,11 @@ let titleToSnake = str => { } let getIntFromString = (str, default) => { - str->Belt.Int.fromString->Belt.Option.getWithDefault(default) + str->Belt.Int.fromString->Option.getWithDefault(default) } let removeTrailingZero = (numeric_str: string) => { - numeric_str->Belt.Float.fromString->Belt.Option.getWithDefault(0.)->Belt.Float.toString + numeric_str->Belt.Float.fromString->Option.getWithDefault(0.)->Belt.Float.toString } let shortNum = ( @@ -458,7 +449,7 @@ let latencyShortNum = (~labelValue: float, ~includeMilliseconds=?, ()) => { } let millisec_disp = if ( (labelValue < 1.0 || - (includeMilliseconds->Belt.Option.getWithDefault(false) && labelValue < 60.0)) && + (includeMilliseconds->Option.getWithDefault(false) && labelValue < 60.0)) && labelValue > 0.0 ) { `.${String.make(mod((labelValue *. 1000.0)->Belt.Int.fromFloat, 1000))}` @@ -517,7 +508,7 @@ let getDictfromDict = (dict, key) => { let checkLeapYear = year => (mod(year, 4) === 0 && mod(year, 100) !== 0) || mod(year, 400) === 0 let getValueFromArray = (arr, index, default) => - arr->Belt.Array.get(index)->Belt.Option.getWithDefault(default) + arr->Belt.Array.get(index)->Option.getWithDefault(default) let isEqualStringArr = (arr1, arr2) => { let arr1 = arr1->getUniqueArray @@ -552,7 +543,7 @@ let getObjectArrayFromJson = json => { } let getListHead = (~default="", list) => { - list->Belt.List.head->Belt.Option.getWithDefault(default) + list->Belt.List.head->Option.getWithDefault(default) } let dataMerge = (~dataArr: array>, ~dictKey: array) => { @@ -627,7 +618,7 @@ let regex = (positionToCheckFrom, searchString) => { let checkStringStartsWithSubstring = (~itemToCheck, ~searchText) => { let isMatch = switch Js.String2.match_(itemToCheck, regex("\\b", searchText)) { | Some(_) => true - | None => Js.String2.match_(itemToCheck, regex("_", searchText))->Belt.Option.isSome + | None => Js.String2.match_(itemToCheck, regex("_", searchText))->Option.isSome } isMatch && searchText->String.length > 0 } diff --git a/src/utils/Modal.res b/src/utils/Modal.res index fbf5f04b6..9de65a4c5 100644 --- a/src/utils/Modal.res +++ b/src/utils/Modal.res @@ -162,7 +162,7 @@ module ModalOverlay = { let attributeId = addAttributeId === "" ? switch modalHeading { - | Some(_heading) => `:${modalHeading->Belt.Option.getWithDefault("")}` + | Some(_heading) => `:${modalHeading->Option.getWithDefault("")}` | None => "" } : `:${addAttributeId}` diff --git a/src/utils/NumericUtils.res b/src/utils/NumericUtils.res index 98248b2cd..ee285ec84 100644 --- a/src/utils/NumericUtils.res +++ b/src/utils/NumericUtils.res @@ -3,7 +3,7 @@ let pretty = (range: array, n: int) => { if range->Array.length === 2 { let range = if range[0] === range[1] { - [0., range[1]->Belt.Option.getWithDefault(0.)] + [0., range[1]->Option.getWithDefault(0.)] } else { range } @@ -13,7 +13,7 @@ let pretty = (range: array, n: int) => { let high_u_bias = 1.5 let u5_bias = 0.5 +. 1.5 *. high_u_bias let d = Js.Math.abs_float( - range[0]->Belt.Option.getWithDefault(0.) -. range[1]->Belt.Option.getWithDefault(0.), + range[0]->Option.getWithDefault(0.) -. range[1]->Option.getWithDefault(0.), ) let c = if Js.Math.log(d) /. Js.Math._LN10 < -2. { @@ -44,22 +44,21 @@ let pretty = (range: array, n: int) => { } let ticks = [] - let i = if range[0]->Belt.Option.getWithDefault(0.) <= unit.contents { + let i = if range[0]->Option.getWithDefault(0.) <= unit.contents { 0. } else { let i123 = - Js.Math.floor_float(range[0]->Belt.Option.getWithDefault(0.) /. unit.contents) *. - unit.contents + Js.Math.floor_float(range[0]->Option.getWithDefault(0.) /. unit.contents) *. unit.contents i123 ->Js.Float.toFixedWithPrecision(~digits=base_toFixed) ->Belt.Float.fromString - ->Belt.Option.getWithDefault(0.) + ->Option.getWithDefault(0.) } let iRef = ref(i) let break = ref(false) - while iRef.contents < range[1]->Belt.Option.getWithDefault(0.) && unit.contents > 0. { + while iRef.contents < range[1]->Option.getWithDefault(0.) && unit.contents > 0. { ticks->Array.push(iRef.contents)->ignore iRef := iRef.contents +. unit.contents if base_toFixed > 0 && unit.contents > 0. { @@ -67,7 +66,7 @@ let pretty = (range: array, n: int) => { iRef.contents ->Js.Float.toFixedWithPrecision(~digits=base_toFixed) ->Belt.Float.fromString - ->Belt.Option.getWithDefault(0.) + ->Option.getWithDefault(0.) } else { break := true } diff --git a/src/utils/UrlUtils.res b/src/utils/UrlUtils.res index c13520498..8e7102ed9 100644 --- a/src/utils/UrlUtils.res +++ b/src/utils/UrlUtils.res @@ -10,7 +10,7 @@ let useGetFilterDictFromUrl = prefix => { ->String.split("&") ->Array.map(str => { let arr = str->String.split("=") - let key = arr->Belt.Array.get(0)->Belt.Option.getWithDefault("-") + let key = arr->Belt.Array.get(0)->Option.getWithDefault("-") let val = arr->Belt.Array.sliceToEnd(1)->Array.joinWith("=") (key, val->UrlFetchUtils.getFilterValue) // it will return the Json string, Json array diff --git a/src/utils/UserPrefUtils.res b/src/utils/UserPrefUtils.res index 3b4659b06..c08d8f73a 100644 --- a/src/utils/UserPrefUtils.res +++ b/src/utils/UserPrefUtils.res @@ -75,7 +75,7 @@ let getUserPref = () => { str ->LogicUtils.safeParse ->Js.Json.decodeObject - ->Belt.Option.getWithDefault(Dict.make()) + ->Option.getWithDefault(Dict.make()) ->converToUserPref | None => Dict.make() @@ -83,7 +83,7 @@ let getUserPref = () => { } let getSearchParams = (moduleWisePref: Js.Dict.t, ~key: string) => { - switch moduleWisePref->Dict.get(key)->Belt.Option.getWithDefault({}) { + switch moduleWisePref->Dict.get(key)->Option.getWithDefault({}) { | {searchParams} => searchParams | _ => "" }