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-client-core | src/utility/constants/SdkStatusMessages.res | .res | type statusMessages = {
successMsg: string,
errorMsg: string,
apiCallFailure: string,
}
let retrievePaymentStatus = {
successMsg: "payment successful",
errorMsg: "payment failed",
apiCallFailure: "retrieve failure, cannot fetch the status of payment",
}
let pollingCallStatus = {
successMsg: "polling sta... | 293 | 10,631 |
hyperswitch-client-core | src/utility/config/next/NextImpl.native.res | .res | 1 | 10,632 | |
hyperswitch-client-core | src/utility/test/TestUtils.res | .res | let cardNumberInputTestId = "CardNumberInputTestId"
let cvcInputTestId = "CVCInputTestId"
let expiryInputTestId = "ExpiryInputTestId"
let payButtonTestId = "PayButtonTestId"
| 45 | 10,633 |
hyperswitch-client-core | src/contexts/CountryStateDataContext.res | .res | type data =
| Localdata(CountryStateDataHookTypes.countryStateData)
| FetchData(CountryStateDataHookTypes.countryStateData)
| Loading
let countryStateDataContext = React.createContext((Loading, () => ()))
module Provider = {
let make = React.Context.provider(countryStateDataContext)
}
module WrapperProvider ... | 763 | 10,634 |
hyperswitch-client-core | src/contexts/PaymentScreenContext.res | .res | type paymentScreenType = PAYMENTSHEET | SAVEDCARDSCREEN
let dafaultVal = SAVEDCARDSCREEN
let paymentScreenTypeContext = React.createContext((dafaultVal, (_: paymentScreenType) => ()))
module Provider = {
let make = React.Context.provider(paymentScreenTypeContext)
}
@react.component
let make = (~children) => {
let... | 130 | 10,635 |
hyperswitch-client-core | src/contexts/LocaleStringDataContext.res | .res | type data =
| Loading
| Some(LocaleDataType.localeStrings)
let localeDataContext = React.createContext((Loading, (_: data => data) => ()))
module Provider = {
let make = React.Context.provider(localeDataContext)
}
@react.component
let make = (~children) => {
let (state, setState) = React.useState(_ => Loadin... | 406 | 10,636 |
hyperswitch-client-core | src/contexts/AllApiDataContext.res | .res | type retryObject = {
processor: string,
redirectUrl: string,
}
type additionalPMLData = {
retryEnabled: option<retryObject>,
redirect_url: option<string>,
mandateType: PaymentMethodListType.mandateType,
paymentType: option<string>,
merchantName: option<string>,
requestExternalThreeDsAuthentication: opt... | 508 | 10,637 |
hyperswitch-client-core | src/contexts/CardDataContext.res | .res | type cardData = {
cardNumber: string,
expireDate: string,
cvv: string,
zip: string,
isCardNumberValid: option<bool>,
isCardBrandSupported: option<bool>,
isExpireDataValid: option<bool>,
isCvvValid: option<bool>,
isZipValid: option<bool>,
cardBrand: string,
selectedCoBadgedCardBrand: option<string>... | 254 | 10,638 |
hyperswitch-client-core | src/contexts/NativePropContext.res | .res | let defaultValue: SdkTypes.nativeProp = SdkTypes.nativeJsonToRecord(JSON.Encode.null, 1)
let defaultSetter = (_: SdkTypes.nativeProp) => ()
let nativePropContext = React.createContext((defaultValue, defaultSetter))
module Provider = {
let make = React.Context.provider(nativePropContext)
}
@react.component
let mak... | 185 | 10,639 |
hyperswitch-client-core | src/contexts/LoggerContext.res | .res | let defaultSetter = (_: Dict.t<float>) => ()
let loggingContext = React.createContext((Dict.make(), defaultSetter))
module Provider = {
let make = React.Context.provider(loggingContext)
}
@react.component
let make = (~children) => {
let (state, setState) = React.useState(_ => Dict.make())
let setState = React.us... | 104 | 10,640 |
hyperswitch-client-core | src/contexts/ThemeContext.res | .res | type appObj = SdkTypes.appearance
type themeType = Light(appObj) | Dark(appObj)
let defaultValue: themeType = Light(SdkTypes.defaultAppearance)
let defaultSetter = (_: themeType) => ()
let themeContext = React.createContext((defaultValue, defaultSetter))
module Provider = {
let make = React.Context.provider(themeCo... | 221 | 10,641 |
hyperswitch-client-core | src/contexts/LoadingContext.res | .res | type processingPayments = {showOverlay: bool}
type sdkPaymentState =
| FillingDetails
| ProcessingPayments(option<processingPayments>)
| PaymentSuccess
| PaymentCancelled
let defaultSetter = (_: sdkPaymentState) => ()
let loadingContext = React.createContext((FillingDetails, defaultSetter))
module Provider = {... | 176 | 10,642 |
hyperswitch-client-core | src/contexts/ViewportContext.res | .res | type viewPortContants = {
windowHeight: float,
windowWidth: float,
screenHeight: float,
screenWidth: float,
navigationBarHeight: float,
maxPaymentSheetHeight: float,
}
let defaultNavbarHeight = 25.
let windowHeight = ReactNative.Dimensions.get(#window).height
let windowWidth = ReactNative.Dimensions.get(#w... | 326 | 10,643 |
hyperswitch-client-core | src/icons/ChevronIcon.res | .res | open ReactNative
open Style
@react.component
let make = (~width=20., ~height=16., ~fill="#ffffff") => {
<Icon
style={viewStyle(~transform=[rotate(~rotate=270.->deg)], ())}
name="back"
height
width
fill
/>
}
| 75 | 10,644 |
hyperswitch-client-core | src/icons/Icon.res | .res | let card = `<svg class="p-Icon p-Icon--card Icon p-Icon--md p-TabIcon TabIcon p-TabIcon--selected TabIcon--selected" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M0 4a2 2 0 012-2h12a2 2 0 012 2H0zm0 2v6a2 2 0 002 2h12a2 2 0 002-2V6H0zm3 5a1 ... | 29,456 | 10,645 |
hyperswitch-client-core | src/headless/Headless.res | .res | open SdkTypes
open HeadlessUtils
open HeadlessNative
let reRegisterCallback = ref(() => ())
let registerHeadless = headless => {
let headlessModule = initialise(headless)
let getDefaultPaymentSession = error => {
headlessModule.getPaymentSession(
error->Utils.getJsonObjectFromRecord,
error->Utils... | 4,139 | 10,646 |
hyperswitch-client-core | src/headless/HeadlessUtils.res | .res | open SdkTypes
let sendLogs = (logFile, customLogUrl, env: GlobalVars.envType) => {
let uri = switch customLogUrl {
| Some(url) => url
| None =>
switch env {
| PROD => "https://api.hyperswitch.io/logs/sdk"
| _ => "https://sandbox.hyperswitch.io/logs/sdk"
}
}
if WebKit.platform != #next {
l... | 3,905 | 10,647 |
hyperswitch-client-core | src/headless/HeadlessNative.res | .res | open ReactNative
type headlessModule = {
initialisePaymentSession: (JSON.t => unit) => unit,
getPaymentSession: (JSON.t, JSON.t, JSON.t, JSON.t => unit) => unit,
exitHeadless: string => unit,
}
let getFunctionFromModule = (dict: Dict.t<'a>, key: string, default: 'b): 'b => {
switch dict->Dict.get(key) {
| S... | 310 | 10,648 |
hyperswitch-client-core | src/components/modules/SamsungPayModule.res | .res | open ExternalThreeDsTypes
type module_ = {
checkSamsungPayValidity: (string, statusType => unit) => unit,
presentSamsungPayPaymentSheet: (
(statusType, option<SamsungPayType.addressCollectedFromSpay>) => unit
) => unit,
isAvailable: bool,
}
@val external require: string => module_ = "require"
let (checkS... | 163 | 10,649 |
hyperswitch-client-core | src/components/modules/ScanCardModule.res | .res | type scanCardData = {
pan: string,
expiryMonth: string,
expiryYear: string,
}
type scanCardReturnType = {
status: string,
data: scanCardData,
}
type scanCardReturnStatus = Succeeded(scanCardData) | Failed | Cancelled | None
type module_ = {launchScanCard: (scanCardReturnType => unit) => unit, isAvailable: boo... | 308 | 10,650 |
hyperswitch-client-core | src/components/modules/KountModule.res | .res | type module_ = {launchKount: (string, Dict.t<JSON.t> => unit) => unit}
@val external require: string => module_ = "require"
let launchKountMod = switch try {
require("react-native-hyperswitch-kount")->Some
} catch {
| _ => None
} {
| Some(mod) => mod.launchKount
| None => (_, _) => ()
}
let launchKountIfAvailable ... | 163 | 10,651 |
hyperswitch-client-core | src/components/modules/KlarnaModule.res | .res | type params = {
@dead
authorized: bool,
approved: bool,
authToken: option<string>,
errorMessage: option<string>,
}
type event = {nativeEvent: params}
type element = {
initialize: (string, option<string>) => unit,
load: unit => unit,
authorize: unit => unit,
}
type moduleProps = {
key: string,
cate... | 304 | 10,652 |
hyperswitch-client-core | src/components/modules/ErrorBoundary.res | .res | let defaultFallback = (fallbackArg: Sentry.fallbackArg, level, rootTag) => {
<FallBackScreen error=fallbackArg level rootTag />
}
@react.component
let make = (~children, ~renderFallback=defaultFallback, ~level, ~rootTag) => {
<Sentry.ErrorBoundary fallback={e => renderFallback(e, level, rootTag)}>
children
<... | 89 | 10,653 |
hyperswitch-client-core | src/components/modules/ReactModule.res | .res | @module("react")
external useEffect: (unit => option<unit => unit>) => unit = "useEffect"
| 24 | 10,654 |
hyperswitch-client-core | src/components/modules/HyperModule.res | .res | type hyperModule = {
sendMessageToNative: string => unit,
launchApplePay: (string, Dict.t<JSON.t> => unit) => unit,
startApplePay: (string, Dict.t<JSON.t> => unit) => unit,
presentApplePay: (string, Dict.t<JSON.t> => unit) => unit,
launchGPay: (string, Dict.t<JSON.t> => unit) => unit,
exitPaymentsheet: (int... | 1,531 | 10,655 |
hyperswitch-client-core | src/components/modules/PaypalModule.res | .res | type module_ = {launchPayPal: (string, Dict.t<JSON.t> => unit) => unit}
@val external require: string => module_ = "require"
let payPalModule = try {
require("react-native-hyperswitch-paypal")->Some
} catch {
| _ => None
}
let launchPayPalMod = switch payPalModule {
| Some(mod) => mod.launchPayPal
| None => (_, _)... | 136 | 10,656 |
hyperswitch-client-core | src/components/modules/Sentry.res | .res | type integration = unit
type instrumentation = unit
type sentryInitArg = {
dsn: string,
environment: string,
integrations?: array<integration>,
tracesSampleRate: float,
tracePropagationTargets?: array<string>,
replaysSessionSampleRate?: float,
replaysOnErrorSampleRate?: float,
deactivateStacktraceMergi... | 615 | 10,657 |
hyperswitch-client-core | src/components/modules/Netcetera3dsModule.res | .res | open ExternalThreeDsTypes
type module_ = {
initialiseNetceteraSDK: (string, string, statusType => unit) => unit,
generateAReqParams: (string, string, (statusType, aReqParams) => unit) => unit,
recieveChallengeParamsFromRN: (
string,
string,
string,
string,
statusType => unit,
option<strin... | 264 | 10,658 |
hyperswitch-client-core | src/components/modules/ApplePayButtonView/ApplePayButtonView.res | .res | open ReactNative
type props = {
buttonType?: SdkTypes.applePayButtonType,
buttonStyle?: SdkTypes.applePayButtonStyle,
cornerRadius?: float,
style?: Style.t,
}
@module("./ApplePayButtonViewImpl")
external make: React.component<props> = "make"
| 65 | 10,659 |
hyperswitch-client-core | src/components/modules/ApplePayButtonView/ApplePayButtonViewImpl.web.res | .res | open ReactNative
@react.component
let make = (~cornerRadius: float, ~style: Style.t) => {
let styleDict =
style
->JSON.stringifyAny
->Option.getOr("")
->Js.Json.parseExn
->Utils.getDictFromJson
let height =
styleDict
->Utils.getOptionFloat("height")
->Option.getOr(100.)
->Float... | 243 | 10,660 |
hyperswitch-client-core | src/components/modules/ApplePayButtonView/ApplePayButtonViewImpl.android.res | .res | type props
let make: React.component<props> = _ => React.null
| 17 | 10,661 |
hyperswitch-client-core | src/components/modules/ApplePayButtonView/ApplePayButtonViewImpl.ios.res | .res | open ReactNative
type props = {
buttonType?: SdkTypes.applePayButtonType,
buttonStyle?: SdkTypes.applePayButtonStyle,
cornerRadius?: float,
style?: Style.t,
}
let make: React.component<props> = NativeModules.requireNativeComponent("ApplePayView")
| 63 | 10,662 |
hyperswitch-client-core | src/components/modules/GooglePayButtonView/GooglePayButtonViewImpl.android.res | .res | type props = {
buttonType?: SdkTypes.googlePayButtonType,
borderRadius?: float,
buttonStyle?: ReactNative.Appearance.t,
style?: ReactNative.Style.t,
allowedPaymentMethods?: string,
}
let make: React.component<props> = ReactNative.NativeModules.requireNativeComponent(
"GooglePayButton",
)
| 69 | 10,663 |
hyperswitch-client-core | src/components/modules/GooglePayButtonView/GooglePayButtonViewImpl.web.res | .res | open ReactNative
@react.component
let make = (~borderRadius: float, ~style: Style.t) => {
<View nativeID="google-wallet-button-container" style={style}>
<style>
{React.string(`
.gpay-card-info-container.black, .gpay-card-info-animation-container.black {
background-color: #000 !importa... | 125 | 10,664 |
hyperswitch-client-core | src/components/modules/GooglePayButtonView/GooglePayButtonView.res | .res | type props = {
buttonType?: SdkTypes.googlePayButtonType,
borderRadius?: float,
buttonStyle?: ReactNative.Appearance.t,
style?: ReactNative.Style.t,
allowedPaymentMethods?: string,
}
@module("./GooglePayButtonViewImpl")
external make: React.component<props> = "make"
| 66 | 10,665 |
hyperswitch-client-core | src/components/modules/GooglePayButtonView/GooglePayButtonViewImpl.ios.res | .res | type props = {
buttonType?: SdkTypes.googlePayButtonType,
borderRadius?: float,
buttonStyle?: ReactNative.Appearance.t,
style?: ReactNative.Style.t,
allowedPaymentMethods?: string,
}
let make: React.component<props> = _ => React.null
| 59 | 10,666 |
hyperswitch-client-core | src/components/modules/Plaid/PlaidImpl.android.res | .res | /**
Checks if native modules for sdk have been imported as optional dependency
*/
let isAvailable =
Dict.get(ReactNative.NativeModules.nativeModules, "PlaidAndroid")
->Option.flatMap(JSON.Decode.object)
->Option.isSome
| 49 | 10,667 |
hyperswitch-client-core | src/components/modules/Plaid/PlaidImpl.ios.res | .res | /**
Checks if native modules for sdk have been imported as optional dependency
*/
let isAvailable =
Dict.get(ReactNative.NativeModules.nativeModules, "RNLinksdk")
->Option.flatMap(JSON.Decode.object)
->Option.isSome
| 49 | 10,668 |
hyperswitch-client-core | src/components/modules/Plaid/PlaidImpl.web.res | .res | /**
Checks if native modules for sdk have been imported as optional dependency.
Not available in web via plaid-link-sdk.
*/
let isAvailable = false
| 31 | 10,669 |
hyperswitch-client-core | src/components/modules/Plaid/Plaid.res | .res | open PlaidTypes
type module_ = {
create: linkTokenConfiguration => unit,
@as("open") open_: linkOpenProps => promise<unit>,
dismissLink: unit => unit,
}
@module("./PlaidImpl")
external isAvailable: bool = "isAvailable"
@val external require: string => module_ = "require"
/**
Plaid Link React Native SDK
*/
let... | 194 | 10,670 |
hyperswitch-client-core | src/components/elements/ModalHeader.res | .res | open ReactNative
open Style
@react.component
let make = (~onModalClose) => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
let {iconColor} = ThemebasedStyle.useThemeBasedStyle()
let (paymentScreenType, _) = React.useContext(PaymentScreenContext.paymentScreenTypeContext)
let (allAp... | 555 | 10,671 |
hyperswitch-client-core | src/components/elements/CardElement.res | .res | open Validation
type cardFormType = {isZipAvailable: bool}
type viewType = PaymentSheet | CardForm(cardFormType)
@react.component
let make = (
~setIsAllValid,
~viewType=PaymentSheet,
~reset: bool,
~keyToTrigerButtonClickError=0,
~cardNetworks=?,
) => {
let isZipAvailable = switch viewType {
| CardForm(ca... | 1,954 | 10,672 |
hyperswitch-client-core | src/components/elements/PaymentSheetUi.res | .res | open ReactNative
open Style
open Validation
@react.component
let make = (
~cardNumber,
~cvv,
~expireDate,
~onChangeCardNumber,
~onChangeCardExpire,
~onChangeCvv,
~isCardNumberValid,
~isExpireDataValid,
~isCardBrandSupported,
~isCvvValid,
~onScanCard,
~keyToTrigerButtonClickError,
~cardNetwork... | 2,335 | 10,673 |
hyperswitch-client-core | src/components/elements/TubeSpinner.res | .res | open ReactNative
open Style
open ReactNativeSvg
@react.component
let make = (~loaderColor=?, ~size=?) => {
let {iconColor} = ThemebasedStyle.useThemeBasedStyle()
let iconColor = switch loaderColor {
| Some(color) => color
| None => iconColor
}
let size = switch size {
| Some(size) => size
| None => 18... | 635 | 10,674 |
hyperswitch-client-core | src/components/elements/HyperSwitchBranding.res | .res | open ReactNative
open Style
@react.component
let make = () => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
<UIUtils.RenderIf condition={!nativeProp.hyperParams.disableBranding}>
<Space />
<View style={viewStyle(~alignItems=#center, ())}>
<View
style={viewStyle(... | 247 | 10,675 |
hyperswitch-client-core | src/components/elements/CardFormUi.res | .res | open ReactNative
open Style
open Validation
@react.component
let make = (
~cardNumber,
~cvv,
~expireDate,
~isZipAvailable=false,
~zip,
~onChangeCardNumber,
~onChangeCardExpire,
~onChangeCvv,
~onChangeZip,
~isCardNumberValid,
~isExpireDataValid,
~isCvvValid,
~isZipValid,
) => {
let (nativePro... | 2,485 | 10,676 |
hyperswitch-client-core | src/components/elements/ScrollableCustomTopBar.res | .res | open ReactNative
open Style
module BottomTabList = {
@react.component
let make = (
~item: PMListModifier.hoc,
~index: int,
~indexInFocus: int,
~setIndexToScrollParentFlatList,
) => {
let isFocused = index == indexInFocus
let routeName = item.name
let isLoading = routeName == "loading"... | 928 | 10,677 |
hyperswitch-client-core | src/components/elements/Klarna.res | .res | open ReactNative
@react.component
let make = (
~launchKlarna: option<PaymentMethodListType.payment_method_types_pay_later>,
~return_url,
~klarnaSessionTokens: string,
~processRequest: (PaymentMethodListType.payment_method_types_pay_later, string) => unit,
) => {
let (_paymentViewLoaded, setpaymentViewLoaded)... | 621 | 10,678 |
hyperswitch-client-core | src/components/elements/FallBackScreen.res | .res | open ReactNative
open Style
type level = Top | Screen | Widget
@react.component
let make = (~error: Sentry.fallbackArg, ~level: level, ~rootTag) => {
let {simplyExit} = HyperModule.useExitPaymentsheet()
switch level {
| Top =>
<SafeAreaView style={viewStyle(~flex=1., ~alignItems=#center, ~justifyContent=#"... | 782 | 10,679 |
hyperswitch-client-core | src/components/elements/RedirectionText.res | .res | open ReactNative
open Style
@react.component
let make = () => {
let {component} = ThemebasedStyle.useThemeBasedStyle()
let localeObject = GetLocale.useGetLocalObj()
<View style={viewStyle(~flexDirection=#row, ())}>
<Icon name="redirection" width=40. height=35. fill=component.color />
<Space width=10. />... | 135 | 10,680 |
hyperswitch-client-core | src/components/elements/ButtonElement.res | .res | open ReactNative
open Style
open PaymentMethodListType
type item = {
linearGradientColorTuple: option<ThemebasedStyle.buttonColorConfig>,
name: string,
iconName: string,
iconNameRight: option<string>,
}
@react.component
let make = (
~walletType: PaymentMethodListType.payment_method_types_wallet,
~sessionO... | 5,036 | 10,681 |
hyperswitch-client-core | src/components/elements/LoadingOverlay.res | .res | open ReactNative
open Style
switch UIManager.setLayoutAnimationEnabledExperimental {
| None => ()
| Some(setEnabled) => setEnabled(true)
}
@react.component
let make = () => {
let {bgColor, borderRadius} = ThemebasedStyle.useThemeBasedStyle()
let (loading, _) = React.useContext(LoadingContext.loadingContext)
let... | 536 | 10,682 |
hyperswitch-client-core | src/components/elements/CardSchemeComponent.res | .res | open ReactNative
open Style
module CardSchemeItem = {
@react.component
let make = (~onPress, ~item, ~index) => {
<CustomTouchableOpacity key={index->Int.toString} onPress>
<View
style={viewStyle(~flexDirection=#row, ~alignItems=#center, ~paddingVertical=5.->dp, ())}>
<Icon name={item} hei... | 1,139 | 10,683 |
hyperswitch-client-core | src/components/elements/ConfirmButton.res | .res | @react.component
let make = (
~loading: bool,
~isAllValuesValid: bool,
~handlePress: ReactNative.Event.pressEvent => unit,
~hasSomeFields=?,
~paymentMethod: string,
~paymentExperience=?,
~errorText=None,
) => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
let (allApiData... | 259 | 10,684 |
hyperswitch-client-core | src/components/elements/PaymentSheetProcessingElement.res | .res | open ReactNative
open Style
@react.component
let make = () => {
let {component} = ThemebasedStyle.useThemeBasedStyle()
let (paymentProcessingText, setPaymentProcessingText) = React.useState(_ => ".")
React.useEffect1(() => {
let intervalId = setTimeout(() => {
let newState = switch paymentProcessingT... | 347 | 10,685 |
hyperswitch-client-core | src/components/common/Pager.res | .res | open ReactNative
open Style
let deadZone = 12.0
@get external getValue: ReactNative.Animated.Value.t => float = "_value"
@get external getOffset: ReactNative.Animated.Value.t => float = "_offset"
type defaultTransitionSpec = {
timing: (Animated.value<Animated.regular>, Animated.Value.Spring.config) => Animated.Ani... | 2,540 | 10,686 |
hyperswitch-client-core | src/components/common/SceneMap.res | .res | module SceneComponent = {
@react.component
let make = React.memo((
~component: (~route: TabViewType.route, ~position: int, ~jumpTo: int => unit) => React.element,
~route: TabViewType.route,
~jumpTo: int => unit,
~position: int,
) => component(~route, ~position, ~jumpTo))
}
let sceneMap = (
scen... | 199 | 10,687 |
hyperswitch-client-core | src/components/common/SceneMap.js | .js | import * as React from 'react';
const SceneComponent = React.memo(({
component,
...rest
}) => {
return React.createElement(component, rest);
}
);
export function SceneMap(scenes) {
return ({ route, jumpTo, position }) => (
<SceneComponent
key={route.key}
component={scenes[route.key]}
rou... | 97 | 10,688 |
hyperswitch-client-core | src/components/common/CustomButton.res | .res | open ReactNative
open Style
type buttonState = Normal | LoadingButton | Completed | Disabled
type buttonType = Primary
type iconType = CustomIcon(React.element) | NoIcon
@react.component
let make = (
~loadingText="Loading..",
~buttonState: buttonState=Normal,
~text=?,
~name as _=?,
~buttonType: buttonType=... | 1,072 | 10,689 |
hyperswitch-client-core | src/components/common/CustomInput.res | .res | open ReactNative
open Style
type iconType =
| NoIcon
| CustomIcon(React.element)
@react.component
let make = (
~state,
~setState,
~placeholder="Enter the text here",
~placeholderTextColor=None,
~width=100.->pct,
~height: float=46.,
~secureTextEntry=false,
~keyboardType=#default,
~iconLeft: iconT... | 1,887 | 10,690 |
hyperswitch-client-core | src/components/common/TextWithLine.res | .res | open ReactNative
open Style
@react.component
let make = (~text) => {
<View style={viewStyle(~alignItems=#center, ~justifyContent=#center, ~flexDirection=#row, ())}>
<View
style={viewStyle(
~height=1.->dp,
~marginHorizontal=10.->dp,
~backgroundColor="#CCCCCC",
~flex=1.,
... | 158 | 10,691 |
hyperswitch-client-core | src/components/common/ReImage.res | .res | open ReactNative
open Style
@react.component
let make = (~uri, ~style=viewStyle(~width=33.->dp, ~height=33.->dp, ())) => {
<Image style source={Image.Source.fromUriSource({uri: uri})} />
}
| 62 | 10,692 |
hyperswitch-client-core | src/components/common/CustomSelectBox.res | .res | @react.component
let make = (~initialIconName, ~updateIconName, ~isSelected, ~fillIcon) => {
let {primaryColor} = ThemebasedStyle.useThemeBasedStyle()
let fill = fillIcon ? Some(primaryColor) : None
switch updateIconName {
| None => <Icon name={initialIconName} height=18. width=18. ?fill />
| Some(updateIcon... | 202 | 10,693 |
hyperswitch-client-core | src/components/common/CustomView.res | .res | open ReactNative
open Style
type modalPosition = [#center | #top | #bottom]
@react.component
let make = (
~onDismiss=() => (),
~children,
~closeOnClickOutSide=true,
~modalPosition=#bottom,
~bottomModalWidth=100.->pct,
(),
) => {
let (viewPortContants, _) = React.useContext(ViewportContext.viewPortContext... | 728 | 10,694 |
hyperswitch-client-core | src/components/common/CustomRadioButton.res | .res | open ReactNative
open Style
@react.component
let make = (~size=18., ~selected, ~color="#006DF9") => {
<View
style={viewStyle(
~height=size->dp,
~width=size->dp,
~borderRadius=size /. 2.,
~borderWidth=1.,
~borderColor=selected ? color : "lightgray",
~alignItems=#center,
~j... | 171 | 10,695 |
hyperswitch-client-core | src/components/common/Space.res | .res | open ReactNative
open Style
@react.component
let make = (~width=15., ~height=15.) => {
<View style={viewStyle(~height=height->dp, ~width=width->dp, ())} />
}
| 53 | 10,696 |
hyperswitch-client-core | src/components/common/SceneView.res | .res | open ReactNative
open Style
type handleEnter = int => unit
@live
type timerFunctionType = {unsubscribe: option<int => int>, timer: option<timeoutId>}
@react.component
let make = (
~children: (~loading: bool) => React.element,
~position as _,
~jumpTo as _,
~indexInFocus,
~lazy_,
~layout: Event.ScrollEvent.... | 485 | 10,697 |
hyperswitch-client-core | src/components/common/Loadericon.res | .res | open ReactNative
open Style
@react.component
let make = (~iconColor=?, ~size=ActivityIndicator.Small) => {
let {component} = ThemebasedStyle.useThemeBasedStyle()
let loderColor = switch iconColor {
| Some(color) => color
| None => component.color
}
<ActivityIndicator
animating={true} size color=loderCo... | 102 | 10,698 |
hyperswitch-client-core | src/components/common/TextWrapper.res | .res | open ReactNative
open Style
type textType =
| HeadingBold
| Heading
| Subheading
| SubheadingBold
| ModalTextLight
| ModalText
| ModalTextBold
| PlaceholderText
| PlaceholderTextBold
| ErrorText
| ErrorTextBold
| ButtonText
| ButtonTextBold
| LinkText
| LinkTextBold
| CardTextBold
| C... | 1,205 | 10,699 |
hyperswitch-client-core | src/components/common/CustomPicker.res | .res | open ReactNative
open Style
type customPickerType = {
label: string,
value: string,
icon?: string,
}
@react.component
let make = (
~value,
~setValue,
~borderBottomLeftRadius=0.,
~borderBottomRightRadius=0.,
~borderBottomWidth=0.,
~disabled=false,
~placeholderText,
~items: array<customPickerType>... | 1,395 | 10,700 |
hyperswitch-client-core | src/components/common/DynamicFields.res | .res | open ReactNative
open Style
open RequiredFieldsTypes
module RenderField = {
let getStateData = (states, country) => {
states
->Utils.getStateNames(country)
->Array.map((item): CustomPicker.customPickerType => {
{
label: item.label != "" ? item.label ++ " - " ++ item.value : item.value,
... | 4,072 | 10,701 |
hyperswitch-client-core | src/components/common/CustomKeyboardAvoidingView.res | .res | open ReactNative
open Style
@react.component
let make = (~children, ~style, ~keyboardVerticalOffset=48.) => {
let frame = React.useRef(None)
let keyboardEvent = React.useRef(None)
let (bottom, setBottom) = React.useState(() => 0.)
let relativeKeyboardHeight = async (keyboardFrame: Keyboard.screenRect) => {
... | 628 | 10,702 |
hyperswitch-client-core | src/components/common/CustomPressable.res | .res | open ReactNative
@react.component
let make = (
~onPress=?,
~children=?,
~style=?,
~disabled=?,
~accessibilityRole=?,
~accessibilityState=?,
~accessibilityLabel=?,
~testID=?,
~activeOpacity as _=?,
) => {
<Pressable ?onPress children=?{React.useMemo1(_ =>
switch children {
| Some(childre... | 173 | 10,703 |
hyperswitch-client-core | src/components/common/ErrorText.res | .res | @react.component
let make = (~text=None) => {
switch text {
| None => React.null
| Some(val) =>
val == ""
? React.null
: <>
<TextWrapper textType={ErrorText}> {val->React.string} </TextWrapper>
</>
}
}
| 67 | 10,704 |
hyperswitch-client-core | src/components/common/CustomTabView.res | .res | open ReactNative
open Style
@react.component
let make = (
~hocComponentArr: array<PMListModifier.hoc>=[],
~loading=true,
~setConfirmButtonDataRef,
) => {
let (indexInFocus, setIndexInFocus) = React.useState(_ => 0)
let setIndexInFocus = React.useCallback1(ind => setIndexInFocus(_ => ind), [setIndexInFocus])
... | 577 | 10,705 |
hyperswitch-client-core | src/components/common/TopTabScreenWraper.res | .res | open ReactNative
open Style
@react.component
let make = (~children, ~setDynamicHeight, ~isScreenFocus) => {
let (viewHeight, setViewHeight) = React.useState(_ => 100.)
let updateTabHeight = (event: Event.layoutEvent) => {
let {height} = event.nativeEvent.layout
if height > 100. && (viewHeight -. height)->M... | 218 | 10,706 |
hyperswitch-client-core | src/components/common/TabView.res | .res | open ReactNative
open Style
type isRTL = {isRTL: bool}
type i18nManager = {getConstants: unit => isRTL}
@val @scope("ReactNative") external i18nManager: i18nManager = "I18nManager"
type initialLayout = {
height?: float,
width?: float,
}
@live
type state = {navigationState: TabViewType.navigationState}
@react.com... | 867 | 10,707 |
hyperswitch-client-core | src/components/common/TouchableOpacity/TouchableOpacityImpl.native.res | .res | type props = ReactNative.TouchableOpacity.props
let make = ReactNative.TouchableOpacity.make
| 18 | 10,708 |
hyperswitch-client-core | src/components/common/TouchableOpacity/TouchableOpacityImpl.web.res | .res | let make = CustomPressable.make
| 8 | 10,709 |
hyperswitch-client-core | src/components/common/TouchableOpacity/CustomTouchableOpacity.res | .res | @module("./TouchableOpacityImpl")
external make: React.component<ReactNative.TouchableOpacity.props> = "make"
| 22 | 10,710 |
hyperswitch-client-core | src/components/common/Tooltip/TooltipTypes.res | .res | type positionX = Left(float) | Right(float)
type positionY = Top(float) | Bottom(float)
type tooltipPosition = {
x: positionX,
y: positionY,
}
| 40 | 10,711 |
hyperswitch-client-core | src/components/common/Tooltip/Tooltip.res | .res | open ReactNative
open Style
@react.component
let make = (
~children: React.element,
~renderContent: (_ => unit) => React.element,
~maxHeight=200.,
~maxWidth=200.,
~adjustment=2.,
~containerStyle=?,
~backgroundColor=?,
~disabled=false,
~keyboardShouldPersistTaps=false,
) => {
let {
component,
... | 919 | 10,712 |
hyperswitch-client-core | src/components/common/CustomLoader/CustomLoader.res | .res | type props = {
height?: string,
width?: string,
speed?: float,
radius?: float,
style?: ReactNative.Style.t,
}
@module("./CustomLoaderImpl")
external make: React.component<props> = "make"
| 52 | 10,713 |
hyperswitch-client-core | src/components/common/CustomLoader/CustomLoaderImpl.web.res | .res | module ContentLoaderWeb = {
@module("react-content-loader") @react.component
external make: (
~speed: float,
~width: string,
~height: string,
~viewBox: string=?,
~backgroundColor: string=?,
~foregroundColor: string=?,
~style: ReactNative.Style.t=?,
~children: React.element,
) => Re... | 335 | 10,714 |
hyperswitch-client-core | src/components/common/CustomLoader/CustomLoaderImpl.native.res | .res | module ContentLoaderNative = {
@module("react-content-loader/native") @react.component
external make: (
~speed: float,
~width: string,
~height: string,
~viewBox: string=?,
~backgroundColor: string=?,
~foregroundColor: string=?,
~style: ReactNative.Style.t=?,
~children: React.element,... | 406 | 10,715 |
hyperswitch-client-core | src/hooks/LightDarkTheme.res | .res | // let useIsDarkMode = () => {
// let (theme, _) = React.useContext(ThemeContext.themeContext)
// theme->Option.getOr(#dark) == #dark
// }
open ReactNative
let useIsDarkMode = () => {
switch Appearance.useColorScheme()->Option.getOr(#light) {
| #dark => true
| #light => false
}
}
| 87 | 10,716 |
hyperswitch-client-core | src/hooks/GetLocale.res | .res | let useGetLocalObj = () => {
let (localeStrings, _) = React.useContext(LocaleStringDataContext.localeDataContext)
switch localeStrings {
| Some(data) => data
| _ => LocaleDataType.defaultLocale
}
}
| 51 | 10,717 |
hyperswitch-client-core | src/hooks/SDKLoadCheckHook.res | .res | let useSDKLoadCheck = (~enablePartialLoading=true) => {
let samsungPayValidity = SamsungPay.useSamsungPayValidityHook()
let (localeStrings, _) = React.useContext(LocaleStringDataContext.localeDataContext)
let (canLoad, setCanLoad) = React.useState(_ => false)
let checkIsSDKAbleToLoad = () => {
if enablePar... | 175 | 10,718 |
hyperswitch-client-core | src/hooks/ThemebasedStyle.res | .res | open ReactNative
open Style
type statusColorConfig = {
textColor: ReactNative.Color.t,
backgroundColor: ReactNative.Color.t,
}
type buttonColorConfig = (string, string)
type componentConfig = {
background: ReactNative.Color.t,
borderColor: ReactNative.Color.t,
dividerColor: ReactNative.Color.t,
color: Rea... | 8,945 | 10,719 |
hyperswitch-client-core | src/hooks/BrowserHook.res | .res | type animations = {
startEnter: string,
startExit: string,
endEnter: string,
endExit: string,
}
type properties = {
dismissButtonStyle: string,
preferredBarTintColor: string,
preferredControlTintColor: string,
readerMode: bool,
animated: bool,
modalPresentationStyle: string,
modalTransitionStyle:... | 1,377 | 10,720 |
hyperswitch-client-core | src/hooks/WebButtonHook.res | .res | let usePayButton = () => {
let (nativeProp, _) = React.useContext(NativePropContext.nativePropContext)
let {
applePayButtonColor,
googlePayButtonColor,
buttonBorderRadius,
} = ThemebasedStyle.useThemeBasedStyle()
let {launchApplePay, launchGPay} = WebKit.useWebKit()
let addApplePay = (~sessionObj... | 849 | 10,721 |
hyperswitch-client-core | src/hooks/CountryStateDataHookTypes.res | .res | type country = {
isoAlpha2: string,
timeZones: array<string>,
value: string,
label: string,
}
type state = {
label: string,
value: string,
code: string,
}
type states = Dict.t<array<state>>
type countries = array<country>
type countryStateData = {
countries: countries,
states: states,
}
let defaultTim... | 111 | 10,722 |
hyperswitch-client-core | src/hooks/NetceteraThreeDsHooks.res | .res | open ExternalThreeDsTypes
open ThreeDsUtils
open SdkStatusMessages
let isInitialisedPromiseRef = ref(None)
let initialisedNetceteraOnce = (~netceteraSDKApiKey, ~sdkEnvironment) => {
switch isInitialisedPromiseRef.contents {
| Some(promiseVal) => promiseVal
| None => {
let promiseVal = Promise.make((resolve... | 3,293 | 10,723 |
hyperswitch-client-core | src/hooks/CommonHooks.res | .res | let fetchApi = (
~uri,
~bodyStr: string="",
~headers,
~method_: Fetch.requestMethod,
~mode: option<Fetch.requestMode>=?,
~dontUseDefaultHeader=false,
(),
) => {
if !dontUseDefaultHeader {
Dict.set(headers, "Content-Type", "application/json")
Dict.set(headers, "X-Client-Platform", WebKit.platform... | 242 | 10,724 |
hyperswitch-client-core | src/hooks/S3ApiHook.res | .res | open CountryStateDataHookTypes
let decodeCountryArray: array<Js.Json.t> => array<country> = data => {
data->Array.map(item => {
switch item->Js.Json.decodeObject {
| Some(res) => {
isoAlpha2: Utils.getString(res, "isoAlpha2", ""),
timeZones: Utils.getStrArray(res, "timeZones"),
value:... | 2,552 | 10,725 |
hyperswitch-client-core | src/hooks/LoggerHook.res | .res | open LoggerTypes
open LoggerUtils
let useCalculateLatency = () => {
let (events, _setEvents) = React.useContext(LoggerContext.loggingContext)
eventName => {
let currentTimestamp = Date.now()
let isRequest = eventName->String.includes("_INIT")
let latency = switch eventName {
| "PAYMENT_ATTEMPT" => ... | 1,512 | 10,726 |
hyperswitch-client-core | src/hooks/FontFamily.res | .res | let convertFontToGoogleFontURL = fontName => {
let normalizedFontName =
fontName
->String.splitByRegExp("/[_\s]+/"->RegExp.fromString)
->Array.map(word =>
switch word {
| Some(word) =>
word->String.charAt(0)->String.toUpperCase ++
word->String.slice(~start=1, ~end=word->Strin... | 270 | 10,727 |
hyperswitch-client-core | src/hooks/SamsungPay.res | .res | open SamsungPayType
type samsungPayWalletValidity = Checking | Valid | Invalid | Not_Started
let val = ref(Not_Started)
let isSamsungPayValid = state => {
state != Checking && state != Not_Started
}
let useSamsungPayValidityHook = () => {
let (state, setState) = React.useState(_ => val.contents)
let isSamsungP... | 737 | 10,728 |
hyperswitch-client-core | src/hooks/WindowDimension.res | .res | type mediaView = Mobile | Tablet | Desktop
let useMediaView = () => {
let {width} = ReactNative.Dimensions.useWindowDimensions()
() => {
if width < 441.0 {
Mobile
} else if width < 830.0 {
Tablet
} else {
Desktop
}
}
}
let useIsMobileView = () => {
useMediaView()() == Mobile
... | 98 | 10,729 |
hyperswitch-client-core | src/hooks/PMListModifier.res | .res | type hoc = {
name: string,
componentHoc: (
~isScreenFocus: bool,
~setConfirmButtonDataRef: React.element => unit,
) => React.element,
}
type walletProp = {
walletType: PaymentMethodListType.payment_method_types_wallet,
sessionObject: SessionsType.sessions,
}
type paymentList = {
tabArr: array<hoc>... | 3,043 | 10,730 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.