diff --git a/config/FeatureFlag.json b/config/FeatureFlag.json index 9d6e08029..0106d7dba 100644 --- a/config/FeatureFlag.json +++ b/config/FeatureFlag.json @@ -1,23 +1,23 @@ { - "test_live_toggle": false, + "test_live_toggle": true, "is_live_mode": false, - "magic_link": false, - "production_access": false, - "quick_start": false, - "switch_merchant": false, - "audit_trail": false, - "system_metrics": false, - "sample_data": false, - "frm": false, - "payout": false, - "recon": false, - "user_management": false, + "magic_link": true, + "production_access": true, + "quick_start": true, + "switch_merchant": true, + "audit_trail": true, + "system_metrics": true, + "sample_data": true, + "frm": true, + "payout": true, + "recon": true, + "user_management": true, "test_processors": true, - "feedback": false, - "verify_connector": false, + "feedback": true, + "verify_connector": true, "mixpanel": false, - "business_profile": false, - "generate_report": false, - "forgot_password": false, + "business_profile": true, + "generate_report": true, + "forgot_password": true, "oss_build": true } diff --git a/src/components/AnalyticsComponent/NestedDropdownWithCalendar.res b/src/components/AnalyticsComponent/NestedDropdownWithCalendar.res index a101dc0dc..fe729d39d 100644 --- a/src/components/AnalyticsComponent/NestedDropdownWithCalendar.res +++ b/src/components/AnalyticsComponent/NestedDropdownWithCalendar.res @@ -25,7 +25,7 @@ let make = ( endDateArr->Belt.Array.get(i)->Belt.Option.getWithDefault(x), )) - input.onChange(newArr->NestedDropdown.formToArray) + input.onChange(newArr->Identity.anyTypeToReactEvent) } let showCalendars = React.useMemo1(() => { diff --git a/src/components/Base64ImageInputWithDnD.res b/src/components/Base64ImageInputWithDnD.res index 3495dc2fa..40fa90417 100644 --- a/src/components/Base64ImageInputWithDnD.res +++ b/src/components/Base64ImageInputWithDnD.res @@ -1,4 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" external strToDomImg: string => Webapi.Dom.Image.t = "%identity" @send external drawImage: (Webapi.Canvas.Canvas2d.t, 'a, int, int) => unit = "drawImage" @send external toDataURL: 'a => string = "toDataURL" @@ -57,7 +56,7 @@ let make = ( ) let clearImage = _evt => { setFilename(_ => "") - input.onChange(""->toReactEvent) + input.onChange(""->Identity.stringToFormReactEvent) } let onChange = evt => { let target = ReactEvent.Form.target(evt) @@ -76,7 +75,7 @@ let make = ( let target = ReactEvent.Form.target(e) let data = target["result"] setIsNewUpload(_ => true) - input.onChange(toReactEvent(data)) + input.onChange(data->Identity.anyTypeToReactEvent) } } } @@ -106,7 +105,7 @@ let make = ( context->drawImage(img, 0, 0) toDataURL(canvas) } - input.onChange(a->toReactEvent) + input.onChange(a->Identity.stringToFormReactEvent) }
{ @@ -129,7 +128,7 @@ let make = ( let target = ReactEvent.Form.target(e) let data = target["result"] setIsNewUpload(_ => true) - input.onChange(toReactEvent(data)) + input.onChange(data->Identity.anyTypeToReactEvent) } } } diff --git a/src/components/CsvFileUpload.res b/src/components/CsvFileUpload.res index 8e1360611..30629d66a 100644 --- a/src/components/CsvFileUpload.res +++ b/src/components/CsvFileUpload.res @@ -1,4 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" type t type formData @@ -28,7 +27,7 @@ let make = ( setFilenameVal(_ => "") onFileUpload(None) - input.onChange(""->toReactEvent) + input.onChange(""->Identity.stringToFormReactEvent) } let onChange = evt => { diff --git a/src/components/CsvInputField.res b/src/components/CsvInputField.res index 4ead42446..6673571da 100644 --- a/src/components/CsvInputField.res +++ b/src/components/CsvInputField.res @@ -1,4 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" external jsonToarr: Js.Json.t => array<'a> = "%identity" external arrToReactEvent: array => ReactEvent.Form.t = "%identity" external strToReactEvent: string => ReactEvent.Form.t = "%identity" @@ -7,7 +6,7 @@ module FilenameSaver = { @react.component let make = (~input: ReactFinalForm.fieldRenderPropsInput, ~fileName) => { React.useEffect1(() => { - let reactEvFilename = fileName->toReactEvent + let reactEvFilename = fileName->Identity.anyTypeToReactEvent input.onChange(reactEvFilename) None }, [fileName]) @@ -164,7 +163,7 @@ let make = ( }) if errorLines->Js.Array2.length === 0 { - input.onChange(toReactEvent(res)) + input.onChange(res->Identity.anyTypeToReactEvent) toast("File Uploaded Successfully", ToastSuccess) } @@ -175,7 +174,7 @@ let make = ( } | None => { - input.onChange(toReactEvent(res)) + input.onChange(res->Identity.anyTypeToReactEvent) toast("File Uploaded Successfully", ToastSuccess) } } @@ -188,7 +187,7 @@ let make = ( } | _ => setIsNewUpload(_ => true) - input.onChange(toReactEvent(csv)) + input.onChange(csv->Identity.anyTypeToReactEvent) toast("File Uploaded Successfully", ToastSuccess) } } diff --git a/src/components/DatePicker.res b/src/components/DatePicker.res index 5eb475e1d..c37abb8e2 100644 --- a/src/components/DatePicker.res +++ b/src/components/DatePicker.res @@ -1,6 +1,6 @@ external strToForm: string => ReactEvent.Form.t = "%identity" external jsonToForm: Js.Json.t => ReactEvent.Form.t = "%identity" -external formEvAsString: ReactEvent.Form.t => string = "%identity" + @react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, @@ -167,7 +167,7 @@ let make = ( name: "string", onBlur: _ev => (), onChange: timeValEv => { - let timeVal = timeValEv->formEvAsString + let timeVal = timeValEv->Identity.formReactEventToString if selectedDate !== "" { let todayDayJsObj = Js.Date.make()->Js.Date.toString->DayJs.getDayJsForString let todayTime = todayDayJsObj.format(. "HH:mm:ss") diff --git a/src/components/DateRangePicker.res b/src/components/DateRangePicker.res index eeb831c42..210fa84f3 100644 --- a/src/components/DateRangePicker.res +++ b/src/components/DateRangePicker.res @@ -1,5 +1,4 @@ external strToForm: string => ReactEvent.Form.t = "%identity" -external formEvAsString: ReactEvent.Form.t => string = "%identity" let defaultCellHighlighter = (_): Calendar.highlighter => { { @@ -458,7 +457,7 @@ module Base = { name: "string", onBlur: _ev => (), onChange: timeValEv => { - let startTimeVal = timeValEv->formEvAsString + let startTimeVal = timeValEv->Identity.formReactEventToString let endTime = localEndDate->getTimeStringForValue(isoStringToCustomTimeZone) if localStartDate !== "" { @@ -481,7 +480,7 @@ module Base = { name: "string", onBlur: _ev => (), onChange: timeValEv => { - let endTimeVal = timeValEv->formEvAsString + let endTimeVal = timeValEv->Identity.formReactEventToString let startTime = localStartDate->getTimeStringForValue(isoStringToCustomTimeZone) if localEndDate !== "" { if disableFutureDates && selectedEndDate == todayDate && endTimeVal > todayTime { diff --git a/src/components/DistributionDonut/DistributionDonut.res b/src/components/DistributionDonut/DistributionDonut.res index 623635db1..6a056d565 100644 --- a/src/components/DistributionDonut/DistributionDonut.res +++ b/src/components/DistributionDonut/DistributionDonut.res @@ -1,5 +1,4 @@ external objToJson: {..} => Js.Json.t = "%identity" -external formEventToStr: ReactEvent.Form.t => string = "%identity" type dataPoint = {y: int, name: string} @@ -160,7 +159,7 @@ let make = ( let filterInput: ReactFinalForm.fieldRenderPropsInput = { name: "Get By", onBlur: _ev => (), - onChange: ev => {setGroupBy(_ => ev->formEventToStr)}, + onChange: ev => {setGroupBy(_ => ev->Identity.formReactEventToString)}, onFocus: _ev => (), value: groupBy->Js.Json.string, checked: true, diff --git a/src/components/DraggableFilter.res b/src/components/DraggableFilter.res index 04ef0f11d..0166806d9 100644 --- a/src/components/DraggableFilter.res +++ b/src/components/DraggableFilter.res @@ -4,8 +4,6 @@ type rec options = { options: option>, } -external formToArray: 'a => ReactEvent.Form.t = "%identity" - module TypeText = { @react.component let make = () => { @@ -429,7 +427,7 @@ let make = ( } React.useEffect1(() => { - input.onChange(dataSelectedBase->formToArray) + input.onChange(dataSelectedBase->Identity.anyTypeToReactEvent) None }, [dataSelectedBase]) let keyExtractor = (index, data, isDragging) => { diff --git a/src/components/DynamicChart.res b/src/components/DynamicChart.res index 35e06740c..db014ee6a 100644 --- a/src/components/DynamicChart.res +++ b/src/components/DynamicChart.res @@ -292,7 +292,6 @@ let useChartFetch = (~setStatusDict) => { fetchChartData } -external formEventToStr: ReactEvent.Form.t => string = "%identity" external tofloat: string => float = "%identity" let granularityMapper = (granularity: granularity) => { @@ -862,7 +861,9 @@ let make = ( let _inputChart: ReactFinalForm.fieldRenderPropsInput = { name: "inputChart", onChange: ev => { - updateChartCompFilters(Js.Dict.fromArray([("chartType", ev->formEventToStr)])) + updateChartCompFilters( + Js.Dict.fromArray([("chartType", ev->Identity.formReactEventToString)]), + ) }, value: chartTypeFromUrl->Js.Json.string, onBlur: _ev => (), @@ -872,7 +873,9 @@ let make = ( let inputMetricTop: ReactFinalForm.fieldRenderPropsInput = { name: "inputMetricTop", onChange: ev => { - updateChartCompFilters(Js.Dict.fromArray([("chartTopMetric", ev->formEventToStr)])) + updateChartCompFilters( + Js.Dict.fromArray([("chartTopMetric", ev->Identity.formReactEventToString)]), + ) }, value: chartTopMetricFromUrl->Js.Json.string, onBlur: _ev => (), @@ -882,7 +885,9 @@ let make = ( let inputMetricBottom: ReactFinalForm.fieldRenderPropsInput = { name: "inputMetricBottom", onChange: ev => { - updateChartCompFilters(Js.Dict.fromArray([("chartBottomMetric", ev->formEventToStr)])) + updateChartCompFilters( + Js.Dict.fromArray([("chartBottomMetric", ev->Identity.formReactEventToString)]), + ) }, value: chartBottomMetricFromUrl->Js.Json.string, onBlur: _ev => (), diff --git a/src/components/DynamicTabs.res b/src/components/DynamicTabs.res index c00d3a344..f1c6ca47b 100644 --- a/src/components/DynamicTabs.res +++ b/src/components/DynamicTabs.res @@ -177,7 +177,6 @@ module TabInfo = { } } -external syntheticEventAsStr: ReactEvent.Form.t => string = "%identity" module IndicationArrow = { @react.component let make = (~iconName, ~side, ~refElement: React.ref>, ~isVisible) => { diff --git a/src/components/MultiLineInputBox.res b/src/components/MultiLineInputBox.res index c9a016176..166cffabc 100644 --- a/src/components/MultiLineInputBox.res +++ b/src/components/MultiLineInputBox.res @@ -1,4 +1,3 @@ -external toReactFormEvent: 'a => ReactEvent.Form.t = "%identity" @react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, @@ -24,7 +23,7 @@ let make = ( } let handleRemove = _ => { - input.onChange(""->toReactFormEvent) + input.onChange(""->Identity.stringToFormReactEvent) setError(_ => None) setFocus(_ => false) handleRemove() @@ -51,7 +50,7 @@ let make = ( if value === "" || error->Belt.Option.isNone { setFocus(_ => false) - input.onChange(value->toReactFormEvent) + input.onChange(value->Identity.stringToFormReactEvent) setShow(_ => false) } else { setError(_ => error) diff --git a/src/components/MultipleFileUpload.res b/src/components/MultipleFileUpload.res index 56ef8f71a..940ca1b41 100644 --- a/src/components/MultipleFileUpload.res +++ b/src/components/MultipleFileUpload.res @@ -1,4 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" external arrToReactEvent: array => ReactEvent.Form.t = "%identity" external strToReactEvent: string => ReactEvent.Form.t = "%identity" type dataTransfer @@ -48,8 +47,8 @@ let make = ( let showToast = ToastState.useShowToast() React.useEffect2(() => { - fileNamesInput.onChange(fileNames->toReactEvent) - fileTypeInput.onChange(fileTypes->toReactEvent) + fileNamesInput.onChange(fileNames->Identity.anyTypeToReactEvent) + fileTypeInput.onChange(fileTypes->Identity.anyTypeToReactEvent) None }, (fileNames, fileTypes)) @@ -61,7 +60,7 @@ let make = ( ->getArrayFromJson([]) ->Js.Array2.filteri((_, i) => indx != i) ->Js.Json.array - ->toReactEvent, + ->Identity.anyTypeToReactEvent, ) setKey(prev => prev + 1) } @@ -130,7 +129,7 @@ let make = ( } if !isCorrectFileFormat { - input.onChange(toReactEvent("")) + input.onChange(Identity.stringToFormReactEvent("")) toast("Invalid file format", ToastError) } else if isValid { switch sizeLimit { @@ -180,7 +179,7 @@ let make = ( } else { break := true } - input.onChange(toReactEvent(files)) + input.onChange(Identity.anyTypeToReactEvent(files)) } } @@ -226,7 +225,7 @@ let make = ( setFilenames(prev => prev->Js.Array2.concat(filename)) setFileTypes(prev => prev->Js.Array2.concat(mimeType)) input.onChange( - toReactEvent( + Identity.anyTypeToReactEvent( input.value->getArrayFromJson([])->Js.Array2.concat([file->Js.Json.string]), ), ) diff --git a/src/components/NestedDropdown.res b/src/components/NestedDropdown.res index 07a719ae8..0ffe83706 100644 --- a/src/components/NestedDropdown.res +++ b/src/components/NestedDropdown.res @@ -3,7 +3,6 @@ type rec options = { value: string, options?: array, } -external formToArray: 'a => ReactEvent.Form.t = "%identity" module RenderOption = { @react.component @@ -38,7 +37,7 @@ module RenderOption = { } setSelectedData(_ => data) setSelectedDataVal(_ => dataN) - input.onChange(data->formToArray) + input.onChange(data->Identity.anyTypeToReactEvent) } if selectedInd != index { setSelectedInd(_ => index) @@ -134,7 +133,7 @@ module RenderOptionList = { | None => false } let onClick = _ => { - input.onChange(selectedData->formToArray) + input.onChange(selectedData->Identity.anyTypeToReactEvent) } <>
ReactEvent.Form.t = "%identity" -external formEvAsString: ReactEvent.Form.t => string = "%identity" let defaultCellHighlighter = (_): NewCalendar.highlighter => { { diff --git a/src/components/Paginator.res b/src/components/Paginator.res index 55148c49b..94b5faf65 100644 --- a/src/components/Paginator.res +++ b/src/components/Paginator.res @@ -1,5 +1,3 @@ -external formEventToStr: ReactEvent.Form.t => string = "%identity" - @react.component let make = ( ~totalResults, @@ -50,7 +48,7 @@ let make = ( onBlur: _ev => (), onChange: ev => { setResultsPerPage(_ => { - ev->formEventToStr->Belt.Int.fromString->Belt.Option.getWithDefault(15) + ev->Identity.formReactEventToString->Belt.Int.fromString->Belt.Option.getWithDefault(15) }) }, onFocus: _ev => (), diff --git a/src/components/RangeSlider.res b/src/components/RangeSlider.res index b0d7d36f7..d3e28e319 100644 --- a/src/components/RangeSlider.res +++ b/src/components/RangeSlider.res @@ -1,4 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" @react.component let make = ( ~max="5000", @@ -148,7 +147,7 @@ let make = ( maxSlide.value->Js.Json.decodeNumber->Belt.Option.getWithDefault(0.) if minVal >= min && minVal < maxSliderValue { setHasError(((_, max)) => (false, max)) - minSlide.onChange(ev->toReactEvent) + minSlide.onChange(ev->Identity.anyTypeToReactEvent) } else { setHasError(((_, max)) => (true, max)) } @@ -166,7 +165,7 @@ let make = ( maxSlide.value->Js.Json.decodeNumber->Belt.Option.getWithDefault(0.) if minVal >= min && minVal <= maxSliderValue { setHasError(((_, max)) => (false, max)) - minSlide.onChange(ev->toReactEvent) + minSlide.onChange(ev->Identity.anyTypeToReactEvent) } else { setHasError(((_, max)) => (true, max)) } @@ -188,7 +187,7 @@ let make = ( minSlide.value->Js.Json.decodeNumber->Belt.Option.getWithDefault(0.) if maxVal <= max && maxVal > minSliderValue { setHasError(((min, _)) => (min, false)) - maxSlide.onChange(ev->toReactEvent) + maxSlide.onChange(ev->Identity.anyTypeToReactEvent) } else { setHasError(((min, _)) => (min, true)) } @@ -207,7 +206,7 @@ let make = ( if key === "Enter" || keyCode === 13 { if maxVal <= max && maxVal >= minSliderValue { setHasError(((min, _)) => (min, false)) - maxSlide.onChange(ev->toReactEvent) + maxSlide.onChange(ev->Identity.anyTypeToReactEvent) } else { setHasError(((min, _)) => (min, true)) } diff --git a/src/components/RatingOptions.res b/src/components/RatingOptions.res index 33274cb56..5d4f05f2d 100644 --- a/src/components/RatingOptions.res +++ b/src/components/RatingOptions.res @@ -1,5 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" - @react.component let make = (~icons, ~size) => { let (isActive, setIsActive) = React.useState(_ => false) @@ -7,7 +5,7 @@ let make = (~icons, ~size) => { let rating = ratingInput.value->LogicUtils.getIntFromJson(1) let handleClick = ratingNumber => { - ratingInput.onChange(ratingNumber->toReactEvent) + ratingInput.onChange(ratingNumber->Identity.anyTypeToReactEvent) setIsActive(_ => true) } diff --git a/src/components/RedirectSearchInput.res b/src/components/RedirectSearchInput.res index cdf26166e..a603351be 100644 --- a/src/components/RedirectSearchInput.res +++ b/src/components/RedirectSearchInput.res @@ -1,4 +1,3 @@ -external inputAsString: ReactEvent.Form.t => string = "%identity" external stringToForm: string => ReactEvent.Form.t = "%identity" external toReactForm: Js.Json.t => ReactEvent.Form.t = "%identity" @@ -21,7 +20,10 @@ module SearchInput = { let key = ev->ReactEvent.Keyboard.key let keyCode = ev->ReactEvent.Keyboard.keyCode if key === "Enter" || keyCode === 13 { - let value = {ev->ReactEvent.Keyboard.target}["value"]->inputAsString->Js.String2.trim + let value = + {ev->ReactEvent.Keyboard.target}["value"] + ->Identity.formReactEventToString + ->Js.String2.trim if value !== "" { RescriptReactRouter.push(`${redirectUrl}${value}`) } diff --git a/src/components/Table.resi b/src/components/Table.resi index ea3ffbf8c..c2cc56a27 100644 --- a/src/components/Table.resi +++ b/src/components/Table.resi @@ -24,7 +24,6 @@ type filterDataType = TableUtils.filterDataType = | DateTime external formEventToStrArr: ReactEvent.Form.t => array = "%identity" -external formEventToString: ReactEvent.Form.t => string = "%identity" external toReactDOMStyle: Js.Json.t => ReactDOM.style = "%identity" external jsonToStr: Js.Json.t => string = "%identity" type textAlign = TableUtils.textAlign = Left | Right diff --git a/src/components/TableLocalFilters.res b/src/components/TableLocalFilters.res index 17f8d6404..7427f1f66 100644 --- a/src/components/TableLocalFilters.res +++ b/src/components/TableLocalFilters.res @@ -1,5 +1,4 @@ external formEventToJsonArr: ReactEvent.Form.t => array = "%identity" -external inputAsString: ReactEvent.Form.t => string = "%identity" module RangeSliderLocalFilter = { @react.component diff --git a/src/components/TableUtils.res b/src/components/TableUtils.res index 9eb8c3d49..c33117d51 100644 --- a/src/components/TableUtils.res +++ b/src/components/TableUtils.res @@ -76,7 +76,6 @@ type hideItem = { } external formEventToStrArr: ReactEvent.Form.t => array = "%identity" -external formEventToString: ReactEvent.Form.t => string = "%identity" external toReactDOMStyle: Js.Json.t => ReactDOM.style = "%identity" external jsonToStr: Js.Json.t => string = "%identity" diff --git a/src/components/TableUtils.resi b/src/components/TableUtils.resi index 75e0c5e82..2b8a6a9f6 100644 --- a/src/components/TableUtils.resi +++ b/src/components/TableUtils.resi @@ -27,7 +27,6 @@ type selectAllSubmitActions = { } type hideItem = {key: string, value: string} external formEventToStrArr: ReactEvent.Form.t => array = "%identity" -external formEventToString: ReactEvent.Form.t => string = "%identity" external toReactDOMStyle: Js.Json.t => ReactDOM.style = "%identity" external jsonToStr: Js.Json.t => string = "%identity" type textAlign = Left | Right diff --git a/src/components/TimeInput.res b/src/components/TimeInput.res index df5f35606..d37eed727 100644 --- a/src/components/TimeInput.res +++ b/src/components/TimeInput.res @@ -26,8 +26,6 @@ module OptionVals = { } } -external asFormEvent: 'a => ReactEvent.Form.t = "%identity" - @react.component let make = ( ~label=?, @@ -70,7 +68,11 @@ let make = ( let arr = [hourVal, minuteVal, secondsVal] Belt.Array.set(arr, index, newVal)->ignore - arr->Js.Array2.map(padNum)->Js.Array2.joinWith(":")->asFormEvent->input.onChange + arr + ->Js.Array2.map(padNum) + ->Js.Array2.joinWith(":") + ->Identity.anyTypeToReactEvent + ->input.onChange }, (hourVal, minuteVal, secondsVal, input.onChange)) let onHourChange = React.useCallback1(changeVal(0), [changeVal]) let onMinuteChange = React.useCallback1(changeVal(1), [changeVal]) diff --git a/src/components/form/ColorPickerInput.res b/src/components/form/ColorPickerInput.res index ccda34e39..e783a469c 100644 --- a/src/components/form/ColorPickerInput.res +++ b/src/components/form/ColorPickerInput.res @@ -1,4 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" @react.component let make = (~input: ReactFinalForm.fieldRenderPropsInput) => { let (color, setColor) = React.useState(_ => @@ -11,7 +10,7 @@ let make = (~input: ReactFinalForm.fieldRenderPropsInput) => { let onChangeComplete = color => { let hex = color->LogicUtils.getDictFromJsonObject->LogicUtils.getString("hex", "") setColor(_ => hex) - input.onChange(hex->toReactEvent) + input.onChange(hex->Identity.anyTypeToReactEvent) } OutsideClick.useOutsideClick( diff --git a/src/components/form/ComboInputField.res b/src/components/form/ComboInputField.res index 2afcabdb8..ac997028b 100644 --- a/src/components/form/ComboInputField.res +++ b/src/components/form/ComboInputField.res @@ -1,7 +1,5 @@ -external inputAsString: ReactEvent.Form.t => string = "%identity" external inputAsArray: ReactEvent.Form.t => array = "%identity" external stringToForm: string => ReactEvent.Form.t = "%identity" -external toReactForm: 'a => ReactEvent.Form.t = "%identity" open LogicUtils @@ -42,7 +40,11 @@ module BaseComponent = { switch fieldType { | String => val | Array => - val->inputAsString->Js.String2.split(",")->Js.Array2.filter(x => x !== "")->toReactForm + val + ->Identity.formReactEventToString + ->Js.String2.split(",") + ->Js.Array2.filter(x => x !== "") + ->Identity.anyTypeToReactEvent }, ) }, @@ -76,13 +78,19 @@ module BaseComponent = { let handleKeyUp = React.useCallback1(ev => { if !submitOnEnter { - let value = {ev->ReactEvent.Keyboard.target}["value"]->inputAsString->Js.String2.trim + let value = + {ev->ReactEvent.Keyboard.target}["value"] + ->Identity.formReactEventToString + ->Js.String2.trim input.onChange(value->stringToForm) } else { let key = ev->ReactEvent.Keyboard.key let keyCode = ev->ReactEvent.Keyboard.keyCode if key === "Enter" || keyCode === 13 { - let value = {ev->ReactEvent.Keyboard.target}["value"]->inputAsString->Js.String2.trim + let value = + {ev->ReactEvent.Keyboard.target}["value"] + ->Identity.formReactEventToString + ->Js.String2.trim switch customSubmitFunction { | Some(fn) => fn(input, value) | None => @@ -200,7 +208,7 @@ let make = ( onBlur: _ev => (), onChange: ev => { setComboVal(_ => "") - let value = ev->inputAsString + let value = ev->Identity.formReactEventToString form.change(selectedMode, Js.Json.null) setSelectedMode(_ => value) }, diff --git a/src/components/form/FileUpload.res b/src/components/form/FileUpload.res index 5a13c8889..9a008509c 100644 --- a/src/components/form/FileUpload.res +++ b/src/components/form/FileUpload.res @@ -1,4 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" external arrToReactEvent: array => ReactEvent.Form.t = "%identity" external strToReactEvent: string => ReactEvent.Form.t = "%identity" @@ -30,13 +29,13 @@ let make = ( let showToast = ToastState.useShowToast() React.useEffect1(() => { - fileNameInput.onChange(fileName->toReactEvent) + fileNameInput.onChange(fileName->Identity.anyTypeToReactEvent) None }, [fileName]) let clearData = _ev => { setFilename(_ => "") - input.onChange(""->Js.Json.string->toReactEvent) + input.onChange(""->Js.Json.string->Identity.anyTypeToReactEvent) setKey(prev => prev + 1) } @@ -67,7 +66,7 @@ let make = ( | _ => true } if !isCorrectFileFormat { - input.onChange(toReactEvent("")) + input.onChange(Identity.anyTypeToReactEvent("")) toast("Invalid file format", ToastError) } else if isValid { switch rowsLimit { @@ -75,7 +74,7 @@ let make = ( let rows = Js.String2.split(file, "\n")->Js.Array2.length if value !== "" && rows - 1 < val { setFilename(_ => filename) - input.onChange(toReactEvent(value)) + input.onChange(Identity.anyTypeToReactEvent(value)) if showUploadtoast { toast("File Uploaded Successfully", ToastSuccess) } @@ -85,7 +84,7 @@ let make = ( | None => if value !== "" { setFilename(_ => filename) - input.onChange(toReactEvent(value)) + input.onChange(Identity.anyTypeToReactEvent(value)) if showUploadtoast { toast("File Uploaded Successfully", ToastSuccess) diff --git a/src/components/form/MultipleTextInput.res b/src/components/form/MultipleTextInput.res index 090a098a2..dfd361611 100644 --- a/src/components/form/MultipleTextInput.res +++ b/src/components/form/MultipleTextInput.res @@ -1,4 +1,3 @@ -external inputAsString: ReactEvent.Form.t => string = "%identity" external stringToFormEvent: string => ReactEvent.Form.t = "%identity" module Tag = { diff --git a/src/components/form/NumericTextInput.res b/src/components/form/NumericTextInput.res index 344a61c34..aafeecfc6 100644 --- a/src/components/form/NumericTextInput.res +++ b/src/components/form/NumericTextInput.res @@ -1,4 +1,3 @@ -external toReactFormEvent: 'a => ReactEvent.Form.t = "%identity" let getFloat = strJson => strJson->Js.Json.decodeString->Belt.Option.flatMap(Belt.Float.fromString) @react.component @@ -94,10 +93,10 @@ let make = ( setLocalStrValue(_ => finalVal->Js.Json.string) switch finalVal->Js.Json.string->getFloat { - | Some(num) => input.onChange(num->toReactFormEvent) + | Some(num) => input.onChange(num->Identity.anyTypeToReactEvent) | None => if value === "" { - input.onChange(Js.Json.null->toReactFormEvent) + input.onChange(Js.Json.null->Identity.anyTypeToReactEvent) } } }, diff --git a/src/components/form/PasswordStrengthInput.res b/src/components/form/PasswordStrengthInput.res index 0072ebed3..ae8b6d747 100644 --- a/src/components/form/PasswordStrengthInput.res +++ b/src/components/form/PasswordStrengthInput.res @@ -1,5 +1,3 @@ -external inputAsString: ReactEvent.Form.t => string = "%identity" - type regexTest = { regex: Js.Re.t, weight: float, diff --git a/src/components/form/PasswordStrengthInputAsChips.res b/src/components/form/PasswordStrengthInputAsChips.res index 3c1fea597..8995dfb9d 100644 --- a/src/components/form/PasswordStrengthInputAsChips.res +++ b/src/components/form/PasswordStrengthInputAsChips.res @@ -1,5 +1,3 @@ -external inputAsString: ReactEvent.Form.t => string = "%identity" - type passwordCheck = { number: bool, lowercase: bool, diff --git a/src/components/form/SelectBoxCard.res b/src/components/form/SelectBoxCard.res index ad4835aaa..70b94f830 100644 --- a/src/components/form/SelectBoxCard.res +++ b/src/components/form/SelectBoxCard.res @@ -1,7 +1,6 @@ module CustomViewSection = { external formEventToInt: ReactEvent.Form.t => int = "%identity" external formEventToStrArr: ReactEvent.Form.t => array = "%identity" - external formEventToStr: ReactEvent.Form.t => string = "%identity" external arrToFormEvent: array<'a> => ReactEvent.Form.t = "%identity" external jsonArrToa: array => array<'a> = "%identity" @@ -48,7 +47,7 @@ module CustomViewSection = { if !allowMultiSelect { for _ in 1 to ev->formEventToInt { Js.Array2.pop(valueArrReversed) - ->Belt.Option.getWithDefault(getDefaultObj(ev->formEventToStr)) + ->Belt.Option.getWithDefault(getDefaultObj(ev->Identity.formReactEventToString)) ->Js.Array.push(finalArr) ->ignore } diff --git a/src/components/priority-logics/AddPLGateway.res b/src/components/priority-logics/AddPLGateway.res index 6001c2f9b..553368796 100644 --- a/src/components/priority-logics/AddPLGateway.res +++ b/src/components/priority-logics/AddPLGateway.res @@ -1,7 +1,5 @@ external arrToReactEvent: array => ReactEvent.Form.t = "%identity" -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" external formEventToStrArr: ReactEvent.Form.t => array = "%identity" -external formEventToStr: ReactEvent.Form.t => string = "%identity" type gateway = PriorityLogicUtils.gateway module GatewayView = { @@ -110,7 +108,7 @@ let make = ( onChange: ev => { let newSelectedOptions = ev->formEventToStrArr if newSelectedOptions->Js.Array2.length === 0 { - gateWaysInput.onChange([]->toReactEvent) + gateWaysInput.onChange([]->Identity.anyTypeToReactEvent) } else { let sharePercent = isDistribute ? 100 / newSelectedOptions->Js.Array2.length : 100 let gatewaysArr = newSelectedOptions->Array.mapWithIndex((item, i) => { @@ -126,7 +124,7 @@ let make = ( } obj }) - gateWaysInput.onChange(gatewaysArr->toReactEvent) + gateWaysInput.onChange(gatewaysArr->Identity.anyTypeToReactEvent) } }, onFocus: _ev => (), @@ -149,7 +147,7 @@ let make = ( disableFallback: newDistributeValue ? item.disableFallback : false, } }) - gateWaysInput.onChange(gatewaysArr->toReactEvent) + gateWaysInput.onChange(gatewaysArr->Identity.anyTypeToReactEvent) } } @@ -157,7 +155,7 @@ let make = ( if isDistribute { selectedOptions ->Js.Array2.map(item => {...item, disableFallback: newFallbackValue}) - ->toReactEvent + ->Identity.anyTypeToReactEvent ->gateWaysInput.onChange } } @@ -177,7 +175,7 @@ let make = ( option } }) - gateWaysInput.onChange(newList->toReactEvent) + gateWaysInput.onChange(newList->Identity.anyTypeToReactEvent) } } @@ -189,7 +187,7 @@ let make = ( option } }) - gateWaysInput.onChange(newList->toReactEvent) + gateWaysInput.onChange(newList->Identity.anyTypeToReactEvent) } let removeItem = index => { @@ -197,7 +195,7 @@ let make = ( selectedOptions ->Js.Array2.map(i => i.gateway_name) ->Array.filterWithIndex((_, i) => i !== index) - ->toReactEvent, + ->Identity.anyTypeToReactEvent, ) } @@ -306,7 +304,7 @@ let make = ( { - enforceGatewayPriorityInput.onChange(v->toReactEvent) + enforceGatewayPriorityInput.onChange(v->Identity.anyTypeToReactEvent) }} isDisabled=false /> @@ -324,7 +322,7 @@ let make = ( { - isDistributeInput.onChange(v->toReactEvent) + isDistributeInput.onChange(v->Identity.anyTypeToReactEvent) onClickDistribute(v) }} isDisabled=false diff --git a/src/components/priority-logics/PriorityLogicUtils.res b/src/components/priority-logics/PriorityLogicUtils.res index c5f7c3bb9..219143a86 100644 --- a/src/components/priority-logics/PriorityLogicUtils.res +++ b/src/components/priority-logics/PriorityLogicUtils.res @@ -1,5 +1,3 @@ -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" - type val = StringArray(array) | String(string) | IntArray(array) | Int(int) | Bool(bool) diff --git a/src/entryPoints/hyperswitch/HyperSwitchApp.res b/src/entryPoints/hyperswitch/HyperSwitchApp.res index e8f6b0dcf..56513e9f8 100644 --- a/src/entryPoints/hyperswitch/HyperSwitchApp.res +++ b/src/entryPoints/hyperswitch/HyperSwitchApp.res @@ -1,5 +1,4 @@ type modeType = LiveModeDropDown | TestModeDropDown -external formEventToStr: ReactEvent.Form.t => string = "%identity" open UIUtils open HSwitchUtils open HSLocalStorage diff --git a/src/genericUtils/DOMUtils.res b/src/genericUtils/DOMUtils.res index b7cabfb0e..ba46d9617 100644 --- a/src/genericUtils/DOMUtils.res +++ b/src/genericUtils/DOMUtils.res @@ -16,13 +16,11 @@ external event: string => event = "Event" @val @scope(("window", "location")) external windowOrigin: string = "origin" external toString: option => string = "%identity" external convertToStrDict: 't => Js.Json.t = "%identity" -external evToString: ReactEvent.Form.t => string = "%identity" external objToJson: {..} => Js.Json.t = "%identity" external toJson: exn => Js.Json.t = "%identity" external toRespJson: Fetch.Response.t => Js.Json.t = "%identity" @get external keyCode: 'a => int = "keyCode" -external formEventToStr: ReactEvent.Form.t => string = "%identity" external formEventToBoolean: ReactEvent.Form.t => bool = "%identity" @send external querySelectorAll: (document, string) => array = "querySelectorAll" diff --git a/src/genericUtils/Identity.res b/src/genericUtils/Identity.res new file mode 100644 index 000000000..5829ad371 --- /dev/null +++ b/src/genericUtils/Identity.res @@ -0,0 +1,3 @@ +external formReactEventToString: ReactEvent.Form.t => string = "%identity" +external stringToFormReactEvent: string => ReactEvent.Form.t = "%identity" +external anyTypeToReactEvent: 'a => ReactEvent.Form.t = "%identity" diff --git a/src/screens/HyperSwitch/Analytics/Analytics.res b/src/screens/HyperSwitch/Analytics/Analytics.res index 9f54e85ec..454ecf467 100644 --- a/src/screens/HyperSwitch/Analytics/Analytics.res +++ b/src/screens/HyperSwitch/Analytics/Analytics.res @@ -1,10 +1,8 @@ external toString: option => string = "%identity" external convertToStrDict: 't => Js.Json.t = "%identity" -external evToString: ReactEvent.Form.t => string = "%identity" external asJson: 'a => Js.Json.t = "%identity" external sankeyTest: string => SankeyCharts.sankeyEntity = "%identity" @get external keyCode: 'a => int = "keyCode" -external formEventToStr: ReactEvent.Form.t => string = "%identity" type window @val external window: window = "window" @scope("window") @val external parent: window = "parent" diff --git a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res index 05be61eba..9b4ae3a84 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorAccountDetails.res @@ -1,5 +1,4 @@ external formEventToBool: ReactEvent.Form.t => bool = "%identity" -external formEventToStr: ReactEvent.Form.t => string = "%identity" let connectorsWithIntegrationSteps: array = [ ADYEN, diff --git a/src/screens/HyperSwitch/Connectors/ConnectorList.res b/src/screens/HyperSwitch/Connectors/ConnectorList.res index eff322ee2..7936a1322 100644 --- a/src/screens/HyperSwitch/Connectors/ConnectorList.res +++ b/src/screens/HyperSwitch/Connectors/ConnectorList.res @@ -1,5 +1,3 @@ -external formEventToStr: ReactEvent.Form.t => string = "%identity" - let p1MediumTextStyle = HSwitchUtils.getTextClass(~textVariant=P1, ~paragraphTextVariant=Medium, ()) module RequestConnector = { diff --git a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegrationTypes.res b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegrationTypes.res index 3e0da0950..e3438d581 100644 --- a/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegrationTypes.res +++ b/src/screens/HyperSwitch/Connectors/Wallets/ApplePayWalletIntegrationTypes.res @@ -7,4 +7,3 @@ type verifyApplePay = { domain_names: array, merchant_connector_account_id: string, } -external toForm: 'a => ReactEvent.Form.t = "%identity" diff --git a/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res b/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res index 1c16dbcce..361371c48 100644 --- a/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res +++ b/src/screens/HyperSwitch/FraudAndRisk/FRMPaymentMethods.res @@ -1,5 +1,4 @@ external convertToJsonDict: 't => Js.Dict.t = "%identity" -external asJson: 'a => ReactEvent.Form.t = "%identity" module RadioSection = { open ConnectorTypes @@ -26,7 +25,7 @@ module RadioSection = { | ActionType => paymentMethodTypeInfo.action = option } - setConfigJson(frmConfigs->asJson) + setConfigJson(frmConfigs->Identity.anyTypeToReactEvent) }
@@ -147,7 +146,7 @@ module CheckBoxRenderer = { _ => { frmConfigInfo.payment_methods = [] setIsOpen(_ => !isOpen) - setConfigJson(frmConfigs->asJson) + setConfigJson(frmConfigs->Identity.anyTypeToReactEvent) } }, }, @@ -166,7 +165,7 @@ module CheckBoxRenderer = { switch connectorPaymentMethods { | Some(paymentMethods) => { frmConfigInfo.payment_methods = paymentMethods->generateFRMPaymentMethodsConfig - setConfigJson(frmConfigs->asJson) + setConfigJson(frmConfigs->Identity.anyTypeToReactEvent) } | _ => () } @@ -176,7 +175,7 @@ module CheckBoxRenderer = { showConfitmation() } else { frmConfigInfo.payment_methods = [] - setConfigJson(frmConfigs->asJson) + setConfigJson(frmConfigs->Identity.anyTypeToReactEvent) setIsOpen(_ => !isOpen) } } @@ -188,7 +187,7 @@ module CheckBoxRenderer = { switch connectorPaymentMethods { | Some(paymentMethods) => { frmConfigInfo.payment_methods = paymentMethods->generateFRMPaymentMethodsConfig - setConfigJson(frmConfigs->asJson) + setConfigJson(frmConfigs->Identity.anyTypeToReactEvent) } | _ => () } @@ -298,7 +297,7 @@ module PaymentMethodsRenderer = { }) setConnectorConfig(_ => connectorsConfig) - setConfigJson(updateFRMConfig->asJson) + setConfigJson(updateFRMConfig->Identity.anyTypeToReactEvent) setPageState(_ => Success) } catch { | _ => setPageState(_ => Error("Failed to fetch")) diff --git a/src/screens/HyperSwitch/Home/HomeUtils.res b/src/screens/HyperSwitch/Home/HomeUtils.res index e5f9b2d7b..39ec58d1c 100644 --- a/src/screens/HyperSwitch/Home/HomeUtils.res +++ b/src/screens/HyperSwitch/Home/HomeUtils.res @@ -1,4 +1,3 @@ -external formEventToStr: ReactEvent.Form.t => string = "%identity" open CardUtils open PageUtils open HSwitchUtils diff --git a/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res b/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res index 63effeb51..ea50ce0f3 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AddRuleGateway.res @@ -1,7 +1,5 @@ external arrToReactEvent: array => ReactEvent.Form.t = "%identity" -external toReactEvent: 'a => ReactEvent.Form.t = "%identity" external formEventToStrArr: ReactEvent.Form.t => array = "%identity" -external formEventToStr: ReactEvent.Form.t => string = "%identity" external toJson: 'a => Js.Json.t = "%identity" external anyToEnum: 'a => AdvancedRoutingTypes.connectorSelectionData = "%identity" @@ -22,7 +20,7 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { } else { "priority" } - gateWaysType.onChange(typeString->toReactEvent) + gateWaysType.onChange(typeString->Identity.anyTypeToReactEvent) None }, [isDistributeInput.value]) @@ -42,7 +40,7 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { let newSelectedOptions = ev->formEventToStrArr if newSelectedOptions->Js.Array2.length === 0 { - gateWaysInput.onChange([]->toReactEvent) + gateWaysInput.onChange([]->Identity.anyTypeToReactEvent) } else { let gatewaysArr = newSelectedOptions->Js.Array2.map(item => { open AdvancedRoutingTypes @@ -67,7 +65,7 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { }->toJson } }) - gateWaysInput.onChange(gatewaysArr->toReactEvent) + gateWaysInput.onChange(gatewaysArr->Identity.anyTypeToReactEvent) } }, onFocus: _ev => (), @@ -106,7 +104,7 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { | VolumeObject(obj) => obj.connector->toJson } }) - gateWaysInput.onChange(gatewaysArr->toReactEvent) + gateWaysInput.onChange(gatewaysArr->Identity.anyTypeToReactEvent) } let updatePercentage = (item: AdvancedRoutingTypes.connectorSelectionData, value) => { @@ -134,7 +132,7 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { }->toJson } }) - gateWaysInput.onChange(newList->toReactEvent) + gateWaysInput.onChange(newList->Identity.anyTypeToReactEvent) } } @@ -145,7 +143,7 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { AdvancedRoutingUtils.getConnectorStringFromConnectorSelectionData(i).merchant_connector_id ) ->Array.filterWithIndex((_, i) => i !== index) - ->toReactEvent, + ->Identity.anyTypeToReactEvent, ) } @@ -234,7 +232,7 @@ let make = (~id, ~gatewayOptions, ~isFirst=false, ~isExpanded=false) => { { - isDistributeInput.onChange(v->toReactEvent) + isDistributeInput.onChange(v->Identity.anyTypeToReactEvent) onClickDistribute(v) }} isDisabled=false diff --git a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res index 28e1d3092..2b5db95f3 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res +++ b/src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res @@ -3,9 +3,7 @@ open AdvancedRoutingUtils open FormRenderer external arrToFormEvent: array<'a> => ReactEvent.Form.t = "%identity" -external toForm: 'a => ReactEvent.Form.t = "%identity" external strToFormEvent: Js.String.t => ReactEvent.Form.t = "%identity" -external formEventToStr: ReactEvent.Form.t => string = "%identity" external formEventToStrArr: ReactEvent.Form.t => array = "%identity" module LogicalOps = { @@ -55,8 +53,8 @@ module OperatorInp = { name: "string", onBlur: _ev => (), onChange: ev => { - let value = ev->formEventToStr - operator.onChange(value->toForm) + let value = ev->Identity.formReactEventToString + operator.onChange(value->Identity.anyTypeToReactEvent) }, onFocus: _ev => (), value: operator.value, @@ -74,7 +72,7 @@ module OperatorInp = { setOpVals(_ => operatorVals) if operator.value->Js.Json.decodeString->Belt.Option.isNone { - operator.onChange(operatorVals[0]->toForm) + operator.onChange(operatorVals[0]->Identity.anyTypeToReactEvent) } None }, (field.value, valInp.value)) @@ -139,7 +137,7 @@ module ValueInp = { | NOT_CONTAINS => "enum_variant_array" | _ => "number" } - }->toForm, + }->Identity.anyTypeToReactEvent, ) None }, [valueField.value]) @@ -149,7 +147,7 @@ module ValueInp = { onBlur: _ev => (), onChange: ev => { let value = ev->formEventToStrArr - valueField.onChange(value->toForm) + valueField.onChange(value->Identity.anyTypeToReactEvent) }, onFocus: _ev => (), value: valueField.value, @@ -209,12 +207,12 @@ module MetadataInp = { }) let finalVal = Js.Array2.joinWith(arrStr, ",")->Js.Json.string - valueField.onChange(finalVal->toForm) + valueField.onChange(finalVal->Identity.anyTypeToReactEvent) }, onChange: ev => { let target = ReactEvent.Form.target(ev) let value = target["value"] - valueField.onChange(value->toForm) + valueField.onChange(value->Identity.anyTypeToReactEvent) }, onFocus: _ev => (), value: valueField.value, @@ -295,11 +293,11 @@ module FieldInp = { name: "string", onBlur: _ev => (), onChange: ev => { - let value = ev->formEventToStr + let value = ev->Identity.formReactEventToString onChangeMethod(value) - field.onChange(value->toForm) - op.onChange(""->toForm) - val.onChange(""->toForm) + field.onChange(value->Identity.anyTypeToReactEvent) + op.onChange(""->Identity.anyTypeToReactEvent) + val.onChange(""->Identity.anyTypeToReactEvent) }, onFocus: _ev => (), value: field.value, diff --git a/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res b/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res index 647bc5b71..ab7949efb 100644 --- a/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res +++ b/src/screens/HyperSwitch/RoutingRevamp/BasicDetailsForm.res @@ -2,9 +2,6 @@ open FormRenderer open LogicUtils open AdvancedRoutingTypes -external fromFormEvent: ReactEvent.Form.t => 'a = "%identity" -external formEventToStr: ReactEvent.Form.t => string = "%identity" - let configurationNameInput = makeFieldInfo( ~label="Configuration Name", ~name="name", @@ -43,7 +40,7 @@ module BusinessProfileInp = { value: profile->Js.Json.string, onChange: { ev => { - setProfile(_ => ev->formEventToStr) + setProfile(_ => ev->Identity.formReactEventToString) input.onChange(ev) } }, diff --git a/src/screens/HyperSwitch/SDKPayment/SDKPage.res b/src/screens/HyperSwitch/SDKPayment/SDKPage.res index 2e37537e2..fe9300e49 100644 --- a/src/screens/HyperSwitch/SDKPayment/SDKPage.res +++ b/src/screens/HyperSwitch/SDKPayment/SDKPage.res @@ -1,6 +1,5 @@ let h3Leading2Style = HSwitchUtils.getTextClass(~textVariant=H3, ~h3TextVariant=Leading_2, ()) external toJson: 'a => Js.Json.t = "%identity" -external formEventToStr: ReactEvent.Form.t => string = "%identity" external strToFormEvent: Js.String.t => ReactEvent.Form.t = "%identity" module SDKConfiguarationFields = { @@ -55,7 +54,8 @@ module SDKConfiguarationFields = { value: (initialValues.amount / 100)->string_of_int->Js.Json.string, onChange: { ev => { - let eventValueToInt = ev->formEventToStr->LogicUtils.getIntFromString(0) + let eventValueToInt = + ev->Identity.formReactEventToString->LogicUtils.getIntFromString(0) let valInCents = (eventValueToInt * 100)->string_of_int->strToFormEvent input.onChange(valInCents) } diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res index e54d0211f..d07bd6a18 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchSandboxOnboarding/UserOnboardingUIUtils.res @@ -1,4 +1,3 @@ -external formEventToStr: ReactEvent.Form.t => string = "%identity" open UserOnboardingTypes open UserOnboardingUtils @@ -284,7 +283,7 @@ module BackendFrontendPlatformLangDropDown = { name: "Platform Selecr", onBlur: _ev => (), onChange: ev => { - let val = ev->formEventToStr->getPlatform + let val = ev->Identity.formReactEventToString->getPlatform setPlatform(_ => val) hyperswitchMixPanel(~pageName=urlHead, ~contextName, ~actionName={(val :> string)}, ()) }, @@ -300,7 +299,7 @@ module BackendFrontendPlatformLangDropDown = { name: "BackEnd", onBlur: _ev => (), onChange: ev => { - let val = ev->formEventToStr->getLangauge + let val = ev->Identity.formReactEventToString->getLangauge setBackEndLang(_ => val) hyperswitchMixPanel(~pageName=urlHead, ~contextName, ~actionName={(val :> string)}, ()) }, @@ -312,7 +311,7 @@ module BackendFrontendPlatformLangDropDown = { name: "FrontEnd", onBlur: _ev => (), onChange: ev => { - let val = ev->formEventToStr->getLangauge + let val = ev->Identity.formReactEventToString->getLangauge setFrontEndLang(_ => val) hyperswitchMixPanel(~pageName=urlHead, ~contextName, ~actionName={(val :> string)}, ()) }, diff --git a/src/screens/analyticsScreens/AnalyticsCommonComponents.res b/src/screens/analyticsScreens/AnalyticsCommonComponents.res index bde445c44..8e20b3751 100644 --- a/src/screens/analyticsScreens/AnalyticsCommonComponents.res +++ b/src/screens/analyticsScreens/AnalyticsCommonComponents.res @@ -1,11 +1,10 @@ external toString: option => string = "%identity" external convertToStrDict: 't => Js.Json.t = "%identity" -external evToString: ReactEvent.Form.t => string = "%identity" external objToJson: {..} => Js.Json.t = "%identity" external toJson: exn => Js.Json.t = "%identity" external toRespJson: Fetch.Response.t => Js.Json.t = "%identity" @get external keyCode: 'a => int = "keyCode" -external formEventToStr: ReactEvent.Form.t => string = "%identity" + type window @val external window: window = "window" @scope("window") @val external parent: window = "parent" @@ -348,7 +347,7 @@ module AnalyticsSaveViewNew = { name: "savedView", onBlur: _ev => (), onChange: ev => { - let appliedVal = ev->formEventToStr + let appliedVal = ev->Identity.formReactEventToString if appliedVal === "baseView" { updateExistingKeys(defaultSearchDict) setAppliedSaveView(_ => SaveViewEntity.defaultSaveView) @@ -1305,7 +1304,7 @@ module SankeyWithDropDown = { onBlur: _ev => (), onChange: ev => { setSankeyCardinality(_ => { - ev->formEventToStr->Belt.Int.fromString->Belt.Option.getWithDefault(5) + ev->Identity.formReactEventToString->Belt.Int.fromString->Belt.Option.getWithDefault(5) }) }, onFocus: _ev => (), @@ -1651,7 +1650,7 @@ module ErrorOnCellClick = { let modalInput: ReactFinalForm.fieldRenderPropsInput = { name: "modalInput", onBlur: _ev => (), - onChange: ev => renderModalChart(ev->evToString), + onChange: ev => renderModalChart(ev->Identity.formReactEventToString), onFocus: _ev => (), value: ""->Js.Json.string, checked: true, diff --git a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res index 7a102d294..5de1d1904 100644 --- a/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res +++ b/src/screens/login/HSwitchLoginFlow/HyperSwitchAuthUtils.res @@ -1,5 +1,4 @@ open HyperSwitchAuthTypes -external formEventToStr: ReactEvent.Form.t => string = "%identity" module TermsAndCondition = { @react.component