Skip to content

Commit

Permalink
refactor: refactored lazy loading (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArushKapoorJuspay authored Jul 9, 2024
1 parent a62635c commit b56d391
Show file tree
Hide file tree
Showing 22 changed files with 23 additions and 131 deletions.
11 changes: 1 addition & 10 deletions src/PaymentElementRendererLazy.res
Original file line number Diff line number Diff line change
@@ -1,10 +1 @@
open LazyUtils

type props = {
paymentType: CardThemeType.mode,
cardProps: CardUtils.cardProps,
expiryProps: CardUtils.expiryProps,
cvcProps: CardUtils.cvcProps,
}

let make: props => React.element = reactLazy(() => import_("./PaymentElementRenderer.bs.js"))
let make = React.lazy_(() => Js.import(PaymentElementRenderer.default))
5 changes: 1 addition & 4 deletions src/PaymentManagementLazy.res
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
open LazyUtils

type props = {}
let make: props => React.element = reactLazy(() => import_("./PaymentManagement.bs.js"))
let make = React.lazy_(() => Js.import(PaymentManagement.default))
9 changes: 1 addition & 8 deletions src/PaymentMethodCollectElementLazy.res
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
open LazyUtils

type props = {
integrateError: bool,
logger: OrcaLogger.loggerMake,
}

let make: props => React.element = reactLazy(() => import_("./PaymentMethodCollectElement.bs.js"))
let make = React.lazy_(() => Js.import(PaymentMethodCollectElement.default))
6 changes: 1 addition & 5 deletions src/Payments/ACHBankDebitLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./ACHBankDebit.bs.js"))
let make = React.lazy_(() => Js.import(ACHBankDebit.default))
6 changes: 1 addition & 5 deletions src/Payments/ACHBankTransferLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./ACHBankTransfer.bs.js"))
let make = React.lazy_(() => Js.import(ACHBankTransfer.default))
8 changes: 1 addition & 7 deletions src/Payments/ApplePayLazy.res
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
open LazyUtils

type props = {
sessionObj: option<JSON.t>
}

let make: props => React.element = reactLazy(() => import_("./ApplePay.bs.js"))
let make = React.lazy_(() => Js.import(ApplePay.default))
6 changes: 1 addition & 5 deletions src/Payments/BacsBankDebitLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./BacsBankDebit.bs.js"))
let make = React.lazy_(() => Js.import(BacsBankDebit.default))
3 changes: 2 additions & 1 deletion src/Payments/BacsBankTransfer.res
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
open RecoilAtoms
open Utils

let default = (paymentType: CardThemeType.mode) => {
@react.component
let default = (~paymentType: CardThemeType.mode) => {
let {iframeId} = Recoil.useRecoilValueFromAtom(keys)
let loggerState = Recoil.useRecoilValueFromAtom(loggerAtom)
let {themeObj} = Recoil.useRecoilValueFromAtom(configAtom)
Expand Down
3 changes: 2 additions & 1 deletion src/Payments/BacsBankTransfer.resi
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
let default: CardThemeType.mode => React.element
@react.component
let default: (~paymentType: CardThemeType.mode) => React.element
6 changes: 1 addition & 5 deletions src/Payments/BacsBankTransferLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./BacsBankTransfer.bs.js"))
let make = React.lazy_(() => Js.import(BacsBankTransfer.default))
6 changes: 1 addition & 5 deletions src/Payments/BecsBankDebitLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./BecsBankDebit.bs.js"))
let make = React.lazy_(() => Js.import(BecsBankDebit.default))
6 changes: 1 addition & 5 deletions src/Payments/BoletoLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./Boleto.bs.js"))
let make = React.lazy_(() => Js.import(Boleto.default))
9 changes: 1 addition & 8 deletions src/Payments/GPayLazy.res
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
open LazyUtils

type props = {
sessionObj: option<SessionsType.token>,
thirdPartySessionObj: option<JSON.t>,
}

let make: props => React.element = reactLazy(() => import_("./GPay.bs.js"))
let make = React.lazy_(() => Js.import(GPay.default))
6 changes: 1 addition & 5 deletions src/Payments/KlarnaPaymentLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./KlarnaPayment.bs.js"))
let make = React.lazy_(() => Js.import(KlarnaPayment.default))
6 changes: 1 addition & 5 deletions src/Payments/KlarnaSDKLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {sessionObj: SessionsType.token}

let make: props => React.element = reactLazy(() => import_("./KlarnaSDK.bs.js"))
let make = React.lazy_(() => Js.import(KlarnaSDK.default))
6 changes: 1 addition & 5 deletions src/Payments/PayPalLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {}

let make: props => React.element = reactLazy(() => import_("./PayPal.bs.js"))
let make = React.lazy_(() => Js.import(PayPal.default))
9 changes: 1 addition & 8 deletions src/Payments/PaymentMethodsWrapperLazy.res
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
open LazyUtils

type props = {
paymentType: CardThemeType.mode,
paymentMethodName: string,
}

let make: props => React.element = reactLazy(() => import_("./PaymentMethodsWrapper.bs.js"))
let make = React.lazy_(() => Js.import(PaymentMethodsWrapper.default))
6 changes: 1 addition & 5 deletions src/Payments/PaypalSDKLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {sessionObj: SessionsType.token, paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./PaypalSDK.bs.js"))
let make = React.lazy_(() => Js.import(PaypalSDK.default))
6 changes: 1 addition & 5 deletions src/Payments/SepaBankDebitLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./SepaBankDebit.bs.js"))
let make = React.lazy_(() => Js.import(SepaBankDebit.default))
6 changes: 1 addition & 5 deletions src/Payments/SepaBankTransferLazy.res
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
open LazyUtils

type props = {paymentType: CardThemeType.mode}

let make: props => React.element = reactLazy(() => import_("./SepaBankTransfer.bs.js"))
let make = React.lazy_(() => Js.import(SepaBankTransfer.default))
14 changes: 1 addition & 13 deletions src/SingleLineCardPaymentLazy.res
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
open LazyUtils

type props = {
paymentType: CardThemeType.mode,
cardProps: CardUtils.cardProps,
expiryProps: CardUtils.expiryProps,
cvcProps: CardUtils.cvcProps,
zipProps: CardUtils.zipProps,
handleElementFocus: bool => unit,
isFocus: bool,
}

let make: props => React.element = reactLazy(() => import_("./SingleLineCardPayment.bs.js"))
let make = React.lazy_(() => Js.import(SingleLineCardPayment.default))
11 changes: 0 additions & 11 deletions src/Utilities/LazyUtils.res

This file was deleted.

0 comments on commit b56d391

Please sign in to comment.