repo
stringclasses
4 values
file_path
stringlengths
6
193
extension
stringclasses
23 values
content
stringlengths
0
1.73M
token_count
int64
0
724k
__index_level_0__
int64
0
10.8k
hyperswitch-control-center
src/utils/GlobalVars.res
.res
@val external appVersion: string = "appVersion" type appName = [ | #hyperswitch ] type appEnv = [#production | #sandbox | #integration | #development] let isLocalhost = Window.Location.hostname === "localhost" || Window.Location.hostname === "127.0.0.1" let dashboardPrefix = "dashboard" let dashboardBasePath = ...
463
9,921
hyperswitch-control-center
src/utils/AccessControl.res
.res
open CommonAuthTypes @react.component let make = (~isEnabled=true, ~authorization, ~children) => { let isAccessAllowed = authorization === Access isEnabled && isAccessAllowed ? children : <UnauthorizedPage /> }
48
9,922
hyperswitch-control-center
src/utils/MapTypes.res
.res
type rec map = {entries: unit => map} @new external create: 't => map = "Map" type object = {fromEntries: map => JSON.t} external object: object = "Object"
44
9,923
hyperswitch-control-center
src/utils/DateTimeUtils.res
.res
type days = Sunday | Monday | Tuesday | Wednesday | Thrusday | Friday | Saturday let daysArr = [Sunday, Monday, Tuesday, Wednesday, Thrusday, Friday, Saturday] let dayMapper = (days: days) => { switch days { | Sunday => "Sunday" | Monday => "Monday" | Tuesday => "Tuesda" | Wednesday => "Wednesday" | Thrus...
1,863
9,924
hyperswitch-control-center
src/utils/ModalCloseIcon.res
.res
@react.component let make = (~fill="#7c7d82", ~onClick) => { <AddDataAttributes attributes=[("data-component", `modalCloseIcon`)]> <div className="" onClick> <Icon name="close" className="border-2 p-2 rounded-2xl bg-gray-100 cursor-pointer" size=30 /> </div> </AddDataAttributes> }
91
9,925
hyperswitch-control-center
src/utils/Identity.res
.res
external formReactEventToString: ReactEvent.Form.t => string = "%identity" external stringToFormReactEvent: string => ReactEvent.Form.t = "%identity" external anyTypeToReactEvent: 'a => ReactEvent.Form.t = "%identity" external arrofStringToReactEvent: array<string> => ReactEvent.Form.t = "%identity" external jsonToNull...
350
9,926
hyperswitch-control-center
src/utils/ModalUtils.res
.res
let getHeaderTextClass = _ => "text-lg font-semibold leading-6" let getAnimationClass = showModal => switch showModal { | true => "animate-slideUp animate-fadeIn" | _ => "" } let getCloseIcon = onClick => { <Icon name="modal-close-icon" className="cursor-pointer" size=30 onClick /> }
76
9,927
hyperswitch-control-center
src/utils/CurrencyUtils.res
.res
type currencyCode = | AED | ALL | AMD | ANG | ARS | AUD | AWG | AZN | BBD | BDT | BHD | BMD | BND | BOB | BRL | BSD | BWP | BZD | CAD | CHF | COP | CRC | CUP | CZK | DKK | DOP | DZD | EGP | ETB | EUR | FJD | GBP | GHS | GIP | GMD | GTQ | GYD | ...
4,929
9,928
hyperswitch-control-center
src/utils/AnalyticsNewUtils.res
.res
open DateTimeUtils open LogicUtils type timeZone = UTC | IST let calculateHistoricTime = ( ~startTime: string, ~endTime: string, ~format: string="YYYY-MM-DDTHH:mm:ss[Z]", ~timeZone: timeZone=UTC, ) => { let toUtc = switch timeZone { | UTC => toUtc | IST => val => val } if startTime->LogicUtils.isNonEm...
3,767
9,929
hyperswitch-control-center
src/utils/Modal.resi
.resi
type modalData = {heading: string, content: React.element} module ModalHeading: { @react.component let make: ( ~headingClass: string, ~headerTextClass: string, ~headerAlignmentClass: string, ~modalHeading: string, ~showCloseIcon: bool, ~showCloseOnLeft: bool, ~showBackIcon: bool, ~le...
791
9,930
hyperswitch-control-center
src/utils/CurrencyFormatUtils.res
.res
type currencyFormat = | IND | USD | DefaultConvert
17
9,931
hyperswitch-control-center
src/utils/UrlFetchUtils.res
.res
let getFilterValue = value => { if String.includes(value, "[") { let str = String.slice(~start=1, ~end=value->String.length - 1, value) let splitArray = String.split(str, ",") let jsonarr = splitArray->Array.map(val => JSON.Encode.string(val)) JSON.Encode.array(jsonarr) } else { JSON.Encode.stri...
88
9,932
hyperswitch-control-center
src/utils/ArrayUtils.res
.res
let getUniqueStrArray = (arr: array<string>) => { arr ->Array.map(item => { (item, 0) }) ->Dict.fromArray ->Dict.keysToArray }
46
9,933
hyperswitch-control-center
src/utils/DownloadUtils.res
.res
type blobInstanceType @new external blob: (array<'a>, {"type": string}) => blobInstanceType = "Blob" @val @scope(("window", "URL")) external createObjectURL: blobInstanceType => string = "createObjectURL" @send external clickElement: Dom.element => unit = "click" let download = (~fileName, ~content, ~fileType) => { ...
203
9,934
hyperswitch-control-center
src/utils/BreadCrumbNavigation.res
.res
type breadcrumb = { title: string, link: string, onClick?: ReactEvent.Mouse.t => unit, warning?: string, mixPanelCustomString?: string, } let arrowDivider = <span className="ml-2 mr-2"> <Icon className="align-middle text-jp-gray-930" size=8 name="chevron-right" /> </span> type dividerVal = | Slash ...
900
9,935
hyperswitch-control-center
src/utils/UserTimeZoneTypes.res
.res
type timezoneData = { offset: string, region: string, title: string, } type timeZoneType = | GMT | EAT | CET | WAT | CAT | EET | CEST | SAST | HDT | AKDT | AST | EST | CDT | CST | MDT | MST | EDT | ADT | PDT | NDT | AEST | NZST | EEST | HKT | WIB | WIT | IDT ...
258
9,936
hyperswitch-control-center
src/utils/DateRangeUtils.res
.res
type customDateRange = | Today | Tomorrow | Yesterday | ThisMonth | LastMonth | LastSixMonths | NextMonth | Hour(float) | Day(float) type compareOption = | No_Comparison | Previous_Period | Custom @unboxed type comparison = | EnableComparison | DisableComparison let comparisonMapprer = val ...
3,280
9,937
hyperswitch-control-center
src/utils/UseEvent.res
.res
let useEvent0 = callback => { let callbackRef = React.useRef(callback) React.useEffect(() => { callbackRef.current = callback None }, [callback]) React.useCallback(() => { callbackRef.current() }, []) }
56
9,938
hyperswitch-control-center
src/utils/LazyUtils.res
.res
type lazyScreen type lazyScreenLoader = unit => promise<lazyScreen> @val external import_: string => promise<lazyScreen> = "import" type reactLazy<'component> = lazyScreenLoader => 'component @module("react") @val external reactLazy: reactLazy<'a> = "lazy"
68
9,939
hyperswitch-control-center
src/utils/DOMUtils.res
.res
type document = {mutable title: string} type window = {mutable _env_: HyperSwitchConfigTypes.urlConfig} @val external document: document = "document" @send external getElementById: (document, string) => Dom.element = "getElementById" @send external createElement: (document, string) => Dom.element = "createElement" @val...
299
9,940
hyperswitch-control-center
src/utils/NumericUtils.res
.res
// Copied from https://gist.github.com/Frencil/aab561687cdd2b0de04a let pretty = (range: array<float>, n: int) => { if range->Array.length === 2 { let range = if range[0] === range[1] { [0., range[1]->Option.getOr(0.)] } else { range } let min_n = Int.toFloat(n) /. 3. let shrink_sml ...
639
9,941
hyperswitch-control-center
src/utils/FormDataUtils.res
.res
type formData @new external formData: unit => Fetch.formData = "FormData" @send external append: (Fetch.formData, string, 'a) => unit = "append"
36
9,942
hyperswitch-control-center
src/utils/UrlUtils.res
.res
let useGetFilterDictFromUrl = prefix => { let url = RescriptReactRouter.useUrl() let (searchParamsDict, setSearchParamDict) = React.useState(_ => Dict.make()) React.useEffect(() => { if url.search->LogicUtils.isNonEmptyString { let searcParamsToDict = url.search ->decodeURI ->St...
278
9,943
hyperswitch-control-center
src/utils/JsonFlattenUtils.res
.res
let rec flattenObject = (obj, addIndicatorForObject) => { let newDict = Dict.make() switch obj->JSON.Decode.object { | Some(obj) => obj ->Dict.toArray ->Array.forEach(entry => { let (key, value) = entry if value->Identity.jsonToNullableJson->Js.Nullable.isNullable { Dict.set(newDi...
484
9,944
hyperswitch-control-center
src/utils/Modal.res
.res
open ModalUtils type modalData = { heading: string, content: React.element, } module Back = { @react.component let make = (~onClick) => { <Icon size=18 name="chevron-left" className="cursor-pointer opacity-50 dark:opacity-100 " onClick /> } } module ModalHeading = { @react.component let m...
2,467
9,945
hyperswitch-control-center
src/utils/Country.res
.res
type timezoneType = { isoAlpha3: string, timeZones: array<string>, countryName: CountryUtils.countries, isoAlpha2: CountryUtils.countiesCode, } let defaultTimeZone = { isoAlpha3: "", timeZones: [], countryName: UnitedStatesOfAmerica, isoAlpha2: US, } let country = [ { isoAlpha3: "AFG", timeZ...
6,598
9,946
hyperswitch-control-center
src/utils/ResizeObserver.res
.res
type observer type dimensions @new external newResizerObserver: (array<dimensions> => unit) => observer = "ResizeObserver"
29
9,947
hyperswitch-control-center
src/utils/DictionaryUtils.res
.res
let deleteKey = (dictionary: Dict.t<'a>, key: string) => { dictionary ->Dict.toArray ->Belt.Array.keepMap(entry => { let (filterKey, _) = entry key !== filterKey ? Some(entry) : None }) ->Dict.fromArray } let deleteKeys = (dictionary: Dict.t<'a>, keys: array<string>) => { let updatedDict = dict...
751
9,948
hyperswitch-control-center
src/utils/LogicUtilsTypes.res
.res
type valueType = | Amount | Rate | Volume | Latency | LatencyMs | FormattedAmount | AmountWithSuffix | Default
42
9,949
hyperswitch-control-center
src/utils/Reveal.res
.res
type postion = Top | Right
8
9,950
hyperswitch-control-center
src/utils/LoaderModal.res
.res
@react.component let make = (~showModal, ~setShowModal, ~text) => { <RenderIf condition={showModal}> <Modal showModal setShowModal modalClass="w-80 !h-56 flex items-center justify-center m-auto" paddingClass="" childClass="flex items-center justify-center h-full w-full"> <div c...
134
9,951
hyperswitch-control-center
src/utils/CountryUtils.res
.res
type countries = | AlandIslands | Albania | Afghanistan | Algeria | AmericanSamoa | Andorra | Angola | Anguilla | Antarctica | AntiguaAndBarbuda | Argentina | Armenia | Aruba | Australia | Austria | Azerbaijan | Bahamas | Bahrain | Bangladesh | Barbados | Belarus | Belgium ...
16,889
9,952
hyperswitch-control-center
src/utils/IframeUtils.res
.res
@val external document: 'a = "document" type window type parent @val external window: window = "window" @val @scope("window") external iframeParent: parent = "parent" type event = {data: string} @get external contentWindow: Dom.element => Dom.element = "contentWindow" @send external postMessageToParent: (parent, JSON....
223
9,953
hyperswitch-control-center
src/utils/TimeZoneUtils.res
.res
let getUserTimeZoneString = () => { Date.make()->Js.Date.toTimeString->String.split(" ")->Array.get(1)->Option.getOr("") } let getUserTimeZone = () => { open UserTimeZoneTypes let userTimeZone = getUserTimeZoneString() switch userTimeZone { | "GMT+0000" => GMT | "GMT+0300" => EAT | "GMT+0100" => CET ...
367
9,954
hyperswitch-control-center
src/utils/PromiseUtils.res
.res
// Pollyfill for Promise.allSettled() // Promise.allSettled() takes an iterable of promises and returns a single promise that is fulfilled with an array of promise settlement result let allSettledPolyfill = (arr: array<promise<JSON.t>>) => { arr ->Array.map(promise => promise ->Promise.then(val => { ...
152
9,955
hyperswitch-control-center
src/utils/TimeZoneConversion.res
.res
type timeZoneObject = {timeZone: string} @send external toLocaleString: (Date.t, string, timeZoneObject) => string = "toLocaleString" type dateTime = { year: float, month: float, date: float, hour: float, minute: float, second: float, } let timezoneOffset = Dict.fromArray([("IST", "+05:30"), ("GMT", "+00:...
400
9,956
hyperswitch-control-center
src/utils/AnalyticsTypesUtils.res
.res
type dataState<'a> = Loaded('a) | Loading | LoadedError type metricsType = | Latency | Volume | Rate | Amount | NegativeRate type timeObj = { apiStartTime: float, apiEndTime: float, }
61
9,957
hyperswitch-control-center
src/utils/UserPrefUtils.res
.res
open LogicUtils type moduleVisePref = { searchParams?: string, moduleConfig?: Dict.t<JSON.t>, // we store array of string here } type userPref = { lastVisitedTab?: string, moduleVisePref?: Dict.t<moduleVisePref>, } external userPrefToJson: userPref => JSON.t = "%identity" // DO NOT CHANGE THE KEYS let userPre...
629
9,958
hyperswitch-control-center
src/utils/RenderIf.res
.res
@react.component let make = (~condition, ~children) => { if condition { children } else { React.null } }
33
9,959
hyperswitch-control-center
src/utils/LogicUtils.res
.res
let isEmptyString = str => str->String.length === 0 let isNonEmptyString = str => str->String.length > 0 let methodStr = (method: Fetch.requestMethod) => { switch method { | Get => "GET" | Head => "HEAD" | Post => "POST" | Put => "PUT" | Delete => "DELETE" | Connect => "CONNECT" | Options => "OPTIONS"...
5,784
9,960
hyperswitch-control-center
src/utils/HyperSwitchUtils.res
.res
let getMixpanelRouteName = (pageTitle, url: RescriptReactRouter.url) => { switch (url.path, url.search) { | (list{"payments", ""}, _) | (list{"refunds", ""}, _) | (list{"disputes", ""}, _) | (list{"connectors", ""}, _) | (list{"routing", ""}, _) | (list{"settings"}, "") => `/${pageTitle}` | (list{"o...
474
9,961
hyperswitch-control-center
src/utils/Form.res
.res
let defaultSubmit = (_, _) => { Nullable.null->Promise.resolve } module FormBody = { @react.component let make = (~children, ~formClass, ~handleSubmit, ~submitOnEnter) => { let form = ReactFinalForm.useForm() let formRef = React.useRef(Nullable.null) React.useEffect(() => { let onKeyDown = (ev: ...
377
9,962
hyperswitch-control-center
src/utils/Mappers/MerchantAccountDetailsMapper.res
.res
open HSwitchSettingTypes let getMerchantDetails = (values: JSON.t) => { open LogicUtils let valuesDict = values->getDictFromJsonObject let merchantDetails = valuesDict->getObj("merchant_details", Dict.make()) let address = merchantDetails->getObj("address", Dict.make()) let primary_business_details = val...
663
9,963
hyperswitch-control-center
src/utils/Mappers/GroupACLMapper.res
.res
open CommonAuthTypes open UserManagementTypes let mapGroupAccessTypeToString = groupAccessType => switch groupAccessType { | OperationsView => "operations_view" | OperationsManage => "operations_manage" | ConnectorsView => "connectors_view" | ConnectorsManage => "connectors_manage" | WorkflowsView => "work...
1,153
9,964
hyperswitch-control-center
src/utils/Mappers/BusinessProfileMapper.res
.res
open HSwitchSettingTypes let constructWebhookDetailsObject = webhookDetailsDict => { open LogicUtils let webhookDetails = { webhook_version: webhookDetailsDict->getOptionString("webhook_version"), webhook_username: webhookDetailsDict->getOptionString("webhook_username"), webhook_password: webhookDetail...
799
9,965
hyperswitch-control-center
src/components/TimeInput.res
.res
let padNum = num => { let str = num->Int.toString if str->String.length === 1 { `0${str}` } else { str } } module OptionVals = { @react.component let make = (~upto=60, ~value, ~onChange, ~isDisabled) => { let cursorClass = isDisabled ? "cursor-not-allowed" : "" <select value={value->In...
727
9,966
hyperswitch-control-center
src/components/DynamicSingleStat.res
.res
type chartType = Default | Table type singleStatData = { title: string, tooltipText: string, deltaTooltipComponent: string => React.element, value: float, delta: float, data: array<(float, float)>, statType: string, showDelta: bool, label?: string, } type columnsType<'colType> = { colType: 'colTyp...
4,947
9,967
hyperswitch-control-center
src/components/CustomExpandableTable.res
.res
open Table @react.component let make = ( ~title, ~heading=[], ~rows, ~offset=0, ~fullWidth=true, ~showScrollBar=false, ~setFilterObj=?, ~filterObj=?, ~onExpandIconClick, ~expandedRowIndexArray, ~getRowDetails, ~showSerial=false, ) => { if showSerial { heading->Array.unshift(makeHeaderInfo...
1,330
9,968
hyperswitch-control-center
src/components/DesktopView.res
.res
@react.component let make = (~children) => { let isMobileView = MatchMedia.useMobileChecker() <RenderIf condition={!isMobileView}> children </RenderIf> }
40
9,969
hyperswitch-control-center
src/components/InfraCalendar.res
.res
type month = Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec type highlighter = { highlightSelf: bool, highlightLeft: bool, highlightRight: bool, } module TableRow = { let defaultCellHighlighter = _ => { highlightSelf: false, highlightLeft: false, highlightRight: false, } ...
2,470
9,970
hyperswitch-control-center
src/components/ACLDiv.res
.res
@react.component let make = ( ~authorization, ~onClick, ~children, ~className="", ~noAccessDescription=?, ~description=?, ~tooltipWidthClass=?, ~isRelative=?, ~showTooltip=true, ~contentAlign=?, ~justifyClass=?, ~tooltipForWidthClass=?, ~dataAttrStr=?, ~height=?, ) => { switch showTooltip ...
231
9,971
hyperswitch-control-center
src/components/DateRangeCompareFields.res
.res
let defaultCellHighlighter = (_): Calendar.highlighter => { { highlightSelf: false, highlightLeft: false, highlightRight: false, } } let useErrorValueResetter = (value: string, setValue: (string => string) => unit) => { React.useEffect(() => { let isErroryTimeValue = _ => { try { fa...
5,891
9,972
hyperswitch-control-center
src/components/DynamicFilter.res
.res
module CustomFilters = { @react.component let make = ( ~setShowModal, ~tabNames, ~moduleName as _, ~setCustomFilter, ~currentFilterValue, ) => { open LogicUtils let (errMessage, setErrMessage) = React.useState(_ => "") let (completionDisposable, setCompletionDisposable) = Recoil.u...
1,820
9,973
hyperswitch-control-center
src/components/DatePicker.res
.res
@react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, ~isDisabled=false, ~disablePastDates=true, ~disableFutureDates=false, ~format="YYYY-MM-DDTHH:mm:ss", ~customButtonStyle="", ~newThemeCustomButtonStyle="", ~leftIcon=?, ~rightIcon=?, ~buttonType=?, ~buttonSize=?, ~customD...
1,970
9,974
hyperswitch-control-center
src/components/Button.res
.res
type buttonState = Normal | Loading | Disabled | NoHover | Focused type buttonVariant = Fit | Long | Full | Rounded type buttonType = | Primary | Secondary | PrimaryOutline | SecondaryFilled | NonFilled | Pagination | Pill | FilterAdd | Delete | Transparent | SelectTransparent | DarkPurple | ...
6,444
9,975
hyperswitch-control-center
src/components/Table.res
.res
include TableUtils module TableFilterRow = { @react.component let make = ( ~item: array<filterRow>, ~removeVerticalLines, ~removeHorizontalLines, ~evenVertivalLines, ~tableDataBorderClass, ~customFilterRowStyle, ~showCheckbox, ) => { let colsLen = item->Array.length let borderC...
7,352
9,976
hyperswitch-control-center
src/components/NoDataFound.res
.res
type renderType = InfoBox | Painting | NotFound | Locked | LoadError | ExtendDateUI @react.component let make = ( ~title=?, ~message, ~renderType: renderType=InfoBox, ~children=?, ~customCssClass="my-6", ~customBorderClass="", ~customMessageCss="", ~handleClick=?, ) => { let prefix = LogicUtils.useUr...
1,173
9,977
hyperswitch-control-center
src/components/ACLButton.resi
.resi
@react.component let make: ( ~text: string=?, ~buttonState: Button.buttonState=?, ~buttonType: Button.buttonType=?, ~buttonVariant: Button.buttonVariant=?, ~buttonSize: Button.buttonSize=?, ~leftIcon: Button.iconType=?, ~rightIcon: Button.iconType=?, ~showBorder: bool=?, ~type_: string=?, ~onClick: ...
283
9,978
hyperswitch-control-center
src/components/DateRangeField.res
.res
let defaultCellHighlighter = (_): Calendar.highlighter => { { highlightSelf: false, highlightLeft: false, highlightRight: false, } } let useErroryValueResetter = (value: string, setValue: (string => string) => unit) => { React.useEffect(() => { let isErroryTimeValue = _ => { try { f...
7,267
9,979
hyperswitch-control-center
src/components/DynamicTabs.res
.res
type tab = { title: string, value: string, isRemovable: bool, description?: string, } let getValueFromArrayTab = (tabsVal: array<tab>, index: int) => { switch tabsVal->Array.get(index) { | Some(val) => val.value | None => "" } } type boundingClient = {x: int, right: int} type scrollIntoViewParams = {be...
4,911
9,980
hyperswitch-control-center
src/components/InputFields.resi
.resi
type customInputFn = ( ~input: ReactFinalForm.fieldRenderPropsInput, ~placeholder: string, ) => React.element type comboCustomInputFn = array<ReactFinalForm.fieldRenderProps> => React.element type comboCustomInputRecord = {fn: comboCustomInputFn, names: array<string>} let selectInput: ( ~options: array<SelectBox....
3,076
9,981
hyperswitch-control-center
src/components/CalendarList.res
.res
external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput< array<string>, > = "%identity" open Calendar @react.component let make = ( ~changeHighlightCellStyle="", ~calendarContaierStyle="", ~month: option<month>=?, ~year: option<int>=?, ~onDateClick=...
1,301
9,982
hyperswitch-control-center
src/components/HSwitchFeedBackModal.res
.res
@react.component let make = ( ~modalHeading, ~setShowModal, ~showModal, ~feedbackVia="user", ~modalType: HSwitchFeedBackModalUtils.modalType=FeedBackModal, ) => { open HSwitchFeedBackModalUtils open APIUtils let {email} = CommonAuthHooks.useCommonAuthInfo()->Option.getOr(CommonAuthHooks.defaultAuthInfo)...
792
9,983
hyperswitch-control-center
src/components/MonacoEditorLazy.res
.res
@react.component let make = ( ~defaultLanguage: string, ~defaultValue=?, ~value=?, ~height=?, ~theme=?, ~readOnly=false, ~width=?, ~onChange=?, ~onValidate=?, ~showCopy=true, ~fontSize=?, ~fontFamily=?, ~fontWeight=?, ~minimap=true, ~outerWidth="w-full", ~onMount: option<Monaco.Editor.IS...
283
9,984
hyperswitch-control-center
src/components/DateRangePicker.res
.res
let defaultCellHighlighter = (_): Calendar.highlighter => { { highlightSelf: false, highlightLeft: false, highlightRight: false, } } let useErroryValueResetter = (value: string, setValue: (string => string) => unit) => { React.useEffect(() => { let isErroryTimeValue = _ => { try { f...
7,099
9,985
hyperswitch-control-center
src/components/MakeRuleFieldComponent.res
.res
let validateConditionJson = json => { open LogicUtils let checkValue = dict => { dict ->getArrayFromDict("value", []) ->Array.filter(ele => { ele != ""->JSON.Encode.string }) ->Array.length > 0 || dict->getString("value", "")->LogicUtils.isNonEmptyString || dict->getFloat("value", ...
781
9,986
hyperswitch-control-center
src/components/TableUtils.resi
.resi
let regex: string => RescriptCore.RegExp.t let highlightedText: (Js.String.t, string) => React.element type labelColor = | LabelGreen | LabelRed | LabelBlue | LabelGray | LabelOrange | LabelYellow | LabelLightGray type filterDataType = Float(float, float) | String | DateTime type disableField = {key: stri...
1,745
9,987
hyperswitch-control-center
src/components/InfraCalendarList.res
.res
external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput< array<string>, > = "%identity" let startYear = ref(2016) let years = [] while Date.make()->Js.Date.getFullYear->Float.toInt >= startYear.contents { years->Array.push(startYear.contents)->ignore star...
1,405
9,988
hyperswitch-control-center
src/components/DateRangeHelper.res
.res
open DateRangeUtils module CompareOption = { @react.component let make = (~value: compareOption, ~comparison, ~startDateVal, ~endDateVal, ~onClick) => { let isoStringToCustomTimeZone = TimeZoneHook.useIsoStringToCustomTimeZone() let previousPeriod = React.useMemo(() => { let startDateStr = formatDat...
1,402
9,989
hyperswitch-control-center
src/components/ReactWindowTable.res
.res
open TableUtils type checkBoxProps = { showCheckBox: bool, selectedData: array<JSON.t>, setSelectedData: (array<JSON.t> => array<JSON.t>) => unit, } let checkBoxPropDefaultVal: checkBoxProps = { showCheckBox: false, selectedData: [], setSelectedData: _ => (), } module FilterRow = { @react.component let...
8,342
9,990
hyperswitch-control-center
src/components/NotFoundPage.res
.res
@react.component let make = (~message="Error 404!") => { let {setDashboardPageState} = React.useContext(GlobalProvider.defaultContext) <NoDataFound message renderType={NotFound}> <Button text={"Go to Home"} buttonType=Primary buttonSize=Small onClick={_ => { setDashboardPageState...
121
9,991
hyperswitch-control-center
src/components/Button.resi
.resi
type buttonState = Normal | Loading | Disabled | NoHover | Focused type buttonVariant = Fit | Long | Full | Rounded type buttonType = | Primary | Secondary | PrimaryOutline | SecondaryFilled | NonFilled | Pagination | Pill | FilterAdd | Delete | Transparent | SelectTransparent | DarkPurple | ...
706
9,992
hyperswitch-control-center
src/components/BottomModal.res
.res
@react.component let make = (~onCloseClick, ~children, ~headerText) => { let onClick = e => { e->ReactEvent.Mouse.stopPropagation } <div onClick className={`flex flex-col border border-jp-gray-500 dark:border-jp-gray-960 bg-jp-gray-950 dark:bg-white-600 dark:bg-opacity-80 fixed bg-opacity-70 h-scree...
339
9,993
hyperswitch-control-center
src/components/HSwitchSingleStatTableWidget.res
.res
type statChartColor = [#blue | #grey] type tableRowType = { rowLabel: string, rowValue: float, } type cols = | Label | Value let visibleColumns = [Label, Value] let colMapper = (col: cols) => { switch col { | Label => "rowLabel" | Value => "rowValue" } } let tableItemToObjMapper: 'a => tableRowType...
1,815
9,994
hyperswitch-control-center
src/components/AdvancedSearchComponent.res
.res
let getSummary: JSON.t => EntityType.summary = json => { switch json->JSON.Decode.object { | Some(dict) => { let rowsCount = LogicUtils.getArrayFromDict(dict, "rows", [])->Array.length let totalCount = LogicUtils.getInt(dict, "entries", 0) {totalCount, count: rowsCount} } | None => {totalCo...
797
9,995
hyperswitch-control-center
src/components/SearchInput.res
.res
open LottieFiles @react.component let make = ( ~onChange, ~inputText, ~autoFocus=true, ~placeholder="", ~searchIconCss="ml-2", ~roundedBorder=true, ~widthClass="w-full", ~heightClass="h-8", ~searchRef=?, ~shouldSubmitForm=true, ~placeholderCss="bg-transparent text-fs-14", ~bgColor="border-jp-gra...
758
9,996
hyperswitch-control-center
src/components/FilterUtils.res
.res
let parseFilterString = queryString => { queryString ->decodeURI ->String.split("&") ->Belt.Array.keepMap(str => { let arr = str->String.split("=") let key = arr->Array.get(0)->Option.getOr("-") let val = arr->Array.sliceToEnd(~start=1)->Array.joinWith("=") key->LogicUtils.isEmptyString || val->...
159
9,997
hyperswitch-control-center
src/components/DynamicTableUtils.res
.res
let tableHeadingClass = "font-bold text-xl text-black text-opacity-75 dark:text-white dark:text-opacity-75" type view = Table | Card let visibilityColFunc = ( ~dateFormatConvertor: string => option<JSON.t>, ~jsonVal: option<JSON.t>, ~tableCell: Table.cell, ) => { switch tableCell { | Label(x) | ColoredText(x...
2,543
9,998
hyperswitch-control-center
src/components/Icon.resi
.resi
@react.component let make: ( ~name: string, ~size: int=?, ~className: string=?, ~themeBased: bool=?, ~onClick: ReactEvent.Mouse.t => unit=?, ~parentClass: string=?, ~customIconColor: string=?, ~customWidth: string=?, ~customHeight: string=?, ) => React.element
86
9,999
hyperswitch-control-center
src/components/NewCalendar.res
.res
open DateTimeUtils type highlighter = { highlightSelf: bool, highlightLeft: bool, highlightRight: bool, } module TableRow = { let defaultCellHighlighter = _ => { highlightSelf: false, highlightLeft: false, highlightRight: false, } let defaultCellRenderer = obj => { switch obj { | Some(a...
4,696
10,000
hyperswitch-control-center
src/components/NewThemeUtils.resi
.resi
type headingSize = XSmall | Small | Medium | Large module NewThemeHeading: { @react.component let make: ( ~heading: string, ~description: string=?, ~headingColor: string=?, ~descriptionColor: string=?, ~headingSize: headingSize=?, ~rightActions: React.element=?, ~headingRightElemnt: Reac...
147
10,001
hyperswitch-control-center
src/components/AddDataAttributes.res
.res
let spreadProps = React.cloneElement @react.component let make = (~attributes: array<(string, string)>, ~children) => { let attributesDict = attributes->Dict.fromArray let ignoreAttributes = React.useContext(AddAttributesContext.ignoreAttributesContext) if !ignoreAttributes { children->spreadProps(attribute...
81
10,002
hyperswitch-control-center
src/components/Loader.res
.res
@react.component let make = ( ~loadingText="Loading...", ~children=React.null, ~slow=false, ~customSpinnerIconColor: string="", ~loadingTextColor="", ) => { let animationType = if slow { "animate-spin-slow" } else { "animate-spin" } let size = if slow { 60 } else { 20 } let loa...
242
10,003
hyperswitch-control-center
src/components/CollapsableTableRow.res
.res
@react.component let make = ( ~item: array<Table.cell>, ~rowIndex, ~offset as _, ~highlightEnabledFieldsArray, ~expandedRowIndexArray, ~onExpandIconClick, ~getRowDetails, ~heading, ~title, ) => { let isCurrentRowExpanded = expandedRowIndexArray->Array.includes(rowIndex) let headingArray = [] he...
907
10,004
hyperswitch-control-center
src/components/DragDrop.res
.res
type draggableDefaultDestination = {index: int, droppableId: string} type draggableItem = React.element let defaultDraggableDest = { index: 0, droppableId: "", } @react.component let make = ( ~isHorizontal=true, ~listItems: array<JSON.t>, ~setListItems: (array<JSON.t> => array<JSON.t>) => unit, ~keyExtrac...
930
10,005
hyperswitch-control-center
src/components/SelectBox.res
.res
type retType = CheckBox(array<string>) | Radiobox(string) external toDict: 'a => Dict.t<'t> = "%identity" @send external getClientRects: Dom.element => Dom.domRect = "getClientRects" @send external focus: Dom.element => unit = "focus" external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalFo...
18,139
10,006
hyperswitch-control-center
src/components/ButtonGroupIp.res
.res
open SelectBox @react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, ~options: array<dropdownOption>, ~buttonClass="", ~isDisabled=false, ~isSeparate=false, ~buttonSize=?, ) => { let {globalUIConfig: {font: {textColor}}} = React.useContext(ThemeProvider.themeContext) let onChange =...
389
10,007
hyperswitch-control-center
src/components/NewCalendarTimeInput.res
.res
open DateTimeUtils let textBoxClass = " font-inter-style text-fs-14 leading-5 font-normal text-jp-2-light-gray-2000" module CustomInputBox = { @react.component let make = ( ~input: ReactFinalForm.fieldRenderPropsInput, ~placeholder, ~isDisabled=false, ~type_="text", ~inputMode="text", ~autoF...
1,947
10,008
hyperswitch-control-center
src/components/TabularInput.res
.res
external ffInputToTableInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput< array<array<string>>, > = "%identity" module FieldInputRenderer = { @react.component let make = (~item, ~input: ReactFinalForm.fieldRenderPropsInput) => { <td> {item(input)} </td> } } module T...
1,164
10,009
hyperswitch-control-center
src/components/DragNDropDemoLazy.res
.res
open LazyUtils type props = { isHorizontal: option<bool>, keyExtractor: JSON.t => option<string>, listItems: array<JSON.t>, setListItems: (array<JSON.t> => array<JSON.t>) => unit, } let make: props => React.element = reactLazy(() => import_("./DragNDropDemo.res.js"))
77
10,010
hyperswitch-control-center
src/components/LoadedTableWithCustomColumns.res
.res
@react.component let make = ( ~defaultSort=?, ~title, ~description=?, ~tableActions=?, ~rightTitleElement=React.null, ~bottomActions=?, ~showSerialNumber=false, ~actualData, ~totalResults, ~resultsPerPage, ~offset, ~setOffset, ~handleRefetch=() => (), ~entity: EntityType.entityType<'colType,...
1,000
10,011
hyperswitch-control-center
src/components/NewCalendarList.res
.res
open DateTimeUtils external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput< array<string>, > = "%identity" open NewCalendar @react.component let make = ( ~forwardRef as _=?, ~changeHighlightCellStyle="", ~calendarContaierStyle="", ~month: option<month...
1,751
10,012
hyperswitch-control-center
src/components/ACLDiv.resi
.resi
@react.component let make: ( ~authorization: CommonAuthTypes.authorization, ~onClick: JsxEvent.Mouse.t => unit, ~children: React.element, ~className: string=?, ~noAccessDescription: string=?, ~description: string=?, ~tooltipWidthClass: string=?, ~isRelative: bool=?, ~showTooltip: bool=?, ~contentAli...
134
10,013
hyperswitch-control-center
src/components/TableLocalFilters.res
.res
external formEventToJsonArr: ReactEvent.Form.t => array<JSON.t> = "%identity" module RangeSliderLocalFilter = { @react.component let make = ( ~filterKey, ~minVal: float, ~maxVal: float, ~maxSlide: ReactFinalForm.fieldRenderPropsInput, ~minSlide: ReactFinalForm.fieldRenderPropsInput, ) => { ...
2,700
10,014
hyperswitch-control-center
src/components/MultipleFileUpload.res
.res
type dataTransfer @get external dataTransfer: ReactEvent.Mouse.t => 'a = "dataTransfer" @get external files: dataTransfer => 'a = "files" open LogicUtils @val external atob: string => string = "atob" @send external focus: Dom.element => unit = "focus" @react.component let make = ( ~input: ReactFinalForm.fieldRenderP...
2,252
10,015
hyperswitch-control-center
src/components/Filter.res
.res
module ClearFilters = { @react.component let make = ( ~defaultFilterKeys=[], ~clearFilters=?, ~isCountRequired=true, ~outsidefilter=false, ) => { let {updateExistingKeys} = React.useContext(FilterContext.filterContext) let textStyle = "text-red-900" let leftIcon: Button.iconType = Cust...
2,973
10,016
hyperswitch-control-center
src/components/ButtonGroup.res
.res
module ButtonWrapper = { let makeInfoRecord = (~isFirst, ~isLast): ButtonGroupContext.buttonInfo => { {isFirst, isLast} } @react.component let make = (~element, ~count, ~index) => { let isFirst = index === 0 let isLast = index === count - 1 let value = React.useMemo(() => makeInfoRecord(~isFirs...
191
10,017
hyperswitch-control-center
src/components/PopUpContainer.res
.res
open PopUpState @react.component let make = (~children) => { let (openPopUps, setOpenPopUp) = Recoil.useRecoilState(PopUpState.openPopUp) let activePopUp = openPopUps->Array.get(0) let popUp = switch activePopUp { | Some(popUp) => { let handleConfirm = ev => { setOpenPopUp(prevArr => prevArr->Arr...
615
10,018
hyperswitch-control-center
src/components/RatingOptions.res
.res
@react.component let make = (~icons, ~size) => { let (isActive, setIsActive) = React.useState(_ => false) let ratingInput = ReactFinalForm.useField("rating").input let rating = ratingInput.value->LogicUtils.getIntFromJson(1) let handleClick = ratingNumber => { ratingInput.onChange(ratingNumber->Identity.an...
218
10,019
hyperswitch-control-center
src/components/DynamicTable.res
.res
let useRemoteFilter = (~searchParams, ~remoteFilters, ~remoteOptions, ~mandatoryRemoteKeys) => { let (remoteFiltersFromUrl, setRemoteFiltersFromUrl) = React.useState(() => JSON.Encode.object(Dict.make()) ) let remoteFiltersFromUrlTemp = React.useMemo(() => { RemoteFiltersUtils.getInitialValuesFromUrl( ...
4,177
10,020