From 31081488d47d81590a980cc147efdb918b2a8235 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Mon, 4 Nov 2024 23:04:19 +0530 Subject: [PATCH 1/6] revert: reverting fetchAPI changes --- src/Utilities/Utils.res | 52 +++++++++++++---------------------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/src/Utilities/Utils.res b/src/Utilities/Utils.res index ebc79bcc..b56fd5f9 100644 --- a/src/Utilities/Utils.res +++ b/src/Utilities/Utils.res @@ -876,14 +876,14 @@ let formatException = exc => | _ => exc->Identity.anyTypeToJson } -let fetchApi = async (uri, ~bodyStr: string="", ~headers=Dict.make(), ~method: Fetch.method) => { - try { - let body = switch method { - | #GET => None - | _ => Some(Fetch.Body.string(bodyStr)) - } - - let response = await Fetch.fetch( +let fetchApi = (uri, ~bodyStr: string="", ~headers=Dict.make(), ~method: Fetch.method) => { + open Promise + let body = switch method { + | #GET => resolve(None) + | _ => resolve(Some(Fetch.Body.string(bodyStr))) + } + body->then(body => { + Fetch.fetch( uri, { method, @@ -891,35 +891,15 @@ let fetchApi = async (uri, ~bodyStr: string="", ~headers=Dict.make(), ~method: F headers: getHeaders(~headers, ~uri), }, ) - - //* Fetch.Response.ok - Response status code - 200-299 - if !(response->Fetch.Response.ok) { - let errorText = await response->Fetch.Response.text - let status = response->Fetch.Response.status - let errorMessage = `FetchError: Failed to fetch (${status->Int.toString}): ${errorText}` - Error.raise(Error.make(errorMessage)) - } - - response - } catch { - | Exn.Error(error) => { - let errorMessage = switch Exn.message(error) { - | Some(msg) => msg - | None => "Unknown error occurred" - } - - let enhancedError = Error.make(`APIError: ${errorMessage} (URL: ${uri})`) - Error.raise(enhancedError) - } - | err => { - let exceptionVal = err->formatException->getDictFromJson - let errorMessage = exceptionVal->getString("message", "Unknown error") - let errorType = exceptionVal->getString("type", "Unknown") - let networkError = Error.make(`${errorType}: ${errorMessage} (URL: ${uri})`) - Error.raise(networkError) - } - } + ->catch(err => { + reject(err) + }) + ->then(resp => { + resolve(resp) + }) + }) } + let arrayJsonToCamelCase = arr => { arr->Array.map(item => { item->transformKeys(CamelCase) From 0284bb3cd9bc44e54bad4f13fee8c615bf9a6782 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 4 Nov 2024 17:36:56 +0000 Subject: [PATCH 2/6] chore(release): 0.99.2 [skip ci] ## [0.99.2](https://github.com/juspay/hyperswitch-web/compare/v0.99.1...v0.99.2) (2024-11-04) ### Reverts * reverting fetchAPI changes ([3108148](https://github.com/juspay/hyperswitch-web/commit/31081488d47d81590a980cc147efdb918b2a8235)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b67578e..3456350f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.99.2](https://github.com/juspay/hyperswitch-web/compare/v0.99.1...v0.99.2) (2024-11-04) + + +### Reverts + +* reverting fetchAPI changes ([3108148](https://github.com/juspay/hyperswitch-web/commit/31081488d47d81590a980cc147efdb918b2a8235)) + ## [0.99.1](https://github.com/juspay/hyperswitch-web/compare/v0.99.0...v0.99.1) (2024-11-04) diff --git a/package-lock.json b/package-lock.json index ab5d10f9..59d250a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.99.1", + "version": "0.99.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.99.1", + "version": "0.99.2", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 3fe8b50f..86091cc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.99.1", + "version": "0.99.2", "main": "index.js", "private": true, "dependencies": { From f629219492ef234c2df76a52a99fb135def7b428 Mon Sep 17 00:00:00 2001 From: aritro2002 Date: Tue, 5 Nov 2024 17:41:47 +0530 Subject: [PATCH 3/6] fix: remove blue border of iframe in firefox (#766) --- src/ThreeDSAuth.res | 8 +++++++- src/ThreeDSMethod.res | 1 + src/index.css | 11 +++++++++++ src/orca-loader/Elements.res | 1 + src/orca-loader/LoaderPaymentElement.res | 2 +- src/orca-loader/PaymentMethodsManagementElements.res | 1 + 6 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ThreeDSAuth.res b/src/ThreeDSAuth.res index 5d5f9a6f..96e0693e 100644 --- a/src/ThreeDSAuth.res +++ b/src/ThreeDSAuth.res @@ -145,7 +145,13 @@ let make = () => {
` let iframeDiv = Window.createElement("div") diff --git a/src/orca-loader/LoaderPaymentElement.res b/src/orca-loader/LoaderPaymentElement.res index 987786f1..b702e6c5 100644 --- a/src/orca-loader/LoaderPaymentElement.res +++ b/src/orca-loader/LoaderPaymentElement.res @@ -385,7 +385,7 @@ let make = ( src="${ApiEndpoint.sdkDomainUrl}/index.html?componentName=${componentType}" allow="payment *" name="orca-payment" - style="border: 0px; ${additionalIframeStyle}" + style="border: 0px; ${additionalIframeStyle} outline: none;" width="100%" >
` diff --git a/src/orca-loader/PaymentMethodsManagementElements.res b/src/orca-loader/PaymentMethodsManagementElements.res index 720a2cf6..e6403f97 100644 --- a/src/orca-loader/PaymentMethodsManagementElements.res +++ b/src/orca-loader/PaymentMethodsManagementElements.res @@ -56,6 +56,7 @@ let make = ( src="${ApiEndpoint.sdkDomainUrl}/index.html?fullscreenType=${componentType}&publishableKey=${publishableKey}&ephemeralKey=${ephemeralKey}&sessionId=${sdkSessionId}&endpoint=${endpoint}&hyperComponentName=${hyperComponentName->getStrFromHyperComponentName}" allow="*" name="orca-payment" + style="outline: none;" > ` let iframeDiv = Window.createElement("div") From 194e1ffaf9999c8b28caf428542f110ab35ee52c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 5 Nov 2024 12:13:49 +0000 Subject: [PATCH 4/6] chore(release): 0.99.3 [skip ci] ## [0.99.3](https://github.com/juspay/hyperswitch-web/compare/v0.99.2...v0.99.3) (2024-11-05) ### Bug Fixes * remove blue border of iframe in firefox ([#766](https://github.com/juspay/hyperswitch-web/issues/766)) ([f629219](https://github.com/juspay/hyperswitch-web/commit/f629219492ef234c2df76a52a99fb135def7b428)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3456350f..2a216ed5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.99.3](https://github.com/juspay/hyperswitch-web/compare/v0.99.2...v0.99.3) (2024-11-05) + + +### Bug Fixes + +* remove blue border of iframe in firefox ([#766](https://github.com/juspay/hyperswitch-web/issues/766)) ([f629219](https://github.com/juspay/hyperswitch-web/commit/f629219492ef234c2df76a52a99fb135def7b428)) + ## [0.99.2](https://github.com/juspay/hyperswitch-web/compare/v0.99.1...v0.99.2) (2024-11-04) diff --git a/package-lock.json b/package-lock.json index 59d250a9..f8b7f955 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.99.2", + "version": "0.99.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.99.2", + "version": "0.99.3", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 86091cc5..a3a3d50b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.99.2", + "version": "0.99.3", "main": "index.js", "private": true, "dependencies": { From 17892d9ff7470ac12e251e878afe9ae9affffd50 Mon Sep 17 00:00:00 2001 From: aritro2002 Date: Tue, 5 Nov 2024 18:28:09 +0530 Subject: [PATCH 5/6] fix: card brand update to prevent multiple error messages (#767) --- src/Payment.res | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Payment.res b/src/Payment.res index 96f876c1..34cb0c97 100644 --- a/src/Payment.res +++ b/src/Payment.res @@ -334,10 +334,11 @@ let make = (~paymentMode, ~integrateError, ~logger) => { "" } else if isCardSupported->Option.getOr(true) { localeString.inValidCardErrorText - } else if cardBrand == "" { - localeString.enterValidCardNumberErrorText } else { - localeString.cardBrandConfiguredErrorText(cardBrand) + switch cardNumber->CardUtils.getCardBrand { + | "" => localeString.inValidCardErrorText + | cardBrandValue => localeString.cardBrandConfiguredErrorText(cardBrandValue) + } } setCardError(_ => cardError) None From 81e8617b0b0560fc03b75e19abc8f88e43c67e4d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 5 Nov 2024 13:00:05 +0000 Subject: [PATCH 6/6] chore(release): 0.99.4 [skip ci] ## [0.99.4](https://github.com/juspay/hyperswitch-web/compare/v0.99.3...v0.99.4) (2024-11-05) ### Bug Fixes * card brand update to prevent multiple error messages ([#767](https://github.com/juspay/hyperswitch-web/issues/767)) ([17892d9](https://github.com/juspay/hyperswitch-web/commit/17892d9ff7470ac12e251e878afe9ae9affffd50)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a216ed5..49573ca8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.99.4](https://github.com/juspay/hyperswitch-web/compare/v0.99.3...v0.99.4) (2024-11-05) + + +### Bug Fixes + +* card brand update to prevent multiple error messages ([#767](https://github.com/juspay/hyperswitch-web/issues/767)) ([17892d9](https://github.com/juspay/hyperswitch-web/commit/17892d9ff7470ac12e251e878afe9ae9affffd50)) + ## [0.99.3](https://github.com/juspay/hyperswitch-web/compare/v0.99.2...v0.99.3) (2024-11-05) diff --git a/package-lock.json b/package-lock.json index f8b7f955..a23e4a2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.99.3", + "version": "0.99.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.99.3", + "version": "0.99.4", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index a3a3d50b..24ef231c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.99.3", + "version": "0.99.4", "main": "index.js", "private": true, "dependencies": {