diff --git a/CHANGELOG.md b/CHANGELOG.md index eff617abc..1b7f45086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## [0.55.2](https://github.com/juspay/hyperswitch-web/compare/v0.55.1...v0.55.2) (2024-05-27) + + +### Bug Fixes + +* blik code hyphen removal ([#401](https://github.com/juspay/hyperswitch-web/issues/401)) ([4953f7a](https://github.com/juspay/hyperswitch-web/commit/4953f7a861ed40ebe2c59b139aa06f9b822f8e67)) + +## [0.55.1](https://github.com/juspay/hyperswitch-web/compare/v0.55.0...v0.55.1) (2024-05-27) + + +### Bug Fixes + +* sdk button loader issue ([#400](https://github.com/juspay/hyperswitch-web/issues/400)) ([e012642](https://github.com/juspay/hyperswitch-web/commit/e012642865231e6c2787b828730cfc1c41ebbe36)) + # [0.55.0](https://github.com/juspay/hyperswitch-web/compare/v0.54.2...v0.55.0) (2024-05-23) diff --git a/package-lock.json b/package-lock.json index a5ad45c60..787ce6bb6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.55.0", + "version": "0.55.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.55.0", + "version": "0.55.2", "hasInstallScript": true, "dependencies": { "@aws-sdk/client-cloudfront": "^3.414.0", diff --git a/package.json b/package.json index 3bb7a984a..df8fe0455 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.55.0", + "version": "0.55.2", "main": "index.js", "private": true, "dependencies": { diff --git a/src/Components/PayNowButton.res b/src/Components/PayNowButton.res index 7d4653914..d8795f3d6 100644 --- a/src/Components/PayNowButton.res +++ b/src/Components/PayNowButton.res @@ -21,9 +21,23 @@ let make = () => { let confirmPayload = sdkHandleConfirmPayment->PaymentBody.confirmPayloadForSDKButton let buttonText = sdkHandleConfirmPayment.buttonText->Option.getOr(localeString.payNowButton) + let handleMessage = (event: Types.event) => { + let json = event.data->Identity.anyTypeToJson->getStringFromJson("")->safeParse + let dict = json->getDictFromJson + switch dict->Dict.get("submitSuccessful") { + | Some(submitSuccessfulVal) => + if !(submitSuccessfulVal->JSON.Decode.bool->Option.getOr(false)) { + setIsPayNowButtonDisable(_ => false) + setShowLoader(_ => false) + } + | None => () + } + } + let handleOnClick = _ => { setIsPayNowButtonDisable(_ => true) setShowLoader(_ => true) + EventListenerManager.addSmartEventListener("message", handleMessage, "onSubmitSuccessful") handlePostMessage([("handleSdkConfirm", confirmPayload)]) } diff --git a/src/Payments/PaymentMethodsWrapper.res b/src/Payments/PaymentMethodsWrapper.res index 63089b91a..38b3bff28 100644 --- a/src/Payments/PaymentMethodsWrapper.res +++ b/src/Payments/PaymentMethodsWrapper.res @@ -33,7 +33,6 @@ let make = (~paymentType: CardThemeType.mode, ~paymentMethodName: string) => { let (country, _) = Recoil.useRecoilState(userCountry) let (selectedBank, _) = Recoil.useRecoilState(userBank) let setFieldComplete = Recoil.useSetRecoilState(fieldsComplete) - let cleanBlik = str => str->String.replaceRegExp(%re("/-/g"), "") let cleanPhoneNumber = str => str->String.replaceRegExp(%re("/\s/g"), "") let (requiredFieldsBody, setRequiredFieldsBody) = React.useState(_ => Dict.make()) @@ -79,7 +78,7 @@ let make = (~paymentType: CardThemeType.mode, ~paymentMethodName: string) => { ~fullName=fullName.value, ~email=email.value, ~bank=bank.hyperSwitch, - ~blikCode=blikCode.value->cleanBlik, + ~blikCode=blikCode.value->removeHyphen, ~phoneNumber=cleanPhoneNumber( phoneNumber.countryCode->Option.getOr("") ++ phoneNumber.value, ), diff --git a/src/Utilities/DynamicFieldsUtils.res b/src/Utilities/DynamicFieldsUtils.res index 8477c2cdb..207f95b2f 100644 --- a/src/Utilities/DynamicFieldsUtils.res +++ b/src/Utilities/DynamicFieldsUtils.res @@ -408,7 +408,7 @@ let useRequiredFieldsBody = ( | AddressCity => city.value | AddressPincode => postalCode.value | AddressState => state.value - | BlikCode => blikCode.value + | BlikCode => blikCode.value->Utils.removeHyphen | PhoneNumber => phone.value | Currency(_) => currency | Country => country diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index 35531437c..96371e03b 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -1278,3 +1278,5 @@ let getStateNameFromStateCodeAndCountry = (list: JSON.t, stateCode: string, coun | None => stateCode } } + +let removeHyphen = str => str->String.replaceRegExp(%re("/-/g"), "")