Skip to content

Commit

Permalink
Merge branch 'main' into log-event-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
PritishBudhiraja authored Aug 22, 2024
2 parents be98292 + 8a10f88 commit a0bfd8a
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 21 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [0.84.3](https://github.com/juspay/hyperswitch-web/compare/v0.84.2...v0.84.3) (2024-08-22)

## [0.84.2](https://github.com/juspay/hyperswitch-web/compare/v0.84.1...v0.84.2) (2024-08-22)


### Bug Fixes

* google pay button border ([#570](https://github.com/juspay/hyperswitch-web/issues/570)) ([44be5b6](https://github.com/juspay/hyperswitch-web/commit/44be5b69ed95d081d178d9dbed74e9ddcc336a56))

## [0.84.1](https://github.com/juspay/hyperswitch-web/compare/v0.84.0...v0.84.1) (2024-08-13)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orca-payment-page",
"version": "0.84.1",
"version": "0.84.3",
"main": "index.js",
"private": true,
"dependencies": {
Expand Down
6 changes: 1 addition & 5 deletions src/Components/PayNowButton.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,13 @@ let make = () => {
open RecoilAtoms
open Utils
let (showLoader, setShowLoader) = React.useState(() => false)
let (isPayNowButtonDisable, setIsPayNowButtonDisable) = React.useState(() => false)
let {themeObj, localeString} = configAtom->Recoil.useRecoilValueFromAtom
let {sdkHandleConfirmPayment} = optionAtom->Recoil.useRecoilValueFromAtom
let (isPayNowButtonDisable, setIsPayNowButtonDisable) = payNowButtonDisable->Recoil.useRecoilState

let confirmPayload = sdkHandleConfirmPayment->PaymentBody.confirmPayloadForSDKButton
let buttonText = sdkHandleConfirmPayment.buttonText->Option.getOr(localeString.payNowButton)

React.useEffect1(() => {
setIsPayNowButtonDisable(_ => !sdkHandleConfirmPayment.allowButtonBeforeValidation)
None
}, [sdkHandleConfirmPayment.allowButtonBeforeValidation])

let handleMessage = (event: Types.event) => {
let json = event.data->Identity.anyTypeToJson->getStringFromJson("")->safeParse
Expand Down
6 changes: 0 additions & 6 deletions src/Hooks/UtilityHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ let useHandlePostMessages = (~complete, ~empty, ~paymentType, ~savedMethod=false
open RecoilAtoms

let loggerState = Recoil.useRecoilValueFromAtom(loggerAtom)
let setIsPayNowButtonDisable = Recoil.useSetRecoilState(payNowButtonDisable)
let {sdkHandleConfirmPayment} = Recoil.useRecoilValueFromAtom(optionAtom)

React.useEffect(() => {
if !sdkHandleConfirmPayment.allowButtonBeforeValidation {
let isCompletelyFilled = complete && paymentType !== ""
setIsPayNowButtonDisable(_ => !isCompletelyFilled)
}
Utils.handlePostMessageEvents(~complete, ~empty, ~paymentType, ~loggerState, ~savedMethod)
None
}, (complete, empty, paymentType))
Expand Down
1 change: 1 addition & 0 deletions src/RenderPaymentMethods.res
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ let make = (
background: "transparent",
marginLeft: "4px",
marginRight: "4px",
marginTop: "4px",
fontFamily: themeObj.fontFamily,
fontSize: themeObj.fontSizeBase,
filter: blur,
Expand Down
3 changes: 0 additions & 3 deletions src/TabCard.res
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ let make = (~paymentOption: PaymentMethodsRecord.paymentFieldsInfo, ~isActive: b
let {themeObj, localeString} = Recoil.useRecoilValueFromAtom(configAtom)
let {readOnly, customMethodNames} = Recoil.useRecoilValueFromAtom(optionAtom)
let setSelectedOption = Recoil.useSetRecoilState(selectedOptionAtom)
let {sdkHandleConfirmPayment} = optionAtom->Recoil.useRecoilValueFromAtom
let setIsPayNowButtonDisable = Recoil.useSetRecoilState(payNowButtonDisable)
let (tabClass, tabLabelClass, tabIconClass) = React.useMemo(
() => isActive ? ("Tab--selected", "TabLabel--selected", "TabIcon--selected") : ("", "", ""),
[isActive],
Expand All @@ -17,7 +15,6 @@ let make = (~paymentOption: PaymentMethodsRecord.paymentFieldsInfo, ~isActive: b
paymentOption.icon,
)
let onClick = _ => {
setIsPayNowButtonDisable(_ => !sdkHandleConfirmPayment.allowButtonBeforeValidation)
setSelectedOption(_ => paymentOption.paymentMethodName)
}
<button
Expand Down
3 changes: 0 additions & 3 deletions src/Types/PaymentType.res
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ type sdkHandleConfirmPayment = {
handleConfirm: bool,
buttonText?: string,
confirmParams: ConfirmType.confirmParams,
allowButtonBeforeValidation: bool,
}

type options = {
Expand Down Expand Up @@ -287,7 +286,6 @@ let defaultBillingAddress = {
let defaultSdkHandleConfirmPayment = {
handleConfirm: false,
confirmParams: ConfirmType.defaultConfirm,
allowButtonBeforeValidation: false,
}

let defaultOptions = {
Expand Down Expand Up @@ -985,7 +983,6 @@ let getSdkHandleConfirmPaymentProps = dict => {
handleConfirm: dict->getBool("handleConfirm", false),
buttonText: ?dict->getOptionString("buttonText"),
confirmParams: dict->getDictFromDict("confirmParams")->getConfirmParams,
allowButtonBeforeValidation: dict->getBool("allowButtonBeforeValidation", false),
}

let itemToObjMapper = (dict, logger) => {
Expand Down
1 change: 0 additions & 1 deletion src/Utilities/RecoilAtoms.res
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ let paymentTokenAtom = Recoil.atom(
let showCardFieldsAtom = Recoil.atom("showCardFields", false)
let phoneJson = Recoil.atom("phoneJson", Loading)
let cardBrand = Recoil.atom("cardBrand", "")
let payNowButtonDisable = Recoil.atom("payNowButtonDisable", true)
let paymentMethodCollectOptionAtom = Recoil.atom(
"paymentMethodCollectOptions",
PaymentMethodCollectUtils.defaultPaymentMethodCollectOptions,
Expand Down

0 comments on commit a0bfd8a

Please sign in to comment.