Skip to content
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
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@juspay-tech/react-hyper-js",
"version": "1.2.2",
"version": "1.2.3",
"main": "dist/index.js",
"module": "dist/index.mjs",
"exports": {
Expand Down
12 changes: 11 additions & 1 deletion src/Context.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/Context.res
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type switchContextType = {
confirmCardPayment: (string, option<JSON.t>, option<JSON.t>) => Promise.t<JSON.t>,
retrievePaymentIntent: string => Promise.t<JSON.t>,
paymentRequest: JSON.t => JSON.t,
completeUpdateIntent: string => promise<JSON.t>,
initiateUpdateIntent: unit => promise<JSON.t>,
}

type paymentMethodsManagementSwitchContextType = {
Expand Down Expand Up @@ -109,6 +111,8 @@ let defaultSwitchContext = {
confirmCardPayment: confirmCardPaymentFn,
retrievePaymentIntent: retrievePaymentIntentFn,
paymentRequest,
completeUpdateIntent: _ => Promise.resolve(Dict.make()->JSON.Encode.object),
initiateUpdateIntent: _ => Promise.resolve(Dict.make()->JSON.Encode.object),
}

let switchContext = React.createContext(defaultSwitchContext)
Expand Down
2 changes: 2 additions & 0 deletions src/OrcaJs.res
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ type switchInstance = {
retrievePaymentIntent: string => Promise.t<JSON.t>,
paymentRequest: JSON.t => JSON.t,
paymentMethodsManagementElements: JSON.t => element,
completeUpdateIntent: string => promise<JSON.t>,
initiateUpdateIntent: unit => promise<JSON.t>,
}
6 changes: 5 additions & 1 deletion src/components/Elements.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/components/Elements.res
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let make = (~children, ~stripe: Promise.t<OrcaJs.switchInstance>, ~options: JSON

React.useEffect0(() => {
stripe
->(Js.Promise.then_((switchInstance: OrcaJs.switchInstance) => {
->Js.Promise.then_((switchInstance: OrcaJs.switchInstance) => {
let orcaElementsConfig = switchInstance.elements(options)
let newElemValues: Context.elementsType = {
options: elementOptions,
Expand All @@ -21,12 +21,14 @@ let make = (~children, ~stripe: Promise.t<OrcaJs.switchInstance>, ~options: JSON
retrievePaymentIntent: switchInstance.retrievePaymentIntent,
clientSecret: elementOptions.clientSecret,
paymentRequest: switchInstance.paymentRequest,
completeUpdateIntent: switchInstance.completeUpdateIntent,
initiateUpdateIntent: switchInstance.initiateUpdateIntent,
}

setSwitchState(_ => switchValClone)
setElementsState(_ => newElemValues)
Promise.resolve(switchValClone)
}, _))
}, _)
->ignore
None
})
Expand Down
6 changes: 5 additions & 1 deletion src/components/HyperElements.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/components/HyperElements.res
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let make = (~children, ~hyper: Promise.t<OrcaJs.switchInstance>, ~options: JSON.

React.useEffect0(() => {
hyper
->(Js.Promise.then_((switchInstance: OrcaJs.switchInstance) => {
->Js.Promise.then_((switchInstance: OrcaJs.switchInstance) => {
let orcaElementsConfig = switchInstance.elements(options)
let newElemValues: Context.elementsType = {
options: elementOptions,
Expand All @@ -21,12 +21,14 @@ let make = (~children, ~hyper: Promise.t<OrcaJs.switchInstance>, ~options: JSON.
retrievePaymentIntent: switchInstance.retrievePaymentIntent,
clientSecret: elementOptions.clientSecret,
paymentRequest: switchInstance.paymentRequest,
completeUpdateIntent: switchInstance.completeUpdateIntent,
initiateUpdateIntent: switchInstance.initiateUpdateIntent,
}

setSwitchState(_ => switchValClone)
setElementsState(_ => newElemValues)
Promise.resolve(switchValClone)
}, _))
}, _)
->ignore
None
})
Expand Down
Loading