Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: proper identification of reactHyperJs from hyperswitch #299

Merged
merged 6 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions src/libraries/HyperSwitch/HyperSwitch.res

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,44 @@ type appearanceType = {
rules: Js.Json.t,
}
type updateType = {appearance: appearanceType}

@module("@juspay-tech/hyper-js")
external loadHyper: string => hyperPromise = "loadHyper"

@module("@juspay-tech/react-hyper-js")
external useHyper: unit => hyperType = "useHyper"
@module("@juspay-tech/react-hyper-js")
external useElements: unit => hyperType = "useElements"

module Elements = {
@module("@juspay-tech/react-hyper-js") @react.component
external make: (
~options: options,
~stripe: hyperPromise,
~children: React.element,
) => React.element = "Elements"
}

module PaymentElement = {
@module("@juspay-tech/react-hyper-js") @react.component
external make: (~id: string, ~options: options2) => React.element = "PaymentElement"
}

module CardWidget = {
@module("@juspay-tech/react-hyper-js") @react.component
external make: (~id: string, ~options: options2) => React.element = "CardWidget"
}

module ElementsTest = {
@module("@juspay-tech/react-hyper-js") @react.component
external make: (
~options: optionsTest,
~stripe: hyperPromise,
~children: React.element,
) => React.element = "Elements"
}

module PaymentElementTest = {
@module("@juspay-tech/react-hyper-js") @react.component
external make: (~id: string, ~options: options2) => React.element = "PaymentElement"
}
4 changes: 2 additions & 2 deletions src/libraries/Window.res
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ external removeEventListener: (string, listener<'ev>) => unit = "removeEventList
external postMessage: (Js.Json.t, string) => unit = "postMessage"

@val @scope("window")
external checkLoadHyper: option<HyperSwitchTypes.hyperloader> = "Hyper"
external checkLoadHyper: option<ReactHyperJs.hyperloader> = "Hyper"

@val @scope("window")
external loadHyper: string => HyperSwitchTypes.hyperloader = "Hyper"
external loadHyper: string => ReactHyperJs.hyperloader = "Hyper"

type rec selectionObj = {\"type": string}
@val @scope("window") external getSelection: unit => selectionObj = "getSelection"
Expand Down
2 changes: 1 addition & 1 deletion src/screens/HyperSwitch/Home/HomeUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type resourcesTypes = {
id: string,
}

let countries: array<HyperSwitchTypes.country> = [
let countries: array<ReactHyperJs.country> = [
{
isoAlpha3: "USA",
currency: "USD",
Expand Down
2 changes: 1 addition & 1 deletion src/screens/HyperSwitch/SDKPayment/TestPayment.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let make = (
) => {
open APIUtils
open LogicUtils
open HyperSwitchTypes
open ReactHyperJs

let updateDetails = useUpdateMethod(~showErrorToast=false, ())
let (clientSecret, setClientSecret) = React.useState(_ => None)
Expand Down
3 changes: 1 addition & 2 deletions src/screens/HyperSwitch/SDKPayment/WebSDK.res
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
open HyperSwitch
open HyperSwitchTypes
open ReactHyperJs
open Promise

type configElements = {
Expand Down
Loading