From aa0d088c7c56425ff815564cf79e740996649751 Mon Sep 17 00:00:00 2001 From: sakksham7 <130480324+sakksham7@users.noreply.github.com> Date: Mon, 23 Dec 2024 16:00:00 +0530 Subject: [PATCH 1/6] fix: display saved method screen condition and dynamic fields values updation issue in saved card screen (#848) --- src/Components/DynamicFields.res | 2 +- src/Components/SavedCardItem.res | 9 +++++++++ src/Components/SavedMethods.res | 3 ++- src/PaymentElement.res | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Components/DynamicFields.res b/src/Components/DynamicFields.res index 734cfc1b..964f9af4 100644 --- a/src/Components/DynamicFields.res +++ b/src/Components/DynamicFields.res @@ -328,7 +328,7 @@ let make = ( let spacedStylesForBiilingDetails = isSpacedInnerLayout ? "p-2" : "my-2" - Array.length > 0}> + Array.length > 0}> {<> {dynamicFieldsToRenderOutsideBilling ->Array.mapWithIndex((item, index) => { diff --git a/src/Components/SavedCardItem.res b/src/Components/SavedCardItem.res index 71a349a1..7cd8d3f3 100644 --- a/src/Components/SavedCardItem.res +++ b/src/Components/SavedCardItem.res @@ -37,6 +37,7 @@ let make = ( ~savedCardlength, ~cvcProps, ~paymentType, + ~setRequiredFieldsBody, ) => { let {themeObj, config, localeString} = Recoil.useRecoilValueFromAtom(RecoilAtoms.configAtom) let {hideExpiredPaymentMethods, displayDefaultSavedPaymentIcon} = Recoil.useRecoilValueFromAtom( @@ -207,6 +208,14 @@ let make = ( + Dict.make()) + let (requiredFieldsBody, setRequiredFieldsBody) = React.useState(_ => Dict.make()) let loggerState = Recoil.useRecoilValueFromAtom(RecoilAtoms.loggerAtom) let setUserError = message => { postFailedSubmitResponse(~errortype="validation_error", ~message) @@ -60,6 +60,7 @@ let make = ( savedCardlength cvcProps paymentType + setRequiredFieldsBody /> ) ->React.array} diff --git a/src/PaymentElement.res b/src/PaymentElement.res index e97420f6..911a7707 100644 --- a/src/PaymentElement.res +++ b/src/PaymentElement.res @@ -100,7 +100,7 @@ let make = (~cardProps, ~expiryProps, ~cvcProps, ~paymentType: CardThemeType.mod ? NoResult(isGuestCustomer) : LoadedSavedCards(finalSavedPaymentMethods, isGuestCustomer) ) - setShowFields(prev => finalSavedPaymentMethods->Array.length == 0 || prev) + setShowFields(_ => finalSavedPaymentMethods->Array.length == 0) } | (_, NoResult(isGuestCustomer)) => { setLoadSavedCards(_ => NoResult(isGuestCustomer)) From 6463d26565180af1ff8d18601182d3ad85d07157 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 23 Dec 2024 10:32:09 +0000 Subject: [PATCH 2/6] chore(release): 0.106.14 [skip ci] ## [0.106.14](https://github.com/juspay/hyperswitch-web/compare/v0.106.13...v0.106.14) (2024-12-23) ### Bug Fixes * display saved method screen condition and dynamic fields values updation issue in saved card screen ([#848](https://github.com/juspay/hyperswitch-web/issues/848)) ([aa0d088](https://github.com/juspay/hyperswitch-web/commit/aa0d088c7c56425ff815564cf79e740996649751)) --- 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 3c567e17..b8785a20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.106.14](https://github.com/juspay/hyperswitch-web/compare/v0.106.13...v0.106.14) (2024-12-23) + + +### Bug Fixes + +* display saved method screen condition and dynamic fields values updation issue in saved card screen ([#848](https://github.com/juspay/hyperswitch-web/issues/848)) ([aa0d088](https://github.com/juspay/hyperswitch-web/commit/aa0d088c7c56425ff815564cf79e740996649751)) + ## [0.106.13](https://github.com/juspay/hyperswitch-web/compare/v0.106.12...v0.106.13) (2024-12-19) ## [0.106.12](https://github.com/juspay/hyperswitch-web/compare/v0.106.11...v0.106.12) (2024-12-18) diff --git a/package-lock.json b/package-lock.json index 3fb7434b..fcaea097 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.106.13", + "version": "0.106.14", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.106.13", + "version": "0.106.14", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 88868232..c90183e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.106.13", + "version": "0.106.14", "main": "index.js", "private": true, "dependencies": { From ef1bd8521a58be3e61e088cf60c9e4a88b7e82fc Mon Sep 17 00:00:00 2001 From: sakksham7 <130480324+sakksham7@users.noreply.github.com> Date: Mon, 23 Dec 2024 17:34:16 +0530 Subject: [PATCH 3/6] fix: saved cards screen cards validity issue (#849) Co-authored-by: Pritish Budhiraja --- src/Components/DynamicFields.res | 1 + src/Utilities/DynamicFieldsUtils.res | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Components/DynamicFields.res b/src/Components/DynamicFields.res index 964f9af4..611a2e42 100644 --- a/src/Components/DynamicFields.res +++ b/src/Components/DynamicFields.res @@ -269,6 +269,7 @@ let make = ( ~cardNumber, ~cardExpiry, ~cvcNumber, + ~isSavedCardFlow, ) useSetInitialRequiredFields( diff --git a/src/Utilities/DynamicFieldsUtils.res b/src/Utilities/DynamicFieldsUtils.res index 46329eb8..852150e8 100644 --- a/src/Utilities/DynamicFieldsUtils.res +++ b/src/Utilities/DynamicFieldsUtils.res @@ -134,6 +134,7 @@ let useRequiredFieldsEmptyAndValid = ( ~cardNumber, ~cardExpiry, ~cvcNumber, + ~isSavedCardFlow, ) => { let email = Recoil.useRecoilValueFromAtom(userEmailAddress) let vpaId = Recoil.useRecoilValueFromAtom(userVpaId) @@ -208,7 +209,7 @@ let useRequiredFieldsEmptyAndValid = ( | _ => true } }) - setAreRequiredFieldsValid(_ => areRequiredFieldsValid) + setAreRequiredFieldsValid(_ => isSavedCardFlow || areRequiredFieldsValid) let areRequiredFieldsEmpty = fieldsArrWithBillingAddress->Array.reduce(false, ( acc, From 4b740d0cf1f8b6e4e2ac6cb06feb5785f4174db8 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 23 Dec 2024 12:06:12 +0000 Subject: [PATCH 4/6] chore(release): 0.106.15 [skip ci] ## [0.106.15](https://github.com/juspay/hyperswitch-web/compare/v0.106.14...v0.106.15) (2024-12-23) ### Bug Fixes * saved cards screen cards validity issue ([#849](https://github.com/juspay/hyperswitch-web/issues/849)) ([ef1bd85](https://github.com/juspay/hyperswitch-web/commit/ef1bd8521a58be3e61e088cf60c9e4a88b7e82fc)) --- 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 b8785a20..f81f71f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [0.106.15](https://github.com/juspay/hyperswitch-web/compare/v0.106.14...v0.106.15) (2024-12-23) + + +### Bug Fixes + +* saved cards screen cards validity issue ([#849](https://github.com/juspay/hyperswitch-web/issues/849)) ([ef1bd85](https://github.com/juspay/hyperswitch-web/commit/ef1bd8521a58be3e61e088cf60c9e4a88b7e82fc)) + ## [0.106.14](https://github.com/juspay/hyperswitch-web/compare/v0.106.13...v0.106.14) (2024-12-23) diff --git a/package-lock.json b/package-lock.json index fcaea097..3f5c9244 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.106.14", + "version": "0.106.15", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.106.14", + "version": "0.106.15", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index c90183e6..05d763e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.106.14", + "version": "0.106.15", "main": "index.js", "private": true, "dependencies": { From 821f43d940c5389a7113292756fce287cf6e5992 Mon Sep 17 00:00:00 2001 From: Pritish Budhiraja Date: Wed, 25 Dec 2024 12:12:28 +0530 Subject: [PATCH 5/6] chore: separation of builds for v1 and v2 (#847) --- package.json | 8 ++++++-- src/GlobalVars.res | 1 + webpack.common.js | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 05d763e4..09ee9564 100644 --- a/package.json +++ b/package.json @@ -17,10 +17,14 @@ }, "scripts": { "build": "webpack --config webpack.common.js", + "build:v2": "cross-env SDK_VERSION=v2 webpack --config webpack.common.js", "build:integ": "cross-env sdkEnv=integ webpack --config webpack.common.js", - "build:playground": "npm run setup:playground && npm run build", - "build:prod": "cross-env sdkEnv=prod webpack --config webpack.common.js", + "build:playground": "npm run setup:playground && webpack --config webpack.common.js", "build:sandbox": "cross-env sdkEnv=sandbox webpack --config webpack.common.js", + "build:prod": "cross-env sdkEnv=prod webpack --config webpack.common.js", + "build:integ:v2": "cross-env sdkEnv=integ SDK_VERSION=v2 webpack --config webpack.common.js", + "build:sandbox:v2": "cross-env sdkEnv=sandbox SDK_VERSION=v2 webpack --config webpack.common.js", + "build:prod:v2": "cross-env sdkEnv=prod SDK_VERSION=v2 webpack --config webpack.common.js", "deploy-to-s3": "node ./scripts/pushToS3.js", "postinstall": "cd Hyperswitch-React-Demo-App && npm i", "prepare": "husky install", diff --git a/src/GlobalVars.res b/src/GlobalVars.res index e7be7c34..ab5375c7 100644 --- a/src/GlobalVars.res +++ b/src/GlobalVars.res @@ -10,6 +10,7 @@ @val external enableLogging: bool = "enableLogging" @val external loggingLevelStr: string = "loggingLevel" @val external maxLogsPushedPerEventName: int = "maxLogsPushedPerEventName" +@val external sdkVersion: string = "sdkVersion" let targetOrigin: string = "*" let isInteg = sdkUrl === "https://dev.hyperswitch.io" let isSandbox = sdkUrl === "https://beta.hyperswitch.io" || sdkUrl === "http://localhost:9050" diff --git a/webpack.common.js b/webpack.common.js index 70f19b55..f4d21ae1 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -19,11 +19,21 @@ const envSdkUrl = getEnvVariable("ENV_SDK_URL", ""); const envBackendUrl = getEnvVariable("ENV_BACKEND_URL", ""); const envLoggingUrl = getEnvVariable("ENV_LOGGING_URL", ""); +/* +* SDK Version Compatibility: + +* v0: Compatible with API v1 +* v1: Compatible with API v1 +* v2: Compatible with API v2 + +* The default SDK version is "v1". +*/ +const sdkVersion = getEnvVariable("SDK_VERSION", "v1"); + const repoVersion = require("./package.json").version; -const majorVersion = "v" + repoVersion.split(".")[0]; const repoName = require("./package.json").name; const repoPublicPath = - sdkEnv === "local" ? "" : `/web/${repoVersion}/${majorVersion}`; + sdkEnv === "local" ? "" : `/web/${repoVersion}/${sdkVersion}`; const getSdkUrl = (env, customUrl) => { if (customUrl) return customUrl; @@ -81,6 +91,7 @@ module.exports = (publicPath = "auto") => { enableLogging: ENABLE_LOGGING, loggingLevel: JSON.stringify(loggingLevel), maxLogsPushedPerEventName: JSON.stringify(maxLogsPushedPerEventName), + sdkVersion: JSON.stringify(sdkVersion), }; const plugins = [ @@ -137,7 +148,7 @@ module.exports = (publicPath = "auto") => { output: { path: sdkEnv && sdkEnv !== "local" - ? path.resolve(__dirname, "dist", sdkEnv) + ? path.resolve(__dirname, "dist", sdkEnv, sdkVersion) : path.resolve(__dirname, "dist"), clean: true, publicPath: `${repoPublicPath}/`, From 86b2638653de75d78a2f88c21453a1e0f85de6f4 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 25 Dec 2024 06:44:17 +0000 Subject: [PATCH 6/6] chore(release): 0.106.16 [skip ci] ## [0.106.16](https://github.com/juspay/hyperswitch-web/compare/v0.106.15...v0.106.16) (2024-12-25) --- CHANGELOG.md | 2 ++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f81f71f0..d0340be3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## [0.106.16](https://github.com/juspay/hyperswitch-web/compare/v0.106.15...v0.106.16) (2024-12-25) + ## [0.106.15](https://github.com/juspay/hyperswitch-web/compare/v0.106.14...v0.106.15) (2024-12-23) diff --git a/package-lock.json b/package-lock.json index 3f5c9244..aa07670a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "orca-payment-page", - "version": "0.106.15", + "version": "0.106.16", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "orca-payment-page", - "version": "0.106.15", + "version": "0.106.16", "hasInstallScript": true, "dependencies": { "@glennsl/rescript-fetch": "^0.2.0", diff --git a/package.json b/package.json index 09ee9564..e9c0ba1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orca-payment-page", - "version": "0.106.15", + "version": "0.106.16", "main": "index.js", "private": true, "dependencies": {